Loading src/api/main.py +17 −17 Original line number Diff line number Diff line Loading @@ -450,12 +450,12 @@ class Api: def update_network_slice_service(self, intent): """ Modifica (reemplaza) toda la configuración de network-slice-services Modify (replace) all network-slice-services configuration """ try: xpath = "/ietf-network-slice-service:network-slice-services" # Verificar que existe algo que modificar # Verify if there is something to modify existing_data = get_data_store(xpath) if not existing_data: return send_response(False, code=404, message="Network slice services not found") Loading @@ -465,7 +465,7 @@ class Api: if not result: return send_response(False, code=500, message="Failed to process slice in TFS") # Reemplazar completamente el recurso # Replace completely the resource update_data_store(intent) logging.info("Network slice services modified successfully") Loading @@ -483,17 +483,17 @@ class Api: def update_slo_sle_template(self, template_id, template): """ Modifica (reemplaza) un template SLO/SLE específico Modify (replace) an specific SLO/SLE template """ try: xpath = f"/ietf-network-slice-service:network-slice-services/slo-sle-templates/slo-sle-template[id='{template_id}']" # Verificar que el template existe # Verify the template exists existing_template = get_data_store(xpath) if not existing_template: return send_response(False, code=404, message="Template not found") # Asegurar que el ID en el body coincide con el de la URL # Assure that the body ID matches the URL if "id" in template and template["id"] != template_id: return send_response(False, code=400, message="Template ID in body does not match URL") Loading @@ -519,7 +519,7 @@ class Api: template_data = template.copy() template_data.pop("id", None) # Reemplazar el template # Replace the template update_data_store(template_data, xpath) logging.info(f"Template {template_id} modified successfully") Loading @@ -542,16 +542,16 @@ class Api: try: xpath = f"/ietf-network-slice-service:network-slice-services/slice-service[id='{slice_id}']" # Verificar que el slice existe # Verify that the slice exists existing_slice = get_data_store(xpath) if not existing_slice: return send_response(False, code=404, message="Slice not found") # Asegurar que el ID en el body coincide con el de la URL # Assure that the body ID matches the URL if "id" in intent and intent["id"] != slice_id: return send_response(False, code=400, message="Slice ID in body does not match URL") # Validar que existe el template SLO/SLE referenciado # Validate that the referenced SLO/SLE template exists if "slo-sle-template" in intent: template_ref = intent.get("slo-sle-template") xpath_template = f"/ietf-network-slice-service:network-slice-services/slo-sle-templates/slo-sle-template[id='{template_ref}']" Loading @@ -559,7 +559,7 @@ class Api: if not existing_template: return send_response(False, code=404, message="Referenced SLO/SLE template not found") # Construir el intent completo para TFS # Build the full intent full_intent = { "ietf-network-slice-service:network-slice-services": { "slo-sle-templates": { Loading Loading @@ -589,7 +589,7 @@ class Api: intent_data = intent.copy() intent_data.pop("id", None) # Reemplazar el slice # Replace the slice update_data_store(intent_data, xpath) logging.info(f"Slice {slice_id} modified successfully") Loading @@ -609,22 +609,22 @@ class Api: def update_sdp(self, slice_id, sdp_id, sdp): """ Modifica (reemplaza) un SDP específico dentro de un slice Modify (replace) an specific SDP in the slice """ try: # Verificar que el slice existe # Verify the template exists slice_xpath = f"/ietf-network-slice-service:network-slice-services/slice-service[id='{slice_id}']" existing_slice = get_data_store(slice_xpath) if not existing_slice: return send_response(False, code=404, message="Slice not found") # Verificar que el SDP existe # Verify the SDP exists sdp_xpath = f"/ietf-network-slice-service:network-slice-services/slice-service[id='{slice_id}']/sdps/sdp[id='{sdp_id}']" existing_sdp = get_data_store(sdp_xpath) if not existing_sdp: return send_response(False, code=404, message="SDP not found") # Asegurar que el ID en el body coincide con el de la URL # Assure that the body ID matches the URL if "id" in sdp and sdp["id"] != sdp_id: return send_response(False, code=400, message="SDP ID in body does not match URL") Loading @@ -632,7 +632,7 @@ class Api: sdp_data = sdp.copy() sdp_data.pop("id", None) # Reemplazar el SDP # Replace the SDP update_data_store(sdp_data, sdp_xpath) logging.info(f"SDP {sdp_id} in slice {slice_id} modified successfully") Loading src/mapper/process_connnectivity.py +0 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ from src.utils.safe_get import safe_get from .extract_sdp_info import extract_sdp_info import logging def process_connectivity(connection_group_id, connectivity_type, connectivity_construct, connectivity_construct_id, slice_service): """ Loading src/realizer/restconf/service_types/builders/create_site_from_sdp.py +7 −7 Original line number Diff line number Diff line Loading @@ -22,15 +22,15 @@ from .configure_slos import configure_slos def create_site_from_sdp(sdp, ietf_intent, connectivity_type, layer_type): """ Crea la configuración de un site a partir de un SDP. Creates the configuration of a site from an SDP. Args: sdp: Service Delivery Point ietf_intent: Intent IETF completo connectivity_type: Tipo de conectividad ietf_intent: Complete IETF intent connectivity_type: Connectivity type Returns: Diccionario con la configuración del site Dictionary with site configuration """ logging.debug(f"Processing SDP: {sdp}") Loading @@ -43,7 +43,7 @@ def create_site_from_sdp(sdp, ietf_intent, connectivity_type, layer_type): network_access = create_network_access(sdp, ietf_intent, connectivity_type, router_id, router_if, layer_type) # Crear estructura del site # Create site structure site = { "site-id": safe_get(sdp, ["sdp", "id"]), "locations": { Loading src/realizer/restconf/service_types/l2vpn.py +8 −8 Original line number Diff line number Diff line Loading @@ -22,26 +22,26 @@ from .builders.create_site_from_sdp import create_site_from_sdp def l2vpn(ietf_intent): """ Crea un servicio L2VPN basado en el intent IETF proporcionado. Creates an L2VPN service based on the provided IETF intent. Args: ietf_intent: Diccionario con la configuración del intent IETF response: Objeto de respuesta ietf_intent: Dictionary with IETF intent configuration response: Response object Returns: Diccionario con la configuración del servicio L2VPN o None si no hay SDPs Dictionary with L2VPN service configuration or None if no SDPs """ # Early validation if not ietf_intent.get("sdps"): logging.warning("SDPs not found in the intent. Skipping L2VPN realization.") return None # Inicializar estructura L2VPN # Initialize L2VPN structure connectivity_type = ietf_intent["connectivity_type"] l2_service = initialize_structure(ietf_intent["id"], connectivity_type, layer_type="l2") # Procesar cada SDP # Process each SDP for sdp in ietf_intent["sdps"]: site = create_site_from_sdp(sdp, ietf_intent, connectivity_type, layer_type="l2") l2_service["ietf-l2vpn-svc:l2vpn-svc"]["sites"]["site"].append(site) Loading src/realizer/restconf/service_types/l3vpn.py +8 −8 Original line number Diff line number Diff line Loading @@ -20,25 +20,25 @@ from .builders.create_site_from_sdp import create_site_from_sdp def l3vpn(ietf_intent): """ Crea un servicio L3VPN basado en el intent IETF proporcionado. Creates an L3VPN service based on the provided IETF intent. Args: ietf_intent: Diccionario con la configuración del intent IETF response: Objeto de respuesta ietf_intent: Dictionary with IETF intent configuration response: Response object Returns: Diccionario con la configuración del servicio L3VPN o None si no hay SDPs Dictionary with L3VPN service configuration or None if no SDPs """ # Early validation if not ietf_intent.get("sdps"): logging.warning("SDPs not found in the intent. Skipping L3VPN realization.") return None # Inicializar estructura L3VPN # Initialize L3VPN structure connectivity_type = ietf_intent["connectivity_type"] l3_service = initialize_structure(ietf_intent["id"], connectivity_type, layer_type="l3") # Procesar cada SDP # Process each SDP for sdp in ietf_intent["sdps"]: site = create_site_from_sdp(sdp, ietf_intent, connectivity_type, layer_type="l3") l3_service["ietf-l3vpn-svc:l3vpn-svc"]["sites"]["site"].append(site) Loading Loading
src/api/main.py +17 −17 Original line number Diff line number Diff line Loading @@ -450,12 +450,12 @@ class Api: def update_network_slice_service(self, intent): """ Modifica (reemplaza) toda la configuración de network-slice-services Modify (replace) all network-slice-services configuration """ try: xpath = "/ietf-network-slice-service:network-slice-services" # Verificar que existe algo que modificar # Verify if there is something to modify existing_data = get_data_store(xpath) if not existing_data: return send_response(False, code=404, message="Network slice services not found") Loading @@ -465,7 +465,7 @@ class Api: if not result: return send_response(False, code=500, message="Failed to process slice in TFS") # Reemplazar completamente el recurso # Replace completely the resource update_data_store(intent) logging.info("Network slice services modified successfully") Loading @@ -483,17 +483,17 @@ class Api: def update_slo_sle_template(self, template_id, template): """ Modifica (reemplaza) un template SLO/SLE específico Modify (replace) an specific SLO/SLE template """ try: xpath = f"/ietf-network-slice-service:network-slice-services/slo-sle-templates/slo-sle-template[id='{template_id}']" # Verificar que el template existe # Verify the template exists existing_template = get_data_store(xpath) if not existing_template: return send_response(False, code=404, message="Template not found") # Asegurar que el ID en el body coincide con el de la URL # Assure that the body ID matches the URL if "id" in template and template["id"] != template_id: return send_response(False, code=400, message="Template ID in body does not match URL") Loading @@ -519,7 +519,7 @@ class Api: template_data = template.copy() template_data.pop("id", None) # Reemplazar el template # Replace the template update_data_store(template_data, xpath) logging.info(f"Template {template_id} modified successfully") Loading @@ -542,16 +542,16 @@ class Api: try: xpath = f"/ietf-network-slice-service:network-slice-services/slice-service[id='{slice_id}']" # Verificar que el slice existe # Verify that the slice exists existing_slice = get_data_store(xpath) if not existing_slice: return send_response(False, code=404, message="Slice not found") # Asegurar que el ID en el body coincide con el de la URL # Assure that the body ID matches the URL if "id" in intent and intent["id"] != slice_id: return send_response(False, code=400, message="Slice ID in body does not match URL") # Validar que existe el template SLO/SLE referenciado # Validate that the referenced SLO/SLE template exists if "slo-sle-template" in intent: template_ref = intent.get("slo-sle-template") xpath_template = f"/ietf-network-slice-service:network-slice-services/slo-sle-templates/slo-sle-template[id='{template_ref}']" Loading @@ -559,7 +559,7 @@ class Api: if not existing_template: return send_response(False, code=404, message="Referenced SLO/SLE template not found") # Construir el intent completo para TFS # Build the full intent full_intent = { "ietf-network-slice-service:network-slice-services": { "slo-sle-templates": { Loading Loading @@ -589,7 +589,7 @@ class Api: intent_data = intent.copy() intent_data.pop("id", None) # Reemplazar el slice # Replace the slice update_data_store(intent_data, xpath) logging.info(f"Slice {slice_id} modified successfully") Loading @@ -609,22 +609,22 @@ class Api: def update_sdp(self, slice_id, sdp_id, sdp): """ Modifica (reemplaza) un SDP específico dentro de un slice Modify (replace) an specific SDP in the slice """ try: # Verificar que el slice existe # Verify the template exists slice_xpath = f"/ietf-network-slice-service:network-slice-services/slice-service[id='{slice_id}']" existing_slice = get_data_store(slice_xpath) if not existing_slice: return send_response(False, code=404, message="Slice not found") # Verificar que el SDP existe # Verify the SDP exists sdp_xpath = f"/ietf-network-slice-service:network-slice-services/slice-service[id='{slice_id}']/sdps/sdp[id='{sdp_id}']" existing_sdp = get_data_store(sdp_xpath) if not existing_sdp: return send_response(False, code=404, message="SDP not found") # Asegurar que el ID en el body coincide con el de la URL # Assure that the body ID matches the URL if "id" in sdp and sdp["id"] != sdp_id: return send_response(False, code=400, message="SDP ID in body does not match URL") Loading @@ -632,7 +632,7 @@ class Api: sdp_data = sdp.copy() sdp_data.pop("id", None) # Reemplazar el SDP # Replace the SDP update_data_store(sdp_data, sdp_xpath) logging.info(f"SDP {sdp_id} in slice {slice_id} modified successfully") Loading
src/mapper/process_connnectivity.py +0 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ from src.utils.safe_get import safe_get from .extract_sdp_info import extract_sdp_info import logging def process_connectivity(connection_group_id, connectivity_type, connectivity_construct, connectivity_construct_id, slice_service): """ Loading
src/realizer/restconf/service_types/builders/create_site_from_sdp.py +7 −7 Original line number Diff line number Diff line Loading @@ -22,15 +22,15 @@ from .configure_slos import configure_slos def create_site_from_sdp(sdp, ietf_intent, connectivity_type, layer_type): """ Crea la configuración de un site a partir de un SDP. Creates the configuration of a site from an SDP. Args: sdp: Service Delivery Point ietf_intent: Intent IETF completo connectivity_type: Tipo de conectividad ietf_intent: Complete IETF intent connectivity_type: Connectivity type Returns: Diccionario con la configuración del site Dictionary with site configuration """ logging.debug(f"Processing SDP: {sdp}") Loading @@ -43,7 +43,7 @@ def create_site_from_sdp(sdp, ietf_intent, connectivity_type, layer_type): network_access = create_network_access(sdp, ietf_intent, connectivity_type, router_id, router_if, layer_type) # Crear estructura del site # Create site structure site = { "site-id": safe_get(sdp, ["sdp", "id"]), "locations": { Loading
src/realizer/restconf/service_types/l2vpn.py +8 −8 Original line number Diff line number Diff line Loading @@ -22,26 +22,26 @@ from .builders.create_site_from_sdp import create_site_from_sdp def l2vpn(ietf_intent): """ Crea un servicio L2VPN basado en el intent IETF proporcionado. Creates an L2VPN service based on the provided IETF intent. Args: ietf_intent: Diccionario con la configuración del intent IETF response: Objeto de respuesta ietf_intent: Dictionary with IETF intent configuration response: Response object Returns: Diccionario con la configuración del servicio L2VPN o None si no hay SDPs Dictionary with L2VPN service configuration or None if no SDPs """ # Early validation if not ietf_intent.get("sdps"): logging.warning("SDPs not found in the intent. Skipping L2VPN realization.") return None # Inicializar estructura L2VPN # Initialize L2VPN structure connectivity_type = ietf_intent["connectivity_type"] l2_service = initialize_structure(ietf_intent["id"], connectivity_type, layer_type="l2") # Procesar cada SDP # Process each SDP for sdp in ietf_intent["sdps"]: site = create_site_from_sdp(sdp, ietf_intent, connectivity_type, layer_type="l2") l2_service["ietf-l2vpn-svc:l2vpn-svc"]["sites"]["site"].append(site) Loading
src/realizer/restconf/service_types/l3vpn.py +8 −8 Original line number Diff line number Diff line Loading @@ -20,25 +20,25 @@ from .builders.create_site_from_sdp import create_site_from_sdp def l3vpn(ietf_intent): """ Crea un servicio L3VPN basado en el intent IETF proporcionado. Creates an L3VPN service based on the provided IETF intent. Args: ietf_intent: Diccionario con la configuración del intent IETF response: Objeto de respuesta ietf_intent: Dictionary with IETF intent configuration response: Response object Returns: Diccionario con la configuración del servicio L3VPN o None si no hay SDPs Dictionary with L3VPN service configuration or None if no SDPs """ # Early validation if not ietf_intent.get("sdps"): logging.warning("SDPs not found in the intent. Skipping L3VPN realization.") return None # Inicializar estructura L3VPN # Initialize L3VPN structure connectivity_type = ietf_intent["connectivity_type"] l3_service = initialize_structure(ietf_intent["id"], connectivity_type, layer_type="l3") # Procesar cada SDP # Process each SDP for sdp in ietf_intent["sdps"]: site = create_site_from_sdp(sdp, ietf_intent, connectivity_type, layer_type="l3") l3_service["ietf-l3vpn-svc:l3vpn-svc"]["sites"]["site"].append(site) Loading