Loading src/device/service/Tools.py +1 −1 Original line number Diff line number Diff line Loading @@ -523,7 +523,7 @@ def extract_resources(config : dict, device : Device) -> list[list[dict],dict]: if 'frequency' in config['new_config'] and 'band' in config['new_config'] and conditions['edit_type'] == 'media-channel': if config['new_config']['frequency'] is not None and config['new_config']['band'] is not None: lower_frequency = int(int(config['new_config']['frequency']) - (int(config['new_config']['band'])/2)) lower_frequency = int(int(config['new_config']['frequency']) - (int(config['new_config']['band'])/2)+1) upper_frequency = int(int(config['new_config']['frequency']) + (int(config['new_config']['band'])/2)) Loading src/device/service/drivers/oc_driver/templates/VPN/roadms.py +1 −1 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ def create_media_channel_v2 (resources): if resource['resource_key'] == "index": with tag('index'):text(str(int(index)+n)) elif resource['resource_key']== 'optical-band-parent' : with tag('optical-band-parent',xmlns=optical_band_namespaces):text(resource['value']) with tag('optical-band-parent',xmlns=optical_band_namespaces):text(int(resource['value'])+int(n)) elif resource['resource_key']== 'admin-state' : with tag('admin-status'):text(resource['value']) else: Loading src/opticalcontroller/OpticalController.py +1 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ class DelFLightpath(Resource): def delete(flow_id, src, dst, bitrate, o_band_id): if flow_id in rsa.db_flows.keys(): flow = rsa.db_flows[flow_id] print(f"delete flexlightpath flow {flow}") bidir = flow["bidir"] match1 = flow["src"] == src and flow["dst"] == dst and flow["bitrate"] == bitrate if bidir: Loading src/opticalcontroller/RSA.py +20 −12 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ class RSA(): def init_link_slots(self, testing): if not testing: if full_links: for l in self.links_dict["optical_links"]: for fib in l["optical_link"]["details"]["fibers"]: #fib = self.links_dict[l]["fibers"][f] Loading @@ -46,7 +46,7 @@ class RSA(): return "{},{},{}".format(self.c_slot_number, self.l_slot_number, self.s_slot_number) def init_link_slots2(self, testing): if not testing: if full_links: for l in self.links_dict["optical_links"]: fib = l["optical_details"] #fib = self.links_dict[l]["fibers"][f] Loading Loading @@ -279,7 +279,7 @@ class RSA(): fib[band][str(i)] = 1 if 'used' in fib: fib['used'] = False fib[band].sort() #fib[band].sort() def restore_link_2(self, fib, slots, band,link): print("start restoring link") Loading @@ -287,7 +287,7 @@ class RSA(): fib[band][str(i)] = 1 if 'used' in fib: fib['used'] = False fib[band].sort() #fib[band].keys().sort() set_link_update(fib,link,test="restoration") Loading @@ -312,9 +312,9 @@ class RSA(): self.optical_bands[optical_band_id][band][str(i)] = 1 print(f"example of self.optical_bands_after { self.optical_bands}") link_name= self.optical_bands[optical_band_id]['links'][0] link = self.get_link_by_name(link_name) update_optical_band(optical_bands=self.optical_bands,optical_band_id=optical_band_id,band=band,link=link) #link_name= self.optical_bands[optical_band_id]['links'][0] #link = self.get_link_by_name(link_name) #update_optical_band(optical_bands=self.optical_bands,optical_band_id=optical_band_id,band=band,link=link) def del_flow(self, flow, o_b_id = None): Loading @@ -338,18 +338,26 @@ class RSA(): fib = self.get_link_by_name(l)["optical_details"] print(f"del_flow_fib {fib } and band {band}") print(f"del_flow { str_list_to_int(fib[band].keys())}") if not list_in_list(slots, str_list_to_int(fib[band].keys())): ''' if list_in_list(slots, str_list_to_int(fib[band].keys())): #self.restore_link(fib, slots, band) print("invoking restore_link_2 from del_flow") self.restore_link_2(fib, slots, band,link=l) if debug: print(fib[band]) ''' print(f"invoking restore_link_2 fib: {fib} , slots {slots} , band {band} ") self.restore_link(fib, slots, band) if debug: print(fib[band]) if o_b_id is not None: if debug: print("restoring OB") #self.restore_optical_band(o_b_id, slots, band) self.restore_optical_band_2(o_b_id, slots, band,links) print(f"invoking restore_optical_band o_b_id: {o_b_id} , slots {slots} , band {band} ") self.restore_optical_band(o_b_id, slots, band) #self.restore_optical_band_2(o_b_id, slots, band,links) if bidir: for l in links: r_l = reverse_link(l) Loading @@ -359,8 +367,8 @@ class RSA(): # f = fiber_f[l] # fib = link['fibers'][f] fib = self.get_link_by_name(r_l)["optical_details"] if not list_in_list(slots, str_list_to_int(fib[band].keys())): self.restore_link(fib, slots, band) if list_in_list(slots, str_list_to_int(fib[band].keys())): self.restore_link(fib, slots, band, link=l) if debug: print(fib[band]) ''' Loading src/opticalcontroller/tools.py +15 −5 Original line number Diff line number Diff line Loading @@ -57,9 +57,15 @@ def consecutives(link, val): x1 = list(link.keys()) x = str_list_to_int(x1) x.sort() y = 0 if debug: print("BLACK") print(link) print(x) print(x[0]) if link[str(x[0])] == 1: temp.append(int(x[0])) y = 1 #print(link, x) for i in range(1, len(x)): if (int(x[i]) == int(x[i - 1]) + 1) and link[str(x[i])] == 1: y += 1 Loading @@ -67,8 +73,12 @@ def consecutives(link, val): else: if y >= val: res.extend(temp) if link[str(x[i])] == 1: temp = [int(x[i])] y = 1 else: temp = [] y = 0 if i == len(x) - 1 and y >= val: res.extend(temp) return res Loading Loading
src/device/service/Tools.py +1 −1 Original line number Diff line number Diff line Loading @@ -523,7 +523,7 @@ def extract_resources(config : dict, device : Device) -> list[list[dict],dict]: if 'frequency' in config['new_config'] and 'band' in config['new_config'] and conditions['edit_type'] == 'media-channel': if config['new_config']['frequency'] is not None and config['new_config']['band'] is not None: lower_frequency = int(int(config['new_config']['frequency']) - (int(config['new_config']['band'])/2)) lower_frequency = int(int(config['new_config']['frequency']) - (int(config['new_config']['band'])/2)+1) upper_frequency = int(int(config['new_config']['frequency']) + (int(config['new_config']['band'])/2)) Loading
src/device/service/drivers/oc_driver/templates/VPN/roadms.py +1 −1 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ def create_media_channel_v2 (resources): if resource['resource_key'] == "index": with tag('index'):text(str(int(index)+n)) elif resource['resource_key']== 'optical-band-parent' : with tag('optical-band-parent',xmlns=optical_band_namespaces):text(resource['value']) with tag('optical-band-parent',xmlns=optical_band_namespaces):text(int(resource['value'])+int(n)) elif resource['resource_key']== 'admin-state' : with tag('admin-status'):text(resource['value']) else: Loading
src/opticalcontroller/OpticalController.py +1 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ class DelFLightpath(Resource): def delete(flow_id, src, dst, bitrate, o_band_id): if flow_id in rsa.db_flows.keys(): flow = rsa.db_flows[flow_id] print(f"delete flexlightpath flow {flow}") bidir = flow["bidir"] match1 = flow["src"] == src and flow["dst"] == dst and flow["bitrate"] == bitrate if bidir: Loading
src/opticalcontroller/RSA.py +20 −12 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ class RSA(): def init_link_slots(self, testing): if not testing: if full_links: for l in self.links_dict["optical_links"]: for fib in l["optical_link"]["details"]["fibers"]: #fib = self.links_dict[l]["fibers"][f] Loading @@ -46,7 +46,7 @@ class RSA(): return "{},{},{}".format(self.c_slot_number, self.l_slot_number, self.s_slot_number) def init_link_slots2(self, testing): if not testing: if full_links: for l in self.links_dict["optical_links"]: fib = l["optical_details"] #fib = self.links_dict[l]["fibers"][f] Loading Loading @@ -279,7 +279,7 @@ class RSA(): fib[band][str(i)] = 1 if 'used' in fib: fib['used'] = False fib[band].sort() #fib[band].sort() def restore_link_2(self, fib, slots, band,link): print("start restoring link") Loading @@ -287,7 +287,7 @@ class RSA(): fib[band][str(i)] = 1 if 'used' in fib: fib['used'] = False fib[band].sort() #fib[band].keys().sort() set_link_update(fib,link,test="restoration") Loading @@ -312,9 +312,9 @@ class RSA(): self.optical_bands[optical_band_id][band][str(i)] = 1 print(f"example of self.optical_bands_after { self.optical_bands}") link_name= self.optical_bands[optical_band_id]['links'][0] link = self.get_link_by_name(link_name) update_optical_band(optical_bands=self.optical_bands,optical_band_id=optical_band_id,band=band,link=link) #link_name= self.optical_bands[optical_band_id]['links'][0] #link = self.get_link_by_name(link_name) #update_optical_band(optical_bands=self.optical_bands,optical_band_id=optical_band_id,band=band,link=link) def del_flow(self, flow, o_b_id = None): Loading @@ -338,18 +338,26 @@ class RSA(): fib = self.get_link_by_name(l)["optical_details"] print(f"del_flow_fib {fib } and band {band}") print(f"del_flow { str_list_to_int(fib[band].keys())}") if not list_in_list(slots, str_list_to_int(fib[band].keys())): ''' if list_in_list(slots, str_list_to_int(fib[band].keys())): #self.restore_link(fib, slots, band) print("invoking restore_link_2 from del_flow") self.restore_link_2(fib, slots, band,link=l) if debug: print(fib[band]) ''' print(f"invoking restore_link_2 fib: {fib} , slots {slots} , band {band} ") self.restore_link(fib, slots, band) if debug: print(fib[band]) if o_b_id is not None: if debug: print("restoring OB") #self.restore_optical_band(o_b_id, slots, band) self.restore_optical_band_2(o_b_id, slots, band,links) print(f"invoking restore_optical_band o_b_id: {o_b_id} , slots {slots} , band {band} ") self.restore_optical_band(o_b_id, slots, band) #self.restore_optical_band_2(o_b_id, slots, band,links) if bidir: for l in links: r_l = reverse_link(l) Loading @@ -359,8 +367,8 @@ class RSA(): # f = fiber_f[l] # fib = link['fibers'][f] fib = self.get_link_by_name(r_l)["optical_details"] if not list_in_list(slots, str_list_to_int(fib[band].keys())): self.restore_link(fib, slots, band) if list_in_list(slots, str_list_to_int(fib[band].keys())): self.restore_link(fib, slots, band, link=l) if debug: print(fib[band]) ''' Loading
src/opticalcontroller/tools.py +15 −5 Original line number Diff line number Diff line Loading @@ -57,9 +57,15 @@ def consecutives(link, val): x1 = list(link.keys()) x = str_list_to_int(x1) x.sort() y = 0 if debug: print("BLACK") print(link) print(x) print(x[0]) if link[str(x[0])] == 1: temp.append(int(x[0])) y = 1 #print(link, x) for i in range(1, len(x)): if (int(x[i]) == int(x[i - 1]) + 1) and link[str(x[i])] == 1: y += 1 Loading @@ -67,8 +73,12 @@ def consecutives(link, val): else: if y >= val: res.extend(temp) if link[str(x[i])] == 1: temp = [int(x[i])] y = 1 else: temp = [] y = 0 if i == len(x) - 1 and y >= val: res.extend(temp) return res Loading