Commit 797a722c authored by Mohammad Ismaeel's avatar Mohammad Ismaeel
Browse files

clean code phase 2

parent d9d65afa
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)

+1 −1
Original line number Diff line number Diff line
@@ -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
        
+1 −1
Original line number Diff line number Diff line
@@ -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:
       
+7 −8
Original line number Diff line number Diff line
@@ -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:
+1 −1
Original line number Diff line number Diff line
@@ -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
Loading