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

Add Switch models and make them selectable in the creation workflow

parent 20bb21e8
No related branches found
No related tags found
1 merge request!302Feature/update lan interconnect
"""Update LAN Switch Interconnect.
Revision ID: e854e0c35e20
Revises: 543afff041f9
Revises: 28c1723c6a00
Create Date: 2024-11-04 17:21:14.612740
"""
......@@ -10,7 +10,7 @@ from alembic import op
# revision identifiers, used by Alembic.
revision = 'e854e0c35e20'
down_revision = '543afff041f9'
down_revision = '28c1723c6a00'
branch_labels = None
depends_on = None
......
"""Clean up deprecated references to NREN-names products
Revision ID: 79a76b22ca53
Revises: e854e0c35e20
Create Date: 2024-12-03 17:01:33.752966
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '79a76b22ca53'
down_revision = 'e854e0c35e20'
branch_labels = None
depends_on = None
def upgrade() -> None:
conn = op.get_bind()
conn.execute(sa.text("""
DELETE FROM product_product_blocks WHERE product_product_blocks.product_id IN (SELECT products.product_id FROM products WHERE products.name IN ('GÉANT IP', 'IAS', 'Imported GÉANT IP', 'Imported IAS')) AND product_product_blocks.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('NRENL3CoreServiceBlock'))
"""))
conn.execute(sa.text("""
DELETE FROM subscription_instances WHERE subscription_instances.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('NRENL3CoreServiceBlock', 'NRENAccessPort'))
"""))
conn.execute(sa.text("""
DELETE FROM product_blocks WHERE product_blocks.name IN ('NRENL3CoreServiceBlock', 'NRENAccessPort')
"""))
def downgrade() -> None:
conn = op.get_bind()
......@@ -16,7 +16,9 @@ from gso.utils.types.ip_address import PortNumber
class SwitchModel(strEnum):
"""Enumerator for the different types of switches."""
EX3400 = "EX3400"
EX3400_24T = "EX3400 - 24T"
EX3400_48T = "EX3400 - 48T"
EX4300_32F = "EX4300 - 32F"
class SwitchBlockInactive(
......
......@@ -12,10 +12,10 @@
"site_tier": "Site Tier",
"site_ts_address": "Site Terminal Server Address",
"hostname": "Hostname of the new router, only the part that comes before the first period",
"hostname": "Hostname of the new device, only the part that comes before the first period",
"ts_address": "IP address of the terminal server",
"ts_port": "Port number of the terminal server",
"vendor": "Router vendor",
"vendor": "Device vendor",
"router_role": "Router role",
"geant_s_sid": "GÉANT S-SID",
......
......@@ -10,7 +10,7 @@ from orchestrator.workflow import StepList, begin, done, inputstep, step, workfl
from orchestrator.workflows.steps import resync, set_status, store_process_subscription
from orchestrator.workflows.utils import wrap_create_initial_input_form
from pydantic import ConfigDict, model_validator
from pydantic_forms.validators import Label, ReadOnlyField
from pydantic_forms.validators import Choice, Label, ReadOnlyField
from gso.products.product_blocks.switch import SwitchModel
from gso.products.product_types.site import Site
......@@ -40,7 +40,7 @@ def _initial_input_form_generator(product_name: str) -> FormGenerator:
hostname: str
ts_port: PortNumber
vendor: ReadOnlyField(Vendor.JUNIPER, default_type=Vendor) # type: ignore[valid-type]
model: ReadOnlyField(SwitchModel.EX3400, default_type=SwitchModel) # type: ignore[valid-type]
model: SwitchModel = Choice("Switch model", SwitchModel.values())
@model_validator(mode="after")
def hostname_must_be_available(self) -> Self:
......
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