Loading src/api/main.py +4 −4 Original line number Diff line number Diff line Loading @@ -460,7 +460,7 @@ class Api: if not existing_data: return send_response(False, code=404, message="Network slice services not found") # Si no está en modo DUMMY, procesar con TFS # If not in DUMMY mode, process with TFS result = self.slice_service.nsc(intent) if not result: return send_response(False, code=500, message="Failed to process slice in TFS") Loading Loading @@ -515,7 +515,7 @@ class Api: if not result: return send_response(False, code=500, message="Slice not updated") # Eliminar el ID del body si existe (ya está en el predicado) # Remove the ID from the body if it exists (it's already in the predicate) template_data = template.copy() template_data.pop("id", None) Loading Loading @@ -585,7 +585,7 @@ class Api: if not result: return send_response(False, code=500, message="Slice not updated") # Eliminar el ID del body (ya está en el predicado) # Remove the ID from the body (it's already in the predicate) intent_data = intent.copy() intent_data.pop("id", None) Loading Loading @@ -628,7 +628,7 @@ class Api: if "id" in sdp and sdp["id"] != sdp_id: return send_response(False, code=400, message="SDP ID in body does not match URL") # Eliminar el ID del body (ya está en el predicado) # Remove the ID from the body (it's already in the predicate) sdp_data = sdp.copy() sdp_data.pop("id", None) Loading src/database/sysrepo_store.py +42 −42 Original line number Diff line number Diff line Loading @@ -21,13 +21,13 @@ import logging def _get_connection(): """ Crea una nueva conexión cada vez Creates a new connection each time """ return sysrepo.SysrepoConnection() def create_data_store(intent: dict, xpath: str= ""): """ CREATE: Crea nuevos datos en el datastore CREATE: Creates new data in the datastore """ conn = _get_connection() sess = conn.start_session() Loading @@ -48,7 +48,7 @@ def create_data_store(intent: dict, xpath: str= ""): def get_data_store(xpath: str = ""): """ Obtiene todos los slices del datastore Gets all slices from the datastore """ conn = _get_connection() sess = conn.start_session() Loading @@ -69,23 +69,23 @@ def get_data_store(xpath: str = ""): def update_data_store(intent: dict, xpath: str = ""): """ UPDATE: Modifica datos en el datastore UPDATE: Modifies data in the datastore Args: intent: Datos a modificar xpath: Ruta al recurso intent: Data to modify xpath: Path to resource operation: - "merge" (default): PATCH - actualiza campos específicos - "replace": PUT - reemplaza completamente el recurso - "create": POST - solo crea si no existe - "merge" (default): PATCH - updates specific fields - "replace": PUT - completely replaces the resource - "create": POST - only creates if it doesn't exist Returns: bool: True si tuvo éxito bool: True if successful """ conn = _get_connection() sess = conn.start_session() # PUT: Eliminar y recrear (reemplazo completo) # PUT: Delete and recreate (complete replacement) try: if not xpath: sess.delete_item("/ietf-network-slice-service:network-slice-services") Loading @@ -107,25 +107,25 @@ def update_data_store(intent: dict, xpath: str = ""): def patch_data_store(intent: dict, xpath: str = ""): """ UPDATE: Modifica datos en el datastore UPDATE: Modifies data in the datastore Args: intent: Datos a modificar xpath: Ruta al recurso intent: Data to modify xpath: Path to resource operation: - "merge" (default): PATCH - actualiza campos específicos - "replace": PUT - reemplaza completamente el recurso - "create": POST - solo crea si no existe - "merge" (default): PATCH - updates specific fields - "replace": PUT - completely replaces the resource - "create": POST - only creates if it doesn't exist Returns: bool: True si tuvo éxito bool: True if successful """ conn = _get_connection() sess = conn.start_session() # PUT: Eliminar y recrear (reemplazo completo) # PUT: Delete and recreate (complete replacement) try: # PATCH: Merge con datos existentes # PATCH: Merge with existing data _write_dict(sess, xpath, intent) sess.apply_changes() logging.debug(f"Merged data at {xpath}") Loading @@ -141,7 +141,7 @@ def patch_data_store(intent: dict, xpath: str = ""): def delete_data_store(xpath: str = ""): """ DELETE: Elimina datos del datastore DELETE: Deletes data from the datastore """ conn = _get_connection() sess = conn.start_session() Loading @@ -161,8 +161,8 @@ def delete_data_store(xpath: str = ""): def _write_dict(sess, base_xpath, data, parent_key=None): """ Convierte dict → XPaths YANG parent_key: clave que ya está en el xpath y debe ser excluida Converts dict → YANG XPaths parent_key: key already in xpath and should be excluded """ LIST_KEYS = { 'slo-sle-template': 'id', Loading Loading @@ -201,13 +201,13 @@ def _write_dict(sess, base_xpath, data, parent_key=None): # ----------------------------- if isinstance(data, dict): # Saltar diccionarios vacíos # Skip empty dictionaries if not data: logging.debug("Skipping empty dict") return for k, v in data.items(): # IMPORTANTE: Saltar la clave si ya está en el predicado # IMPORTANT: Skip the key if already in the predicate if k == parent_key: logging.debug(f"Skipping key field '{k}' (already in predicate)") continue Loading @@ -219,7 +219,7 @@ def _write_dict(sess, base_xpath, data, parent_key=None): # ----------------------------- elif isinstance(data, list): # Saltar listas vacías # Skip empty lists if not data: logging.debug("Skipping empty list") return Loading @@ -233,7 +233,7 @@ def _write_dict(sess, base_xpath, data, parent_key=None): if is_leaf_list: # ----------------------------- # LEAF-LIST: Lista de valores simples # LEAF-LIST: List of simple values # ----------------------------- logging.debug(f"Processing as LEAF-LIST: {list_name}") Loading @@ -243,13 +243,13 @@ def _write_dict(sess, base_xpath, data, parent_key=None): continue logging.debug(f"Adding leaf-list value: {value}") # En sysrepo, los leaf-lists se agregan con el mismo xpath # pero múltiples valores # In sysrepo, leaf-lists are added with the same xpath # but multiple values sess.set_item(base_xpath, str(value)) else: # ----------------------------- # LIST: Lista de containers # LIST: List of containers # ----------------------------- logging.debug(f"Processing as LIST: {list_name}") key_field = LIST_KEYS.get(list_name) Loading @@ -260,7 +260,7 @@ def _write_dict(sess, base_xpath, data, parent_key=None): item_xpath = f"{base_xpath}[{key_field}='{key_value}']" logging.debug(f"Using key '{key_field}={key_value}' for list '{list_name}'") # Pasar el key_field para que sea excluido al procesar el item # Pass the key_field to be excluded when processing the item _write_dict(sess, item_xpath, item, parent_key=key_field) else: logging.error(f"ERROR: No key '{key_field}' found in item for list '{list_name}'") Loading Loading @@ -292,18 +292,18 @@ def normalize_libyang_data(data): KeyedList = None if KeyedList and isinstance(data, KeyedList): # KeyedList -> lista normal # KeyedList -> normal list return [normalize_libyang_data(item) for item in data] elif isinstance(data, dict): # Dict -> procesar valores recursivamente # Dict -> process values recursively return { key: normalize_libyang_data(value) for key, value in data.items() } elif isinstance(data, (list, tuple)): # Lista/tupla -> procesar elementos recursivamente # List/tuple -> process elements recursively return [normalize_libyang_data(item) for item in data] else: Loading src/mapper/extract_sdp_info.py +2 −2 Original line number Diff line number Diff line Loading @@ -32,12 +32,12 @@ def extract_sdp_info(sdp_id, slice_service, connection_group_id, connectivity_co 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, search by 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, use the first available 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] Loading src/mapper/slo_viability.py +1 −1 Original line number Diff line number Diff line Loading @@ -61,4 +61,4 @@ def slo_viability(slice_slos, nrp_slos): # Calculate final viability score score = sum(flexibility_scores) / len(flexibility_scores) if flexibility_scores else 0 return True, score # Si pasó todas las verificaciones, la NRP es viable No newline at end of file return True, score # If it passed all verifications, the NRP is viable No newline at end of file src/realizer/ixia/helpers/NEII_V4.py +5 −5 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ class NEII_controller: self.existentes(ip) return ## FUNCIONES MENÚ PRINCIPAL ## ## MAIN MENU FUNCTIONS ## def ver_info(self,ip): ''' Loading Loading @@ -173,9 +173,9 @@ class NEII_controller: drops = json_data.get("drops", None) desv_drop = json_data.get("desv_drop", None) # --- Variables de configuración --- # --- Configuration variables --- # Configuración de IPv4 / IPv6 # IPv4 / IPv6 configuration if src_node_ip and dst_node_ip: if isinstance(ipaddress.ip_address(src_node_ip), ipaddress.IPv4Address) and isinstance(ipaddress.ip_address(dst_node_ip), ipaddress.IPv4Address): configuraciones['ipv4'] = self.ipv4(src_node_ip, dst_node_ip, 5) Loading Loading @@ -214,12 +214,12 @@ class NEII_controller: dataProfile['profiles'].append(configuracion_perfil) logging.info(f"Configuración del perfil: {configuracion_perfil}") # Enviar la configuración # Send the configuration automatizacion.envio_peticion(ip, puerto, dataProfile) return automatizacion.obtener_informacion_puerto(ip, puerto) ## FUNCIONES DE CONFIGURACIÓN DE PUERTO ## ## PORT CONFIGURATION FUNCTIONS ## def delay(self,delay_perfil): ''' Loading Loading
src/api/main.py +4 −4 Original line number Diff line number Diff line Loading @@ -460,7 +460,7 @@ class Api: if not existing_data: return send_response(False, code=404, message="Network slice services not found") # Si no está en modo DUMMY, procesar con TFS # If not in DUMMY mode, process with TFS result = self.slice_service.nsc(intent) if not result: return send_response(False, code=500, message="Failed to process slice in TFS") Loading Loading @@ -515,7 +515,7 @@ class Api: if not result: return send_response(False, code=500, message="Slice not updated") # Eliminar el ID del body si existe (ya está en el predicado) # Remove the ID from the body if it exists (it's already in the predicate) template_data = template.copy() template_data.pop("id", None) Loading Loading @@ -585,7 +585,7 @@ class Api: if not result: return send_response(False, code=500, message="Slice not updated") # Eliminar el ID del body (ya está en el predicado) # Remove the ID from the body (it's already in the predicate) intent_data = intent.copy() intent_data.pop("id", None) Loading Loading @@ -628,7 +628,7 @@ class Api: if "id" in sdp and sdp["id"] != sdp_id: return send_response(False, code=400, message="SDP ID in body does not match URL") # Eliminar el ID del body (ya está en el predicado) # Remove the ID from the body (it's already in the predicate) sdp_data = sdp.copy() sdp_data.pop("id", None) Loading
src/database/sysrepo_store.py +42 −42 Original line number Diff line number Diff line Loading @@ -21,13 +21,13 @@ import logging def _get_connection(): """ Crea una nueva conexión cada vez Creates a new connection each time """ return sysrepo.SysrepoConnection() def create_data_store(intent: dict, xpath: str= ""): """ CREATE: Crea nuevos datos en el datastore CREATE: Creates new data in the datastore """ conn = _get_connection() sess = conn.start_session() Loading @@ -48,7 +48,7 @@ def create_data_store(intent: dict, xpath: str= ""): def get_data_store(xpath: str = ""): """ Obtiene todos los slices del datastore Gets all slices from the datastore """ conn = _get_connection() sess = conn.start_session() Loading @@ -69,23 +69,23 @@ def get_data_store(xpath: str = ""): def update_data_store(intent: dict, xpath: str = ""): """ UPDATE: Modifica datos en el datastore UPDATE: Modifies data in the datastore Args: intent: Datos a modificar xpath: Ruta al recurso intent: Data to modify xpath: Path to resource operation: - "merge" (default): PATCH - actualiza campos específicos - "replace": PUT - reemplaza completamente el recurso - "create": POST - solo crea si no existe - "merge" (default): PATCH - updates specific fields - "replace": PUT - completely replaces the resource - "create": POST - only creates if it doesn't exist Returns: bool: True si tuvo éxito bool: True if successful """ conn = _get_connection() sess = conn.start_session() # PUT: Eliminar y recrear (reemplazo completo) # PUT: Delete and recreate (complete replacement) try: if not xpath: sess.delete_item("/ietf-network-slice-service:network-slice-services") Loading @@ -107,25 +107,25 @@ def update_data_store(intent: dict, xpath: str = ""): def patch_data_store(intent: dict, xpath: str = ""): """ UPDATE: Modifica datos en el datastore UPDATE: Modifies data in the datastore Args: intent: Datos a modificar xpath: Ruta al recurso intent: Data to modify xpath: Path to resource operation: - "merge" (default): PATCH - actualiza campos específicos - "replace": PUT - reemplaza completamente el recurso - "create": POST - solo crea si no existe - "merge" (default): PATCH - updates specific fields - "replace": PUT - completely replaces the resource - "create": POST - only creates if it doesn't exist Returns: bool: True si tuvo éxito bool: True if successful """ conn = _get_connection() sess = conn.start_session() # PUT: Eliminar y recrear (reemplazo completo) # PUT: Delete and recreate (complete replacement) try: # PATCH: Merge con datos existentes # PATCH: Merge with existing data _write_dict(sess, xpath, intent) sess.apply_changes() logging.debug(f"Merged data at {xpath}") Loading @@ -141,7 +141,7 @@ def patch_data_store(intent: dict, xpath: str = ""): def delete_data_store(xpath: str = ""): """ DELETE: Elimina datos del datastore DELETE: Deletes data from the datastore """ conn = _get_connection() sess = conn.start_session() Loading @@ -161,8 +161,8 @@ def delete_data_store(xpath: str = ""): def _write_dict(sess, base_xpath, data, parent_key=None): """ Convierte dict → XPaths YANG parent_key: clave que ya está en el xpath y debe ser excluida Converts dict → YANG XPaths parent_key: key already in xpath and should be excluded """ LIST_KEYS = { 'slo-sle-template': 'id', Loading Loading @@ -201,13 +201,13 @@ def _write_dict(sess, base_xpath, data, parent_key=None): # ----------------------------- if isinstance(data, dict): # Saltar diccionarios vacíos # Skip empty dictionaries if not data: logging.debug("Skipping empty dict") return for k, v in data.items(): # IMPORTANTE: Saltar la clave si ya está en el predicado # IMPORTANT: Skip the key if already in the predicate if k == parent_key: logging.debug(f"Skipping key field '{k}' (already in predicate)") continue Loading @@ -219,7 +219,7 @@ def _write_dict(sess, base_xpath, data, parent_key=None): # ----------------------------- elif isinstance(data, list): # Saltar listas vacías # Skip empty lists if not data: logging.debug("Skipping empty list") return Loading @@ -233,7 +233,7 @@ def _write_dict(sess, base_xpath, data, parent_key=None): if is_leaf_list: # ----------------------------- # LEAF-LIST: Lista de valores simples # LEAF-LIST: List of simple values # ----------------------------- logging.debug(f"Processing as LEAF-LIST: {list_name}") Loading @@ -243,13 +243,13 @@ def _write_dict(sess, base_xpath, data, parent_key=None): continue logging.debug(f"Adding leaf-list value: {value}") # En sysrepo, los leaf-lists se agregan con el mismo xpath # pero múltiples valores # In sysrepo, leaf-lists are added with the same xpath # but multiple values sess.set_item(base_xpath, str(value)) else: # ----------------------------- # LIST: Lista de containers # LIST: List of containers # ----------------------------- logging.debug(f"Processing as LIST: {list_name}") key_field = LIST_KEYS.get(list_name) Loading @@ -260,7 +260,7 @@ def _write_dict(sess, base_xpath, data, parent_key=None): item_xpath = f"{base_xpath}[{key_field}='{key_value}']" logging.debug(f"Using key '{key_field}={key_value}' for list '{list_name}'") # Pasar el key_field para que sea excluido al procesar el item # Pass the key_field to be excluded when processing the item _write_dict(sess, item_xpath, item, parent_key=key_field) else: logging.error(f"ERROR: No key '{key_field}' found in item for list '{list_name}'") Loading Loading @@ -292,18 +292,18 @@ def normalize_libyang_data(data): KeyedList = None if KeyedList and isinstance(data, KeyedList): # KeyedList -> lista normal # KeyedList -> normal list return [normalize_libyang_data(item) for item in data] elif isinstance(data, dict): # Dict -> procesar valores recursivamente # Dict -> process values recursively return { key: normalize_libyang_data(value) for key, value in data.items() } elif isinstance(data, (list, tuple)): # Lista/tupla -> procesar elementos recursivamente # List/tuple -> process elements recursively return [normalize_libyang_data(item) for item in data] else: Loading
src/mapper/extract_sdp_info.py +2 −2 Original line number Diff line number Diff line Loading @@ -32,12 +32,12 @@ def extract_sdp_info(sdp_id, slice_service, connection_group_id, connectivity_co 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, search by 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, use the first available 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] Loading
src/mapper/slo_viability.py +1 −1 Original line number Diff line number Diff line Loading @@ -61,4 +61,4 @@ def slo_viability(slice_slos, nrp_slos): # Calculate final viability score score = sum(flexibility_scores) / len(flexibility_scores) if flexibility_scores else 0 return True, score # Si pasó todas las verificaciones, la NRP es viable No newline at end of file return True, score # If it passed all verifications, the NRP is viable No newline at end of file
src/realizer/ixia/helpers/NEII_V4.py +5 −5 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ class NEII_controller: self.existentes(ip) return ## FUNCIONES MENÚ PRINCIPAL ## ## MAIN MENU FUNCTIONS ## def ver_info(self,ip): ''' Loading Loading @@ -173,9 +173,9 @@ class NEII_controller: drops = json_data.get("drops", None) desv_drop = json_data.get("desv_drop", None) # --- Variables de configuración --- # --- Configuration variables --- # Configuración de IPv4 / IPv6 # IPv4 / IPv6 configuration if src_node_ip and dst_node_ip: if isinstance(ipaddress.ip_address(src_node_ip), ipaddress.IPv4Address) and isinstance(ipaddress.ip_address(dst_node_ip), ipaddress.IPv4Address): configuraciones['ipv4'] = self.ipv4(src_node_ip, dst_node_ip, 5) Loading Loading @@ -214,12 +214,12 @@ class NEII_controller: dataProfile['profiles'].append(configuracion_perfil) logging.info(f"Configuración del perfil: {configuracion_perfil}") # Enviar la configuración # Send the configuration automatizacion.envio_peticion(ip, puerto, dataProfile) return automatizacion.obtener_informacion_puerto(ip, puerto) ## FUNCIONES DE CONFIGURACIÓN DE PUERTO ## ## PORT CONFIGURATION FUNCTIONS ## def delay(self,delay_perfil): ''' Loading