From f83593dd14df44422293f9188659e875fe95326d Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Sat, 8 Apr 2023 18:43:26 +0200 Subject: [PATCH] tmp refactoring of service.ipam --- geant_service_orchestrator/main.py | 2 +- geant_service_orchestrator/services/ipam.py | 8 +++++--- .../workflows/device/create_device.py | 2 +- .../workflows/device/terminate_device.py | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/geant_service_orchestrator/main.py b/geant_service_orchestrator/main.py index 0ec8aae0..9ea59ed7 100644 --- a/geant_service_orchestrator/main.py +++ b/geant_service_orchestrator/main.py @@ -2,7 +2,7 @@ from orchestrator import OrchestratorCore from orchestrator.cli.main import app as core_cli from orchestrator.settings import AppSettings import geant_service_orchestrator.products # noqa: F401 -import geant_service_orchestrator.workflows # noqa: F401 +import geant_service_orchestrator.workflows # noqa: F401 app = OrchestratorCore(base_settings=AppSettings()) diff --git a/geant_service_orchestrator/services/ipam.py b/geant_service_orchestrator/services/ipam.py index 7c02a448..3314bce4 100644 --- a/geant_service_orchestrator/services/ipam.py +++ b/geant_service_orchestrator/services/ipam.py @@ -2,7 +2,6 @@ import ipaddress from pydantic import BaseSettings from geant_service_orchestrator import settings - class ServiceNetworks(BaseSettings): v4: ipaddress.IPv4Network v6: ipaddress.IPv6Network @@ -14,8 +13,9 @@ class HostAddresses(BaseSettings): def new_service_networks( - ipam: settings.IPAMParams, service_params: settings.ServiceNetworkParams) -> ServiceNetworks: + oss = settings.load_oss_params() + assert oss.IPAM.INFOBLOX # TODO: load from ipam # cf. https://gitlab.geant.org/goat/gap-jenkins/-/blob/development/service-editor/gap_service_editor/ipam.py#L35-66 # noqa: E501 return ServiceNetworks( @@ -23,7 +23,9 @@ def new_service_networks( v6=ipaddress.IPv6Network('dead:beef::/120')) -def new_device_lo_address(fqdn: str, networks: ServiceNetworks) -> HostAddresses: +def new_device_lo_address() -> HostAddresses: + oss = settings.load_oss_params() + assert oss.IPAM.INFOBLOX # TODO: load from ipam return HostAddresses( v4=ipaddress.IPv4Address('10.10.10.10'), diff --git a/geant_service_orchestrator/workflows/device/create_device.py b/geant_service_orchestrator/workflows/device/create_device.py index d3fe7af8..02eedfa7 100644 --- a/geant_service_orchestrator/workflows/device/create_device.py +++ b/geant_service_orchestrator/workflows/device/create_device.py @@ -45,7 +45,7 @@ def get_info_from_ipam(subscription: device.DeviceInactive) -> State: lo = ipam.new_device_lo_address() subscription.device.lo_ipv4_address = lo.v4 subscription.device.lo_ipv6_address = lo.v6 - # TODO: get info about how these are to be generated + # TODO: get info about how these should be generated subscription.device.lo_iso_address = "49.51e5.0001.0620.4009.6047.00" subscription.device.si_ipv4_network = "192.168.0.0/31" subscription.device.ias_lt_ipv4_network = "192.168.1.0/31" diff --git a/geant_service_orchestrator/workflows/device/terminate_device.py b/geant_service_orchestrator/workflows/device/terminate_device.py index 2ea80d0e..5c175778 100644 --- a/geant_service_orchestrator/workflows/device/terminate_device.py +++ b/geant_service_orchestrator/workflows/device/terminate_device.py @@ -11,7 +11,7 @@ from orchestrator.workflows.steps import ( ) from orchestrator.workflows.utils import wrap_modify_initial_input_form -from products import Device +from geant_service_orchestrator.products.product_types.device import Device def initial_input_form_generator(subscription_id: UUIDstr) -> InputForm: -- GitLab