Poll UBNT AirFiber radios (AF11X + AF60-LR) every 5 minutes via net-snmp CLI, storing signal metrics in commercial_samples. Fetches ASOS weather alongside each cycle for propagation correlation. Includes 7 seeded link definitions, Oban cron worker, and net-snmp in the Docker image.
85 lines
2.9 KiB
Elixir
85 lines
2.9 KiB
Elixir
defmodule Microwaveprop.Repo.Migrations.SeedCommercialLinks do
|
|
use Ecto.Migration
|
|
|
|
def up do
|
|
now = DateTime.utc_now() |> DateTime.truncate(:second) |> DateTime.to_naive()
|
|
|
|
links = [
|
|
%{
|
|
label: "verona-to-climax",
|
|
host: "10.250.1.26",
|
|
community: "kdyyJrT0Mm",
|
|
radio_type: "af11x",
|
|
endpoint_a: ~s|{"lat":33.246171,"lon":-96.426516,"alt_m":205.4}|,
|
|
endpoint_b: ~s|{"lat":33.187294,"lon":-96.448128,"alt_m":191.0}|,
|
|
weather_station: "KTKI"
|
|
},
|
|
%{
|
|
label: "new-hope-to-core",
|
|
host: "10.250.1.58",
|
|
community: "kdyyJrT0Mm",
|
|
radio_type: "af11x",
|
|
endpoint_a: ~s|{"lat":33.207279,"lon":-96.537762,"alt_m":216.4}|,
|
|
endpoint_b: ~s|{"lat":33.174149,"lon":-96.491943,"alt_m":198.9}|,
|
|
weather_station: "KTKI"
|
|
},
|
|
%{
|
|
label: "core-new-hope",
|
|
host: "10.250.1.61",
|
|
community: "kdyyJrT0Mm",
|
|
radio_type: "af11x",
|
|
endpoint_a: ~s|{"lat":33.174149,"lon":-96.491943,"alt_m":198.9}|,
|
|
endpoint_b: ~s|{"lat":33.207279,"lon":-96.537762,"alt_m":216.4}|,
|
|
weather_station: "KTKI"
|
|
},
|
|
%{
|
|
label: "982_380_60LR",
|
|
host: "10.250.1.34",
|
|
community: "kdyyJrT0Mm",
|
|
radio_type: "af60",
|
|
endpoint_a: ~s|{"lat":33.148921,"lon":-96.4958,"alt_m":186.5}|,
|
|
endpoint_b: ~s|{"lat":33.174135,"lon":-96.491935,"alt_m":200.4}|,
|
|
weather_station: "KTKI"
|
|
},
|
|
%{
|
|
label: "380_982_60LR",
|
|
host: "10.250.1.37",
|
|
community: "kdyyJrT0Mm",
|
|
radio_type: "af60",
|
|
endpoint_a: ~s|{"lat":33.174135,"lon":-96.491935,"alt_m":200.4}|,
|
|
endpoint_b: ~s|{"lat":33.148921,"lon":-96.4958,"alt_m":186.5}|,
|
|
weather_station: "KTKI"
|
|
},
|
|
%{
|
|
label: "core-to-climax",
|
|
host: "10.250.1.93",
|
|
community: "kdyyJrT0Mm",
|
|
radio_type: "af11x",
|
|
endpoint_a: ~s|{"lat":33.174149,"lon":-96.491943,"alt_m":198.9}|,
|
|
endpoint_b: ~s|{"lat":33.187294,"lon":-96.448128,"alt_m":191.0}|,
|
|
weather_station: "KTKI"
|
|
},
|
|
%{
|
|
label: "climax-to-core",
|
|
host: "10.250.1.90",
|
|
community: "kdyyJrT0Mm",
|
|
radio_type: "af11x",
|
|
endpoint_a: ~s|{"lat":33.187294,"lon":-96.448128,"alt_m":191.0}|,
|
|
endpoint_b: ~s|{"lat":33.174149,"lon":-96.491943,"alt_m":198.9}|,
|
|
weather_station: "KTKI"
|
|
}
|
|
]
|
|
|
|
for link <- links do
|
|
execute("""
|
|
INSERT INTO commercial_links (id, label, host, community, radio_type, endpoint_a, endpoint_b, weather_station, enabled, inserted_at, updated_at)
|
|
VALUES (gen_random_uuid(), '#{link.label}', '#{link.host}', '#{link.community}', '#{link.radio_type}', '#{link.endpoint_a}'::jsonb, '#{link.endpoint_b}'::jsonb, '#{link.weather_station}', true, '#{now}', '#{now}')
|
|
ON CONFLICT (label) DO NOTHING
|
|
""")
|
|
end
|
|
end
|
|
|
|
def down do
|
|
execute("DELETE FROM commercial_links")
|
|
end
|
|
end
|