Loading src/Constants.py +4 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ import logging, os, json # Default logging level DEFAULT_LOGGING_LEVEL = logging.DEBUG DEFAULT_LOGGING_LEVEL = logging.INFO # Default port for NSC deployment NSC_PORT = 8081 Loading Loading @@ -47,9 +47,11 @@ PCE_EXTERNAL = False # Controller Flags # If True, config is not sent to controllers DUMMY_MODE = True DUMMY_MODE = False # Teraflow IP TFS_IP = ips.get('TFS_IP') UPLOAD_TYPE = "NBI" # "WEBUI" or "NBI" NBI_L2_PATH = "restconf/data/ietf-l2vpn-svc:l2vpn-svc/vpn-services" # Flag to determine if additional L2VPN configuration support is required for deploying L2VPNs with path selection TFS_L2VPN_SUPPORT = False # IXIA NEII IP Loading src/helpers.py +17 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ logging.basicConfig( #Teraflow class tfs_connector(): def simple_post(self, tfs_ip, service): def webui_post(self, tfs_ip, service): user="admin" password="admin" token="" Loading @@ -46,6 +46,22 @@ class tfs_connector(): logging.debug("Http response: %s",response.text) return response def nbi_post(self, tfs_ip, service, path): token="" user="admin" password="admin" token="" session = requests.Session() session.auth = (user, password) url = f'http://{tfs_ip}/{path}' headers = {'Content-Type': 'application/json'} data = json.dumps(service) logging.debug("Posting to TFS NBI: %s",data) token={'csrf_token':token} response = session.post(url,headers=headers,data=data,timeout=60) logging.debug("Http response: %s",response.text) return response #CISCO class cisco_connector(): def __init__(self, address, configs=None): Loading src/network_slice_controller.py +7 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ import json, time, os, logging, uuid, traceback, sys from datetime import datetime from src.helpers import tfs_connector, cisco_connector from src.Constants import DEFAULT_LOGGING_LEVEL, TFS_IP, TFS_L2VPN_SUPPORT, IXIA_IP, SRC_PATH, TEMPLATES_PATH, DUMMY_MODE, DUMP_TEMPLATES, PLANNER_ENABLED, NRP_ENABLED from src.Constants import DEFAULT_LOGGING_LEVEL, TFS_IP, TFS_L2VPN_SUPPORT, IXIA_IP, SRC_PATH, TEMPLATES_PATH, DUMMY_MODE, DUMP_TEMPLATES, PLANNER_ENABLED, NRP_ENABLED, UPLOAD_TYPE, NBI_L2_PATH from src.realizers.ixia.NEII_V4 import NEII_controller from src.planner.planner import Planner Loading @@ -42,7 +42,7 @@ class NSController: - Slice Realization: Convert intents to specific network configurations (L2VPN, L3VPN) """ def __init__(self, controller_type = "TFS", tfs_ip=TFS_IP, ixia_ip =IXIA_IP, need_l2vpn_support=TFS_L2VPN_SUPPORT): def __init__(self, controller_type = "TFS", tfs_ip=TFS_IP, ixia_ip =IXIA_IP, need_l2vpn_support=TFS_L2VPN_SUPPORT, path=NBI_L2_PATH): """ Initialize the Network Slice Controller. Loading @@ -61,6 +61,7 @@ class NSController: """ self.controller_type = controller_type self.tfs_ip = tfs_ip self.path = path self.answer = {} self.cool_answer = {} self.start_time = 0 Loading Loading @@ -298,7 +299,10 @@ class NSController: # Optional: Upload template to Teraflow if not DUMMY_MODE: if self.controller_type == "TFS": response = tfs_connector().simple_post(self.tfs_ip, requests) if UPLOAD_TYPE == "WEBUI": response = tfs_connector().webui_post(self.tfs_ip, requests) elif UPLOAD_TYPE == "NBI": response = tfs_connector().nbi_post(self.tfs_ip, requests, self.path) if not response.ok: return self.__send_response(False, code=response.status_code, message=f"Teraflow upload failed. Response: {response.text}") Loading src/templates/ietfL2VPN_template.json +31 −35 Original line number Diff line number Diff line { "l2vpn": { "vpn-services": { "vpn-service": [ "ietf-l2vpn-svc:vpn-service": [ { "vpn-id": 100, "name": "VPN_L2_Example", "vpn-type": "point-to-point", "vpn-id": "11327140-7361-41b3-aa45-e84a7fb40be9", "customer-name": "osm", "vpn-svc-type": "vpws", "svc-topo": "any-to-any", "site": [ { "site-id": 1, "site-id": "1.1.1.1", "site-role": "hub", "site-location": "R4", "site-location": "CU-N2", "site-network-access": { "interface": { "ip-address": "4.4.4.4", "ip-address": "10.60.11.3", "encapsulation": "ethernet" } } }, { "site-id": 2, "site-id": "3.3.3.3", "site-role": "spoke", "site-location": "R5", "site-location": "AMF-N2", "site-network-access": { "interface": { "ip-address": "5.5.5.5", "ip-address": "10.60.60.105", "encapsulation": "ethernet" } } Loading @@ -33,6 +32,3 @@ } ] } } } No newline at end of file Loading
src/Constants.py +4 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ import logging, os, json # Default logging level DEFAULT_LOGGING_LEVEL = logging.DEBUG DEFAULT_LOGGING_LEVEL = logging.INFO # Default port for NSC deployment NSC_PORT = 8081 Loading Loading @@ -47,9 +47,11 @@ PCE_EXTERNAL = False # Controller Flags # If True, config is not sent to controllers DUMMY_MODE = True DUMMY_MODE = False # Teraflow IP TFS_IP = ips.get('TFS_IP') UPLOAD_TYPE = "NBI" # "WEBUI" or "NBI" NBI_L2_PATH = "restconf/data/ietf-l2vpn-svc:l2vpn-svc/vpn-services" # Flag to determine if additional L2VPN configuration support is required for deploying L2VPNs with path selection TFS_L2VPN_SUPPORT = False # IXIA NEII IP Loading
src/helpers.py +17 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ logging.basicConfig( #Teraflow class tfs_connector(): def simple_post(self, tfs_ip, service): def webui_post(self, tfs_ip, service): user="admin" password="admin" token="" Loading @@ -46,6 +46,22 @@ class tfs_connector(): logging.debug("Http response: %s",response.text) return response def nbi_post(self, tfs_ip, service, path): token="" user="admin" password="admin" token="" session = requests.Session() session.auth = (user, password) url = f'http://{tfs_ip}/{path}' headers = {'Content-Type': 'application/json'} data = json.dumps(service) logging.debug("Posting to TFS NBI: %s",data) token={'csrf_token':token} response = session.post(url,headers=headers,data=data,timeout=60) logging.debug("Http response: %s",response.text) return response #CISCO class cisco_connector(): def __init__(self, address, configs=None): Loading
src/network_slice_controller.py +7 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ import json, time, os, logging, uuid, traceback, sys from datetime import datetime from src.helpers import tfs_connector, cisco_connector from src.Constants import DEFAULT_LOGGING_LEVEL, TFS_IP, TFS_L2VPN_SUPPORT, IXIA_IP, SRC_PATH, TEMPLATES_PATH, DUMMY_MODE, DUMP_TEMPLATES, PLANNER_ENABLED, NRP_ENABLED from src.Constants import DEFAULT_LOGGING_LEVEL, TFS_IP, TFS_L2VPN_SUPPORT, IXIA_IP, SRC_PATH, TEMPLATES_PATH, DUMMY_MODE, DUMP_TEMPLATES, PLANNER_ENABLED, NRP_ENABLED, UPLOAD_TYPE, NBI_L2_PATH from src.realizers.ixia.NEII_V4 import NEII_controller from src.planner.planner import Planner Loading @@ -42,7 +42,7 @@ class NSController: - Slice Realization: Convert intents to specific network configurations (L2VPN, L3VPN) """ def __init__(self, controller_type = "TFS", tfs_ip=TFS_IP, ixia_ip =IXIA_IP, need_l2vpn_support=TFS_L2VPN_SUPPORT): def __init__(self, controller_type = "TFS", tfs_ip=TFS_IP, ixia_ip =IXIA_IP, need_l2vpn_support=TFS_L2VPN_SUPPORT, path=NBI_L2_PATH): """ Initialize the Network Slice Controller. Loading @@ -61,6 +61,7 @@ class NSController: """ self.controller_type = controller_type self.tfs_ip = tfs_ip self.path = path self.answer = {} self.cool_answer = {} self.start_time = 0 Loading Loading @@ -298,7 +299,10 @@ class NSController: # Optional: Upload template to Teraflow if not DUMMY_MODE: if self.controller_type == "TFS": response = tfs_connector().simple_post(self.tfs_ip, requests) if UPLOAD_TYPE == "WEBUI": response = tfs_connector().webui_post(self.tfs_ip, requests) elif UPLOAD_TYPE == "NBI": response = tfs_connector().nbi_post(self.tfs_ip, requests, self.path) if not response.ok: return self.__send_response(False, code=response.status_code, message=f"Teraflow upload failed. Response: {response.text}") Loading
src/templates/ietfL2VPN_template.json +31 −35 Original line number Diff line number Diff line { "l2vpn": { "vpn-services": { "vpn-service": [ "ietf-l2vpn-svc:vpn-service": [ { "vpn-id": 100, "name": "VPN_L2_Example", "vpn-type": "point-to-point", "vpn-id": "11327140-7361-41b3-aa45-e84a7fb40be9", "customer-name": "osm", "vpn-svc-type": "vpws", "svc-topo": "any-to-any", "site": [ { "site-id": 1, "site-id": "1.1.1.1", "site-role": "hub", "site-location": "R4", "site-location": "CU-N2", "site-network-access": { "interface": { "ip-address": "4.4.4.4", "ip-address": "10.60.11.3", "encapsulation": "ethernet" } } }, { "site-id": 2, "site-id": "3.3.3.3", "site-role": "spoke", "site-location": "R5", "site-location": "AMF-N2", "site-network-access": { "interface": { "ip-address": "5.5.5.5", "ip-address": "10.60.60.105", "encapsulation": "ethernet" } } Loading @@ -33,6 +32,3 @@ } ] } } } No newline at end of file