Loading src/config/.env.example +10 −1 Original line number Original line Diff line number Diff line Loading @@ -19,7 +19,7 @@ # ------------------------- # ------------------------- NSC_PORT=8086 NSC_PORT=8086 # Options: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET # Options: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET LOGGING_LEVEL=INFO LOGGING_LEVEL=DEBUG DUMP_TEMPLATES=false DUMP_TEMPLATES=false # ------------------------- # ------------------------- Loading Loading @@ -63,6 +63,15 @@ IXIA_IP=127.0.0.1 # ------------------------- # ------------------------- TFS_E2E_IP=127.0.0.1 TFS_E2E_IP=127.0.0.1 # ------------------------- # Restconf Controller # ------------------------- RESTCONF_IP=127.0.0.1 # Options: TFS or IXIA SDN_CONTROLLER_TYPE=TFS # Options: FRR, CISCO DATAPLANE_SUPPORT=FRR # ------------------------- # ------------------------- # WebUI # WebUI # ------------------------- # ------------------------- Loading src/config/config.py +5 −0 Original line number Original line Diff line number Diff line Loading @@ -64,4 +64,9 @@ def create_config(app: Flask): # WebUI # WebUI app.config["WEBUI_DEPLOY"] = os.getenv("WEBUI_DEPLOY", "false").lower() == "true" app.config["WEBUI_DEPLOY"] = os.getenv("WEBUI_DEPLOY", "false").lower() == "true" # Restconf Controller app.config["RESTCONF_IP"] = os.getenv("RESTCONF_IP", "127.0.0.1") app.config["SDN_CONTROLLER_TYPE"] = os.getenv("SDN_CONTROLLER_TYPE", "TFS") app.config["DATAPLANE_SUPPORT"] = os.getenv("DATAPLANE_SUPPORT", "FRR") return app return app src/main.py +8 −6 Original line number Original line Diff line number Diff line Loading @@ -96,11 +96,13 @@ class NSController: for intent in ietf_intents: for intent in ietf_intents: # Mapper # Mapper rules = mapper(intent) services, rules = mapper(intent) logging.info(f"Services: {services}") # Build response # Build response self.response = build_response(intent, self.response, controller_type= self.controller_type) self.response = build_response(intent, self.response, controller_type= self.controller_type) # Realizer # Realizer request = realizer(intent, controller_type=self.controller_type, response = self.response, rules = rules) for service in services: request = realizer(service, controller_type=self.controller_type, response = self.response, rules = rules) # Store slice request details # Store slice request details if request: if request: requests["services"].append(request) requests["services"].append(request) Loading src/mapper/extract_sdp_info.py 0 → 100644 +31 −0 Original line number Original line Diff line number Diff line import logging from src.utils.safe_get import safe_get def extract_sdp_info(sdp_id, slice_service, connection_group_id, connectivity_construct_id): logging.debug(f"Extracting SDP info for SDP ID: {sdp_id}, Connection Group ID: {connection_group_id}, Connectivity Construct ID: {connectivity_construct_id}") logging.debug(f"Slice Service: {slice_service}") selected_sdp = next((sdp for sdp in safe_get(slice_service, ["sdps", "sdp"]) if sdp.get("id") == sdp_id), None) selected_match_criteria = None match_criteria_list = safe_get(selected_sdp, ["service-match-criteria", "match-criterion"]) logging.debug(f"Available match criteria: {match_criteria_list}") logging.debug(f"Selected SDP: {selected_sdp}") if match_criteria_list: # Buscar por connectivity construct if connectivity_construct_id: logging.debug(f"Looking for match criteria with target-connectivity-construct-id: {connectivity_construct_id}") selected_match_criteria = next((mc for mc in match_criteria_list if safe_get(mc, ["target-connectivity-construct-id"]) == connectivity_construct_id), None) # Si no, buscar por connection group if not selected_match_criteria and connection_group_id: logging.debug(f"Looking for match criteria with target-connection-group-id: {connection_group_id}") selected_match_criteria = next((mc for mc in match_criteria_list if safe_get(mc, ["target-connection-group-id"]) == connection_group_id), None) # Si no, usar el primero disponible if not selected_match_criteria: logging.debug("No specific match criteria found for connectivity construct or connection group. Using the first available match criteria.") selected_match_criteria = match_criteria_list[0] return selected_sdp, selected_match_criteria No newline at end of file src/mapper/get_service_template.py 0 → 100644 +20 −0 Original line number Original line Diff line number Diff line from src.utils.safe_get import safe_get from .get_template import get_template def get_service_template(service_element, available_templates): """ Extract template from service element. Args: service_element: Dictionary containing service configuration available_templates: List of available templates Returns: Template object or None """ if "slo-sle-template" in service_element: template_ref = safe_get(service_element, ["slo-sle-template"]) return get_template(template_ref, available_templates) elif "service-slo-sle-policy" in service_element: return safe_get(service_element, ["service-slo-sle-policy"]) return None No newline at end of file Loading
src/config/.env.example +10 −1 Original line number Original line Diff line number Diff line Loading @@ -19,7 +19,7 @@ # ------------------------- # ------------------------- NSC_PORT=8086 NSC_PORT=8086 # Options: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET # Options: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET LOGGING_LEVEL=INFO LOGGING_LEVEL=DEBUG DUMP_TEMPLATES=false DUMP_TEMPLATES=false # ------------------------- # ------------------------- Loading Loading @@ -63,6 +63,15 @@ IXIA_IP=127.0.0.1 # ------------------------- # ------------------------- TFS_E2E_IP=127.0.0.1 TFS_E2E_IP=127.0.0.1 # ------------------------- # Restconf Controller # ------------------------- RESTCONF_IP=127.0.0.1 # Options: TFS or IXIA SDN_CONTROLLER_TYPE=TFS # Options: FRR, CISCO DATAPLANE_SUPPORT=FRR # ------------------------- # ------------------------- # WebUI # WebUI # ------------------------- # ------------------------- Loading
src/config/config.py +5 −0 Original line number Original line Diff line number Diff line Loading @@ -64,4 +64,9 @@ def create_config(app: Flask): # WebUI # WebUI app.config["WEBUI_DEPLOY"] = os.getenv("WEBUI_DEPLOY", "false").lower() == "true" app.config["WEBUI_DEPLOY"] = os.getenv("WEBUI_DEPLOY", "false").lower() == "true" # Restconf Controller app.config["RESTCONF_IP"] = os.getenv("RESTCONF_IP", "127.0.0.1") app.config["SDN_CONTROLLER_TYPE"] = os.getenv("SDN_CONTROLLER_TYPE", "TFS") app.config["DATAPLANE_SUPPORT"] = os.getenv("DATAPLANE_SUPPORT", "FRR") return app return app
src/main.py +8 −6 Original line number Original line Diff line number Diff line Loading @@ -96,11 +96,13 @@ class NSController: for intent in ietf_intents: for intent in ietf_intents: # Mapper # Mapper rules = mapper(intent) services, rules = mapper(intent) logging.info(f"Services: {services}") # Build response # Build response self.response = build_response(intent, self.response, controller_type= self.controller_type) self.response = build_response(intent, self.response, controller_type= self.controller_type) # Realizer # Realizer request = realizer(intent, controller_type=self.controller_type, response = self.response, rules = rules) for service in services: request = realizer(service, controller_type=self.controller_type, response = self.response, rules = rules) # Store slice request details # Store slice request details if request: if request: requests["services"].append(request) requests["services"].append(request) Loading
src/mapper/extract_sdp_info.py 0 → 100644 +31 −0 Original line number Original line Diff line number Diff line import logging from src.utils.safe_get import safe_get def extract_sdp_info(sdp_id, slice_service, connection_group_id, connectivity_construct_id): logging.debug(f"Extracting SDP info for SDP ID: {sdp_id}, Connection Group ID: {connection_group_id}, Connectivity Construct ID: {connectivity_construct_id}") logging.debug(f"Slice Service: {slice_service}") selected_sdp = next((sdp for sdp in safe_get(slice_service, ["sdps", "sdp"]) if sdp.get("id") == sdp_id), None) selected_match_criteria = None match_criteria_list = safe_get(selected_sdp, ["service-match-criteria", "match-criterion"]) logging.debug(f"Available match criteria: {match_criteria_list}") logging.debug(f"Selected SDP: {selected_sdp}") if match_criteria_list: # Buscar por connectivity construct if connectivity_construct_id: logging.debug(f"Looking for match criteria with target-connectivity-construct-id: {connectivity_construct_id}") selected_match_criteria = next((mc for mc in match_criteria_list if safe_get(mc, ["target-connectivity-construct-id"]) == connectivity_construct_id), None) # Si no, buscar por connection group if not selected_match_criteria and connection_group_id: logging.debug(f"Looking for match criteria with target-connection-group-id: {connection_group_id}") selected_match_criteria = next((mc for mc in match_criteria_list if safe_get(mc, ["target-connection-group-id"]) == connection_group_id), None) # Si no, usar el primero disponible if not selected_match_criteria: logging.debug("No specific match criteria found for connectivity construct or connection group. Using the first available match criteria.") selected_match_criteria = match_criteria_list[0] return selected_sdp, selected_match_criteria No newline at end of file
src/mapper/get_service_template.py 0 → 100644 +20 −0 Original line number Original line Diff line number Diff line from src.utils.safe_get import safe_get from .get_template import get_template def get_service_template(service_element, available_templates): """ Extract template from service element. Args: service_element: Dictionary containing service configuration available_templates: List of available templates Returns: Template object or None """ if "slo-sle-template" in service_element: template_ref = safe_get(service_element, ["slo-sle-template"]) return get_template(template_ref, available_templates) elif "service-slo-sle-policy" in service_element: return safe_get(service_element, ["service-slo-sle-policy"]) return None No newline at end of file