Commit 7f24267c authored by rahhal's avatar rahhal Committed by Javier Velázquez
Browse files

Challenge #4 –L3VPN Support

parent 952b856b
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
# Copyright 2025 Telefonica Innovación Digital S.L.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -54,6 +54,11 @@ DUMMY_MODE = False
TFS_IP = ips.get('TFS_IP')
UPLOAD_TYPE = "WEBUI"  # "WEBUI" or "NBI"
NBI_L2_PATH = "restconf/data/ietf-l2vpn-svc:l2vpn-svc/vpn-services"
#path = "restconf/data/ietf-l2vpn-svc:l2vpn-svc/vpn-services"
path_l3 = "restconf/data/ietf-l3vpn-svc:l3vpn-svc/vpn-services"

#json_file = "/home/tfs/nsc-hackfest7/src/hackfest7/slice_request.json"
#/home/tfs/nsc-hackfest7/src/hackfest7/slice_request.json
# Flag to determine if additional L2VPN configuration support is required for deploying L2VPNs with path selection
TFS_L2VPN_SUPPORT = False

+2 −1
Original line number Diff line number Diff line
# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
# Copyright 2025 Telefonica Innovación Digital S.L.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
import logging, requests, json
from netmiko import ConnectHandler
from src.Constants import DEFAULT_LOGGING_LEVEL
from requests.auth import HTTPBasicAuth

# Configure logging to provide clear and informative log messages
logging.basicConfig(
+18 −16
Original line number Diff line number Diff line
# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
# Copyright 2025 Telefonica Innovación Digital S.L.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -62,6 +62,8 @@ class NSController:
        self.controller_type = controller_type
        self.tfs_ip = tfs_ip
        self.path = path
        self.path_l3 = path_l3
        #self.json_file = json_file
        self.answer = {}
        self.cool_answer = {}
        self.start_time = 0
@@ -498,6 +500,7 @@ class NSController:
                "setup_time": self.setup_time
            }
            # Add slice details to the response
            logging.info(self.answer)
            for subnet in self.answer:
                slice_info = {
                    "id": subnet,
@@ -828,7 +831,6 @@ class NSController:
            logging.warning(f"Unsupported controller: {controller}. Defaulting to TFS L2VPN realization.")
            realizing_request = self.__tfs_l2vpn(ietf_intent)
        return realizing_request
    
    def __tfs_l2vpn(self, ietf_intent):
       """
       Translate slice intent into a TeraFlow service request.
@@ -851,7 +853,7 @@ class NSController:
        # Hardcoded router endpoints
        # TODO (should be dynamically determined)
        origin_router_id = ietf_intent["ietf-network-slice-service:network-slice-services"]["slice-service"][0]["sdps"]["sdp"][0]["attachment-circuits"]["attachment-circuit"][0]["sdp-peering"]["peer-sap-id"]
        origin_router_if = '0/0/0-GigabitEthernet0/0/0/0'
        origin_router_if = 'eth2'
        destination_router_id = ietf_intent["ietf-network-slice-service:network-slice-services"]["slice-service"][0]["sdps"]["sdp"][1]["attachment-circuits"]["attachment-circuit"][0]["sdp-peering"]["peer-sap-id"]
        destination_router_if = '0/0/0-GigabitEthernet0/0/0/0'