From af4269913377925a178dc30df22e077941947e1b Mon Sep 17 00:00:00 2001 From: EstherLerouzic Date: Tue, 24 Aug 2021 14:13:38 +0200 Subject: [PATCH] Enable the loading of a bitmap OMS are currently built with a brand new spectrum bitmap using f_min, f_max, guard band and grid values. This changes enables to load an existing bitmap. Signed-off-by: EstherLerouzic Change-Id: If0547bc337c863a3510ad9e43928e6f64701d295 --- gnpy/topology/spectrum_assignment.py | 35 ++++++++++++---------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/gnpy/topology/spectrum_assignment.py b/gnpy/topology/spectrum_assignment.py index 6a7b8f94b..176193bd1 100644 --- a/gnpy/topology/spectrum_assignment.py +++ b/gnpy/topology/spectrum_assignment.py @@ -97,26 +97,21 @@ def add_element(self, elem): self.el_id_list.append(elem.uid) self.el_list.append(elem) - def update_spectrum(self, f_min, f_max, guardband=0.15e12, existing_spectrum=None, - grid=0.00625e12): - """frequencies expressed in Hz""" - if existing_spectrum is None: - # add some 150 GHz margin to enable a center channel on f_min - # use ITU-T G694.1 - # Flexible DWDM grid definition - # For the flexible DWDM grid, the allowed frequency slots have a nominal - # central frequency (in THz) defined by: - # 193.1 + n × 0.00625 where n is a positive or negative integer including 0 - # and 0.00625 is the nominal central frequency granularity in THz - # and a slot width defined by: - # 12.5 × m where m is a positive integer and 12.5 is the slot width granularity in - # GHz. - # Any combination of frequency slots is allowed as long as no two frequency - # slots overlap. - - # TODO : add explaination on that / parametrize .... - self.spectrum_bitmap = Bitmap(f_min, f_max, grid, guardband) - # print(len(self.spectrum_bitmap.bitmap)) + def update_spectrum(self, f_min, f_max, guardband=0.15e12, existing_spectrum=None, grid=0.00625e12): + """Frequencies expressed in Hz. + Add 150 GHz margin to enable a center channel on f_min + Use ITU-T G694.1 Flexible DWDM grid definition + For the flexible DWDM grid, the allowed frequency slots have a nominal central frequency (in THz) defined by: + 193.1 + n × 0.00625 where n is a positive or negative integer including 0 + and 0.00625 is the nominal central frequency granularity in THz + and a slot width defined by: + 12.5 × m where m is a positive integer and 12.5 is the slot width granularity in GHz. + Any combination of frequency slots is allowed as long as no two frequency slots overlap. + If bitmap is not None, then use it: Bitmap checks its consistency with f_min f_max + else a brand new bitmap is created + """ + self.spectrum_bitmap = Bitmap(f_min=f_min, f_max=f_max, grid=grid, guardband=guardband, + bitmap=existing_spectrum) def assign_spectrum(self, nvalue, mvalue): """change oms spectrum to mark spectrum assigned"""