From 797a722c800fa0eb822aac818f55a661f3248582 Mon Sep 17 00:00:00 2001 From: ismaeel <mohammad.ismaael@cnit.it> Date: Wed, 2 Oct 2024 05:19:23 +0000 Subject: [PATCH] clean code phase 2 --- src/context/service/database/Link.py | 2 +- .../OpticalConfig/OpticalConfigModel.py | 2 +- .../service/database/uuids/OpticalEndPoint.py | 2 +- .../service/drivers/oc_driver/OCDriver.py | 15 ++++---- .../templates/Interfaces/interfaces.py | 2 +- .../drivers/oc_driver/templates/Tools.py | 4 +-- .../oc_driver/templates/VPN/physical.py | 8 ++--- .../drivers/oc_driver/templates/VPN/roadms.py | 4 +-- .../oc_driver/templates/VPN/transponder.py | 9 +++-- .../templates/descovery_tool/roadms.py | 4 +-- .../templates/descovery_tool/transponders.py | 6 ++-- src/opticalcontroller/OpticalController.py | 36 ++++++++----------- .../service/service_handlers/oc/OCTools.py | 31 ++++++++-------- src/service/service/tools/OpticalTools.py | 10 +++--- src/webui/service/opticalconfig/routes.py | 4 +-- 15 files changed, 64 insertions(+), 75 deletions(-) diff --git a/src/context/service/database/Link.py b/src/context/service/database/Link.py index 39f60fdc3..5d97bc026 100644 --- a/src/context/service/database/Link.py +++ b/src/context/service/database/Link.py @@ -84,7 +84,7 @@ def link_set(db_engine : Engine, messagebroker : MessageBroker, request : Link) link_endpoints_data : List[Dict] = list() for i,endpoint_id in enumerate(request.link_endpoint_ids): - logging.info(f"links endpoint_id is {endpoint_id}") + endpoint_topology_uuid, _, endpoint_uuid = endpoint_get_uuid( endpoint_id, allow_random=False) diff --git a/src/context/service/database/models/OpticalConfig/OpticalConfigModel.py b/src/context/service/database/models/OpticalConfig/OpticalConfigModel.py index 515a21a85..3b5725651 100644 --- a/src/context/service/database/models/OpticalConfig/OpticalConfigModel.py +++ b/src/context/service/database/models/OpticalConfig/OpticalConfigModel.py @@ -69,6 +69,6 @@ class OpticalConfigModel(_Base): obj['roadm_uuid']=channels['roadm_uuid'] if 'roadm_uuid' in channels else None - logging.info(f"optical_config_model {obj}") + return obj diff --git a/src/context/service/database/uuids/OpticalEndPoint.py b/src/context/service/database/uuids/OpticalEndPoint.py index b31bc7d71..db0a99f54 100644 --- a/src/context/service/database/uuids/OpticalEndPoint.py +++ b/src/context/service/database/uuids/OpticalEndPoint.py @@ -29,7 +29,7 @@ def optical_endpoint_get_uuid( if len(raw_endpoint_uuid) > 0: prefix_for_name = '{:s}'.format( device_uuid) - logging.info(f" raw_endpoint uuid {raw_endpoint_uuid} and endpoint {get_uuid_from_string(raw_endpoint_uuid, prefix_for_name=prefix_for_name)}") + return device_uuid, get_uuid_from_string(raw_endpoint_uuid, prefix_for_name=prefix_for_name) if len(endpoint_name) > 0: diff --git a/src/device/service/drivers/oc_driver/OCDriver.py b/src/device/service/drivers/oc_driver/OCDriver.py index a94907928..aa86acb55 100644 --- a/src/device/service/drivers/oc_driver/OCDriver.py +++ b/src/device/service/drivers/oc_driver/OCDriver.py @@ -136,7 +136,7 @@ class NetconfSessionHandler: response= self.__manager.edit_config( config, target=target, default_operation=default_operation, test_option=test_option, error_option=error_option, format=format) - logging.info(f"resonse from edit {response}") + str_respones = str(response) if re.search(r'<ok/>', str_respones): @@ -190,7 +190,7 @@ def edit_config( - logging.info(f" edit messages {str_config_messages}") + for str_config_message in str_config_messages: # configuration of the received templates @@ -226,13 +226,13 @@ class OCDriver(_Driver): timezone=pytz.utc) self._temp_address=f"{address}{port}" self.__out_samples = queue.Queue() - logging.info(f"setting ocdriver address {self.address} and {self.port} {self.settings}") + self.__netconf_handler = NetconfSessionHandler(self.address, self.port, **(self.settings)) self.__type = self.settings.get("type","optical-transponder") self.__device_uuid=device_uuid self.__pending_tasks=[] self.Connect() - logging.info(f"settings {settings}") + def Connect(self) -> bool: with self.__lock: @@ -277,7 +277,7 @@ class OCDriver(_Driver): try: xml_data = self.__netconf_handler.get().data_xml - logging.info(f"type {self.__type}") + if (self.__type == "optical-transponder"): extracted_values=transponder_values_extractor(data_xml=xml_data,resource_keys=transponder_filter_fields,dic=config) @@ -319,13 +319,12 @@ class OCDriver(_Driver): self.__logger.exception(MSG.format(e)) if(len(ports_result)>0) : results.extend(ports_result) - logging.info(f"from OCDriver {results}") + return results @metered_subclass_method(METRICS_POOL) def SetConfig(self, resources : List[Tuple[str, Any]],conditions:dict) -> List[Union[bool, Exception]]: - logging.info(f"from setConfig {resources}") - logging.info(f"from setConfig condititons {conditions}") + if len(resources) == 0: return [] results=[] with self.__lock: diff --git a/src/device/service/drivers/oc_driver/templates/Interfaces/interfaces.py b/src/device/service/drivers/oc_driver/templates/Interfaces/interfaces.py index 87ba8835a..0e5d924e1 100644 --- a/src/device/service/drivers/oc_driver/templates/Interfaces/interfaces.py +++ b/src/device/service/drivers/oc_driver/templates/Interfaces/interfaces.py @@ -37,7 +37,7 @@ def interface_template (interface_data:dict) : indentation = ' '*2, newline = '\r\n' ) - logging.info("interfaces %s",result) + return result \ No newline at end of file diff --git a/src/device/service/drivers/oc_driver/templates/Tools.py b/src/device/service/drivers/oc_driver/templates/Tools.py index 93f3ce3df..ba1a0c71f 100644 --- a/src/device/service/drivers/oc_driver/templates/Tools.py +++ b/src/device/service/drivers/oc_driver/templates/Tools.py @@ -166,7 +166,7 @@ def extract_channels_based_on_type (xml_data:str): return channel_names def extract_value(resource_key:str,xml_data:str,dic:dict,channel_name:str,channel_namespace:str): - logging.info(f"resource_key {resource_key} and channgel_name {channel_name} and channel_namespace {channel_namespace}") + xml_bytes = xml_data.encode("utf-8") root = ET.fromstring(xml_bytes) channel_name=channel_name if 'index' not in channel_name else channel_name['index'] @@ -186,7 +186,7 @@ def extract_value(resource_key:str,xml_data:str,dic:dict,channel_name:str,channe else: logging.info("element is None") print(" element not found.") - logging.info(f"dic {dic}") + return dic diff --git a/src/device/service/drivers/oc_driver/templates/VPN/physical.py b/src/device/service/drivers/oc_driver/templates/VPN/physical.py index cc59c721b..82526db06 100644 --- a/src/device/service/drivers/oc_driver/templates/VPN/physical.py +++ b/src/device/service/drivers/oc_driver/templates/VPN/physical.py @@ -41,7 +41,7 @@ def create_optical_channel(resources:list[dict],ports:list[dict],config:list[dic data ={} data["channel_namespace"]=next((i["value"] for i in resources if i["resource_key"] == "channel_namespace"), None) #config,ports,index=seperate_port_config(resources,unwanted_keys=unwanted_keys) - logging.info(f"ports are {ports}") + port_val = "" if 'destination_port' in ports and ports['destination_port'][0] is not None: port_val = ports['destination_port'][0] @@ -127,7 +127,7 @@ def create_optical_band (resources) : results =[] unwanted_keys=['destination_port','source_port','channel_namespace','frequency','optical-band-parent'] config,ports,index= seperate_port_config(resources,unwanted_keys=unwanted_keys) - logging.info(f"BBBBBBBBBBBBB {ports}") + doc, tag, text = Doc().tagtext() #with tag('config'): with tag('config',xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"): @@ -175,7 +175,7 @@ def create_media_channel (resources): results=[] unwanted_keys=['destination_port','source_port','channel_namespace','frequency','operational-mode', 'optical-band-parent'] config,ports,index= seperate_port_config(resources,unwanted_keys=unwanted_keys) - logging.info(f"BBBBBBBBBBBBB {ports}") + doc, tag, text = Doc().tagtext() #with tag('config'): with tag('config',xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"): @@ -254,7 +254,7 @@ def edit_optical_channel (resources:list[dict]): channel_name=next((i["value"] for i in resources if i["resource_key"]=="channel_name" and i["value"] != None),None) admin_state= next((i["value"] for i in resources if i["resource_key"]== "admin-state" and i["value"] != None) , None) - logging.info(f"admin state is {admin_state}") + if channel_name is not None : if (admin_state is not None): results.extend(change_optical_channel_status(channel_name=channel_name,state=admin_state,ports=ports)) diff --git a/src/device/service/drivers/oc_driver/templates/VPN/roadms.py b/src/device/service/drivers/oc_driver/templates/VPN/roadms.py index 6a83a7a03..1215a3e83 100644 --- a/src/device/service/drivers/oc_driver/templates/VPN/roadms.py +++ b/src/device/service/drivers/oc_driver/templates/VPN/roadms.py @@ -239,7 +239,7 @@ def create_optical_band (resources) : results =[] unwanted_keys=['destination_port','source_port','channel_namespace','frequency','optical-band-parent','handled_flow'] config,ports,index= filter_config(resources,unwanted_keys=unwanted_keys) - logging.info(f"SSSSSSSSSSSSSSS {ports}") + #with tag('config'): n = 0 for flow in ports: @@ -251,7 +251,7 @@ def create_optical_band (resources) : #with tag('optical-band', operation="create"): src,dest=flow - logging.info(f"SSSSSSSSSSSSSSS {src}, {dest}") + with tag('optical-band'): if index is not None: with tag('index'):text(str(int(index)+n)) diff --git a/src/device/service/drivers/oc_driver/templates/VPN/transponder.py b/src/device/service/drivers/oc_driver/templates/VPN/transponder.py index c4a2c3c52..1319caa95 100644 --- a/src/device/service/drivers/oc_driver/templates/VPN/transponder.py +++ b/src/device/service/drivers/oc_driver/templates/VPN/transponder.py @@ -72,7 +72,7 @@ def create_optical_channel(resources:list[dict],ports:list[dict],config:list[dic data ={} data["channel_namespace"]=next((i["value"] for i in resources if i["resource_key"] == "channel_namespace"), None) #config,ports,index=seperate_port_config(resources,unwanted_keys=unwanted_keys) - logging.info(f"ports are {ports}") + port_val = "" if 'destination_port' in ports and ports['destination_port'][0] is not None: port_val = ports['destination_port'][0] @@ -141,7 +141,7 @@ def change_optical_channel_status (state:str,ports:list[dict]) : def edit_optical_channel (resources:list[dict]): - logging.info(f"building xml {resources}") + unwanted_keys=['destination_port','source_port','channel_namespace' ,'optical-band-parent','index', 'name','admin-state','handled_flow'] config,ports,index=seperate_port_config(resources,unwanted_keys=unwanted_keys) @@ -149,12 +149,11 @@ def edit_optical_channel (resources:list[dict]): # channel_name=next((i["value"] for i in resources if i["resource_key"]=="channel_name" and i["value"] != None),None) # admin_state= next((i["value"] for i in resources if i["resource_key"]== "admin-state" and i["value"] != None) , None) - # logging.info(f"channel_name {channel_name}") + # results.extend(change_optical_channel_status(state=admin_state,ports=ports)) # else : - logging.info(f"config_xml {config}") - logging.info(f"ports_xml {ports}") + results.extend(create_optical_channel(resources=resources,ports=ports,config=config) ) return results \ No newline at end of file diff --git a/src/device/service/drivers/oc_driver/templates/descovery_tool/roadms.py b/src/device/service/drivers/oc_driver/templates/descovery_tool/roadms.py index 9f09be6ad..171805d9e 100644 --- a/src/device/service/drivers/oc_driver/templates/descovery_tool/roadms.py +++ b/src/device/service/drivers/oc_driver/templates/descovery_tool/roadms.py @@ -61,7 +61,7 @@ def extract_optical_bands (data_xml:str,namespace:str): root = ET.fromstring(xml_bytes) op_bands=[] optical_bands= root.find('.//oc:optical-bands',namespaces) - logging.info(f'optical_bands {optical_bands}') + if optical_bands is not None : optical_bands_ele= optical_bands.findall('.//oc:optical-band',namespaces) @@ -269,7 +269,7 @@ def extract_roadm_circuits_pack (xml_data:str): circuit_info["slot"]=slot.text if (shelf is not None): circuit_info["shelf"]=shelf.text - logging.info(f"circuit_ports {circuit_ports}") + circuit_info["ports"]=circuit_ports circuits_list.append(circuit_info) diff --git a/src/device/service/drivers/oc_driver/templates/descovery_tool/transponders.py b/src/device/service/drivers/oc_driver/templates/descovery_tool/transponders.py index 892ef98dc..e44f127f2 100644 --- a/src/device/service/drivers/oc_driver/templates/descovery_tool/transponders.py +++ b/src/device/service/drivers/oc_driver/templates/descovery_tool/transponders.py @@ -147,7 +147,7 @@ def extract_channels_based_on_type (xml_data:str): return channel_names def extract_value(resource_key:str,xml_data:str,dic:dict,channel_name:str,channel_namespace:str): - logging.info(f"resource_key {resource_key} and channgel_name {channel_name} and channel_namespace {channel_namespace}") + xml_bytes = xml_data.encode("utf-8") root = ET.fromstring(xml_bytes) channel_name=channel_name if 'index' not in channel_name else channel_name['index'] @@ -167,7 +167,7 @@ def extract_value(resource_key:str,xml_data:str,dic:dict,channel_name:str,channe else: logging.info("element is None") print(" element not found.") - logging.info(f"dic {dic}") + return dic @@ -266,7 +266,7 @@ def transponder_values_extractor(data_xml:str,resource_keys:list,dic:dict): # channel_names=extract_channels_based_on_type(xml_data=data_xml) # if len(channel_names)==0 : channel_names= extract_channels_based_on_channelnamespace(xml_data=data_xml,channel_namespace=channel_namespace,is_opticalband=is_opticalband) - logging.info(f"channel_names {channel_names}") + ports = extract_ports_based_on_type(data_xml) optical_channels_params=[] ports_result=[] diff --git a/src/opticalcontroller/OpticalController.py b/src/opticalcontroller/OpticalController.py index 33ff0a743..8b5818c77 100644 --- a/src/opticalcontroller/OpticalController.py +++ b/src/opticalcontroller/OpticalController.py @@ -106,13 +106,13 @@ class AddFlexLightpath(Resource): else: return "Error", 404 # @optical.route('/DelFlexLightpath/<string:src>/<string:dst>/<int:bitrate>/<int:o_band_id>') -@optical.route('/DelFlexLightpath/<string:src>/<string:dst>/<int:bitrate>/<int:o_band_id>/<int:delete_band>') -@optical.route('/DelFlexLightpath/<string:src>/<string:dst>/<int:bitrate>/<int:o_band_id>/<int:delete_band>/<int:flow_id>') +@optical.route('/DelFlexLightpath/<string:src>/<string:dst>/<int:bitrate>/<int:o_band_id>') +@optical.route('/DelFlexLightpath/<string:src>/<string:dst>/<int:bitrate>/<int:o_band_id>/<int:flow_id>') @optical.response(200, 'Success') @optical.response(404, 'Error, not found') class DelFLightpath(Resource): @staticmethod - def delete( src, dst, bitrate, o_band_id,delete_band,flow_id=None): + def delete( src, dst, bitrate, o_band_id,flow_id=None): flow = None match1=False ob_id=None @@ -171,14 +171,14 @@ class DelFLightpath(Resource): -@optical.route('/DelOpticalBand/<string:src>/<string:dst>/<int:o_band_id>/<int:delete_band>',methods=['DELETE']) +@optical.route('/DelOpticalBand/<string:src>/<string:dst>/<int:o_band_id>',methods=['DELETE']) @optical.response(200, 'Success') @optical.response(404, 'Error, not found') class DelOpticalBand(Resource): @staticmethod - def delete( src, dst, o_band_id,delete_band): + def delete( src, dst, o_band_id): flow = None - match1=True + ob_id=None if o_band_id is not None : @@ -210,23 +210,17 @@ class DelOpticalBand(Resource): else: return "ob_id {} not matching".format(ob_id), 404 else: - if match1: + if ob_id is not None: - if ob_id is not None: - - if len( rsa.optical_bands[ob_id]["served_lightpaths"]) != 0: - return "DELETE_NOT_ALLOWED" ,400 + if len( rsa.optical_bands[ob_id]["served_lightpaths"]) != 0: + return "DELETE_NOT_ALLOWED" ,400 - rsa.del_band(flow,ob_id) - - - - if debug: - print(f"vor ob_id {ob_id} rsa.optical_bands {rsa.optical_bands[ob_id]}") - print(f"rsa.links_dict {rsa.links_dict}") - return "ob_id {} deleted".format(ob_id), 200 - else: - return "ob_id {} not matching".format(ob_id), 404 + rsa.del_band(flow,ob_id) + if debug: + print(f"vor ob_id {ob_id} rsa.optical_bands {rsa.optical_bands[ob_id]}") + print(f"rsa.links_dict {rsa.links_dict}") + return "ob_id {} deleted".format(ob_id), 200 + else : return "flow for ob_id {} not found".format(ob_id),400 else: diff --git a/src/service/service/service_handlers/oc/OCTools.py b/src/service/service/service_handlers/oc/OCTools.py index e796e2f6c..6853458c9 100644 --- a/src/service/service/service_handlers/oc/OCTools.py +++ b/src/service/service/service_handlers/oc/OCTools.py @@ -123,7 +123,7 @@ def ob_flows(endpoints : List[Tuple[str, str, Optional[str]]], bidir : int): if bidir: endpoint = endpoints[i] device_uuid, endpoint_uuid = endpoint[0:2] - log.info("current OCTools step {}, {}, {}".format(i, device_uuid, endpoint_uuid)) + if device_uuid not in entries.keys(): entries[device_uuid] = [] entry_tuple = "0", endpoint_uuid @@ -140,7 +140,7 @@ def ob_flows(endpoints : List[Tuple[str, str, Optional[str]]], bidir : int): return {} i = i + 2 if end > 4: - log.info("Bidirectional optical band connection with {} (>4) endpoints".format(end)) + while(i < end-2): #i endpoint = endpoints[i] @@ -189,19 +189,19 @@ def ob_flows(endpoints : List[Tuple[str, str, Optional[str]]], bidir : int): else: endpoint = endpoints[i] device_uuid, endpoint_uuid = endpoint[0:2] - log.info("current OCTools step {}, {}, {}".format(i, device_uuid, endpoint_uuid)) + if device_uuid not in entries.keys(): entries[device_uuid] = [] entry_tuple = "0", endpoint_uuid entries[device_uuid].append(entry_tuple) i = i + 1 if end > 2: - log.info("Unidirectional optical band connection with {} (>2) endpoints".format(end)) + while(i < end-1): #i endpoint = endpoints[i] device_uuid, endpoint_uuid = endpoint[0:2] - log.info("current OCTools step {}, {}, {}".format(i, device_uuid, endpoint_uuid)) + if device_uuid not in entries.keys(): entries[device_uuid] = [] #i+1 @@ -231,7 +231,7 @@ def conn_flows(endpoints : List[Tuple[str, str, Optional[str]]], bidir : int): #tx tp endpoint = endpoints[i] device_uuid, endpoint_uuid = endpoint[0:2] - log.info("current OCTools step {}, {}, {}".format(i, device_uuid, endpoint_uuid)) + if device_uuid not in entries.keys(): entries[device_uuid] = [] entry_tuple = "0", endpoint_uuid @@ -244,7 +244,7 @@ def conn_flows(endpoints : List[Tuple[str, str, Optional[str]]], bidir : int): #i endpoint = endpoints[i] device_uuid, endpoint_uuid = endpoint[0:2] - log.info("current OCTools step {}, {}, {}".format(i, device_uuid, endpoint_uuid)) + if device_uuid not in entries.keys(): entries[device_uuid] = [] #i+1 @@ -254,8 +254,7 @@ def conn_flows(endpoints : List[Tuple[str, str, Optional[str]]], bidir : int): entry_tuple = endpoint_uuid, next_endpoint_uuid entries[device_uuid].append(entry_tuple) else: - log.info(f"ERROR1 in bidirectional connection ") - log.info("{}, {}, {}".format(i+2, next_device_uuid, device_uuid)) + return {} #i+2 @@ -269,15 +268,14 @@ def conn_flows(endpoints : List[Tuple[str, str, Optional[str]]], bidir : int): entries[device_uuid].append(entry_tuple) i = i + 4 else: - log.info("ERROR2 in bidirection connection") - log.info("{}, {}, {}".format(i+4, next_2_device_uuid, device_uuid)) + return {} else: while(i < end-1): #i endpoint = endpoints[i] device_uuid, endpoint_uuid = endpoint[0:2] - log.info("current OCTools step {}, {}, {}".format(i, device_uuid, endpoint_uuid)) + if device_uuid not in entries.keys(): entries[device_uuid] = [] #i+1 @@ -288,8 +286,7 @@ def conn_flows(endpoints : List[Tuple[str, str, Optional[str]]], bidir : int): entries[device_uuid].append(entry_tuple) i = i + 2 else: - log.info("ERROR3 in bidirectional ob") - log.info("{}, {}, {}".format(i, next_device_uuid, device_uuid)) + return {} #rx tp endpoint = endpoints[i] @@ -302,7 +299,7 @@ def conn_flows(endpoints : List[Tuple[str, str, Optional[str]]], bidir : int): def endpoints_to_flows(endpoints : List[Tuple[str, str, Optional[str]]], bidir : int, is_ob: bool)->Dict: - log.info("AAAAAAAAAAAAAAAAAAAAAAAA: {}".format(endpoints)) + if is_ob: entries = ob_flows(endpoints, bidir) else: @@ -339,11 +336,11 @@ def handle_flows_names (task_executor,flows:dict)->Dict : def check_media_channel_existance (service:Service): has_media_channel=False for config_rule in service.service_config.config_rules: - log.info(f"config_rule {config_rule}") + if isinstance(config_rule.custom.resource_value,str): settings=json.dumps(config_rule.custom.resource_value) if "flow_id" in settings : has_media_channel=True - log.info(f"has_media_channel {has_media_channel}") + return has_media_channel \ No newline at end of file diff --git a/src/service/service/tools/OpticalTools.py b/src/service/service/tools/OpticalTools.py index 52bda1d5e..b7760d2ef 100644 --- a/src/service/service/tools/OpticalTools.py +++ b/src/service/service/tools/OpticalTools.py @@ -118,7 +118,7 @@ def refresh_opticalcontroller (topology_id:dict): if (res is not None ): - logging.info(f"res from opticalcontroler {res.json()}") + def add_lightpath(src, dst, bitrate, bidir, ob_band) -> str: if not TESTING: @@ -165,15 +165,15 @@ def delete_lightpath( src, dst, bitrate, ob_id,delete_band,flow_id=None) -> str: if not TESTING: urlx=None if flow_id is not None: - urlx = "http://{}:{}/OpticalTFS/DelFlexLightpath/{}/{}/{}/{}/{}/{}".format(OPTICAL_IP, OPTICAL_PORT, src, dst, bitrate, ob_id,delete_band,flow_id) + urlx = "http://{}:{}/OpticalTFS/DelFlexLightpath/{}/{}/{}/{}/{}/{}".format(OPTICAL_IP, OPTICAL_PORT, src, dst, bitrate, ob_id,flow_id) else : - urlx = "http://{}:{}/OpticalTFS/DelOpticalBand/{}/{}/{}/{}".format(OPTICAL_IP, OPTICAL_PORT, src, dst, ob_id,delete_band) + urlx = "http://{}:{}/OpticalTFS/DelOpticalBand/{}/{}/{}/{}".format(OPTICAL_IP, OPTICAL_PORT, src, dst, ob_id) headers = {"Content-Type": "application/json"} r = requests.delete(urlx, headers=headers) reply = r.text code = r.status_code - logging.info(f"delete_lightpath reply {reply}") + return (reply,code) def DelFlexLightpath (flow_id,src,dst,bitrate,o_band_id): @@ -203,7 +203,7 @@ def adapt_reply(devices, service, reply_json, context_id, topology_id, optical_b rules_ob= [] ob_id = 0 connection_ob=None - log.info(f"BLACK {reply_json}\n {optical_band_txt}") + r = reply_json if "parent_opt_band" in r.keys(): ob_id = r["parent_opt_band"] diff --git a/src/webui/service/opticalconfig/routes.py b/src/webui/service/opticalconfig/routes.py index 508d762ad..f3552df6c 100644 --- a/src/webui/service/opticalconfig/routes.py +++ b/src/webui/service/opticalconfig/routes.py @@ -35,7 +35,7 @@ def home() : context_client.connect() opticalConfig_list:OpticalConfigList = context_client.GetOpticalConfig(Empty()) - logging.info("myconfigList %s",opticalConfig_list) + for configs in opticalConfig_list.opticalconfigs: @@ -53,7 +53,7 @@ def home() : list_config.append(value) - logging.info("opticalConfig %s",list_config) + context_client.close() -- GitLab