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
Select Git revision
  • 1048-service-config-backfilling
  • NAT-1154-import-edge-port-update
  • develop
  • feature/10GGBS-NAT-980
  • feature/NAT-1150-model-commecial-peers
  • feature/NAT-1182-rename-geant-plus-descriptions
  • feature/NAT-732-ias-to-re-interconnect
  • feature/add-moodi-wf-to-router
  • feature/nat-1211-edgeport-lacp-xmit
  • feature/rename-geant-plus-descriptions
  • fix/NAT-1009/fix-redeploy-base-config-if-there-is-a-vprn
  • fix/l3-imports
  • fix/nat-1120-sdp-validation
  • master
  • update_change_log
  • 0.1
  • 0.2
  • 0.3
  • 0.4
  • 0.5
  • 0.6
  • 0.7
  • 0.8
  • 0.9
  • 1.0
  • 1.1
  • 1.4
  • 1.5
  • 2.0
  • 2.1
  • 2.10
  • 2.11
  • 2.12
  • 2.13
  • 2.14
  • 2.15
  • 2.16
  • 2.17
  • 2.18
  • 2.19
  • 2.2
  • 2.20
  • 2.21
  • 2.22
  • 2.23
  • 2.24
  • 2.25
  • 2.26
  • 2.27
  • 2.28
  • 2.29
  • 2.3
  • 2.31
  • 2.32
  • 2.33
  • 2.34
  • 2.35
  • 2.36
  • 2.37
  • 2.38
  • 2.39
  • 2.4
  • 2.40
  • 2.41
  • 2.42
  • 2.43
  • 2.44
  • 2.45
  • 2.46
  • 2.47
  • 2.48
  • 2.5
  • 2.6
  • 2.7
  • 2.8
  • 2.9
  • 3.0
  • 3.1
  • 3.2
  • 3.3
  • 3.4
  • 3.5
  • 3.6
  • 3.7
  • 3.8
  • 3.9
  • Lime-Seal
87 results

Target

Select target project
  • goat/gap/geant-service-orchestrator
