Skip to content
Snippets Groups Projects
Commit db2198aa authored by Carlos Manso's avatar Carlos Manso
Browse files

Merge branch 'develop' of https://labs.etsi.org/rep/tfs/controller into...

Merge branch 'develop' of https://labs.etsi.org/rep/tfs/controller into feat/147-integrate-support-for-ip-e2e-optical-sdn-controllers-to-manage-hierarchical-virtual
parents 7a509524 acdeb35a
No related branches found
No related tags found
2 merge requests!294Release TeraFlowSDN 4.0,!225Resolve "Integrate Support for IP-E2E-Optical SDN controllers to manage hierarchical virtual topologies"
#!/bin/bash
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......
......@@ -143,49 +143,49 @@ def test_configure(drivers : Dict[str, OpenConfigDriver]):
#results_getconfig = driver.GetConfig(resources_to_get)
#LOGGER.info('results_getconfig = {:s}'.format(str(results_getconfig)))
#csgw1_resources_to_set = [
# network_instance('ecoc24', 'L3VRF', '192.168.150.1', '65001:1'),
# network_instance_add_protocol_direct('ecoc24', 'L3VRF'),
# network_instance_add_protocol_static('ecoc24', 'L3VRF'),
# network_instance_add_protocol_bgp('ecoc24', 'L3VRF', '192.168.150.1', '65001', neighbors=[
# ('192.168.150.2', '65001')
# ]),
# network_instance_add_table_connection('ecoc24', 'DIRECTLY_CONNECTED', 'BGP', 'IPV4', 'ACCEPT_ROUTE', bgp_as='65001'),
# network_instance_add_table_connection('ecoc24', 'STATIC', 'BGP', 'IPV4', 'ACCEPT_ROUTE', bgp_as='65001'),
#
# interface('ce1', 0, if_type='ethernetCsmacd', mtu=1500),
# network_instance_interface('ecoc24', 'L3VRF', 'ce1', 0),
# interface('ce1', 0, if_type='ethernetCsmacd', mtu=1500, ipv4_address_prefix=('192.168.10.1', 24), enabled=True),
#
# interface('xe5', 0, if_type='ethernetCsmacd', mtu=1500),
# network_instance_interface('ecoc24', 'L3VRF', 'xe5', 0),
# interface('xe5', 0, if_type='ethernetCsmacd', mtu=1500, ipv4_address_prefix=('192.168.150.1', 24), enabled=True),
#]
#LOGGER.info('CSGW1 resources_to_set = {:s}'.format(str(csgw1_resources_to_set)))
#results_setconfig = drivers['CSGW1'].SetConfig(csgw1_resources_to_set)
#LOGGER.info('CSGW1 results_setconfig = {:s}'.format(str(results_setconfig)))
#csgw2_resources_to_set = [
# network_instance('ecoc24', 'L3VRF', '192.168.150.2', '65001:1'),
# network_instance_add_protocol_direct('ecoc24', 'L3VRF'),
# network_instance_add_protocol_static('ecoc24', 'L3VRF'),
# network_instance_add_protocol_bgp('ecoc24', 'L3VRF', '192.168.150.2', '65001', neighbors=[
# ('192.168.150.1', '65001')
# ]),
# network_instance_add_table_connection('ecoc24', 'DIRECTLY_CONNECTED', 'BGP', 'IPV4', 'ACCEPT_ROUTE', bgp_as='65001'),
# network_instance_add_table_connection('ecoc24', 'STATIC', 'BGP', 'IPV4', 'ACCEPT_ROUTE', bgp_as='65001'),
#
# interface('ce1', 0, if_type='ethernetCsmacd', mtu=1500),
# network_instance_interface('ecoc24', 'L3VRF', 'ce1', 0),
# interface('ce1', 0, if_type='ethernetCsmacd', mtu=1500, ipv4_address_prefix=('192.168.20.1', 24), enabled=True),
#
# interface('xe5', 0, if_type='ethernetCsmacd', mtu=1500),
# network_instance_interface('ecoc24', 'L3VRF', 'xe5', 0),
# interface('xe5', 0, if_type='ethernetCsmacd', mtu=1500, ipv4_address_prefix=('192.168.150.2', 24), enabled=True),
#]
#LOGGER.info('CSGW2 resources_to_set = {:s}'.format(str(csgw2_resources_to_set)))
#results_setconfig = drivers['CSGW2'].SetConfig(csgw2_resources_to_set)
#LOGGER.info('CSGW2 results_setconfig = {:s}'.format(str(results_setconfig)))
csgw1_resources_to_set = [
network_instance('ecoc24', 'L3VRF', '192.168.150.1', '65001:1'),
network_instance_add_protocol_direct('ecoc24', 'L3VRF'),
network_instance_add_protocol_static('ecoc24', 'L3VRF'),
network_instance_add_protocol_bgp('ecoc24', 'L3VRF', '192.168.150.1', '65001', neighbors=[
('192.168.150.2', '65001')
]),
network_instance_add_table_connection('ecoc24', 'DIRECTLY_CONNECTED', 'BGP', 'IPV4', 'ACCEPT_ROUTE', bgp_as='65001'),
network_instance_add_table_connection('ecoc24', 'STATIC', 'BGP', 'IPV4', 'ACCEPT_ROUTE', bgp_as='65001'),
interface('ce1', 0, if_type='ethernetCsmacd', mtu=1500),
network_instance_interface('ecoc24', 'L3VRF', 'ce1', 0),
interface('ce1', 0, if_type='ethernetCsmacd', mtu=1500, ipv4_address_prefix=('192.168.10.1', 24), enabled=True),
interface('xe5', 0, if_type='ethernetCsmacd', mtu=1500),
network_instance_interface('ecoc24', 'L3VRF', 'xe5', 0),
interface('xe5', 0, if_type='ethernetCsmacd', mtu=1500, ipv4_address_prefix=('192.168.150.1', 24), enabled=True),
]
LOGGER.info('CSGW1 resources_to_set = {:s}'.format(str(csgw1_resources_to_set)))
results_setconfig = drivers['CSGW1'].SetConfig(csgw1_resources_to_set)
LOGGER.info('CSGW1 results_setconfig = {:s}'.format(str(results_setconfig)))
csgw2_resources_to_set = [
network_instance('ecoc24', 'L3VRF', '192.168.150.2', '65001:1'),
network_instance_add_protocol_direct('ecoc24', 'L3VRF'),
network_instance_add_protocol_static('ecoc24', 'L3VRF'),
network_instance_add_protocol_bgp('ecoc24', 'L3VRF', '192.168.150.2', '65001', neighbors=[
('192.168.150.1', '65001')
]),
network_instance_add_table_connection('ecoc24', 'DIRECTLY_CONNECTED', 'BGP', 'IPV4', 'ACCEPT_ROUTE', bgp_as='65001'),
network_instance_add_table_connection('ecoc24', 'STATIC', 'BGP', 'IPV4', 'ACCEPT_ROUTE', bgp_as='65001'),
interface('ce1', 0, if_type='ethernetCsmacd', mtu=1500),
network_instance_interface('ecoc24', 'L3VRF', 'ce1', 0),
interface('ce1', 0, if_type='ethernetCsmacd', mtu=1500, ipv4_address_prefix=('192.168.20.1', 24), enabled=True),
interface('xe5', 0, if_type='ethernetCsmacd', mtu=1500),
network_instance_interface('ecoc24', 'L3VRF', 'xe5', 0),
interface('xe5', 0, if_type='ethernetCsmacd', mtu=1500, ipv4_address_prefix=('192.168.150.2', 24), enabled=True),
]
LOGGER.info('CSGW2 resources_to_set = {:s}'.format(str(csgw2_resources_to_set)))
results_setconfig = drivers['CSGW2'].SetConfig(csgw2_resources_to_set)
LOGGER.info('CSGW2 results_setconfig = {:s}'.format(str(results_setconfig)))
csgw1_resources_to_delete = [
network_instance_interface('ecoc24', 'L3VRF', 'ce1', 0),
......@@ -198,13 +198,13 @@ def test_configure(drivers : Dict[str, OpenConfigDriver]):
results_deleteconfig = drivers['CSGW1'].DeleteConfig(csgw1_resources_to_delete)
LOGGER.info('CSGW1 results_deleteconfig = {:s}'.format(str(results_deleteconfig)))
#csgw2_resources_to_delete = [
# network_instance_interface('ecoc24', 'L3VRF', 'ce1', 0),
# network_instance_interface('ecoc24', 'L3VRF', 'xe5', 0),
# #interface('ce1', 0),
# #interface('xe5', 0),
# network_instance('ecoc24', 'L3VRF'),
#]
#LOGGER.info('CSGW2 resources_to_delete = {:s}'.format(str(csgw2_resources_to_delete)))
#results_deleteconfig = drivers['CSGW2'].DeleteConfig(csgw2_resources_to_delete)
#LOGGER.info('CSGW2 results_deleteconfig = {:s}'.format(str(results_deleteconfig)))
csgw2_resources_to_delete = [
network_instance_interface('ecoc24', 'L3VRF', 'ce1', 0),
network_instance_interface('ecoc24', 'L3VRF', 'xe5', 0),
#interface('ce1', 0),
#interface('xe5', 0),
network_instance('ecoc24', 'L3VRF'),
]
LOGGER.info('CSGW2 resources_to_delete = {:s}'.format(str(csgw2_resources_to_delete)))
results_deleteconfig = drivers['CSGW2'].DeleteConfig(csgw2_resources_to_delete)
LOGGER.info('CSGW2 results_deleteconfig = {:s}'.format(str(results_deleteconfig)))
......@@ -12,10 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import Dict, List, Tuple
from typing import Any, Dict, List, Optional, Tuple
from common.tools.object_factory.ConfigRule import json_config_rule_delete, json_config_rule_set
from service.service.service_handler_api.AnyTreeTools import TreeNode
def get_value(field_name : str, *containers, default=None) -> Optional[Any]:
if len(containers) == 0: raise Exception('No containers specified')
for container in containers:
if field_name not in container: continue
return container[field_name]
return default
def setup_config_rules(
service_uuid : str, connection_uuid : str, device_uuid : str, endpoint_uuid : str, endpoint_name : str,
service_settings : TreeNode, device_settings : TreeNode, endpoint_settings : TreeNode, endpoint_acls : List [Tuple]
......@@ -29,9 +36,11 @@ def setup_config_rules(
json_device_settings : Dict = device_settings.value
json_endpoint_settings : Dict = endpoint_settings.value
mtu = json_settings.get('mtu', 1450 ) # 1512
settings = (json_settings, json_endpoint_settings, json_device_settings)
mtu = get_value('mtu', *settings, default=1450) # 1512
#address_families = json_settings.get('address_families', [] ) # ['IPV4']
bgp_as = json_settings.get('bgp_as', 65000 ) # 65000
bgp_as = get_value('bgp_as', *settings, default=65000) # 65000
router_id = json_endpoint_settings.get('router_id', '0.0.0.0') # '10.95.0.10'
route_distinguisher = json_settings.get('route_distinguisher', '65000:101' ) # '60001:801'
......@@ -199,21 +208,23 @@ def teardown_config_rules(
) -> List[Dict]:
if service_settings is None: return []
if device_settings is None: return []
if device_settings is None: return []
if endpoint_settings is None: return []
json_settings : Dict = service_settings.value
json_device_settings : Dict = device_settings.value
json_endpoint_settings : Dict = endpoint_settings.value
settings = (json_settings, json_endpoint_settings, json_device_settings)
service_short_uuid = service_uuid.split('-')[-1]
network_instance_name = '{:s}-NetInst'.format(service_short_uuid)
#network_interface_desc = '{:s}-NetIf'.format(service_uuid)
#network_subinterface_desc = '{:s}-NetSubIf'.format(service_uuid)
#mtu = json_settings.get('mtu', 1450 ) # 1512
#mtu = get_value('mtu', *settings, default=1450) # 1512
#address_families = json_settings.get('address_families', [] ) # ['IPV4']
#bgp_as = json_settings.get('bgp_as', 65000 ) # 65000
#bgp_as = get_value('bgp_as', *settings, default=65000) # 65000
route_distinguisher = json_settings.get('route_distinguisher', '0:0' ) # '60001:801'
#sub_interface_index = json_endpoint_settings.get('sub_interface_index', 0 ) # 1
#router_id = json_endpoint_settings.get('router_id', '0.0.0.0') # '10.95.0.10'
......
......@@ -22,12 +22,12 @@ def setup_config_rules(
) -> List[Dict]:
if service_settings is None: return []
if device_settings is None: return []
if endpoint_settings is None: return []
if device_settings is None: return []
json_settings : Dict = service_settings.value
json_endpoint_settings : Dict = endpoint_settings.value
json_device_settings : Dict = device_settings.value
json_endpoint_settings : Dict = endpoint_settings.value
mtu = json_settings.get('mtu', 1450 ) # 1512
#address_families = json_settings.get('address_families', [] ) # ['IPV4']
......@@ -233,12 +233,12 @@ def teardown_config_rules(
) -> List[Dict]:
if service_settings is None: return []
if device_settings is None: return []
if endpoint_settings is None: return []
if device_settings is None: return []
json_settings : Dict = service_settings.value
json_endpoint_settings : Dict = endpoint_settings.value
json_device_settings : Dict = device_settings.value
json_endpoint_settings : Dict = endpoint_settings.value
service_short_uuid = service_uuid.split('-')[-1]
# network_instance_name = '{:s}-NetInst'.format(service_short_uuid)
......
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