Skip to content
Snippets Groups Projects
Commit c0b3a841 authored by Neda Moeini's avatar Neda Moeini Committed by Mohammad Torkashvand
Browse files

Update create EdgePort WF

parent 28a66dea
No related branches found
No related tags found
1 merge request!324Feature/manage sid and gids
...@@ -22,6 +22,7 @@ from gso.products.product_types.router import Router ...@@ -22,6 +22,7 @@ from gso.products.product_types.router import Router
from gso.services.lso_client import LSOState, lso_interaction from gso.services.lso_client import LSOState, lso_interaction
from gso.services.netbox_client import NetboxClient from gso.services.netbox_client import NetboxClient
from gso.services.partners import get_partner_by_id from gso.services.partners import get_partner_by_id
from gso.services.subscriptions import make_unique_ga_id
from gso.utils.helpers import ( from gso.utils.helpers import (
active_pe_router_selector, active_pe_router_selector,
available_interfaces_choices, available_interfaces_choices,
...@@ -52,7 +53,6 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: ...@@ -52,7 +53,6 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
minimum_links: int minimum_links: int
mac_address: str | None = None mac_address: str | None = None
ignore_if_down: bool = False ignore_if_down: bool = False
ga_id: str | None = None
@model_validator(mode="after") @model_validator(mode="after")
def validate_number_of_members(self) -> Self: def validate_number_of_members(self) -> Self:
...@@ -104,7 +104,6 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: ...@@ -104,7 +104,6 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
"minimum_links", "minimum_links",
"mac_address", "mac_address",
"ignore_if_down", "ignore_if_down",
"ga_id",
"enable_lacp", "enable_lacp",
"edge_port_name", "edge_port_name",
"edge_port_description", "edge_port_description",
...@@ -134,7 +133,6 @@ def initialize_subscription( ...@@ -134,7 +133,6 @@ def initialize_subscription(
encapsulation: EncapsulationType, encapsulation: EncapsulationType,
name: str, name: str,
minimum_links: int, minimum_links: int,
ga_id: str | None,
mac_address: str | None, mac_address: str | None,
partner: str, partner: str,
enable_lacp: bool, # noqa: FBT001 enable_lacp: bool, # noqa: FBT001
...@@ -152,6 +150,7 @@ def initialize_subscription( ...@@ -152,6 +150,7 @@ def initialize_subscription(
subscription.edge_port.edge_port_name = name subscription.edge_port.edge_port_name = name
subscription.edge_port.minimum_links = minimum_links subscription.edge_port.minimum_links = minimum_links
subscription.edge_port.ignore_if_down = ignore_if_down 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.ga_id = ga_id
subscription.edge_port.mac_address = mac_address subscription.edge_port.mac_address = mac_address
partner_name = get_partner_by_id(partner).name partner_name = get_partner_by_id(partner).name
......
...@@ -50,7 +50,6 @@ def input_form_wizard_data(request, router_subscription_factory, partner_factory ...@@ -50,7 +50,6 @@ def input_form_wizard_data(request, router_subscription_factory, partner_factory
"node": router_subscription_factory(vendor=Vendor.NOKIA), "node": router_subscription_factory(vendor=Vendor.NOKIA),
"partner": partner_factory(name="GAAR", email=faker.email())["partner_id"], "partner": partner_factory(name="GAAR", email=faker.email())["partner_id"],
"service_type": EdgePortType.PUBLIC, "service_type": EdgePortType.PUBLIC,
"ga_id": faker.geant_gid(),
"enable_lacp": True, "enable_lacp": True,
"speed": PhysicalPortCapacity.HUNDRED_GIGABIT_PER_SECOND, "speed": PhysicalPortCapacity.HUNDRED_GIGABIT_PER_SECOND,
"encapsulation": EncapsulationType.DOT1Q, "encapsulation": EncapsulationType.DOT1Q,
...@@ -101,9 +100,9 @@ def test_successful_edge_port_creation( ...@@ -101,9 +100,9 @@ def test_successful_edge_port_creation(
subscription = EdgePort.from_subscription(subscription_id) subscription = EdgePort.from_subscription(subscription_id)
assert subscription.status == "active" 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 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 len(subscription.edge_port.edge_port_ae_members) == 2
assert mock_execute_playbook.call_count == 2 assert mock_execute_playbook.call_count == 2
......
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