Skip to content
Snippets Groups Projects
Commit 94f88873 authored by Neda Moeini's avatar Neda Moeini
Browse files

Fixed data files and fixed validate country code issue with UK as country code.

parent 3aaa7529
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"hostname": "rt1", "hostname": "rt1",
"ts_port": 22111, "ts_port": 22111,
"router_vendor": "juniper", "router_vendor": "juniper",
"router_role": "p", "router_role": "pe",
"router_lo_ipv4_address": "62.40.119.2", "router_lo_ipv4_address": "62.40.119.2",
"router_lo_ipv6_address": "2001:798:1ab::2", "router_lo_ipv6_address": "2001:798:1ab::2",
"router_lo_iso_address": "49.51e5.0001.0620.4011.9002.00", "router_lo_iso_address": "49.51e5.0001.0620.4011.9002.00",
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
"hostname": "rt1", "hostname": "rt1",
"ts_port": 22111, "ts_port": 22111,
"router_vendor": "juniper", "router_vendor": "juniper",
"router_role": "p", "router_role": "pe",
"router_lo_ipv4_address": "62.40.119.1", "router_lo_ipv4_address": "62.40.119.1",
"router_lo_ipv6_address": "2001:798:1ab::1", "router_lo_ipv6_address": "2001:798:1ab::1",
"router_lo_iso_address": "49.51e5.0001.0620.4011.9001.00", "router_lo_iso_address": "49.51e5.0001.0620.4011.9001.00",
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
"hostname": "rt1", "hostname": "rt1",
"ts_port": 22111, "ts_port": 22111,
"router_vendor": "juniper", "router_vendor": "juniper",
"router_role": "p", "router_role": "pe",
"router_lo_ipv4_address": "62.40.119.3", "router_lo_ipv4_address": "62.40.119.3",
"router_lo_ipv6_address": "2001:798:1ab::3", "router_lo_ipv6_address": "2001:798:1ab::3",
"router_lo_iso_address": "49.51e5.0001.0620.4011.9003.00", "router_lo_iso_address": "49.51e5.0001.0620.4011.9003.00",
...@@ -37,18 +37,18 @@ ...@@ -37,18 +37,18 @@
"hostname": "rt1", "hostname": "rt1",
"ts_port": 22111, "ts_port": 22111,
"router_vendor": "juniper", "router_vendor": "juniper",
"router_role": "p", "router_role": "pe",
"router_lo_ipv4_address": "62.40.119.4", "router_lo_ipv4_address": "62.40.119.4",
"router_lo_ipv6_address": "2001:798:1ab::4", "router_lo_ipv6_address": "2001:798:1ab::4",
"router_lo_iso_address": "49.51e5.0001.0620.4011.9004.00", "router_lo_iso_address": "49.51e5.0001.0620.4011.9004.00",
"is_ias_connected": false "is_ias_connected": false
}, },
{ {
"router_site": "LON", "router_site": "LON",
"hostname": "rt1", "hostname": "rt1",
"ts_port": 22111, "ts_port": 22111,
"router_vendor": "juniper", "router_vendor": "juniper",
"router_role": "p", "router_role": "pe",
"router_lo_ipv4_address": "62.40.119.5", "router_lo_ipv4_address": "62.40.119.5",
"router_lo_ipv6_address": "2001:798:1ab::5", "router_lo_ipv6_address": "2001:798:1ab::5",
"router_lo_iso_address": "49.51e5.0001.0620.4011.9005.00", "router_lo_iso_address": "49.51e5.0001.0620.4011.9005.00",
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"site_bgp_community_id": 13, "site_bgp_community_id": 13,
"site_internal_id": 2, "site_internal_id": 2,
"site_tier": "1", "site_tier": "1",
"site_ts_address": "62.40.111.195", "site_ts_address": "62.40.111.195"
}, },
{ {
"site_name": "ATH", "site_name": "ATH",
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"site_bgp_community_id": 14, "site_bgp_community_id": 14,
"site_internal_id": 4, "site_internal_id": 4,
"site_tier": "1", "site_tier": "1",
"site_ts_address": "62.40.111.196", "site_ts_address": "62.40.111.196"
}, },
{ {
"site_name": "BIL", "site_name": "BIL",
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
"site_bgp_community_id": 47, "site_bgp_community_id": 47,
"site_internal_id": 3, "site_internal_id": 3,
"site_tier": "1", "site_tier": "1",
"site_ts_address": "62.40.111.197", "site_ts_address": "62.40.111.197"
}, },
{ {
"site_name": "DUB", "site_name": "DUB",
...@@ -50,12 +50,12 @@ ...@@ -50,12 +50,12 @@
{ {
"site_name": "LON", "site_name": "LON",
"site_city": "London", "site_city": "London",
"site_country": "England", "site_country": "United Kingdom",
"site_country_code": "UK", "site_country_code": "UK",
"site_latitude": 51.49821912962843, "site_latitude": 51.49821912962843,
"site_longitude": -0.015228819041376851, "site_longitude": -0.015228819041376851,
"site_bgp_community_id": 28, "site_bgp_community_id": 28,
"site_internal_id": "1", "site_internal_id": 1,
"site_tier": "1", "site_tier": "1",
"site_ts_address": "62.40.111.199" "site_ts_address": "62.40.111.199"
} }
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
"id": "LGS-00003", "id": "LGS-00003",
"config": { "config": {
"common": { "common": {
"link_speed": "100g", "link_speed": "100G",
"minimum_links": 1, "minimum_links": 1,
"isis_metric": 500, "isis_metric": 500,
"type": "Leased" "type": "Leased"
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
"id": "LGS-00004", "id": "LGS-00004",
"config": { "config": {
"common": { "common": {
"link_speed": "400g", "link_speed": "400G",
"minimum_links": 1, "minimum_links": 1,
"isis_metric": 100, "isis_metric": 100,
"type": "Dark_fiber" "type": "Dark_fiber"
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
"id": "LGS-00006", "id": "LGS-00006",
"config": { "config": {
"common": { "common": {
"link_speed": "100g", "link_speed": "100G",
"minimum_links": 1, "minimum_links": 1,
"isis_metric": 500, "isis_metric": 500,
"type": "Dark_fiber" "type": "Dark_fiber"
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
"id": "LGS-00007", "id": "LGS-00007",
"config": { "config": {
"common": { "common": {
"link_speed": "100g", "link_speed": "100G",
"minimum_links": 1, "minimum_links": 1,
"isis_metric": 500, "isis_metric": 500,
"type": "Dark_fiber" "type": "Dark_fiber"
...@@ -188,7 +188,7 @@ ...@@ -188,7 +188,7 @@
"id": "LGS-00008", "id": "LGS-00008",
"config": { "config": {
"common": { "common": {
"link_speed": "100g", "link_speed": "100G",
"minimum_links": 1, "minimum_links": 1,
"isis_metric": 500, "isis_metric": 500,
"type": "Dark_fiber" "type": "Dark_fiber"
...@@ -225,7 +225,7 @@ ...@@ -225,7 +225,7 @@
"id": "LGS-00012", "id": "LGS-00012",
"config": { "config": {
"common": { "common": {
"link_speed": "100g", "link_speed": "100G",
"minimum_links": 1, "minimum_links": 1,
"isis_metric": 500, "isis_metric": 500,
"type": "Dark_fiber" "type": "Dark_fiber"
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
"id": "LGS-00013", "id": "LGS-00013",
"config": { "config": {
"common": { "common": {
"link_speed": "100g", "link_speed": "100G",
"minimum_links": 1, "minimum_links": 1,
"isis_metric": 500, "isis_metric": 500,
"type": "Dark_fiber" "type": "Dark_fiber"
......
...@@ -173,7 +173,7 @@ def import_iptrunks(filepath: str = common_filepath_option) -> None: ...@@ -173,7 +173,7 @@ def import_iptrunks(filepath: str = common_filepath_option) -> None:
except ValidationError as e: except ValidationError as e:
typer.echo(f"Validation error: {e}") typer.echo(f"Validation error: {e}")
if successfully_imported_data: if successfully_imported_data:
typer.echo("Successfully imported IP Trunks:") typer.echo("Successfully imported IP Trunks:")
for item in successfully_imported_data: for item in successfully_imported_data:
typer.echo(f"- {item}") typer.echo(f"- {item}")
...@@ -199,13 +199,14 @@ def validate_ipv4_or_ipv6(value: str) -> str: ...@@ -199,13 +199,14 @@ def validate_ipv4_or_ipv6(value: str) -> str:
def validate_country_code(country_code: str) -> str: def validate_country_code(country_code: str) -> str:
"""Validate that a country code is valid.""" """Validate that a country code is valid."""
try: # Check for the UK code before attempting to look it up since it's known as "GB" in the pycountry database.
pycountry.countries.lookup(country_code) if country_code != "UK":
except LookupError as e: try:
msg = "Invalid or non-existent country code, it must be in ISO 3166-1 alpha-2 format." pycountry.countries.lookup(country_code)
raise ValueError(msg) from e except LookupError as e:
else: msg = "Invalid or non-existent country code, it must be in ISO 3166-1 alpha-2 format."
return country_code raise ValueError(msg) from e
return country_code
def validate_site_name(site_name: str) -> str: def validate_site_name(site_name: str) -> str:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment