Skip to content
Snippets Groups Projects
Commit bfeeaa5c authored by Aleksandr Kurbatov's avatar Aleksandr Kurbatov
Browse files

add partner name into edge port wfs

parent 2c0193b3
Branches
Tags
No related merge requests found
Pipeline #89787 failed
...@@ -29,6 +29,7 @@ from gso.utils.helpers import ( ...@@ -29,6 +29,7 @@ from gso.utils.helpers import (
partner_choice, partner_choice,
validate_edge_port_number_of_members_based_on_lacp, validate_edge_port_number_of_members_based_on_lacp,
) )
from gso.services.partners import get_partner_by_id
from gso.utils.types.interfaces import LAGMember, PhysicalPortCapacity from gso.utils.types.interfaces import LAGMember, PhysicalPortCapacity
from gso.utils.types.tt_number import TTNumber from gso.utils.types.tt_number import TTNumber
...@@ -135,7 +136,7 @@ def initialize_subscription( ...@@ -135,7 +136,7 @@ def initialize_subscription(
) )
subscription = EdgePortProvisioning.from_other_lifecycle(subscription, SubscriptionLifecycle.PROVISIONING) subscription = EdgePortProvisioning.from_other_lifecycle(subscription, SubscriptionLifecycle.PROVISIONING)
return {"subscription": subscription} return {"subscription": subscription, "partner_name": partner_name}
@step("Reserve interfaces in NetBox") @step("Reserve interfaces in NetBox")
...@@ -184,11 +185,12 @@ def allocate_interfaces_in_netbox(subscription: EdgePortProvisioning) -> None: ...@@ -184,11 +185,12 @@ def allocate_interfaces_in_netbox(subscription: EdgePortProvisioning) -> None:
@step("[DRY RUN] Create edge port") @step("[DRY RUN] Create edge port")
def create_edge_port_dry(subscription: dict[str, Any], tt_number: str, process_id: UUIDstr) -> LSOState: def create_edge_port_dry(subscription: dict[str, Any], tt_number: str, process_id: UUIDstr, partner_name: str) -> LSOState:
"""Create a new edge port in the network as a dry run.""" """Create a new edge port in the network as a dry run."""
extra_vars = { extra_vars = {
"dry_run": True, "dry_run": True,
"subscription": subscription, "subscription": subscription,
"partner_name": partner_name,
"commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - Create Edge Port", "commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - Create Edge Port",
"verb": "create", "verb": "create",
} }
...@@ -201,11 +203,12 @@ def create_edge_port_dry(subscription: dict[str, Any], tt_number: str, process_i ...@@ -201,11 +203,12 @@ def create_edge_port_dry(subscription: dict[str, Any], tt_number: str, process_i
@step("[FOR REAL] Create edge port") @step("[FOR REAL] Create edge port")
def create_edge_port_real(subscription: dict[str, Any], tt_number: str, process_id: UUIDstr) -> LSOState: def create_edge_port_real(subscription: dict[str, Any], tt_number: str, process_id: UUIDstr, partner_name: str) -> LSOState:
"""Create a new edge port in the network for real.""" """Create a new edge port in the network for real."""
extra_vars = { extra_vars = {
"dry_run": False, "dry_run": False,
"subscription": subscription, "subscription": subscription,
"partner_name": partner_name,
"commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - Create Edge Port", "commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - Create Edge Port",
"verb": "create", "verb": "create",
} }
......
...@@ -146,11 +146,13 @@ def modify_edge_port_subscription( ...@@ -146,11 +146,13 @@ def modify_edge_port_subscription(
f" {get_partner_by_id(subscription.customer_id).name}, {geant_ga_id or ""}" f" {get_partner_by_id(subscription.customer_id).name}, {geant_ga_id or ""}"
) )
subscription.edge_port.edge_port_ae_members.clear() subscription.edge_port.edge_port_ae_members.clear()
partner_name = get_partner_by_id(subscription.customer_id).name
for member in ae_members: for member in ae_members:
subscription.edge_port.edge_port_ae_members.append(EdgePortAEMemberBlock.new(subscription_id=uuid4(), **member)) subscription.edge_port.edge_port_ae_members.append(EdgePortAEMemberBlock.new(subscription_id=uuid4(), **member))
return { return {
"subscription": subscription, "subscription": subscription,
"partner_name": partner_name,
"removed_ae_members": removed_ae_members, "removed_ae_members": removed_ae_members,
"previous_ae_members": previous_ae_members, "previous_ae_members": previous_ae_members,
} }
...@@ -184,11 +186,12 @@ def update_interfaces_in_netbox( ...@@ -184,11 +186,12 @@ def update_interfaces_in_netbox(
@step("[DRY RUN] Update edge port configuration.") @step("[DRY RUN] Update edge port configuration.")
def update_edge_port_dry( def update_edge_port_dry(
subscription: dict[str, Any], process_id: UUIDstr, tt_number: str, removed_ae_members: list[dict] subscription: dict[str, Any], process_id: UUIDstr, tt_number: str, removed_ae_members: list[dict], partner_name: str
) -> LSOState: ) -> LSOState:
"""Perform a dry run of updating the edge port configuration.""" """Perform a dry run of updating the edge port configuration."""
extra_vars = { extra_vars = {
"subscription": subscription, "subscription": subscription,
"partner_name": partner_name,
"dry_run": True, "dry_run": True,
"verb": "update", "verb": "update",
"commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} " "commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} "
...@@ -198,7 +201,7 @@ def update_edge_port_dry( ...@@ -198,7 +201,7 @@ def update_edge_port_dry(
} }
return { return {
"playbook_name": "edge_ports.yaml", "playbook_name": "edge_port.yaml",
"inventory": {"all": {"hosts": {subscription["edge_port"]["node"]["router_fqdn"]}}}, "inventory": {"all": {"hosts": {subscription["edge_port"]["node"]["router_fqdn"]}}},
"extra_vars": extra_vars, "extra_vars": extra_vars,
"subscription": subscription, "subscription": subscription,
...@@ -207,11 +210,12 @@ def update_edge_port_dry( ...@@ -207,11 +210,12 @@ def update_edge_port_dry(
@step("[FOR REAL] Update edge port configuration.") @step("[FOR REAL] Update edge port configuration.")
def update_edge_port_real( def update_edge_port_real(
subscription: dict[str, Any], process_id: UUIDstr, tt_number: str, removed_ae_members: list[str] subscription: dict[str, Any], process_id: UUIDstr, tt_number: str, removed_ae_members: list[str], partner_name: str
) -> LSOState: ) -> LSOState:
"""Update the edge port configuration.""" """Update the edge port configuration."""
extra_vars = { extra_vars = {
"subscription": subscription, "subscription": subscription,
"partner_name": partner_name,
"dry_run": False, "dry_run": False,
"verb": "update", "verb": "update",
"commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} " "commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} "
...@@ -222,7 +226,7 @@ def update_edge_port_real( ...@@ -222,7 +226,7 @@ def update_edge_port_real(
return { return {
"subscription": subscription, "subscription": subscription,
"playbook_name": "edge_ports.yaml", "playbook_name": "edge_port.yaml",
"inventory": {"all": {"hosts": {subscription["edge_port"]["node"]["router_fqdn"]: None}}}, "inventory": {"all": {"hosts": {subscription["edge_port"]["node"]["router_fqdn"]: None}}},
"extra_vars": extra_vars, "extra_vars": extra_vars,
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment