Skip to content
Snippets Groups Projects

Feature/lan switch interconnect

Merged Karel van Klink requested to merge feature/lan-switch-interconnect into develop
7 files
+ 139
17
Compare changes
  • Side-by-side
  • Inline
Files
7
@@ -8,14 +8,17 @@ from orchestrator.targets import Target
from orchestrator.types import FormGenerator, State, SubscriptionLifecycle
from orchestrator.workflow import StepList, begin, done
from orchestrator.workflows.steps import resync, set_status, store_process_subscription
from products.product_types.lan_switch_interconnect import ImportedLanSwitchInterconnectInactive
from gso.cli.imports import LanSwitchInterconnectRouterSideImportModel, LanSwitchInterconnectSwitchSideImportModel
from gso.products import ProductName
from gso.products.product_blocks.lan_switch_interconnect import (
LanSwitchInterconnectInterfaceBlockInactive,
LanSwitchInterconnectRouterSideBlockInactive,
LanSwitchInterconnectSwitchSideBlockInactive,
)
from gso.products.product_types.lan_switch_interconnect import ImportedLanSwitchInterconnectInactive
from gso.products.product_types.router import Router
from gso.products.product_types.switch import Switch
from gso.services.partners import get_partner_by_name
from gso.services.subscriptions import get_product_id_by_name
from gso.utils.types.ip_address import AddressSpace, IPv4NetworkType
@@ -51,19 +54,31 @@ def initialize_subscription(
lan_switch_interconnect_ip_network: IPv4NetworkType | None,
address_space: AddressSpace,
minimum_links: int,
lan_switch_interconnect_router_side: dict,
lan_switch_interconnect_switch_side: dict,
router_side: dict,
switch_side: dict,
) -> State:
"""Initialize the subscription using input data."""
subscription.lan_switch_interconnect.lan_switch_interconnect_description = lan_switch_interconnect_description
subscription.lan_switch_interconnect.lan_switch_interconnect_ip_network = lan_switch_interconnect_ip_network
subscription.lan_switch_interconnect.address_space = address_space
subscription.lan_switch_interconnect.minimum_links = minimum_links
router_block = Router.from_subscription(router_side.pop("node")).router
router_side_interfaces = [
LanSwitchInterconnectInterfaceBlockInactive.new(uuid4(), **ae_member)
for ae_member in router_side.pop("ae_members")
]
subscription.lan_switch_interconnect.router_side = LanSwitchInterconnectRouterSideBlockInactive.new(
uuid4(), **lan_switch_interconnect_router_side
uuid4(), **router_side, node=router_block, ae_members=router_side_interfaces
)
switch_block = Switch.from_subscription(switch_side.pop("switch")).switch
switch_side_interfaces = [
LanSwitchInterconnectInterfaceBlockInactive.new(uuid4(), **ae_member)
for ae_member in switch_side.pop("ae_members")
]
subscription.lan_switch_interconnect.switch_side = LanSwitchInterconnectSwitchSideBlockInactive.new(
uuid4(), **lan_switch_interconnect_switch_side
uuid4(), **switch_side, switch=switch_block, ae_members=switch_side_interfaces
)
return {"subscription": subscription}
Loading