Skip to content
Snippets Groups Projects
Commit 31ca85e7 authored by geant-release-service's avatar geant-release-service
Browse files

Finished release 2.23.

parents 51a8a2f6 5a1f270d
Branches
Tags 2.23
No related merge requests found
Pipeline #90136 passed
Showing
with 452 additions and 15 deletions
orchestrator-core==2.7.6 orchestrator-core==2.8.0
requests==2.31.0 requests==2.31.0
infoblox-client~=0.6.0 infoblox-client~=0.6.0
pycountry==23.12.11 pycountry==23.12.11
......
...@@ -4,14 +4,14 @@ from setuptools import find_packages, setup ...@@ -4,14 +4,14 @@ from setuptools import find_packages, setup
setup( setup(
name="geant-service-orchestrator", name="geant-service-orchestrator",
version="2.22", version="2.23",
author="GÉANT Orchestration and Automation Team", author="GÉANT Orchestration and Automation Team",
author_email="goat@geant.org", author_email="goat@geant.org",
description="GÉANT Service Orchestrator", description="GÉANT Service Orchestrator",
url="https://gitlab.software.geant.org/goat/gap/geant-service-orchestrator", url="https://gitlab.software.geant.org/goat/gap/geant-service-orchestrator",
packages=find_packages(), packages=find_packages(),
install_requires=[ install_requires=[
"orchestrator-core==2.7.6", "orchestrator-core==2.8.0",
"requests==2.31.0", "requests==2.31.0",
"infoblox-client~=0.6.0", "infoblox-client~=0.6.0",
"pycountry==23.12.11", "pycountry==23.12.11",
......
...@@ -7,23 +7,27 @@ import pytest ...@@ -7,23 +7,27 @@ import pytest
from gso.cli.imports import ( from gso.cli.imports import (
import_edge_port, import_edge_port,
import_iptrunks, import_iptrunks,
import_lan_switch_interconnect,
import_nren_l3_core_service, import_nren_l3_core_service,
import_office_routers, import_office_routers,
import_opengear, import_opengear,
import_routers, import_routers,
import_sites, import_sites,
import_super_pop_switches, import_super_pop_switches,
import_switches,
) )
from gso.products.product_blocks.bgp_session import IPFamily from gso.products.product_blocks.bgp_session import IPFamily
from gso.products.product_blocks.edge_port import EdgePortType, EncapsulationType from gso.products.product_blocks.edge_port import EdgePortType, EncapsulationType
from gso.products.product_blocks.iptrunk import IptrunkType from gso.products.product_blocks.iptrunk import IptrunkType
from gso.products.product_blocks.router import RouterRole from gso.products.product_blocks.router import RouterRole
from gso.products.product_blocks.site import SiteTier from gso.products.product_blocks.site import SiteTier
from gso.products.product_blocks.switch import SwitchModel
from gso.products.product_types.router import Router from gso.products.product_types.router import Router
from gso.products.product_types.site import Site from gso.products.product_types.site import Site
from gso.utils.helpers import iso_from_ipv4 from gso.utils.helpers import iso_from_ipv4
from gso.utils.shared_enums import Vendor from gso.utils.shared_enums import Vendor
from gso.utils.types.interfaces import PhysicalPortCapacity from gso.utils.types.interfaces import PhysicalPortCapacity
from gso.utils.types.ip_address import AddressSpace
############## ##############
...@@ -200,6 +204,59 @@ def opengear_data(temp_file, faker, site_subscription_factory): ...@@ -200,6 +204,59 @@ def opengear_data(temp_file, faker, site_subscription_factory):
return _opengear_data return _opengear_data
@pytest.fixture()
def switch_data(temp_file, faker, site_subscription_factory):
def _switch_data(**kwargs):
switch_data = {
"fqdn": faker.domain_name(levels=4),
"ts_port": faker.port_number(is_user=True),
"site": site_subscription_factory(),
"switch_vendor": Vendor.JUNIPER,
"switch_model": SwitchModel.EX3400,
}
switch_data.update(**kwargs)
temp_file.write_text(json.dumps([switch_data]))
return {"path": str(temp_file), "data": switch_data}
return _switch_data
@pytest.fixture()
def lan_switch_interconnect_data(temp_file, faker, switch_subscription_factory, router_subscription_factory):
def _lan_switch_interconnect_data(**kwargs):
lan_switch_interconnect_data = {
"lan_switch_interconnect_description": faker.sentence(),
"lan_switch_interconnect_ip_network": str(faker.ipv4_network()),
"address_space": AddressSpace.PUBLIC,
"minimum_links": 1,
"router_side": {
"node": router_subscription_factory(),
"ae_iface": faker.nokia_lag_interface_name(),
"ae_members": [
{"interface_name": faker.network_interface(), "interface_description": faker.sentence()}
for _ in range(2)
],
"ipv4_address": faker.ipv4(),
},
"switch_side": {
"switch": switch_subscription_factory(),
"ae_iface": faker.juniper_ae_interface_name(),
"ae_members": [
{"interface_name": faker.network_interface(), "interface_description": faker.sentence()}
for _ in range(2)
],
"ipv4_address": faker.ipv4(),
},
}
lan_switch_interconnect_data.update(**kwargs)
temp_file.write_text(json.dumps([lan_switch_interconnect_data]))
return {"path": str(temp_file), "data": lan_switch_interconnect_data}
return _lan_switch_interconnect_data
@pytest.fixture() @pytest.fixture()
def edge_port_data(temp_file, faker, router_subscription_factory, partner_factory): def edge_port_data(temp_file, faker, router_subscription_factory, partner_factory):
def _edge_port_data(**kwargs): def _edge_port_data(**kwargs):
...@@ -425,6 +482,20 @@ router_lo_ipv6_address ...@@ -425,6 +482,20 @@ router_lo_ipv6_address
assert mock_start_process.call_count == 0 assert mock_start_process.call_count == 0
@patch("gso.cli.imports.time.sleep")
@patch("gso.cli.imports.start_process")
def test_import_switch_success(mock_start_process, mock_sleep, switch_data):
import_switches(switch_data()["path"])
assert mock_start_process.call_count == 1
@patch("gso.cli.imports.time.sleep")
@patch("gso.cli.imports.start_process")
def test_import_lan_switch_interconnect(mock_start_process, mock_sleep, lan_switch_interconnect_data):
import_lan_switch_interconnect(lan_switch_interconnect_data()["path"])
assert mock_start_process.call_count == 1
@patch("gso.cli.imports.time.sleep") @patch("gso.cli.imports.time.sleep")
@patch("gso.cli.imports.start_process") @patch("gso.cli.imports.start_process")
def test_import_iptrunk_successful(mock_start_process, mock_sleep, iptrunk_data): def test_import_iptrunk_successful(mock_start_process, mock_sleep, iptrunk_data):
......
...@@ -40,6 +40,7 @@ from test.fixtures import ( # noqa: F401 ...@@ -40,6 +40,7 @@ from test.fixtures import ( # noqa: F401
edge_port_subscription_factory, edge_port_subscription_factory,
iptrunk_side_subscription_factory, iptrunk_side_subscription_factory,
iptrunk_subscription_factory, iptrunk_subscription_factory,
lan_switch_interconnect_subscription_factory,
nren_access_port_factory, nren_access_port_factory,
nren_l3_core_service_subscription_factory, nren_l3_core_service_subscription_factory,
office_router_subscription_factory, office_router_subscription_factory,
...@@ -48,6 +49,7 @@ from test.fixtures import ( # noqa: F401 ...@@ -48,6 +49,7 @@ from test.fixtures import ( # noqa: F401
service_binding_port_factory, service_binding_port_factory,
site_subscription_factory, site_subscription_factory,
super_pop_switch_subscription_factory, super_pop_switch_subscription_factory,
switch_subscription_factory,
) )
logging.getLogger("faker.factory").setLevel(logging.WARNING) logging.getLogger("faker.factory").setLevel(logging.WARNING)
...@@ -108,7 +110,15 @@ class FakerProvider(BaseProvider): ...@@ -108,7 +110,15 @@ class FakerProvider(BaseProvider):
return self.generator.random_int(min=1, max=128) return self.generator.random_int(min=1, max=128)
def network_interface(self) -> str: def network_interface(self) -> str:
return self.generator.numerify("ge-@#/@#/@#") interface = self.generator.random_choices(elements=("ge", "et", "xe"))[0]
number = self.generator.numerify("-%/%/%")
return f"{interface}{number}"
def juniper_ae_interface_name(self) -> str:
return self.generator.numerify("ae@#")
def nokia_lag_interface_name(self) -> str:
return self.generator.numerify("lag-@#")
def link_members_juniper(self) -> LAGMemberList[LAGMember]: def link_members_juniper(self) -> LAGMemberList[LAGMember]:
iface_amount = self.generator.random_int(min=2, max=5) iface_amount = self.generator.random_int(min=2, max=5)
......
from test.fixtures.edge_port_fixtures import edge_port_subscription_factory from test.fixtures.edge_port_fixtures import edge_port_subscription_factory
from test.fixtures.iptrunk_fixtures import iptrunk_side_subscription_factory, iptrunk_subscription_factory from test.fixtures.iptrunk_fixtures import iptrunk_side_subscription_factory, iptrunk_subscription_factory
from test.fixtures.lan_switch_interconnect_fixtures import lan_switch_interconnect_subscription_factory
from test.fixtures.nren_l3_core_service_fixtures import ( from test.fixtures.nren_l3_core_service_fixtures import (
bgp_session_subscription_factory, bgp_session_subscription_factory,
nren_access_port_factory, nren_access_port_factory,
...@@ -11,12 +12,14 @@ from test.fixtures.opengear_fixtures import opengear_subscription_factory ...@@ -11,12 +12,14 @@ from test.fixtures.opengear_fixtures import opengear_subscription_factory
from test.fixtures.router_fixtures import router_subscription_factory from test.fixtures.router_fixtures import router_subscription_factory
from test.fixtures.site_fixtures import site_subscription_factory from test.fixtures.site_fixtures import site_subscription_factory
from test.fixtures.super_pop_switch_fixtures import super_pop_switch_subscription_factory from test.fixtures.super_pop_switch_fixtures import super_pop_switch_subscription_factory
from test.fixtures.switch_fixtures import switch_subscription_factory
__all__ = [ __all__ = [
"bgp_session_subscription_factory", "bgp_session_subscription_factory",
"edge_port_subscription_factory", "edge_port_subscription_factory",
"iptrunk_side_subscription_factory", "iptrunk_side_subscription_factory",
"iptrunk_subscription_factory", "iptrunk_subscription_factory",
"lan_switch_interconnect_subscription_factory",
"nren_access_port_factory", "nren_access_port_factory",
"nren_l3_core_service_subscription_factory", "nren_l3_core_service_subscription_factory",
"office_router_subscription_factory", "office_router_subscription_factory",
...@@ -25,4 +28,5 @@ __all__ = [ ...@@ -25,4 +28,5 @@ __all__ = [
"service_binding_port_factory", "service_binding_port_factory",
"site_subscription_factory", "site_subscription_factory",
"super_pop_switch_subscription_factory", "super_pop_switch_subscription_factory",
"switch_subscription_factory",
] ]
from uuid import uuid4
import pytest
from orchestrator.db import db
from orchestrator.domain import SubscriptionModel
from orchestrator.types import SubscriptionLifecycle, UUIDstr
from gso.products import ProductName
from gso.products.product_blocks.lan_switch_interconnect import (
LanSwitchInterconnectInterfaceBlockInactive,
LanSwitchInterconnectRouterSideBlockInactive,
LanSwitchInterconnectSwitchSideBlockInactive,
)
from gso.products.product_types.lan_switch_interconnect import (
ImportedLanSwitchInterconnectInactive,
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.ip_address import AddressSpace, IPv4AddressType, IPv4NetworkType
@pytest.fixture()
def lan_switch_interconnect_subscription_factory(
faker, geant_partner, router_subscription_factory, switch_subscription_factory
):
def create_subscription(
description: str | None = None,
partner: dict | None = None,
status: SubscriptionLifecycle | None = None,
start_date: str | None = "2024-01-01T10:20:30+01:02",
lan_switch_interconnect_description: str | None = None,
lan_switch_interconnect_ip_network: IPv4NetworkType | None = None,
address_space: AddressSpace | None = None,
minimum_links: int | None = None,
router_side_node: UUIDstr | None = None,
router_side_ae_iface: str | None = None,
router_side_ae_members: list[dict[str, str]] | None = None,
router_side_ipv4_address: IPv4AddressType | None = None,
switch_side_switch: UUIDstr | None = None,
switch_side_ae_iface: str | None = None,
switch_side_ae_members: list[dict[str, str]] | None = None,
switch_side_ipv4_address: IPv4AddressType | None = None,
*,
is_imported: bool | None = True,
) -> UUIDstr:
if partner is None:
partner = geant_partner
if is_imported:
product_id = get_product_id_by_name(ProductName.LAN_SWITCH_INTERCONNECT)
subscription = LanSwitchInterconnectInactive.from_product_id(product_id, partner["partner_id"])
else:
product_id = get_product_id_by_name(ProductName.IMPORTED_LAN_SWITCH_INTERCONNECT)
subscription = ImportedLanSwitchInterconnectInactive.from_product_id(product_id, partner["partner_id"])
router_side_ae_members = router_side_ae_members or [
LanSwitchInterconnectInterfaceBlockInactive.new(
uuid4(), interface_name=faker.network_interface(), interface_description=faker.sentence()
)
for _ in range(2)
]
switch_side_ae_members = switch_side_ae_members or [
LanSwitchInterconnectInterfaceBlockInactive.new(
uuid4(), interface_name=faker.network_interface(), interface_description=faker.sentence()
)
for _ in range(2)
]
subscription.lan_switch_interconnect.lan_switch_interconnect_description = (
lan_switch_interconnect_description or faker.sentence()
)
subscription.lan_switch_interconnect.lan_switch_interconnect_ip_network = (
lan_switch_interconnect_ip_network or faker.ipv4_network()
)
subscription.lan_switch_interconnect.address_space = address_space or AddressSpace.PRIVATE
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,
ae_iface=router_side_ae_iface or faker.network_interface(),
ae_members=router_side_ae_members,
ipv4_address=router_side_ipv4_address or faker.ipv4(),
)
subscription.lan_switch_interconnect.switch_side = LanSwitchInterconnectSwitchSideBlockInactive.new(
uuid4(),
switch=switch_side_switch or Switch.from_subscription(switch_subscription_factory()).switch,
ae_iface=switch_side_ae_iface or faker.network_interface(),
ae_members=switch_side_ae_members,
ipv4_address=switch_side_ipv4_address or faker.ipv4(),
)
subscription = SubscriptionModel.from_other_lifecycle(subscription, SubscriptionLifecycle.ACTIVE)
subscription.insync = True
subscription.description = description or faker.sentence()
subscription.start_date = start_date
if status:
subscription.status = status
subscription.save()
db.session.commit()
return str(subscription.subscription_id)
return create_subscription
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_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
from gso.utils.types.ip_address import PortNumber
@pytest.fixture()
def switch_subscription_factory(faker, geant_partner, site_subscription_factory):
def subscription_create(
partner: dict | None = None,
description: str | None = None,
start_date: str | None = "2024-01-01T10:20:30+01:02",
fqdn: str | None = None,
ts_port: PortNumber | None = None,
site: UUIDstr | None = None,
switch_vendor: Vendor | None = None,
switch_model: SwitchModel | None = None,
status: SubscriptionLifecycle | None = None,
*,
is_imported: bool = True,
) -> UUIDstr:
if partner is None:
partner = geant_partner
if is_imported:
product_id = get_product_id_by_name(ProductName.SWITCH)
switch_subscription = SwitchInactive.from_product_id(product_id, partner["partner_id"])
else:
product_id = get_product_id_by_name(ProductName.IMPORTED_SWITCH)
switch_subscription = ImportedSwitchInactive.from_product_id(product_id, partner["partner_id"])
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.switch_vendor = switch_vendor or Vendor.JUNIPER
switch_subscription.switch.switch_model = switch_model or SwitchModel.EX3400
switch_subscription = SubscriptionModel.from_other_lifecycle(switch_subscription, SubscriptionLifecycle.ACTIVE)
switch_subscription.insync = True
switch_subscription.description = description or faker.sentence()
switch_subscription.start_date = start_date
if status:
switch_subscription.status = status
switch_subscription.save()
db.session.commit()
return str(switch_subscription.subscription_id)
return subscription_create
...@@ -64,6 +64,9 @@ class MockedNetboxClient: ...@@ -64,6 +64,9 @@ class MockedNetboxClient:
def delete_interface(): def delete_interface():
return None return None
def get_available_lags_in_range(self):
return self.get_available_lags()
class MockedSharePointClient: class MockedSharePointClient:
class BaseMockObject: class BaseMockObject:
...@@ -104,15 +107,18 @@ class MockedKentikClient: ...@@ -104,15 +107,18 @@ class MockedKentikClient:
@staticmethod @staticmethod
def get_plans() -> list[dict[str, Any]]: def get_plans() -> list[dict[str, Any]]:
return [{"id": 0, "plan_name": "kentik-plan-1"}, {"id": 1, "plan_name": "kentik-plan-2"}] return [
{"id": 0, "name": "kentik-plan-1", "active": True, "devices": [], "max_devices": 9999},
{"id": 1, "name": "kentik-plan-2", "active": True, "devices": [], "max_devices": 9999},
]
@staticmethod @staticmethod
def get_plan(plan_id: int) -> dict[str, Any]: def get_plan(plan_id: int) -> dict[str, Any]:
return {"id": plan_id, "plan_name": "kentik-mocked-plan"} return {"id": plan_id, "name": "kentik-mocked-plan", "active": True, "devices": [], "max_devices": 9999}
@staticmethod @staticmethod
def get_plan_by_name(plan_name: str) -> dict[str, Any]: def get_plan_by_name(plan_name: str) -> dict[str, Any]:
return {"id": 0, "plan_name": plan_name} return {"id": 0, "name": plan_name, "active": True, "devices": [], "max_devices": 9999}
@staticmethod @staticmethod
def create_device(device: NewKentikDevice) -> dict[str, Any]: def create_device(device: NewKentikDevice) -> dict[str, Any]:
......
...@@ -81,7 +81,6 @@ def input_form_wizard_data(request, router_subscription_factory, partner_factory ...@@ -81,7 +81,6 @@ def input_form_wizard_data(request, router_subscription_factory, partner_factory
@patch("gso.services.lso_client._send_request") @patch("gso.services.lso_client._send_request")
def test_successful_edge_port_creation( def test_successful_edge_port_creation(
mock_execute_playbook, mock_execute_playbook,
responses,
input_form_wizard_data, input_form_wizard_data,
faker, faker,
_netbox_client_mock, # noqa: PT019 _netbox_client_mock, # noqa: PT019
......
...@@ -119,7 +119,6 @@ def test_successful_iptrunk_creation_with_standard_lso_result( ...@@ -119,7 +119,6 @@ def test_successful_iptrunk_creation_with_standard_lso_result(
mock_allocate_v4_network, mock_allocate_v4_network,
mock_allocate_v6_network, mock_allocate_v6_network,
mock_execute_playbook, mock_execute_playbook,
responses,
input_form_wizard_data, input_form_wizard_data,
faker, faker,
_netbox_client_mock, # noqa: PT019 _netbox_client_mock, # noqa: PT019
...@@ -176,7 +175,6 @@ def test_iptrunk_creation_fails_when_lso_return_code_is_one( ...@@ -176,7 +175,6 @@ def test_iptrunk_creation_fails_when_lso_return_code_is_one(
mock_allocate_v4_network, mock_allocate_v4_network,
mock_allocate_v6_network, mock_allocate_v6_network,
mock_execute_playbook, mock_execute_playbook,
responses,
input_form_wizard_data, input_form_wizard_data,
faker, faker,
_netbox_client_mock, # noqa: PT019 _netbox_client_mock, # noqa: PT019
...@@ -217,7 +215,6 @@ def test_successful_iptrunk_creation_with_juniper_interface_names( ...@@ -217,7 +215,6 @@ def test_successful_iptrunk_creation_with_juniper_interface_names(
mock_allocate_v4_network, mock_allocate_v4_network,
mock_allocate_v6_network, mock_allocate_v6_network,
mock_execute_playbook, mock_execute_playbook,
responses,
input_form_wizard_data, input_form_wizard_data,
faker, faker,
data_config_filename: PathLike, data_config_filename: PathLike,
......
import pytest
from orchestrator.types import SubscriptionLifecycle
from gso.products import ProductName
from gso.products.product_types.lan_switch_interconnect import ImportedLanSwitchInterconnect
from gso.utils.types.ip_address import AddressSpace
from test.workflows import (
assert_complete,
extract_state,
run_workflow,
)
@pytest.fixture()
def workflow_input_data(faker, router_subscription_factory, switch_subscription_factory):
return {
"lan_switch_interconnect_description": faker.sentence(),
"lan_switch_interconnect_ip_network": faker.ipv4_network(),
"address_space": AddressSpace.PUBLIC,
"minimum_links": 1,
"router_side": {
"node": router_subscription_factory(),
"ae_iface": faker.nokia_lag_interface_name(),
"ae_members": faker.link_members_nokia(),
"ipv4_address": faker.ipv4(),
},
"switch_side": {
"switch": switch_subscription_factory(),
"ae_iface": faker.juniper_ae_interface_name(),
"ae_members": faker.link_members_juniper(),
"ipv4_address": faker.ipv4(),
},
}
@pytest.mark.workflow()
def test_create_imported_lan_switch_interconnect_success(workflow_input_data):
result, _, _ = run_workflow("create_imported_lan_switch_interconnect", [workflow_input_data])
state = extract_state(result)
subscription = ImportedLanSwitchInterconnect.from_subscription(state["subscription_id"])
assert_complete(result)
assert subscription.product.name == ProductName.IMPORTED_LAN_SWITCH_INTERCONNECT
assert subscription.status == SubscriptionLifecycle.ACTIVE
from unittest.mock import patch
import pytest
from orchestrator.types import SubscriptionLifecycle
from gso.products import ProductName
from gso.products.product_types.lan_switch_interconnect import LanSwitchInterconnect
from gso.services.subscriptions import get_product_id_by_name
from gso.utils.types.ip_address import AddressSpace
from test.services.conftest import MockedNetboxClient
from test.workflows import assert_complete, extract_state, run_workflow
@pytest.fixture()
def _netbox_client_mock():
# Mock NetboxClient methods
with (
patch("gso.services.netbox_client.NetboxClient.get_device_by_name") as mock_get_device_by_name,
patch("gso.services.netbox_client.NetboxClient.get_available_interfaces") as mock_get_available_interfaces,
patch("gso.services.netbox_client.NetboxClient.get_available_lags_in_range") as mock_available_lags_in_range,
):
mock_get_device_by_name.return_value = MockedNetboxClient().get_device_by_name()
mock_get_available_interfaces.return_value = MockedNetboxClient().get_available_interfaces()
mock_available_lags_in_range.return_value = MockedNetboxClient().get_available_lags_in_range()
yield
@pytest.fixture()
def input_form_data(faker, router_subscription_factory, switch_subscription_factory):
def _generate_form_data(address_space: AddressSpace):
return [
{
"product": get_product_id_by_name(ProductName.LAN_SWITCH_INTERCONNECT),
},
{
"tt_number": faker.tt_number(),
"router_side": router_subscription_factory(),
"switch_side": switch_subscription_factory(),
"address_space": address_space,
"description": faker.sentence(),
"minimum_link_count": 2,
"vlan_id": 111, # VLAN ID for new interconnections is always 111
},
{
"router_side_iface": "lag-1",
"router_side_ae_members": faker.link_members_nokia()[:2],
},
{
"switch_side_iface": faker.network_interface(),
"switch_side_ae_members": faker.link_members_juniper()[:2],
},
{},
]
return _generate_form_data
@pytest.mark.parametrize("address_space", [AddressSpace.PRIVATE, AddressSpace.PUBLIC])
@pytest.mark.workflow()
def test_create_lan_switch_interconnect_success(
address_space,
input_form_data,
_netbox_client_mock, # noqa: PT019
):
initial_data = input_form_data(address_space)
result, _, _ = run_workflow("create_lan_switch_interconnect", initial_data)
assert_complete(result)
state = extract_state(result)
subscription_id = state["subscription_id"]
subscription = LanSwitchInterconnect.from_subscription(subscription_id)
assert subscription.status == SubscriptionLifecycle.ACTIVE
import pytest
from orchestrator.types import SubscriptionLifecycle
from gso.products import ProductName
from gso.products.product_types.lan_switch_interconnect import LanSwitchInterconnect
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=False)
result, _, _ = run_workflow(
"import_lan_switch_interconnect", [{"subscription_id": imported_lan_switch_interconnect}]
)
subscription = LanSwitchInterconnect.from_subscription(imported_lan_switch_interconnect)
assert_complete(result)
assert subscription.product.name == ProductName.LAN_SWITCH_INTERCONNECT
assert subscription.status == SubscriptionLifecycle.ACTIVE
assert subscription.insync is True
import pytest
from gso.products.product_types.lan_switch_interconnect import LanSwitchInterconnect
from test.workflows import assert_complete, extract_state, run_workflow
@pytest.mark.workflow()
def test_terminate_lan_switch_interconnect(lan_switch_interconnect_subscription_factory, faker):
subscription_id = lan_switch_interconnect_subscription_factory()
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)
state = extract_state(result)
subscription_id = state["subscription_id"]
subscription = LanSwitchInterconnect.from_subscription(subscription_id)
assert subscription.status == "terminated"
...@@ -34,7 +34,6 @@ def base_bgp_peer_input(faker): ...@@ -34,7 +34,6 @@ def base_bgp_peer_input(faker):
def test_create_nren_l3_core_service_success( def test_create_nren_l3_core_service_success(
mock_lso_client, mock_lso_client,
l3_core_type, l3_core_type,
responses,
faker, faker,
partner_factory, partner_factory,
edge_port_subscription_factory, edge_port_subscription_factory,
......
...@@ -6,7 +6,7 @@ from test.workflows import assert_complete, run_workflow ...@@ -6,7 +6,7 @@ from test.workflows import assert_complete, run_workflow
@pytest.mark.workflow() @pytest.mark.workflow()
def test_modify_connection_strategy(responses, router_subscription_factory): def test_modify_connection_strategy(router_subscription_factory):
subscription_id = router_subscription_factory(router_access_via_ts=True) subscription_id = router_subscription_factory(router_access_via_ts=True)
subscription = Router.from_subscription(subscription_id) subscription = Router.from_subscription(subscription_id)
assert subscription.router.router_access_via_ts is True assert subscription.router.router_access_via_ts is True
......
from unittest.mock import patch
import pytest
from gso.products.product_blocks.router import RouterRole
from gso.products.product_types.router import Router
from test.services.conftest import MockedKentikClient
from test.workflows import assert_complete, extract_state, run_workflow
@pytest.mark.workflow()
@patch("gso.services.kentik_client.KentikClient")
def test_modify_router_kentik_license_success(
mock_kentik_client,
router_subscription_factory,
faker,
):
# Set up mock return values
product_id = router_subscription_factory(router_role=RouterRole.PE)
mock_kentik_client.return_value = MockedKentikClient
# Run workflow
initial_input_data = [{"subscription_id": product_id}, {"new_plan_id": "0"}]
result, _, _ = run_workflow("modify_router_kentik_license", initial_input_data)
assert_complete(result)
state = extract_state(result)
subscription_id = state["subscription_id"]
subscription = Router.from_subscription(subscription_id)
assert subscription.status == "active"
...@@ -9,7 +9,7 @@ from test.workflows import assert_complete, extract_state, run_workflow ...@@ -9,7 +9,7 @@ from test.workflows import assert_complete, extract_state, run_workflow
@pytest.mark.workflow() @pytest.mark.workflow()
def test_create_site(responses, faker): def test_create_site(faker):
product_id = get_product_id_by_name(ProductName.SITE) product_id = get_product_id_by_name(ProductName.SITE)
initial_site_data = [ initial_site_data = [
{"product": product_id}, {"product": product_id},
...@@ -41,7 +41,7 @@ def test_create_site(responses, faker): ...@@ -41,7 +41,7 @@ def test_create_site(responses, faker):
@pytest.mark.workflow() @pytest.mark.workflow()
def test_site_name_is_incorrect(responses, faker): def test_site_name_is_incorrect(faker):
"""Test validate site name on site creation. """Test validate site name on site creation.
The site name is a string with 3 upper case letter and one digit. The site name is a string with 3 upper case letter and one digit.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment