diff --git a/gso/utils/types/interfaces.py b/gso/utils/types/interfaces.py index 80ac4a5f84a804ed1ea97f8d8fade083ce5743a7..f76cd8de373ac4eb916d67d3370193de0210db51 100644 --- a/gso/utils/types/interfaces.py +++ b/gso/utils/types/interfaces.py @@ -54,10 +54,10 @@ def validate_juniper_phy_interface_name(interface_name: str) -> str: Returns: The interface name if match was successful, otherwise it will throw a ValueError exception. """ - pattern = re.compile(r"^(ge|et|xe)-1?[0-9]/[0-9]{1,2}/[0-9]{1,2}$") + pattern = re.compile(r"^(ge|et|xe)-1?\d/\d{1,2}/\d{1,2}$") if not bool(pattern.match(interface_name)): error_msg = ( - f"Invalid interface name. The interface name should be of format: xe-1/0/0. " f"Got: {interface_name}" + f"Invalid interface name. The interface name should be of format: xe-1/0/0, received: {interface_name}" ) raise ValueError(error_msg) return interface_name @@ -113,7 +113,7 @@ def bandwidth_string_is_valid(bandwidth_string: str) -> str: if len(bandwidth_string) < 2: # noqa: PLR2004 not a magic value raise ValueError(msg) - if bandwidth_string[-1:] not in "K" "M" "G" "T": + if bandwidth_string[-1:] not in set("K" "M" "G" "T"): raise ValueError(msg) try: diff --git a/gso/utils/types/site_name.py b/gso/utils/types/site_name.py index 903b3468abbe744280a77c27bb2cf7861e8a389e..48d91dba779722c3caede4205c707cc210c3ce77 100644 --- a/gso/utils/types/site_name.py +++ b/gso/utils/types/site_name.py @@ -11,7 +11,7 @@ def validate_site_name(site_name: str) -> str: The site name must consist of three uppercase letters, optionally followed by a single digit. """ - pattern = re.compile(r"^[A-Z]{3}[0-9]?$") + pattern = re.compile(r"^[A-Z]{3}\d?$") if not pattern.match(site_name): msg = ( "Enter a valid site name. It must consist of three uppercase letters (A-Z), followed by an optional single " diff --git a/gso/workflows/edge_port/create_edge_port.py b/gso/workflows/edge_port/create_edge_port.py index a62c7147531299f8fdad5c822fe9077278cd2397..f715e10470ede68c7993f7af58c1344c20ffe3b4 100644 --- a/gso/workflows/edge_port/create_edge_port.py +++ b/gso/workflows/edge_port/create_edge_port.py @@ -154,7 +154,7 @@ def initialize_subscription( subscription.edge_port.ga_id = ga_id subscription.edge_port.mac_address = mac_address partner_name = get_partner_by_id(partner).name - subscription.description = f"Edge Port {name} on {router.router_fqdn}, " f"{partner_name}, {ga_id or ""}" + subscription.description = f"Edge Port {name} on {router.router_fqdn}, {partner_name}, {ga_id or ""}" subscription.edge_port.edge_port_description = description for member in ae_members: subscription.edge_port.edge_port_ae_members.append( diff --git a/gso/workflows/iptrunk/migrate_iptrunk.py b/gso/workflows/iptrunk/migrate_iptrunk.py index 1282f6365b65b6edaf3c9d7c42977b57cd9b51af..83e7000c5c3376bd12934ce5d64b8ab52661fd94 100644 --- a/gso/workflows/iptrunk/migrate_iptrunk.py +++ b/gso/workflows/iptrunk/migrate_iptrunk.py @@ -445,7 +445,7 @@ def update_remaining_side_bfd_dry( "verb": "update", "config_object": "bfd_update", "dry_run": True, - "commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} " f"- Update BFD config.", + "commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - Update BFD config.", } return { @@ -473,7 +473,7 @@ def update_remaining_side_bfd_real( "verb": "update", "config_object": "bfd_update", "dry_run": False, - "commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} " f"- Update BFD config.", + "commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - Update BFD config.", } return { diff --git a/test/fixtures/layer_2_circuit_fixtures.py b/test/fixtures/layer_2_circuit_fixtures.py index 2b93a37025a3ae728f68d0b869305b20b7474ff8..b8772cf44c08c58ed2fdc77a1ec5d21504b668bc 100644 --- a/test/fixtures/layer_2_circuit_fixtures.py +++ b/test/fixtures/layer_2_circuit_fixtures.py @@ -107,7 +107,7 @@ def layer_2_circuit_subscription_factory(faker, geant_partner, edge_port_subscri subscription.layer_2_circuit.bandwidth = None subscription.layer_2_circuit.policer_burst_rate = None subscription.description = description or ( - f"{subscription.product.name} - " f"{subscription.layer_2_circuit.virtual_circuit_id}" + f"{subscription.product.name} - {subscription.layer_2_circuit.virtual_circuit_id}" ) subscription = SubscriptionModel.from_other_lifecycle(subscription, SubscriptionLifecycle.ACTIVE)