Skip to content
Snippets Groups Projects
Commit 7a5a4f98 authored by Karel van Klink's avatar Karel van Klink :smiley_cat: Committed by Neda Moeini
Browse files

move utility modules that only contain type definitions into gso.utils.types package

parent 8fd576ae
No related branches found
No related tags found
1 merge request!83Clean up the repo a bit, and add some unit tests
......@@ -7,7 +7,7 @@ from orchestrator.security import opa_security_default
from orchestrator.services import processes, subscriptions
from sqlalchemy.exc import MultipleResultsFound
from gso.schemas.imports import ImportResponseModel, IptrunkImportModel, RouterImportModel, SiteImportModel
from utils.types.imports import ImportResponseModel, IptrunkImportModel, RouterImportModel, SiteImportModel
router = APIRouter(prefix="/imports", tags=["Imports"], dependencies=[Depends(opa_security_default)])
......
......@@ -5,7 +5,7 @@ from orchestrator.domain.base import ProductBlockModel
from orchestrator.types import SubscriptionLifecycle, strEnum
from gso.products.product_blocks.site import SiteBlock, SiteBlockInactive, SiteBlockProvisioning
from gso.products.shared import PortNumber
from utils.types.port import PortNumber
class RouterVendor(strEnum):
......@@ -92,5 +92,5 @@ class RouterBlock(RouterBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTI
router_role: RouterRole
#: The :class:`Site` that this router resides in. Both physically and computationally.
router_site: SiteBlock
#: The router is going to have a LT interface between inet0 and IAS
#: The router is going to have an LT interface between inet0 and IAS
router_is_ias_connected: bool
......@@ -2,7 +2,7 @@
from orchestrator.domain.base import ProductBlockModel
from orchestrator.types import SubscriptionLifecycle, strEnum
from gso.schemas.types import LatitudeCoordinate, LongitudeCoordinate
from gso.utils.types.snmp import LatitudeCoordinate, LongitudeCoordinate
class SiteTier(strEnum):
......
File moved
File moved
File moved
File moved
......@@ -14,7 +14,7 @@ from pydantic import validator
from gso.products.product_blocks.router import RouterRole, RouterVendor, generate_fqdn
from gso.products.product_types.router import RouterInactive, RouterProvisioning
from gso.products.product_types.site import Site
from gso.products.shared import PortNumber
from utils.types.port import PortNumber
from gso.services import infoblox, provisioning_proxy, subscriptions
from gso.services.netbox_client import NetboxClient
from gso.services.provisioning_proxy import pp_interaction
......
......@@ -12,8 +12,8 @@ from pydantic import validator
from gso.products.product_blocks import site as site_pb
from gso.products.product_types import site
from gso.schemas.types import LatitudeCoordinate, LongitudeCoordinate
from gso.workflows.utils import customer_selector
from gso.utils.types.snmp import LatitudeCoordinate, LongitudeCoordinate
def initial_input_form_generator(product_name: str) -> FormGenerator: # noqa: C901
......
......@@ -13,7 +13,7 @@ from gso.products.product_blocks.router import RouterRole, RouterVendor
from gso.products.product_types import router
from gso.products.product_types.router import RouterInactive
from gso.products.product_types.site import Site
from gso.products.shared import PortNumber
from utils.types.port import PortNumber
from gso.products import ProductType
from gso.services import subscriptions
from gso.services.crm import get_customer_by_name
......
......@@ -4,5 +4,5 @@ if [ ! -d ./docs/vale/styles/proselint ] || [ ! -d ./docs/vale/styles/Microsoft
docker run -it --rm -v "$(pwd)"/docs:/docs jdkato/vale:latest --config="/docs/vale/.vale.ini" sync
fi
docker run -it --rm -v $(pwd):/gso jdkato/vale:latest --glob='!*/migrations/*' \
docker run -it --rm -v "$(pwd)":/gso jdkato/vale:latest --glob='!*/migrations/*' \
--config="/gso/docs/vale/.vale.ini" /gso/docs/source /gso/gso
import pytest
from gso.schemas.types import LatitudeCoordinate, LongitudeCoordinate
from gso.utils.types.snmp import LatitudeCoordinate, LongitudeCoordinate
@pytest.mark.parametrize(
......
......@@ -160,14 +160,14 @@ def _sanitize_input(input_data: State | list[State]) -> list[State]:
if not isinstance(input_data, list):
input_data = [input_data]
# We need a copy here and we want to mimic the actual code that returns a serialized version of the state
# We need a copy here, and we want to mimic the actual code that returns a serialized version of the state
return cast(list[State], json_loads(json_dumps(input_data)))
def run_workflow(workflow_key: str, input_data: State | list[State]) -> tuple[WFProcess, ProcessStat, list]:
# ATTENTION!! This code needs to be as similar as possible to `server.services.processes.start_process`
# The main differences are: we use a different step log function and we don't run in
# a sepperate thread
# The main differences are: we use a different step log function, and we don't run in
# a separate thread
user_data = _sanitize_input(input_data)
user = "john.doe"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment