Loading my_deploy.sh +2 −2 Original line number Diff line number Diff line Loading @@ -99,10 +99,10 @@ export CRDB_DATABASE="tfs" export CRDB_DEPLOY_MODE="single" # Disable flag for dropping database, if it exists. export CRDB_DROP_DATABASE_IF_EXISTS="" export CRDB_DROP_DATABASE_IF_EXISTS="YES" # Disable flag for re-deploying CockroachDB from scratch. export CRDB_REDEPLOY="YES" export CRDB_REDEPLOY="" # ----- NATS ------------------------------------------------------------------- Loading src/common/tools/object_factory/OpticalLink.py +31 −1 Original line number Diff line number Diff line Loading @@ -43,3 +43,33 @@ def order_dict (dct:dict)->dict: if (len(ordered_lst)>0): return list_to_dict (ordered_lst) def order_dict_v1 (dct:dict)->dict: lst = list() for key,value in dct.items(): lst.append((int(key),value)) ordered_lst= order_list(lst) if (len(ordered_lst)>0): return list_to_dict (ordered_lst) def correct_slot (dic:dict): ordered_dict= order_dict_v1(dic) keys_list = list(ordered_dict.keys()) if (len(keys_list) < 20): num_keys= [] for i in keys_list: num_keys.append(int(i)) if num_keys[-1] != 20 : missed_keys=[] diff= 20 - len(num_keys) print(f"diff {diff}") for i in range(diff+1): missed_keys.append(num_keys[-1]+i) print(f"missed_keys {missed_keys}") for key in missed_keys : ordered_dict[key]=1 print(f"result {ordered_dict}") return order_dict_v1(ordered_dict) No newline at end of file src/context/service/database/Topology.py +1 −1 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ def topology_get_details(db_engine : Engine, request : TopologyId) -> TopologyDe .options(selectinload(TopologyModel.topology_optical_links, TopologyOpticalLinkModel.optical_link, OpticalLinkModel.opticallink_endpoints))\ .filter_by(topology_uuid=topology_uuid).one_or_none() #.options(selectinload(DeviceModel.components))\ LOGGER.info(f"optical_link from get_topology_details {obj.dump_details()['optical_links']} ") return None if obj is None else obj.dump_details() obj = run_transaction(sessionmaker(bind=db_engine), callback) if obj is None: Loading src/context/service/database/models/Slot.py +4 −4 Original line number Diff line number Diff line Loading @@ -27,13 +27,13 @@ class SlotType(TypeDecorator): def process_bind_param(self, value, dialect): if value is not None: logging.info(f"before ordering {value} ") value =order_dict(value) logging.info(f"after ordering {value} ") bin_num="0b" for i,(key,val) in enumerate(value.items()): bin_num =bin_num + f"{val}" logging.info(f"after ordering bin_num {bin_num} ") int_num = int(bin_num,2) return int_num Loading Loading @@ -63,7 +63,7 @@ class C_Slot (SlotType): if (len(sliced_num) != 20) : for i in range(0,20 - len(sliced_num)): sliced_num='0'+sliced_num logging.info(f"sliced_num {sliced_num}") for i in range(len(sliced_num)): slot[str(self.start_point+i+1)]=int(sliced_num[i]) Loading src/device/service/DeviceServiceServicerImpl.py +1 −1 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ class DeviceServiceServicerImpl(DeviceServiceServicer): # #endpoint.endpoint_id.device_id.CopyFrom(device.device_id) # pass if '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']) Loading Loading
my_deploy.sh +2 −2 Original line number Diff line number Diff line Loading @@ -99,10 +99,10 @@ export CRDB_DATABASE="tfs" export CRDB_DEPLOY_MODE="single" # Disable flag for dropping database, if it exists. export CRDB_DROP_DATABASE_IF_EXISTS="" export CRDB_DROP_DATABASE_IF_EXISTS="YES" # Disable flag for re-deploying CockroachDB from scratch. export CRDB_REDEPLOY="YES" export CRDB_REDEPLOY="" # ----- NATS ------------------------------------------------------------------- Loading
src/common/tools/object_factory/OpticalLink.py +31 −1 Original line number Diff line number Diff line Loading @@ -43,3 +43,33 @@ def order_dict (dct:dict)->dict: if (len(ordered_lst)>0): return list_to_dict (ordered_lst) def order_dict_v1 (dct:dict)->dict: lst = list() for key,value in dct.items(): lst.append((int(key),value)) ordered_lst= order_list(lst) if (len(ordered_lst)>0): return list_to_dict (ordered_lst) def correct_slot (dic:dict): ordered_dict= order_dict_v1(dic) keys_list = list(ordered_dict.keys()) if (len(keys_list) < 20): num_keys= [] for i in keys_list: num_keys.append(int(i)) if num_keys[-1] != 20 : missed_keys=[] diff= 20 - len(num_keys) print(f"diff {diff}") for i in range(diff+1): missed_keys.append(num_keys[-1]+i) print(f"missed_keys {missed_keys}") for key in missed_keys : ordered_dict[key]=1 print(f"result {ordered_dict}") return order_dict_v1(ordered_dict) No newline at end of file
src/context/service/database/Topology.py +1 −1 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ def topology_get_details(db_engine : Engine, request : TopologyId) -> TopologyDe .options(selectinload(TopologyModel.topology_optical_links, TopologyOpticalLinkModel.optical_link, OpticalLinkModel.opticallink_endpoints))\ .filter_by(topology_uuid=topology_uuid).one_or_none() #.options(selectinload(DeviceModel.components))\ LOGGER.info(f"optical_link from get_topology_details {obj.dump_details()['optical_links']} ") return None if obj is None else obj.dump_details() obj = run_transaction(sessionmaker(bind=db_engine), callback) if obj is None: Loading
src/context/service/database/models/Slot.py +4 −4 Original line number Diff line number Diff line Loading @@ -27,13 +27,13 @@ class SlotType(TypeDecorator): def process_bind_param(self, value, dialect): if value is not None: logging.info(f"before ordering {value} ") value =order_dict(value) logging.info(f"after ordering {value} ") bin_num="0b" for i,(key,val) in enumerate(value.items()): bin_num =bin_num + f"{val}" logging.info(f"after ordering bin_num {bin_num} ") int_num = int(bin_num,2) return int_num Loading Loading @@ -63,7 +63,7 @@ class C_Slot (SlotType): if (len(sliced_num) != 20) : for i in range(0,20 - len(sliced_num)): sliced_num='0'+sliced_num logging.info(f"sliced_num {sliced_num}") for i in range(len(sliced_num)): slot[str(self.start_point+i+1)]=int(sliced_num[i]) Loading
src/device/service/DeviceServiceServicerImpl.py +1 −1 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ class DeviceServiceServicerImpl(DeviceServiceServicer): # #endpoint.endpoint_id.device_id.CopyFrom(device.device_id) # pass if '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']) Loading