Commit 03cc0e30 authored by Javier Velázquez's avatar Javier Velázquez
Browse files

General

Slices are stored only when the request is processed, to avoid cases where slice is stored but the request is not fully processed
Add new error (RuntimeError) to handle cases were the request is processed but no service is created
Change some error raised to be consistent in the whole app
Create flags to select the IP of HRAT and optical planner IPs
Update env.example with new flags
Change build_response to be the same for every request
Planner
Both HRAT and optical planner are configured through ip in the config
Add exception handling in HRAT and optical planner to avoid errors
Add "allowed_ids" variable in energy planner to handle only requests involving specific ids, to avoid errors in energy planning
Realizer
Change e2e realizer to handle cases with no rules avoiding errors
Change e2e_connect to use the tfs_connector class
parent a7b6056a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -52,6 +52,9 @@ class Api:
                code=201,
                data=result 
            )
        except RuntimeError as e:
            # Handle case where there is no content to process
            return send_response(False, code=200, message=str(e))
        except Exception as e:
            # Handle unexpected errors
            return send_response(False, code=500, message=str(e))
+11 −0
Original line number Diff line number Diff line
@@ -29,6 +29,12 @@ NRP_ENABLED=false
PLANNER_ENABLED=true
# Flag to determine if external PCE is used
PCE_EXTERNAL=false
# Type of planner to be used. Options: ENERGY, HRAT, TFS_OPTICAL
PLANNER_TYPE=ENERGY
# HRAT
HRAT_IP=10.0.0.1
# TFS_OPTICAL
OPTICAL_PLANNER_IP=10.0.0.1

# -------------------------
# Realizer
@@ -49,6 +55,11 @@ TFS_L2VPN_SUPPORT=false
# -------------------------
IXIA_IP=127.0.0.1

# -------------------------
# E2E Controller
# -------------------------
TFS_E2E_IP=127.0.0.1

# -------------------------
# WebUI
# -------------------------
+5 −1
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ def create_config(app: Flask):
    app.config["PLANNER_ENABLED"] = os.getenv("PLANNER_ENABLED", "false").lower() == "true"
    app.config["PLANNER_TYPE"] = os.getenv("PLANNER_TYPE", "ENERGY")
    app.config["PCE_EXTERNAL"] = os.getenv("PCE_EXTERNAL", "false").lower() == "true"
    app.config["HRAT_IP"] = os.getenv("HRAT_IP", "192.168.1.143")
    app.config["OPTICAL_PLANNER_IP"] = os.getenv("OPTICAL_PLANNER_IP", "10.30.7.66")

    # Realizer
    app.config["DUMMY_MODE"] = os.getenv("DUMMY_MODE", "true").lower() == "true"
@@ -52,11 +54,13 @@ def create_config(app: Flask):
    app.config["TFS_IP"] = os.getenv("TFS_IP", "127.0.0.1")
    app.config["UPLOAD_TYPE"] = os.getenv("UPLOAD_TYPE", "WEBUI")
    app.config["TFS_L2VPN_SUPPORT"] = os.getenv("TFS_L2VPN_SUPPORT", "false").lower() == "true"
    app.config["TFS_E2E"] = os.getenv("TFS_E2E", "127.0.0.1")

    # IXIA
    app.config["IXIA_IP"] = os.getenv("IXIA_IP", "127.0.0.1")

    # E2E Controller
    app.config["TFS_E2E_IP"] = os.getenv("TFS_E2E_IP", "127.0.0.1")

    # WebUI
    app.config["WEBUI_DEPLOY"] = os.getenv("WEBUI_DEPLOY", "false").lower() == "true"

+10 −3
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ class NSController:

        # Reset requests
        requests = {"services":[]}
        response = None

        # Process intent (translate if 3GPP)
        ietf_intents = nbi_processor(intent_json)
@@ -96,16 +97,22 @@ class NSController:
        for intent in ietf_intents:
            # Mapper
            rules = mapper(intent)
            # Store slice request details and build response
            store_data(intent, slice_id, controller_type=self.controller_type)
            # Build response
            self.response = build_response(intent, self.response, controller_type= self.controller_type)
            # Realizer
            request = realizer(intent, controller_type=self.controller_type, response = self.response, rules = rules)
            # Store slice request details
            if request: 
                requests["services"].append(request)
                store_data(intent, slice_id, controller_type=self.controller_type)

        # Store the generated template for debugging
        dump_templates(intent_json, ietf_intents, requests)

        # Check if there are services to process
        if not requests.get("services"):
            raise RuntimeError("No service to process.")

        # Send config to controllers
        response = send_controller(self.controller_type, requests)

+2 −1
Original line number Diff line number Diff line
@@ -65,7 +65,8 @@ def mapper(ietf_intent):
                # Request the controller to create a new NRP that meets the SLOs
                answer = realizer(ietf_intent, True, "CREATE", best_nrp)
                if not answer:
                    raise Exception("Slice rejected due to lack of NRPs")
                    logging.error("Slice rejected due to lack of NRPs")
                    return None
                # TODO Here we should put how the slice is attached to the new nrp

    if current_app.config["PLANNER_ENABLED"]:
Loading