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

Add SBP reference to NREN Access Port block

parent 9addd138
No related branches found
No related tags found
1 merge request!286Add Edge Port, GÉANT IP and IAS products
"""Update GÉANT IP model.
Revision ID: b3cda39379a0
Revises: 289e5334848f
Create Date: 2024-10-03 15:47:51.942674
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = 'b3cda39379a0'
down_revision = '289e5334848f'
branch_labels = None
depends_on = None
def upgrade() -> None:
conn = op.get_bind()
conn.execute(sa.text("""
INSERT INTO product_block_relations (in_use_by_id, depends_on_id) VALUES ((SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('NRENAccessPort')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('ServiceBindingPort')))
"""))
def downgrade() -> None:
conn = op.get_bind()
conn.execute(sa.text("""
DELETE FROM product_block_relations WHERE product_block_relations.in_use_by_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('NRENAccessPort')) AND product_block_relations.depends_on_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('ServiceBindingPort'))
"""))
......@@ -5,6 +5,11 @@ from orchestrator.types import SubscriptionLifecycle
from pydantic import Field
from gso.products.product_blocks.edge_port import EdgePortBlock, EdgePortBlockInactive, EdgePortBlockProvisioning
from gso.products.product_blocks.service_binding_port import (
ServiceBindingPort,
ServiceBindingPortInactive,
ServiceBindingPortProvisioning,
)
from gso.utils.shared_enums import APType
......@@ -15,6 +20,7 @@ class NRENAccessPortInactive(
nren_ap_type: APType | None = None
geant_ip_ep: EdgePortBlockInactive
geant_ip_sbp: ServiceBindingPortInactive
class NRENAccessPortProvisioning(NRENAccessPortInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING]):
......@@ -22,6 +28,7 @@ class NRENAccessPortProvisioning(NRENAccessPortInactive, lifecycle=[Subscription
nren_ap_type: APType
geant_ip_ep: EdgePortBlockProvisioning
geant_ip_sbp: ServiceBindingPortProvisioning
class NRENAccessPort(NRENAccessPortProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]):
......@@ -29,8 +36,10 @@ class NRENAccessPort(NRENAccessPortProvisioning, lifecycle=[SubscriptionLifecycl
#: The type of Access Port
nren_ap_type: APType
#: The list of Edge Ports where this service terminates.
#: The Edge Port where this :term:`NREN` Access Port terminates.
geant_ip_ep: EdgePortBlock
#: The corresponding :term:`SBP` of this Access Port.
geant_ip_sbp: ServiceBindingPort
class GeantIPBlockInactive(
......
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