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

Rebrand SBP, EP, and GÉANT IP service, including updating database migrations

parent d4f53aae
No related branches found
No related tags found
1 merge request!286Add Edge Port, GÉANT IP and IAS products
"""Add Edge Port and GÉANT IP workflows. """Add Edge Port and NREN L3 Core Service workflows.
Revision ID: bf05800fe9fc Revision ID: bf05800fe9fc
Revises: a08bf228f112 Revises: a08bf228f112
...@@ -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 = 'bf05800fe9fc' revision = 'bf05800fe9fc'
down_revision = 'a08bf228f112' down_revision = '2d224884c80b'
branch_labels = None branch_labels = None
depends_on = None depends_on = None
...@@ -55,34 +55,34 @@ new_workflows = [ ...@@ -55,34 +55,34 @@ new_workflows = [
"product_type": "ImportedEdgePort" "product_type": "ImportedEdgePort"
}, },
{ {
"name": "create_geant_ip", "name": "create_nren_l3_core_service",
"target": "CREATE", "target": "CREATE",
"description": "Create G\u00c9ANT IP", "description": "Create NREN L3 Core Service",
"product_type": "GeantIP" "product_type": "NRENL3CoreService"
}, },
{ {
"name": "modify_geant_ip", "name": "modify_nren_l3_core_service",
"target": "MODIFY", "target": "MODIFY",
"description": "Modify G\u00c9ANT IP", "description": "Modify NREN L3 Core Service",
"product_type": "GeantIP" "product_type": "NRENL3CoreService"
}, },
{ {
"name": "migrate_geant_ip", "name": "migrate_nren_l3_core_service",
"target": "MODIFY", "target": "MODIFY",
"description": "Migrate G\u00c9ANT IP", "description": "Migrate NREN L3 Core Service",
"product_type": "GeantIP" "product_type": "NRENL3CoreService"
}, },
{ {
"name": "create_imported_geant_ip", "name": "create_imported_nren_l3_core_service",
"target": "CREATE", "target": "CREATE",
"description": "Import G\u00c9ANT IP", "description": "Import NREN L3 Core Service",
"product_type": "ImportedGeantIP" "product_type": "ImportedNRENL3CoreService"
}, },
{ {
"name": "import_geant_ip", "name": "import_nren_l3_core_service",
"target": "MODIFY", "target": "MODIFY",
"description": "Import G\u00c9ANT IP", "description": "Import NREN L3 Core Service",
"product_type": "ImportedGeantIP" "product_type": "ImportedNRENL3CoreService"
} }
] ]
......
"""Add IPV4/IPV6 netmask to Service Binding Port model .
Revision ID: df108295d917
Revises: bf05800fe9fc
Create Date: 2024-10-10 11:39:43.051211
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = 'df108295d917'
down_revision = 'bf05800fe9fc'
branch_labels = None
depends_on = None
def upgrade() -> None:
conn = op.get_bind()
conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('ipv4_mask', 'IPV4 subnet mask') RETURNING resource_types.resource_type_id
"""))
conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('ipv6_mask', 'IPV6 subnet mask') RETURNING resource_types.resource_type_id
"""))
conn.execute(sa.text("""
INSERT INTO product_block_resource_types (product_block_id, resource_type_id) VALUES ((SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('ServiceBindingPort')), (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('ipv4_mask')))
"""))
conn.execute(sa.text("""
INSERT INTO product_block_resource_types (product_block_id, resource_type_id) VALUES ((SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('ServiceBindingPort')), (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('ipv6_mask')))
"""))
conn.execute(sa.text("""
WITH subscription_instance_ids AS (
SELECT subscription_instances.subscription_instance_id
FROM subscription_instances
WHERE subscription_instances.product_block_id IN (
SELECT product_blocks.product_block_id
FROM product_blocks
WHERE product_blocks.name = 'ServiceBindingPort'
)
)
INSERT INTO
subscription_instance_values (subscription_instance_id, resource_type_id, value)
SELECT
subscription_instance_ids.subscription_instance_id,
resource_types.resource_type_id,
'None'
FROM resource_types
CROSS JOIN subscription_instance_ids
WHERE resource_types.resource_type = 'ipv4_mask'
"""))
conn.execute(sa.text("""
WITH subscription_instance_ids AS (
SELECT subscription_instances.subscription_instance_id
FROM subscription_instances
WHERE subscription_instances.product_block_id IN (
SELECT product_blocks.product_block_id
FROM product_blocks
WHERE product_blocks.name = 'ServiceBindingPort'
)
)
INSERT INTO
subscription_instance_values (subscription_instance_id, resource_type_id, value)
SELECT
subscription_instance_ids.subscription_instance_id,
resource_types.resource_type_id,
'None'
FROM resource_types
CROSS JOIN subscription_instance_ids
WHERE resource_types.resource_type = 'ipv6_mask'
"""))
def downgrade() -> None:
conn = op.get_bind()
conn.execute(sa.text("""
DELETE FROM product_block_resource_types WHERE product_block_resource_types.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('ServiceBindingPort')) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('ipv4_mask'))
"""))
conn.execute(sa.text("""
DELETE FROM subscription_instance_values USING product_block_resource_types WHERE subscription_instance_values.subscription_instance_id IN (SELECT subscription_instances.subscription_instance_id FROM subscription_instances WHERE subscription_instances.subscription_instance_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('ServiceBindingPort'))) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('ipv4_mask'))
"""))
conn.execute(sa.text("""
DELETE FROM product_block_resource_types WHERE product_block_resource_types.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('ServiceBindingPort')) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('ipv6_mask'))
"""))
conn.execute(sa.text("""
DELETE FROM subscription_instance_values USING product_block_resource_types WHERE subscription_instance_values.subscription_instance_id IN (SELECT subscription_instances.subscription_instance_id FROM subscription_instances WHERE subscription_instances.subscription_instance_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('ServiceBindingPort'))) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('ipv6_mask'))
"""))
conn.execute(sa.text("""
DELETE FROM subscription_instance_values WHERE subscription_instance_values.resource_type_id IN (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('ipv4_mask', 'ipv6_mask'))
"""))
conn.execute(sa.text("""
DELETE FROM resource_types WHERE resource_types.resource_type IN ('ipv4_mask', 'ipv6_mask')
"""))
...@@ -62,34 +62,34 @@ class EdgePortBlockInactive( ...@@ -62,34 +62,34 @@ class EdgePortBlockInactive(
): ):
"""An edge port that's currently inactive. See :class:`EdgePortBlock`.""" """An edge port that's currently inactive. See :class:`EdgePortBlock`."""
edge_port_node: RouterBlockInactive | None = None node: RouterBlockInactive | None = None
edge_port_name: str | None = None name: str | None = None
edge_port_description: str | None = None edge_port_description: str | None = None
edge_port_enable_lacp: bool | None = None enable_lacp: bool | None = None
edge_port_encapsulation: EncapsulationType = EncapsulationType.DOT1Q encapsulation: EncapsulationType = EncapsulationType.DOT1Q
edge_port_mac_address: str | None = None mac_address: str | None = None
edge_port_member_speed: PhysicalPortCapacity | None = None member_speed: PhysicalPortCapacity | None = None
edge_port_minimum_links: int | None = None minimum_links: int | None = None
edge_port_type: EdgePortType | None = None edge_port_type: EdgePortType | None = None
edge_port_ignore_if_down: bool = False ignore_if_down: bool = False
edge_port_geant_ga_id: str | None = None geant_ga_id: str | None = None
edge_port_ae_members: LAGMemberList[EdgePortAEMemberBlockInactive] edge_port_ae_members: LAGMemberList[EdgePortAEMemberBlockInactive]
class EdgePortBlockProvisioning(EdgePortBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING]): class EdgePortBlockProvisioning(EdgePortBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING]):
"""An edge port that's being provisioned. See :class:`EdgePortBlock`.""" """An edge port that's being provisioned. See :class:`EdgePortBlock`."""
edge_port_node: RouterBlockProvisioning node: RouterBlockProvisioning
edge_port_name: str name: str
edge_port_description: str | None = None edge_port_description: str | None = None
edge_port_enable_lacp: bool enable_lacp: bool
edge_port_encapsulation: EncapsulationType = EncapsulationType.DOT1Q encapsulation: EncapsulationType = EncapsulationType.DOT1Q
edge_port_mac_address: str | None = None mac_address: str | None = None
edge_port_member_speed: PhysicalPortCapacity member_speed: PhysicalPortCapacity
edge_port_minimum_links: int | None = None minimum_links: int | None = None
edge_port_type: EdgePortType edge_port_type: EdgePortType
edge_port_ignore_if_down: bool = False ignore_if_down: bool = False
edge_port_geant_ga_id: str | None = None geant_ga_id: str | None = None
edge_port_ae_members: LAGMemberList[EdgePortAEMemberBlockProvisioning] # type: ignore[assignment] edge_port_ae_members: LAGMemberList[EdgePortAEMemberBlockProvisioning] # type: ignore[assignment]
...@@ -97,26 +97,26 @@ class EdgePortBlock(EdgePortBlockProvisioning, lifecycle=[SubscriptionLifecycle. ...@@ -97,26 +97,26 @@ class EdgePortBlock(EdgePortBlockProvisioning, lifecycle=[SubscriptionLifecycle.
"""An edge port that's currently deployed in the network.""" """An edge port that's currently deployed in the network."""
#: The router that this edge port is connected to. #: The router that this edge port is connected to.
edge_port_node: RouterBlock node: RouterBlock
#: The name of the edge port, in our case, corresponds to the name of the :term:`LAG` interface. #: The name of the edge port, in our case, corresponds to the name of the :term:`LAG` interface.
edge_port_name: str name: str
#: A description of the edge port. #: A description of the edge port.
edge_port_description: str | None = None edge_port_description: str | None = None
#: Indicates whether :term:`LACP` is enabled for this edge port. #: Indicates whether :term:`LACP` is enabled for this edge port.
edge_port_enable_lacp: bool enable_lacp: bool
#: The type of encapsulation used on this edge port, by default DOT1Q. #: The type of encapsulation used on this edge port, by default DOT1Q.
edge_port_encapsulation: EncapsulationType = EncapsulationType.DOT1Q encapsulation: EncapsulationType = EncapsulationType.DOT1Q
#: The MAC address assigned to this edge port, if applicable. #: The MAC address assigned to this edge port, if applicable.
edge_port_mac_address: str | None = None mac_address: str | None = None
#: The speed capacity of each member in the physical port. #: The speed capacity of each member in the physical port.
edge_port_member_speed: PhysicalPortCapacity member_speed: PhysicalPortCapacity
#: The minimum number of links required for this edge port. #: The minimum number of links required for this edge port.
edge_port_minimum_links: int | None = None minimum_links: int | None = None
#: The type of edge port (e.g., customer, private, public). #: The type of edge port (e.g., customer, private, public).
edge_port_type: EdgePortType edge_port_type: EdgePortType
#: If set to True, the edge port will be ignored if it is down. #: If set to True, the edge port will be ignored if it is down.
edge_port_ignore_if_down: bool = False ignore_if_down: bool = False
#: The GEANT GA ID associated with this edge port, if any. #: The GEANT GA ID associated with this edge port, if any.
edge_port_geant_ga_id: str | None = None geant_ga_id: str | None = None
#: A list of :term:`LAG` members associated with this edge port. #: A list of :term:`LAG` members associated with this edge port.
edge_port_ae_members: LAGMemberList[EdgePortAEMemberBlock] # type: ignore[assignment] edge_port_ae_members: LAGMemberList[EdgePortAEMemberBlock] # type: ignore[assignment]
...@@ -31,7 +31,7 @@ class ServiceBindingPortInactive( ...@@ -31,7 +31,7 @@ class ServiceBindingPortInactive(
ipv6_mask: IPV6Netmask | None = None ipv6_mask: IPV6Netmask | None = None
custom_firewall_filters: bool | None = None custom_firewall_filters: bool | None = None
geant_sid: str | None = None geant_sid: str | None = None
sbp_bgp_session_list: list[BGPSessionInactive] = Field(default_factory=list) bgp_session_list: list[BGPSessionInactive] = Field(default_factory=list)
edge_port: EdgePortBlockInactive | None = None edge_port: EdgePortBlockInactive | None = None
...@@ -47,7 +47,7 @@ class ServiceBindingPortProvisioning(ServiceBindingPortInactive, lifecycle=[Subs ...@@ -47,7 +47,7 @@ class ServiceBindingPortProvisioning(ServiceBindingPortInactive, lifecycle=[Subs
ipv6_mask: IPV6Netmask | None = None ipv6_mask: IPV6Netmask | None = None
custom_firewall_filters: bool custom_firewall_filters: bool
geant_sid: str geant_sid: str
sbp_bgp_session_list: list[BGPSessionProvisioning] # type: ignore[assignment] bgp_session_list: list[BGPSessionProvisioning] # type: ignore[assignment]
edge_port: EdgePortBlockProvisioning edge_port: EdgePortBlockProvisioning
...@@ -73,6 +73,6 @@ class ServiceBindingPort(ServiceBindingPortProvisioning, lifecycle=[Subscription ...@@ -73,6 +73,6 @@ class ServiceBindingPort(ServiceBindingPortProvisioning, lifecycle=[Subscription
#: The GÉANT service ID of this binding port. #: The GÉANT service ID of this binding port.
geant_sid: str geant_sid: str
#: The :term:`BGP` sessions associated with this service binding port. #: The :term:`BGP` sessions associated with this service binding port.
sbp_bgp_session_list: list[BGPSession] # type: ignore[assignment] bgp_session_list: list[BGPSession] # type: ignore[assignment]
#: The Edge Port on which this :term:`SBP` resides. #: The Edge Port on which this :term:`SBP` resides.
edge_port: EdgePortBlock edge_port: EdgePortBlock
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