Skip to content

Commit 248d8d4

Browse files
dgonzdevamrnator
authored andcommitted
Add more link types attempt 2 (#1046)
* add new link types * add migration * update utils * update tests * add unspecified to label * update migrations * update constant reference * add types-python-dateutil to dev dependencies * fix casing * fix test map endpoints tests * fix tests
1 parent ea02208 commit 248d8d4

File tree

9 files changed

+103
-40
lines changed

9 files changed

+103
-40
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ dev = [
6161
"flask == 3.0.*",
6262
"django-cprofile-middleware==1.0.5",
6363
"django-silk==5.1.0",
64+
"types-python-dateutil == 2.9.*",
6465
"types-requests==2.32.*",
6566
"types-six==1.16.0.*",
6667
"django-stubs[compatible-mypy]==5.0.*",
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Generated by Django 4.2.25 on 2025-10-26 15:41
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("meshapi", "0013_historicalnode_placement_node_placement"),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name="historicallink",
15+
name="type",
16+
field=models.CharField(
17+
blank=True,
18+
choices=[
19+
("5 GHz", "5 GHz Unspecified"),
20+
("5 GHz Airmax", "5 GHz Airmax"),
21+
("5 GHz WDS", "5 GHz WDS"),
22+
("5 GHz Wlan4", "5 GHz Wlan4"),
23+
("6 GHz", "6 GHz"),
24+
("24 GHz", "24 GHz"),
25+
("60 GHz", "60 GHz"),
26+
("70-80 GHz", "70-80 GHz"),
27+
("VPN", "VPN"),
28+
("Fiber", "Fiber"),
29+
("Ethernet", "Ethernet"),
30+
],
31+
default=None,
32+
help_text="The technology used for this link 5Ghz, 60Ghz, fiber, etc.",
33+
null=True,
34+
),
35+
),
36+
migrations.AlterField(
37+
model_name="link",
38+
name="type",
39+
field=models.CharField(
40+
blank=True,
41+
choices=[
42+
("5 GHz", "5 GHz Unspecified"),
43+
("5 GHz Airmax", "5 GHz Airmax"),
44+
("5 GHz WDS", "5 GHz WDS"),
45+
("5 GHz Wlan4", "5 GHz Wlan4"),
46+
("6 GHz", "6 GHz"),
47+
("24 GHz", "24 GHz"),
48+
("60 GHz", "60 GHz"),
49+
("70-80 GHz", "70-80 GHz"),
50+
("VPN", "VPN"),
51+
("Fiber", "Fiber"),
52+
("Ethernet", "Ethernet"),
53+
],
54+
default=None,
55+
help_text="The technology used for this link 5Ghz, 60Ghz, fiber, etc.",
56+
null=True,
57+
),
58+
),
59+
]

src/meshapi/models/link.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ class LinkStatus(models.TextChoices):
1717
ACTIVE = "Active"
1818

1919
class LinkType(models.TextChoices):
20-
FIVE_GHZ = "5 GHz", "5 GHz"
20+
FIVE_GHZ_UNSPECIFIED = "5 GHz", "5 GHz Unspecified"
21+
FIVE_GHZ_AIRMAX = "5 GHz Airmax", "5 GHz Airmax"
22+
FIVE_GHZ_WDS = "5 GHz WDS", "5 GHz WDS"
23+
FIVE_GHZ_WLAN = "5 GHz Wlan4", "5 GHz Wlan4"
2124
SIX_GHZ = "6 GHz", "6 GHz"
2225
TWENTYFOUR_GHZ = "24 GHz", "24 GHz"
2326
SIXTY_GHZ = "60 GHz", "60 GHz"

src/meshapi/tests/test_kml_endpoint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def test_kml_data(self):
110110
from_device=sn1_omni,
111111
to_device=brian_omni,
112112
status=Link.LinkStatus.ACTIVE,
113-
type=Link.LinkType.FIVE_GHZ,
113+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
114114
)
115115
)
116116

@@ -128,7 +128,7 @@ def test_kml_data(self):
128128
from_device=grand_omni,
129129
to_device=random_omni,
130130
status=Link.LinkStatus.PLANNED,
131-
type=Link.LinkType.FIVE_GHZ,
131+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
132132
)
133133
)
134134

@@ -138,7 +138,7 @@ def test_kml_data(self):
138138
from_device=dead_omni,
139139
to_device=random_omni,
140140
status=Link.LinkStatus.ACTIVE,
141-
type=Link.LinkType.FIVE_GHZ,
141+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
142142
)
143143
)
144144

src/meshapi/tests/test_lookups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ def setUp(self):
11201120
from_device=self.d1,
11211121
to_device=self.d2,
11221122
status=Link.LinkStatus.ACTIVE,
1123-
type=Link.LinkType.FIVE_GHZ,
1123+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
11241124
uisp_id="1231",
11251125
)
11261126
self.l1.save()

