Introduce a reverse_oms function to identify bidir oms
reversed_oms is introdused in order to identify which oms correspond
to the reversed direction of a given oms. Indeed for spectrum assignment
it is mandatory to mark spectrum resources occupation on both directions
(requests are supposed bidirectional in WDM).
@@ -259,8 +259,25 @@ def build_oms_list(network, equipment):
oms_list.append(oms)
oms_id += 1
oms_list = align_grids(oms_list)
+ reversed_oms(oms_list)
return oms_list
+def reversed_oms(oms_list):
+ """ identifies reversed OMS
+ only applicable for non parallel OMS
+ """
+ for oms in oms_list:
+ has_reversed = False
+ for this_o in oms_list:
+ if (oms.el_id_list[0] == this_o.el_id_list[-1] and
+ oms.el_id_list[-1] == this_o.el_id_list[0]):
+ oms.reversed_oms = this_o
+ has_reversed = True
+ break
+ if not has_reversed:
+ oms.reversed_oms = None
+
+
def bitmap_sum(band1, band2):
""" a functions that marks occupied bitmap by 0 if the slot is occupied in band1 or in band2
"""