1 result
Select Git revision
Show changes
Commits on Source (9)
Showing
with 135 additions and 94 deletions
__pycache__/
*.egg-info
.coverage
.coverage*
coverage.xml
.vscode
venv
......
......@@ -23,7 +23,7 @@ run-tox-pipeline:
POSTGRES_DB: gso-test-db
POSTGRES_USER: nwa
POSTGRES_PASSWORD: nwa
DATABASE_URI_TEST: 'postgresql://nwa:nwa@postgres:5432/gso-test-db'
DATABASE_HOST: "postgres"
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
......@@ -36,9 +36,9 @@ run-tox-pipeline:
- pip install virtualenv
- virtualenv venv
- . venv/bin/activate
- pip install tox
script:
- pip install tox
- tox
artifacts:
......
......@@ -123,5 +123,8 @@
},
"SENTRY": {
"DSN": "https://sentry-dsn-url"
},
"MOODI": {
"host": "moodi.test.gap.geant.org"
}
}
......@@ -5,7 +5,7 @@ from uuid import UUID
import pydantic
import pynetbox
from pydantic_forms.types import UUIDstr
from orchestrator.types import UUIDstr
from pynetbox.models.dcim import Devices, DeviceTypes, Interfaces
from gso.products.product_types.router import Router
......
......@@ -18,8 +18,7 @@ from orchestrator.db import (
)
from orchestrator.domain import SubscriptionModel
from orchestrator.services.subscriptions import query_in_use_by_subscriptions
from orchestrator.types import SubscriptionLifecycle
from pydantic_forms.types import UUIDstr
from orchestrator.types import SubscriptionLifecycle, UUIDstr
from gso.products import ProductName, ProductType
from gso.products.product_types.site import Site
......
......@@ -11,8 +11,9 @@ import os
from pathlib import Path
from typing import Annotated
from orchestrator.types import UUIDstr
from pydantic import EmailStr, Field
from pydantic_forms.types import UUIDstr, strEnum
from pydantic_forms.types import strEnum
from pydantic_settings import BaseSettings
from typing_extensions import Doc
......@@ -210,6 +211,12 @@ class SentryParams(BaseSettings):
DSN: str
class MoodiParams(BaseSettings):
"""Settings for Moodi."""
host: str
class OSSParams(BaseSettings):
"""The set of parameters required for running :term:`GSO`."""
......@@ -224,6 +231,7 @@ class OSSParams(BaseSettings):
SHAREPOINT: SharepointParams
KENTIK: KentikParams
SENTRY: SentryParams | None = None
MOODI: MoodiParams
def load_oss_params() -> OSSParams:
......
......@@ -2,8 +2,8 @@
from typing import Annotated, TypeVar
from orchestrator.types import UUIDstr
from pydantic import AfterValidator
from pydantic_forms.types import UUIDstr
from gso.products.product_types.router import Router
from gso.services.netbox_client import NetboxClient
......
......@@ -35,7 +35,7 @@ def _deploy_base_config(
}
return {
"playbook_name": "base_config.yaml",
"playbook_name": "gap_ansible/playbooks/base_config.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -67,7 +67,7 @@ def _update_sdp_mesh(
}
return {
"playbook_name": "update_pe_sdp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_pe_sdp_mesh.yaml",
"inventory": inventory,
"extra_vars": extra_vars,
}
......@@ -88,7 +88,6 @@ def _update_sdp_single_pe(
"verb": "update_sdp_mesh",
"pe_router_list": generate_inventory_for_active_routers(
router_role=RouterRole.PE,
router_vendor=Vendor.NOKIA,
exclude_routers=[subscription["router"]["router_fqdn"]],
)["all"]["hosts"],
}
......@@ -101,7 +100,7 @@ def _update_sdp_single_pe(
}
return {
"playbook_name": "update_pe_sdp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_pe_sdp_mesh.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -133,7 +132,7 @@ def _add_pe_mesh_to_pe(
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -158,7 +157,7 @@ def _add_pe_to_pe_mesh(
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": inventory,
"extra_vars": extra_vars,
}
......@@ -189,7 +188,7 @@ def _add_all_p_to_pe(
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -214,7 +213,7 @@ def _add_pe_to_all_p(
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": inventory,
"extra_vars": extra_vars,
}
......@@ -321,7 +320,7 @@ def set_isis_to_max(subscription: Iptrunk, process_id: UUIDstr, tt_number: str)
return {
"subscription": subscription,
"playbook_name": "iptrunks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -339,8 +338,8 @@ def set_isis_to_max(subscription: Iptrunk, process_id: UUIDstr, tt_number: str)
def run_checks_after_base_config(subscription: dict[str, Any]) -> LSOState:
"""Workflow step for running show commands after installing base config."""
return {
"playbook_name": "base_config_checks.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]}}},
"playbook_name": "gap_ansible/playbooks/base_config_checks.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": {"wfo_router_json": subscription},
}
......@@ -355,7 +354,7 @@ def check_pe_ibgp(subscription: dict[str, Any]) -> LSOState:
}
return {
"playbook_name": "check_ibgp.yaml",
"playbook_name": "gap_ansible/playbooks/check_ibgp.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -371,7 +370,7 @@ def check_l3_services(subscription: dict[str, Any]) -> LSOState:
}
return {
"playbook_name": "check_l3_services.yaml",
"playbook_name": "gap_ansible/playbooks/check_l3_services.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -390,3 +389,27 @@ def prompt_sharepoint_checklist_url(checklist_url: str) -> FormGenerator:
yield SharepointPrompt
return {}
@step("Start Moodi")
def start_moodi(subscription: dict[str, Any]) -> LSOState:
"""Start monitoring on demand using Moodi Telemetry stack."""
params = load_oss_params()
return {
"playbook_name": "moodi_telemetry/playbooks/start_moodi.yaml",
"inventory": {"all": {"hosts": {params.MOODI.host: None}}},
"extra_vars": {"subscription": subscription},
}
@step("Stop Moodi")
def stop_moodi() -> LSOState:
"""Stop monitoring on demand."""
params = load_oss_params()
return {
"playbook_name": "moodi_telemetry/playbooks/stop_moodi.yaml",
"inventory": {"all": {"hosts": {params.MOODI.host: None}}},
"extra_vars": None,
}
......@@ -337,7 +337,7 @@ def provision_ip_trunk_iface_dry(subscription: IptrunkInactive, process_id: UUID
}
return {
"playbook_name": "iptrunks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -363,7 +363,7 @@ def provision_ip_trunk_iface_real(subscription: IptrunkInactive, process_id: UUI
}
return {
"playbook_name": "iptrunks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -382,7 +382,7 @@ def check_ip_trunk_connectivity(subscription: IptrunkInactive) -> LSOState:
extra_vars = {"wfo_ip_trunk_json": json.loads(json_dumps(subscription)), "check": "ping"}
return {
"playbook_name": "iptrunks_checks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_checks.yaml",
"inventory": {"all": {"hosts": {subscription.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_fqdn: None}}},
"extra_vars": extra_vars,
}
......@@ -401,7 +401,7 @@ def provision_ip_trunk_isis_iface_dry(subscription: IptrunkInactive, process_id:
}
return {
"playbook_name": "iptrunks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -427,7 +427,7 @@ def provision_ip_trunk_isis_iface_real(subscription: IptrunkInactive, process_id
}
return {
"playbook_name": "iptrunks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -446,7 +446,7 @@ def check_ip_trunk_isis(subscription: IptrunkInactive) -> LSOState:
extra_vars = {"wfo_ip_trunk_json": json.loads(json_dumps(subscription)), "check": "isis"}
return {
"playbook_name": "iptrunks_checks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_checks.yaml",
"inventory": {"all": {"hosts": {subscription.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_fqdn: None}}},
"extra_vars": extra_vars,
}
......
......@@ -44,7 +44,7 @@ def deploy_twamp_dry(subscription: Iptrunk, process_id: UUIDstr, tt_number: str)
}
return {
"playbook_name": "deploy_twamp.yaml",
"playbook_name": "gap_ansible/playbooks/deploy_twamp.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -69,7 +69,7 @@ def deploy_twamp_real(subscription: Iptrunk, process_id: UUIDstr, tt_number: str
}
return {
"playbook_name": "deploy_twamp.yaml",
"playbook_name": "gap_ansible/playbooks/deploy_twamp.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -91,7 +91,7 @@ def check_twamp_status(subscription: Iptrunk) -> LSOState:
}
return {
"playbook_name": "deploy_twamp.yaml",
"playbook_name": "gap_ansible/playbooks/deploy_twamp.yaml",
"inventory": {
"all": {
"hosts": {
......
......@@ -208,7 +208,7 @@ def check_ip_trunk_optical_levels_pre(subscription: Iptrunk) -> LSOState:
extra_vars = {"wfo_ip_trunk_json": json.loads(json_dumps(subscription)), "check": "optical_pre"}
return {
"playbook_name": "iptrunks_checks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_checks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -235,7 +235,7 @@ def check_ip_trunk_optical_levels_post(
}
return {
"playbook_name": "iptrunks_checks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_checks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -262,7 +262,7 @@ def check_ip_trunk_lldp(
}
return {
"playbook_name": "iptrunks_checks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_checks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -300,7 +300,7 @@ def disable_old_config_dry(
}
return {
"playbook_name": "iptrunks_migration.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_migration.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -339,7 +339,7 @@ def disable_old_config_real(
}
return {
"playbook_name": "iptrunks_migration.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_migration.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -378,7 +378,7 @@ def deploy_new_config_dry(
}
return {
"playbook_name": "iptrunks_migration.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_migration.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -417,7 +417,7 @@ def deploy_new_config_real(
}
return {
"playbook_name": "iptrunks_migration.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_migration.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -447,7 +447,7 @@ def update_remaining_side_bfd_dry(
}
return {
"playbook_name": "iptrunks_migration.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_migration.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -475,7 +475,7 @@ def update_remaining_side_bfd_real(
}
return {
"playbook_name": "iptrunks_migration.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_migration.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -497,7 +497,7 @@ def check_ip_trunk_bfd(subscription: Iptrunk, new_node: Router, replace_index: i
}
return {
"playbook_name": "iptrunks_checks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_checks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -529,7 +529,7 @@ def check_ip_trunk_connectivity(subscription: Iptrunk, replace_index: int) -> LS
extra_vars = {"wfo_ip_trunk_json": json.loads(json_dumps(subscription)), "check": "ping"}
return {
"playbook_name": "iptrunks_checks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_checks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -566,7 +566,7 @@ def deploy_new_isis(
}
return {
"playbook_name": "iptrunks_migration.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_migration.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -586,7 +586,7 @@ def check_ip_trunk_isis(subscription: Iptrunk, replace_index: int) -> LSOState:
extra_vars = {"wfo_ip_trunk_json": json.loads(json_dumps(subscription)), "check": "isis"}
return {
"playbook_name": "iptrunks_checks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_checks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -631,7 +631,7 @@ def restore_isis_metric(
}
return {
"playbook_name": "iptrunks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -669,7 +669,7 @@ def delete_old_config_dry(
}
return {
"playbook_name": "iptrunks_migration.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_migration.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -708,7 +708,7 @@ def delete_old_config_real(
}
return {
"playbook_name": "iptrunks_migration.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_migration.yaml",
"inventory": {
"all": {
"hosts": {
......
......@@ -49,7 +49,7 @@ def provision_ip_trunk_isis_iface_dry(subscription: Iptrunk, process_id: UUIDstr
}
return {
"playbook_name": "iptrunks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -75,7 +75,7 @@ def provision_ip_trunk_isis_iface_real(subscription: Iptrunk, process_id: UUIDst
}
return {
"playbook_name": "iptrunks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks.yaml",
"inventory": {
"all": {
"hosts": {
......
......@@ -191,7 +191,7 @@ def check_ip_trunk_connectivity(subscription: Iptrunk) -> LSOState:
extra_vars = {"wfo_ip_trunk_json": json.loads(json_dumps(subscription)), "check": "ping"}
return {
"playbook_name": "iptrunks_checks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_checks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -209,7 +209,7 @@ def check_ip_trunk_lldp(subscription: Iptrunk) -> LSOState:
extra_vars = {"wfo_ip_trunk_json": json.loads(json_dumps(subscription)), "check": "lldp"}
return {
"playbook_name": "iptrunks_checks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_checks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -321,7 +321,7 @@ def provision_ip_trunk_iface_dry(
}
return {
"playbook_name": "iptrunks.yaml",
"playbook_name": "gap_ansible/playbooks/gap_ansible/iptrunks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -350,7 +350,7 @@ def provision_ip_trunk_iface_real(
}
return {
"playbook_name": "iptrunks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -464,7 +464,7 @@ def check_ip_trunk_optical_levels_post(subscription: Iptrunk) -> LSOState:
extra_vars = {"wfo_ip_trunk_json": json.loads(json_dumps(subscription)), "check": "optical_post"}
return {
"playbook_name": "iptrunks_checks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks_checks.yaml",
"inventory": {
"all": {
"hosts": {
......
......@@ -63,7 +63,7 @@ def deprovision_ip_trunk_dry(subscription: Iptrunk, process_id: UUIDstr, tt_numb
}
return {
"playbook_name": "iptrunks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -89,7 +89,7 @@ def deprovision_ip_trunk_real(subscription: Iptrunk, process_id: UUIDstr, tt_num
}
return {
"playbook_name": "iptrunks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks.yaml",
"inventory": {
"all": {
"hosts": {
......
......@@ -23,7 +23,7 @@ def validate_router_config(subscription: Iptrunk) -> LSOState:
extra_vars = {"wfo_trunk_json": json.loads(json_dumps(subscription)), "verb": "validate"}
return {
"playbook_name": "base_config.yaml",
"playbook_name": "gap_ansible/playbooks/base_config.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -137,7 +137,7 @@ def verify_netbox_entries(subscription: Iptrunk) -> None:
def verify_iptrunk_config(subscription: Iptrunk) -> LSOState:
"""Check for configuration drift on the relevant routers."""
return {
"playbook_name": "iptrunks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -160,7 +160,7 @@ def verify_iptrunk_config(subscription: Iptrunk) -> LSOState:
def check_ip_trunk_isis(subscription: Iptrunk) -> LSOState:
"""Run an Ansible playbook to check for any :term:`ISIS` configuration drift."""
return {
"playbook_name": "iptrunks.yaml",
"playbook_name": "gap_ansible/playbooks/iptrunks.yaml",
"inventory": {
"all": {
"hosts": {
......@@ -183,7 +183,7 @@ def check_ip_trunk_isis(subscription: Iptrunk) -> LSOState:
def verify_twamp_config(subscription: Iptrunk) -> LSOState:
"""Check for configuration drift of TWAMP."""
return {
"playbook_name": "deploy_twamp.yaml",
"playbook_name": "gap_ansible/playbooks/deploy_twamp.yaml",
"inventory": {
"all": {
"hosts": {
......
......@@ -72,7 +72,7 @@ def set_isis_overload(subscription: dict[str, Any], tt_number: str, process_id:
}
return {
"playbook_name": "promote_p_to_pe.yaml",
"playbook_name": "gap_ansible/playbooks/promote_p_to_pe.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -91,7 +91,7 @@ def deploy_pe_base_config_dry(subscription: dict[str, Any], tt_number: str, proc
}
return {
"playbook_name": "promote_p_to_pe.yaml",
"playbook_name": "gap_ansible/playbooks/promote_p_to_pe.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -110,7 +110,7 @@ def deploy_pe_base_config_real(subscription: dict[str, Any], tt_number: str, pro
}
return {
"playbook_name": "promote_p_to_pe.yaml",
"playbook_name": "gap_ansible/playbooks/promote_p_to_pe.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -176,7 +176,7 @@ def remove_p_from_pe_dry(subscription: dict[str, Any], tt_number: str, process_i
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": generate_inventory_for_active_routers(RouterRole.PE),
"extra_vars": extra_vars,
}
......@@ -194,7 +194,7 @@ def remove_p_from_pe_real(subscription: dict[str, Any], tt_number: str, process_
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": generate_inventory_for_active_routers(RouterRole.PE),
"extra_vars": extra_vars,
}
......@@ -211,7 +211,7 @@ def deploy_routing_instances_dry(subscription: dict[str, Any], tt_number: str, p
}
return {
"playbook_name": "promote_p_to_pe.yaml",
"playbook_name": "gap_ansible/playbooks/promote_p_to_pe.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -228,7 +228,7 @@ def deploy_routing_instances_real(subscription: dict[str, Any], tt_number: str,
}
return {
"playbook_name": "promote_p_to_pe.yaml",
"playbook_name": "gap_ansible/playbooks/promote_p_to_pe.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -245,7 +245,7 @@ def remove_isis_overload(subscription: dict[str, Any], tt_number: str, process_i
}
return {
"playbook_name": "promote_p_to_pe.yaml",
"playbook_name": "gap_ansible/playbooks/promote_p_to_pe.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -271,7 +271,7 @@ def delete_default_routes_dry(subscription: dict[str, Any], tt_number: str, proc
}
return {
"playbook_name": "promote_p_to_pe.yaml",
"playbook_name": "gap_ansible/playbooks/promote_p_to_pe.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -289,7 +289,7 @@ def delete_default_routes_real(subscription: dict[str, Any], tt_number: str, pro
}
return {
"playbook_name": "promote_p_to_pe.yaml",
"playbook_name": "gap_ansible/playbooks/promote_p_to_pe.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......
......@@ -3,12 +3,11 @@
import ipaddress
import json
import logging
from typing import Any
from orchestrator.forms import FormPage
from orchestrator.forms.validators import Label
from orchestrator.targets import Target
from orchestrator.types import FormGenerator, SubscriptionLifecycle, UUIDstr
from orchestrator.types import FormGenerator, State, SubscriptionLifecycle, UUIDstr
from orchestrator.utils.errors import ProcessFailureError
from orchestrator.utils.json import json_dumps
from orchestrator.workflow import StepList, begin, conditional, done, step, workflow
......@@ -19,6 +18,7 @@ from orchestrator.workflows.steps import (
unsync,
)
from orchestrator.workflows.utils import wrap_modify_initial_input_form
from requests import HTTPError
from gso.products.product_blocks.router import RouterRole
from gso.products.product_types.router import Router
......@@ -80,7 +80,7 @@ def remove_config_from_router_dry(subscription: Router, process_id: UUIDstr, tt_
}
return {
"playbook_name": "base_config.yaml",
"playbook_name": "gap_ansible/playbooks/base_config.yaml",
"inventory": {"all": {"hosts": {subscription.router.router_fqdn: None}}},
"extra_vars": extra_vars,
}
......@@ -98,7 +98,7 @@ def remove_config_from_router_real(subscription: Router, process_id: UUIDstr, tt
}
return {
"playbook_name": "base_config.yaml",
"playbook_name": "gap_ansible/playbooks/base_config.yaml",
"inventory": {"all": {"hosts": {subscription.router.router_fqdn: None}}},
"extra_vars": extra_vars,
}
......@@ -123,7 +123,7 @@ def remove_p_from_all_pe_dry(subscription: Router, tt_number: str, process_id: U
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": generate_inventory_for_active_routers(RouterRole.PE),
"extra_vars": extra_vars,
}
......@@ -141,7 +141,7 @@ def remove_p_from_all_pe_real(subscription: Router, tt_number: str, process_id:
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": generate_inventory_for_active_routers(RouterRole.PE),
"extra_vars": extra_vars,
}
......@@ -159,7 +159,7 @@ def remove_pe_from_all_pe_dry(subscription: Router, tt_number: str, process_id:
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": generate_inventory_for_active_routers(
RouterRole.PE, exclude_routers=[subscription.router.router_fqdn]
),
......@@ -179,7 +179,7 @@ def remove_pe_from_all_pe_real(subscription: Router, tt_number: str, process_id:
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": generate_inventory_for_active_routers(
RouterRole.PE, exclude_routers=[subscription.router.router_fqdn]
),
......@@ -199,7 +199,7 @@ def remove_pe_from_all_p_dry(subscription: Router, tt_number: str, process_id: U
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": generate_inventory_for_active_routers(RouterRole.P),
"extra_vars": extra_vars,
}
......@@ -217,20 +217,30 @@ def remove_pe_from_all_p_real(subscription: Router, tt_number: str, process_id:
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": generate_inventory_for_active_routers(RouterRole.P),
"extra_vars": extra_vars,
}
@step("Remove Device from Librenms")
def remove_device_from_librenms(subscription: Router) -> None:
def remove_device_from_librenms(subscription: Router) -> State:
"""Remove the device from LibreNMS."""
LibreNMSClient().remove_device(subscription.router.router_fqdn)
try:
LibreNMSClient().remove_device(subscription.router.router_fqdn)
except HTTPError as e:
response = e.response.json()
if response["message"] == f"Device {subscription.router.router_fqdn} not found":
return {
"librenms_error": str(e.response.json()),
"librenms_device": "Device not found, please confirm nothing needs to be removed from LibreNMS",
}
raise ProcessFailureError(message="LibreNMS error", details=response) from None
return {"librenms_device": "Device removed from LibreNMS"}
@step("Apply the archiving license in Kentik")
def kentik_apply_archive_license(subscription: Router) -> dict[str, dict[str, Any]]:
def kentik_apply_archive_license(subscription: Router) -> State:
"""Apply the archiving license to a PE router in Kentik.
This includes setting the flow rate to one flow per second.
......@@ -239,8 +249,7 @@ def kentik_apply_archive_license(subscription: Router) -> dict[str, dict[str, An
kentik_archive_plan_id = kentik_client.get_plan_by_name(load_oss_params().KENTIK.archive_license_key)["id"]
kentik_device = kentik_client.get_device_by_name(subscription.router.router_fqdn)
if "id" not in kentik_device:
msg = "Failed to find Kentik device by name"
raise ProcessFailureError(msg, details=kentik_device)
return {"kentik_device": "Device not found, no license applied"}
updated_device = {"device": {"plan_id": kentik_archive_plan_id, "device_sample_rate": 1}}
kentik_device = kentik_client.update_device(kentik_device["id"], updated_device)
......
......@@ -78,7 +78,7 @@ def add_p_to_mesh_dry(subscription: dict[str, Any], tt_number: str, process_id:
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": generate_inventory_for_active_routers(RouterRole.PE),
"extra_vars": extra_vars,
}
......@@ -95,7 +95,7 @@ def add_p_to_mesh_real(subscription: dict[str, Any], tt_number: str, process_id:
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": generate_inventory_for_active_routers(RouterRole.PE),
"extra_vars": extra_vars,
}
......@@ -112,7 +112,7 @@ def add_all_pe_to_p_dry(subscription: dict[str, Any]) -> LSOState:
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -130,7 +130,7 @@ def add_all_pe_to_p_real(subscription: dict[str, Any], tt_number: str, process_i
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -140,7 +140,7 @@ def add_all_pe_to_p_real(subscription: dict[str, Any], tt_number: str, process_i
def check_ibgp_session(subscription: Router) -> LSOState:
"""Run a playbook using the provisioning proxy, to check the health of the new iBGP session."""
return {
"playbook_name": "check_ibgp.yaml",
"playbook_name": "gap_ansible/playbooks/check_ibgp.yaml",
"inventory": {"all": {"hosts": {subscription.router.router_fqdn: None}}},
"extra_vars": {},
}
......
......@@ -3,11 +3,11 @@
from typing import Any
from orchestrator.targets import Target
from orchestrator.types import State, UUIDstr
from orchestrator.utils.errors import ProcessFailureError
from orchestrator.workflow import StepList, begin, conditional, done, step, workflow
from orchestrator.workflows.steps import resync, store_process_subscription, unsync
from orchestrator.workflows.utils import wrap_modify_initial_input_form
from pydantic_forms.types import State, UUIDstr
from gso.products.product_blocks.router import RouterRole
from gso.products.product_types.router import Router
......@@ -64,7 +64,7 @@ def verify_p_ibgp(subscription: dict[str, Any]) -> LSOState:
}
return {
"playbook_name": "update_ibgp_mesh.yaml",
"playbook_name": "gap_ansible/playbooks/update_ibgp_mesh.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
......@@ -100,7 +100,7 @@ def check_kentik_entry_exists(subscription: Router) -> None:
def verify_base_config(subscription: dict[str, Any]) -> LSOState:
"""Workflow step for running a playbook that checks whether base config has drifted."""
return {
"playbook_name": "base_config.yaml",
"playbook_name": "gap_ansible/playbooks/base_config.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": {
"wfo_router_json": subscription,
......
......@@ -4,10 +4,9 @@ from enum import Enum
from orchestrator.forms import FormPage
from orchestrator.targets import Target
from orchestrator.types import FormGenerator, State
from orchestrator.types import FormGenerator, State, UUIDstr
from orchestrator.workflow import StepList, begin, done, step, workflow
from pydantic import ConfigDict, EmailStr, field_validator
from pydantic_forms.types import UUIDstr
from pydantic_forms.validators import Choice
from gso.services.partners import delete_partner, get_all_partners, get_partner_by_name
......