diff --git a/gso/workflows/edge_port/create_edge_port.py b/gso/workflows/edge_port/create_edge_port.py index ccd022f665735ffbd26f5a79fe8dcfb5143acab0..a3ff763c9eb204cbd465f29c667d958ed5a14be1 100644 --- a/gso/workflows/edge_port/create_edge_port.py +++ b/gso/workflows/edge_port/create_edge_port.py @@ -22,6 +22,7 @@ from gso.products.product_types.router import Router from gso.services.lso_client import LSOState, lso_interaction from gso.services.netbox_client import NetboxClient from gso.services.partners import get_partner_by_id +from gso.services.subscriptions import make_unique_ga_id from gso.utils.helpers import ( active_pe_router_selector, available_interfaces_choices, @@ -52,7 +53,6 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: minimum_links: int mac_address: str | None = None ignore_if_down: bool = False - ga_id: str | None = None @model_validator(mode="after") def validate_number_of_members(self) -> Self: @@ -104,7 +104,6 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: "minimum_links", "mac_address", "ignore_if_down", - "ga_id", "enable_lacp", "edge_port_name", "edge_port_description", @@ -134,7 +133,6 @@ def initialize_subscription( encapsulation: EncapsulationType, name: str, minimum_links: int, - ga_id: str | None, mac_address: str | None, partner: str, enable_lacp: bool, # noqa: FBT001 @@ -152,6 +150,7 @@ def initialize_subscription( subscription.edge_port.edge_port_name = name subscription.edge_port.minimum_links = minimum_links subscription.edge_port.ignore_if_down = ignore_if_down + ga_id = make_unique_ga_id() subscription.edge_port.ga_id = ga_id subscription.edge_port.mac_address = mac_address partner_name = get_partner_by_id(partner).name diff --git a/test/workflows/edge_port/test_create_edge_port.py b/test/workflows/edge_port/test_create_edge_port.py index 35cf26134f506fe420ff5320153962e66becf5e6..107dab95f2a328b4d1c7746ba0e605a65e255906 100644 --- a/test/workflows/edge_port/test_create_edge_port.py +++ b/test/workflows/edge_port/test_create_edge_port.py @@ -50,7 +50,6 @@ def input_form_wizard_data(request, router_subscription_factory, partner_factory "node": router_subscription_factory(vendor=Vendor.NOKIA), "partner": partner_factory(name="GAAR", email=faker.email())["partner_id"], "service_type": EdgePortType.PUBLIC, - "ga_id": faker.geant_gid(), "enable_lacp": True, "speed": PhysicalPortCapacity.HUNDRED_GIGABIT_PER_SECOND, "encapsulation": EncapsulationType.DOT1Q, @@ -101,9 +100,9 @@ def test_successful_edge_port_creation( subscription = EdgePort.from_subscription(subscription_id) assert subscription.status == "active" - ga_id = input_form_wizard_data[0]["ga_id"] router_fqdn = Router.from_subscription(input_form_wizard_data[0]["node"]).router.router_fqdn - assert subscription.description == f"Edge Port lag-21 on {router_fqdn}, GAAR, {ga_id}" + assert subscription.edge_port.ga_id is not None + assert subscription.description == f"Edge Port lag-21 on {router_fqdn}, GAAR, {subscription.edge_port.ga_id}" assert len(subscription.edge_port.edge_port_ae_members) == 2 assert mock_execute_playbook.call_count == 2