diff --git a/gso/migrations/versions/2024-08-29_0e7e7d749617_add_switch_workflows.py b/gso/migrations/versions/2024-08-29_0e7e7d749617_add_switch_workflows.py index c7a5eb33d9532b89e8e8216d0a930731ecb4ed28..0d6b41cff953fed51a2dd505b4b1416d71673d2d 100644 --- a/gso/migrations/versions/2024-08-29_0e7e7d749617_add_switch_workflows.py +++ b/gso/migrations/versions/2024-08-29_0e7e7d749617_add_switch_workflows.py @@ -1,7 +1,7 @@ """Add switch workflows. Revision ID: 0e7e7d749617 -Revises: bd9be532b3f9 +Revises: 7412c5b7ebe4 Create Date: 2024-08-29 15:45:57.581710 """ @@ -10,7 +10,7 @@ from alembic import op # revision identifiers, used by Alembic. revision = '0e7e7d749617' -down_revision = 'bd9be532b3f9' +down_revision = '7412c5b7ebe4' branch_labels = None depends_on = None diff --git a/gso/migrations/versions/2024-08-29_bd9be532b3f9_update_switch_domain_model.py b/gso/migrations/versions/2024-08-29_bd9be532b3f9_update_switch_domain_model.py deleted file mode 100644 index 2abecc091264a1c17b389eb12355364b1e04faeb..0000000000000000000000000000000000000000 --- a/gso/migrations/versions/2024-08-29_bd9be532b3f9_update_switch_domain_model.py +++ /dev/null @@ -1,29 +0,0 @@ -"""Update switch domain model. - -Revision ID: bd9be532b3f9 -Revises: 87a05eddee3e -Create Date: 2024-08-29 11:41:06.936423 - -""" -import sqlalchemy as sa -from alembic import op - -# revision identifiers, used by Alembic. -revision = 'bd9be532b3f9' -down_revision = '87a05eddee3e' -branch_labels = None -depends_on = None - - -def upgrade() -> None: - conn = op.get_bind() - conn.execute(sa.text(""" -UPDATE resource_types SET resource_type='switch_fqdn' WHERE resource_types.resource_type = 'switch_hostname' - """)) - - -def downgrade() -> None: - conn = op.get_bind() - conn.execute(sa.text(""" -UPDATE resource_types SET resource_type='switch_hostname' WHERE resource_types.resource_type = 'switch_fqdn' - """)) diff --git a/gso/products/product_blocks/lan_switch_interconnect.py b/gso/products/product_blocks/lan_switch_interconnect.py index e2626de5c680bb983454ed32b523e61f1b78ad6d..39e31c9f5cb376a377d148a8f581236c3ee8c016 100644 --- a/gso/products/product_blocks/lan_switch_interconnect.py +++ b/gso/products/product_blocks/lan_switch_interconnect.py @@ -6,10 +6,11 @@ from orchestrator.types import SubscriptionLifecycle, strEnum from gso.products.product_blocks.router import RouterBlock, RouterBlockInactive, RouterBlockProvisioning from gso.products.product_blocks.switch import SwitchBlock, SwitchBlockInactive, SwitchBlockProvisioning from gso.utils.types.interfaces import LAGMemberList +from gso.utils.types.ip_address import IPv4NetworkType class LanSwitchInterconnectAddressSpace(strEnum): - """Types of LAN Switch Interconnect. Can be private or public.""" + """Types of :term:`LAN` Switch Interconnect. Can be private or public.""" PRIVATE = "Private" PUBLIC = "Public" @@ -20,7 +21,7 @@ class LanSwitchInterconnectInterfaceBlockInactive( lifecycle=[SubscriptionLifecycle.INITIAL], product_block_name="LanSwitchInterconnectInterfaceBlock", ): - """An inactive LAN Switch Interconnect interface.""" + """An inactive :term:`LAN` Switch Interconnect interface.""" interface_name: str | None = None interface_description: str | None = None @@ -29,7 +30,7 @@ class LanSwitchInterconnectInterfaceBlockInactive( class LanSwitchInterconnectInterfaceBlockProvisioning( LanSwitchInterconnectInterfaceBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING] ): - """A LAN Switch Interconnect interface that is being provisioned.""" + """A :term:`LAN` Switch Interconnect interface that is being provisioned.""" interface_name: str interface_description: str @@ -49,7 +50,7 @@ class LanSwitchInterconnectRouterSideBlockInactive( lifecycle=[SubscriptionLifecycle.INITIAL], product_block_name="LanSwitchInterconnectRouterSideBlock", ): - """An inactive LAN Switch Interconnect router side.""" + """An inactive :term:`LAN` Switch Interconnect router side.""" node: RouterBlockInactive ae_iface: str | None = None @@ -59,7 +60,7 @@ class LanSwitchInterconnectRouterSideBlockInactive( class LanSwitchInterconnectRouterSideBlockProvisioning( LanSwitchInterconnectRouterSideBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING] ): - """An LAN Switch Interconnect router side that is being provisioned.""" + """A :term:`LAN` Switch Interconnect router side that is being provisioned.""" node: RouterBlockProvisioning ae_iface: str | None = None @@ -69,7 +70,7 @@ class LanSwitchInterconnectRouterSideBlockProvisioning( class LanSwitchInterconnectRouterSideBlock( LanSwitchInterconnectRouterSideBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE] ): - """An active LAN Switch Interconnect router side.""" + """An active :term:`LAN` Switch Interconnect router side.""" node: RouterBlock ae_iface: str @@ -81,9 +82,9 @@ class LanSwitchInterconnectSwitchSideBlockInactive( lifecycle=[SubscriptionLifecycle.INITIAL], product_block_name="LanSwitchInterconnectSwitchSideBlock", ): - """An inactive LAN Switch Interconnect switch side.""" + """An inactive :term:`LAN` Switch Interconnect switch side.""" - node: SwitchBlockInactive + switch: SwitchBlockInactive ae_iface: str | None = None ae_members: LAGMemberList[LanSwitchInterconnectInterfaceBlockInactive] @@ -91,9 +92,9 @@ class LanSwitchInterconnectSwitchSideBlockInactive( class LanSwitchInterconnectSwitchSideBlockProvisioning( LanSwitchInterconnectSwitchSideBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING] ): - """An LAN Switch Interconnect switch side that is being provisioned.""" + """A :term:`LAN` Switch Interconnect switch side that is being provisioned.""" - node: SwitchBlockProvisioning + switch: SwitchBlockProvisioning ae_iface: str | None = None ae_members: LAGMemberList[LanSwitchInterconnectInterfaceBlockProvisioning] # type: ignore[assignment] @@ -101,9 +102,9 @@ class LanSwitchInterconnectSwitchSideBlockProvisioning( class LanSwitchInterconnectSwitchSideBlock( LanSwitchInterconnectSwitchSideBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE] ): - """An active LAN Switch Interconnect switch side.""" + """An active :term:`LAN` Switch Interconnect switch side.""" - node: SwitchBlock + switch: SwitchBlock ae_iface: str ae_members: LAGMemberList[LanSwitchInterconnectInterfaceBlock] # type: ignore[assignment] @@ -113,9 +114,10 @@ class LanSwitchInterconnectBlockInactive( lifecycle=[SubscriptionLifecycle.INITIAL], product_block_name="LanSwitchInterconnectBlock", ): - """A LAN Switch Interconnect that's currently inactive, see :class:`LanSwitchInterconnectBlock`.""" + """A :term:`LAN` Switch Interconnect that's currently inactive, see :class:`LanSwitchInterconnectBlock`.""" lan_switch_interconnect_description: str | None = None + lan_switch_interconnect_ip_network: IPv4NetworkType | None = None address_space: LanSwitchInterconnectAddressSpace | None = None minimum_links: int | None = None router_side: LanSwitchInterconnectRouterSideBlockInactive @@ -125,9 +127,10 @@ class LanSwitchInterconnectBlockInactive( class LanSwitchInterconnectBlockProvisioning( LanSwitchInterconnectBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING] ): - """A LAN Switch Interconnect that's currently being provisioned, see :class:`LanSwitchInterconnectBlock`.""" + """A :term:`LAN` Switch Interconnect that's currently being provisioned, see :class:`LanSwitchInterconnectBlock`.""" lan_switch_interconnect_description: str | None = None + lan_switch_interconnect_ip_network: IPv4NetworkType | None address_space: LanSwitchInterconnectAddressSpace | None = None minimum_links: int | None = None router_side: LanSwitchInterconnectRouterSideBlockProvisioning @@ -135,15 +138,17 @@ class LanSwitchInterconnectBlockProvisioning( class LanSwitchInterconnectBlock(LanSwitchInterconnectBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]): - """A LAN Switch Interconnect that's currently deployed in the network.""" + """A :term:`LAN` Switch Interconnect that's currently deployed in the network.""" - #: A human-readable description of this LAN Switch Interconnect. + #: A human-readable description of this :term:`LAN` Switch Interconnect. lan_switch_interconnect_description: str - #: The address space of the VLAN Switch Interconnect. It can be private or public. + #: The :term:`IP` resources for this :term:`VLAN` Switch Interconnect. + lan_switch_interconnect_ip_network: IPv4NetworkType | None + #: The address space of the :term:`VLAN` Switch Interconnect. It can be private or public. address_space: LanSwitchInterconnectAddressSpace - #: The minimum amount of links the LAN Switch Interconnect should consist of. + #: The minimum amount of links the :term:`LAN` Switch Interconnect should consist of. minimum_links: int - #: The router side of the LAN Switch Interconnect. + #: The router side of the :term:`LAN` Switch Interconnect. router_side: LanSwitchInterconnectRouterSideBlock - #: The switch side of the LAN Switch Interconnect. + #: The switch side of the :term:`LAN` Switch Interconnect. switch_side: LanSwitchInterconnectSwitchSideBlock diff --git a/gso/products/product_blocks/pop_vlan.py b/gso/products/product_blocks/pop_vlan.py index 191e7255951f24f9514a592989546774d17f2185..7e60aa2e2c762bd3d24977b3ddceae8a1b0f89f4 100644 --- a/gso/products/product_blocks/pop_vlan.py +++ b/gso/products/product_blocks/pop_vlan.py @@ -1,4 +1,4 @@ -"""Pop VLAN product block that has all parameters of a subscription throughout its lifecycle.""" +"""Pop :term:`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 VLAN port.""" + """An inactive Pop :term:`VLAN` port.""" port_name: str | None = None port_description: str | None = None @@ -40,15 +40,15 @@ class PopVlanPortBlockInactive( class PopVlanPortBlockProvisioning(PopVlanPortBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING]): - """A Pop VLAN port that is being provisioned.""" + """A Pop :term:`VLAN` port that is being provisioned.""" - port_name: str | None = None - port_description: str | None = None - tagged: bool | None = None + port_name: str | None + port_description: str | None + tagged: bool | None class PopVlanPortBlock(PopVlanPortBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]): - """An active Pop VLAN port.""" + """An active Pop :term:`VLAN` port.""" port_name: str port_description: str @@ -60,10 +60,10 @@ class PopVlanBlockInactive( lifecycle=[SubscriptionLifecycle.INITIAL], product_block_name="PopVlanBlock", ): - """A Pop VLAN that's currently inactive, see :class:`PopVlanBlock`.""" + """A Pop :term:`VLAN` that's currently inactive, see :class:`PopVlanBlock`.""" vlan_id: int - pop_vlan_description: str | None + pop_vlan_description: str | None = None lan_switch_interconnect: LanSwitchInterconnectBlockInactive ports: PortList[PopVlanPortBlockProvisioning] layer_preference: LayerPreference @@ -72,31 +72,31 @@ class PopVlanBlockInactive( class PopVlanBlockProvisioning(PopVlanBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING]): - """A Pop VLAN that's currently being provisioned, see :class:`PopVlanBlock`.""" + """A Pop :term:`VLAN` that's currently being provisioned, see :class:`PopVlanBlock`.""" vlan_id: int - pop_vlan_description: str | None = None + pop_vlan_description: str | None lan_switch_interconnect: LanSwitchInterconnectBlockProvisioning ports: PortList[PopVlanPortBlockProvisioning] layer_preference: LayerPreference - ipv4_network: IPv4Network | None = None - ipv6_network: IPv6Network | None = None + ipv4_network: IPv4Network | None + ipv6_network: IPv6Network | None class PopVlanBlock(PopVlanBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]): - """A Pop VLAN that's currently deployed in the network.""" + """A Pop :term:`VLAN` that's currently deployed in the network.""" - #: The VLAN ID of the Pop VLAN. + #: The :term:`VLAN` ID of the Pop :term:`VLAN`. vlan_id: int - #: The description of the Pop VLAN. + #: The description of the Pop :term:`VLAN`. pop_vlan_description: str - #: The LAN Switch Interconnect that this Pop VLAN is connected to. + #: The :term:`LAN` Switch Interconnect that this Pop :term:`VLAN` is connected to. lan_switch_interconnect: LanSwitchInterconnectBlock - #: The ports of the Pop VLAN. + #: The ports of the Pop :term:`VLAN`. ports: PortList[PopVlanPortBlock] # type: ignore[assignment] - #: The level of the layer preference for the Pop VLAN (L2 or L3). + #: The level of the layer preference for the Pop :term:`VLAN` (L2 or L3). layer_preference: LayerPreference - #: IPv4 network for the Pop VLAN if layer preference is L3. - ipv4_network: IPv4Network | None = None - #: IPv6 network for the Pop VLAN if layer preference is L3. - ipv6_network: IPv6Network | None = None + #: IPv4 network for the Pop :term:`VLAN` if layer preference is L3. + ipv4_network: IPv4Network | None + #: IPv6 network for the Pop :term:`VLAN` if layer preference is L3. + ipv6_network: IPv6Network | None diff --git a/gso/products/product_blocks/switch.py b/gso/products/product_blocks/switch.py index 43be0169560b7a691ed3981bc4f0683d627008db..790807ad058c6dece6eb1cab7dd055ae9bac96fd 100644 --- a/gso/products/product_blocks/switch.py +++ b/gso/products/product_blocks/switch.py @@ -26,9 +26,9 @@ class SwitchBlockInactive( ): """A switch that's being currently inactive. See :class:`SwitchBlock`.""" - switch_fqdn: str | None = None - switch_ts_port: PortNumber | None = None - switch_site: SiteBlockInactive | None = None + fqdn: str | None = None + ts_port: PortNumber | None = None + site: SiteBlockInactive | None = None switch_vendor: Vendor | None = None switch_model: SwitchModel | None = None @@ -36,9 +36,9 @@ class SwitchBlockInactive( class SwitchBlockProvisioning(SwitchBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING]): """A switch that's being provisioned. See :class:`SwitchBlock`.""" - switch_fqdn: str - switch_ts_port: PortNumber - switch_site: SiteBlockProvisioning + fqdn: str + ts_port: PortNumber + site: SiteBlockProvisioning switch_vendor: Vendor switch_model: SwitchModel @@ -47,11 +47,11 @@ class SwitchBlock(SwitchBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTI """A switch that's currently deployed in the network.""" #: The :term:`FQDN` of the switch. - switch_fqdn: str + fqdn: str #: The port of the terminal server that this switch is connected to. Used to offer out of band access. - switch_ts_port: PortNumber + ts_port: PortNumber #: The :class:`Site` that this switch resides in. Both physically and computationally. - switch_site: SiteBlock + site: SiteBlock #: The vendor of the switch. switch_vendor: Vendor #: The model of the switch.