src/meshapi/tests/test_map_endpoints.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ def test_link_data(self):
934934
from_device=sn1_omni,
935935
to_device=brian_omni,
936936
status=Link.LinkStatus.ACTIVE,
937-
type=Link.LinkType.FIVE_GHZ,
937+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
938938
)
939939
)
940940

@@ -954,7 +954,7 @@ def test_link_data(self):
954954
from_device=grand_omni,
955955
to_device=random_omni,
956956
status=Link.LinkStatus.PLANNED,
957-
type=Link.LinkType.FIVE_GHZ,
957+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
958958
)
959959
)
960960

@@ -964,7 +964,7 @@ def test_link_data(self):
964964
from_device=sn1_omni,
965965
to_device=random_omni,
966966
status=Link.LinkStatus.INACTIVE,
967-
type=Link.LinkType.FIVE_GHZ,
967+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
968968
)
969969
)
970970

@@ -974,7 +974,7 @@ def test_link_data(self):
974974
from_device=sn1_omni,
975975
to_device=inactive_omni,
976976
status=Link.LinkStatus.ACTIVE,
977-
type=Link.LinkType.FIVE_GHZ,
977+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
978978
)
979979
)
980980

@@ -1194,7 +1194,7 @@ def test_link_serializer_inactive_link(self):
11941194
from_device=sn1_omni,
11951195
to_device=random_omni,
11961196
status=Link.LinkStatus.INACTIVE,
1197-
type=Link.LinkType.FIVE_GHZ,
1197+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
11981198
)
11991199

12001200
self.assertEqual(
@@ -1310,7 +1310,7 @@ def test_links_are_deduplicated(self):
13101310
from_device=sn1_additional_device,
13111311
to_device=grand_additional_device,
13121312
status=Link.LinkStatus.ACTIVE,
1313-
type=Link.LinkType.FIVE_GHZ,
1313+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
13141314
)
13151315
)
13161316
links.append(
@@ -1319,7 +1319,7 @@ def test_links_are_deduplicated(self):
13191319
from_device=grand2_omni,
13201320
to_device=grand_omni,
13211321
status=Link.LinkStatus.ACTIVE,
1322-
type=Link.LinkType.FIVE_GHZ,
1322+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
13231323
)
13241324
)
13251325

@@ -1539,7 +1539,7 @@ def test_link_install_number_resolution(self):
15391539
from_device=device_1,
15401540
to_device=device_2,
15411541
status=Link.LinkStatus.ACTIVE,
1542-
type=Link.LinkType.FIVE_GHZ,
1542+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
15431543
)
15441544
)
15451545

@@ -1548,7 +1548,7 @@ def test_link_install_number_resolution(self):
15481548
from_device=device_2,
15491549
to_device=device_3,
15501550
status=Link.LinkStatus.ACTIVE,
1551-
type=Link.LinkType.FIVE_GHZ,
1551+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
15521552
)
15531553
)
15541554

@@ -1557,7 +1557,7 @@ def test_link_install_number_resolution(self):
15571557
from_device=device_3,
15581558
to_device=device_1,
15591559
status=Link.LinkStatus.ACTIVE,
1560-
type=Link.LinkType.FIVE_GHZ,
1560+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
15611561
)
15621562
)
15631563

@@ -1682,7 +1682,7 @@ def test_install_number_used_for_links_with_no_nn(self):
16821682
from_device=device1,
16831683
to_device=device2,
16841684
status=Link.LinkStatus.PLANNED,
1685-
type=Link.LinkType.FIVE_GHZ,
1685+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
16861686
)
16871687
link.save()
16881688
los = LOS(
@@ -1747,7 +1747,7 @@ def test_inactive_duplicate_link_doesnt_hide_active_one(self):
17471747
from_device=device1,
17481748
to_device=device2,
17491749
status=Link.LinkStatus.INACTIVE,
1750-
type=Link.LinkType.FIVE_GHZ,
1750+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
17511751
)
17521752
link1.save()
17531753

src/meshapi/tests/test_serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def setUp(self):
152152
status=Link.LinkStatus.ACTIVE,
153153
notes="abc def ghi",
154154
description="xyz abc",
155-
type=Link.LinkType.FIVE_GHZ,
155+
type=Link.LinkType.FIVE_GHZ_UNSPECIFIED,
156156
uisp_id="35eecca6-0186-4a33-9837-451de8b12da0",
157157
install_date=datetime.date(2016, 1, 2),
158158
abandon_date=datetime.date(2017, 1, 2),

0 commit comments

Comments
 (0)