diff --git a/docs/source/module/workflows/index.rst b/docs/source/module/workflows/index.rst index 97204c39c36965957ae9c741e9297ecf7e11aecf..9ef57ae8414ab3e0d46154237f5aadc7b0817ede 100644 --- a/docs/source/module/workflows/index.rst +++ b/docs/source/module/workflows/index.rst @@ -13,6 +13,7 @@ Subpackages :titlesonly: iptrunk/index + office_router/index router/index site/index - tasks/index + super_pop_switch/index diff --git a/docs/source/module/workflows/iptrunk/create_imported_iptrunk.rst b/docs/source/module/workflows/iptrunk/create_imported_iptrunk.rst new file mode 100644 index 0000000000000000000000000000000000000000..c7a72a1a1af789e2a07e5d2c1e458f75dec408d1 --- /dev/null +++ b/docs/source/module/workflows/iptrunk/create_imported_iptrunk.rst @@ -0,0 +1,6 @@ +``gso.workflows.iptrunk.create_imported_iptrunk`` +====================================== + +.. automodule:: gso.workflows.iptrunk.create_imported_iptrunk + :members: + :show-inheritance: diff --git a/docs/source/module/workflows/iptrunk/index.rst b/docs/source/module/workflows/iptrunk/index.rst index f046983fd0c9650d0aa72315a48d875525b312f7..e5135e2e01faf93dd8193448db05d8bc84aecb14 100644 --- a/docs/source/module/workflows/iptrunk/index.rst +++ b/docs/source/module/workflows/iptrunk/index.rst @@ -13,6 +13,7 @@ Submodules :titlesonly: activate_iptrunk + create_imported_iptrunk create_iptrunk migrate_iptrunk modify_isis_metric diff --git a/docs/source/module/workflows/office_router/create_imported_office_router.rst b/docs/source/module/workflows/office_router/create_imported_office_router.rst new file mode 100644 index 0000000000000000000000000000000000000000..a3136a813822ebe8657650cebfed3cef5d4b521c --- /dev/null +++ b/docs/source/module/workflows/office_router/create_imported_office_router.rst @@ -0,0 +1,6 @@ +``gso.workflows.office_router.create_imported_office_router`` +============================================================= + +.. automodule:: gso.workflows.office_router.create_imported_office_router + :members: + :show-inheritance: diff --git a/docs/source/module/workflows/office_router/index.rst b/docs/source/module/workflows/office_router/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..a3d8b3eb8d84b183bfc58acf2d6ca9ccdc32cb3b --- /dev/null +++ b/docs/source/module/workflows/office_router/index.rst @@ -0,0 +1,15 @@ +``gso.workflows.office_router`` +=============================== + +.. automodule:: gso.workflows.office_router + :members: + :show-inheritance: + +Submodules +---------- + +.. toctree:: + :maxdepth: 2 + :titlesonly: + + create_imported_office_router diff --git a/docs/source/module/workflows/router/create_imported_router.rst b/docs/source/module/workflows/router/create_imported_router.rst new file mode 100644 index 0000000000000000000000000000000000000000..8124fd0de31b8033b723494635c1cfa2dd9aedc9 --- /dev/null +++ b/docs/source/module/workflows/router/create_imported_router.rst @@ -0,0 +1,6 @@ +``gso.workflows.router.create_imported_router`` +=============================================== + +.. automodule:: gso.workflows.router.create_imported_router + :members: + :show-inheritance: diff --git a/docs/source/module/workflows/router/index.rst b/docs/source/module/workflows/router/index.rst index e582a4402c8c17ba1292fcb1763cdcce193109a0..08fcc72b429b4e2f7c2bf7d9a40c8dee88ae7015 100644 --- a/docs/source/module/workflows/router/index.rst +++ b/docs/source/module/workflows/router/index.rst @@ -13,6 +13,7 @@ Submodules :titlesonly: activate_router + create_imported_router create_router redeploy_base_config terminate_router diff --git a/docs/source/module/workflows/site/create_imported_site.rst b/docs/source/module/workflows/site/create_imported_site.rst new file mode 100644 index 0000000000000000000000000000000000000000..52fab323a19e5c27cc114dd03f52565d09cadc3e --- /dev/null +++ b/docs/source/module/workflows/site/create_imported_site.rst @@ -0,0 +1,6 @@ +``gso.workflows.site.create_imported_site`` +=========================================== + +.. automodule:: gso.workflows.site.create_imported_site + :members: + :show-inheritance: diff --git a/docs/source/module/workflows/site/index.rst b/docs/source/module/workflows/site/index.rst index c07dc9b901088cf268cec9709286403c60c2bbcd..b06ffd1398863fdbe347f86d50b2cdbe4122d049 100644 --- a/docs/source/module/workflows/site/index.rst +++ b/docs/source/module/workflows/site/index.rst @@ -12,6 +12,7 @@ Submodules :maxdepth: 2 :titlesonly: + create_imported_site create_site modify_site terminate_site diff --git a/docs/source/module/workflows/super_pop_switch/create_imported_super_pop_switch.rst b/docs/source/module/workflows/super_pop_switch/create_imported_super_pop_switch.rst new file mode 100644 index 0000000000000000000000000000000000000000..69922a13fa966368357b9c17349567f049b3302b --- /dev/null +++ b/docs/source/module/workflows/super_pop_switch/create_imported_super_pop_switch.rst @@ -0,0 +1,6 @@ +``gso.workflows.office_router.create_imported_super_pop_switch`` +================================================================ + +.. automodule:: gso.workflows.office_router.create_imported_super_pop_switch + :members: + :show-inheritance: diff --git a/docs/source/module/workflows/super_pop_switch/index.rst b/docs/source/module/workflows/super_pop_switch/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..e76428c78372e5513e8b97ba0e4998fc64a60ace --- /dev/null +++ b/docs/source/module/workflows/super_pop_switch/index.rst @@ -0,0 +1,15 @@ +``gso.workflows.super_pop_switch`` +================================== + +.. automodule:: gso.workflows.super_pop_switch + :members: + :show-inheritance: + +Submodules +---------- + +.. toctree:: + :maxdepth: 2 + :titlesonly: + + create_imported_super_pop_switch diff --git a/docs/source/module/workflows/tasks/import_iptrunk.rst b/docs/source/module/workflows/tasks/import_iptrunk.rst deleted file mode 100644 index 24a4be08f99a22f03e107ebef8d1cb58e5d0815b..0000000000000000000000000000000000000000 --- a/docs/source/module/workflows/tasks/import_iptrunk.rst +++ /dev/null @@ -1,6 +0,0 @@ -``gso.workflows.tasks.import_iptrunk`` -====================================== - -.. automodule:: gso.workflows.tasks.import_iptrunk - :members: - :show-inheritance: diff --git a/docs/source/module/workflows/tasks/import_office_router.rst b/docs/source/module/workflows/tasks/import_office_router.rst deleted file mode 100644 index a6b37df5df88e9e57590be22495dfa213cfba177..0000000000000000000000000000000000000000 --- a/docs/source/module/workflows/tasks/import_office_router.rst +++ /dev/null @@ -1,6 +0,0 @@ -``gso.workflows.tasks.import_office_router`` -============================================ - -.. automodule:: gso.workflows.tasks.import_office_router - :members: - :show-inheritance: diff --git a/docs/source/module/workflows/tasks/import_router.rst b/docs/source/module/workflows/tasks/import_router.rst deleted file mode 100644 index 65a6e60741a9d13b4dd3fc2dc3d796550b12b22e..0000000000000000000000000000000000000000 --- a/docs/source/module/workflows/tasks/import_router.rst +++ /dev/null @@ -1,6 +0,0 @@ -``gso.workflows.tasks.import_router`` -===================================== - -.. automodule:: gso.workflows.tasks.import_router - :members: - :show-inheritance: diff --git a/docs/source/module/workflows/tasks/import_site.rst b/docs/source/module/workflows/tasks/import_site.rst deleted file mode 100644 index eb9280dff87c304ac2d7853931ce64203929851e..0000000000000000000000000000000000000000 --- a/docs/source/module/workflows/tasks/import_site.rst +++ /dev/null @@ -1,6 +0,0 @@ -``gso.workflows.tasks.import_site`` -=================================== - -.. automodule:: gso.workflows.tasks.import_site - :members: - :show-inheritance: diff --git a/docs/source/module/workflows/tasks/import_super_pop_switch.rst b/docs/source/module/workflows/tasks/import_super_pop_switch.rst deleted file mode 100644 index 575db1e0e343ffbe1436c6822276524bbcf456a0..0000000000000000000000000000000000000000 --- a/docs/source/module/workflows/tasks/import_super_pop_switch.rst +++ /dev/null @@ -1,6 +0,0 @@ -``gso.workflows.tasks.import_super_pop_switch`` -=============================================== - -.. automodule:: gso.workflows.tasks.import_super_pop_switch - :members: - :show-inheritance: diff --git a/docs/source/module/workflows/tasks/index.rst b/docs/source/module/workflows/tasks/index.rst deleted file mode 100644 index 1931adef62a66b169c5e5b423df4f31022cfa4d5..0000000000000000000000000000000000000000 --- a/docs/source/module/workflows/tasks/index.rst +++ /dev/null @@ -1,19 +0,0 @@ -``gso.workflows.tasks`` -======================= - -.. automodule:: gso.workflows.tasks - :members: - :show-inheritance: - -Submodules ----------- - -.. toctree:: - :maxdepth: 2 - :titlesonly: - - import_super_pop_switch - import_office_router - import_iptrunk - import_router - import_site diff --git a/gso/products/__init__.py b/gso/products/__init__.py index b50bb6f02f2e6b4e6fcc2d17cafc69678c54c8c1..e81b36b8bd9d1777edac64aea4b4da77cba49b4c 100644 --- a/gso/products/__init__.py +++ b/gso/products/__init__.py @@ -8,14 +8,14 @@ from orchestrator.domain import SUBSCRIPTION_MODEL_REGISTRY from pydantic_forms.types import strEnum -from gso.products.product_types.iptrunk import Iptrunk +from gso.products.product_types.iptrunk import ImportedIptrunk, Iptrunk from gso.products.product_types.lan_switch_interconnect import LanSwitchInterconnect -from gso.products.product_types.office_router import OfficeRouter +from gso.products.product_types.office_router import ImportedOfficeRouter, OfficeRouter from gso.products.product_types.opengear import Opengear from gso.products.product_types.pop_vlan import PopVlan -from gso.products.product_types.router import Router -from gso.products.product_types.site import Site -from gso.products.product_types.super_pop_switch import SuperPopSwitch +from gso.products.product_types.router import ImportedRouter, Router +from gso.products.product_types.site import ImportedSite, Site +from gso.products.product_types.super_pop_switch import ImportedSuperPopSwitch, SuperPopSwitch from gso.products.product_types.switch import Switch @@ -30,6 +30,11 @@ class ProductName(strEnum): SWITCH = "Switch" LAN_SWITCH_INTERCONNECT = "LAN Switch Interconnect" POP_VLAN = "Pop VLAN" + IMPORTED_IP_TRUNK = "Imported IP trunk" + IMPORTED_ROUTER = "Imported router" + IMPORTED_SITE = "Imported site" + IMPORTED_SUPER_POP_SWITCH = "Imported super PoP switch" + IMPORTED_OFFICE_ROUTER = "Imported office router" OPENGEAR = "Opengear" @@ -44,6 +49,11 @@ class ProductType(strEnum): SWITCH = Switch.__name__ LAN_SWITCH_INTERCONNECT = LanSwitchInterconnect.__name__ POP_VLAN = PopVlan.__name__ + IMPORTED_IP_TRUNK = ImportedIptrunk.__name__ + IMPORTED_ROUTER = ImportedRouter.__name__ + IMPORTED_SITE = ImportedSite.__name__ + IMPORTED_SUPER_POP_SWITCH = ImportedSuperPopSwitch.__name__ + IMPORTED_OFFICE_ROUTER = ImportedOfficeRouter.__name__ OPENGEAR = Opengear.__name__ @@ -57,6 +67,11 @@ SUBSCRIPTION_MODEL_REGISTRY.update( ProductName.SWITCH.value: Switch, ProductName.LAN_SWITCH_INTERCONNECT.value: LanSwitchInterconnect, ProductName.POP_VLAN.value: PopVlan, + ProductName.IMPORTED_IP_TRUNK.value: ImportedIptrunk, + ProductName.IMPORTED_ROUTER.value: ImportedRouter, + ProductName.IMPORTED_SITE.value: ImportedSite, + ProductName.IMPORTED_SUPER_POP_SWITCH.value: ImportedSuperPopSwitch, + ProductName.IMPORTED_OFFICE_ROUTER.value: ImportedOfficeRouter, ProductName.OPENGEAR.value: Opengear, }, ) diff --git a/gso/products/product_types/iptrunk.py b/gso/products/product_types/iptrunk.py index 70612d49216fa6f00fb47835bbbc1b772b818dc1..82c912bf062b1c2afc5bd5f2b55e352507fd5a07 100644 --- a/gso/products/product_types/iptrunk.py +++ b/gso/products/product_types/iptrunk.py @@ -26,3 +26,15 @@ class Iptrunk(IptrunkProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]): """An IP trunk that is active.""" iptrunk: IptrunkBlock + + +class ImportedIptrunkInactive(SubscriptionModel, is_base=True): + """An IP trunk that is inactive.""" + + iptrunk: IptrunkBlockInactive + + +class ImportedIptrunk(ImportedIptrunkInactive, lifecycle=[SubscriptionLifecycle.ACTIVE]): + """An IP trunk that is active.""" + + iptrunk: IptrunkBlock diff --git a/gso/products/product_types/office_router.py b/gso/products/product_types/office_router.py index 6fff33e041edc35e1f333f66a01ac3d6f78fc286..04c47dfbadaaadac9c268cf47221c9dc462c5f98 100644 --- a/gso/products/product_types/office_router.py +++ b/gso/products/product_types/office_router.py @@ -26,3 +26,15 @@ class OfficeRouter(OfficeRouterProvisioning, lifecycle=[SubscriptionLifecycle.AC """An office router that is currently active.""" office_router: OfficeRouterBlock + + +class ImportedOfficeRouterInactive(SubscriptionModel, is_base=True): + """An imported, inactive office router.""" + + office_router: OfficeRouterBlockInactive + + +class ImportedOfficeRouter(ImportedOfficeRouterInactive, lifecycle=[SubscriptionLifecycle.ACTIVE]): + """An imported office router that is currently active.""" + + office_router: OfficeRouterBlock diff --git a/gso/products/product_types/router.py b/gso/products/product_types/router.py index d6a59c12ccd14dea0dac8852a7748810359718b7..e24df3e7b3f5af3b9810f8155b6ad9906b2a258d 100644 --- a/gso/products/product_types/router.py +++ b/gso/products/product_types/router.py @@ -26,3 +26,15 @@ class Router(RouterProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]): """A router that is currently active.""" router: RouterBlock + + +class ImportedRouterInactive(SubscriptionModel, is_base=True): + """An imported, inactive router.""" + + router: RouterBlockInactive + + +class ImportedRouter(ImportedRouterInactive, lifecycle=[SubscriptionLifecycle.ACTIVE]): + """An imported router that is currently active.""" + + router: RouterBlock diff --git a/gso/products/product_types/site.py b/gso/products/product_types/site.py index ec09962e33521d82bd5c05b6fa3bccd6dbb6e8bf..0fb16a574588e43cab41615a60162f49c16dbdc1 100644 --- a/gso/products/product_types/site.py +++ b/gso/products/product_types/site.py @@ -26,3 +26,15 @@ class Site(SiteProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]): """A site that is currently active.""" site: SiteBlock + + +class ImportedSiteInactive(SubscriptionModel, is_base=True): + """An imported site that is inactive.""" + + site: SiteBlockInactive + + +class ImportedSite(ImportedSiteInactive, lifecycle=[SubscriptionLifecycle.ACTIVE]): + """An imported site that is currently active.""" + + site: SiteBlock diff --git a/gso/products/product_types/super_pop_switch.py b/gso/products/product_types/super_pop_switch.py index e12b1a3d12793d372c47b5022a85307a7bf730ce..3c80e3646b6b3a3d8108b1a44c30e38817255366 100644 --- a/gso/products/product_types/super_pop_switch.py +++ b/gso/products/product_types/super_pop_switch.py @@ -26,3 +26,15 @@ class SuperPopSwitch(SuperPopSwitchProvisioning, lifecycle=[SubscriptionLifecycl """A Super PoP switch that is currently active.""" super_pop_switch: SuperPopSwitchBlock + + +class ImportedSuperPopSwitchInactive(SubscriptionModel, is_base=True): + """An imported, inactive Super PoP switch.""" + + super_pop_switch: SuperPopSwitchBlockInactive + + +class ImportedSuperPopSwitch(ImportedSuperPopSwitchInactive, lifecycle=[SubscriptionLifecycle.ACTIVE]): + """An imported Super PoP switch that is currently active.""" + + super_pop_switch: SuperPopSwitchBlock diff --git a/gso/translations/en-GB.json b/gso/translations/en-GB.json index 63b31e76b5ea23947a59fff034c4367f50e1f83d..2ef5f1c0dbcc9d0033804b266fb9c468e9dcdd65 100644 --- a/gso/translations/en-GB.json +++ b/gso/translations/en-GB.json @@ -45,6 +45,11 @@ "modify_site": "Modify site", "modify_trunk_interface": "Modify IP Trunk interface", "redeploy_base_config": "Redeploy base config", - "update_ibgp_mesh": "Update iBGP mesh" + "update_ibgp_mesh": "Update iBGP mesh", + "create_imported_site": "NOT FOR HUMANS -- Import existing site", + "create_imported_router": "NOT FOR HUMANS -- Import existing router", + "create_imported_iptrunk": "NOT FOR HUMANS -- Import existing IP trunk", + "create_imported_super_pop_switch": "NOT FOR HUMANS -- Import existing super PoP switch", + "create_imported_office_router": "NOT FOR HUMANS -- Import existing office router" } } diff --git a/gso/workflows/tasks/import_iptrunk.py b/gso/workflows/iptrunk/create_imported_iptrunk.py similarity index 93% rename from gso/workflows/tasks/import_iptrunk.py rename to gso/workflows/iptrunk/create_imported_iptrunk.py index 9c6687b35943f7316a4cf4758009598270f80b77..7e28fe64f4f717ad496914d477a8f902f193d9a6 100644 --- a/gso/workflows/tasks/import_iptrunk.py +++ b/gso/workflows/iptrunk/create_imported_iptrunk.py @@ -13,7 +13,7 @@ from orchestrator.workflows.steps import resync, set_status, store_process_subsc from gso.products import ProductName from gso.products.product_blocks.iptrunk import IptrunkInterfaceBlockInactive, IptrunkType, PhysicalPortCapacity -from gso.products.product_types.iptrunk import IptrunkInactive, IptrunkProvisioning +from gso.products.product_types.iptrunk import ImportedIptrunkInactive from gso.products.product_types.router import Router from gso.services import subscriptions from gso.services.partners import get_partner_by_name @@ -68,8 +68,8 @@ def initial_input_form_generator() -> FormGenerator: def create_subscription(partner: str) -> State: """Create a new subscription in the service database.""" partner_id = get_partner_by_name(partner)["partner_id"] - product_id = subscriptions.get_product_id_by_name(ProductName.IP_TRUNK) - subscription = IptrunkInactive.from_product_id(product_id, partner_id) + product_id = subscriptions.get_product_id_by_name(ProductName.IMPORTED_IP_TRUNK) + subscription = ImportedIptrunkInactive.from_product_id(product_id, partner_id) return { "subscription": subscription, @@ -79,7 +79,7 @@ def create_subscription(partner: str) -> State: @step("Initialize subscription") def initialize_subscription( - subscription: IptrunkInactive, + subscription: ImportedIptrunkInactive, geant_s_sid: str | None, iptrunk_type: IptrunkType, iptrunk_description: str, @@ -120,14 +120,12 @@ def initialize_subscription( ) subscription.description = f"IP trunk, geant_s_sid:{geant_s_sid}" - subscription = IptrunkProvisioning.from_other_lifecycle(subscription, SubscriptionLifecycle.PROVISIONING) - return {"subscription": subscription} @step("Update IPAM Stub for Subscription") def update_ipam_stub_for_subscription( - subscription: IptrunkProvisioning, + subscription: ImportedIptrunkInactive, iptrunk_ipv4_network: ipaddress.IPv4Network, iptrunk_ipv6_network: ipaddress.IPv6Network, ) -> State: @@ -143,7 +141,7 @@ def update_ipam_stub_for_subscription( initial_input_form=initial_input_form_generator, target=Target.CREATE, ) -def import_iptrunk() -> StepList: +def create_imported_iptrunk() -> StepList: """Import an IP trunk without provisioning it.""" return ( init diff --git a/gso/workflows/office_router/__init__.py b/gso/workflows/office_router/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1a947a5007a60e3629ce913aebbf4b80d22dda15 --- /dev/null +++ b/gso/workflows/office_router/__init__.py @@ -0,0 +1 @@ +"""Workflows for Office router products.""" diff --git a/gso/workflows/tasks/import_office_router.py b/gso/workflows/office_router/create_imported_office_router.py similarity index 88% rename from gso/workflows/tasks/import_office_router.py rename to gso/workflows/office_router/create_imported_office_router.py index 9168cdae0150a82a1893b6b3ceae450b5df542b5..82c52fc4071272fc8f77c14af665aa42c2e5ed3a 100644 --- a/gso/workflows/tasks/import_office_router.py +++ b/gso/workflows/office_router/create_imported_office_router.py @@ -10,8 +10,7 @@ from orchestrator.workflow import StepList, done, init, step from orchestrator.workflows.steps import resync, set_status, store_process_subscription from gso.products import ProductName -from gso.products.product_types import office_router -from gso.products.product_types.office_router import OfficeRouterInactive +from gso.products.product_types.office_router import ImportedOfficeRouterInactive from gso.services import subscriptions from gso.services.partners import get_partner_by_name from gso.services.subscriptions import get_site_by_name @@ -22,8 +21,8 @@ from gso.utils.shared_enums import PortNumber, Vendor def create_subscription(partner: str) -> State: """Create a new subscription object.""" partner_id = get_partner_by_name(partner)["partner_id"] - product_id = subscriptions.get_product_id_by_name(ProductName.OFFICE_ROUTER) - subscription = OfficeRouterInactive.from_product_id(product_id, partner_id) + product_id = subscriptions.get_product_id_by_name(ProductName.IMPORTED_OFFICE_ROUTER) + subscription = ImportedOfficeRouterInactive.from_product_id(product_id, partner_id) return { "subscription": subscription, @@ -52,7 +51,7 @@ def initial_input_form_generator() -> FormGenerator: @step("Initialize subscription") def initialize_subscription( - subscription: OfficeRouterInactive, + subscription: ImportedOfficeRouterInactive, office_router_fqdn: str, office_router_ts_port: PortNumber, office_router_site: str, @@ -69,10 +68,6 @@ def initialize_subscription( subscription.office_router.office_router_lo_ipv6_address = office_router_lo_ipv6_address subscription.office_router.vendor = Vendor.JUNIPER - subscription = office_router.OfficeRouterProvisioning.from_other_lifecycle( - subscription, SubscriptionLifecycle.PROVISIONING - ) - return {"subscription": subscription} diff --git a/gso/workflows/tasks/import_router.py b/gso/workflows/router/create_imported_router.py similarity index 83% rename from gso/workflows/tasks/import_router.py rename to gso/workflows/router/create_imported_router.py index c71ce26ee47a0e0929842d7261d7c0fd195d2e55..a71a7a18a6ca45909d2ffe80c410f3672e0771a7 100644 --- a/gso/workflows/tasks/import_router.py +++ b/gso/workflows/router/create_imported_router.py @@ -10,13 +10,10 @@ from orchestrator.workflow import StepList, done, init, step from orchestrator.workflows.steps import resync, set_status, store_process_subscription from gso.products import ProductName -from gso.products.product_blocks import router as router_pb from gso.products.product_blocks.router import RouterRole -from gso.products.product_types import router -from gso.products.product_types.router import RouterInactive -from gso.services import subscriptions +from gso.products.product_types.router import ImportedRouterInactive from gso.services.partners import get_partner_by_name -from gso.services.subscriptions import get_site_by_name +from gso.services.subscriptions import get_product_id_by_name, get_site_by_name from gso.utils.helpers import generate_fqdn from gso.utils.shared_enums import PortNumber, Vendor @@ -25,8 +22,8 @@ from gso.utils.shared_enums import PortNumber, Vendor def create_subscription(partner: str) -> State: """Create a new subscription object.""" partner_id = get_partner_by_name(partner)["partner_id"] - product_id = subscriptions.get_product_id_by_name(ProductName.ROUTER) - subscription = RouterInactive.from_product_id(product_id, partner_id) + product_id = get_product_id_by_name(ProductName.IMPORTED_ROUTER) + subscription = ImportedRouterInactive.from_product_id(product_id, partner_id) return { "subscription": subscription, @@ -58,11 +55,11 @@ def initial_input_form_generator() -> FormGenerator: @step("Initialize subscription") def initialize_subscription( - subscription: RouterInactive, + subscription: ImportedRouterInactive, hostname: str, ts_port: PortNumber, router_site: str, - router_role: router_pb.RouterRole, + router_role: RouterRole, router_vendor: Vendor, router_lo_ipv4_address: ipaddress.IPv4Address | None = None, router_lo_ipv6_address: ipaddress.IPv6Address | None = None, @@ -82,8 +79,6 @@ def initialize_subscription( subscription.router.router_lo_iso_address = router_lo_iso_address subscription.router.vendor = router_vendor - subscription = router.RouterProvisioning.from_other_lifecycle(subscription, SubscriptionLifecycle.PROVISIONING) - return {"subscription": subscription} @@ -92,7 +87,7 @@ def initialize_subscription( initial_input_form=initial_input_form_generator, target=Target.CREATE, ) -def import_router() -> StepList: +def create_imported_router() -> StepList: """Import a router without provisioning it.""" return ( init diff --git a/gso/workflows/tasks/import_site.py b/gso/workflows/site/create_imported_site.py similarity index 89% rename from gso/workflows/tasks/import_site.py rename to gso/workflows/site/create_imported_site.py index ff49808a5a86d1e73c6a741d74a75c4c7c233471..ef3977f4a7d0d5849a45f24c6abf58f477045921 100644 --- a/gso/workflows/tasks/import_site.py +++ b/gso/workflows/site/create_imported_site.py @@ -10,7 +10,7 @@ from orchestrator.workflows.steps import resync, set_status, store_process_subsc from gso.products import ProductName from gso.products.product_blocks.site import SiteTier -from gso.products.product_types.site import SiteInactive +from gso.products.product_types.site import ImportedSiteInactive from gso.services import subscriptions from gso.services.partners import get_partner_by_name from gso.workflows.site.create_site import initialize_subscription @@ -18,13 +18,10 @@ from gso.workflows.site.create_site import initialize_subscription @step("Create subscription") def create_subscription(partner: str) -> State: - """Create a new subscription object in the service database. - - FIXME: all attributes passed by the input form appear to be unused - """ + """Create a new subscription object in the service database.""" partner_id = get_partner_by_name(partner)["partner_id"] - product_id: UUID = subscriptions.get_product_id_by_name(ProductName.SITE) - subscription = SiteInactive.from_product_id(product_id, partner_id) + product_id: UUID = subscriptions.get_product_id_by_name(ProductName.IMPORTED_SITE) + subscription = ImportedSiteInactive.from_product_id(product_id, partner_id) return { "subscription": subscription, @@ -60,7 +57,7 @@ def generate_initial_input_form() -> FormGenerator: target=Target.CREATE, initial_input_form=generate_initial_input_form, ) -def import_site() -> StepList: +def create_imported_site() -> StepList: """Workflow to import a site without provisioning it.""" return ( init diff --git a/gso/workflows/super_pop_switch/__init__.py b/gso/workflows/super_pop_switch/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..caed99fa16523bd4a445bf09576817912c7e03de --- /dev/null +++ b/gso/workflows/super_pop_switch/__init__.py @@ -0,0 +1 @@ +"""Workflows for super PoP switches."""