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