Skip to content
Snippets Groups Projects
Verified Commit 8231c78d authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

Update product models for Switch, PoP VLAN, and LAN Switch Interconnect

parent 3c98b24d
Branches
Tags
1 merge request!300Feature/lan switch interconnect
"""Add switch workflows. """Add switch workflows.
Revision ID: 0e7e7d749617 Revision ID: 0e7e7d749617
Revises: bd9be532b3f9 Revises: 7412c5b7ebe4
Create Date: 2024-08-29 15:45:57.581710 Create Date: 2024-08-29 15:45:57.581710
""" """
...@@ -10,7 +10,7 @@ from alembic import op ...@@ -10,7 +10,7 @@ from alembic import op
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = '0e7e7d749617' revision = '0e7e7d749617'
down_revision = 'bd9be532b3f9' down_revision = '7412c5b7ebe4'
branch_labels = None branch_labels = None
depends_on = None depends_on = None
......
"""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'
"""))
...@@ -6,10 +6,11 @@ from orchestrator.types import SubscriptionLifecycle, strEnum ...@@ -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.router import RouterBlock, RouterBlockInactive, RouterBlockProvisioning
from gso.products.product_blocks.switch import SwitchBlock, SwitchBlockInactive, SwitchBlockProvisioning from gso.products.product_blocks.switch import SwitchBlock, SwitchBlockInactive, SwitchBlockProvisioning
from gso.utils.types.interfaces import LAGMemberList from gso.utils.types.interfaces import LAGMemberList
from gso.utils.types.ip_address import IPv4NetworkType
class LanSwitchInterconnectAddressSpace(strEnum): 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" PRIVATE = "Private"
PUBLIC = "Public" PUBLIC = "Public"
...@@ -20,7 +21,7 @@ class LanSwitchInterconnectInterfaceBlockInactive( ...@@ -20,7 +21,7 @@ class LanSwitchInterconnectInterfaceBlockInactive(
lifecycle=[SubscriptionLifecycle.INITIAL], lifecycle=[SubscriptionLifecycle.INITIAL],
product_block_name="LanSwitchInterconnectInterfaceBlock", product_block_name="LanSwitchInterconnectInterfaceBlock",
): ):
"""An inactive LAN Switch Interconnect interface.""" """An inactive :term:`LAN` Switch Interconnect interface."""
interface_name: str | None = None interface_name: str | None = None
interface_description: str | None = None interface_description: str | None = None
...@@ -29,7 +30,7 @@ class LanSwitchInterconnectInterfaceBlockInactive( ...@@ -29,7 +30,7 @@ class LanSwitchInterconnectInterfaceBlockInactive(
class LanSwitchInterconnectInterfaceBlockProvisioning( class LanSwitchInterconnectInterfaceBlockProvisioning(
LanSwitchInterconnectInterfaceBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING] 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_name: str
interface_description: str interface_description: str
...@@ -49,7 +50,7 @@ class LanSwitchInterconnectRouterSideBlockInactive( ...@@ -49,7 +50,7 @@ class LanSwitchInterconnectRouterSideBlockInactive(
lifecycle=[SubscriptionLifecycle.INITIAL], lifecycle=[SubscriptionLifecycle.INITIAL],
product_block_name="LanSwitchInterconnectRouterSideBlock", product_block_name="LanSwitchInterconnectRouterSideBlock",
): ):
"""An inactive LAN Switch Interconnect router side.""" """An inactive :term:`LAN` Switch Interconnect router side."""
node: RouterBlockInactive node: RouterBlockInactive
ae_iface: str | None = None ae_iface: str | None = None
...@@ -59,7 +60,7 @@ class LanSwitchInterconnectRouterSideBlockInactive( ...@@ -59,7 +60,7 @@ class LanSwitchInterconnectRouterSideBlockInactive(
class LanSwitchInterconnectRouterSideBlockProvisioning( class LanSwitchInterconnectRouterSideBlockProvisioning(
LanSwitchInterconnectRouterSideBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING] 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 node: RouterBlockProvisioning
ae_iface: str | None = None ae_iface: str | None = None
...@@ -69,7 +70,7 @@ class LanSwitchInterconnectRouterSideBlockProvisioning( ...@@ -69,7 +70,7 @@ class LanSwitchInterconnectRouterSideBlockProvisioning(
class LanSwitchInterconnectRouterSideBlock( class LanSwitchInterconnectRouterSideBlock(
LanSwitchInterconnectRouterSideBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE] LanSwitchInterconnectRouterSideBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]
): ):
"""An active LAN Switch Interconnect router side.""" """An active :term:`LAN` Switch Interconnect router side."""
node: RouterBlock node: RouterBlock
ae_iface: str ae_iface: str
...@@ -81,9 +82,9 @@ class LanSwitchInterconnectSwitchSideBlockInactive( ...@@ -81,9 +82,9 @@ class LanSwitchInterconnectSwitchSideBlockInactive(
lifecycle=[SubscriptionLifecycle.INITIAL], lifecycle=[SubscriptionLifecycle.INITIAL],
product_block_name="LanSwitchInterconnectSwitchSideBlock", 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_iface: str | None = None
ae_members: LAGMemberList[LanSwitchInterconnectInterfaceBlockInactive] ae_members: LAGMemberList[LanSwitchInterconnectInterfaceBlockInactive]
...@@ -91,9 +92,9 @@ class LanSwitchInterconnectSwitchSideBlockInactive( ...@@ -91,9 +92,9 @@ class LanSwitchInterconnectSwitchSideBlockInactive(
class LanSwitchInterconnectSwitchSideBlockProvisioning( class LanSwitchInterconnectSwitchSideBlockProvisioning(
LanSwitchInterconnectSwitchSideBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING] 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_iface: str | None = None
ae_members: LAGMemberList[LanSwitchInterconnectInterfaceBlockProvisioning] # type: ignore[assignment] ae_members: LAGMemberList[LanSwitchInterconnectInterfaceBlockProvisioning] # type: ignore[assignment]
...@@ -101,9 +102,9 @@ class LanSwitchInterconnectSwitchSideBlockProvisioning( ...@@ -101,9 +102,9 @@ class LanSwitchInterconnectSwitchSideBlockProvisioning(
class LanSwitchInterconnectSwitchSideBlock( class LanSwitchInterconnectSwitchSideBlock(
LanSwitchInterconnectSwitchSideBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE] 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_iface: str
ae_members: LAGMemberList[LanSwitchInterconnectInterfaceBlock] # type: ignore[assignment] ae_members: LAGMemberList[LanSwitchInterconnectInterfaceBlock] # type: ignore[assignment]
...@@ -113,9 +114,10 @@ class LanSwitchInterconnectBlockInactive( ...@@ -113,9 +114,10 @@ class LanSwitchInterconnectBlockInactive(
lifecycle=[SubscriptionLifecycle.INITIAL], lifecycle=[SubscriptionLifecycle.INITIAL],
product_block_name="LanSwitchInterconnectBlock", 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_description: str | None = None
lan_switch_interconnect_ip_network: IPv4NetworkType | None = None
address_space: LanSwitchInterconnectAddressSpace | None = None address_space: LanSwitchInterconnectAddressSpace | None = None
minimum_links: int | None = None minimum_links: int | None = None
router_side: LanSwitchInterconnectRouterSideBlockInactive router_side: LanSwitchInterconnectRouterSideBlockInactive
...@@ -125,9 +127,10 @@ class LanSwitchInterconnectBlockInactive( ...@@ -125,9 +127,10 @@ class LanSwitchInterconnectBlockInactive(
class LanSwitchInterconnectBlockProvisioning( class LanSwitchInterconnectBlockProvisioning(
LanSwitchInterconnectBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING] 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_description: str | None = None
lan_switch_interconnect_ip_network: IPv4NetworkType | None
address_space: LanSwitchInterconnectAddressSpace | None = None address_space: LanSwitchInterconnectAddressSpace | None = None
minimum_links: int | None = None minimum_links: int | None = None
router_side: LanSwitchInterconnectRouterSideBlockProvisioning router_side: LanSwitchInterconnectRouterSideBlockProvisioning
...@@ -135,15 +138,17 @@ class LanSwitchInterconnectBlockProvisioning( ...@@ -135,15 +138,17 @@ class LanSwitchInterconnectBlockProvisioning(
class LanSwitchInterconnectBlock(LanSwitchInterconnectBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]): 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 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 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 minimum_links: int
#: The router side of the LAN Switch Interconnect. #: The router side of the :term:`LAN` Switch Interconnect.
router_side: LanSwitchInterconnectRouterSideBlock router_side: LanSwitchInterconnectRouterSideBlock
#: The switch side of the LAN Switch Interconnect. #: The switch side of the :term:`LAN` Switch Interconnect.
switch_side: LanSwitchInterconnectSwitchSideBlock switch_side: LanSwitchInterconnectSwitchSideBlock
"""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 ipaddress import IPv4Network, IPv6Network
from typing import Annotated, TypeVar from typing import Annotated, TypeVar
...@@ -32,7 +32,7 @@ PortList = Annotated[list[T], AfterValidator(validate_unique_list), Doc("A list ...@@ -32,7 +32,7 @@ PortList = Annotated[list[T], AfterValidator(validate_unique_list), Doc("A list
class PopVlanPortBlockInactive( class PopVlanPortBlockInactive(
ProductBlockModel, lifecycle=[SubscriptionLifecycle.INITIAL], product_block_name="PopVlanPortBlock" 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_name: str | None = None
port_description: str | None = None port_description: str | None = None
...@@ -40,15 +40,15 @@ class PopVlanPortBlockInactive( ...@@ -40,15 +40,15 @@ class PopVlanPortBlockInactive(
class PopVlanPortBlockProvisioning(PopVlanPortBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING]): 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_name: str | None
port_description: str | None = None port_description: str | None
tagged: bool | None = None tagged: bool | None
class PopVlanPortBlock(PopVlanPortBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]): class PopVlanPortBlock(PopVlanPortBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]):
"""An active Pop VLAN port.""" """An active Pop :term:`VLAN` port."""
port_name: str port_name: str
port_description: str port_description: str
...@@ -60,10 +60,10 @@ class PopVlanBlockInactive( ...@@ -60,10 +60,10 @@ class PopVlanBlockInactive(
lifecycle=[SubscriptionLifecycle.INITIAL], lifecycle=[SubscriptionLifecycle.INITIAL],
product_block_name="PopVlanBlock", 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 vlan_id: int
pop_vlan_description: str | None pop_vlan_description: str | None = None
lan_switch_interconnect: LanSwitchInterconnectBlockInactive lan_switch_interconnect: LanSwitchInterconnectBlockInactive
ports: PortList[PopVlanPortBlockProvisioning] ports: PortList[PopVlanPortBlockProvisioning]
layer_preference: LayerPreference layer_preference: LayerPreference
...@@ -72,31 +72,31 @@ class PopVlanBlockInactive( ...@@ -72,31 +72,31 @@ class PopVlanBlockInactive(
class PopVlanBlockProvisioning(PopVlanBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING]): 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 vlan_id: int
pop_vlan_description: str | None = None pop_vlan_description: str | None
lan_switch_interconnect: LanSwitchInterconnectBlockProvisioning lan_switch_interconnect: LanSwitchInterconnectBlockProvisioning
ports: PortList[PopVlanPortBlockProvisioning] ports: PortList[PopVlanPortBlockProvisioning]
layer_preference: LayerPreference layer_preference: LayerPreference
ipv4_network: IPv4Network | None = None ipv4_network: IPv4Network | None
ipv6_network: IPv6Network | None = None ipv6_network: IPv6Network | None
class PopVlanBlock(PopVlanBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]): 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 vlan_id: int
#: The description of the Pop VLAN. #: The description of the Pop :term:`VLAN`.
pop_vlan_description: str 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 lan_switch_interconnect: LanSwitchInterconnectBlock
#: The ports of the Pop VLAN. #: The ports of the Pop :term:`VLAN`.
ports: PortList[PopVlanPortBlock] # type: ignore[assignment] 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 layer_preference: LayerPreference
#: IPv4 network for the Pop VLAN if layer preference is L3. #: IPv4 network for the Pop :term:`VLAN` if layer preference is L3.
ipv4_network: IPv4Network | None = None ipv4_network: IPv4Network | None
#: IPv6 network for the Pop VLAN if layer preference is L3. #: IPv6 network for the Pop :term:`VLAN` if layer preference is L3.
ipv6_network: IPv6Network | None = None ipv6_network: IPv6Network | None
...@@ -26,9 +26,9 @@ class SwitchBlockInactive( ...@@ -26,9 +26,9 @@ class SwitchBlockInactive(
): ):
"""A switch that's being currently inactive. See :class:`SwitchBlock`.""" """A switch that's being currently inactive. See :class:`SwitchBlock`."""
switch_fqdn: str | None = None fqdn: str | None = None
switch_ts_port: PortNumber | None = None ts_port: PortNumber | None = None
switch_site: SiteBlockInactive | None = None site: SiteBlockInactive | None = None
switch_vendor: Vendor | None = None switch_vendor: Vendor | None = None
switch_model: SwitchModel | None = None switch_model: SwitchModel | None = None
...@@ -36,9 +36,9 @@ class SwitchBlockInactive( ...@@ -36,9 +36,9 @@ class SwitchBlockInactive(
class SwitchBlockProvisioning(SwitchBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING]): class SwitchBlockProvisioning(SwitchBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING]):
"""A switch that's being provisioned. See :class:`SwitchBlock`.""" """A switch that's being provisioned. See :class:`SwitchBlock`."""
switch_fqdn: str fqdn: str
switch_ts_port: PortNumber ts_port: PortNumber
switch_site: SiteBlockProvisioning site: SiteBlockProvisioning
switch_vendor: Vendor switch_vendor: Vendor
switch_model: SwitchModel switch_model: SwitchModel
...@@ -47,11 +47,11 @@ class SwitchBlock(SwitchBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTI ...@@ -47,11 +47,11 @@ class SwitchBlock(SwitchBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTI
"""A switch that's currently deployed in the network.""" """A switch that's currently deployed in the network."""
#: The :term:`FQDN` of the switch. #: 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. #: 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. #: The :class:`Site` that this switch resides in. Both physically and computationally.
switch_site: SiteBlock site: SiteBlock
#: The vendor of the switch. #: The vendor of the switch.
switch_vendor: Vendor switch_vendor: Vendor
#: The model of the switch. #: The model of the switch.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment