Skip to content
Snippets Groups Projects
Verified Commit 3cfaeb00 authored by Neda Moeini's avatar Neda Moeini Committed by Karel van Klink
Browse files

Update Migrations and Create/Modify NREN L3 Service workflows.

parent f566bb32
No related branches found
No related tags found
1 merge request!286Add Edge Port, GÉANT IP and IAS products
Showing
with 167 additions and 164 deletions
"""Add Edge Port and NREN L3 Core Service workflows. """Add Import EdgePort and L3 Core Service workflows..
Revision ID: bf05800fe9fc Revision ID: 7412c5b7ebe4
Revises: a08bf228f112 Revises: e1659d366925
Create Date: 2024-10-08 11:22:00.038925 Create Date: 2024-10-17 13:10:38.551706
""" """
import sqlalchemy as sa import sqlalchemy as sa
from alembic import op from alembic import op
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = 'bf05800fe9fc' revision = '7412c5b7ebe4'
down_revision = '2d224884c80b' down_revision = 'e1659d366925'
branch_labels = None branch_labels = None
depends_on = None depends_on = None
...@@ -57,32 +57,32 @@ new_workflows = [ ...@@ -57,32 +57,32 @@ new_workflows = [
{ {
"name": "create_nren_l3_core_service", "name": "create_nren_l3_core_service",
"target": "CREATE", "target": "CREATE",
"description": "Create NREN L3 Core Service", "description": "Create G\u00c9ANT IP",
"product_type": "NRENL3CoreService" "product_type": "NRENL3CoreService"
}, },
{ {
"name": "modify_nren_l3_core_service", "name": "modify_nren_l3_core_service",
"target": "MODIFY", "target": "MODIFY",
"description": "Modify NREN L3 Core Service", "description": "Modify G\u00c9ANT IP",
"product_type": "NRENL3CoreService"
},
{
"name": "migrate_nren_l3_core_service",
"target": "MODIFY",
"description": "Migrate NREN L3 Core Service",
"product_type": "NRENL3CoreService" "product_type": "NRENL3CoreService"
}, },
{ {
"name": "create_imported_nren_l3_core_service", "name": "create_imported_nren_l3_core_service",
"target": "CREATE", "target": "CREATE",
"description": "Import NREN L3 Core Service", "description": "Import G\u00c9ANT IP",
"product_type": "ImportedNRENL3CoreService" "product_type": "ImportedNRENL3CoreService"
}, },
{ {
"name": "import_nren_l3_core_service", "name": "import_nren_l3_core_service",
"target": "MODIFY", "target": "MODIFY",
"description": "Import NREN L3 Core Service", "description": "Import G\u00c9ANT IP",
"product_type": "ImportedNRENL3CoreService" "product_type": "ImportedNRENL3CoreService"
},
{
"name": "migrate_nren_l3_core_service",
"target": "MODIFY",
"description": "Migrate G\u00c9ANT IP",
"product_type": "NRENL3CoreService"
} }
] ]
......
"""Add Edge Port and NREN L3 Core Service products. """Add Edge Port and L3 Core Service domain models.
Revision ID: 2d224884c80b Revision ID: e1659d366925
Revises: 51c819b28101 Revises: 51c819b28101
Create Date: 2024-10-16 14:39:40.236160 Create Date: 2024-10-17 11:33:38.103939
""" """
import sqlalchemy as sa import sqlalchemy as sa
from alembic import op from alembic import op
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = '2d224884c80b' revision = 'e1659d366925'
down_revision = '51c819b28101' down_revision = '51c819b28101'
branch_labels = None branch_labels = None
depends_on = None depends_on = None
...@@ -27,7 +27,7 @@ INSERT INTO products (name, description, product_type, tag, status) VALUES ('Imp ...@@ -27,7 +27,7 @@ INSERT INTO products (name, description, product_type, tag, status) VALUES ('Imp
INSERT INTO products (name, description, product_type, tag, status) VALUES ('GÉANT IP', 'A GÉANT IP subscription for R&E access', 'NRENL3CoreService', 'G_IP', 'active') RETURNING products.product_id INSERT INTO products (name, description, product_type, tag, status) VALUES ('GÉANT IP', 'A GÉANT IP subscription for R&E access', 'NRENL3CoreService', 'G_IP', 'active') RETURNING products.product_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO products (name, description, product_type, tag, status) VALUES ('Imported GÉANT IP', 'A Gpre-existing GÉANT IP subscription that is imported into the service database', 'ImportedNRENL3CoreService', 'IMP_G_IP', 'active') RETURNING products.product_id INSERT INTO products (name, description, product_type, tag, status) VALUES ('Imported GÉANT IP', 'A pre-existing GÉANT IP subscription that is imported into the service database', 'ImportedNRENL3CoreService', 'IMP_G_IP', 'active') RETURNING products.product_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO products (name, description, product_type, tag, status) VALUES ('IAS', 'An Internet Access Service for general internet access', 'NRENL3CoreService', 'IAS', 'active') RETURNING products.product_id INSERT INTO products (name, description, product_type, tag, status) VALUES ('IAS', 'An Internet Access Service for general internet access', 'NRENL3CoreService', 'IAS', 'active') RETURNING products.product_id
...@@ -36,7 +36,7 @@ INSERT INTO products (name, description, product_type, tag, status) VALUES ('IAS ...@@ -36,7 +36,7 @@ INSERT INTO products (name, description, product_type, tag, status) VALUES ('IAS
INSERT INTO products (name, description, product_type, tag, status) VALUES ('Imported IAS', 'A pre-existing Internet Access Service that is imported into the service database', 'ImportedNRENL3CoreService', 'IMP_IAS', 'active') RETURNING products.product_id INSERT INTO products (name, description, product_type, tag, status) VALUES ('Imported IAS', 'A pre-existing Internet Access Service that is imported into the service database', 'ImportedNRENL3CoreService', 'IMP_IAS', 'active') RETURNING products.product_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO fixed_inputs (name, value, product_id) VALUES ('nren_l3_core_service_type', 'IMPORTED_IAS', (SELECT products.product_id FROM products WHERE products.name IN ('Imported IAS'))), ('nren_l3_core_service_type', 'IMPORTED_GEANT_IP', (SELECT products.product_id FROM products WHERE products.name IN ('Imported GÉANT IP'))), ('nren_l3_core_service_type', 'IAS', (SELECT products.product_id FROM products WHERE products.name IN ('IAS'))), ('nren_l3_core_service_type', 'GGEANT_IP', (SELECT products.product_id FROM products WHERE products.name IN ('GÉANT IP'))) INSERT INTO fixed_inputs (name, value, product_id) VALUES ('nren_l3_core_service_type', 'IAS', (SELECT products.product_id FROM products WHERE products.name IN ('IAS'))), ('nren_l3_core_service_type', 'IMPORTED_IAS', (SELECT products.product_id FROM products WHERE products.name IN ('Imported IAS'))), ('nren_l3_core_service_type', 'GEANT_IP', (SELECT products.product_id FROM products WHERE products.name IN ('GÉANT IP'))), ('nren_l3_core_service_type', 'IMPORTED_GEANT_IP', (SELECT products.product_id FROM products WHERE products.name IN ('Imported GÉANT IP')))
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO product_blocks (name, description, tag, status) VALUES ('EdgePortBlock', 'The product block with all attributes of an Edge Port', 'EP_BLOCK', 'active') RETURNING product_blocks.product_block_id INSERT INTO product_blocks (name, description, tag, status) VALUES ('EdgePortBlock', 'The product block with all attributes of an Edge Port', 'EP_BLOCK', 'active') RETURNING product_blocks.product_block_id
...@@ -57,100 +57,100 @@ INSERT INTO product_blocks (name, description, tag, status) VALUES ('ServiceBind ...@@ -57,100 +57,100 @@ INSERT INTO product_blocks (name, description, tag, status) VALUES ('ServiceBind
INSERT INTO product_blocks (name, description, tag, status) VALUES ('BGPSession', 'A BGP session', 'BGP_BLOCK', 'active') RETURNING product_blocks.product_block_id INSERT INTO product_blocks (name, description, tag, status) VALUES ('BGPSession', 'A BGP session', 'BGP_BLOCK', 'active') RETURNING product_blocks.product_block_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('ignore_if_down', 'Ignore if this interface goes down') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('send_default_route', 'This product sends a default route') RETURNING resource_types.resource_type_id
"""))
conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('multipath_enabled', 'Does this have multipath enabled') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('geant_ga_id', 'GÉANT GA service ID') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('has_custom_policies', 'This has custom policies enabled') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('has_custom_policies', 'This has custom policies enabled') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('is_passive', 'This product is passive') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('families', 'IP families, can be v4 v6 and UNICAST or MULTICAST') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('bfd_enabled', 'This product has BFD enabled') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('edge_port_name', 'Edge Port interface name') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('enable_lacp', 'This product has LACP enabled') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('edge_port_type', 'Type of Edge Port') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('edge_port_type', 'Type of Edge Port') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('custom_firewall_filters', 'This product has custom firewall filters enabled') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('geant_ga_id', 'GÉANT GA service ID') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('peer_address', 'A Peer address') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('bfd_multiplier', 'BFD multiplier') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('ipv6_address', 'IPv6 Address') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('ipv6_address', 'IPv6 Address') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('edge_port_description', 'Description of an Edge Port') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('edge_port_name', 'The Edge Port name') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('authentication_key', 'Authentication key') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('encapsulation', 'Encapsulation method') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('bfd_multiplier', 'BFD multiplier') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('ignore_if_down', 'Ignore if this interface goes down') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('is_tagged', 'This product is tagged') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('bfd_interval', 'BFD interval') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('rtbh_enabled', 'This product has RTBH enabled') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('rtbh_enabled', 'This product has RTBH enabled') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('mac_address', 'A MAC address') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('custom_firewall_filters', 'This product has custom firewall filters enabled') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('bfd_interval', 'BFD interval') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('ap_type', 'Access Port type') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('is_multi_hop', 'This product is multi-hop') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('is_multi_hop', 'This product is multi-hop') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('member_speed', 'The capacity of a member interface') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('edge_port_description', 'Description of an Edge Port') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('ipv4_mask', 'IPv4 netmask') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('is_tagged', 'This product is tagged') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('geant_sid', 'G´ÉANT service ID') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('mac_address', 'A MAC address') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('encapsulation', 'Encapsulation method') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('geant_sid', 'GEANT SID') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('ipv4_address', 'IPv4 Address') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('ipv4_address', 'IPV4 Address') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('ipv6_mask', 'IPv6 netmask') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('peer_address', 'Peer address') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('bfd_enabled', 'This product has BFD enabled') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('sbp_type', 'Type of Service Binding Port') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('ap_type', 'Access Port type') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('ipv6_mask', 'IPV6 subnet mask') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('send_default_route', 'This product sends a default route') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('authentication_key', 'Authentication key') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('is_passive', 'This product is passive') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('multipath_enabled', 'Does this have multipath enabled') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('sbp_type', 'Type of Service Binding Port') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('ipv4_mask', 'IPV4 netmask') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('enable_lacp', 'This product has LACP enabled') RETURNING resource_types.resource_type_id INSERT INTO resource_types (resource_type, description) VALUES ('families', 'IP families, can be v4 v6 and UNICAST or MULTICAST') RETURNING resource_types.resource_type_id
"""))
conn.execute(sa.text("""
INSERT INTO resource_types (resource_type, description) VALUES ('member_speed', 'The member speed') RETURNING resource_types.resource_type_id
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO product_product_blocks (product_id, product_block_id) VALUES ((SELECT products.product_id FROM products WHERE products.name IN ('Imported Edge Port')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('EdgePortBlock'))), ((SELECT products.product_id FROM products WHERE products.name IN ('Edge Port')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('EdgePortBlock'))) INSERT INTO product_product_blocks (product_id, product_block_id) VALUES ((SELECT products.product_id FROM products WHERE products.name IN ('Edge Port')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('EdgePortBlock'))), ((SELECT products.product_id FROM products WHERE products.name IN ('Imported Edge Port')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('EdgePortBlock')))
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
INSERT INTO product_product_blocks (product_id, product_block_id) VALUES ((SELECT products.product_id FROM products WHERE products.name IN ('Imported IAS')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('NRENL3CoreServiceBlock'))), ((SELECT products.product_id FROM products WHERE products.name IN ('Imported GÉANT IP')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('NRENL3CoreServiceBlock'))), ((SELECT products.product_id FROM products WHERE products.name IN ('IAS')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('NRENL3CoreServiceBlock'))), ((SELECT products.product_id FROM products WHERE products.name IN ('GÉANT IP')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('NRENL3CoreServiceBlock'))) INSERT INTO product_product_blocks (product_id, product_block_id) VALUES ((SELECT products.product_id FROM products WHERE products.name IN ('IAS')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('NRENL3CoreServiceBlock'))), ((SELECT products.product_id FROM products WHERE products.name IN ('Imported IAS')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('NRENL3CoreServiceBlock'))), ((SELECT products.product_id FROM products WHERE products.name IN ('GÉANT IP')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('NRENL3CoreServiceBlock'))), ((SELECT products.product_id FROM products WHERE products.name IN ('Imported GÉANT IP')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('NRENL3CoreServiceBlock')))
""")) """))
conn.execute(sa.text(""" 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 ('EdgePortBlock')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('RouterBlock'))) 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 ('EdgePortBlock')), (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('RouterBlock')))
...@@ -481,16 +481,16 @@ DELETE FROM product_block_resource_types WHERE product_block_resource_types.prod ...@@ -481,16 +481,16 @@ DELETE FROM product_block_resource_types WHERE product_block_resource_types.prod
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 ('BGPSession'))) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('rtbh_enabled')) 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 ('BGPSession'))) AND product_block_resource_types.resource_type_id = (SELECT resource_types.resource_type_id FROM resource_types WHERE resource_types.resource_type IN ('rtbh_enabled'))
""")) """))
conn.execute(sa.text(""" 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 ('ignore_if_down', 'multipath_enabled', 'geant_ga_id', 'has_custom_policies', 'families', 'edge_port_name', 'edge_port_type', 'custom_firewall_filters', 'peer_address', 'ipv6_address', 'edge_port_description', 'authentication_key', 'bfd_multiplier', 'is_tagged', 'rtbh_enabled', 'mac_address', 'bfd_interval', 'is_multi_hop', 'member_speed', 'ipv4_mask', 'geant_sid', 'encapsulation', 'ipv4_address', 'ipv6_mask', 'bfd_enabled', 'ap_type', 'send_default_route', 'is_passive', 'sbp_type', 'enable_lacp')) 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 ('send_default_route', 'has_custom_policies', 'is_passive', 'bfd_enabled', 'enable_lacp', 'edge_port_type', 'geant_ga_id', 'bfd_multiplier', 'ipv6_address', 'edge_port_name', 'encapsulation', 'ignore_if_down', 'bfd_interval', 'rtbh_enabled', 'custom_firewall_filters', 'ap_type', 'is_multi_hop', 'edge_port_description', 'is_tagged', 'mac_address', 'geant_sid', 'ipv4_address', 'peer_address', 'sbp_type', 'ipv6_mask', 'authentication_key', 'multipath_enabled', 'ipv4_mask', 'families', 'member_speed'))
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
DELETE FROM resource_types WHERE resource_types.resource_type IN ('ignore_if_down', 'multipath_enabled', 'geant_ga_id', 'has_custom_policies', 'families', 'edge_port_name', 'edge_port_type', 'custom_firewall_filters', 'peer_address', 'ipv6_address', 'edge_port_description', 'authentication_key', 'bfd_multiplier', 'is_tagged', 'rtbh_enabled', 'mac_address', 'bfd_interval', 'is_multi_hop', 'member_speed', 'ipv4_mask', 'geant_sid', 'encapsulation', 'ipv4_address', 'ipv6_mask', 'bfd_enabled', 'ap_type', 'send_default_route', 'is_passive', 'sbp_type', 'enable_lacp') DELETE FROM resource_types WHERE resource_types.resource_type IN ('send_default_route', 'has_custom_policies', 'is_passive', 'bfd_enabled', 'enable_lacp', 'edge_port_type', 'geant_ga_id', 'bfd_multiplier', 'ipv6_address', 'edge_port_name', 'encapsulation', 'ignore_if_down', 'bfd_interval', 'rtbh_enabled', 'custom_firewall_filters', 'ap_type', 'is_multi_hop', 'edge_port_description', 'is_tagged', 'mac_address', 'geant_sid', 'ipv4_address', 'peer_address', 'sbp_type', 'ipv6_mask', 'authentication_key', 'multipath_enabled', 'ipv4_mask', 'families', 'member_speed')
""")) """))
conn.execute(sa.text(""" 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 ('Imported Edge Port', 'Edge Port')) AND product_product_blocks.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('EdgePortBlock')) DELETE FROM product_product_blocks WHERE product_product_blocks.product_id IN (SELECT products.product_id FROM products WHERE products.name IN ('Edge Port', 'Imported Edge Port')) AND product_product_blocks.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('EdgePortBlock'))
""")) """))
conn.execute(sa.text(""" 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 ('Imported IAS', 'Imported GÉANT IP', 'IAS', 'GÉANT IP')) AND product_product_blocks.product_block_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('NRENL3CoreServiceBlock')) DELETE FROM product_product_blocks WHERE product_product_blocks.product_id IN (SELECT products.product_id FROM products WHERE products.name IN ('IAS', 'Imported IAS', 'GÉANT IP', 'Imported GÉANT IP')) 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(""" 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 ('EdgePortBlock')) AND product_block_relations.depends_on_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('RouterBlock')) 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 ('EdgePortBlock')) AND product_block_relations.depends_on_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('RouterBlock'))
...@@ -511,26 +511,26 @@ DELETE FROM product_block_relations WHERE product_block_relations.in_use_by_id I ...@@ -511,26 +511,26 @@ DELETE FROM product_block_relations WHERE product_block_relations.in_use_by_id I
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 ('ServiceBindingPort')) AND product_block_relations.depends_on_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('EdgePortBlock')) 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 ('ServiceBindingPort')) AND product_block_relations.depends_on_id IN (SELECT product_blocks.product_block_id FROM product_blocks WHERE product_blocks.name IN ('EdgePortBlock'))
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
DELETE FROM fixed_inputs WHERE fixed_inputs.product_id IN (SELECT products.product_id FROM products WHERE products.name IN ('Imported IAS', 'Imported GÉANT IP', 'IAS', 'GÉANT IP')) AND fixed_inputs.name = 'nren_l3_core_service_type' DELETE FROM fixed_inputs WHERE fixed_inputs.product_id IN (SELECT products.product_id FROM products WHERE products.name IN ('IAS', 'Imported IAS', 'GÉANT IP', 'Imported GÉANT IP')) AND fixed_inputs.name = 'nren_l3_core_service_type'
""")) """))
conn.execute(sa.text(""" 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 ('BGPSession', 'ServiceBindingPort', 'NRENAccessPort', 'EdgePortAEMemberBlock', 'NRENL3CoreServiceBlock', 'EdgePortBlock')) 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 ('EdgePortAEMemberBlock', 'EdgePortBlock', 'NRENL3CoreServiceBlock', 'ServiceBindingPort', 'BGPSession', 'NRENAccessPort'))
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
DELETE FROM product_blocks WHERE product_blocks.name IN ('BGPSession', 'ServiceBindingPort', 'NRENAccessPort', 'EdgePortAEMemberBlock', 'NRENL3CoreServiceBlock', 'EdgePortBlock') DELETE FROM product_blocks WHERE product_blocks.name IN ('EdgePortAEMemberBlock', 'EdgePortBlock', 'NRENL3CoreServiceBlock', 'ServiceBindingPort', 'BGPSession', 'NRENAccessPort')
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
DELETE FROM processes WHERE processes.pid IN (SELECT processes_subscriptions.pid FROM processes_subscriptions WHERE processes_subscriptions.subscription_id IN (SELECT subscriptions.subscription_id FROM subscriptions WHERE subscriptions.product_id IN (SELECT products.product_id FROM products WHERE products.name IN ('Imported IAS', 'Imported GÉANT IP', 'Imported Edge Port', 'Edge Port', 'IAS', 'GÉANT IP')))) DELETE FROM processes WHERE processes.pid IN (SELECT processes_subscriptions.pid FROM processes_subscriptions WHERE processes_subscriptions.subscription_id IN (SELECT subscriptions.subscription_id FROM subscriptions WHERE subscriptions.product_id IN (SELECT products.product_id FROM products WHERE products.name IN ('IAS', 'GÉANT IP', 'Imported GÉANT IP', 'Edge Port', 'Imported IAS', 'Imported Edge Port'))))
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
DELETE FROM processes_subscriptions WHERE processes_subscriptions.subscription_id IN (SELECT subscriptions.subscription_id FROM subscriptions WHERE subscriptions.product_id IN (SELECT products.product_id FROM products WHERE products.name IN ('Imported IAS', 'Imported GÉANT IP', 'Imported Edge Port', 'Edge Port', 'IAS', 'GÉANT IP'))) DELETE FROM processes_subscriptions WHERE processes_subscriptions.subscription_id IN (SELECT subscriptions.subscription_id FROM subscriptions WHERE subscriptions.product_id IN (SELECT products.product_id FROM products WHERE products.name IN ('IAS', 'GÉANT IP', 'Imported GÉANT IP', 'Edge Port', 'Imported IAS', 'Imported Edge Port')))
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
DELETE FROM subscription_instances WHERE subscription_instances.subscription_id IN (SELECT subscriptions.subscription_id FROM subscriptions WHERE subscriptions.product_id IN (SELECT products.product_id FROM products WHERE products.name IN ('Imported IAS', 'Imported GÉANT IP', 'Imported Edge Port', 'Edge Port', 'IAS', 'GÉANT IP'))) DELETE FROM subscription_instances WHERE subscription_instances.subscription_id IN (SELECT subscriptions.subscription_id FROM subscriptions WHERE subscriptions.product_id IN (SELECT products.product_id FROM products WHERE products.name IN ('IAS', 'GÉANT IP', 'Imported GÉANT IP', 'Edge Port', 'Imported IAS', 'Imported Edge Port')))
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
DELETE FROM subscriptions WHERE subscriptions.product_id IN (SELECT products.product_id FROM products WHERE products.name IN ('Imported IAS', 'Imported GÉANT IP', 'Imported Edge Port', 'Edge Port', 'IAS', 'GÉANT IP')) DELETE FROM subscriptions WHERE subscriptions.product_id IN (SELECT products.product_id FROM products WHERE products.name IN ('IAS', 'GÉANT IP', 'Imported GÉANT IP', 'Edge Port', 'Imported IAS', 'Imported Edge Port'))
""")) """))
conn.execute(sa.text(""" conn.execute(sa.text("""
DELETE FROM products WHERE products.name IN ('Imported IAS', 'Imported GÉANT IP', 'Imported Edge Port', 'Edge Port', 'IAS', 'GÉANT IP') DELETE FROM products WHERE products.name IN ('IAS', 'GÉANT IP', 'Imported GÉANT IP', 'Edge Port', 'Imported IAS', 'Imported Edge Port')
""")) """))
...@@ -40,3 +40,4 @@ class ImportedEdgePort( ...@@ -40,3 +40,4 @@ class ImportedEdgePort(
"""An imported Edge Port that is currently active.""" """An imported Edge Port that is currently active."""
edge_port: EdgePortBlock edge_port: EdgePortBlock
...@@ -17,7 +17,7 @@ class NRENL3CoreServiceType(strEnum): ...@@ -17,7 +17,7 @@ class NRENL3CoreServiceType(strEnum):
The core services offered include GÉANT IP for R&E access, and the Internet Access Service. The core services offered include GÉANT IP for R&E access, and the Internet Access Service.
""" """
GEANT_IP = "GÉANT IP" GEANT_IP = "GEANT_IP"
IAS = "IAS" IAS = "IAS"
......
...@@ -16,7 +16,7 @@ from gso.products.product_blocks.bgp_session import BGPSession, IPFamily ...@@ -16,7 +16,7 @@ from gso.products.product_blocks.bgp_session import BGPSession, IPFamily
from gso.products.product_blocks.nren_l3_core_service import NRENAccessPortInactive from gso.products.product_blocks.nren_l3_core_service import NRENAccessPortInactive
from gso.products.product_blocks.service_binding_port import VLAN_ID, ServiceBindingPortInactive from gso.products.product_blocks.service_binding_port import VLAN_ID, ServiceBindingPortInactive
from gso.products.product_types.edge_port import EdgePort from gso.products.product_types.edge_port import EdgePort
from gso.products.product_types.nren_l3_core_service import ImportedGeantIPInactive from gso.products.product_types.nren_l3_core_service import ImportedNRENL3CoreServiceInactive
from gso.services.partners import get_partner_by_name from gso.services.partners import get_partner_by_name
from gso.services.subscriptions import get_product_id_by_name from gso.services.subscriptions import get_product_id_by_name
from gso.utils.shared_enums import SBPType from gso.utils.shared_enums import SBPType
...@@ -70,12 +70,12 @@ def create_subscription(partner: str) -> dict: ...@@ -70,12 +70,12 @@ def create_subscription(partner: str) -> dict:
"""Create a new subscription object in the database.""" """Create a new subscription object in the database."""
partner_id = get_partner_by_name(partner)["partner_id"] partner_id = get_partner_by_name(partner)["partner_id"]
product_id = get_product_id_by_name(ProductName.IMPORTED_GEANT_IP) product_id = get_product_id_by_name(ProductName.IMPORTED_GEANT_IP)
subscription = ImportedGeantIPInactive.from_product_id(product_id, partner_id) subscription = ImportedNRENL3CoreServiceInactive.from_product_id(product_id, partner_id)
return {"subscription": subscription, "subscription_id": subscription.subscription_id} return {"subscription": subscription, "subscription_id": subscription.subscription_id}
@step("Initialize subscription") @step("Initialize subscription")
def initialize_subscription(subscription: ImportedGeantIPInactive, service_binding_ports: list) -> dict: def initialize_subscription(subscription: ImportedNRENL3CoreServiceInactive, service_binding_ports: list) -> dict:
"""Initialize the subscription with the user input.""" """Initialize the subscription with the user input."""
for service_binding_port in service_binding_ports: for service_binding_port in service_binding_ports:
edge_port_subscription = EdgePort.from_subscription(service_binding_port.pop("edge_port")) edge_port_subscription = EdgePort.from_subscription(service_binding_port.pop("edge_port"))
...@@ -106,7 +106,7 @@ def initialize_subscription(subscription: ImportedGeantIPInactive, service_bindi ...@@ -106,7 +106,7 @@ def initialize_subscription(subscription: ImportedGeantIPInactive, service_bindi
initial_input_form=initial_input_form_generator, initial_input_form=initial_input_form_generator,
target=Target.CREATE, target=Target.CREATE,
) )
def create_imported_geant_ip() -> StepList: def create_imported_nren_l3_core_service() -> StepList:
"""Import a GÉANT IP without provisioning it.""" """Import a GÉANT IP without provisioning it."""
return ( return (
begin begin
......
"""Create a new GÉANT IP subscription.""" """Create a new NREN L3 Core Service subscription including GÉANT IP and IAS."""
from typing import Annotated, Any from typing import Annotated, Any
from uuid import uuid4 from uuid import uuid4
...@@ -17,7 +17,7 @@ from gso.products.product_blocks.bgp_session import BGPSession, IPFamily ...@@ -17,7 +17,7 @@ from gso.products.product_blocks.bgp_session import BGPSession, IPFamily
from gso.products.product_blocks.nren_l3_core_service import NRENAccessPortInactive from gso.products.product_blocks.nren_l3_core_service import NRENAccessPortInactive
from gso.products.product_blocks.service_binding_port import VLAN_ID, ServiceBindingPortInactive from gso.products.product_blocks.service_binding_port import VLAN_ID, ServiceBindingPortInactive
from gso.products.product_types.edge_port import EdgePort from gso.products.product_types.edge_port import EdgePort
from gso.products.product_types.nren_l3_core_service import GeantIPInactive from gso.products.product_types.nren_l3_core_service import NRENL3CoreService, NRENL3CoreServiceInactive
from gso.services.lso_client import LSOState, lso_interaction from gso.services.lso_client import LSOState, lso_interaction
from gso.utils.helpers import ( from gso.utils.helpers import (
active_edge_port_selector, active_edge_port_selector,
...@@ -31,13 +31,13 @@ from gso.utils.types.tt_number import TTNumber ...@@ -31,13 +31,13 @@ from gso.utils.types.tt_number import TTNumber
def initial_input_form_generator(product_name: str) -> FormGenerator: def initial_input_form_generator(product_name: str) -> FormGenerator:
"""Gather input from the operator to build a new subscription object.""" """Gather input from the operator to build a new subscription object."""
class CreateGeantIPForm(FormPage): class CreateNRENCoreServiceForm(FormPage):
model_config = ConfigDict(title="GÉANT IP - Select partner") model_config = ConfigDict(title=f"{product_name} - Select partner")
tt_number: TTNumber tt_number: TTNumber
partner: partner_choice() # type: ignore[valid-type] partner: partner_choice() # type: ignore[valid-type]
initial_user_input = yield CreateGeantIPForm initial_user_input = yield CreateNRENCoreServiceForm
class EdgePortSelection(BaseModel): class EdgePortSelection(BaseModel):
edge_port: active_edge_port_selector(partner_id=initial_user_input.partner) # type: ignore[valid-type] edge_port: active_edge_port_selector(partner_id=initial_user_input.partner) # type: ignore[valid-type]
...@@ -52,9 +52,9 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: ...@@ -52,9 +52,9 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
return edge_ports return edge_ports
class EdgePortSelectionForm(FormPage): class EdgePortSelectionForm(FormPage):
model_config = ConfigDict(title="GÉANT IP - Select Edge Ports") model_config = ConfigDict(title=f"{product_name} - Select Edge Ports")
info_label: Label = Field( info_label: Label = Field(
"Please select the Edge Ports where this GÉANT IP service will terminate", exclude=True f"Please select the Edge Ports where this {product_name} service will terminate", exclude=True
) )
edge_ports: Annotated[list[EdgePortSelection], AfterValidator(validate_edge_ports_are_unique)] edge_ports: Annotated[list[EdgePortSelection], AfterValidator(validate_edge_ports_are_unique)]
...@@ -94,7 +94,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: ...@@ -94,7 +94,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
for ep_index, edge_port in enumerate(ep_list): for ep_index, edge_port in enumerate(ep_list):
class BindingPortsInputForm(FormPage): class BindingPortsInputForm(FormPage):
model_config = ConfigDict(title=f"GÉANT IP - Configure Edge Ports ({ep_index + 1}/{len(ep_list)})") model_config = ConfigDict(title=f"{product_name} - Configure Edge Ports ({ep_index + 1}/{len(ep_list)})")
info_label: Label = Field("Please configure the Service Binding Ports for each Edge Port.", exclude=True) info_label: Label = Field("Please configure the Service Binding Ports for each Edge Port.", exclude=True)
current_ep_label: Label = Field( current_ep_label: Label = Field(
f"Currently configuring on {EdgePort.from_subscription(edge_port.edge_port).description} " f"Currently configuring on {EdgePort.from_subscription(edge_port.edge_port).description} "
...@@ -135,14 +135,14 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: ...@@ -135,14 +135,14 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
@step("Create subscription") @step("Create subscription")
def create_subscription(product: UUIDstr, partner: str) -> State: def create_subscription(product: UUIDstr, partner: str) -> State:
"""Create a new subscription object in the database.""" """Create a new subscription object in the database."""
subscription = GeantIPInactive.from_product_id(product, partner) subscription = NRENL3CoreServiceInactive.from_product_id(product, partner)
return {"subscription": subscription, "subscription_id": subscription.subscription_id} return {"subscription": subscription, "subscription_id": subscription.subscription_id}
@step("Initialize subscription") @step("Initialize subscription")
def initialize_subscription( def initialize_subscription(
subscription: GeantIPInactive, edge_ports: list[dict], binding_port_inputs: list[dict] subscription: NRENL3CoreServiceInactive, edge_ports: list[dict], binding_port_inputs: list[dict], product_name: str
) -> State: ) -> State:
"""Take all user inputs and use them to populate the subscription model.""" """Take all user inputs and use them to populate the subscription model."""
edge_port_fqdn_list = [] edge_port_fqdn_list = []
...@@ -155,20 +155,20 @@ def initialize_subscription( ...@@ -155,20 +155,20 @@ def initialize_subscription(
service_binding_port = ServiceBindingPortInactive.new( service_binding_port = ServiceBindingPortInactive.new(
subscription_id=uuid4(), subscription_id=uuid4(),
**sbp_input, **sbp_input,
sbp_bgp_session_list=sbp_bgp_session_list, bgp_session_list=sbp_bgp_session_list,
sbp_type=SBPType.L3, sbp_type=SBPType.L3,
edge_port=edge_port_subscription.edge_port, edge_port=edge_port_subscription.edge_port,
) )
subscription.geant_ip.geant_ip_ap_list.append( subscription.nren_l3_core_service.nren_ap_list.append(
NRENAccessPortInactive.new( NRENAccessPortInactive.new(
subscription_id=uuid4(), subscription_id=uuid4(),
nren_ap_type=edge_port_input["ap_type"], ap_type=edge_port_input["ap_type"],
geant_ip_sbp=service_binding_port, sbp=service_binding_port,
) )
) )
edge_port_fqdn_list.append(edge_port_subscription.edge_port.node.router_fqdn) edge_port_fqdn_list.append(edge_port_subscription.edge_port.node.router_fqdn)
subscription.description = "GEANT IP service" subscription.description = f"{product_name} service"
return {"subscription": subscription, "edge_port_fqdn_list": edge_port_fqdn_list} return {"subscription": subscription, "edge_port_fqdn_list": edge_port_fqdn_list}
...@@ -278,19 +278,19 @@ def check_bgp_peers(subscription: dict[str, Any], edge_port_fqdn_list: list[str] ...@@ -278,19 +278,19 @@ def check_bgp_peers(subscription: dict[str, Any], edge_port_fqdn_list: list[str]
@step("Update Infoblox") @step("Update Infoblox")
def update_dns_records(subscription: GeantIPInactive) -> State: def update_dns_records(subscription: NRENL3CoreService) -> State:
"""Update :term:`DNS` records in Infoblox.""" """Update :term:`DNS` records in Infoblox."""
# TODO: implement # TODO: implement
return {"subscription": subscription} return {"subscription": subscription}
@workflow( @workflow(
"Create GÉANT IP", "Create NREN L3 Core Service",
initial_input_form=wrap_create_initial_input_form(initial_input_form_generator), initial_input_form=wrap_create_initial_input_form(initial_input_form_generator),
target=Target.CREATE, target=Target.CREATE,
) )
def create_geant_ip() -> StepList: def create_nren_l3_core_service() -> StepList:
"""Create a new GÉANT IP subscription. """Create a new :term:`NREN` L3 Core Service subscription including GÉANT IP and IAS.
* Create subscription object in the service database * Create subscription object in the service database
* Deploy service binding ports * Deploy service binding ports
......
...@@ -7,21 +7,21 @@ from orchestrator.workflows.steps import resync, store_process_subscription, uns ...@@ -7,21 +7,21 @@ from orchestrator.workflows.steps import resync, store_process_subscription, uns
from orchestrator.workflows.utils import wrap_modify_initial_input_form from orchestrator.workflows.utils import wrap_modify_initial_input_form
from gso.products import ProductName from gso.products import ProductName
from gso.products.product_types.nren_l3_core_service import GeantIP, ImportedGeantIP from gso.products.product_types.nren_l3_core_service import NRENL3CoreService, ImportedNRENL3CoreService
from gso.services.subscriptions import get_product_id_by_name from gso.services.subscriptions import get_product_id_by_name
@step("Create new IP trunk subscription") @step("Create new IP trunk subscription")
def import_geant_ip_subscription(subscription_id: UUIDstr) -> State: def import_geant_ip_subscription(subscription_id: UUIDstr) -> State:
"""Take an ImportedGeantIP subscription, and turn it into an GeantIP subscription.""" """Take an ImportedGeantIP subscription, and turn it into an GeantIP subscription."""
old_geant_ip = ImportedGeantIP.from_subscription(subscription_id) old_geant_ip = ImportedNRENL3CoreService.from_subscription(subscription_id)
new_subscription_id = get_product_id_by_name(ProductName.GEANT_IP) new_subscription_id = get_product_id_by_name(ProductName.GEANT_IP)
new_subscription = GeantIP.from_other_product(old_geant_ip, new_subscription_id) # type: ignore[arg-type] new_subscription = NRENL3CoreService.from_other_product(old_geant_ip, new_subscription_id) # type: ignore[arg-type]
return {"subscription": new_subscription} return {"subscription": new_subscription}
@workflow("Import GÉANT IP", target=Target.MODIFY, initial_input_form=wrap_modify_initial_input_form(None)) @workflow("Import GÉANT IP", target=Target.MODIFY, initial_input_form=wrap_modify_initial_input_form(None))
def import_geant_ip() -> StepList: def import_nren_l3_core_service() -> StepList:
"""Modify an ImportedGeantIP subscription into an GeantIP subscription to complete the import.""" """Modify an ImportedGeantIP subscription into an GeantIP subscription to complete the import."""
return init >> store_process_subscription(Target.MODIFY) >> unsync >> import_geant_ip_subscription >> resync >> done return init >> store_process_subscription(Target.MODIFY) >> unsync >> import_geant_ip_subscription >> resync >> done
...@@ -14,14 +14,14 @@ from pydantic_forms.types import FormGenerator, State, UUIDstr ...@@ -14,14 +14,14 @@ from pydantic_forms.types import FormGenerator, State, UUIDstr
from pydantic_forms.validators import Choice, Divider from pydantic_forms.validators import Choice, Divider
from gso.products.product_types.edge_port import EdgePort from gso.products.product_types.edge_port import EdgePort
from gso.products.product_types.nren_l3_core_service import GeantIP from gso.products.product_types.nren_l3_core_service import NRENL3CoreService
from gso.services.subscriptions import get_active_edge_port_subscriptions from gso.services.subscriptions import get_active_edge_port_subscriptions
from gso.utils.types.tt_number import TTNumber from gso.utils.types.tt_number import TTNumber
def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
"""Gather input from the operator on what new Edge Ports this GÉANT IP should migrate to.""" """Gather input from the operator on what new Edge Ports this GÉANT IP should migrate to."""
subscription = GeantIP.from_subscription(subscription_id) subscription = NRENL3CoreService.from_subscription(subscription_id)
partner_id = subscription.customer_id partner_id = subscription.customer_id
edge_port_count = len(subscription.geant_ip.geant_ip_ap_list) edge_port_count = len(subscription.geant_ip.geant_ip_ap_list)
...@@ -54,7 +54,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: ...@@ -54,7 +54,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
raise ValueError(msg) raise ValueError(msg)
return edge_ports return edge_ports
class GeantIPEdgePortSelectionForm(FormPage): class NRENL3CoreServiceEdgePortSelectionForm(FormPage):
model_config = ConfigDict(title="Migrating GÉANT IP to a new set of Edge Ports") model_config = ConfigDict(title="Migrating GÉANT IP to a new set of Edge Ports")
tt_number: TTNumber tt_number: TTNumber
...@@ -73,13 +73,13 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: ...@@ -73,13 +73,13 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
for ap in subscription.geant_ip.geant_ip_ap_list for ap in subscription.geant_ip.geant_ip_ap_list
] ]
ep_user_input = yield GeantIPEdgePortSelectionForm ep_user_input = yield NRENL3CoreServiceEdgePortSelectionForm
return {"subscription_id": subscription_id, "subscription": subscription} | ep_user_input.model_dump() return {"subscription_id": subscription_id, "subscription": subscription} | ep_user_input.model_dump()
@step("Update subscription model") @step("Update subscription model")
def update_subscription_model(subscription: GeantIP, edge_port_selection: list[dict]) -> State: def update_subscription_model(subscription: NRENL3CoreService, edge_port_selection: list[dict]) -> State:
"""Update the subscription model with the new list of Access Ports.""" """Update the subscription model with the new list of Access Ports."""
for index, selected_port in enumerate(edge_port_selection): for index, selected_port in enumerate(edge_port_selection):
subscription.geant_ip.geant_ip_ap_list[index].geant_ip_sbp.edge_port = EdgePort.from_subscription( subscription.geant_ip.geant_ip_ap_list[index].geant_ip_sbp.edge_port = EdgePort.from_subscription(
...@@ -94,6 +94,6 @@ def update_subscription_model(subscription: GeantIP, edge_port_selection: list[d ...@@ -94,6 +94,6 @@ def update_subscription_model(subscription: GeantIP, edge_port_selection: list[d
initial_input_form=wrap_modify_initial_input_form(initial_input_form_generator), initial_input_form=wrap_modify_initial_input_form(initial_input_form_generator),
target=Target.MODIFY, target=Target.MODIFY,
) )
def migrate_geant_ip() -> StepList: def migrate_nren_l3_core_service() -> StepList:
"""Migrate a GÉANT IP to a new set of Edge Ports.""" """Migrate a GÉANT IP to a new set of Edge Ports."""
return begin >> store_process_subscription(Target.MODIFY) >> unsync >> update_subscription_model >> resync >> done return begin >> store_process_subscription(Target.MODIFY) >> unsync >> update_subscription_model >> resync >> done
"""A modification workflow for a GÉANT IP subscription.""" """A modification workflow for a :term:`NREN` L3 Core Service subscription."""
from typing import Annotated, Any from typing import Annotated, Any
from uuid import uuid4 from uuid import uuid4
...@@ -18,7 +18,7 @@ from gso.products.product_blocks.bgp_session import BGPSession, IPFamily ...@@ -18,7 +18,7 @@ from gso.products.product_blocks.bgp_session import BGPSession, IPFamily
from gso.products.product_blocks.nren_l3_core_service import NRENAccessPort from gso.products.product_blocks.nren_l3_core_service import NRENAccessPort
from gso.products.product_blocks.service_binding_port import VLAN_ID, ServiceBindingPort from gso.products.product_blocks.service_binding_port import VLAN_ID, ServiceBindingPort
from gso.products.product_types.edge_port import EdgePort from gso.products.product_types.edge_port import EdgePort
from gso.products.product_types.nren_l3_core_service import GeantIP from gso.products.product_types.nren_l3_core_service import NRENL3CoreService
from gso.utils.helpers import active_edge_port_selector from gso.utils.helpers import active_edge_port_selector
from gso.utils.shared_enums import APType, SBPType from gso.utils.shared_enums import APType, SBPType
from gso.utils.types.ip_address import IPv4AddressType, IPV4Netmask, IPv6AddressType, IPV6Netmask from gso.utils.types.ip_address import IPv4AddressType, IPV4Netmask, IPv6AddressType, IPV6Netmask
...@@ -26,35 +26,36 @@ from gso.utils.types.ip_address import IPv4AddressType, IPV4Netmask, IPv6Address ...@@ -26,35 +26,36 @@ from gso.utils.types.ip_address import IPv4AddressType, IPV4Netmask, IPv6Address
def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
"""Get input about added, removed, and modified Access Ports.""" """Get input about added, removed, and modified Access Ports."""
subscription = GeantIP.from_subscription(subscription_id) subscription = NRENL3CoreService.from_subscription(subscription_id)
product_name = subscription.product.name
class AccessPortSelection(BaseModel): class AccessPortSelection(BaseModel):
geant_ip_ep: active_edge_port_selector(partner_id=subscription.customer_id) | str # type: ignore[valid-type] edge_port: active_edge_port_selector(partner_id=subscription.customer_id) | str # type: ignore[valid-type]
nren_ap_type: APType ap_type: APType
def validate_edge_ports_are_unique(access_ports: list[AccessPortSelection]) -> list[AccessPortSelection]: def validate_edge_ports_are_unique(access_ports: list[AccessPortSelection]) -> list[AccessPortSelection]:
"""Verify if interfaces are unique.""" """Verify if interfaces are unique."""
edge_ports = [str(port.geant_ip_ep) for port in access_ports] edge_ports = [str(port.edge_port) for port in access_ports]
if len(edge_ports) != len(set(edge_ports)): if len(edge_ports) != len(set(edge_ports)):
msg = "Edge Ports must be unique." msg = "Edge Ports must be unique."
raise ValueError(msg) raise ValueError(msg)
return access_ports return access_ports
class ModifyGeantIPAccessPortsForm(FormPage): class ModifyAccessPortsForm(FormPage):
model_config = ConfigDict(title="Modify GÉANT IP") model_config = ConfigDict(title=f"Modify {product_name}")
access_ports: Annotated[list[AccessPortSelection], AfterValidator(validate_edge_ports_are_unique)] = [ # noqa: RUF012 access_ports: Annotated[list[AccessPortSelection], AfterValidator(validate_edge_ports_are_unique)] = [ # noqa: RUF012
AccessPortSelection( AccessPortSelection(
geant_ip_ep=str(access_port.geant_ip_sbp.edge_port.owner_subscription_id), edge_port=str(access_port.sbp.edge_port.owner_subscription_id),
nren_ap_type=access_port.nren_ap_type, ap_type=access_port.ap_type,
) )
for access_port in subscription.geant_ip.geant_ip_ap_list for access_port in subscription.nren_l3_core_service.nren_ap_list
] ]
access_port_input = yield ModifyGeantIPAccessPortsForm access_port_input = yield ModifyAccessPortsForm
input_ap_list = access_port_input.access_ports input_ap_list = access_port_input.access_ports
input_ep_list = [str(ap.geant_ip_ep) for ap in input_ap_list] input_ep_list = [str(ap.edge_port) for ap in input_ap_list]
existing_ep_list = [ existing_ep_list = [
str(ap.geant_ip_sbp.edge_port.owner_subscription_id) for ap in subscription.geant_ip.geant_ip_ap_list str(ap.sbp.edge_port.owner_subscription_id) for ap in subscription.nren_l3_core_service.nren_ap_list
] ]
class BaseBGPPeer(BaseModel): class BaseBGPPeer(BaseModel):
...@@ -89,26 +90,26 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: ...@@ -89,26 +90,26 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
# modified. # modified.
removed_ap_list = [ removed_ap_list = [
access_port.subscription_instance_id access_port.subscription_instance_id
for access_port in subscription.geant_ip.geant_ip_ap_list for access_port in subscription.nren_l3_core_service.nren_ap_list
if str(access_port.geant_ip_sbp.edge_port.owner_subscription_id) not in input_ep_list if str(access_port.sbp.edge_port.owner_subscription_id) not in input_ep_list
] ]
modified_ap_list = [ modified_ap_list = [
( (
access_port, access_port,
next( next(
( (
ap.nren_ap_type ap.ap_type
for ap in input_ap_list for ap in input_ap_list
if str(ap.geant_ip_ep) == str(access_port.geant_ip_sbp.edge_port.owner_subscription_id) if str(ap.edge_port) == str(access_port.sbp.edge_port.owner_subscription_id)
), ),
None, None,
), ),
) )
for access_port in subscription.geant_ip.geant_ip_ap_list for access_port in subscription.nren_l3_core_service.nren_ap_list
if str(access_port.geant_ip_sbp.edge_port.owner_subscription_id) in input_ep_list if str(access_port.sbp.edge_port.owner_subscription_id) in input_ep_list
] ]
added_ap_list = [ added_ap_list = [
(ep, next(ap.nren_ap_type for ap in input_ap_list if str(ap.geant_ip_ep) == ep)) (ep, next(ap.ap_type for ap in input_ap_list if str(ap.edge_port) == ep))
for ep in input_ep_list for ep in input_ep_list
if ep not in existing_ep_list if ep not in existing_ep_list
] ]
...@@ -117,24 +118,25 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: ...@@ -117,24 +118,25 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
sbp_inputs = [] sbp_inputs = []
for access_port_index, ap_entry in enumerate(modified_ap_list): for access_port_index, ap_entry in enumerate(modified_ap_list):
access_port, new_ap_type = ap_entry access_port, new_ap_type = ap_entry
current_sbp = access_port.geant_ip_sbp current_sbp = access_port.sbp
v4_peer = next(peer for peer in current_sbp.sbp_bgp_session_list if IPFamily.V4UNICAST in peer.families) v4_peer = next(peer for peer in current_sbp.bgp_session_list if IPFamily.V4UNICAST in peer.families)
v6_peer = next(peer for peer in current_sbp.sbp_bgp_session_list if IPFamily.V6UNICAST in peer.families) v6_peer = next(peer for peer in current_sbp.bgp_session_list if IPFamily.V6UNICAST in peer.families)
class BindingPortModificationForm(FormPage): class BindingPortModificationForm(FormPage):
model_config = ConfigDict( model_config = ConfigDict(
title=f"GÉANT IP - Modify Edge Port configuration ({access_port_index + 1}/{len(input_ap_list)})" title=f"{product_name} - Modify Edge Port configuration "
f"({access_port_index + 1}/{len(input_ap_list)})"
) )
current_ep_label: Label = Field( current_ep_label: Label = Field(
f"Currently configuring on {access_port.geant_ip_sbp.edge_port.description} " f"Currently configuring on {access_port.sbp.edge_port.edge_port_description} "
f"(Access Port type: {access_port.nren_ap_type})", f"(Access Port type: {access_port.ap_type})",
exclude=True, exclude=True,
) )
geant_sid: str = current_sbp.geant_sid geant_sid: str = current_sbp.geant_sid
is_tagged: bool = current_sbp.is_tagged is_tagged: bool = current_sbp.is_tagged
# The SBP model doesn't require these three fields, but in the case of GÉANT IP this will never occur since # The SBP model doesn't require these three fields, but in the case of GÉANT IP OR IAS this will never
# it's a layer 3 service. The ignore statements are there to put our type checker at ease. # occur since it's a layer 3 service. The ignore statements are there to put our type checker at ease.
vlan_id: VLAN_ID = current_sbp.vlan_id # type: ignore[assignment] vlan_id: VLAN_ID = current_sbp.vlan_id # type: ignore[assignment]
ipv4_address: IPv4AddressType = current_sbp.ipv4_address # type: ignore[assignment] ipv4_address: IPv4AddressType = current_sbp.ipv4_address # type: ignore[assignment]
ipv4_mask: IPV4Netmask = current_sbp.ipv4_mask # type: ignore[assignment] ipv4_mask: IPV4Netmask = current_sbp.ipv4_mask # type: ignore[assignment]
...@@ -167,7 +169,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: ...@@ -167,7 +169,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
class BindingPortInputForm(FormPage): class BindingPortInputForm(FormPage):
model_config = ConfigDict( model_config = ConfigDict(
title=f"GÉANT IP - Configure new Edge Port " title=f"{product_name} - Configure new Edge Port "
f"({len(modified_ap_list) + ap_index + 1}/{len(input_ap_list)})" f"({len(modified_ap_list) + ap_index + 1}/{len(input_ap_list)})"
) )
info_label: Label = Field( info_label: Label = Field(
...@@ -210,11 +212,11 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: ...@@ -210,11 +212,11 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
@step("Clean up removed Edge Ports") @step("Clean up removed Edge Ports")
def remove_old_sbp_blocks(subscription: GeantIP, removed_access_ports: list[UUIDstr]) -> State: def remove_old_sbp_blocks(subscription: NRENL3CoreService, removed_access_ports: list[UUIDstr]) -> State:
"""Remove old :term:`SBP` product blocks from the GÉANT IP subscription.""" """Remove old :term:`SBP` product blocks from the GÉANT IP subscription."""
subscription.geant_ip.geant_ip_ap_list = [ subscription.nren_l3_core_service.nren_ap_list = [
ap ap
for ap in subscription.geant_ip.geant_ip_ap_list for ap in subscription.nren_l3_core_service.nren_ap_list
if str(ap.subscription_instance_id) not in removed_access_ports if str(ap.subscription_instance_id) not in removed_access_ports
] ]
...@@ -222,55 +224,55 @@ def remove_old_sbp_blocks(subscription: GeantIP, removed_access_ports: list[UUID ...@@ -222,55 +224,55 @@ def remove_old_sbp_blocks(subscription: GeantIP, removed_access_ports: list[UUID
@step("Modify existing Service Binding Ports") @step("Modify existing Service Binding Ports")
def modify_existing_sbp_blocks(subscription: GeantIP, modified_sbp_list: list[dict[str, Any]]) -> State: def modify_existing_sbp_blocks(subscription: NRENL3CoreService, modified_sbp_list: list[dict[str, Any]]) -> State:
"""Update the subscription model.""" """Update the subscription model."""
for access_port in subscription.geant_ip.geant_ip_ap_list: for access_port in subscription.nren_l3_core_service.nren_ap_list:
current_sbp = access_port.geant_ip_sbp current_sbp = access_port.sbp
modified_sbp_data = next( modified_sbp_data = next(
sbp for sbp in modified_sbp_list if sbp["current_sbp_id"] == str(current_sbp.subscription_instance_id) sbp for sbp in modified_sbp_list if sbp["current_sbp_id"] == str(current_sbp.subscription_instance_id)
) )
v4_peer = next(peer for peer in current_sbp.sbp_bgp_session_list if IPFamily.V4UNICAST in peer.families) v4_peer = next(peer for peer in current_sbp.bgp_session_list if IPFamily.V4UNICAST in peer.families)
for attribute in modified_sbp_data["v4_bgp_peer"]: for attribute in modified_sbp_data["v4_bgp_peer"]:
setattr(v4_peer, attribute, modified_sbp_data["v4_bgp_peer"][attribute]) setattr(v4_peer, attribute, modified_sbp_data["v4_bgp_peer"][attribute])
v6_peer = next(peer for peer in current_sbp.sbp_bgp_session_list if IPFamily.V6UNICAST in peer.families) v6_peer = next(peer for peer in current_sbp.bgp_session_list if IPFamily.V6UNICAST in peer.families)
for attribute in modified_sbp_data["v6_bgp_peer"]: for attribute in modified_sbp_data["v6_bgp_peer"]:
setattr(v6_peer, attribute, modified_sbp_data["v6_bgp_peer"][attribute]) setattr(v6_peer, attribute, modified_sbp_data["v6_bgp_peer"][attribute])
current_sbp.sbp_bgp_session_list = [v4_peer, v6_peer] current_sbp.bgp_session_list = [v4_peer, v6_peer]
current_sbp.vlan_id = modified_sbp_data["vlan_id"] current_sbp.vlan_id = modified_sbp_data["vlan_id"]
current_sbp.geant_sid = modified_sbp_data["geant_sid"] current_sbp.geant_sid = modified_sbp_data["geant_sid"]
current_sbp.is_tagged = modified_sbp_data["is_tagged"] current_sbp.is_tagged = modified_sbp_data["is_tagged"]
current_sbp.ipv4_address = modified_sbp_data["ipv4_address"] current_sbp.ipv4_address = modified_sbp_data["ipv4_address"]
current_sbp.ipv6_address = modified_sbp_data["ipv6_address"] current_sbp.ipv6_address = modified_sbp_data["ipv6_address"]
current_sbp.custom_firewall_filters = modified_sbp_data["custom_firewall_filters"] current_sbp.custom_firewall_filters = modified_sbp_data["custom_firewall_filters"]
access_port.nren_ap_type = modified_sbp_data["new_ap_type"] access_port.ap_type = modified_sbp_data["new_ap_type"]
return {"subscription": subscription} return {"subscription": subscription}
@step("Instantiate new Service Binding Ports") @step("Instantiate new Service Binding Ports")
def create_new_sbp_blocks(subscription: GeantIP, added_service_binding_ports: list[dict[str, Any]]) -> State: def create_new_sbp_blocks(subscription: NRENL3CoreService, added_service_binding_ports: list[dict[str, Any]]) -> State:
"""Add new :term:`SBP`s to the GÉANT IP subscription.""" """Add new :term:`SBP`s to the :term:`NREN` L3 Core Service subscription."""
for sbp_input in added_service_binding_ports: for sbp_input in added_service_binding_ports:
edge_port = EdgePort.from_subscription(sbp_input["edge_port_id"]) edge_port = EdgePort.from_subscription(sbp_input["edge_port_id"])
sbp_bgp_session_list = [ bgp_session_list = [
BGPSession.new(subscription_id=uuid4(), **session, rtbh_enabled=True, is_multi_hop=True) BGPSession.new(subscription_id=uuid4(), **session, rtbh_enabled=True, is_multi_hop=True)
for session in sbp_input["bgp_peers"] for session in sbp_input["bgp_peers"]
] ]
service_binding_port = ServiceBindingPort.new( service_binding_port = ServiceBindingPort.new(
subscription_id=uuid4(), subscription_id=uuid4(),
**sbp_input, **sbp_input,
sbp_bgp_session_list=sbp_bgp_session_list, bgp_session_list=bgp_session_list,
sbp_type=SBPType.L3, sbp_type=SBPType.L3,
edge_port=edge_port.edge_port, edge_port=edge_port.edge_port,
) )
subscription.geant_ip.geant_ip_ap_list.append( subscription.nren_l3_core_service.nren_ap_list.append(
NRENAccessPort.new( NRENAccessPort.new(
subscription_id=uuid4(), subscription_id=uuid4(),
nren_ap_type=sbp_input["ap_type"], ap_type=sbp_input["ap_type"],
geant_ip_sbp=service_binding_port, sbp=service_binding_port,
) )
) )
...@@ -278,12 +280,12 @@ def create_new_sbp_blocks(subscription: GeantIP, added_service_binding_ports: li ...@@ -278,12 +280,12 @@ def create_new_sbp_blocks(subscription: GeantIP, added_service_binding_ports: li
@workflow( @workflow(
"Modify GÉANT IP", "Modify :term:`NREN` L3 Core Service",
initial_input_form=wrap_modify_initial_input_form(initial_input_form_generator), initial_input_form=wrap_modify_initial_input_form(initial_input_form_generator),
target=Target.MODIFY, target=Target.MODIFY,
) )
def modify_geant_ip() -> StepList: def modify_nren_l3_core_service() -> StepList:
"""Modify a GÉANT IP subscription.""" """Modify a NRN L3 Core Service subscription."""
access_ports_are_removed = conditional(lambda state: bool(len(state["removed_access_ports"]) > 0)) access_ports_are_removed = conditional(lambda state: bool(len(state["removed_access_ports"]) > 0))
access_ports_are_modified = conditional(lambda state: bool(len(state["modified_sbp_list"]) > 0)) access_ports_are_modified = conditional(lambda state: bool(len(state["modified_sbp_list"]) > 0))
access_ports_are_added = conditional(lambda state: bool(len(state["added_service_binding_ports"]) > 0)) access_ports_are_added = conditional(lambda state: bool(len(state["added_service_binding_ports"]) > 0))
......
...@@ -4,7 +4,7 @@ import pytest ...@@ -4,7 +4,7 @@ import pytest
from orchestrator.types import SubscriptionLifecycle from orchestrator.types import SubscriptionLifecycle
from gso.products import ProductName from gso.products import ProductName
from gso.products.product_types.nren_l3_core_service import GeantIP from gso.products.product_types.nren_l3_core_service import NRENL3CoreService
from gso.services.subscriptions import get_product_id_by_name from gso.services.subscriptions import get_product_id_by_name
from gso.utils.shared_enums import APType from gso.utils.shared_enums import APType
from test.workflows import assert_complete, assert_lso_interaction_success, extract_state, run_workflow from test.workflows import assert_complete, assert_lso_interaction_success, extract_state, run_workflow
...@@ -69,7 +69,7 @@ def test_create_geant_ip_success( ...@@ -69,7 +69,7 @@ def test_create_geant_ip_success(
assert_complete(result) assert_complete(result)
state = extract_state(result) state = extract_state(result)
subscription = GeantIP.from_subscription(state["subscription_id"]) subscription = NRENL3CoreService.from_subscription(state["subscription_id"])
assert mock_lso_client.call_count == lso_interaction_count assert mock_lso_client.call_count == lso_interaction_count
assert subscription.status == SubscriptionLifecycle.ACTIVE assert subscription.status == SubscriptionLifecycle.ACTIVE
assert len(subscription.geant_ip.geant_ip_ap_list) == 1 assert len(subscription.geant_ip.geant_ip_ap_list) == 1
......
import pytest import pytest
from orchestrator.types import SubscriptionLifecycle from orchestrator.types import SubscriptionLifecycle
from gso.products import ImportedGeantIP from gso.products import ImportedNRENL3CoreService
from gso.products.product_blocks.bgp_session import IPFamily from gso.products.product_blocks.bgp_session import IPFamily
from gso.utils.shared_enums import SBPType from gso.utils.shared_enums import SBPType
from test.workflows import assert_complete, extract_state, run_workflow from test.workflows import assert_complete, extract_state, run_workflow
...@@ -62,6 +62,6 @@ def imported_geant_ip_creation_input_form_data(edge_port_subscription_factory, p ...@@ -62,6 +62,6 @@ def imported_geant_ip_creation_input_form_data(edge_port_subscription_factory, p
def test_create_imported_geant_ip_success(faker, imported_geant_ip_creation_input_form_data): def test_create_imported_geant_ip_success(faker, imported_geant_ip_creation_input_form_data):
result, _, _ = run_workflow("create_imported_geant_ip", [imported_geant_ip_creation_input_form_data]) result, _, _ = run_workflow("create_imported_geant_ip", [imported_geant_ip_creation_input_form_data])
state = extract_state(result) state = extract_state(result)
subscription = ImportedGeantIP.from_subscription(state["subscription_id"]) subscription = ImportedNRENL3CoreService.from_subscription(state["subscription_id"])
assert_complete(result) assert_complete(result)
assert subscription.status == SubscriptionLifecycle.ACTIVE assert subscription.status == SubscriptionLifecycle.ACTIVE
import pytest import pytest
from orchestrator.types import SubscriptionLifecycle from orchestrator.types import SubscriptionLifecycle
from gso.products import GeantIP, ProductName from gso.products import NRENL3CoreService, ProductName
from test.workflows import assert_complete, run_workflow from test.workflows import assert_complete, run_workflow
...@@ -9,7 +9,7 @@ from test.workflows import assert_complete, run_workflow ...@@ -9,7 +9,7 @@ from test.workflows import assert_complete, run_workflow
def test_import_edge_port_success(geant_ip_subscription_factory): def test_import_edge_port_success(geant_ip_subscription_factory):
imported_geant_ip = geant_ip_subscription_factory(is_imported=False) imported_geant_ip = geant_ip_subscription_factory(is_imported=False)
result, _, _ = run_workflow("import_geant_ip", [{"subscription_id": imported_geant_ip}]) result, _, _ = run_workflow("import_geant_ip", [{"subscription_id": imported_geant_ip}])
subscription = GeantIP.from_subscription(imported_geant_ip) subscription = NRENL3CoreService.from_subscription(imported_geant_ip)
assert_complete(result) assert_complete(result)
assert subscription.product.name == ProductName.GEANT_IP assert subscription.product.name == ProductName.GEANT_IP
......
import pytest import pytest
from gso.products.product_types.nren_l3_core_service import GeantIP from gso.products.product_types.nren_l3_core_service import NRENL3CoreService
from test.workflows import assert_complete, extract_state, run_workflow from test.workflows import assert_complete, extract_state, run_workflow
...@@ -12,7 +12,7 @@ def test_migrate_geant_ip_success( ...@@ -12,7 +12,7 @@ def test_migrate_geant_ip_success(
subscription_id = geant_ip_subscription_factory(partner=partner) subscription_id = geant_ip_subscription_factory(partner=partner)
new_edge_port_1 = edge_port_subscription_factory(partner=partner) new_edge_port_1 = edge_port_subscription_factory(partner=partner)
new_edge_port_2 = edge_port_subscription_factory(partner=partner) new_edge_port_2 = edge_port_subscription_factory(partner=partner)
subscription = GeantIP.from_subscription(subscription_id) subscription = NRENL3CoreService.from_subscription(subscription_id)
form_input_data = [ form_input_data = [
{"subscription_id": subscription_id}, {"subscription_id": subscription_id},
...@@ -35,7 +35,7 @@ def test_migrate_geant_ip_success( ...@@ -35,7 +35,7 @@ def test_migrate_geant_ip_success(
assert_complete(result) assert_complete(result)
state = extract_state(result) state = extract_state(result)
subscription = GeantIP.from_subscription(state["subscription_id"]) subscription = NRENL3CoreService.from_subscription(state["subscription_id"])
assert subscription.insync assert subscription.insync
assert len(subscription.geant_ip.geant_ip_ap_list) == 2 assert len(subscription.geant_ip.geant_ip_ap_list) == 2
assert ( assert (
......
import pytest import pytest
from gso.products.product_blocks.bgp_session import IPFamily from gso.products.product_blocks.bgp_session import IPFamily
from gso.products.product_types.nren_l3_core_service import GeantIP from gso.products.product_types.nren_l3_core_service import NRENL3CoreService
from gso.utils.shared_enums import APType from gso.utils.shared_enums import APType
from test.workflows import extract_state, run_workflow from test.workflows import extract_state, run_workflow
...@@ -9,7 +9,7 @@ from test.workflows import extract_state, run_workflow ...@@ -9,7 +9,7 @@ from test.workflows import extract_state, run_workflow
@pytest.mark.workflow() @pytest.mark.workflow()
def test_modify_geant_ip_remove_edge_port_success(geant_ip_subscription_factory): def test_modify_geant_ip_remove_edge_port_success(geant_ip_subscription_factory):
subscription_id = geant_ip_subscription_factory() subscription_id = geant_ip_subscription_factory()
subscription = GeantIP.from_subscription(subscription_id) subscription = NRENL3CoreService.from_subscription(subscription_id)
access_port = subscription.geant_ip.geant_ip_ap_list[0] access_port = subscription.geant_ip.geant_ip_ap_list[0]
input_form_data = [ input_form_data = [
{"subscription_id": subscription_id}, {"subscription_id": subscription_id},
...@@ -27,7 +27,7 @@ def test_modify_geant_ip_remove_edge_port_success(geant_ip_subscription_factory) ...@@ -27,7 +27,7 @@ def test_modify_geant_ip_remove_edge_port_success(geant_ip_subscription_factory)
result, _, _ = run_workflow("modify_geant_ip", input_form_data) result, _, _ = run_workflow("modify_geant_ip", input_form_data)
state = extract_state(result) state = extract_state(result)
subscription = GeantIP.from_subscription(state["subscription_id"]) subscription = NRENL3CoreService.from_subscription(state["subscription_id"])
assert len(subscription.geant_ip.geant_ip_ap_list) == 1 assert len(subscription.geant_ip.geant_ip_ap_list) == 1
assert subscription.geant_ip.geant_ip_ap_list[0].nren_ap_type == APType.LOAD_BALANCED assert subscription.geant_ip.geant_ip_ap_list[0].nren_ap_type == APType.LOAD_BALANCED
...@@ -39,7 +39,7 @@ def test_modify_geant_ip_add_new_edge_port_success( ...@@ -39,7 +39,7 @@ def test_modify_geant_ip_add_new_edge_port_success(
partner = partner_factory() partner = partner_factory()
new_edge_port = edge_port_subscription_factory(partner=partner) new_edge_port = edge_port_subscription_factory(partner=partner)
subscription_id = geant_ip_subscription_factory(partner=partner) subscription_id = geant_ip_subscription_factory(partner=partner)
subscription = GeantIP.from_subscription(subscription_id) subscription = NRENL3CoreService.from_subscription(subscription_id)
input_form_data = [ input_form_data = [
{"subscription_id": subscription_id}, {"subscription_id": subscription_id},
{ {
...@@ -78,14 +78,14 @@ def test_modify_geant_ip_add_new_edge_port_success( ...@@ -78,14 +78,14 @@ def test_modify_geant_ip_add_new_edge_port_success(
result, _, _ = run_workflow("modify_geant_ip", input_form_data) result, _, _ = run_workflow("modify_geant_ip", input_form_data)
state = extract_state(result) state = extract_state(result)
subscription = GeantIP.from_subscription(state["subscription_id"]) subscription = NRENL3CoreService.from_subscription(state["subscription_id"])
assert len(subscription.geant_ip.geant_ip_ap_list) == 3 assert len(subscription.geant_ip.geant_ip_ap_list) == 3
@pytest.mark.workflow() @pytest.mark.workflow()
def test_modify_geant_ip_modify_edge_port_success(faker, geant_ip_subscription_factory): def test_modify_geant_ip_modify_edge_port_success(faker, geant_ip_subscription_factory):
subscription_id = geant_ip_subscription_factory() subscription_id = geant_ip_subscription_factory()
subscription = GeantIP.from_subscription(subscription_id) subscription = NRENL3CoreService.from_subscription(subscription_id)
new_sbp_data = [ new_sbp_data = [
{ {
"geant_sid": faker.geant_sid(), "geant_sid": faker.geant_sid(),
...@@ -171,7 +171,7 @@ def test_modify_geant_ip_modify_edge_port_success(faker, geant_ip_subscription_f ...@@ -171,7 +171,7 @@ def test_modify_geant_ip_modify_edge_port_success(faker, geant_ip_subscription_f
result, _, _ = run_workflow("modify_geant_ip", input_form_data) result, _, _ = run_workflow("modify_geant_ip", input_form_data)
state = extract_state(result) state = extract_state(result)
subscription = GeantIP.from_subscription(state["subscription_id"]) subscription = NRENL3CoreService.from_subscription(state["subscription_id"])
assert len(subscription.geant_ip.geant_ip_ap_list) == 2 assert len(subscription.geant_ip.geant_ip_ap_list) == 2
for i in range(2): for i in range(2):
......
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