Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • goat/gap/geant-service-orchestrator
1 result
Show changes
......@@ -14,11 +14,11 @@ from gso.products.product_blocks.iptrunk import IptrunkType
from gso.products.product_types.device import Device
from gso.products.product_types.iptrunk import IptrunkInactive, IptrunkProvisioning
from gso.services import _ipam, provisioning_proxy
from gso.services.provisioning_proxy import await_pp_results, confirm_pp_results
from gso.services.provisioning_proxy import pp_interaction
def initial_input_form_generator(product_name: str) -> FormGenerator:
# TODO: we need additional validation:
# TODO: implement more strict validation:
# * interface names must be validated
devices = {}
......@@ -62,7 +62,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
user_input_side_a = yield CreateIptrunkSideAForm
# We remove the selected device for side A, to prevent any loops
# Remove the selected device for side A, to prevent any loops
devices.pop(str(user_input_side_a.iptrunk_sideA_node_id.name))
DeviceEnumB = Choice("Select a device", zip(devices.keys(), devices.items())) # type: ignore
......@@ -245,30 +245,14 @@ def create_iptrunk() -> StepList:
>> store_process_subscription(Target.CREATE)
>> initialize_subscription
>> get_info_from_ipam
>> provision_ip_trunk_iface_dry
>> await_pp_results
>> confirm_pp_results
>> provision_ip_trunk_iface_real
>> await_pp_results
>> confirm_pp_results
>> provision_ip_trunk_isis_iface_dry
>> await_pp_results
>> confirm_pp_results
>> provision_ip_trunk_isis_iface_real
>> await_pp_results
>> confirm_pp_results
>> provision_ip_trunk_ldp_iface_dry
>> await_pp_results
>> confirm_pp_results
>> provision_ip_trunk_ldp_iface_real
>> await_pp_results
>> confirm_pp_results
>> provision_ip_trunk_lldp_iface_dry
>> await_pp_results
>> confirm_pp_results
>> provision_ip_trunk_lldp_iface_real
>> await_pp_results
>> confirm_pp_results
>> pp_interaction(provision_ip_trunk_iface_dry, 3)
>> pp_interaction(provision_ip_trunk_iface_real, 3)
>> pp_interaction(provision_ip_trunk_isis_iface_dry, 3)
>> pp_interaction(provision_ip_trunk_isis_iface_real, 3)
>> pp_interaction(provision_ip_trunk_ldp_iface_dry, 3)
>> pp_interaction(provision_ip_trunk_ldp_iface_real, 3)
>> pp_interaction(provision_ip_trunk_lldp_iface_dry, 3)
>> pp_interaction(provision_ip_trunk_lldp_iface_real, 3)
>> set_status(SubscriptionLifecycle.ACTIVE)
>> resync
>> done
......
......@@ -12,7 +12,7 @@ from gso.products.product_blocks import PhyPortCapacity
from gso.products.product_blocks.iptrunk import IptrunkType
from gso.products.product_types.iptrunk import Iptrunk
from gso.services import provisioning_proxy
from gso.services.provisioning_proxy import await_pp_results, confirm_pp_results
from gso.services.provisioning_proxy import pp_interaction
def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
......@@ -108,7 +108,7 @@ def provision_ip_trunk_iface_dry(subscription: Iptrunk, process_id: UUIDstr) ->
return {
"subscription": subscription,
"label_text": "Provision of the Trunk interface [DRY]" "Please refresh to get the results of the playbook",
"label_text": "[DRY RUN] Provisioning trunk interface, please refresh to get the results of the playbook.",
}
......@@ -118,7 +118,7 @@ def provision_ip_trunk_iface_real(subscription: Iptrunk, process_id: UUIDstr) ->
return {
"subscription": subscription,
"label_text": "Provision of the Trunk interface [REAL]" "Please refresh to get the results of the playbook",
"label_text": "Provisioning trunk interface, please refresh to get the results of the playbook.",
}
......@@ -128,7 +128,7 @@ def provision_ip_trunk_lldp_iface_dry(subscription: Iptrunk, process_id: UUIDstr
return {
"subscription": subscription,
"label_text": "Provision of the LLDP interface [DRY]" "Please refresh to get the results of the playbook",
"label_text": "[DRY RUN] Provisioning LLDP interface, please refresh to get the results of the playbook.",
}
......@@ -138,7 +138,7 @@ def provision_ip_trunk_lldp_iface_real(subscription: Iptrunk, process_id: UUIDst
return {
"subscription": subscription,
"label_text": "Provision of the LLDP interface [REAL]" "Please refresh to get the results of the playbook",
"label_text": "Provisioning LLDP interface, please refresh to get the results of the playbook.",
}
......@@ -153,18 +153,10 @@ def modify_generic() -> StepList:
>> store_process_subscription(Target.MODIFY)
>> unsync
>> modify_iptrunk_subscription
>> provision_ip_trunk_iface_dry
>> await_pp_results
>> confirm_pp_results
>> provision_ip_trunk_iface_real
>> await_pp_results
>> confirm_pp_results
>> provision_ip_trunk_lldp_iface_dry
>> await_pp_results
>> confirm_pp_results
>> provision_ip_trunk_lldp_iface_real
>> await_pp_results
>> confirm_pp_results
>> pp_interaction(provision_ip_trunk_iface_dry, 3)
>> pp_interaction(provision_ip_trunk_iface_real, 3)
>> pp_interaction(provision_ip_trunk_lldp_iface_dry, 3)
>> pp_interaction(provision_ip_trunk_lldp_iface_real, 3)
>> resync
>> done
)
......@@ -7,7 +7,7 @@ from orchestrator.workflows.utils import wrap_modify_initial_input_form
from gso.products.product_types.iptrunk import Iptrunk
from gso.services import provisioning_proxy
from gso.services.provisioning_proxy import await_pp_results, confirm_pp_results
from gso.services.provisioning_proxy import pp_interaction
def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
......@@ -34,13 +34,8 @@ def provision_ip_trunk_isis_iface_dry(subscription: Iptrunk, process_id: UUIDstr
return {
"subscription": subscription,
"label_text": (
"This is a dry run for the deployment of a new IP "
"trunk ISIS interface. "
"Deployment is being taken care of by the "
"provisioning proxy, please wait for the results to "
"come back before continuing."
),
"label_text": "This is a dry run for the deployment of a new IP trunk ISIS interface. Deployment is being taken"
" care of by the provisioning proxy, please wait for the results to come back before continuing.",
}
......@@ -50,13 +45,8 @@ def provision_ip_trunk_isis_iface_real(subscription: Iptrunk, process_id: UUIDst
return {
"subscription": subscription,
"label_text": (
"This is a live deployment of a new IP trunk "
"ISIS interface. "
"Deployment is being taken care of by the "
"provisioning proxy, please wait for the results to "
"come back before continuing."
),
"label_text": "This is a live deployment of a new IP trunk ISIS interface. Deployment is being taken care of by"
" the provisioning proxy, please wait for the results to come back before continuing.",
}
......@@ -71,12 +61,8 @@ def modify_isis_metric() -> StepList:
>> store_process_subscription(Target.MODIFY)
>> unsync
>> modify_iptrunk_subscription
>> provision_ip_trunk_isis_iface_dry
>> await_pp_results
>> confirm_pp_results
>> provision_ip_trunk_isis_iface_real
>> await_pp_results
>> confirm_pp_results
>> pp_interaction(provision_ip_trunk_isis_iface_dry, 3)
>> pp_interaction(provision_ip_trunk_isis_iface_real, 3)
>> resync
>> done
)
......@@ -12,7 +12,7 @@ from orchestrator.workflows.utils import wrap_modify_initial_input_form
from gso.products.product_types.iptrunk import Iptrunk
from gso.services import ipam, provisioning_proxy
from gso.services.ipam import V4ServiceNetwork, V6ServiceNetwork
from gso.services.provisioning_proxy import await_pp_results, confirm_pp_results
from gso.services.provisioning_proxy import pp_interaction
def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
......@@ -49,7 +49,7 @@ def deprovision_ip_trunk_dry(subscription: Iptrunk, process_id: UUIDstr) -> Stat
return {
"subscription": subscription,
"label_text": "This is a dry run for the termination of an IP " "trunk. " "Press refresh to get the results",
"label_text": "[DRY RUN] Terminating IP trunk, please refresh to get the results of the playbook.",
}
......@@ -59,7 +59,7 @@ def deprovision_ip_trunk_real(subscription: Iptrunk, process_id: UUIDstr) -> Sta
return {
"subscription": subscription,
"label_text": "This is a termination of an IP trunk. " "Press refresh to get the results",
"label_text": "Terminating IP trunk, please refresh to get the results of the playbook.",
}
......@@ -92,15 +92,8 @@ def terminate_iptrunk() -> StepList:
>> store_process_subscription(Target.TERMINATE)
>> unsync
>> modify_iptrunk_subscription
>> drain_traffic_from_ip_trunk
>> await_pp_results
>> confirm_pp_results
>> deprovision_ip_trunk_dry
>> await_pp_results
>> confirm_pp_results
>> deprovision_ip_trunk_real
>> await_pp_results
>> confirm_pp_results
>> pp_interaction(drain_traffic_from_ip_trunk, 3)
>> pp_interaction(deprovision_ip_trunk_dry, 3)
>> deprovision_ip_trunk_ipv4
>> deprovision_ip_trunk_ipv6
>> set_status(SubscriptionLifecycle.TERMINATED)
......
......@@ -6,10 +6,10 @@ setup(
author="GÉANT",
author_email="swd@geant.org",
description="GÉANT Service Orchestrator",
url="https://gitlab.geant.org/goat/geant-service-orchestrator",
url="https://gitlab.software.geant.org/goat/gap/geant-service-orchestrator",
packages=find_packages(),
install_requires=[
"orchestrator-core==1.0.0",
"orchestrator-core==1.2.2",
"pydantic",
"requests",
],
......
#!/bin/bash
docker run -it --rm -v $(pwd)/:/gso sphinxdoc/sphinx:latest /bin/bash -c \
"pip install sphinx-autodoc2 sphinx_rtd_theme myst-parser;cd /gso/docs/source;make html"
if [ ! -d ./docs/vale/styles/proselint ] || [ ! -d ./docs/vale/styles/Microsoft ]; then
docker run -it --rm -v $(pwd)/docs:/docs jdkato/vale:latest --config="/docs/vale/.vale.ini" sync
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='!*/_?ipam.py|!*/apidocs/*|!*/migrations/*' \
docker run -it --rm -v $(pwd):/gso jdkato/vale:latest --glob='!*/migrations/*' \
--config="/gso/docs/vale/.vale.ini" /gso/docs/source /gso/gso
......@@ -14,13 +14,15 @@ def _random_string(n=None, letters=string.ascii_letters + string.digits + string
def test_new_router():
router_name = _random_string(10)
assert router_name not in resource_manager._DUMMY_INVENTORY
resource_manager.import_new_router(new_router_fqdn=router_name)
resource_manager.import_new_router(new_router_fqdn=router_name, subscription_id=_random_string(10))
assert router_name in resource_manager._DUMMY_INVENTORY
def test_new_lag():
router_name = list(resource_manager._DUMMY_INVENTORY.keys())[0]
new_lags = {resource_manager.next_lag(router_fqdn=router_name) for _ in range(10)}
new_lags = {
resource_manager.next_lag(router_fqdn=router_name, subscription_id=_random_string(10)) for _ in range(10)
}
assert len(new_lags) == 10
assert new_lags <= set(resource_manager._DUMMY_INVENTORY[router_name]["lags"])
......@@ -35,7 +37,9 @@ def test_physical_allocation_lifecycle_happy():
interface_name = initial_available[0]
resource_manager.reserve_physical_interface(router_fqdn=router_name, interface_name=interface_name)
resource_manager.reserve_physical_interface(
router_fqdn=router_name, subscription_id=_random_string(10), interface_name=interface_name
)
current_available = _interfaces()
assert interface_name not in current_available
......
[flake8]
ignore = D100,D101,D102,D103,D104,D105,D106,D107,D202,E501,RST301,RST304,W503,E203,C417,T202,S101
; extend-ignore = E203
; Allow >> on newline (W503), and allow cls as first argument for pydantic validators (B902)
ignore = B902,W503
exclude = .git,.*_cache,.eggs,*.egg-info,__pycache__,venv,.tox,gso/migrations,docs
enable-extensions = G
select = B,C,D,E,F,G,I,N,S,T,W,B902,B903,R
max-line-length = 120
ban-relative-imports = true
per-file-ignores =
# Allow first argument to be cls instead of self for pydantic validators
gso/*: B902
[testenv]
deps =
......