From 96171bb2fa12345bb5b0ee7aef904af183a42ce3 Mon Sep 17 00:00:00 2001 From: Karel van Klink <karel.vanklink@geant.org> Date: Fri, 29 Nov 2024 14:13:14 +0100 Subject: [PATCH] Remove Sphinx term statements These are not needed anymore, as MkDocs will pick up on them automatically --- docs/scripts/gen_ref_pages.py | 1 + docs/scripts/gen_wf_redirects.py | 20 +++++++++---------- gso/__init__.py | 8 ++++---- gso/api/__init__.py | 2 +- gso/api/v1/__init__.py | 2 +- gso/api/v1/subscriptions.py | 2 +- gso/cli/__init__.py | 2 +- gso/cli/imports.py | 14 ++++++------- gso/cli/netbox.py | 2 +- gso/main.py | 2 +- gso/products/__init__.py | 6 +++--- gso/products/product_blocks/iptrunk.py | 2 +- gso/products/product_blocks/pop_vlan.py | 6 +++--- gso/products/product_blocks/router.py | 4 ++-- gso/products/product_blocks/site.py | 8 ++++---- gso/schedules/__init__.py | 2 +- gso/schedules/scheduling.py | 2 +- gso/schedules/validate_products.py | 2 +- gso/services/infoblox.py | 10 +++++----- gso/services/netbox_client.py | 14 ++++++------- gso/services/subscriptions.py | 4 ++-- gso/settings.py | 16 +++++++-------- gso/utils/exceptions.py | 2 +- gso/utils/helpers.py | 16 +++++++-------- gso/utils/workflow_steps.py | 6 +++--- gso/worker.py | 4 ++-- gso/workflows/__init__.py | 2 +- gso/workflows/iptrunk/create_iptrunk.py | 2 +- gso/workflows/iptrunk/deploy_twamp.py | 6 +++--- gso/workflows/iptrunk/migrate_iptrunk.py | 2 +- gso/workflows/iptrunk/modify_isis_metric.py | 16 +++++++-------- .../iptrunk/modify_trunk_interface.py | 4 ++-- gso/workflows/iptrunk/terminate_iptrunk.py | 10 +++++----- gso/workflows/router/create_router.py | 2 +- gso/workflows/router/terminate_router.py | 8 ++++---- 35 files changed, 106 insertions(+), 105 deletions(-) diff --git a/docs/scripts/gen_ref_pages.py b/docs/scripts/gen_ref_pages.py index 9d0cd44d..11e0e2fe 100644 --- a/docs/scripts/gen_ref_pages.py +++ b/docs/scripts/gen_ref_pages.py @@ -1,3 +1,4 @@ +# noqa: INP001 """Generate the code reference pages. Source: https://mkdocstrings.github.io/recipes/ diff --git a/docs/scripts/gen_wf_redirects.py b/docs/scripts/gen_wf_redirects.py index f9a03e60..ddd49909 100644 --- a/docs/scripts/gen_wf_redirects.py +++ b/docs/scripts/gen_wf_redirects.py @@ -1,3 +1,4 @@ +# noqa: INP001 """Generate pages to forward workflow URLs. This will redirect `/workflow/workflow_name` to `reference/gso/workflow/module/workflow_name`. This is required since @@ -21,18 +22,17 @@ for path in sorted(src.rglob("*.py")): elif parts[-1] == "__main__": continue - if len(parts) == 4 and "workflows" in parts: + if len(parts) == 4 and "workflows" in parts: # noqa: PLR2004 redirect_map["workflow/" + parts[3] + "/index.md"] = "https://docs.gap.geant.org/reference/" + "/".join(parts) -with open(root / "wf_redirects.yaml", 'w') as redirect_file: +with Path.open(root / "wf_redirects.yaml", "w") as redirect_file: file_content = { - "plugins": - [ - "search", - {"gen-files": {"scripts": ["scripts/gen_ref_pages.py"]}}, - {"redirects": {"redirect_maps": redirect_map}}, - {"literate-nav": {"nav_file": "SUMMARY.md"}}, - "mkdocstrings", - ] + "plugins": [ + "search", + {"gen-files": {"scripts": ["scripts/gen_ref_pages.py"]}}, + {"redirects": {"redirect_maps": redirect_map}}, + {"literate-nav": {"nav_file": "SUMMARY.md"}}, + "mkdocstrings", + ] } yaml.dump(file_content, redirect_file) diff --git a/gso/__init__.py b/gso/__init__.py index 478efc94..ccbb2d0d 100644 --- a/gso/__init__.py +++ b/gso/__init__.py @@ -1,4 +1,4 @@ -"""The main entrypoint for :term:`GSO`, and the different ways in which it can be run.""" +"""The main entrypoint for GSO, and the different ways in which it can be run.""" import os @@ -24,13 +24,13 @@ SCALAR_OVERRIDES.update(GSO_SCALAR_OVERRIDES) def gso_initialise_celery(celery: Celery) -> None: - """Initialise the :term:`Celery` app.""" + """Initialise the Celery app.""" initialise_celery(celery) celery.conf.task_routes = {} def init_gso_app() -> OrchestratorCore: - """Initialise the :term:`GSO` app.""" + """Initialise the GSO app.""" app = OrchestratorCore(base_settings=app_settings) app.register_authentication(oidc_instance) app.register_authorization(opa_instance) @@ -55,7 +55,7 @@ def init_gso_app() -> OrchestratorCore: def init_cli_app() -> typer.Typer: - """Initialise :term:`GSO` as a CLI application.""" + """Initialise GSO as a CLI application.""" from gso.cli import imports, netbox # noqa: PLC0415 cli_app.add_typer(imports.app, name="import-cli") diff --git a/gso/api/__init__.py b/gso/api/__init__.py index d6167385..6a3c99b7 100644 --- a/gso/api/__init__.py +++ b/gso/api/__init__.py @@ -1,4 +1,4 @@ -"""Initialisation class for the :term:`GSO` :term:`API`.""" +"""Initialisation class for the GSO API.""" from fastapi import APIRouter diff --git a/gso/api/v1/__init__.py b/gso/api/v1/__init__.py index 4694b6c5..8772f54e 100644 --- a/gso/api/v1/__init__.py +++ b/gso/api/v1/__init__.py @@ -1,4 +1,4 @@ -"""Version 1 of the :term:`GSO` :term:`API`.""" +"""Version 1 of the GSO API.""" from fastapi import APIRouter diff --git a/gso/api/v1/subscriptions.py b/gso/api/v1/subscriptions.py index bf4e96bf..ba762cab 100644 --- a/gso/api/v1/subscriptions.py +++ b/gso/api/v1/subscriptions.py @@ -1,4 +1,4 @@ -""":term:`API` endpoint for fetching different types of subscriptions.""" +"""API endpoint for fetching different types of subscriptions.""" from typing import Any diff --git a/gso/cli/__init__.py b/gso/cli/__init__.py index b5071454..cb25f470 100644 --- a/gso/cli/__init__.py +++ b/gso/cli/__init__.py @@ -1 +1 @@ -"""The :term:`CLI` of :term:`GSO`.""" +"""The CLI of GSO.""" diff --git a/gso/cli/imports.py b/gso/cli/imports.py index bca9ccd4..c57d80bd 100644 --- a/gso/cli/imports.py +++ b/gso/cli/imports.py @@ -1,4 +1,4 @@ -""":term:`CLI` commands for importing data to coreDB.""" +"""CLI commands for importing data to coreDB.""" import csv import ipaddress @@ -153,7 +153,7 @@ class IptrunkImportModel(BaseModel): @field_validator("side_a_node_id", "side_b_node_id") def check_if_router_side_is_available(cls, value: str) -> str: - """Both sides of the trunk must exist in :term:`GSO`.""" + """Both sides of the trunk must exist in GSO.""" if value not in cls._get_active_routers(): msg = f"Router {value} not found" raise ValueError(msg) @@ -162,7 +162,7 @@ class IptrunkImportModel(BaseModel): @model_validator(mode="after") def check_members(self) -> Self: - """Amount of :term:`LAG` members has to match on side A and B, and meet the minimum requirement.""" + """Amount of LAG members has to match on side A and B, and meet the minimum requirement.""" len_a = len(self.side_a_ae_members) len_b = len(self.side_b_ae_members) @@ -218,7 +218,7 @@ class EdgePortImportModel(BaseModel): @field_validator("node") def validate_node(cls, value: str) -> str: - """Check if the node is an active PE router in :term:`GSO`.""" + """Check if the node is an active PE router in GSO.""" pe_routers = { str(router.subscription_id) for router in get_active_subscriptions_by_field_and_value("router_role", RouterRole.PE) @@ -231,7 +231,7 @@ class EdgePortImportModel(BaseModel): @model_validator(mode="after") def check_members(self) -> Self: - """Amount of :term:`LAG` members has to match and meet the minimum requirement.""" + """Amount of LAG members has to match and meet the minimum requirement.""" if len(self.ae_members) < self.minimum_links: msg = f"Number of members should be at least {self.minimum_links} (edge_port_minimum_links)" raise ValueError(msg) @@ -657,7 +657,7 @@ def import_partners(file_path: str = typer.Argument(..., help="Path to the CSV f @app.command() def import_l3_core_service(filepath: str = common_filepath_option) -> None: - """Import L3 Core Services into :term:`GSO`.""" + """Import L3 Core Services into GSO.""" successfully_imported_data = [] l3_core_service_list = _read_data(Path(filepath)) @@ -702,7 +702,7 @@ def import_l3_core_service(filepath: str = common_filepath_option) -> None: @app.command() def import_lan_switch_interconnect(filepath: str = common_filepath_option) -> None: - """Import :term:`LAN` Switch Interconnect services into :term:`GSO`.""" + """Import LAN Switch Interconnect services into GSO.""" _generic_import_product( Path(filepath), ProductType.IMPORTED_LAN_SWITCH_INTERCONNECT, diff --git a/gso/cli/netbox.py b/gso/cli/netbox.py index 8765f1a4..b4945583 100644 --- a/gso/cli/netbox.py +++ b/gso/cli/netbox.py @@ -1,4 +1,4 @@ -"""A :term:`CLI` for interacting with Netbox.""" +"""A CLI for interacting with Netbox.""" import typer from pynetbox import RequestError diff --git a/gso/main.py b/gso/main.py index 20098b12..d0fe8804 100755 --- a/gso/main.py +++ b/gso/main.py @@ -1,4 +1,4 @@ -"""The main module that runs :term:`GSO`.""" +"""The main module that runs GSO.""" from gso import init_cli_app, init_gso_app diff --git a/gso/products/__init__.py b/gso/products/__init__.py index c0e3d173..88552bc7 100644 --- a/gso/products/__init__.py +++ b/gso/products/__init__.py @@ -1,4 +1,4 @@ -"""Module that updates the domain model of :term:`GSO`. Should contain all types of subscriptions. +"""Module that updates the domain model of GSO. Should contain all types of subscriptions. .. warning:: Whenever a new product is added, this should be reflected in the `ProductType` enumerator. @@ -24,7 +24,7 @@ from gso.products.product_types.vrf import VRF class ProductName(strEnum): - """An enumerator of available product names in :term:`GSO`.""" + """An enumerator of available product names in GSO.""" IP_TRUNK = "IP trunk" ROUTER = "Router" @@ -63,7 +63,7 @@ class ProductName(strEnum): class ProductType(strEnum): - """An enumerator of available product types in :term:`GSO`.""" + """An enumerator of available product types in GSO.""" IP_TRUNK = Iptrunk.__name__ ROUTER = Router.__name__ diff --git a/gso/products/product_blocks/iptrunk.py b/gso/products/product_blocks/iptrunk.py index ad83609d..7978edd6 100644 --- a/gso/products/product_blocks/iptrunk.py +++ b/gso/products/product_blocks/iptrunk.py @@ -134,7 +134,7 @@ class IptrunkBlock(IptrunkBlockProvisioning, lifecycle=[SubscriptionLifecycle.AC iptrunk_speed: PhysicalPortCapacity #: The minimum amount of links the trunk should consist of. iptrunk_minimum_links: int - #: The :term:`ISIS` metric of this link + #: The ISIS metric of this link iptrunk_isis_metric: int #: The IPv4 network used for this trunk. iptrunk_ipv4_network: ipaddress.IPv4Network diff --git a/gso/products/product_blocks/pop_vlan.py b/gso/products/product_blocks/pop_vlan.py index 7e60aa2e..e90d6655 100644 --- a/gso/products/product_blocks/pop_vlan.py +++ b/gso/products/product_blocks/pop_vlan.py @@ -1,4 +1,4 @@ -"""Pop :term:`VLAN` product block that has all parameters of a subscription throughout its lifecycle.""" +"""PoP VLAN product block that has all parameters of a subscription throughout its lifecycle.""" from ipaddress import IPv4Network, IPv6Network from typing import Annotated, TypeVar @@ -32,7 +32,7 @@ PortList = Annotated[list[T], AfterValidator(validate_unique_list), Doc("A list class PopVlanPortBlockInactive( ProductBlockModel, lifecycle=[SubscriptionLifecycle.INITIAL], product_block_name="PopVlanPortBlock" ): - """An inactive Pop :term:`VLAN` port.""" + """An inactive Pop VLAN port.""" port_name: str | None = None port_description: str | None = None @@ -40,7 +40,7 @@ class PopVlanPortBlockInactive( class PopVlanPortBlockProvisioning(PopVlanPortBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING]): - """A Pop :term:`VLAN` port that is being provisioned.""" + """A Pop VLAN port that is being provisioned.""" port_name: str | None port_description: str | None diff --git a/gso/products/product_blocks/router.py b/gso/products/product_blocks/router.py index 6d7dabf9..7f64c3f5 100644 --- a/gso/products/product_blocks/router.py +++ b/gso/products/product_blocks/router.py @@ -55,7 +55,7 @@ class RouterBlockProvisioning(RouterBlockInactive, lifecycle=[SubscriptionLifecy class RouterBlock(RouterBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]): """A router that's currently deployed in the network.""" - #: :term:`FQDN` of a router. + #: FQDN of a router. router_fqdn: str #: The port of the terminal server that this router is connected to. Used to offer out of band access. router_ts_port: PortNumber @@ -65,7 +65,7 @@ class RouterBlock(RouterBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTI router_lo_ipv4_address: IPv4AddressType #: The IPv6 loopback address of the router. router_lo_ipv6_address: IPv6AddressType - #: The :term:`ISO` :term:`NET` of the router, used for :term:`ISIS` support. + #: The ISO NET of the router, used for ISIS support. router_lo_iso_address: str #: The role of the router, which can be any of the values defined in :class:`RouterRole`. router_role: RouterRole diff --git a/gso/products/product_blocks/site.py b/gso/products/product_blocks/site.py index eec86847..e4d7231e 100644 --- a/gso/products/product_blocks/site.py +++ b/gso/products/product_blocks/site.py @@ -58,23 +58,23 @@ class SiteBlockProvisioning(SiteBlockInactive, lifecycle=[SubscriptionLifecycle. class SiteBlock(SiteBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]): """A site that's currently available for routers and services to be hosted at.""" - #: The name of the site, that will dictate part of the :term:`FQDN` of routers that are hosted at this site. For + #: The name of the site, that will dictate part of the FQDN of routers that are hosted at this site. For #: example: ``router.X.Y.geant.net``, where X denotes the name of the site. site_name: SiteName #: The city at which the site is located. site_city: str #: The country in which the site is located. site_country: str - #: The code of the corresponding country. This is also used for the :term:`FQDN`, following the example given for + #: The code of the corresponding country. This is also used for the FQDN, following the example given for #: the site name, the country code would end up in the Y position. site_country_code: str - #: The latitude of the site, used for :term:`SNMP` purposes. + #: The latitude of the site, used for SNMP purposes. site_latitude: LatitudeCoordinate #: Similar to the latitude, the longitude of a site. site_longitude: LongitudeCoordinate #: The internal ID used within GÉANT to denote a site. site_internal_id: int - #: The :term:`BGP` community ID of a site, used to advertise routes learned at this site. + #: The BGP community ID of a site, used to advertise routes learned at this site. site_bgp_community_id: int #: The tier of a site, as described in :class:`SiteTier`. site_tier: SiteTier diff --git a/gso/schedules/__init__.py b/gso/schedules/__init__.py index 8257a874..d6d68797 100644 --- a/gso/schedules/__init__.py +++ b/gso/schedules/__init__.py @@ -1 +1 @@ -"""Tasks that are scheduled to run periodically in :term:`GSO`.""" +"""Tasks that are scheduled to run periodically in GSO.""" diff --git a/gso/schedules/scheduling.py b/gso/schedules/scheduling.py index b0e22a09..b688ecbe 100644 --- a/gso/schedules/scheduling.py +++ b/gso/schedules/scheduling.py @@ -1,4 +1,4 @@ -"""Definition of the decorator that schedules tasks in :term:`GSO` that are to run periodically.""" +"""Definition of the decorator that schedules tasks in GSO that are to run periodically.""" import inspect from collections.abc import Callable diff --git a/gso/schedules/validate_products.py b/gso/schedules/validate_products.py index 9d8e6f18..5722592b 100644 --- a/gso/schedules/validate_products.py +++ b/gso/schedules/validate_products.py @@ -1,4 +1,4 @@ -"""Scheduled task that validates all products and inactive subscriptions in :term:`GSO`.""" +"""Scheduled task that validates all products and inactive subscriptions in GSO.""" from orchestrator.services.processes import start_process diff --git a/gso/services/infoblox.py b/gso/services/infoblox.py index fc33f3b0..3139eab4 100644 --- a/gso/services/infoblox.py +++ b/gso/services/infoblox.py @@ -1,4 +1,4 @@ -"""The Infoblox service that allocates :term:`IPAM` resources used in :term:`GSO` products.""" +"""The Infoblox service that allocates IPAM resources used in GSO products.""" import ipaddress from logging import getLogger @@ -23,7 +23,7 @@ class AllocationError(Exception): def _setup_connection() -> tuple[connector.Connector, IPAMParams]: """Set up a new connection with an Infoblox instance. - :return: A tuple that has an Infoblox ``Connector`` instance, and :term:`IPAM` parameters. + :return: A tuple that has an Infoblox ``Connector`` instance, and IPAM parameters. :rtype: tuple[:class:`Connector`, IPAMParams] """ oss = load_oss_params().IPAM @@ -37,7 +37,7 @@ def _setup_connection() -> tuple[connector.Connector, IPAMParams]: return connector.Connector(options), oss -def _allocate_network( # noqa: PLR0917 +def _allocate_network( conn: connector.Connector, dns_view: str, network_view: str, @@ -55,7 +55,7 @@ def _allocate_network( # noqa: PLR0917 :param str network_view: The Infoblox ``network_view`` where the network should be allocated. :param int netmask: The netmask of the desired network. Can be up to 32 for v4 networks, and 128 for v6 networks. :param list [str] containers: A list of network containers in which the network should be allocated, given in - :term:`CIDR` notation. + CIDR notation. :param str comment: Optionally, a comment can be added to the network allocation. """ for container in [ipaddress.ip_network(con) for con in containers]: @@ -92,7 +92,7 @@ def hostname_available(hostname: str) -> bool: def allocate_v4_network(service_type: str, comment: str | None = "") -> ipaddress.IPv4Network: """Allocate a new IPv4 network in Infoblox. - Allocate an IPv4 network for a specific service type. The service type should be defined in the :term:`OSS` + Allocate an IPv4 network for a specific service type. The service type should be defined in the OSS parameters of :term:`GSO`, from which the containers and netmask will be used. :param service_type: The service type for which the network is allocated. diff --git a/gso/services/netbox_client.py b/gso/services/netbox_client.py index a64ec758..489f95ab 100644 --- a/gso/services/netbox_client.py +++ b/gso/services/netbox_client.py @@ -53,7 +53,7 @@ class Site(pydantic.BaseModel): class NetboxClient: - """Implement all methods to communicate with the Netbox :term:`API`.""" + """Implement all methods to communicate with the Netbox API.""" def __init__(self) -> None: """Instantiate a new Netbox client.""" @@ -212,16 +212,16 @@ class NetboxClient: iface_name: str, description: str | None = None, ) -> Interfaces: - """Assign a given interface to a :term:`LAG`. + """Assign a given interface to a LAG. Returns the interface object after assignment. """ iface = self.get_interface_by_name_and_device(iface_name, device_name) - # Get :term:`LAG` + # Get LAG lag = self.get_interface_by_name_and_device(lag_name, device_name) - # Assign interface to :term:`LAG`, ensuring it does not already belong to a :term:`LAG`. + # Assign interface to LAG, ensuring it does not already belong to a LAG. if iface.lag: msg = f"The interface: {iface_name} on device: {device_name} already belongs to a LAG: {iface.lag.name}." raise WorkflowStateError(msg) @@ -278,7 +278,7 @@ class NetboxClient: return interface def detach_interfaces_from_lag(self, device_name: str, lag_name: str) -> None: - """Detach all interfaces from a :term:`LAG`.""" + """Detach all interfaces from a LAG.""" device = self.get_device_by_name(device_name) lag = self.netbox.dcim.interfaces.get(device_id=device.id, name=lag_name) for interface in self.netbox.dcim.interfaces.filter( @@ -295,7 +295,7 @@ class NetboxClient: router_name = Router.from_subscription(router_id).router.router_fqdn device = self.get_device_by_name(router_name) - # Get the existing :term:`LAG` interfaces for the device + # Get the existing LAG interfaces for the device lag_interface_names = [ interface["name"] for interface in self.netbox.dcim.interfaces.filter(device=device.name, type="lag") ] @@ -307,7 +307,7 @@ class NetboxClient: return [lag for lag in all_feasible_lags if lag not in lag_interface_names] def get_available_lags(self, router_id: UUID) -> list[str]: - """Return all available :term:`LAG` not assigned to a device.""" + """Return all available LAG not assigned to a device.""" return self.get_available_lags_in_range(router_id, FEASIBLE_IP_TRUNK_LAG_RANGE) def get_available_services_lags(self, router_id: UUID) -> list[str]: diff --git a/gso/services/subscriptions.py b/gso/services/subscriptions.py index 2c5ffba4..add27960 100644 --- a/gso/services/subscriptions.py +++ b/gso/services/subscriptions.py @@ -175,12 +175,12 @@ def get_trunks_that_terminate_on_router( def get_product_id_by_name(product_name: ProductName) -> UUID: - """Retrieve the :term:`UUID` of a product by its name. + """Retrieve the UUID of a product by its name. :param product_name: The name of the product. :type product_name: ProductName - :return UUID: The :term:`UUID` of the product. + :return UUID: The UUID of the product. :rtype: UUID """ return ProductTable.query.filter_by(name=product_name).first().product_id diff --git a/gso/settings.py b/gso/settings.py index eaeeada9..7f71a560 100644 --- a/gso/settings.py +++ b/gso/settings.py @@ -1,7 +1,7 @@ -""":term:`GSO` settings. +"""GSO settings. Ensuring that the required parameters are set correctly. An example file ``oss-params-example.json`` is present in the -:term:`GSO` package itself. +GSO package itself. """ import ipaddress @@ -30,12 +30,12 @@ class EnvironmentEnum(strEnum): class GeneralParams(BaseSettings): - """General parameters for a :term:`GSO` configuration file.""" + """General parameters for a GSO configuration file.""" public_hostname: str - """The hostname that :term:`GSO` is publicly served at, used for building callback URLs for public use.""" + """The hostname that GSO is publicly served at, used for building callback URLs for public use.""" internal_hostname: str - """The hostname of :term:`GSO` that is for internal use, such as the provisioning proxy.""" + """The hostname of GSO that is for internal use, such as the provisioning proxy.""" isis_high_metric: int environment: EnvironmentEnum @@ -90,7 +90,7 @@ class ServiceNetworkParams(BaseSettings): class IPAMParams(BaseSettings): - """A set of parameters related to :term:`IPAM`.""" + """A set of parameters related to IPAM.""" INFOBLOX: InfoBloxParams LO: ServiceNetworkParams @@ -129,7 +129,7 @@ class SNMPParams(BaseSettings): v2c: MonitoringSNMPV2Params #: .. versionadded :: 2.0 - #: Support for :term:`SNMP` v3 will get added in a later version of :term:`GSO`. Parameters are optional for now. + #: Support for SNMP v3 will get added in a later version of GSO. Parameters are optional for now. v3: MonitoringSNMPV3Params | None = None @@ -213,7 +213,7 @@ class MoodiParams(BaseSettings): class OSSParams(BaseSettings): - """The set of parameters required for running :term:`GSO`.""" + """The set of parameters required for running GSO.""" GENERAL: GeneralParams IPAM: IPAMParams diff --git a/gso/utils/exceptions.py b/gso/utils/exceptions.py index 66ce6d9e..c5f4938b 100644 --- a/gso/utils/exceptions.py +++ b/gso/utils/exceptions.py @@ -1,4 +1,4 @@ -"""Custom exceptions for :term:`GSO`.""" +"""Custom exceptions for GSO.""" class NotFoundError(Exception): diff --git a/gso/utils/helpers.py b/gso/utils/helpers.py index 5485bf20..3557b4eb 100644 --- a/gso/utils/helpers.py +++ b/gso/utils/helpers.py @@ -1,4 +1,4 @@ -"""Helper methods that are used across :term:`GSO`.""" +"""Helper methods that are used across GSO.""" import random import re @@ -96,7 +96,7 @@ def available_service_lags_choices(router_id: UUID) -> Choice | None: def get_router_vendor(router_id: UUID) -> Vendor: """Retrieve the vendor of a router. - :param router_id: The :term:`UUID` of the router. + :param router_id: The UUID of the router. :type router_id: :class:`uuid.UUID` :return: The vendor of the router. @@ -106,10 +106,10 @@ def get_router_vendor(router_id: UUID) -> Vendor: def iso_from_ipv4(ipv4_address: IPv4AddressType) -> str: - """Calculate an :term:`ISO` address, based on an IPv4 address. + """Calculate an ISO address, based on an IPv4 address. :param IPv4Address ipv4_address: The address that's to be converted - :returns: An :term:`ISO`-formatted address. + :returns: An ISO-formatted address. """ padded_octets = [f"{x:>03}" for x in str(ipv4_address).split(".")] joined_octets = "".join(padded_octets) @@ -118,7 +118,7 @@ def iso_from_ipv4(ipv4_address: IPv4AddressType) -> str: def generate_fqdn(hostname: str, site_name: str, country_code: str) -> str: - """Generate an :term:`FQDN` from a hostname, site name, and a country code.""" + """Generate an FQDN from a hostname, site name, and a country code.""" oss = settings.load_oss_params() return f"{hostname}.{site_name.lower()}.{country_code.lower()}{oss.IPAM.LO.domain_name}" @@ -252,11 +252,11 @@ def partner_choice() -> Choice: def validate_edge_port_number_of_members_based_on_lacp(*, number_of_members: int, enable_lacp: bool) -> None: - """Validate the number of edge port members based on the :term:`LACP` setting. + """Validate the number of edge port members based on the LACP setting. :param number_of_members: The number of members to validate. - :param enable_lacp: Whether :term:`LACP` is enabled or not. - :raises ValueError: If the number of members is greater than 1 and :term:`LACP` is disabled. + :param enable_lacp: Whether LACP is enabled or not. + :raises ValueError: If the number of members is greater than 1 and LACP is disabled. """ if number_of_members > 1 and not enable_lacp: err_msg = "Number of members must be 1 if LACP is disabled." diff --git a/gso/utils/workflow_steps.py b/gso/utils/workflow_steps.py index 72e6104a..aee52b51 100644 --- a/gso/utils/workflow_steps.py +++ b/gso/utils/workflow_steps.py @@ -308,7 +308,7 @@ def update_sdp_single_pe_real(subscription: dict[str, Any], tt_number: str, proc @step("[FOR REAL] Set ISIS metric to very high value") def set_isis_to_max(subscription: Iptrunk, process_id: UUIDstr, tt_number: str) -> LSOState: - """Workflow step for setting the :term:`ISIS` metric to an arbitrarily high value to drain a link.""" + """Workflow step for setting the ISIS metric to an arbitrarily high value to drain a link.""" old_isis_metric = subscription.iptrunk.iptrunk_isis_metric params = load_oss_params() subscription.iptrunk.iptrunk_isis_metric = params.GENERAL.isis_high_metric @@ -398,7 +398,7 @@ _is_moodi_enabled = conditional(lambda _: load_oss_params().MOODI.moodi_enabled) def start_moodi() -> StepList: - """Start monitoring on demand using :term:`Moodi` Telemetry stack.""" + """Start monitoring on demand using Moodi Telemetry stack.""" host = load_oss_params().MOODI.host @step("Start Moodi") @@ -413,7 +413,7 @@ def start_moodi() -> StepList: def stop_moodi() -> StepList: - """Stop :term:`Moodi` Telemetry monitoring on demand.""" + """Stop Moodi Telemetry monitoring on demand.""" host = load_oss_params().MOODI.host @step("Stop Moodi") diff --git a/gso/worker.py b/gso/worker.py index c2e825cc..f7bfa083 100644 --- a/gso/worker.py +++ b/gso/worker.py @@ -1,4 +1,4 @@ -"""Module that sets up :term:`GSO` as a Celery worker. This will allow for the scheduling of regular task workflows.""" +"""Module that sets up GSO as a Celery worker. This will allow for the scheduling of regular task workflows.""" from typing import Any from uuid import UUID @@ -43,7 +43,7 @@ def process_broadcast_fn(process_id: UUID) -> None: class OrchestratorWorker(Celery): - """A :term:`GSO` instance that functions as a Celery worker.""" + """A GSO instance that functions as a Celery worker.""" websocket_manager: WebSocketManager process_broadcast_fn: BroadcastFunc diff --git a/gso/workflows/__init__.py b/gso/workflows/__init__.py index 2c75fb11..cc6725d4 100644 --- a/gso/workflows/__init__.py +++ b/gso/workflows/__init__.py @@ -1,4 +1,4 @@ -"""Initialisation class that imports all workflows into :term:`GSO`.""" +"""Initialisation class that imports all workflows into GSO.""" from orchestrator.services.subscriptions import WF_USABLE_MAP from orchestrator.types import SubscriptionLifecycle diff --git a/gso/workflows/iptrunk/create_iptrunk.py b/gso/workflows/iptrunk/create_iptrunk.py index 2d7be47d..ef111977 100644 --- a/gso/workflows/iptrunk/create_iptrunk.py +++ b/gso/workflows/iptrunk/create_iptrunk.py @@ -228,7 +228,7 @@ def create_subscription(product: UUIDstr, partner: str) -> State: @step("Get information from IPAM") def get_info_from_ipam(subscription: IptrunkInactive) -> State: - """Allocate IP resources in :term:`IPAM`.""" + """Allocate IP resources in IPAM.""" new_ipv4_network = infoblox.allocate_v4_network( "TRUNK", subscription.iptrunk.iptrunk_description, diff --git a/gso/workflows/iptrunk/deploy_twamp.py b/gso/workflows/iptrunk/deploy_twamp.py index 468564de..66b1f1c1 100644 --- a/gso/workflows/iptrunk/deploy_twamp.py +++ b/gso/workflows/iptrunk/deploy_twamp.py @@ -1,4 +1,4 @@ -"""Workflow for adding :term:`TWAMP` to an existing IP trunk. +"""Workflow for adding TWAMP to an existing IP trunk. Takes a trunk that is either `PROVISIONING` or `ACTIVE` and deploy configuration for TWAMP. The trunk will not change state after running this workflow. @@ -38,7 +38,7 @@ def _initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: @step("[DRY RUN] Deploy TWAMP on both sides") def deploy_twamp_dry(subscription: Iptrunk, process_id: UUIDstr, tt_number: str) -> LSOState: - """Perform a dry run of deploying the :term:`TWAMP` session.""" + """Perform a dry run of deploying the TWAMP session.""" extra_vars = { "subscription": json.loads(json_dumps(subscription)), "process_id": process_id, @@ -63,7 +63,7 @@ def deploy_twamp_dry(subscription: Iptrunk, process_id: UUIDstr, tt_number: str) @step("[FOR REAL] Deploy TWAMP on both sides") def deploy_twamp_real(subscription: Iptrunk, process_id: UUIDstr, tt_number: str) -> LSOState: - """Deploy the :term:`TWAMP` session.""" + """Deploy the TWAMP session.""" extra_vars = { "subscription": json.loads(json_dumps(subscription)), "process_id": process_id, diff --git a/gso/workflows/iptrunk/migrate_iptrunk.py b/gso/workflows/iptrunk/migrate_iptrunk.py index e288000a..b101c9c2 100644 --- a/gso/workflows/iptrunk/migrate_iptrunk.py +++ b/gso/workflows/iptrunk/migrate_iptrunk.py @@ -167,7 +167,7 @@ def netbox_reserve_interfaces( """Reserve new interfaces in Netbox, only when the new side's router is a Nokia router.""" new_side = Router.from_subscription(new_node).router nbclient = NetboxClient() - # Create :term:`LAG` interfaces + # Create LAG interfaces lag_interface: Interfaces = nbclient.create_interface( iface_name=new_lag_interface, interface_type="lag", diff --git a/gso/workflows/iptrunk/modify_isis_metric.py b/gso/workflows/iptrunk/modify_isis_metric.py index 26c1b35b..61d2f090 100644 --- a/gso/workflows/iptrunk/modify_isis_metric.py +++ b/gso/workflows/iptrunk/modify_isis_metric.py @@ -1,4 +1,4 @@ -"""A modification workflow for setting a new :term:`ISIS` metric for an IP trunk. +"""A modification workflow for setting a new ISIS metric for an IP trunk. The strategy is to re-apply the necessary template to the configuration construct: using a "replace" strategy only the necessary modifications will be applied. @@ -21,7 +21,7 @@ from gso.workflows.shared import modify_summary_form def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: - """Ask the operator for the new :term:`ISIS` metric.""" + """Ask the operator for the new ISIS metric.""" subscription = Iptrunk.from_subscription(subscription_id) class ModifyIptrunkForm(FormPage): @@ -38,7 +38,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: @step("Update subscription") def modify_iptrunk_subscription(subscription: Iptrunk, isis_metric: int) -> State: - """Store the new :term:`ISIS` metric in the database by updating the subscription.""" + """Store the new ISIS metric in the database by updating the subscription.""" subscription.iptrunk.iptrunk_isis_metric = isis_metric return {"subscription": subscription} @@ -46,7 +46,7 @@ def modify_iptrunk_subscription(subscription: Iptrunk, isis_metric: int) -> Stat @step("[DRY RUN] Provision IP trunk ISIS interface") def provision_ip_trunk_isis_iface_dry(subscription: Iptrunk, process_id: UUIDstr, tt_number: str) -> LSOState: - """Perform a dry run of deploying the new :term:`ISIS` metric on both sides of the trunk.""" + """Perform a dry run of deploying the new ISIS metric on both sides of the trunk.""" extra_vars = { "wfo_trunk_json": json.loads(json_dumps(subscription)), "dry_run": True, @@ -72,7 +72,7 @@ def provision_ip_trunk_isis_iface_dry(subscription: Iptrunk, process_id: UUIDstr @step("[FOR REAL] Provision IP trunk ISIS interface") def provision_ip_trunk_isis_iface_real(subscription: Iptrunk, process_id: UUIDstr, tt_number: str) -> LSOState: - """Deploy the new :term:`ISIS` metric on both sides of the trunk.""" + """Deploy the new ISIS metric on both sides of the trunk.""" extra_vars = { "wfo_trunk_json": json.loads(json_dumps(subscription)), "dry_run": False, @@ -102,11 +102,11 @@ def provision_ip_trunk_isis_iface_real(subscription: Iptrunk, process_id: UUIDst target=Target.MODIFY, ) def modify_isis_metric() -> StepList: - """Modify the :term:`ISIS` metric of an existing IP trunk. + """Modify the ISIS metric of an existing IP trunk. * Modify the subscription model in the database - * Perform a dry run of setting the new :term:`ISIS` metric - * Deploy the new :term:`ISIS` metric on both sides of the trunk + * Perform a dry run of setting the new ISIS metric + * Deploy the new ISIS metric on both sides of the trunk """ return ( begin diff --git a/gso/workflows/iptrunk/modify_trunk_interface.py b/gso/workflows/iptrunk/modify_trunk_interface.py index d2056db7..e76d9d2e 100644 --- a/gso/workflows/iptrunk/modify_trunk_interface.py +++ b/gso/workflows/iptrunk/modify_trunk_interface.py @@ -1,4 +1,4 @@ -"""A modification workflow that updates the :term:`LAG` interfaces that are part of an existing IP trunk. +"""A modification workflow that updates the LAG interfaces that are part of an existing IP trunk. Modifies LAG interfaces and members. This is used to increase capacity or to change SID/interface descriptions. @@ -211,7 +211,7 @@ def check_ip_trunk_connectivity(subscription: Iptrunk) -> LSOState: @step("Check LLDP on the trunk endpoints") def check_ip_trunk_lldp(subscription: Iptrunk) -> LSOState: - """Check :term:`LLDP` on trunk endpoints.""" + """Check LLDP on trunk endpoints.""" extra_vars = {"wfo_ip_trunk_json": json.loads(json_dumps(subscription)), "check": "lldp"} return { diff --git a/gso/workflows/iptrunk/terminate_iptrunk.py b/gso/workflows/iptrunk/terminate_iptrunk.py index 1e448ad0..d008ad88 100644 --- a/gso/workflows/iptrunk/terminate_iptrunk.py +++ b/gso/workflows/iptrunk/terminate_iptrunk.py @@ -40,7 +40,7 @@ from gso.utils.workflow_steps import set_isis_to_max def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: - """Ask the operator to confirm whether router configuration and :term:`IPAM` resources should be deleted.""" + """Ask the operator to confirm whether router configuration and IPAM resources should be deleted.""" iptrunk = Iptrunk.from_subscription(subscription_id) class TerminateForm(FormPage): @@ -141,7 +141,7 @@ def netbox_clean_up_side_b(subscription: Iptrunk) -> State: @step("Deprovision IPv4 networks") def deprovision_ip_trunk_ipv4(subscription: Iptrunk) -> dict: - """Clear up IPv4 resources in :term:`IPAM`.""" + """Clear up IPv4 resources in IPAM.""" infoblox.delete_network(ipaddress.IPv4Network(subscription.iptrunk.iptrunk_ipv4_network)) return {"subscription": subscription} @@ -149,7 +149,7 @@ def deprovision_ip_trunk_ipv4(subscription: Iptrunk) -> dict: @step("Deprovision IPv6 networks") def deprovision_ip_trunk_ipv6(subscription: Iptrunk) -> dict: - """Clear up IPv6 resources in :term:`IPAM`.""" + """Clear up IPv6 resources in IPAM.""" infoblox.delete_network(ipaddress.IPv6Network(subscription.iptrunk.iptrunk_ipv6_network)) return {"subscription": subscription} @@ -164,10 +164,10 @@ def terminate_iptrunk() -> StepList: """Terminate an IP trunk. * Let the operator decide whether to remove configuration from the routers, if so: - * Set the :term:`ISIS` metric of the IP trunk to an arbitrarily high value + * Set the ISIS metric of the IP trunk to an arbitrarily high value * Disable and remove configuration from the routers, first as a dry run * Mark the IP trunk interfaces as free in Netbox - * Clear :term:`IPAM` resources + * Clear IPAM resources * Terminate the subscription in the service database """ run_config_steps = conditional(lambda state: state["remove_configuration"]) diff --git a/gso/workflows/router/create_router.py b/gso/workflows/router/create_router.py index 22c86665..f0595fe8 100644 --- a/gso/workflows/router/create_router.py +++ b/gso/workflows/router/create_router.py @@ -153,7 +153,7 @@ def initialize_subscription( @step("Allocate loopback interfaces in IPAM") def ipam_allocate_loopback(subscription: RouterInactive) -> State: - """Allocate :term:`IPAM` resources for the loopback interface.""" + """Allocate IPAM resources for the loopback interface.""" fqdn = subscription.router.router_fqdn if not fqdn: msg = f"Router fqdn for subscription id {subscription.subscription_id} is missing!" diff --git a/gso/workflows/router/terminate_router.py b/gso/workflows/router/terminate_router.py index 604265f7..ca3b30ba 100644 --- a/gso/workflows/router/terminate_router.py +++ b/gso/workflows/router/terminate_router.py @@ -51,7 +51,7 @@ logger = logging.getLogger(__name__) def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: - """Let the operator decide whether to delete configuration on the router, and clear up :term:`IPAM` resources.""" + """Let the operator decide whether to delete configuration on the router, and clear up IPAM resources.""" router = Router.from_subscription(subscription_id) class TerminateForm(FormPage): @@ -77,7 +77,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: @step("Deprovision loopback IPs from IPAM") def deprovision_loopback_ips(subscription: Router) -> dict: - """Clear up the loopback addresses from :term:`IPAM`.""" + """Clear up the loopback addresses from IPAM.""" infoblox.delete_host_by_ip(ipaddress.IPv4Address(subscription.router.router_lo_ipv4_address)) return {"subscription": subscription} @@ -276,8 +276,8 @@ def kentik_apply_archive_license(subscription: Router) -> State: def terminate_router() -> StepList: """Terminate a router subscription. - * Let the operator decide whether to delete :term:`IPAM` resources, and remove configuration from the router - * Clear up :term:`IPAM` resources, if selected by the operator + * Let the operator decide whether to delete IPAM resources, and remove configuration from the router + * Clear up IPAM resources, if selected by the operator * Disable and delete configuration on the router, if selected by the operator * Mark the subscription as terminated in the service database """ -- GitLab