Loading src/context/service/database/Device.py +1 −1 Original line number Original line Diff line number Diff line Loading @@ -108,7 +108,7 @@ def device_set(db_engine : Engine, messagebroker : MessageBroker, request : Devi is_oc_driver = DeviceDriverEnum.DEVICEDRIVER_OC in set(request.device_drivers) is_oc_driver = DeviceDriverEnum.DEVICEDRIVER_OC in set(request.device_drivers) #optical_endpoints_data : List[Dict] = list() #optical_endpoints_data : List[Dict] = list() LOGGER.info(f"is_oc_driver {is_oc_driver}") endpoints_data : List[Dict] = list() endpoints_data : List[Dict] = list() for i, endpoint in enumerate(request.device_endpoints): for i, endpoint in enumerate(request.device_endpoints): endpoint_device_uuid = endpoint.endpoint_id.device_id.device_uuid.uuid endpoint_device_uuid = endpoint.endpoint_id.device_id.device_uuid.uuid Loading src/context/service/database/OpticalConfig.py +8 −11 Original line number Original line Diff line number Diff line Loading @@ -61,9 +61,9 @@ def set_opticalconfig(db_engine : Engine, request : OpticalConfig): channel_namespace= None channel_namespace= None OpticalConfig_data = [] OpticalConfig_data = [] config_type=None config_type=None is_transpondre=False #is_transpondre=False opticalconfig_uuid =opticalconfig_get_uuid(device_id) opticalconfig_uuid =opticalconfig_get_uuid(device_id) LOGGER.info(f"cofigy_type {request.config}") if request.config: if request.config: config = json.loads(request.config) config = json.loads(request.config) if 'channel_namespace' in config: if 'channel_namespace' in config: Loading Loading @@ -179,8 +179,6 @@ def set_opticalconfig(db_engine : Engine, request : OpticalConfig): } } ) ) LOGGER.info(f"added OpticalConfig_data {OpticalConfig_data}") LOGGER.info(f"added channels {channels}") def callback(session:Session)->bool: def callback(session:Session)->bool: stmt = insert(OpticalConfigModel).values(OpticalConfig_data) stmt = insert(OpticalConfigModel).values(OpticalConfig_data) Loading Loading @@ -279,9 +277,9 @@ def update_opticalconfig(db_engine : Engine, request : OpticalConfig): channel_namespace= None channel_namespace= None OpticalConfig_data = [] OpticalConfig_data = [] config_type=None config_type=None is_transpondre=False #is_transpondre=False opticalconfig_uuid =opticalconfig_get_uuid(device_id) opticalconfig_uuid =opticalconfig_get_uuid(device_id) LOGGER.info(f"udpate_cofigy_type {request.config}") if request.config : if request.config : config = json.loads(request.config) config = json.loads(request.config) Loading Loading @@ -432,8 +430,7 @@ def update_opticalconfig(db_engine : Engine, request : OpticalConfig): } } ) ) LOGGER.info(f"udpate_ OpticalConfig_data {OpticalConfig_data}") LOGGER.info(f"udpate_ channels {channels}") def callback(session:Session)->bool: def callback(session:Session)->bool: stmt = insert(OpticalConfigModel).values(OpticalConfig_data) stmt = insert(OpticalConfigModel).values(OpticalConfig_data) Loading Loading @@ -530,7 +527,7 @@ def select_opticalconfig(db_engine:Engine,request:OpticalConfigId): result.opticalconfig_id.opticalconfig_uuid = ids_obj["opticalconfig_uuid"] result.opticalconfig_id.opticalconfig_uuid = ids_obj["opticalconfig_uuid"] result.device_id.device_uuid.uuid=ids_obj["device_uuid"] result.device_id.device_uuid.uuid=ids_obj["device_uuid"] LOGGER.info(f"select_opticalconfig {result}") return result return result return run_transaction(sessionmaker(bind=db_engine, expire_on_commit=False), callback) return run_transaction(sessionmaker(bind=db_engine, expire_on_commit=False), callback) Loading @@ -556,7 +553,7 @@ def delete_opticalchannel(db_engine : Engine ,messagebroker : MessageBroker, re opticalconfig_uuid = request.opticalconfig_id.opticalconfig_uuid opticalconfig_uuid = request.opticalconfig_id.opticalconfig_uuid channels=[] channels=[] config_type=None config_type=None LOGGER.info(f"delete_optical_channel config {config}") if "type" in config : if "type" in config : config_type= config["type"] config_type= config["type"] if 'new_config' in config: if 'new_config' in config: Loading Loading @@ -612,7 +609,7 @@ def delete_opticalchannel(db_engine : Engine ,messagebroker : MessageBroker, re else : else : return return LOGGER.info(f"delete channel {channels}") def callback(session : Session): def callback(session : Session): Loading src/context/service/database/OpticalLink.py +1 −2 Original line number Original line Diff line number Diff line Loading @@ -103,8 +103,7 @@ def optical_link_set(db_engine : Engine, messagebroker : MessageBroker, request LOGGER.info(f"update_link_uuid {link_uuid}") LOGGER.info(f"c_slots {request.optical_details.c_slots }") optical_link_data = [{ optical_link_data = [{ 'opticallink_uuid' : link_uuid, 'opticallink_uuid' : link_uuid, 'name' : link_name, 'name' : link_name, Loading src/device/service/DeviceServiceServicerImpl.py +2 −3 Original line number Original line Diff line number Diff line Loading @@ -60,8 +60,7 @@ class DeviceServiceServicerImpl(DeviceServiceServicer): device_uuid = request.device_id.device_uuid.uuid device_uuid = request.device_id.device_uuid.uuid connection_config_rules = check_connect_rules(request.device_config) connection_config_rules = check_connect_rules(request.device_config) LOGGER.info(f"connection_config_rules {connection_config_rules}") LOGGER.info(f"lenght of connection_config_rules {len(connection_config_rules)}") check_no_endpoints(request.device_endpoints) check_no_endpoints(request.device_endpoints) Loading Loading @@ -158,7 +157,7 @@ class DeviceServiceServicerImpl(DeviceServiceServicer): #for endpoint in request.device_endpoints: #for endpoint in request.device_endpoints: # #endpoint.endpoint_id.device_id.CopyFrom(device.device_id) # #endpoint.endpoint_id.device_id.CopyFrom(device.device_id) # pass # pass LOGGER.info(f"add_device {new_optial_configs}") if ('new_optical_config' in new_optial_configs and 'opticalconfig' in new_optial_configs["new_optical_config"]): if ('new_optical_config' in new_optial_configs and 'opticalconfig' in new_optial_configs["new_optical_config"]): context_client.SetOpticalConfig(new_optial_configs["new_optical_config"]['opticalconfig']) context_client.SetOpticalConfig(new_optial_configs["new_optical_config"]['opticalconfig']) Loading src/device/service/OpenConfigServicer.py +9 −10 Original line number Original line Diff line number Diff line Loading @@ -80,7 +80,7 @@ class OpenConfigServicer(DeviceServiceServicer): is_all_good=True is_all_good=True config =json.loads(request.config) config =json.loads(request.config) results=None results=None LOGGER.info(f" config from openconfigservicer {config}") try: try: context_client = ContextClient() context_client = ContextClient() device = get_device( device = get_device( Loading @@ -89,23 +89,23 @@ class OpenConfigServicer(DeviceServiceServicer): if device is None: if device is None: raise NotFoundException('Device', device_uuid, extra_details='loading in ConfigureDevice') raise NotFoundException('Device', device_uuid, extra_details='loading in ConfigureDevice') LOGGER.info(f"device is {device.name}") resources,conditions=extract_resources(config=config,device=device) resources,conditions=extract_resources(config=config,device=device) LOGGER.info(f"from openconfigservicer {resources} and conditions {conditions}") driver : _Driver = get_driver(self.driver_instance_cache, device) driver : _Driver = get_driver(self.driver_instance_cache, device) results = driver.SetConfig(resources=resources,conditions=conditions) results = driver.SetConfig(resources=resources,conditions=conditions) for result in results: for result in results: if not result : if not result : is_all_good=False is_all_good=False LOGGER.info(f"resluts {results} and is_all_good {is_all_good}") if is_all_good: if is_all_good: #driver.GetConfig(resource_keys=[]) #driver.GetConfig(resource_keys=[]) config = json.loads(request.config) config = json.loads(request.config) handled_flow=next((i for i in resources if i['resource_key']=='handled_flow'),None) handled_flow=next((i for i in resources if i['resource_key']=='handled_flow'),None) flow_handled=[ ] flow_handled=[ ] LOGGER.info(f"flow_handled {handled_flow}") if handled_flow is not None and len(handled_flow)>0: if handled_flow is not None and len(handled_flow)>0: config['flow_handled']=handled_flow['value'] config['flow_handled']=handled_flow['value'] Loading @@ -126,7 +126,6 @@ class OpenConfigServicer(DeviceServiceServicer): device_uuid = configs.device_id.device_uuid.uuid device_uuid = configs.device_id.device_uuid.uuid LOGGER.info(f" Get DeviceConfigure {device_uuid}") try: try: device = get_device( device = get_device( Loading Loading @@ -164,7 +163,7 @@ class OpenConfigServicer(DeviceServiceServicer): resources:list[dict]=[] resources:list[dict]=[] is_all_good=True is_all_good=True config =json.loads(request.config) config =json.loads(request.config) LOGGER.info(f"Disable config from openconfigservicer {config}") try: try: context_client = ContextClient() context_client = ContextClient() device = get_device( device = get_device( Loading @@ -173,9 +172,9 @@ class OpenConfigServicer(DeviceServiceServicer): if device is None: if device is None: raise NotFoundException('Device', device_uuid, extra_details='loading in ConfigureDevice') raise NotFoundException('Device', device_uuid, extra_details='loading in ConfigureDevice') LOGGER.info(f"device is {device.name}") resources,conditions=extract_resources(config=config,device=device) resources,conditions=extract_resources(config=config,device=device) LOGGER.info(f" Disable resources from openconfigservicer {resources} and conditions {conditions}") driver : _Driver = get_driver(self.driver_instance_cache, device) driver : _Driver = get_driver(self.driver_instance_cache, device) if 'edit_type' in conditions and conditions['edit_type'] == 'optical-band': if 'edit_type' in conditions and conditions['edit_type'] == 'optical-band': roadm_configuration = driver.GetConfig() roadm_configuration = driver.GetConfig() Loading @@ -187,7 +186,7 @@ class OpenConfigServicer(DeviceServiceServicer): for result in results: for result in results: if not result : if not result : is_all_good=False is_all_good=False LOGGER.info(f"Disable resluts {results} and is_all_good {is_all_good}") if is_all_good: if is_all_good: config = json.loads(request.config) config = json.loads(request.config) flow_handled=[ ] flow_handled=[ ] Loading Loading
src/context/service/database/Device.py +1 −1 Original line number Original line Diff line number Diff line Loading @@ -108,7 +108,7 @@ def device_set(db_engine : Engine, messagebroker : MessageBroker, request : Devi is_oc_driver = DeviceDriverEnum.DEVICEDRIVER_OC in set(request.device_drivers) is_oc_driver = DeviceDriverEnum.DEVICEDRIVER_OC in set(request.device_drivers) #optical_endpoints_data : List[Dict] = list() #optical_endpoints_data : List[Dict] = list() LOGGER.info(f"is_oc_driver {is_oc_driver}") endpoints_data : List[Dict] = list() endpoints_data : List[Dict] = list() for i, endpoint in enumerate(request.device_endpoints): for i, endpoint in enumerate(request.device_endpoints): endpoint_device_uuid = endpoint.endpoint_id.device_id.device_uuid.uuid endpoint_device_uuid = endpoint.endpoint_id.device_id.device_uuid.uuid Loading
src/context/service/database/OpticalConfig.py +8 −11 Original line number Original line Diff line number Diff line Loading @@ -61,9 +61,9 @@ def set_opticalconfig(db_engine : Engine, request : OpticalConfig): channel_namespace= None channel_namespace= None OpticalConfig_data = [] OpticalConfig_data = [] config_type=None config_type=None is_transpondre=False #is_transpondre=False opticalconfig_uuid =opticalconfig_get_uuid(device_id) opticalconfig_uuid =opticalconfig_get_uuid(device_id) LOGGER.info(f"cofigy_type {request.config}") if request.config: if request.config: config = json.loads(request.config) config = json.loads(request.config) if 'channel_namespace' in config: if 'channel_namespace' in config: Loading Loading @@ -179,8 +179,6 @@ def set_opticalconfig(db_engine : Engine, request : OpticalConfig): } } ) ) LOGGER.info(f"added OpticalConfig_data {OpticalConfig_data}") LOGGER.info(f"added channels {channels}") def callback(session:Session)->bool: def callback(session:Session)->bool: stmt = insert(OpticalConfigModel).values(OpticalConfig_data) stmt = insert(OpticalConfigModel).values(OpticalConfig_data) Loading Loading @@ -279,9 +277,9 @@ def update_opticalconfig(db_engine : Engine, request : OpticalConfig): channel_namespace= None channel_namespace= None OpticalConfig_data = [] OpticalConfig_data = [] config_type=None config_type=None is_transpondre=False #is_transpondre=False opticalconfig_uuid =opticalconfig_get_uuid(device_id) opticalconfig_uuid =opticalconfig_get_uuid(device_id) LOGGER.info(f"udpate_cofigy_type {request.config}") if request.config : if request.config : config = json.loads(request.config) config = json.loads(request.config) Loading Loading @@ -432,8 +430,7 @@ def update_opticalconfig(db_engine : Engine, request : OpticalConfig): } } ) ) LOGGER.info(f"udpate_ OpticalConfig_data {OpticalConfig_data}") LOGGER.info(f"udpate_ channels {channels}") def callback(session:Session)->bool: def callback(session:Session)->bool: stmt = insert(OpticalConfigModel).values(OpticalConfig_data) stmt = insert(OpticalConfigModel).values(OpticalConfig_data) Loading Loading @@ -530,7 +527,7 @@ def select_opticalconfig(db_engine:Engine,request:OpticalConfigId): result.opticalconfig_id.opticalconfig_uuid = ids_obj["opticalconfig_uuid"] result.opticalconfig_id.opticalconfig_uuid = ids_obj["opticalconfig_uuid"] result.device_id.device_uuid.uuid=ids_obj["device_uuid"] result.device_id.device_uuid.uuid=ids_obj["device_uuid"] LOGGER.info(f"select_opticalconfig {result}") return result return result return run_transaction(sessionmaker(bind=db_engine, expire_on_commit=False), callback) return run_transaction(sessionmaker(bind=db_engine, expire_on_commit=False), callback) Loading @@ -556,7 +553,7 @@ def delete_opticalchannel(db_engine : Engine ,messagebroker : MessageBroker, re opticalconfig_uuid = request.opticalconfig_id.opticalconfig_uuid opticalconfig_uuid = request.opticalconfig_id.opticalconfig_uuid channels=[] channels=[] config_type=None config_type=None LOGGER.info(f"delete_optical_channel config {config}") if "type" in config : if "type" in config : config_type= config["type"] config_type= config["type"] if 'new_config' in config: if 'new_config' in config: Loading Loading @@ -612,7 +609,7 @@ def delete_opticalchannel(db_engine : Engine ,messagebroker : MessageBroker, re else : else : return return LOGGER.info(f"delete channel {channels}") def callback(session : Session): def callback(session : Session): Loading
src/context/service/database/OpticalLink.py +1 −2 Original line number Original line Diff line number Diff line Loading @@ -103,8 +103,7 @@ def optical_link_set(db_engine : Engine, messagebroker : MessageBroker, request LOGGER.info(f"update_link_uuid {link_uuid}") LOGGER.info(f"c_slots {request.optical_details.c_slots }") optical_link_data = [{ optical_link_data = [{ 'opticallink_uuid' : link_uuid, 'opticallink_uuid' : link_uuid, 'name' : link_name, 'name' : link_name, Loading
src/device/service/DeviceServiceServicerImpl.py +2 −3 Original line number Original line Diff line number Diff line Loading @@ -60,8 +60,7 @@ class DeviceServiceServicerImpl(DeviceServiceServicer): device_uuid = request.device_id.device_uuid.uuid device_uuid = request.device_id.device_uuid.uuid connection_config_rules = check_connect_rules(request.device_config) connection_config_rules = check_connect_rules(request.device_config) LOGGER.info(f"connection_config_rules {connection_config_rules}") LOGGER.info(f"lenght of connection_config_rules {len(connection_config_rules)}") check_no_endpoints(request.device_endpoints) check_no_endpoints(request.device_endpoints) Loading Loading @@ -158,7 +157,7 @@ class DeviceServiceServicerImpl(DeviceServiceServicer): #for endpoint in request.device_endpoints: #for endpoint in request.device_endpoints: # #endpoint.endpoint_id.device_id.CopyFrom(device.device_id) # #endpoint.endpoint_id.device_id.CopyFrom(device.device_id) # pass # pass LOGGER.info(f"add_device {new_optial_configs}") if ('new_optical_config' in new_optial_configs and 'opticalconfig' in new_optial_configs["new_optical_config"]): if ('new_optical_config' in new_optial_configs and 'opticalconfig' in new_optial_configs["new_optical_config"]): context_client.SetOpticalConfig(new_optial_configs["new_optical_config"]['opticalconfig']) context_client.SetOpticalConfig(new_optial_configs["new_optical_config"]['opticalconfig']) Loading
src/device/service/OpenConfigServicer.py +9 −10 Original line number Original line Diff line number Diff line Loading @@ -80,7 +80,7 @@ class OpenConfigServicer(DeviceServiceServicer): is_all_good=True is_all_good=True config =json.loads(request.config) config =json.loads(request.config) results=None results=None LOGGER.info(f" config from openconfigservicer {config}") try: try: context_client = ContextClient() context_client = ContextClient() device = get_device( device = get_device( Loading @@ -89,23 +89,23 @@ class OpenConfigServicer(DeviceServiceServicer): if device is None: if device is None: raise NotFoundException('Device', device_uuid, extra_details='loading in ConfigureDevice') raise NotFoundException('Device', device_uuid, extra_details='loading in ConfigureDevice') LOGGER.info(f"device is {device.name}") resources,conditions=extract_resources(config=config,device=device) resources,conditions=extract_resources(config=config,device=device) LOGGER.info(f"from openconfigservicer {resources} and conditions {conditions}") driver : _Driver = get_driver(self.driver_instance_cache, device) driver : _Driver = get_driver(self.driver_instance_cache, device) results = driver.SetConfig(resources=resources,conditions=conditions) results = driver.SetConfig(resources=resources,conditions=conditions) for result in results: for result in results: if not result : if not result : is_all_good=False is_all_good=False LOGGER.info(f"resluts {results} and is_all_good {is_all_good}") if is_all_good: if is_all_good: #driver.GetConfig(resource_keys=[]) #driver.GetConfig(resource_keys=[]) config = json.loads(request.config) config = json.loads(request.config) handled_flow=next((i for i in resources if i['resource_key']=='handled_flow'),None) handled_flow=next((i for i in resources if i['resource_key']=='handled_flow'),None) flow_handled=[ ] flow_handled=[ ] LOGGER.info(f"flow_handled {handled_flow}") if handled_flow is not None and len(handled_flow)>0: if handled_flow is not None and len(handled_flow)>0: config['flow_handled']=handled_flow['value'] config['flow_handled']=handled_flow['value'] Loading @@ -126,7 +126,6 @@ class OpenConfigServicer(DeviceServiceServicer): device_uuid = configs.device_id.device_uuid.uuid device_uuid = configs.device_id.device_uuid.uuid LOGGER.info(f" Get DeviceConfigure {device_uuid}") try: try: device = get_device( device = get_device( Loading Loading @@ -164,7 +163,7 @@ class OpenConfigServicer(DeviceServiceServicer): resources:list[dict]=[] resources:list[dict]=[] is_all_good=True is_all_good=True config =json.loads(request.config) config =json.loads(request.config) LOGGER.info(f"Disable config from openconfigservicer {config}") try: try: context_client = ContextClient() context_client = ContextClient() device = get_device( device = get_device( Loading @@ -173,9 +172,9 @@ class OpenConfigServicer(DeviceServiceServicer): if device is None: if device is None: raise NotFoundException('Device', device_uuid, extra_details='loading in ConfigureDevice') raise NotFoundException('Device', device_uuid, extra_details='loading in ConfigureDevice') LOGGER.info(f"device is {device.name}") resources,conditions=extract_resources(config=config,device=device) resources,conditions=extract_resources(config=config,device=device) LOGGER.info(f" Disable resources from openconfigservicer {resources} and conditions {conditions}") driver : _Driver = get_driver(self.driver_instance_cache, device) driver : _Driver = get_driver(self.driver_instance_cache, device) if 'edit_type' in conditions and conditions['edit_type'] == 'optical-band': if 'edit_type' in conditions and conditions['edit_type'] == 'optical-band': roadm_configuration = driver.GetConfig() roadm_configuration = driver.GetConfig() Loading @@ -187,7 +186,7 @@ class OpenConfigServicer(DeviceServiceServicer): for result in results: for result in results: if not result : if not result : is_all_good=False is_all_good=False LOGGER.info(f"Disable resluts {results} and is_all_good {is_all_good}") if is_all_good: if is_all_good: config = json.loads(request.config) config = json.loads(request.config) flow_handled=[ ] flow_handled=[ ] Loading