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

Update switch domain model

parent 4e26ec68
No related branches found
No related tags found
1 merge request!300Feature/lan switch interconnect
"""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'
"""))
......@@ -26,7 +26,7 @@ class SwitchBlockInactive(
):
"""A switch that's being currently inactive. See :class:`SwitchBlock`."""
switch_hostname: str | None = None
switch_fqdn: str | None = None
switch_ts_port: PortNumber | None = None
switch_site: SiteBlockInactive | None = None
switch_vendor: Vendor | None = None
......@@ -36,18 +36,18 @@ class SwitchBlockInactive(
class SwitchBlockProvisioning(SwitchBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING]):
"""A switch that's being provisioned. See :class:`SwitchBlock`."""
switch_hostname: str
switch_fqdn: str
switch_ts_port: PortNumber
switch_site: SiteBlockProvisioning
switch_vendor: Vendor
switch_model: SwitchModel | None = None
switch_model: SwitchModel
class SwitchBlock(SwitchBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]):
"""A switch that's currently deployed in the network."""
#: The hostname of the switch.
switch_hostname: str
#: The :term:`FQDN` of the switch.
switch_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
#: The :class:`Site` that this switch resides in. Both physically and computationally.
......@@ -55,4 +55,4 @@ class SwitchBlock(SwitchBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTI
#: The vendor of the switch.
switch_vendor: Vendor
#: The model of the switch.
switch_model: SwitchModel | None = None
switch_model: SwitchModel
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment