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

udpate documentation, resolve linter warnings

parent d2ed1e7e
Branches
Tags
1 merge request!115Feature/update docs
...@@ -248,7 +248,7 @@ def update_interfaces_in_netbox(subscription: Iptrunk, removed_ae_members: dict, ...@@ -248,7 +248,7 @@ def update_interfaces_in_netbox(subscription: Iptrunk, removed_ae_members: dict,
# Free removed interfaces # Free removed interfaces
for member in removed_ae_members[str(side)]: for member in removed_ae_members[str(side)]:
nbclient.free_interface(router_name, member["interface_name"]) nbclient.free_interface(router_name, member["interface_name"])
# Attach physical interfaces to LAG # Attach physical interfaces to :term:`LAG`
# Update interface description to subscription ID # Update interface description to subscription ID
# Reserve interfaces # Reserve interfaces
for interface in subscription.iptrunk.iptrunk_sides[side].iptrunk_side_ae_members: for interface in subscription.iptrunk.iptrunk_sides[side].iptrunk_side_ae_members:
...@@ -274,7 +274,7 @@ def update_interfaces_in_netbox(subscription: Iptrunk, removed_ae_members: dict, ...@@ -274,7 +274,7 @@ def update_interfaces_in_netbox(subscription: Iptrunk, removed_ae_members: dict,
@step("Allocate interfaces in Netbox") @step("Allocate interfaces in Netbox")
def allocate_interfaces_in_netbox(subscription: Iptrunk, previous_ae_members: dict) -> State: def allocate_interfaces_in_netbox(subscription: Iptrunk, previous_ae_members: dict) -> State:
"""Allocate the LAG interfaces in NetBox. """Allocate the :term:`LAG` interfaces in NetBox.
Attach the :term:`LAG` interfaces to the physical interfaces detach old ones from the :term:`LAG`. Attach the :term:`LAG` interfaces to the physical interfaces detach old ones from the :term:`LAG`.
""" """
...@@ -311,7 +311,7 @@ def modify_trunk_interface() -> StepList: ...@@ -311,7 +311,7 @@ def modify_trunk_interface() -> StepList:
* Update the subscription in the database * Update the subscription in the database
* Reserve new interfaces in Netbox * Reserve new interfaces in Netbox
* Provision the updated version of the IP trunk, first as a dry run * Provision the updated version of the IP trunk, first as a dry run
* Allocate the previously reserved interfaces in Netbox * Allocate the reserved interfaces in Netbox
""" """
return ( return (
init init
......
...@@ -24,7 +24,7 @@ from gso.utils.helpers import set_isis_to_90000 ...@@ -24,7 +24,7 @@ from gso.utils.helpers import set_isis_to_90000
def initial_input_form_generator() -> FormGenerator: def initial_input_form_generator() -> FormGenerator:
"""Ask the operator to confirm whether router configuration and/or IPAM resources should be deleted.""" """Ask the operator to confirm whether router configuration and :term:`IPAM` resources should be deleted."""
class TerminateForm(FormPage): class TerminateForm(FormPage):
termination_label: Label = ( termination_label: Label = (
...@@ -129,7 +129,7 @@ def terminate_iptrunk() -> StepList: ...@@ -129,7 +129,7 @@ def terminate_iptrunk() -> StepList:
* Set the :term:`ISIS` metric of the IP trunk to an arbitrarily high value * Set the :term:`ISIS` metric of the IP trunk to an arbitrarily high value
* Disable and remove configuration from the routers, first as a dry run * Disable and remove configuration from the routers, first as a dry run
* Mark the IP trunk interfaces as free in Netbox * Mark the IP trunk interfaces as free in Netbox
* Clear IPAM resources, if selected by the operator * Clear :term:`IPAM` resources, if selected by the operator
* Terminate the subscription in the service database * Terminate the subscription in the service database
""" """
run_config_steps = conditional(lambda state: state["remove_configuration"]) run_config_steps = conditional(lambda state: state["remove_configuration"])
......
...@@ -128,7 +128,7 @@ def ipam_allocate_loopback(subscription: RouterProvisioning, is_ias_connected: b ...@@ -128,7 +128,7 @@ def ipam_allocate_loopback(subscription: RouterProvisioning, is_ias_connected: b
@step("Allocate IAS connection in IPAM") @step("Allocate IAS connection in IPAM")
def ipam_allocate_ias_networks(subscription: RouterProvisioning) -> State: def ipam_allocate_ias_networks(subscription: RouterProvisioning) -> State:
"""Allocate required IAS :term:`IPAM` resources.""" """Allocate required :term:`IAS` :term:`IPAM` resources."""
fqdn = subscription.router.router_fqdn fqdn = subscription.router.router_fqdn
subscription.router.router_si_ipv4_network = infoblox.allocate_v4_network( subscription.router.router_si_ipv4_network = infoblox.allocate_v4_network(
......
...@@ -25,7 +25,7 @@ logger = logging.getLogger(__name__) ...@@ -25,7 +25,7 @@ logger = logging.getLogger(__name__)
def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
"""Let the operator decide whether to delete configuration on the router, and/or clear up :term:`IPAM` resources.""" """Let the operator decide whether to delete configuration on the router, and clear up :term:`IPAM` resources."""
Router.from_subscription(subscription_id) Router.from_subscription(subscription_id)
class TerminateForm(FormPage): class TerminateForm(FormPage):
...@@ -59,7 +59,7 @@ def deprovision_si_ips(subscription: Router) -> dict: ...@@ -59,7 +59,7 @@ def deprovision_si_ips(subscription: Router) -> dict:
@step("Deprovision IAS LT interfaces from IPAM") @step("Deprovision IAS LT interfaces from IPAM")
def deprovision_lt_ips(subscription: Router) -> dict: def deprovision_lt_ips(subscription: Router) -> dict:
"""Clear up IAS LT interfaces from :term:`IPAM`.""" """Clear up :term:`IAS` LT interfaces from :term:`IPAM`."""
infoblox.delete_network(ipaddress.IPv4Network(subscription.router.router_ias_lt_ipv4_network)) infoblox.delete_network(ipaddress.IPv4Network(subscription.router.router_ias_lt_ipv4_network))
infoblox.delete_network(ipaddress.IPv6Network(subscription.router.router_ias_lt_ipv6_network)) infoblox.delete_network(ipaddress.IPv6Network(subscription.router.router_ias_lt_ipv6_network))
......
...@@ -62,8 +62,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: ...@@ -62,8 +62,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
def site_name_must_be_valid(cls, site_name: str) -> str: def site_name_must_be_valid(cls, site_name: str) -> str:
"""Validate the site name. """Validate the site name.
The site name must consist of three uppercase letters (A-Z) followed The site name must consist of three uppercase letters, followed by an optional single digit.
by an optional single digit (0-9).
""" """
validate_site_fields_is_unique("site_name", site_name) validate_site_fields_is_unique("site_name", site_name)
validate_site_name(site_name) validate_site_name(site_name)
......
...@@ -116,7 +116,7 @@ def extract_error(result): ...@@ -116,7 +116,7 @@ def extract_error(result):
class WorkflowInstanceForTests(LazyWorkflowInstance): class WorkflowInstanceForTests(LazyWorkflowInstance):
"""Register Test workflows. """Register Test workflows.
Similar to `LazyWorkflowInstance` but does not require an import during instantiate Similar to ``LazyWorkflowInstance`` but does not require an import during instantiate
Used for creating test workflows Used for creating test workflows
""" """
...@@ -173,7 +173,7 @@ def _store_step(step_log: list[tuple[Step, Process]]) -> Callable[[ProcessStat, ...@@ -173,7 +173,7 @@ def _store_step(step_log: list[tuple[Step, Process]]) -> Callable[[ProcessStat,
def run_workflow(workflow_key: str, input_data: State | list[State]) -> tuple[Process, ProcessStat, list]: def run_workflow(workflow_key: str, input_data: State | list[State]) -> tuple[Process, ProcessStat, list]:
# ATTENTION!! This code needs to be as similar as possible to `server.services.processes.start_process` # 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 # The main differences are: we use a different step log function, and we don't run in
# a separate thread # a separate thread
user = "john.doe" user = "john.doe"
...@@ -212,7 +212,7 @@ def resume_workflow( ...@@ -212,7 +212,7 @@ def resume_workflow(
step_log: list[tuple[Step, Process]], step_log: list[tuple[Step, Process]],
input_data: State | list[State], input_data: State | list[State],
) -> tuple[Process, list]: ) -> tuple[Process, list]:
# ATTENTION!! This code needs to be as similar as possible to `server.services.processes.resume_process` # ATTENTION!! This code needs to be as similar as possible to ``server.services.processes.resume_process``
# The main differences are: we use a different step log function, and we don't run in a separate thread # The main differences are: we use a different step log function, and we don't run in a separate thread
persistent = list( persistent = list(
filter( filter(
......
...@@ -51,10 +51,7 @@ def test_site_name_is_incorrect(responses, faker): ...@@ -51,10 +51,7 @@ def test_site_name_is_incorrect(responses, faker):
The validation should throw an exception in case of a invalid string. The validation should throw an exception in case of a invalid string.
""" """
invalid_site_name = "AMST10" invalid_site_name = "AMST10"
expected_exception_msg = ( expected_exception_msg = rf".*Enter a valid site name.+Received: {invalid_site_name}.*"
r".*Enter a valid site name\. It must consist of three uppercase letters \(A-Z\) followed by an optional single"
rf" digit \(0\-9\)\. Received: {invalid_site_name} \(type=value_error\)"
)
product_id = get_product_id_by_name(ProductType.SITE) product_id = get_product_id_by_name(ProductType.SITE)
initial_site_data = [ initial_site_data = [
{"product": product_id}, {"product": product_id},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment