diff --git a/Changelog.md b/Changelog.md index 0a5cb25ea52402849e72bd032a0bec39f2ea7e2c..a2140eb8b1387461a6a8879d8588c05f74a25651 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ # Changelog +## [2.34] - 2025-01-27 +- Update SharePoint list interaction for L3 Core Services +- Update signature of helper methods that return Subscription objects + ## [2.33] - 2025-01-23 - fix a bug in resolve_customer when customer_id is None - refactor get_partner_by_name to return object instead of dict diff --git a/gso/__init__.py b/gso/__init__.py index 56c9c7d4615be7e6964c95025dab3fc078af40e9..a12d25239e535cd2019d993b4c7061ffd992dc53 100644 --- a/gso/__init__.py +++ b/gso/__init__.py @@ -73,3 +73,5 @@ def init_sentry() -> None: init_sentry() + +__all__ = ["init_cli_app", "init_gso_app", "init_sentry"] diff --git a/gso/workflows/l3_core_service/create_l3_core_service.py b/gso/workflows/l3_core_service/create_l3_core_service.py index 825897f35c9c77d09560b9f5925b0d8731fce0fa..3069bdacec12f1a035238a03eb9e17a0e6b4f7fd 100644 --- a/gso/workflows/l3_core_service/create_l3_core_service.py +++ b/gso/workflows/l3_core_service/create_l3_core_service.py @@ -22,6 +22,7 @@ from gso.services.lso_client import LSOState, lso_interaction from gso.services.partners import get_partner_by_id from gso.services.sharepoint import SharePointClient from gso.services.subscriptions import generate_unique_id +from gso.settings import load_oss_params from gso.utils.helpers import ( active_edge_port_selector, partner_choice, @@ -334,8 +335,9 @@ def update_dns_records(subscription: L3CoreService) -> State: @step("Create a new SharePoint checklist item") -def create_new_sharepoint_checklist(subscription: L3CoreService, tt_number: TTNumber) -> State: +def create_new_sharepoint_checklist(subscription: L3CoreService, tt_number: TTNumber, process_id: UUIDstr) -> State: """Create a new checklist item in SharePoint for approving this L3 Core Service.""" + new_ep = subscription.l3_core_service.ap_list[0].sbp.edge_port new_list_item_url = SharePointClient().add_list_item( list_name="l3_core_service", fields={ @@ -343,7 +345,8 @@ def create_new_sharepoint_checklist(subscription: L3CoreService, tt_number: TTNu "TT_NUMBER": tt_number, "ACTIVITY_TYPE": "Creation", "PRODUCT_TYPE": subscription.l3_core_service_type, - "LOCATION": subscription.l3_core_service.ap_list[0].sbp.edge_port.node.description, + "LOCATION": f"{new_ep.edge_port_name} {new_ep.edge_port_description} on {new_ep.node.router_fqdn}", + "GAP_PROCESS_URL": f"{load_oss_params().GENERAL.public_hostname}/workflows/{process_id}", }, ) diff --git a/setup.py b/setup.py index bd523b15a8fe2513695e3011c0a6d6717b57f7c6..5ef9fd24e8e765b93dafd99470d1fa7c6993156c 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import find_packages, setup setup( name="geant-service-orchestrator", - version="2.33", + version="2.34", author="GÉANT Orchestration and Automation Team", author_email="goat@geant.org", description="GÉANT Service Orchestrator", diff --git a/test/cli/test_imports.py b/test/cli/test_imports.py index 9cb01c1fd205971e68dc8094cb80d81758167f17..b9cd651104da08f51dac3470bedc5499b8f5a348 100644 --- a/test/cli/test_imports.py +++ b/test/cli/test_imports.py @@ -26,7 +26,6 @@ from gso.products.product_blocks.site import SiteTier from gso.products.product_blocks.switch import SwitchModel from gso.products.product_types.layer_2_circuit import Layer2CircuitServiceType from gso.products.product_types.router import Router -from gso.products.product_types.site import Site from gso.utils.helpers import generate_unique_vc_id, iso_from_ipv4 from gso.utils.shared_enums import Vendor from gso.utils.types.interfaces import PhysicalPortCapacity @@ -70,7 +69,7 @@ def iptrunk_data(temp_file, router_subscription_factory, faker) -> (Path, dict): "type": IptrunkType.DARK_FIBER, }, "nodeA": { - "name": side_a_node or Router.from_subscription(router_side_a).router.router_fqdn, + "name": side_a_node or router_side_a.router.router_fqdn, "ae_name": side_a_ae_name or faker.network_interface(), "port_ga_id": faker.imported_ga_id(), "members": side_a_members @@ -85,7 +84,7 @@ def iptrunk_data(temp_file, router_subscription_factory, faker) -> (Path, dict): "ipv6_address": ipv6_network, }, "nodeB": { - "name": side_b_node or Router.from_subscription(router_side_b).router.router_fqdn, + "name": side_b_node or router_side_b.router.router_fqdn, "ae_name": side_b_ae_name or faker.network_interface(), "port_ga_id": faker.imported_ga_id(), "members": side_b_members @@ -136,7 +135,7 @@ def router_data(temp_file, faker, site_subscription_factory): def _router_data(**kwargs): mock_ipv4 = faker.ipv4() router_data = { - "router_site": Site.from_subscription(site_subscription_factory()).site.site_name, + "router_site": site_subscription_factory().site.site_name, "hostname": str(faker.ipv4()), "ts_port": faker.port_number(is_user=True), "router_role": RouterRole.PE, @@ -158,7 +157,7 @@ def super_pop_switch_data(temp_file, faker, site_subscription_factory): def _super_pop_switch_data(**kwargs): super_pop_switch_data = { "hostname": str(faker.ipv4()), - "super_pop_switch_site": Site.from_subscription(site_subscription_factory()).site.site_name, + "super_pop_switch_site": site_subscription_factory().site.site_name, "super_pop_switch_ts_port": faker.port_number(is_user=True), "super_pop_switch_mgmt_ipv4_address": str(faker.ipv4()), } @@ -175,7 +174,7 @@ def office_router_data(temp_file, faker, site_subscription_factory): def _office_router_data(**kwargs): office_router_data = { "office_router_fqdn": faker.domain_name(levels=4), - "office_router_site": Site.from_subscription(site_subscription_factory()).site.site_name, + "office_router_site": site_subscription_factory().site.site_name, "office_router_ts_port": faker.port_number(is_user=True), "office_router_lo_ipv4_address": str(faker.ipv4()), "office_router_lo_ipv6_address": str(faker.ipv6()), @@ -192,7 +191,7 @@ def office_router_data(temp_file, faker, site_subscription_factory): def opengear_data(temp_file, faker, site_subscription_factory): def _opengear_data(**kwargs): opengear_data = { - "opengear_site": Site.from_subscription(site_subscription_factory()).site.site_name, + "opengear_site": site_subscription_factory().site.site_name, "opengear_hostname": faker.domain_name(levels=4), "opengear_wan_address": str(faker.ipv4()), "opengear_wan_netmask": str(faker.ipv4()), @@ -212,7 +211,7 @@ def switch_data(temp_file, faker, site_subscription_factory): switch_data = { "fqdn": faker.domain_name(levels=4), "ts_port": faker.port_number(is_user=True), - "site": site_subscription_factory(), + "site": str(site_subscription_factory().subscription_id), "switch_vendor": Vendor.JUNIPER, "switch_model": SwitchModel.EX3400_48T, } @@ -231,7 +230,7 @@ def lan_switch_interconnect_data(temp_file, faker, switch_subscription_factory, "lan_switch_interconnect_description": faker.sentence(), "minimum_links": 1, "router_side": { - "node": router_subscription_factory(), + "node": str(router_subscription_factory().subscription_id), "ae_iface": faker.nokia_lag_interface_name(), "ae_members": [ {"interface_name": faker.network_interface(), "interface_description": faker.sentence()} @@ -239,7 +238,7 @@ def lan_switch_interconnect_data(temp_file, faker, switch_subscription_factory, ], }, "switch_side": { - "switch": switch_subscription_factory(), + "switch": str(switch_subscription_factory().subscription_id), "ae_iface": faker.juniper_ae_interface_name(), "ae_members": [ {"interface_name": faker.network_interface(), "interface_description": faker.sentence()} @@ -259,7 +258,7 @@ def lan_switch_interconnect_data(temp_file, faker, switch_subscription_factory, def edge_port_data(temp_file, faker, router_subscription_factory, partner_factory): def _edge_port_data(**kwargs): edge_port_data = { - "node": Router.from_subscription(router_subscription_factory(vendor=Vendor.NOKIA)).router.router_fqdn, + "node": router_subscription_factory(vendor=Vendor.NOKIA).router.router_fqdn, "service_type": EdgePortType.CUSTOMER, "speed": PhysicalPortCapacity.TEN_GIGABIT_PER_SECOND, "encapsulation": EncapsulationType.DOT1Q, @@ -298,7 +297,7 @@ def l3_core_service_data(temp_file, faker, partner_factory, edge_port_subscripti "service_type": "IMPORTED IAS", "service_binding_ports": [ { - "edge_port": edge_port_subscription_factory(), + "edge_port": str(edge_port_subscription_factory().subscription_id), "ap_type": "PRIMARY", "gs_id": faker.imported_gs_id(), "vlan_id": faker.vlan_id(), @@ -346,7 +345,7 @@ def l3_core_service_data(temp_file, faker, partner_factory, edge_port_subscripti ], }, { - "edge_port": edge_port_subscription_factory(), + "edge_port": str(edge_port_subscription_factory().subscription_id), "ap_type": "BACKUP", "gs_id": faker.imported_gs_id(), "vlan_id": faker.vlan_id(), @@ -412,11 +411,11 @@ def layer_2_circuit_data(temp_file, faker, partner_factory, edge_port_subscripti "gs_id": faker.imported_gs_id(), "vc_id": generate_unique_vc_id(), "layer_2_circuit_side_a": { - "edge_port": edge_port_subscription_factory(), + "edge_port": str(edge_port_subscription_factory().subscription_id), "vlan_id": faker.vlan_id(), }, "layer_2_circuit_side_b": { - "edge_port": edge_port_subscription_factory(), + "edge_port": str(edge_port_subscription_factory().subscription_id), "vlan_id": faker.vlan_id(), }, "layer_2_circuit_type": Layer2CircuitType.TAGGED, @@ -644,7 +643,7 @@ def test_import_edge_port_successful(mock_start_process, mock_sleep, edge_port_d def test_import_edge_port_with_invalid_router( mock_start_process, mock_sleep, edge_port_data, capfd, router_subscription_factory ): - p_router = router_subscription_factory(vendor=Vendor.NOKIA, router_role=RouterRole.P) + p_router = router_subscription_factory(vendor=Vendor.NOKIA, router_role=RouterRole.P).subscription_id broken_data = edge_port_data(node=Router.from_subscription(p_router).router.router_fqdn) import_edge_port(broken_data["path"]) @@ -732,7 +731,7 @@ def test_import_l3_core_service_with_invalid_edge_port( }, }, { - "edge_port": edge_port_subscription_factory(), + "edge_port": str(edge_port_subscription_factory().subscription_id), "ap_type": "BACKUP", "gs_id": faker.imported_gs_id(), "vlan_id": faker.vlan_id(), diff --git a/test/fixtures/edge_port_fixtures.py b/test/fixtures/edge_port_fixtures.py index 6beb81817855be8db10d4292fdb303be849ab43d..ad6da994a083b5746107d381d831de6dc1a291ff 100644 --- a/test/fixtures/edge_port_fixtures.py +++ b/test/fixtures/edge_port_fixtures.py @@ -1,7 +1,7 @@ import pytest from orchestrator.db import db from orchestrator.domain import SubscriptionModel -from orchestrator.types import SubscriptionLifecycle, UUIDstr +from orchestrator.types import SubscriptionLifecycle from gso.products import ProductName from gso.products.product_blocks.edge_port import ( @@ -10,7 +10,6 @@ from gso.products.product_blocks.edge_port import ( EncapsulationType, ) from gso.products.product_types.edge_port import EdgePortInactive, ImportedEdgePortInactive -from gso.products.product_types.router import Router from gso.services import subscriptions from gso.utils.shared_enums import Vendor from gso.utils.types.interfaces import PhysicalPortCapacity @@ -38,9 +37,9 @@ def edge_port_subscription_factory(faker, partner_factory, router_subscription_f enable_lacp=True, ignore_if_down=False, is_imported=False, - ) -> UUIDstr: + ) -> SubscriptionModel: partner = partner or partner_factory() - node = node or Router.from_subscription(router_subscription_factory(vendor=Vendor.NOKIA)).router + node = node or router_subscription_factory(vendor=Vendor.NOKIA).router if is_imported: product_id = subscriptions.get_product_id_by_name(ProductName.IMPORTED_EDGE_PORT) @@ -91,6 +90,6 @@ def edge_port_subscription_factory(faker, partner_factory, router_subscription_f edge_port_subscription.save() db.session.commit() - return str(edge_port_subscription.subscription_id) + return edge_port_subscription return subscription_create diff --git a/test/fixtures/iptrunk_fixtures.py b/test/fixtures/iptrunk_fixtures.py index 09fe95827e71a4188dfb5fb3d36b362fa2f7f783..2bfa5ffafdac1ae8408ef84e3bb7c611977cf349 100644 --- a/test/fixtures/iptrunk_fixtures.py +++ b/test/fixtures/iptrunk_fixtures.py @@ -1,7 +1,7 @@ import pytest from orchestrator.db import db from orchestrator.domain import SubscriptionModel -from orchestrator.types import SubscriptionLifecycle, UUIDstr +from orchestrator.types import SubscriptionLifecycle from gso.products import ProductName from gso.products.product_blocks.iptrunk import ( @@ -10,7 +10,6 @@ from gso.products.product_blocks.iptrunk import ( IptrunkType, ) from gso.products.product_types.iptrunk import ImportedIptrunkInactive, IptrunkInactive -from gso.products.product_types.router import Router from gso.services import subscriptions from gso.utils.shared_enums import Vendor from gso.utils.types.interfaces import PhysicalPortCapacity @@ -27,9 +26,9 @@ def iptrunk_side_subscription_factory(router_subscription_factory, faker): ) -> IptrunkSideBlock: return IptrunkSideBlock.new( faker.uuid4(), - iptrunk_side_node=Router.from_subscription( - iptrunk_side_node or router_subscription_factory(vendor=Vendor.NOKIA) - ).router, + iptrunk_side_node=iptrunk_side_node.router + if iptrunk_side_node + else router_subscription_factory(vendor=Vendor.NOKIA).router, iptrunk_side_ae_iface=iptrunk_side_ae_iface or faker.pystr(), ga_id=ga_id or faker.ga_id(), iptrunk_side_ae_members=iptrunk_side_ae_members @@ -68,7 +67,7 @@ def iptrunk_subscription_factory(iptrunk_side_subscription_factory, faker, geant partner: dict | None = None, *, is_imported: bool | None = False, - ) -> UUIDstr: + ) -> SubscriptionModel: if partner is None: partner = geant_partner @@ -117,6 +116,6 @@ def iptrunk_subscription_factory(iptrunk_side_subscription_factory, faker, geant iptrunk_subscription.save() db.session.commit() - return str(iptrunk_subscription.subscription_id) + return iptrunk_subscription return subscription_create diff --git a/test/fixtures/l3_core_service_fixtures.py b/test/fixtures/l3_core_service_fixtures.py index c810d6412a03eaaeda1a44f8cd1c7093a3247942..34f3c185ea42a803f3de28eaf507c02bb292f48e 100644 --- a/test/fixtures/l3_core_service_fixtures.py +++ b/test/fixtures/l3_core_service_fixtures.py @@ -4,7 +4,7 @@ from uuid import uuid4 import pytest from orchestrator.db import db from orchestrator.domain import SubscriptionModel -from orchestrator.types import SubscriptionLifecycle, UUIDstr +from orchestrator.types import SubscriptionLifecycle from pydantic import NonNegativeInt from gso.products import ProductName @@ -114,7 +114,7 @@ def service_binding_port_factory( bgp_session_subscription_factory(families=[IPFamily.V4UNICAST]), bgp_session_subscription_factory(families=[IPFamily.V6UNICAST], peer_address=faker.ipv6()), ], - edge_port=edge_port or EdgePort.from_subscription(edge_port_subscription_factory()).edge_port, + edge_port=edge_port or edge_port_subscription_factory().edge_port, v4_bfd_settings=v4_bfd_settings or bfd_settings_factory(), v6_bfd_settings=v6_bfd_settings or bfd_settings_factory(), ) @@ -152,7 +152,7 @@ def l3_core_service_subscription_factory( start_date="2023-05-24T00:00:00+00:00", status: SubscriptionLifecycle | None = None, edge_port: EdgePort | None = None, - ) -> UUIDstr: + ) -> SubscriptionModel: partner = partner or partner_factory() match l3_core_service_type: case L3CoreServiceType.GEANT_IP: @@ -227,6 +227,6 @@ def l3_core_service_subscription_factory( db.session.commit() - return str(l3_core_service_subscription.subscription_id) + return l3_core_service_subscription return create_l3_core_service_subscription diff --git a/test/fixtures/lan_switch_interconnect_fixtures.py b/test/fixtures/lan_switch_interconnect_fixtures.py index e2cb053263cc153bc57a9139041754c8bf648d2c..40f95374d3cb04da15995e7ab7601eaadc51a6a4 100644 --- a/test/fixtures/lan_switch_interconnect_fixtures.py +++ b/test/fixtures/lan_switch_interconnect_fixtures.py @@ -15,8 +15,6 @@ from gso.products.product_types.lan_switch_interconnect import ( ImportedLanSwitchInterconnectInactive, LanSwitchInterconnectInactive, ) -from gso.products.product_types.router import Router -from gso.products.product_types.switch import Switch from gso.services.subscriptions import get_product_id_by_name from gso.utils.types.virtual_identifiers import ( DEFAULT_DCN_MANAGEMENT_VLAN_ID, @@ -41,12 +39,12 @@ def lan_switch_interconnect_subscription_factory( router_side_node: UUIDstr | None = None, router_side_ae_iface: str | None = None, router_side_ae_members: list[dict[str, str]] | None = None, - switch_side_switch: UUIDstr | None = None, + switch_side_switch: SubscriptionModel | None = None, switch_side_ae_iface: str | None = None, switch_side_ae_members: list[dict[str, str]] | None = None, *, is_imported: bool | None = False, - ) -> UUIDstr: + ) -> SubscriptionModel: if partner is None: partner = geant_partner if is_imported: @@ -75,13 +73,13 @@ def lan_switch_interconnect_subscription_factory( subscription.lan_switch_interconnect.minimum_links = minimum_links or 1 subscription.lan_switch_interconnect.router_side = LanSwitchInterconnectRouterSideBlockInactive.new( uuid4(), - node=router_side_node or Router.from_subscription(router_subscription_factory()).router, + node=router_side_node or router_subscription_factory().router, ae_iface=router_side_ae_iface or faker.network_interface(), ae_members=router_side_ae_members, ) subscription.lan_switch_interconnect.switch_side = LanSwitchInterconnectSwitchSideBlockInactive.new( uuid4(), - switch=switch_side_switch or Switch.from_subscription(switch_subscription_factory()).switch, + switch=switch_side_switch.site if switch_side_switch else switch_subscription_factory().switch, ae_iface=switch_side_ae_iface or faker.network_interface(), ae_members=switch_side_ae_members, ) @@ -103,6 +101,6 @@ def lan_switch_interconnect_subscription_factory( subscription.save() db.session.commit() - return str(subscription.subscription_id) + return subscription return create_subscription diff --git a/test/fixtures/layer_2_circuit_fixtures.py b/test/fixtures/layer_2_circuit_fixtures.py index b8772cf44c08c58ed2fdc77a1ec5d21504b668bc..bc51655294edf5c638b967aa8799bc9d3ac63674 100644 --- a/test/fixtures/layer_2_circuit_fixtures.py +++ b/test/fixtures/layer_2_circuit_fixtures.py @@ -41,7 +41,7 @@ def layer_2_circuit_subscription_factory(faker, geant_partner, edge_port_subscri gs_id: str | None = None, *, policer_enabled: bool = False, - ) -> UUIDstr: + ) -> SubscriptionModel: # Assign default partner if none provided if partner is None: partner = geant_partner @@ -74,8 +74,14 @@ def layer_2_circuit_subscription_factory(faker, geant_partner, edge_port_subscri layer_2_circuit_sides = [] for edge_port, vlan_id in [ - (layer_2_circuit_side_a_edgeport or edge_port_subscription_factory(), vlan_id_side_a or faker.vlan_id()), - (layer_2_circuit_side_b_edgeport or edge_port_subscription_factory(), vlan_id_side_b or faker.vlan_id()), + ( + layer_2_circuit_side_a_edgeport or str(edge_port_subscription_factory().subscription_id), + vlan_id_side_a or faker.vlan_id(), + ), + ( + layer_2_circuit_side_b_edgeport or str(edge_port_subscription_factory().subscription_id), + vlan_id_side_b or faker.vlan_id(), + ), ]: sbp = ServiceBindingPortInactive.new( uuid4(), @@ -119,6 +125,6 @@ def layer_2_circuit_subscription_factory(faker, geant_partner, edge_port_subscri subscription.save() db.session.commit() - return str(subscription.subscription_id) + return subscription return create_subscription diff --git a/test/fixtures/office_router_fixtures.py b/test/fixtures/office_router_fixtures.py index 070e3c9f517836fbeb81d1a0bda59525d6da25d7..bb9d999bc73a09897f61d551852d210351d25230 100644 --- a/test/fixtures/office_router_fixtures.py +++ b/test/fixtures/office_router_fixtures.py @@ -3,11 +3,10 @@ import ipaddress import pytest from orchestrator.db import db from orchestrator.domain import SubscriptionModel -from orchestrator.types import SubscriptionLifecycle, UUIDstr +from orchestrator.types import SubscriptionLifecycle from gso.products import ProductName from gso.products.product_types.office_router import ImportedOfficeRouterInactive, OfficeRouterInactive -from gso.products.product_types.site import Site from gso.services import subscriptions from gso.utils.shared_enums import Vendor @@ -26,7 +25,7 @@ def office_router_subscription_factory(site_subscription_factory, faker, geant_p partner: dict | None = None, *, is_imported: bool | None = False, - ) -> UUIDstr: + ) -> SubscriptionModel: if partner is None: partner = geant_partner @@ -52,7 +51,7 @@ def office_router_subscription_factory(site_subscription_factory, faker, geant_p office_router_subscription.office_router.office_router_ts_port = office_router_ts_port office_router_subscription.office_router.office_router_lo_ipv4_address = office_router_lo_ipv4_address office_router_subscription.office_router.office_router_lo_ipv6_address = office_router_lo_ipv6_address - office_router_subscription.office_router.office_router_site = Site.from_subscription(office_router_site).site + office_router_subscription.office_router.office_router_site = office_router_site.site office_router_subscription.office_router.vendor = Vendor.NOKIA office_router_subscription = SubscriptionModel.from_other_lifecycle( @@ -67,6 +66,6 @@ def office_router_subscription_factory(site_subscription_factory, faker, geant_p office_router_subscription.save() db.session.commit() - return str(office_router_subscription.subscription_id) + return office_router_subscription return subscription_create diff --git a/test/fixtures/opengear_fixtures.py b/test/fixtures/opengear_fixtures.py index 93e0b7c6f841d14df22ce9df58843864d9df9a31..6cf11b218c39342be95301f9b27470f53ae53c08 100644 --- a/test/fixtures/opengear_fixtures.py +++ b/test/fixtures/opengear_fixtures.py @@ -1,11 +1,10 @@ import pytest from orchestrator.db import db from orchestrator.domain import SubscriptionModel -from orchestrator.types import SubscriptionLifecycle, UUIDstr +from orchestrator.types import SubscriptionLifecycle from gso.products import ProductName from gso.products.product_types.opengear import ImportedOpengearInactive, OpengearInactive -from gso.products.product_types.site import Site from gso.services import subscriptions @@ -23,7 +22,7 @@ def opengear_subscription_factory(site_subscription_factory, faker, geant_partne partner: dict | None = None, *, is_imported: bool | None = False, - ) -> UUIDstr: + ) -> SubscriptionModel: if partner is None: partner = geant_partner @@ -45,7 +44,7 @@ def opengear_subscription_factory(site_subscription_factory, faker, geant_partne product_id, customer_id=partner["partner_id"], insync=True ) - opengear_subscription.opengear.opengear_site = Site.from_subscription(opengear_site).site + opengear_subscription.opengear.opengear_site = opengear_site.site opengear_subscription.opengear.opengear_hostname = opengear_hostname opengear_subscription.opengear.opengear_wan_address = opengear_wan_address opengear_subscription.opengear.opengear_wan_netmask = opengear_wan_netmask @@ -63,6 +62,6 @@ def opengear_subscription_factory(site_subscription_factory, faker, geant_partne opengear_subscription.save() db.session.commit() - return str(opengear_subscription.subscription_id) + return opengear_subscription return subscription_create diff --git a/test/fixtures/router_fixtures.py b/test/fixtures/router_fixtures.py index 1ae14dcc4cc420e187a3fc7efbb59d62efef3d5a..f74f49544aa699167d44250f156cd472ac2e4a1b 100644 --- a/test/fixtures/router_fixtures.py +++ b/test/fixtures/router_fixtures.py @@ -3,12 +3,11 @@ import ipaddress import pytest from orchestrator.db import db from orchestrator.domain import SubscriptionModel -from orchestrator.types import SubscriptionLifecycle, UUIDstr +from orchestrator.types import SubscriptionLifecycle from gso.products import ProductName from gso.products.product_blocks.router import RouterRole from gso.products.product_types.router import ImportedRouterInactive, RouterInactive -from gso.products.product_types.site import Site from gso.services import subscriptions from gso.utils.helpers import iso_from_ipv4 from gso.utils.shared_enums import Vendor @@ -33,7 +32,7 @@ def router_subscription_factory(site_subscription_factory, faker, geant_partner) *, router_access_via_ts: bool | None = None, is_imported: bool | None = False, - ) -> UUIDstr: + ) -> SubscriptionModel: if partner is None: partner = geant_partner if is_imported: @@ -58,7 +57,7 @@ def router_subscription_factory(site_subscription_factory, faker, geant_partner) ) router_subscription.router.router_lo_iso_address = router_lo_iso_address or iso_from_ipv4(faker.ipv4()) router_subscription.router.router_role = router_role - router_subscription.router.router_site = Site.from_subscription(router_site or site_subscription_factory()).site + router_subscription.router.router_site = router_site.site if router_site else site_subscription_factory().site router_subscription.router.vendor = vendor router_subscription = SubscriptionModel.from_other_lifecycle(router_subscription, SubscriptionLifecycle.ACTIVE) @@ -72,6 +71,6 @@ def router_subscription_factory(site_subscription_factory, faker, geant_partner) router_subscription.save() db.session.commit() - return str(router_subscription.subscription_id) + return router_subscription return subscription_create diff --git a/test/fixtures/site_fixtures.py b/test/fixtures/site_fixtures.py index c97c11b38528ec1dcd3c43410d6a62e5bf52cedb..cdbf0eb7a61924a9006b64dbad2da3f02effdf72 100644 --- a/test/fixtures/site_fixtures.py +++ b/test/fixtures/site_fixtures.py @@ -1,7 +1,7 @@ import pytest from orchestrator.db import db from orchestrator.domain import SubscriptionModel -from orchestrator.types import SubscriptionLifecycle, UUIDstr +from orchestrator.types import SubscriptionLifecycle from gso.products import ProductName from gso.products.product_blocks.site import SiteTier @@ -32,7 +32,7 @@ def site_subscription_factory(faker, geant_partner): *, is_imported: bool | None = False, site_contains_optical_equipment: bool | None = True, - ) -> UUIDstr: + ) -> SubscriptionModel: if partner is None: partner = geant_partner @@ -66,6 +66,6 @@ def site_subscription_factory(faker, geant_partner): site_subscription.save() db.session.commit() - return str(site_subscription.subscription_id) + return site_subscription return subscription_create diff --git a/test/fixtures/super_pop_switch_fixtures.py b/test/fixtures/super_pop_switch_fixtures.py index 464c0360a910f008e732e14bf477e382e66b56c6..ac791f7ba4f3abad8fa9d192745bf7335cacc69f 100644 --- a/test/fixtures/super_pop_switch_fixtures.py +++ b/test/fixtures/super_pop_switch_fixtures.py @@ -3,10 +3,9 @@ import ipaddress import pytest from orchestrator.db import db from orchestrator.domain import SubscriptionModel -from orchestrator.types import SubscriptionLifecycle, UUIDstr +from orchestrator.types import SubscriptionLifecycle from gso.products import ProductName -from gso.products.product_types.site import Site from gso.products.product_types.super_pop_switch import ImportedSuperPopSwitchInactive, SuperPopSwitchInactive from gso.services import subscriptions from gso.utils.shared_enums import Vendor @@ -25,7 +24,7 @@ def super_pop_switch_subscription_factory(site_subscription_factory, faker, gean partner: dict | None = None, *, is_imported: bool | None = False, - ) -> UUIDstr: + ) -> SubscriptionModel: if partner is None: partner = geant_partner @@ -51,9 +50,7 @@ def super_pop_switch_subscription_factory(site_subscription_factory, faker, gean super_pop_switch_subscription.super_pop_switch.super_pop_switch_mgmt_ipv4_address = ( super_pop_switch_mgmt_ipv4_address ) - super_pop_switch_subscription.super_pop_switch.super_pop_switch_site = Site.from_subscription( - super_pop_switch_site - ).site + super_pop_switch_subscription.super_pop_switch.super_pop_switch_site = super_pop_switch_site.site super_pop_switch_subscription.super_pop_switch.vendor = Vendor.NOKIA super_pop_switch_subscription = SubscriptionModel.from_other_lifecycle( @@ -68,6 +65,6 @@ def super_pop_switch_subscription_factory(site_subscription_factory, faker, gean super_pop_switch_subscription.save() db.session.commit() - return str(super_pop_switch_subscription.subscription_id) + return super_pop_switch_subscription return subscription_create diff --git a/test/fixtures/switch_fixtures.py b/test/fixtures/switch_fixtures.py index 1c42b54caae75d76042b7b311a11ab522806d064..005c44e981eb7d69c2c8821ac58bc8c6f2604988 100644 --- a/test/fixtures/switch_fixtures.py +++ b/test/fixtures/switch_fixtures.py @@ -6,7 +6,6 @@ from pydantic_forms.types import UUIDstr from gso.products import ProductName from gso.products.product_blocks.switch import SwitchModel -from gso.products.product_types.site import Site from gso.products.product_types.switch import ImportedSwitchInactive, SwitchInactive from gso.services.subscriptions import get_product_id_by_name from gso.utils.shared_enums import Vendor @@ -27,7 +26,7 @@ def switch_subscription_factory(faker, geant_partner, site_subscription_factory) status: SubscriptionLifecycle | None = None, *, is_imported: bool = False, - ) -> UUIDstr: + ) -> SubscriptionModel: if partner is None: partner = geant_partner if is_imported: @@ -40,7 +39,7 @@ def switch_subscription_factory(faker, geant_partner, site_subscription_factory) switch_subscription.switch.fqdn = fqdn or faker.domain_name(levels=4) switch_subscription.switch.ts_port = ts_port or faker.port_number(is_user=True) - switch_subscription.switch.site = site or Site.from_subscription(site_subscription_factory()).site + switch_subscription.switch.site = site or site_subscription_factory().site switch_subscription.switch.switch_vendor = switch_vendor or Vendor.JUNIPER switch_subscription.switch.switch_model = switch_model or SwitchModel.EX3400_24T @@ -55,6 +54,6 @@ def switch_subscription_factory(faker, geant_partner, site_subscription_factory) switch_subscription.save() db.session.commit() - return str(switch_subscription.subscription_id) + return switch_subscription return subscription_create diff --git a/test/fixtures/vrf_fixtures.py b/test/fixtures/vrf_fixtures.py index ec1354fff75c9e675868b15f30dcf4406077fae9..09b02ed2683d7aa805654711bcaba9d56503e706 100644 --- a/test/fixtures/vrf_fixtures.py +++ b/test/fixtures/vrf_fixtures.py @@ -2,7 +2,6 @@ import pytest from orchestrator.db import db from orchestrator.domain import SubscriptionModel from orchestrator.types import SubscriptionLifecycle -from pydantic_forms.types import UUIDstr from gso.products import ProductName from gso.products.product_types.vrf import VRFInactive @@ -20,7 +19,7 @@ def vrf_subscription_factory(faker, geant_partner): route_target: str | None = None, vrf_as_number: int | None = None, status: SubscriptionLifecycle | None = None, - ) -> UUIDstr: + ) -> SubscriptionModel: if partner is None: partner = geant_partner product_id = get_product_id_by_name(ProductName.VRF) @@ -40,6 +39,6 @@ def vrf_subscription_factory(faker, geant_partner): vrf_subscription.save() db.session.commit() - return str(vrf_subscription.subscription_id) + return vrf_subscription return subscription_create diff --git a/test/utils/test_helpers.py b/test/utils/test_helpers.py index 6b62f2bb4554c23fd80dd27ed793d6eeac0577f8..ca8d2c034cffce6176f0a127bba7e01795d517b7 100644 --- a/test/utils/test_helpers.py +++ b/test/utils/test_helpers.py @@ -5,8 +5,6 @@ from orchestrator.types import SubscriptionLifecycle from gso.products.product_blocks.iptrunk import IptrunkInterfaceBlock from gso.products.product_blocks.router import RouterRole -from gso.products.product_types.router import Router -from gso.products.product_types.site import Site from gso.utils.helpers import ( available_interfaces_choices_including_current_members, generate_inventory_for_routers, @@ -104,7 +102,7 @@ def test_tt_number(generate_tt_numbers): def test_generate_inventory_for_active_routers_with_single_active_router(router_subscription_factory): """Test the generation of inventory for a single active P router.""" - router = Router.from_subscription(router_subscription_factory(router_role=RouterRole.P)) + router = router_subscription_factory(router_role=RouterRole.P) expected_result = { "all": { "hosts": { @@ -139,7 +137,7 @@ def test_generate_inventory_for_active_routers_with_excluded_router(router_subsc for _ in range(5): router_subscription_factory(router_role=RouterRole.P) router = router_subscription_factory(router_role=RouterRole.P) - excluded_routers = [Router.from_subscription(router).router.router_fqdn] + excluded_routers = [router.router.router_fqdn] inventory = generate_inventory_for_routers(RouterRole.P, exclude_routers=excluded_routers) assert len(inventory["all"]["hosts"]) == 5 # 6 P routers, the last one is excluded, so 5 P routers are left. @@ -150,7 +148,7 @@ def test_generate_lan_switch_interconnect_subnet_v4(execution_count, site_subscr We need to ensure that the third octet of the new subnet is set correctly from the Site internal ID. """ - site = Site.from_subscription(site_subscription_factory()) + site = site_subscription_factory() assert ( str(generate_lan_switch_interconnect_subnet_v4(site.site.site_internal_id)) == f"10.2.{site.site.site_internal_id}.0/24" @@ -159,7 +157,7 @@ def test_generate_lan_switch_interconnect_subnet_v4(execution_count, site_subscr @pytest.mark.parametrize("execution_count", range(10)) def test_generate_lan_switch_interconnect_subnet_v6(execution_count, site_subscription_factory): - site = Site.from_subscription(site_subscription_factory()) + site = site_subscription_factory() assert ( str(generate_lan_switch_interconnect_subnet_v6(site.site.site_internal_id)) == f"beef:cafe:0:{hex(site.site.site_internal_id).split("x")[-1]}::/64" diff --git a/test/workflows/edge_port/test_create_edge_port.py b/test/workflows/edge_port/test_create_edge_port.py index 9690b587f62f574b701646e5a2de92b76bc52033..4a4e9770df9c8919f85a696df18f226dd8ef7d64 100644 --- a/test/workflows/edge_port/test_create_edge_port.py +++ b/test/workflows/edge_port/test_create_edge_port.py @@ -46,7 +46,7 @@ def _netbox_client_mock(): def input_form_wizard_data(request, router_subscription_factory, partner_factory, faker): create_edge_port_step = { "tt_number": faker.tt_number(), - "node": router_subscription_factory(vendor=Vendor.NOKIA), + "node": str(router_subscription_factory(vendor=Vendor.NOKIA).subscription_id), "partner": partner_factory(name="GAAR", email=faker.email())["partner_id"], "service_type": EdgePortType.PUBLIC, "enable_lacp": True, diff --git a/test/workflows/edge_port/test_create_imported_edge_port.py b/test/workflows/edge_port/test_create_imported_edge_port.py index ab558bfb1787058a3c548f6aeefaf70cf7237032..4563c8e503312ae098defd7e17283afdc1645850 100644 --- a/test/workflows/edge_port/test_create_imported_edge_port.py +++ b/test/workflows/edge_port/test_create_imported_edge_port.py @@ -11,7 +11,7 @@ from test.workflows import assert_complete, extract_state, run_workflow @pytest.fixture() def imported_edge_port_creation_input_form_data(router_subscription_factory, partner_factory, faker): return { - "node": router_subscription_factory(vendor=Vendor.NOKIA), + "node": str(router_subscription_factory(vendor=Vendor.NOKIA).subscription_id), "service_type": EdgePortType.CUSTOMER, "speed": PhysicalPortCapacity.TEN_GIGABIT_PER_SECOND, "encapsulation": EncapsulationType.DOT1Q, diff --git a/test/workflows/edge_port/test_import_edge_port.py b/test/workflows/edge_port/test_import_edge_port.py index d417a59bccf7727fe1d49a31f959833fd3d683e3..c63360ce481b0a7ad21a31a0fd61aa742ada4bd0 100644 --- a/test/workflows/edge_port/test_import_edge_port.py +++ b/test/workflows/edge_port/test_import_edge_port.py @@ -9,8 +9,8 @@ from test.workflows import assert_complete, run_workflow @pytest.mark.workflow() def test_import_edge_port_success(edge_port_subscription_factory): imported_edge_port = edge_port_subscription_factory(is_imported=True) - result, _, _ = run_workflow("import_edge_port", [{"subscription_id": imported_edge_port}]) - subscription = EdgePort.from_subscription(imported_edge_port) + result, _, _ = run_workflow("import_edge_port", [{"subscription_id": str(imported_edge_port.subscription_id)}]) + subscription = EdgePort.from_subscription(imported_edge_port.subscription_id) assert_complete(result) assert subscription.product.name == ProductName.EDGE_PORT diff --git a/test/workflows/edge_port/test_modify_edge_port.py b/test/workflows/edge_port/test_modify_edge_port.py index d62598b64e717795cc2746ab39f1e6b052802347..0d71e92cbc07513f1026bc06924c778ed4800ded 100644 --- a/test/workflows/edge_port/test_modify_edge_port.py +++ b/test/workflows/edge_port/test_modify_edge_port.py @@ -16,7 +16,7 @@ from test.workflows.iptrunk.test_create_iptrunk import MockedNetboxClient @pytest.fixture() def input_form_wizard_data(request, faker, edge_port_subscription_factory, partner_factory): - subscription_id = edge_port_subscription_factory() + subscription_id = str(edge_port_subscription_factory().subscription_id) return [ {"subscription_id": subscription_id}, @@ -112,7 +112,7 @@ def test_modify_edge_port_with_changing_capacity( @pytest.fixture() def input_form_wizard_without_changing_capacity(request, faker, edge_port_subscription_factory, partner_factory): - subscription_id = edge_port_subscription_factory() + subscription_id = str(edge_port_subscription_factory().subscription_id) subscription = EdgePort.from_subscription(subscription_id) return [ diff --git a/test/workflows/edge_port/test_terminate_edge_port.py b/test/workflows/edge_port/test_terminate_edge_port.py index 6ae7967726af992c8f8c2819b2bf99d51c56c4ea..58c7d087208913006c52988d4b7cbf87330ff033 100644 --- a/test/workflows/edge_port/test_terminate_edge_port.py +++ b/test/workflows/edge_port/test_terminate_edge_port.py @@ -24,7 +24,7 @@ def test_successful_edge_port_termination( faker, ): # Set up mock return values - subscription_id = edge_port_subscription_factory() + subscription_id = str(edge_port_subscription_factory().subscription_id) mocked_netbox = MockedNetboxClient() mocked_delete_interface.return_value = mocked_netbox.delete_interface() mocked_free_interface.return_value = mocked_netbox.free_interface() diff --git a/test/workflows/edge_port/test_validate_edge_port.py b/test/workflows/edge_port/test_validate_edge_port.py index 94494da13d0828184a9898ff0d7cfc9b5f4b8ee7..d6ce39e05b49f5017a10364961191fd6a24486e9 100644 --- a/test/workflows/edge_port/test_validate_edge_port.py +++ b/test/workflows/edge_port/test_validate_edge_port.py @@ -21,7 +21,7 @@ def test_validate_edge_port_success( edge_port_subscription_factory, faker, ): - subscription_id = edge_port_subscription_factory() + subscription_id = str(edge_port_subscription_factory().subscription_id) mock_get_interface_by_name_and_device.side_effect = [ MockedNetboxClient.BaseMockObject( name="iFace1", diff --git a/test/workflows/iptrunk/test_activate_iptrunk.py b/test/workflows/iptrunk/test_activate_iptrunk.py index d1ed9b3347e52f902952dbff1eec2bbc5e1ffaf1..b3a284b49700353653958c779f0498f9e18666fc 100644 --- a/test/workflows/iptrunk/test_activate_iptrunk.py +++ b/test/workflows/iptrunk/test_activate_iptrunk.py @@ -16,7 +16,7 @@ def test_activate_router_success( faker, ): # Set up mock return values - product_id = iptrunk_subscription_factory(status="provisioning") + product_id = str(iptrunk_subscription_factory(status="provisioning").subscription_id) # Sanity check assert Iptrunk.from_subscription(product_id).status == "provisioning" diff --git a/test/workflows/iptrunk/test_create_imported_iptrunk.py b/test/workflows/iptrunk/test_create_imported_iptrunk.py index deaa2ddd519b8f699633e35d6713414f4e3db8d1..93b47096ae9364e13e095da3e74189cab1e87bd4 100644 --- a/test/workflows/iptrunk/test_create_imported_iptrunk.py +++ b/test/workflows/iptrunk/test_create_imported_iptrunk.py @@ -22,13 +22,13 @@ def workflow_input_data(faker, router_subscription_factory): "iptrunk_speed": PhysicalPortCapacity.FOUR_HUNDRED_GIGABIT_PER_SECOND, "iptrunk_minimum_links": 2, "iptrunk_isis_metric": 10000, - "side_a_node_id": router_subscription_factory(), + "side_a_node_id": str(router_subscription_factory().subscription_id), "side_a_ae_iface": faker.network_interface(), "side_a_ga_id": faker.imported_ga_id(), "side_a_ae_members": [ {"interface_name": faker.network_interface(), "interface_description": faker.sentence()} for _ in range(3) ], - "side_b_node_id": router_subscription_factory(), + "side_b_node_id": str(router_subscription_factory().subscription_id), "side_b_ae_iface": faker.network_interface(), "side_b_ga_id": faker.imported_ga_id(), "side_b_ae_members": [ diff --git a/test/workflows/iptrunk/test_create_iptrunk.py b/test/workflows/iptrunk/test_create_iptrunk.py index f6b0092752c43a017dac42e5727e462b58bea6fd..c9e5abdc65aaa1092cc62783171a2c498aaad1a2 100644 --- a/test/workflows/iptrunk/test_create_iptrunk.py +++ b/test/workflows/iptrunk/test_create_iptrunk.py @@ -49,14 +49,14 @@ def _netbox_client_mock(): @pytest.fixture() def input_form_wizard_data(request, router_subscription_factory, faker): vendor = getattr(request, "param", Vendor.NOKIA) - router_side_a = router_subscription_factory() + router_side_a = str(router_subscription_factory().subscription_id) # Set side b router to Juniper if vendor == Vendor.JUNIPER: - router_side_b = router_subscription_factory(vendor=Vendor.JUNIPER) + router_side_b = str(router_subscription_factory(vendor=Vendor.JUNIPER).subscription_id) side_b_members = faker.link_members_juniper()[0:2] else: - router_side_b = router_subscription_factory() + router_side_b = str(router_subscription_factory().subscription_id) side_b_members = [ {"interface_name": f"Interface{interface}", "interface_description": faker.sentence()} for interface in range(2) diff --git a/test/workflows/iptrunk/test_deploy_twamp.py b/test/workflows/iptrunk/test_deploy_twamp.py index 1b475140658105d076e6f1d0465d5bd9b5e78281..7791940fc60458a6c9eadb3e5c5fef0125c2dd5a 100644 --- a/test/workflows/iptrunk/test_deploy_twamp.py +++ b/test/workflows/iptrunk/test_deploy_twamp.py @@ -19,7 +19,7 @@ def test_iptrunk_deploy_twamp_success( faker, ): # Set up mock return values - product_id = iptrunk_subscription_factory() + product_id = str(iptrunk_subscription_factory().subscription_id) # Run workflow initial_input_data = [{"subscription_id": product_id}, {"tt_number": faker.tt_number()}] diff --git a/test/workflows/iptrunk/test_import_iptrunk.py b/test/workflows/iptrunk/test_import_iptrunk.py index eeca3e310cd8c9be1f1980a33c035dc8d465b0f7..a7b8887b97144265ce40e57ef654ec6a7ca21851 100644 --- a/test/workflows/iptrunk/test_import_iptrunk.py +++ b/test/workflows/iptrunk/test_import_iptrunk.py @@ -8,7 +8,7 @@ from test.workflows import assert_complete, run_workflow @pytest.mark.workflow() def test_import_iptrunk_success(iptrunk_subscription_factory): - imported_iptrunk = iptrunk_subscription_factory(is_imported=True) + imported_iptrunk = str(iptrunk_subscription_factory(is_imported=True).subscription_id) result, _, _ = run_workflow("import_iptrunk", [{"subscription_id": imported_iptrunk}]) subscription = Iptrunk.from_subscription(imported_iptrunk) diff --git a/test/workflows/iptrunk/test_migrate_iptrunk.py b/test/workflows/iptrunk/test_migrate_iptrunk.py index 2ed47dcc19473f818ffa6e6525a4db40018e26cd..ce7d256e6fdd7660713ff83a0251fec6826d0824 100644 --- a/test/workflows/iptrunk/test_migrate_iptrunk.py +++ b/test/workflows/iptrunk/test_migrate_iptrunk.py @@ -33,9 +33,8 @@ def migrate_form_input( if use_juniper == UseJuniperSide.SIDE_A: # Nokia -> Juniper - product_id = iptrunk_subscription_factory() - old_subscription = Iptrunk.from_subscription(product_id) - new_router = router_subscription_factory(vendor=Vendor.JUNIPER) + old_subscription = iptrunk_subscription_factory() + new_router = str(router_subscription_factory(vendor=Vendor.JUNIPER).subscription_id) replace_side = str(old_subscription.iptrunk.iptrunk_sides[0].iptrunk_side_node.subscription.subscription_id) new_side_ae_members = new_side_ae_members_juniper lag_name = "ae1" @@ -45,9 +44,8 @@ def migrate_form_input( old_side_a_node = iptrunk_side_subscription_factory(iptrunk_side_node=old_side_a_node) old_side_b_node = router_subscription_factory(vendor=Vendor.JUNIPER) old_side_b_node = iptrunk_side_subscription_factory(iptrunk_side_node=old_side_b_node) - product_id = iptrunk_subscription_factory(iptrunk_sides=[old_side_a_node, old_side_b_node]) - old_subscription = Iptrunk.from_subscription(product_id) - new_router = router_subscription_factory() + old_subscription = iptrunk_subscription_factory(iptrunk_sides=[old_side_a_node, old_side_b_node]) + new_router = str(router_subscription_factory().subscription_id) replace_side = str(old_subscription.iptrunk.iptrunk_sides[0].iptrunk_side_node.subscription.subscription_id) new_side_ae_members = new_side_ae_members_nokia lag_name = "lag-1" @@ -57,23 +55,21 @@ def migrate_form_input( old_side_a_node = iptrunk_side_subscription_factory(iptrunk_side_node=old_side_a_node) old_side_b_node = router_subscription_factory(vendor=Vendor.JUNIPER) old_side_b_node = iptrunk_side_subscription_factory(iptrunk_side_node=old_side_b_node) - product_id = iptrunk_subscription_factory(iptrunk_sides=[old_side_a_node, old_side_b_node]) - old_subscription = Iptrunk.from_subscription(product_id) - new_router = router_subscription_factory(vendor=Vendor.JUNIPER) + old_subscription = iptrunk_subscription_factory(iptrunk_sides=[old_side_a_node, old_side_b_node]) + new_router = str(router_subscription_factory(vendor=Vendor.JUNIPER).subscription_id) replace_side = str(old_subscription.iptrunk.iptrunk_sides[0].iptrunk_side_node.subscription.subscription_id) new_side_ae_members = new_side_ae_members_juniper lag_name = "ae1" else: # Nokia -> Nokia - product_id = iptrunk_subscription_factory() - old_subscription = Iptrunk.from_subscription(product_id) - new_router = router_subscription_factory() + old_subscription = iptrunk_subscription_factory() + new_router = str(router_subscription_factory().subscription_id) replace_side = str(old_subscription.iptrunk.iptrunk_sides[0].iptrunk_side_node.subscription.subscription_id) new_side_ae_members = new_side_ae_members_nokia lag_name = "lag-1" return [ - {"subscription_id": product_id}, + {"subscription_id": str(old_subscription.subscription_id)}, { "tt_number": faker.tt_number(), "replace_side": replace_side, diff --git a/test/workflows/iptrunk/test_modify_isis_metric.py b/test/workflows/iptrunk/test_modify_isis_metric.py index f81baac86f23d5abb4e85d84b61ac84edccaeb92..551ab0c2628e144013376093353babf2f8f6221d 100644 --- a/test/workflows/iptrunk/test_modify_isis_metric.py +++ b/test/workflows/iptrunk/test_modify_isis_metric.py @@ -19,7 +19,7 @@ def test_iptrunk_modify_isis_metric_success( faker, ): # Set up mock return values - product_id = iptrunk_subscription_factory() + product_id = str(iptrunk_subscription_factory().subscription_id) new_isis_metric = faker.pyint() # Run workflow diff --git a/test/workflows/iptrunk/test_modify_trunk_interface.py b/test/workflows/iptrunk/test_modify_trunk_interface.py index 2f77576dae1a9b712dd5a89f8aa2124d99ae9a4a..e13b5e068a2fee2680c02442e24351feb776667c 100644 --- a/test/workflows/iptrunk/test_modify_trunk_interface.py +++ b/test/workflows/iptrunk/test_modify_trunk_interface.py @@ -51,7 +51,7 @@ def input_form_iptrunk_data( new_side_a_ae_members = faker.link_members_nokia()[0:2] new_side_b_ae_members = faker.link_members_nokia()[0:2] - product_id = iptrunk_subscription_factory(iptrunk_sides=[side_a_node, side_b_node]) + product_id = str(iptrunk_subscription_factory(iptrunk_sides=[side_a_node, side_b_node]).subscription_id) new_sid = faker.gs_id() new_description = faker.sentence() diff --git a/test/workflows/iptrunk/test_terminate_iptrunk.py b/test/workflows/iptrunk/test_terminate_iptrunk.py index 9e1ab25e551d2e5c9aa4154b55456544aae2bbf2..14c6c5298d16e58b1dba9f9b97570d56af2e9120 100644 --- a/test/workflows/iptrunk/test_terminate_iptrunk.py +++ b/test/workflows/iptrunk/test_terminate_iptrunk.py @@ -29,7 +29,7 @@ def test_successful_iptrunk_termination( router_subscription_factory, ): # Set up mock return values - product_id = iptrunk_subscription_factory() + product_id = str(iptrunk_subscription_factory().subscription_id) mocked_netbox = MockedNetboxClient() mocked_delete_interface.return_value = mocked_netbox.delete_interface() mocked_free_interface.return_value = mocked_netbox.free_interface() diff --git a/test/workflows/iptrunk/test_validate_iptrunk.py b/test/workflows/iptrunk/test_validate_iptrunk.py index 5a8d924109f592d7de80bcf16ca68bb7801895c7..a6460cb3a59a823f5812d0fcf71120db907edd5f 100644 --- a/test/workflows/iptrunk/test_validate_iptrunk.py +++ b/test/workflows/iptrunk/test_validate_iptrunk.py @@ -64,8 +64,9 @@ def test_validate_iptrunk_success( # Mock value setup side_a = iptrunk_side_subscription_factory(iptrunk_side_node=router_subscription_factory(side_a_vendor)) side_b = iptrunk_side_subscription_factory(iptrunk_side_node=router_subscription_factory(side_b_vendor)) - subscription_id = iptrunk_subscription_factory(iptrunk_sides=[side_a, side_b], status=subscription_status) - trunk = Iptrunk.from_subscription(subscription_id).iptrunk + iptrunk = iptrunk_subscription_factory(iptrunk_sides=[side_a, side_b], status=subscription_status) + subscription_id = str(iptrunk.subscription_id) + trunk = iptrunk.iptrunk mock_find_network_by_cidr.side_effects = [ objects.Network(connector=None, ipv4addrs=[trunk.iptrunk_ipv4_network]), objects.NetworkV6(connector=None, ipv6addrs=[trunk.iptrunk_ipv6_network]), @@ -219,7 +220,9 @@ def test_validate_iptrunk_skip_legacy_trunks( # Mock value setup side_a = iptrunk_side_subscription_factory(iptrunk_side_node=router_subscription_factory(vendor=Vendor.JUNIPER)) side_b = iptrunk_side_subscription_factory(iptrunk_side_node=router_subscription_factory(vendor=Vendor.JUNIPER)) - subscription_id = iptrunk_subscription_factory(iptrunk_sides=[side_a, side_b], status=subscription_status) + subscription_id = str( + iptrunk_subscription_factory(iptrunk_sides=[side_a, side_b], status=subscription_status).subscription_id + ) # Run workflow initial_router_data = [{"subscription_id": subscription_id}] diff --git a/test/workflows/l2_circuit/test_create_imported_layer_2_circuit.py b/test/workflows/l2_circuit/test_create_imported_layer_2_circuit.py index 3d0e78709dd4b708af3e46cdd19110611edbbfc4..dad5974d22ba81b0a1913f521d5319f0b982c495 100644 --- a/test/workflows/l2_circuit/test_create_imported_layer_2_circuit.py +++ b/test/workflows/l2_circuit/test_create_imported_layer_2_circuit.py @@ -14,8 +14,8 @@ def test_create_imported_layer_2_circuit_success( faker, partner_factory, edge_port_subscription_factory, layer_2_service_type ): partner = partner_factory() - edge_port_a = edge_port_subscription_factory(partner=partner) - edge_port_b = edge_port_subscription_factory(partner=partner) + edge_port_a = str(edge_port_subscription_factory(partner=partner).subscription_id) + edge_port_b = str(edge_port_subscription_factory(partner=partner).subscription_id) policer_enabled = faker.boolean() creation_form_input_data = [ { diff --git a/test/workflows/l2_circuit/test_create_layer_2_circuit.py b/test/workflows/l2_circuit/test_create_layer_2_circuit.py index 04144556d1147c4de0e689b40d2f93020f943867..deb89fddfea678b842ae5bd551c79db9b9996c96 100644 --- a/test/workflows/l2_circuit/test_create_layer_2_circuit.py +++ b/test/workflows/l2_circuit/test_create_layer_2_circuit.py @@ -12,8 +12,8 @@ from test.workflows import assert_complete, extract_state, run_workflow def layer_2_circuit_input(faker, partner_factory, edge_port_subscription_factory, layer_2_circuit_service_type): partner = partner_factory() product_id = get_product_id_by_name(layer_2_circuit_service_type) - edge_port_a = edge_port_subscription_factory(partner=partner) - edge_port_b = edge_port_subscription_factory(partner=partner) + edge_port_a = str(edge_port_subscription_factory(partner=partner).subscription_id) + edge_port_b = str(edge_port_subscription_factory(partner=partner).subscription_id) policer_enabled = faker.boolean() return [ {"product": product_id}, diff --git a/test/workflows/l2_circuit/test_import_layer_2_circuit.py b/test/workflows/l2_circuit/test_import_layer_2_circuit.py index ba2009a03f68dd63a0ff3b0e89e51bd3ddda55ac..6edfe5bd082f02cedb0a1bdaffe18530536d6698 100644 --- a/test/workflows/l2_circuit/test_import_layer_2_circuit.py +++ b/test/workflows/l2_circuit/test_import_layer_2_circuit.py @@ -11,8 +11,8 @@ from test.workflows import assert_complete, run_workflow "layer_2_circuit_service_type", [ProductName.IMPORTED_EXPRESSROUTE, ProductName.IMPORTED_GEANT_PLUS] ) def test_import_layer_2_circuit_success(layer_2_circuit_service_type, layer_2_circuit_subscription_factory): - imported_layer_2_circuit = layer_2_circuit_subscription_factory( - layer_2_circuit_service_type=layer_2_circuit_service_type + imported_layer_2_circuit = str( + layer_2_circuit_subscription_factory(layer_2_circuit_service_type=layer_2_circuit_service_type).subscription_id ) result, _, _ = run_workflow("import_layer_2_circuit", [{"subscription_id": imported_layer_2_circuit}]) subscription = Layer2Circuit.from_subscription(imported_layer_2_circuit) diff --git a/test/workflows/l2_circuit/test_modify_layer_2_circuit.py b/test/workflows/l2_circuit/test_modify_layer_2_circuit.py index 74ff7a9eeeb2c690afdcf04a3071b0cc85536da0..1018792bfdae51222845065c1837bf40950ea46e 100644 --- a/test/workflows/l2_circuit/test_modify_layer_2_circuit.py +++ b/test/workflows/l2_circuit/test_modify_layer_2_circuit.py @@ -15,10 +15,9 @@ def test_modify_layer_2_circuit_change_policer_bandwidth( faker, partner_factory, ): - subscription_id = layer_2_circuit_subscription_factory(layer_2_circuit_service_type=layer_2_circuit_service_type) - subscription = Layer2Circuit.from_subscription(subscription_id) + subscription = layer_2_circuit_subscription_factory(layer_2_circuit_service_type=layer_2_circuit_service_type) input_form_data = [ - {"subscription_id": subscription_id}, + {"subscription_id": str(subscription.subscription_id)}, { "tt_number": faker.tt_number(), "layer_2_circuit_type": Layer2CircuitType.TAGGED, @@ -33,7 +32,7 @@ def test_modify_layer_2_circuit_change_policer_bandwidth( }, ] result, _, _ = run_workflow("modify_layer_2_circuit", input_form_data) - subscription = Layer2Circuit.from_subscription(subscription_id) + subscription = Layer2Circuit.from_subscription(str(subscription.subscription_id)) assert_complete(result) assert subscription.status == SubscriptionLifecycle.ACTIVE assert subscription.layer_2_circuit.policer_enabled is False @@ -50,10 +49,9 @@ def test_modify_layer_2_circuit_change_circuit_type( faker, partner_factory, ): - subscription_id = layer_2_circuit_subscription_factory(layer_2_circuit_service_type=layer_2_circuit_service_type) - subscription = Layer2Circuit.from_subscription(subscription_id) + subscription = layer_2_circuit_subscription_factory(layer_2_circuit_service_type=layer_2_circuit_service_type) input_form_data = [ - {"subscription_id": subscription_id}, + {"subscription_id": str(subscription.subscription_id)}, { "tt_number": faker.tt_number(), "layer_2_circuit_type": Layer2CircuitType.UNTAGGED, diff --git a/test/workflows/l2_circuit/test_terminate_layer_2_circuit.py b/test/workflows/l2_circuit/test_terminate_layer_2_circuit.py index 778582d879d78065921be00b632977af0753ebfa..6ecf68fceeadf9fbf794bfc23b78cde8025116b6 100644 --- a/test/workflows/l2_circuit/test_terminate_layer_2_circuit.py +++ b/test/workflows/l2_circuit/test_terminate_layer_2_circuit.py @@ -8,7 +8,9 @@ from test.workflows import assert_complete, extract_state, run_workflow @pytest.mark.workflow() @pytest.mark.parametrize("layer_2_circuit_service_type", [ProductName.GEANT_PLUS, ProductName.EXPRESSROUTE]) def test_terminate_layer_2_circuit(layer_2_circuit_service_type, layer_2_circuit_subscription_factory, faker): - subscription_id = layer_2_circuit_subscription_factory(layer_2_circuit_service_type=layer_2_circuit_service_type) + subscription_id = str( + layer_2_circuit_subscription_factory(layer_2_circuit_service_type=layer_2_circuit_service_type).subscription_id + ) initialt_layer_2_circuit_data = [{"subscription_id": subscription_id}, {"tt_number": faker.tt_number()}] result, _, _ = run_workflow("terminate_layer_2_circuit", initialt_layer_2_circuit_data) assert_complete(result) diff --git a/test/workflows/l3_core_service/test_create_imported_l3_core_service.py b/test/workflows/l3_core_service/test_create_imported_l3_core_service.py index 48ac4b54d40fa6be2e76a3fea17d98c44bda8d33..77c4aa255160ee25ebecd778272a35080866cf64 100644 --- a/test/workflows/l3_core_service/test_create_imported_l3_core_service.py +++ b/test/workflows/l3_core_service/test_create_imported_l3_core_service.py @@ -25,7 +25,7 @@ def test_create_imported_l3_core_service_success( "service_type": l3_core_service_type, "service_binding_ports": [ { - "edge_port": edge_port_subscription_factory(), + "edge_port": edge_port_subscription_factory().subscription_id, "ap_type": "PRIMARY", "gs_id": faker.imported_gs_id(), "sbp_type": SBPType.L3, diff --git a/test/workflows/l3_core_service/test_create_l3_core_service.py b/test/workflows/l3_core_service/test_create_l3_core_service.py index 6196249a55a691fc9a6f5aa0b4f3b028db650017..4cbb754fa5b91ada23707ba21f88f3a30c0f0939 100644 --- a/test/workflows/l3_core_service/test_create_l3_core_service.py +++ b/test/workflows/l3_core_service/test_create_l3_core_service.py @@ -52,7 +52,7 @@ def test_create_l3_core_service_success( ): partner = partner_factory() product_id = get_product_id_by_name(l3_core_type) - edge_port_a = edge_port_subscription_factory(partner=partner) + edge_port_a = str(edge_port_subscription_factory(partner=partner).subscription_id) mock_sharepoint_client.return_value = MockedSharePointClient form_input_data = [ diff --git a/test/workflows/l3_core_service/test_import_l3_core_service.py b/test/workflows/l3_core_service/test_import_l3_core_service.py index e3293e6167da1ed02daf053cdde70b4d89d21fe2..cc2a86f09c7406971b5f912975986a5e4920b9ec 100644 --- a/test/workflows/l3_core_service/test_import_l3_core_service.py +++ b/test/workflows/l3_core_service/test_import_l3_core_service.py @@ -16,7 +16,9 @@ from test.workflows import assert_complete, run_workflow ) @pytest.mark.workflow() def test_import_l3_core_service_success(l3_core_service_subscription_factory, l3_core_service_type): - imported_l3_core_service = l3_core_service_subscription_factory(l3_core_service_type=l3_core_service_type) + imported_l3_core_service = str( + l3_core_service_subscription_factory(l3_core_service_type=l3_core_service_type).subscription_id + ) result, _, _ = run_workflow("import_l3_core_service", [{"subscription_id": imported_l3_core_service}]) subscription = L3CoreService.from_subscription(imported_l3_core_service) diff --git a/test/workflows/l3_core_service/test_migrate_l3_core_service.py b/test/workflows/l3_core_service/test_migrate_l3_core_service.py index 6109dcca65f26ecec4d29624a4ba4ebe22370323..366678c38adbaf57d9fe6a6136c50cf80a960c44 100644 --- a/test/workflows/l3_core_service/test_migrate_l3_core_service.py +++ b/test/workflows/l3_core_service/test_migrate_l3_core_service.py @@ -23,9 +23,11 @@ def test_migrate_l3_core_service_success( l3_core_service_type, ): partner = partner_factory() - subscription_id = l3_core_service_subscription_factory(partner=partner, l3_core_service_type=l3_core_service_type) - new_edge_port_1 = edge_port_subscription_factory(partner=partner) - new_edge_port_2 = edge_port_subscription_factory(partner=partner) + subscription_id = str( + l3_core_service_subscription_factory(partner=partner, l3_core_service_type=l3_core_service_type).subscription_id + ) + new_edge_port_1 = str(edge_port_subscription_factory(partner=partner).subscription_id) + new_edge_port_2 = str(edge_port_subscription_factory(partner=partner).subscription_id) subscription = L3CoreService.from_subscription(subscription_id) form_input_data = [ diff --git a/test/workflows/l3_core_service/test_modify_l3_core_service.py b/test/workflows/l3_core_service/test_modify_l3_core_service.py index 64bf4df41e2825e82afc430654db578bc4f517ce..6dde4c76df7a9443c097f4aa6a7c52679d69318c 100644 --- a/test/workflows/l3_core_service/test_modify_l3_core_service.py +++ b/test/workflows/l3_core_service/test_modify_l3_core_service.py @@ -18,11 +18,10 @@ from test.workflows import extract_state, run_workflow ) @pytest.mark.workflow() def test_modify_l3_core_service_remove_edge_port_success(l3_core_service_subscription_factory, l3_core_service_type): - subscription_id = l3_core_service_subscription_factory(l3_core_service_type=l3_core_service_type) - subscription = L3CoreService.from_subscription(subscription_id) + subscription = l3_core_service_subscription_factory(l3_core_service_type=l3_core_service_type) access_port = subscription.l3_core_service.ap_list[0] input_form_data = [ - {"subscription_id": subscription_id}, + {"subscription_id": str(subscription.subscription_id)}, { "access_ports": [ { @@ -62,11 +61,10 @@ def test_modify_l3_core_service_add_new_edge_port_success( l3_core_service_type, ): partner = partner_factory() - new_edge_port = edge_port_subscription_factory(partner=partner) - subscription_id = l3_core_service_subscription_factory(partner=partner, l3_core_service_type=l3_core_service_type) - subscription = L3CoreService.from_subscription(subscription_id) + new_edge_port = str(edge_port_subscription_factory(partner=partner).subscription_id) + subscription = l3_core_service_subscription_factory(partner=partner, l3_core_service_type=l3_core_service_type) input_form_data = [ - {"subscription_id": subscription_id}, + {"subscription_id": str(subscription.subscription_id)}, { "access_ports": [ { @@ -176,11 +174,10 @@ def sbp_input_form_data(faker): def test_modify_l3_core_service_modify_edge_port_success( faker, l3_core_service_subscription_factory, l3_core_service_type, sbp_input_form_data ): - subscription_id = l3_core_service_subscription_factory(l3_core_service_type=l3_core_service_type) - subscription = L3CoreService.from_subscription(subscription_id) + subscription = l3_core_service_subscription_factory(l3_core_service_type=l3_core_service_type) new_sbp_data = [sbp_input_form_data(), sbp_input_form_data()] input_form_data = [ - {"subscription_id": subscription_id}, + {"subscription_id": str(subscription.subscription_id)}, { "access_ports": [ { diff --git a/test/workflows/l3_core_service/test_terminate_l3_core_service.py b/test/workflows/l3_core_service/test_terminate_l3_core_service.py index b3c48cec74c8c046ea7fcb0cc3768b0ddb441a1c..8e6752bcdb36b45f54d194c8dc63fed492a7916d 100644 --- a/test/workflows/l3_core_service/test_terminate_l3_core_service.py +++ b/test/workflows/l3_core_service/test_terminate_l3_core_service.py @@ -16,7 +16,9 @@ from test.workflows import assert_complete, extract_state, run_workflow ], ) def test_terminate_l3_core_service(l3_core_service_type, l3_core_service_subscription_factory, faker): - subscription_id = l3_core_service_subscription_factory(l3_core_service_type=l3_core_service_type) + subscription_id = str( + l3_core_service_subscription_factory(l3_core_service_type=l3_core_service_type).subscription_id + ) initial_form_data = [{"subscription_id": subscription_id}, {"tt_number": faker.tt_number()}] result, _, _ = run_workflow("terminate_l3_core_service", initial_form_data) assert_complete(result) diff --git a/test/workflows/lan_switch_interconnect/test_create_imported_lan_switch_interconnect.py b/test/workflows/lan_switch_interconnect/test_create_imported_lan_switch_interconnect.py index 8c3f9c4c6d363d8c96377438ebd9474c6aafd122..a04f7e42674b61152429d88c631feb82257f22d2 100644 --- a/test/workflows/lan_switch_interconnect/test_create_imported_lan_switch_interconnect.py +++ b/test/workflows/lan_switch_interconnect/test_create_imported_lan_switch_interconnect.py @@ -17,12 +17,12 @@ def workflow_input_data(faker, router_subscription_factory, switch_subscription_ "lan_switch_interconnect_description": faker.sentence(), "minimum_links": 1, "router_side": { - "node": router_subscription_factory(), + "node": str(router_subscription_factory().subscription_id), "ae_iface": faker.nokia_lag_interface_name(), "ae_members": faker.link_members_nokia(), }, "switch_side": { - "switch": switch_subscription_factory(), + "switch": str(switch_subscription_factory().subscription_id), "ae_iface": faker.juniper_ae_interface_name(), "ae_members": faker.link_members_juniper(), }, diff --git a/test/workflows/lan_switch_interconnect/test_create_lan_switch_interconnect.py b/test/workflows/lan_switch_interconnect/test_create_lan_switch_interconnect.py index a0c338041649ae37ad12835855e65640921ed61f..f7a8fab1cd21ea7ce5904aac458927b2a16decc6 100644 --- a/test/workflows/lan_switch_interconnect/test_create_lan_switch_interconnect.py +++ b/test/workflows/lan_switch_interconnect/test_create_lan_switch_interconnect.py @@ -35,12 +35,14 @@ def input_form_data(faker, router_subscription_factory, switch_subscription_fact }, { "tt_number": faker.tt_number(), - "router_side": router_subscription_factory( - router_site=site_subscription_factory( - site_contains_optical_equipment=site_contains_optical_equipment - ) + "router_side": str( + router_subscription_factory( + router_site=site_subscription_factory( + site_contains_optical_equipment=site_contains_optical_equipment + ) + ).subscription_id ), - "switch_side": switch_subscription_factory(), + "switch_side": str(switch_subscription_factory().subscription_id), "description": faker.sentence(), "minimum_link_count": 2, }, diff --git a/test/workflows/lan_switch_interconnect/test_import_lan_switch_interconnect.py b/test/workflows/lan_switch_interconnect/test_import_lan_switch_interconnect.py index 3d82ad065f73c6274c601dd2734977c6a63deffd..1955dbd3ecff408ad39cdb80157f0763926cdfab 100644 --- a/test/workflows/lan_switch_interconnect/test_import_lan_switch_interconnect.py +++ b/test/workflows/lan_switch_interconnect/test_import_lan_switch_interconnect.py @@ -8,7 +8,9 @@ from test.workflows import assert_complete, run_workflow @pytest.mark.workflow() def test_import_lan_switch_interconnect_success(lan_switch_interconnect_subscription_factory): - imported_lan_switch_interconnect = lan_switch_interconnect_subscription_factory(is_imported=True) + imported_lan_switch_interconnect = str( + lan_switch_interconnect_subscription_factory(is_imported=True).subscription_id + ) result, _, _ = run_workflow( "import_lan_switch_interconnect", [{"subscription_id": imported_lan_switch_interconnect}] ) diff --git a/test/workflows/lan_switch_interconnect/test_terminate_lan_switch_interconnect.py b/test/workflows/lan_switch_interconnect/test_terminate_lan_switch_interconnect.py index 9b69c628e440e90c76460656addf7c447abe4793..ddc19a4468748e8e46d8a33047c2b998c381e488 100644 --- a/test/workflows/lan_switch_interconnect/test_terminate_lan_switch_interconnect.py +++ b/test/workflows/lan_switch_interconnect/test_terminate_lan_switch_interconnect.py @@ -12,7 +12,7 @@ from test.workflows import assert_complete, extract_state, run_workflow def test_terminate_lan_switch_interconnect( mock_delete_network, mock_find_host, lan_switch_interconnect_subscription_factory, faker ): - subscription_id = lan_switch_interconnect_subscription_factory() + subscription_id = str(lan_switch_interconnect_subscription_factory().subscription_id) initial_lan_switch_interconnect_data = [{"subscription_id": subscription_id}, {"tt_number": faker.tt_number()}] result, _, _ = run_workflow("terminate_lan_switch_interconnect", initial_lan_switch_interconnect_data) assert_complete(result) diff --git a/test/workflows/lan_switch_interconnect/test_validate_lan_switch_interconnect.py b/test/workflows/lan_switch_interconnect/test_validate_lan_switch_interconnect.py index 2e81ff21b1cc0bc9829bd5f28fb02223b6905beb..18e67d17117179eee6ec25083af2f90b7688b534 100644 --- a/test/workflows/lan_switch_interconnect/test_validate_lan_switch_interconnect.py +++ b/test/workflows/lan_switch_interconnect/test_validate_lan_switch_interconnect.py @@ -14,7 +14,7 @@ from test.workflows import assert_complete, assert_lso_success, extract_state, r def test_validate_lan_switch_interconnect( mock_lso_interaction, mock_find_network, mock_find_host, lan_switch_interconnect_subscription_factory, faker ): - subscription_id = lan_switch_interconnect_subscription_factory() + subscription_id = str(lan_switch_interconnect_subscription_factory().subscription_id) mocked_netbox_reply = objects.HostRecord( connector=None, aliases=[], diff --git a/test/workflows/office_router/test_create_imported_office_router.py b/test/workflows/office_router/test_create_imported_office_router.py index ac132d36d4d0653bcce7600c4b83d4416d8af60a..6f89ba54dd075b881c7442d2ed293c84d40c0b22 100644 --- a/test/workflows/office_router/test_create_imported_office_router.py +++ b/test/workflows/office_router/test_create_imported_office_router.py @@ -3,7 +3,6 @@ from orchestrator.types import SubscriptionLifecycle from gso.products import ProductName from gso.products.product_types.office_router import ImportedOfficeRouter -from gso.products.product_types.site import Site from test.workflows import ( assert_complete, extract_state, @@ -15,7 +14,7 @@ from test.workflows import ( def workflow_input_data(faker, site_subscription_factory): return { "partner": "GEANT", - "office_router_site": Site.from_subscription(site_subscription_factory()).site.site_name, + "office_router_site": site_subscription_factory().site.site_name, "office_router_fqdn": faker.domain_name(levels=4), "office_router_ts_port": faker.port_number(is_user=True), "office_router_lo_ipv4_address": faker.ipv4(), diff --git a/test/workflows/office_router/test_import_office_router.py b/test/workflows/office_router/test_import_office_router.py index 306cffa4b8be910122313e7af080533f00f0c14a..60014ba750316c1945d8121fc853ad432ff897e8 100644 --- a/test/workflows/office_router/test_import_office_router.py +++ b/test/workflows/office_router/test_import_office_router.py @@ -8,7 +8,7 @@ from test.workflows import assert_complete, run_workflow @pytest.mark.workflow() def test_import_office_router_success(office_router_subscription_factory): - imported_office_router = office_router_subscription_factory(is_imported=True) + imported_office_router = str(office_router_subscription_factory(is_imported=True).subscription_id) result, _, _ = run_workflow("import_office_router", [{"subscription_id": imported_office_router}]) subscription = OfficeRouter.from_subscription(imported_office_router) diff --git a/test/workflows/opengear/test_create_imported_opengear.py b/test/workflows/opengear/test_create_imported_opengear.py index 9058c602b96ed8fc08d4d9145706b3c688a321b1..e3130665b28b7dd4a8d4ac2f0db5e2894c0b72b7 100644 --- a/test/workflows/opengear/test_create_imported_opengear.py +++ b/test/workflows/opengear/test_create_imported_opengear.py @@ -3,7 +3,6 @@ from orchestrator.types import SubscriptionLifecycle from gso.products import ProductName from gso.products.product_types.opengear import ImportedOpengear -from gso.products.product_types.site import Site from test.workflows import ( assert_complete, extract_state, @@ -15,7 +14,7 @@ from test.workflows import ( def workflow_input_data(faker, site_subscription_factory): return { "partner": "GEANT", - "opengear_site": Site.from_subscription(site_subscription_factory()).site.site_name, + "opengear_site": site_subscription_factory().site.site_name, "opengear_hostname": faker.hostname(), "opengear_wan_address": faker.ipv4(), "opengear_wan_netmask": faker.ipv4(), diff --git a/test/workflows/opengear/test_import_opengear.py b/test/workflows/opengear/test_import_opengear.py index 8643ec4935c7bcda4783fb9e33adbdc0d2f605c1..3e1192673d37aa91362f636d6a525a302fcb5a0b 100644 --- a/test/workflows/opengear/test_import_opengear.py +++ b/test/workflows/opengear/test_import_opengear.py @@ -8,7 +8,7 @@ from test.workflows import assert_complete, run_workflow @pytest.mark.workflow() def test_import_office_router_success(opengear_subscription_factory): - imported_opengear = opengear_subscription_factory(is_imported=True) + imported_opengear = str(opengear_subscription_factory(is_imported=True).subscription_id) result, _, _ = run_workflow("import_opengear", [{"subscription_id": imported_opengear}]) subscription = Opengear.from_subscription(imported_opengear) diff --git a/test/workflows/router/test_activate_router.py b/test/workflows/router/test_activate_router.py index c118dcaf4d1e4cb1efac97d50b3c8b7870c47593..97ea41667ba7f23dc75584ba6da1c580f2935c4f 100644 --- a/test/workflows/router/test_activate_router.py +++ b/test/workflows/router/test_activate_router.py @@ -16,12 +16,12 @@ def test_activate_router_success( faker, ): # Set up mock return values - product_id = router_subscription_factory(status="provisioning") + router = router_subscription_factory(status="provisioning") # Sanity check - assert Router.from_subscription(product_id).status == "provisioning" + assert router.status == "provisioning" # Run workflow - initial_input_data = [{"subscription_id": product_id}, {}] + initial_input_data = [{"subscription_id": router.subscription_id}, {}] result, process_stat, step_log = run_workflow("activate_router", initial_input_data) assert_suspended(result) diff --git a/test/workflows/router/test_create_imported_router.py b/test/workflows/router/test_create_imported_router.py index 6831d0097c53957b3b069b6e541c3ff1a78aa689..d070ea6d5ca27c131fe2eb3add2ac66d361cd32d 100644 --- a/test/workflows/router/test_create_imported_router.py +++ b/test/workflows/router/test_create_imported_router.py @@ -3,7 +3,6 @@ from orchestrator.types import SubscriptionLifecycle from gso.products.product_blocks.router import RouterRole from gso.products.product_types.router import ImportedRouter -from gso.products.product_types.site import Site from gso.utils.helpers import iso_from_ipv4 from gso.utils.shared_enums import Vendor from test.workflows import assert_complete, extract_state, run_workflow @@ -16,7 +15,7 @@ def imported_router_creation_input_form_data(site_subscription_factory, faker): return { "partner": "GEANT", - "router_site": Site.from_subscription(router_site).site.site_name, + "router_site": router_site.site.site_name, "hostname": faker.pystr(), "ts_port": faker.pyint(), "router_role": faker.random_choices(elements=(RouterRole.P, RouterRole.PE, RouterRole.AMT), length=1)[0], diff --git a/test/workflows/router/test_create_router.py b/test/workflows/router/test_create_router.py index ae4219501cb28bcf84e77a99fb30d0bfaaf233e2..249b268dbf48af606cf9068acad0ae505f17fdd3 100644 --- a/test/workflows/router/test_create_router.py +++ b/test/workflows/router/test_create_router.py @@ -24,7 +24,7 @@ from test.workflows import ( @pytest.fixture() def router_creation_input_form_data(site_subscription_factory, faker): - router_site = site_subscription_factory() + router_site = str(site_subscription_factory().subscription_id) return { "tt_number": faker.tt_number(), diff --git a/test/workflows/router/test_import_router.py b/test/workflows/router/test_import_router.py index 74fed0f5fa03324dcb535b029668d7d2d89bdbf8..44e49b543920032c06c99173300bf30db4b4af0e 100644 --- a/test/workflows/router/test_import_router.py +++ b/test/workflows/router/test_import_router.py @@ -8,7 +8,7 @@ from test.workflows import assert_complete, run_workflow @pytest.mark.workflow() def test_import_site_success(router_subscription_factory): - imported_router = router_subscription_factory(is_imported=True) + imported_router = str(router_subscription_factory(is_imported=True).subscription_id) result, _, _ = run_workflow("import_router", [{"subscription_id": imported_router}]) subscription = Router.from_subscription(imported_router) diff --git a/test/workflows/router/test_modify_connection_strategy.py b/test/workflows/router/test_modify_connection_strategy.py index 20f8f31a1780b4222705d17102e887b550b4771a..44ae4820391d63ceb29933f24c9461cb11fa9a47 100644 --- a/test/workflows/router/test_modify_connection_strategy.py +++ b/test/workflows/router/test_modify_connection_strategy.py @@ -7,17 +7,16 @@ from test.workflows import assert_complete, run_workflow @pytest.mark.workflow() def test_modify_connection_strategy(router_subscription_factory): - subscription_id = router_subscription_factory(router_access_via_ts=True) - subscription = Router.from_subscription(subscription_id) + subscription = router_subscription_factory(router_access_via_ts=True) assert subscription.router.router_access_via_ts is True form_data = [ - {"subscription_id": subscription_id}, + {"subscription_id": str(subscription.subscription_id)}, {"connection_strategy": ConnectionStrategy.IN_BAND}, ] result, _, _ = run_workflow("modify_connection_strategy", form_data) assert_complete(result) # Fetch the updated subscription after running the workflow - updated_subscription = Router.from_subscription(subscription_id) + updated_subscription = Router.from_subscription(str(subscription.subscription_id)) assert updated_subscription.status == "active" assert updated_subscription.router.router_access_via_ts is False diff --git a/test/workflows/router/test_modify_router_kentik_license.py b/test/workflows/router/test_modify_router_kentik_license.py index 9d5352c515b25cc921622d7e1e58a1726fe499a1..a84c25801cd685220da76d9e306d459481d0325b 100644 --- a/test/workflows/router/test_modify_router_kentik_license.py +++ b/test/workflows/router/test_modify_router_kentik_license.py @@ -16,7 +16,7 @@ def test_modify_router_kentik_license_success( faker, ): # Set up mock return values - product_id = router_subscription_factory(router_role=RouterRole.PE) + product_id = str(router_subscription_factory(router_role=RouterRole.PE).subscription_id) mock_kentik_client.return_value = MockedKentikClient # Run workflow diff --git a/test/workflows/router/test_promote_p_to_pe.py b/test/workflows/router/test_promote_p_to_pe.py index 1c7ef1dc3e74e1119e288c9ea6c1a100a0124da1..71ffd639224094a08815f186bcbedba7a4d309ce 100644 --- a/test/workflows/router/test_promote_p_to_pe.py +++ b/test/workflows/router/test_promote_p_to_pe.py @@ -28,8 +28,10 @@ def test_promote_p_to_pe_success( ): """Test the successful promotion of a Nokia P router to a PE router.""" mock_kentik_client.return_value = MockedKentikClient - router_id = router_subscription_factory( - vendor=Vendor.NOKIA, router_role=RouterRole.P, status=SubscriptionLifecycle.ACTIVE + router_id = str( + router_subscription_factory( + vendor=Vendor.NOKIA, router_role=RouterRole.P, status=SubscriptionLifecycle.ACTIVE + ).subscription_id ) # Add two more routers to our fake network router_subscription_factory(router_role=RouterRole.P) @@ -50,8 +52,10 @@ def test_promote_p_to_pe_success( @pytest.mark.workflow() def test_promote_p_to_pe_juniper_router(router_subscription_factory, faker): """Test that the workflow does not run for a Juniper P router since this workflow is only for Nokia routers.""" - router_id = router_subscription_factory( - vendor=Vendor.JUNIPER, router_role=RouterRole.P, status=SubscriptionLifecycle.ACTIVE + router_id = str( + router_subscription_factory( + vendor=Vendor.JUNIPER, router_role=RouterRole.P, status=SubscriptionLifecycle.ACTIVE + ).subscription_id ) input_data = [{"subscription_id": router_id}, {"tt_number": faker.tt_number()}] with pytest.raises(FormValidationError) as error: @@ -65,8 +69,10 @@ def test_promote_p_to_pe_juniper_router(router_subscription_factory, faker): @patch("gso.services.lso_client._send_request") def test_promote_p_to_pe_nokia_pe_router(mock_execute_playbook, router_subscription_factory, faker): """Test that the workflow does not run for a Nokia PE router since it is already a PE router.""" - router_id = router_subscription_factory( - vendor=Vendor.NOKIA, router_role=RouterRole.PE, status=SubscriptionLifecycle.ACTIVE + router_id = str( + router_subscription_factory( + vendor=Vendor.NOKIA, router_role=RouterRole.PE, status=SubscriptionLifecycle.ACTIVE + ).subscription_id ) input_data = [{"subscription_id": router_id}, {"tt_number": faker.tt_number()}] with pytest.raises(FormValidationError) as error: @@ -78,8 +84,10 @@ def test_promote_p_to_pe_nokia_pe_router(mock_execute_playbook, router_subscript def test_promote_p_to_pe_missing_tt_number(router_subscription_factory): """Test that a missing TT number results in a validation error.""" - router_id = router_subscription_factory( - vendor=Vendor.NOKIA, router_role=RouterRole.P, status=SubscriptionLifecycle.ACTIVE + router_id = str( + router_subscription_factory( + vendor=Vendor.NOKIA, router_role=RouterRole.P, status=SubscriptionLifecycle.ACTIVE + ).subscription_id ) with pytest.raises(FormValidationError) as error: run_workflow("promote_p_to_pe", [{"subscription_id": router_id}, {}]) @@ -90,8 +98,10 @@ def test_promote_p_to_pe_missing_tt_number(router_subscription_factory): def test_promote_p_to_pe_with_invalid_router_life_cycle(router_subscription_factory, faker): """Test that the router life cycle must be ACTIVE to run this workflow.""" - router_id = router_subscription_factory( - vendor=Vendor.NOKIA, router_role=RouterRole.P, status=SubscriptionLifecycle.PROVISIONING + router_id = str( + router_subscription_factory( + vendor=Vendor.NOKIA, router_role=RouterRole.P, status=SubscriptionLifecycle.PROVISIONING + ).subscription_id ) with pytest.raises(FormValidationError) as error: run_workflow("promote_p_to_pe", [{"subscription_id": router_id}, {"tt_number": faker.tt_number()}]) diff --git a/test/workflows/router/test_redeploy_base_config.py b/test/workflows/router/test_redeploy_base_config.py index 2023ec04e005cab469e45251061de6138b563c8d..5106c59aa98105115434625dd3fe1a75bf4bc7a5 100644 --- a/test/workflows/router/test_redeploy_base_config.py +++ b/test/workflows/router/test_redeploy_base_config.py @@ -19,7 +19,7 @@ def test_redeploy_base_config_success( faker, ): # Set up mock return values - product_id = router_subscription_factory() + product_id = str(router_subscription_factory().subscription_id) # Run workflow initial_input_data = [{"subscription_id": product_id}, {"tt_number": faker.tt_number()}] diff --git a/test/workflows/router/test_terminate_router.py b/test/workflows/router/test_terminate_router.py index ed9c565d87730bd783406ba803c950a9744c976e..6611bc0dc7574f729052f295194273afe3073b24 100644 --- a/test/workflows/router/test_terminate_router.py +++ b/test/workflows/router/test_terminate_router.py @@ -28,7 +28,7 @@ def test_terminate_pe_router_full_success( faker, ): # Prepare mock values and expected results - product_id = router_subscription_factory() + product_id = str(router_subscription_factory().subscription_id) # Add two more routers to our fake network router_subscription_factory(router_role=RouterRole.P) router_subscription_factory(router_role=RouterRole.PE) @@ -81,7 +81,7 @@ def test_terminate_p_router_full_success( faker, ): # Prepare mock values and expected results - product_id = router_subscription_factory(router_role=RouterRole.P) + product_id = str(router_subscription_factory(router_role=RouterRole.P).subscription_id) # Add two more routers to our fake network router_subscription_factory(router_role=RouterRole.P) router_subscription_factory(router_role=RouterRole.PE) diff --git a/test/workflows/router/test_update_ibgp_mesh.py b/test/workflows/router/test_update_ibgp_mesh.py index 055ad43aa3324e25a2cc4c0c3edf90f907187c9f..06b54521eb9f014b693373f38cf74403cd8cfd41 100644 --- a/test/workflows/router/test_update_ibgp_mesh.py +++ b/test/workflows/router/test_update_ibgp_mesh.py @@ -6,7 +6,6 @@ from orchestrator.workflow import StepStatus from pydantic_forms.exceptions import FormValidationError from gso.products.product_blocks.router import RouterRole -from gso.products.product_types.iptrunk import Iptrunk from test import USER_CONFIRM_EMPTY_FORM from test.workflows import ( assert_lso_interaction_success, @@ -41,9 +40,7 @@ def test_update_ibgp_mesh_success( router_subscription_factory(router_role=RouterRole.P) router_subscription_factory() - ip_trunk = Iptrunk.from_subscription( - iptrunk_subscription_factory(status=trunk_status, iptrunk_sides=[side_a, side_b]) - ) + ip_trunk = iptrunk_subscription_factory(status=trunk_status, iptrunk_sides=[side_a, side_b]) callback_step_count = 5 if router_role == RouterRole.P else 14 ibgp_mesh_input_form_data = { "subscription_id": ip_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.owner_subscription_id @@ -71,7 +68,7 @@ def test_update_ibgp_mesh_success( @pytest.mark.parametrize("trunk_status", [SubscriptionLifecycle.INITIAL, SubscriptionLifecycle.TERMINATED]) @pytest.mark.workflow() def test_update_ibgp_mesh_failure(iptrunk_subscription_factory, trunk_status): - ip_trunk = Iptrunk.from_subscription(iptrunk_subscription_factory(status=trunk_status)) + ip_trunk = iptrunk_subscription_factory(status=trunk_status) ibgp_mesh_input_form_data = { "subscription_id": ip_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.owner_subscription_id } @@ -83,7 +80,7 @@ def test_update_ibgp_mesh_failure(iptrunk_subscription_factory, trunk_status): @pytest.mark.workflow() def test_update_ibgp_mesh_isolated_router(router_subscription_factory): - router_id = router_subscription_factory(router_role=RouterRole.P) + router_id = str(router_subscription_factory(router_role=RouterRole.P).subscription_id) exception_message = "Selected router does not terminate any available IP trunks." with pytest.raises(FormValidationError, match=exception_message): diff --git a/test/workflows/router/test_validate_router.py b/test/workflows/router/test_validate_router.py index 1b2e371cebb6cdecd845a4ccc52ee7de285c7afd..8e9397885733b9a836ee14f827e6d94c097d4017 100644 --- a/test/workflows/router/test_validate_router.py +++ b/test/workflows/router/test_validate_router.py @@ -40,13 +40,13 @@ def test_validate_nokia_router_success( router_subscription_factory(router_role=RouterRole.PE) mock_kentik_client.return_value = MockedKentikClient # Run workflow - subscription_id = router_subscription_factory(status=router_state, router_role=router_role) - mock_fqdn = Router.from_subscription(subscription_id).router.router_fqdn + subscription = router_subscription_factory(status=router_state, router_role=router_role) + mock_fqdn = subscription.router.router_fqdn mock_v4 = faker.ipv4() mock_find_host_by_fqdn.return_value = objects.HostRecord( connector=None, aliases=[mock_fqdn], - comment=subscription_id, + comment=str(subscription.subscription_id), ipv4addrs=[ objects.IPv4( ipv4addr=str(mock_v4), @@ -59,7 +59,7 @@ def test_validate_nokia_router_success( name=mock_fqdn, ) - initial_router_data = [{"subscription_id": subscription_id}] + initial_router_data = [{"subscription_id": str(subscription.subscription_id)}] result, process_stat, step_log = run_workflow("validate_router", initial_router_data) state = extract_state(result) @@ -86,7 +86,7 @@ def test_validate_nokia_router_success( @pytest.mark.workflow() def test_validate_juniper_router_success(router_subscription_factory): # Run workflow - subscription_id = router_subscription_factory(vendor=Vendor.JUNIPER) + subscription_id = str(router_subscription_factory(vendor=Vendor.JUNIPER).subscription_id) initial_router_data = [{"subscription_id": subscription_id}] result, _, _ = run_workflow("validate_router", initial_router_data) diff --git a/test/workflows/site/test_import_site.py b/test/workflows/site/test_import_site.py index df609aa27a86c12a06bc7655b8d2f93378dc9dfc..a05d0bb68aa33de151a3dd971861bf14bbe74b13 100644 --- a/test/workflows/site/test_import_site.py +++ b/test/workflows/site/test_import_site.py @@ -9,8 +9,8 @@ from test.workflows import assert_complete, run_workflow @pytest.mark.workflow() def test_import_site_success(site_subscription_factory): imported_site = site_subscription_factory(is_imported=True) - result, _, _ = run_workflow("import_site", [{"subscription_id": imported_site}]) - subscription = Site.from_subscription(imported_site) + result, _, _ = run_workflow("import_site", [{"subscription_id": str(imported_site.subscription_id)}]) + subscription = Site.from_subscription(str(imported_site.subscription_id)) assert_complete(result) assert subscription.product.name == ProductName.SITE diff --git a/test/workflows/site/test_modify_site.py b/test/workflows/site/test_modify_site.py index ff82fc7df2c5b759a57760dfac0a1480aa953eeb..4110f5a3b030e65c9b0ff13a141f09ca5499b104 100644 --- a/test/workflows/site/test_modify_site.py +++ b/test/workflows/site/test_modify_site.py @@ -7,7 +7,7 @@ from test.workflows import assert_complete, extract_state, run_workflow @pytest.mark.workflow() def test_modify_site(site_subscription_factory, faker): - subscription_id = site_subscription_factory() + subscription_id = str(site_subscription_factory().subscription_id) initial_site_data = [ {"subscription_id": subscription_id}, { @@ -33,7 +33,7 @@ def test_modify_site_with_duplicate_bgp_community_id(faker, site_subscription_fa duplicate_bgp_community_id = faker.pyint() site_subscription_factory(site_bgp_community_id=duplicate_bgp_community_id) - subscription_b = site_subscription_factory() + subscription_b = str(site_subscription_factory().subscription_id) initial_site_data = [ {"subscription_id": subscription_b}, @@ -52,7 +52,7 @@ def test_modify_site_with_duplicate_internal_id(faker, site_subscription_factory duplicate_internal_id = faker.pyint() site_subscription_factory(site_internal_id=duplicate_internal_id) - subscription_b = site_subscription_factory() + subscription_b = str(site_subscription_factory().subscription_id) initial_site_data = [ {"subscription_id": subscription_b}, @@ -71,7 +71,7 @@ def test_modify_site_with_duplicate_ts_address(faker, site_subscription_factory) duplicate_ts_address = faker.ipv4() site_subscription_factory(site_ts_address=duplicate_ts_address) - subscription_b = site_subscription_factory() + subscription_b = str(site_subscription_factory().subscription_id) initial_site_data = [ {"subscription_id": subscription_b}, diff --git a/test/workflows/site/test_terminate_site.py b/test/workflows/site/test_terminate_site.py index 93c1cd2141fe9f95cc21a168c447831d5447153f..063cdb2db9f33c397a725674566ccc49d51502cb 100644 --- a/test/workflows/site/test_terminate_site.py +++ b/test/workflows/site/test_terminate_site.py @@ -6,7 +6,7 @@ from test.workflows import assert_complete, extract_state, run_workflow @pytest.mark.workflow() def test_terminate_site(site_subscription_factory): - subscription_id = site_subscription_factory() + subscription_id = str(site_subscription_factory().subscription_id) initial_site_data = [{"subscription_id": subscription_id}, {}] result, _, _ = run_workflow("terminate_site", initial_site_data) assert_complete(result) diff --git a/test/workflows/super_pop_switch/test_create_imported_super_pop_switch.py b/test/workflows/super_pop_switch/test_create_imported_super_pop_switch.py index 5d0dcd17d9f641747c3223b9738c6ef42bcf58ca..403c44e98eb965410c938a14ceb11fd3e6761136 100644 --- a/test/workflows/super_pop_switch/test_create_imported_super_pop_switch.py +++ b/test/workflows/super_pop_switch/test_create_imported_super_pop_switch.py @@ -2,7 +2,6 @@ import pytest from orchestrator.types import SubscriptionLifecycle from gso.products import ProductName -from gso.products.product_types.site import Site from gso.products.product_types.super_pop_switch import ImportedSuperPopSwitch from test.workflows import ( assert_complete, @@ -16,7 +15,7 @@ def workflow_input_data(faker, site_subscription_factory): return { "partner": "GEANT", "hostname": faker.domain_word(), - "super_pop_switch_site": Site.from_subscription(site_subscription_factory()).site.site_name, + "super_pop_switch_site": site_subscription_factory().site.site_name, "super_pop_switch_ts_port": faker.port_number(is_user=True), "super_pop_switch_mgmt_ipv4_address": faker.ipv4(), } diff --git a/test/workflows/super_pop_switch/test_import_super_pop_switch.py b/test/workflows/super_pop_switch/test_import_super_pop_switch.py index 80d4f37029f341cb5649af4a1e6a1e6e6df9bd8b..4a5950e3ef2b8c0e42e61970e7ecd3b23459861b 100644 --- a/test/workflows/super_pop_switch/test_import_super_pop_switch.py +++ b/test/workflows/super_pop_switch/test_import_super_pop_switch.py @@ -8,7 +8,7 @@ from test.workflows import assert_complete, run_workflow @pytest.mark.workflow() def test_import_super_pop_switch_success(super_pop_switch_subscription_factory): - imported_super_pop_switch = super_pop_switch_subscription_factory(is_imported=True) + imported_super_pop_switch = str(super_pop_switch_subscription_factory(is_imported=True).subscription_id) result, _, _ = run_workflow("import_super_pop_switch", [{"subscription_id": imported_super_pop_switch}]) subscription = SuperPopSwitch.from_subscription(imported_super_pop_switch) diff --git a/test/workflows/switch/test_activate_switch.py b/test/workflows/switch/test_activate_switch.py index 52ffa94c4f16d6ae4b7d1c792eb64915583cb76f..587251b822f703361431e425563ee405dd73773f 100644 --- a/test/workflows/switch/test_activate_switch.py +++ b/test/workflows/switch/test_activate_switch.py @@ -16,12 +16,12 @@ def test_activate_switch_success( faker, ): # Set up mock return values - product_id = switch_subscription_factory(status="provisioning") + product = switch_subscription_factory(status="provisioning") # Sanity check - assert Switch.from_subscription(product_id).status == "provisioning" + assert product.status == "provisioning" # Run workflow - initial_input_data = [{"subscription_id": product_id}, {}] + initial_input_data = [{"subscription_id": str(product.subscription_id)}, {}] result, process_stat, step_log = run_workflow("activate_switch", initial_input_data) assert_suspended(result) diff --git a/test/workflows/switch/test_create_imported_switch.py b/test/workflows/switch/test_create_imported_switch.py index b38a0c9401066e88e15b0a11c7699d96dedf75bf..914acd3cf7c850d0a75138991ff4cd39b6b18d0c 100644 --- a/test/workflows/switch/test_create_imported_switch.py +++ b/test/workflows/switch/test_create_imported_switch.py @@ -17,7 +17,7 @@ def workflow_input_data(faker, site_subscription_factory): return { "fqdn": faker.domain_name(levels=4), "ts_port": faker.port_number(is_user=True), - "site": site_subscription_factory(), + "site": str(site_subscription_factory().subscription_id), "switch_vendor": Vendor.JUNIPER, "switch_model": SwitchModel.EX3400_24T, } diff --git a/test/workflows/switch/test_create_switch.py b/test/workflows/switch/test_create_switch.py index 64006141f05f22a12cb74ea76536266665720345..1209b48a16a1352e3b658fc51d0d0e6e92ac90e4 100644 --- a/test/workflows/switch/test_create_switch.py +++ b/test/workflows/switch/test_create_switch.py @@ -30,7 +30,7 @@ def test_create_switch_success( {"product": product_id}, { "tt_number": faker.tt_number(), - "switch_site": site_subscription_factory(), + "switch_site": str(site_subscription_factory().subscription_id), "hostname": faker.domain_word(), "ts_port": faker.port_number(is_user=True), "model": SwitchModel.EX3400_24T, diff --git a/test/workflows/switch/test_import_switch.py b/test/workflows/switch/test_import_switch.py index b35760573a94faa7d6f058035413a45aaf747e5f..bf6c3258d7ee970da97e021ea96acfc81ff3faf2 100644 --- a/test/workflows/switch/test_import_switch.py +++ b/test/workflows/switch/test_import_switch.py @@ -8,7 +8,7 @@ from test.workflows import assert_complete, run_workflow @pytest.mark.workflow() def test_import_switch_success(switch_subscription_factory): - imported_switch = switch_subscription_factory(is_imported=True) + imported_switch = str(switch_subscription_factory(is_imported=True).subscription_id) result, _, _ = run_workflow("import_switch", [{"subscription_id": imported_switch}]) subscription = Switch.from_subscription(imported_switch) diff --git a/test/workflows/switch/test_terminate_switch.py b/test/workflows/switch/test_terminate_switch.py index 4614789c98bf09b40a746f845def31098e93c16d..b0122e968b2da1c3a44a8c0f016e6154dd8ea0dd 100644 --- a/test/workflows/switch/test_terminate_switch.py +++ b/test/workflows/switch/test_terminate_switch.py @@ -10,7 +10,7 @@ from test.workflows import assert_complete, extract_state, run_workflow @patch("gso.services.netbox_client.NetboxClient.delete_device") @patch("gso.services.infoblox.delete_host_by_fqdn") def test_terminate_switch(mock_delete_host_by_fqdn, mock_delete_device, switch_subscription_factory, faker): - subscription_id = switch_subscription_factory() + subscription_id = str(switch_subscription_factory().subscription_id) initial_switch_data = [{"subscription_id": subscription_id}, {"tt_number": faker.tt_number()}] result, _, _ = run_workflow("terminate_switch", initial_switch_data) assert_complete(result) diff --git a/test/workflows/switch/test_validate_switch.py b/test/workflows/switch/test_validate_switch.py index 13e81c6f68459b6f4a8016f86069e8e57504251f..0e5a3b1349621dcc40af9a4d9f1ce4c588d35e44 100644 --- a/test/workflows/switch/test_validate_switch.py +++ b/test/workflows/switch/test_validate_switch.py @@ -22,7 +22,7 @@ def test_validate_switch_success( geant_partner, ): # Run workflow - subscription_id = switch_subscription_factory() + subscription_id = str(switch_subscription_factory().subscription_id) initial_switch_data = [{"subscription_id": subscription_id}] result, process_stat, step_log = run_workflow("validate_switch", initial_switch_data) diff --git a/test/workflows/vrf/test_modify_vrf_router_list.py b/test/workflows/vrf/test_modify_vrf_router_list.py index 7a5bd14f79a52323580dbf8a5549654e4c98093d..d00d9740a05a7aaf79fb9930a2de92eb0ae1d8dc 100644 --- a/test/workflows/vrf/test_modify_vrf_router_list.py +++ b/test/workflows/vrf/test_modify_vrf_router_list.py @@ -11,11 +11,14 @@ from test.workflows import assert_complete, assert_lso_interaction_success, extr @pytest.mark.workflow() @patch("gso.services.lso_client._send_request") def test_modify_vrf_router_list(mock_lso_call, vrf_subscription_factory, router_subscription_factory, faker): - subscription_id = vrf_subscription_factory() + subscription_id = str(vrf_subscription_factory().subscription_id) initial_vrf_data = [ {"subscription_id": subscription_id}, { - "router_list": [{"router_id": router_subscription_factory()}, {"router_id": router_subscription_factory()}], + "router_list": [ + {"router_id": str(router_subscription_factory().subscription_id)}, + {"router_id": str(router_subscription_factory().subscription_id)}, + ], "tt_number": faker.tt_number(), }, ] @@ -35,7 +38,7 @@ def test_modify_vrf_router_list(mock_lso_call, vrf_subscription_factory, router_ @pytest.mark.workflow() def test_modify_vrf_router_list_with_invalid_router_id(vrf_subscription_factory, router_subscription_factory, faker): - subscription_id = vrf_subscription_factory() + subscription_id = str(vrf_subscription_factory().subscription_id) initial_vrf_data = [ {"subscription_id": subscription_id}, {"router_list": [{"router_id": uuid.uuid4()}], "tt_number": faker.tt_number()}, @@ -47,8 +50,8 @@ def test_modify_vrf_router_list_with_invalid_router_id(vrf_subscription_factory, @pytest.mark.workflow() def test_modify_vrf_router_list_with_duplicate_router_id(vrf_subscription_factory, router_subscription_factory, faker): - subscription_id = vrf_subscription_factory() - router_id = router_subscription_factory() + subscription_id = str(vrf_subscription_factory().subscription_id) + router_id = str(router_subscription_factory().subscription_id) initial_vrf_data = [ {"subscription_id": subscription_id}, {"router_list": [{"router_id": router_id}, {"router_id": router_id}], "tt_number": faker.tt_number()}, diff --git a/test/workflows/vrf/test_terminate_vrf.py b/test/workflows/vrf/test_terminate_vrf.py index b06e72dbe3ddff964df0c9177a3e2fd0a74390d9..63bec5d2d6939aa3efeb8a93ba86e3beae4e1b51 100644 --- a/test/workflows/vrf/test_terminate_vrf.py +++ b/test/workflows/vrf/test_terminate_vrf.py @@ -1,14 +1,13 @@ import pytest from pydantic_forms.exceptions import FormValidationError -from gso.products.product_types.router import Router from gso.products.product_types.vrf import VRF from test.workflows import assert_complete, extract_state, run_workflow @pytest.mark.workflow() def test_terminate_vrf_success(vrf_subscription_factory, faker): - subscription_id = vrf_subscription_factory() + subscription_id = str(vrf_subscription_factory().subscription_id) initial_vrf_data = [{"subscription_id": subscription_id}, {"tt_number": faker.tt_number()}] result, _, _ = run_workflow("terminate_vrf", initial_vrf_data) assert_complete(result) @@ -21,9 +20,9 @@ def test_terminate_vrf_success(vrf_subscription_factory, faker): @pytest.mark.workflow() def test_terminate_vrf_with_router_list(vrf_subscription_factory, faker, router_subscription_factory): - subscription_id = vrf_subscription_factory() + subscription_id = str(vrf_subscription_factory().subscription_id) subscription = VRF.from_subscription(subscription_id) - router = Router.from_subscription(router_subscription_factory()) + router = router_subscription_factory() subscription.vrf.vrf_router_list = [router.router] subscription.save() initial_vrf_data = [{"subscription_id": subscription_id}, {"tt_number": faker.tt_number()}]