Commit Graph

64 Commits

Author SHA1 Message Date
EstherLerouzic
c840bb1a44 Improve test coverage on ila constraint cases
explicitely check the corrections for all cases
ila defined in eqpt or not,
ila defined on the link with same direction as request or not
constraint loose or strict
several or one ila in the OMS

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: I4d4b5167e7327c9aea4b13879f4e00d30e60d643
2024-11-25 17:07:36 +01:00
EstherLerouzic
dc68d38293 fix ila names
auto design were changed long ago and these functions did not
apply the changes. Besides there was a confusion between request_element
class where loose is a string, and PathRequest from topology.requests
where loose_list is a list of strings.
This patch corrects the naming and also the tests,
because it used the wrong class to gererate xls services

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: I564b77576459d6cb47767398a2db8138ba6ad1e4
2024-11-25 16:55:25 +01:00
EstherLerouzic
5277ae2005 Add a redesign option
redesign True means that network is redesigned using each request
as reference channel. When False it means that the design is made
once and successive propagation use the settings computed with this
design.

Default propogation is without redesign, so that path-request-script
must use the ----redesign-per-request option to behave as before this
commit.

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: I0084185106d14659a846136620cd17791d551a7d
2024-10-16 17:15:20 +00:00
EstherLerouzic
38cc0e3cc5 feat: separate span power from tx power
gnpy currently uses the same parameter for tx output power and span
input power: this prevents from modelling low tx power effect.
This patch introduces a new tx-cannel-power and uses it to
propagate in ROADM.

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: Id3ac75e2cb617b513bdb38b51a52e05d15af46f5
2024-06-02 19:26:33 +02:00
EstherLerouzic
fb4195c775 Feat: Enable multiple type_varieties for ROADM
This commit introduces the 'type_variety' attribute for ROADM elements,
allowing the use of different types of ROADM specifications instead of
being limited to the default one.

If no type variety name is provided in the eqpt_config, the 'default'
name is used for backward compatibility with libraries. Additionally,
if no type variety is defined in the ROADM element in the topology,
the default one is used for backward compatibility with topologies.

The 'type_variety' attribute is included in the 'to_json' and
'display' methods for ROADM elements.

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: I61a2491f994e47ad0b08cf8eaef30d6d855aa706
2024-06-02 19:26:33 +02:00
EstherLerouzic
87211b35e9 Use design delta_p and gains instead of p_spani
Remove the visualisation of the effective_pch in amp because actual
and target are the relevant ones. effective_pch was artificially
related to a mix of reference channel and noisy channel (mixed between
on the fly redesign but using actual ROADM equalisation which includes noise
in its actual loss).

the change does no more rely on the target power (which is rounded)
but on the designed gain, which is not rounded.

Propagations are slightly changed for openroadm simulations because of that.
(I verified)

The gain of amp was estimated on the fly with p_spni also in case of
RamanFiber preceding elements. removing p_spani requies that an estimation
of Raman gain be done during design.

This commit also adds this estimation.

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: I960b85e99f85a7d168ac5349e325c4928fa5673b
2023-11-20 17:07:46 +01:00
EstherLerouzic
6ac3a517cf refactor build_network: create a separate function to add elements
separate function that adds element, from function that configure them

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: Ica332223bdf7fc599cb007d7513d7cd62d9c5f9c
2023-11-20 10:25:07 +01:00
EstherLerouzic
a3edb20142 Feat: add offset power option for transceivers
Offset power is used for equalization purpose to correct for the
generic equalization target set in ROADM for this particular transceiver.
This is usefull to handle exception to the general equalization rule.
For example in the case of constant power equalization, the user might
want to apply particular power offsets unrelated to slot width or baudrate.
or in constant PSW, the user might want to have a given mode equalized for
a different value than the one computed based on the request bandwidth.

For example consider that a transceiver mode is meant to be equalized with
75 GHz whatever the spacing specified in request. then the user may specify
2 flavours depending on used spacing:

  service 1 : mode 3, spacing 75GHz
  service 2 : mode 4, spacing 87.5Ghz
avec
  {
    "format": "mode 3",
    "baud_rate": 64e9,
    "OSNR": 18,
    "bit_rate": 200e9,
    "roll_off": 0.15,
    "tx_osnr": 40,
    "min_spacing": 75e9,
    "cost": 1
  }

  {
    "format": "mode 4",
    "baud_rate": 64e9,
    "OSNR": 18,
    "bit_rate": 200e9,
    "roll_off": 0.15,
    "tx_osnr": 40,
    "min_spacing": 87.5e9,
    "equalization_offset_db": -0.67,
    "cost": 1
  }

then the same target power would be considered for mode3 and mode4
despite using a different slot width

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: I437f75c42f257b88b24207260ef9ec9b1ab7066e
2023-10-24 13:20:00 +02:00
Jan Kundrát
76e9146043 docs: docstring formatting
Let's use the pythonic indenting, quoting and structure in general as
specified in PEP 0257.

Change-Id: Icd0b4fbd94dabd9a163ae3f6887b236e76c486ab
2023-04-18 01:34:19 +02:00
EstherLerouzic
1bcb3ce25c JSON: ensure that node constraints use correct indexing
The program currently ignores the explicit `index` and reads the
constraints in the JSON order of the list. However in general, it is not
guaranteed that constraints are listed in order.

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: Icefe271f5801cf9f7b43311c6666556564587c65
Signed-off-by: Jan Kundrát <jan.kundrat@telecominfraproject.com>
2022-11-22 01:53:24 +01:00
Jonas Mårtensson
587932290d Calculate CD and PMD penalty
The penalties are calculated and presented separately from the GSNR.

They are also taken into account when optimizing trx mode and verifying
path feasibility in path_requests_run processing.

Penalties are specified in the eqpt_config file as part of trx modes.
This patch includes specifications for OpenROADM trx modes.

Penalties are defined by a list of
impairment_value/penalty_value pairs, for example:

"penalties": [
    {
        "chromatic_dispersion": 4e3,
        "penalty_value": 0
    },
    {
        "chromatic_dispersion": 18e3,
        "penalty_value": 0.5
    },
    {
        "pmd": 10,
        "penalty_value": 0
    },
    {
        "pmd": 30,
        "penalty_value": 0.5
    }
]

- Between given pairs, penalty is linearly interpolated.
- Below min and above max up_to_boundary, transmission is considered
  not feasible.

This is in line with how penalties are specified in OpenROADM and
compatible with specifications from most other organizations and
vendors.

The implementation makes it easy to add other penalties (PDL, etc.) in
the future.

The input format is flexible such that it can easily be extended to
accept combined penalty entries (e.g. CD and PMD) in the future.

Signed-off-by: Jonas Mårtensson <jonas.martensson@ri.se>
Change-Id: I3745eba48ca60c0e4c904839a99b59104eae9216
2022-01-18 12:35:59 +01:00
Jan Kundrát
399eb9700f tests: rely on pytest's native comparisons of nested dicts
In my opinion, this actually produces more useful output *if* pytest is
invoked with `-vv` (which the CI is already doing). When I deliberately
change the expected result of services like this:

 --- a/tests/data/testService_services_expected.json
 +++ b/tests/data/testService_services_expected.json
 @@ -45,7 +45,7 @@
            ],
            "spacing": 50000000000.0,
            "max-nb-of-channel": null,
 -          "output-power": 0.0012589254117941673,
 +          "output-power": 0.001258925411791673,
            "path_bandwidth": 10000000000.0
          }
        }

...the old code would just say:

 >       assert not results.requests.different
 E       AssertionError: assert not [({'bidirectional': False, 'destination': 'trx Vannes_KBE', 'dst-tp-id': 'trx Vannes_KBE', 'path-constraints': {'te-ba......}], 'max-nb-of-channel': None, 'output-power': 0.0012589254117941673, 'path_bandwidth': 10000000000.0, ...}}, ...})]
 E        +  where [({'bidirectional': False, 'destination': 'trx Vannes_KBE', 'dst-tp-id': 'trx Vannes_KBE', 'path-constraints': {'te-ba......}], 'max-nb-of-channel': None, 'output-power': 0.0012589254117941673, 'path_bandwidth': 10000000000.0, ...}}, ...})] = Results(missing=set(), extra=set(), different=[({'request-id': '1', 'source': 'trx Brest_KLA', 'destination': 'trx Van...g': 50000000000.0, 'max-nb-of-channel': 80, 'output-power': 0.0012589254117941673, 'path_bandwidth': 60000000000.0}}}}).different
 E        +    where Results(missing=set(), extra=set(), different=[({'request-id': '1', 'source': 'trx Brest_KLA', 'destination': 'trx Van...g': 50000000000.0, 'max-nb-of-channel': 80, 'output-power': 0.0012589254117941673, 'path_bandwidth': 60000000000.0}}}}) = ServicesResults(requests=Results(missing=set(), extra=set(), different=[({'request-id': '1', 'source': 'trx Brest_KLA'...': 50000000000.0, 'max-nb-of-channel': 80, 'output-power': 0.0012589254117941673, 'path_bandwidth': 60000000000.0}}}})).requests

 tests/test_parser.py:147: AssertionError
 ...
 FAILED tests/test_parser.py::test_excel_service_json_generation[xls_input1-expected_json_output1] - AssertionError: assert not [({'bidirectional': False, 'destination': 'trx Vannes_KBE', 'dst-tp-id': 'trx Vannes_KBE', 'path-constraints': {'te-ba......}], 'max-nb-of-channel': None, 'output-power': 0.0012589254117941673, 'path_bandwidth': 10000000000.0, ...}}, ...})]

With this change in place, the report becomes more useful:

 >       assert from_xls == load_json(expected_json_output)
 E       AssertionError: assert {'path-request': [{'bidirectional': False,\n                   'destination': 'trx Vannes_KBE',\n                   'dst-tp-id': 'trx Vannes_KBE',\n                   'path-constraints': {'te-bandwidth': {'effective-freq-slot': [{'M': None,\n                                                                                  'N': None}],\n                                                         'max-nb-of-channel': 80,\n                                                         'output-power': None,\n                                                         'path_bandwidth': 100000000000.0,\n                                                         'spacing': 50000000000.0,\n                                                         'technology': 'flexi-grid',\n                                                         'trx_mode': 'mode 1',\n                                                         'trx_type': 'Voyager'}},\n                   'request-id': '0',\n                   'source': 'trx Lorient_KMA',\n                   'src-tp-id': 'trx Lorient_KMA'},\n                  {'bidirectional': False,\n                   'destination': 'trx Vannes_KBE',\n                   'dst-tp-id': 'trx Vannes_KBE',\n                   'path-constraints': {'te-bandwidth': {'effective-freq-slot': [{'M': None,\n                                                                                  'N': None}],\n                                                         'max-nb-of-channel': None,\n                                                         'output-power': 0.0012589254117941673,\n                                                         'path_bandwidth': 10000000000.0,\n                                                         'spacing': 50000000000.0,\n                                                         'technology': 'flexi-grid',\n                                                         'trx_mode': 'mode 1',\n                                                         'trx_type': 'Voyager'}},\n                   'request-id': '1',\n                   'source': 'trx Brest_KLA',\n                   'src-tp-id': 'trx Brest_KLA'},\n                  {'bidirectional': False,\n                   'destination': 'trx Rennes_STA',\n                   'dst-tp-id': 'trx Rennes_STA',\n                   'path-constraints': {'te-bandwidth': {'effective-freq-slot': [{'M': None,\n                                                                                  'N': None}],\n                                                         'max-nb-of-channel': 80,\n                                                         'output-power': 0.0012589254117941673,\n                                                         'path_bandwidth': 60000000000.0,\n                                                         'spacing': 50000000000.0,\n                                                         'technology': 'flexi-grid',\n                                                         'trx_mode': 'mode 1',\n                                                         'trx_type': 'vendorA_trx-type1'}},\n                   'request-id': '3',\n                   'source': 'trx Lannion_CAS',\n                   'src-tp-id': 'trx Lannion_CAS'}]} == {'path-request': [{'bidirectional': False,\n                   'destination': 'trx Vannes_KBE',\n                   'dst-tp-id': 'trx Vannes_KBE',\n                   'path-constraints': {'te-bandwidth': {'effective-freq-slot': [{'M': None,\n                                                                                  'N': None}],\n                                                         'max-nb-of-channel': 80,\n                                                         'output-power': None,\n                                                         'path_bandwidth': 100000000000.0,\n                                                         'spacing': 50000000000.0,\n                                                         'technology': 'flexi-grid',\n                                                         'trx_mode': 'mode 1',\n                                                         'trx_type': 'Voyager'}},\n                   'request-id': '0',\n                   'source': 'trx Lorient_KMA',\n                   'src-tp-id': 'trx Lorient_KMA'},\n                  {'bidirectional': False,\n                   'destination': 'trx Vannes_KBE',\n                   'dst-tp-id': 'trx Vannes_KBE',\n                   'path-constraints': {'te-bandwidth': {'effective-freq-slot': [{'M': None,\n                                                                                  'N': None}],\n                                                         'max-nb-of-channel': None,\n                                                         'output-power': 0.001258925411791673,\n                                                         'path_bandwidth': 10000000000.0,\n                                                         'spacing': 50000000000.0,\n                                                         'technology': 'flexi-grid',\n                                                         'trx_mode': 'mode 1',\n                                                         'trx_type': 'Voyager'}},\n                   'request-id': '1',\n                   'source': 'trx Brest_KLA',\n                   'src-tp-id': 'trx Brest_KLA'},\n                  {'bidirectional': False,\n                   'destination': 'trx Rennes_STA',\n                   'dst-tp-id': 'trx Rennes_STA',\n                   'path-constraints': {'te-bandwidth': {'effective-freq-slot': [{'M': None,\n                                                                                  'N': None}],\n                                                         'max-nb-of-channel': 80,\n                                                         'output-power': 0.0012589254117941673,\n                                                         'path_bandwidth': 60000000000.0,\n                                                         'spacing': 50000000000.0,\n                                                         'technology': 'flexi-grid',\n                                                         'trx_mode': 'mode 1',\n                                                         'trx_type': 'vendorA_trx-type1'}},\n                   'request-id': '3',\n                   'source': 'trx Lannion_CAS',\n                   'src-tp-id': 'trx Lannion_CAS'}]}
 E         Differing items:
 E         {'path-request': [{'bidirectional': False, 'destination': 'trx Vannes_KBE', 'dst-tp-id': 'trx Vannes_KBE', 'path-const...[{...}], 'max-nb-of-channel': 80, 'output-power': 0.0012589254117941673, 'path_bandwidth': 60000000000.0, ...}}, ...}]} != {'path-request': [{'bidirectional': False, 'destination': 'trx Vannes_KBE', 'dst-tp-id': 'trx Vannes_KBE', 'path-const...[{...}], 'max-nb-of-channel': 80, 'output-power': 0.0012589254117941673, 'path_bandwidth': 60000000000.0, ...}}, ...}]}
 E         Full diff:
 E           {
 E            'path-request': [{'bidirectional': False,
 E                              'destination': 'trx Vannes_KBE',
 E                              'dst-tp-id': 'trx Vannes_KBE',
 E                              'path-constraints': {'te-bandwidth': {'effective-freq-slot': [{'M': None,
 E                                                                                             'N': None}],
 E                                                                    'max-nb-of-channel': 80,
 E                                                                    'output-power': None,
 E                                                                    'path_bandwidth': 100000000000.0,
 E                                                                    'spacing': 50000000000.0,
 E                                                                    'technology': 'flexi-grid',
 E                                                                    'trx_mode': 'mode 1',
 E                                                                    'trx_type': 'Voyager'}},
 E                              'request-id': '0',
 E                              'source': 'trx Lorient_KMA',
 E                              'src-tp-id': 'trx Lorient_KMA'},
 E                             {'bidirectional': False,
 E                              'destination': 'trx Vannes_KBE',
 E                              'dst-tp-id': 'trx Vannes_KBE',
 E                              'path-constraints': {'te-bandwidth': {'effective-freq-slot': [{'M': None,
 E                                                                                             'N': None}],
 E                                                                    'max-nb-of-channel': None,
 E         -                                                          'output-power': 0.001258925411791673,
 E         +                                                          'output-power': 0.0012589254117941673,
 E         ?                                                                                          +
 E                                                                    'path_bandwidth': 10000000000.0,
 E                                                                    'spacing': 50000000000.0,
 E                                                                    'technology': 'flexi-grid',
 E                                                                    'trx_mode': 'mode 1',
 E                                                                    'trx_type': 'Voyager'}},
 E                              'request-id': '1',
 E                              'source': 'trx Brest_KLA',
 E                              'src-tp-id': 'trx Brest_KLA'},
 E                             {'bidirectional': False,
 E                              'destination': 'trx Rennes_STA',
 E                              'dst-tp-id': 'trx Rennes_STA',
 E                              'path-constraints': {'te-bandwidth': {'effective-freq-slot': [{'M': None,
 E                                                                                             'N': None}],
 E                                                                    'max-nb-of-channel': 80,
 E                                                                    'output-power': 0.0012589254117941673,
 E                                                                    'path_bandwidth': 60000000000.0,
 E                                                                    'spacing': 50000000000.0,
 E                                                                    'technology': 'flexi-grid',
 E                                                                    'trx_mode': 'mode 1',
 E                                                                    'trx_type': 'vendorA_trx-type1'}},
 E                              'request-id': '3',
 E                              'source': 'trx Lannion_CAS',
 E                              'src-tp-id': 'trx Lannion_CAS'}],
 E           }

 tests/test_parser.py:140: AssertionError

Change-Id: I30eafb3c7c0f2e800fb0983371eaa5058e78b029
2021-10-28 17:16:11 +02:00
EstherLerouzic
75e7fca8e4 change M value from 0 to None in case of blocking
Change tests based on M==0 value for response creation and use
instead the blocking_reason attribute existence
result element should have non null M value if request is not blocked.

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: I67e4222cf9d014201e91d3aefd3624b001264e03
2021-08-31 11:31:16 +02:00
EstherLerouzic
7f7c568160 Enabling the reading of N and M value from the json request
For this commit only the first element from the {N, M} list is read
and assigned.

This is better than not reading this value at all.

the commit also updates test_files and test data files with correct
values for the effective_freq_slot attribute

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: I1e60fe833ca1092b40de27c8cbfb13083810414e
2021-08-31 11:31:07 +02:00
Jan Kundrát
601e228bb6 tests: requests: rely on pytest's own dict support
When `pytest` is run with `-vv`, it shows a diff of multiline strings
and dict just fine. The only drawback is that there's the raw string
with newlines shown as "\n", however, *then* the nice diff pretty
printing kicks in, and the result is:

 E                 Common items:
 E                 {'response-id': '5'}
 E                 Differing items:
 E                 {'path-properties': {'path-metric': [{'accumulative-value': 21.68, 'metric-type': 'SNR-bandwidth'}, {'accumulative-val...EDFA', 'link-tp-id': 'east edfa in Rennes_STA to Stbrieuc', 'node-id': 'east edfa in Rennes_STA to Stbrieuc'}}}, ...]}} != {'path-properties': {'path-metric': [{'accumulative-value': 21.68, 'metric-type': 'SNR-bandwidth'}, {'accumulative-val...EDFA', 'link-tp-id': 'east edfa in Rennes_STA to Stbrieuc', 'node-id': 'east edfa in Rennes_STA to Stbrieuc'}}}, ...]}}
 E                 Full diff:
 E                   {
 E                    'path-properties': {'path-metric': [{'accumulative-value': 21.68,
 E                                                         'metric-type': 'SNR-bandwidth'},
 E                                                        {'accumulative-value': 28.77,
 E                                                         'metric-type': 'SNR-0.1nm'},
 E                                                        {'accumulative-value': 23.7,
 E                                                         'metric-type': 'OSNR-bandwidth'},
 E                                                        {'accumulative-value': 30.79,
 E                                                         'metric-type': 'OSNR-0.1nm'},
 E                                                        {'accumulative-value': 0.0019952623149688794,
 E                                                         'metric-type': 'reference_power'},
 E                                                        {'accumulative-value': 20000000000.0,
 E                                                         'metric-type': 'path_bandwidth'}],
 ...
 ... now, it's a bit annoying that there's too much output, but
 ... that's just for context; the offending lines will be properly
 ... marked, see --\
 ...               |
 ...               v
 ...
 E                                                               {'path-route-object': {'index': 17,
 E                 -                                                                    'num-unnum-hop': {'gnpy-node-type': 'transceiver',
 E                 ?                                                                                       ^ ^^^^^^^  - ^      ^^^^^^^^^ -
 E                 +                                                                    'num-unnum-hop': {'link-tp-id': 'trx '
 E                 ?                                                                                       ^^ ^   ^^^      ^^
 E                 -                                                                                      'link-tp-id': 'trx '
 E                                                                                                                      'Lannion_CAS',
 E                                                                                                        'node-id': 'trx '
 E                                                                                                                   'Lannion_CAS'}}},
 E                                                               {'path-route-object': {'index': 18,
 E                                                                                      'label-hop': {'M': 6,
 E                                                                                                    'N': -274}}},
 E                                                               {'path-route-object': {'index': 19,
 E                                                                                      'transponder': {'transponder-mode': 'mode '
 E                                                                                                                          '2',
 E                                                                                                      'transponder-type': 'vendorA_trx-type1'}}}]},
 E                    'response-id': '5',
 E                   }

 tests/test_parser.py:312: AssertionError

Change-Id: I60b4e3bfa432a720a381bf2c0a9f0288e989dab2
2021-06-09 21:17:21 +02:00
EstherLerouzic
a4a144a319 Add tests for the per degree feature
- add a test on the json conversion in case of a ROADM sheet
- test the per per_degree_pch_out_db is correctly created with specified
  values or default.
- also tests that the convert correctly creates the correct equipment
  only if the entry exists in eqpt sheet.

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: Ic006d9c741404b185d15678953d2801cd17bab97
2020-11-03 16:44:28 +01:00
EstherLerouzic
093085fba8 adding a roadm sheet to handle per degree info in roadms
This part only targets conversion from an xls input topology file.
In order to define per degree power, the convert function needs to know
the booster final name.
However before this change, the booster name may not be known if there
is no defined amplifier in eqpt sheet at this stage.
In order to solve this ambiguity, the final name are defined in the convert
function provided that the direction is defined in eqpt sheet and
even if the amp type is not defined.

Then the per degrre target power is defined in a new roadm sheet using
the same direction naming as for Eqpt sheet.

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: I8f279aa880aa0a8ceb60e48e43bddb0f6ff06147
2020-11-03 16:44:28 +01:00
Jan Kundrát
c38fe72ff7 tests: don't clutter up the source dir with generated CSVs
Change-Id: Ice9287dea2ed16ece2594e21eeab4c69e927947e
2020-06-08 20:35:58 +02:00
Jan Kundrát
80f63d32ed use load_json instead of open coding
Change-Id: I43cfbb7272bfdd834fad63e6715932ff45aeac0b
2020-06-08 20:06:11 +02:00
Jan Kundrát
9030f8f84f tests: Do not produce JSON files in the source tree
Change-Id: I7b9c65b93ba2ce64beef4de050b44c49a85163b7
2020-06-08 19:43:51 +02:00
Jan Kundrát
0d5f1c7d80 Split JSON export from service XLS reading
We have a better module for this.

Change-Id: Id4b68d3ddb119f27df3dfac52277981558fc5e50
2020-06-08 18:47:15 +02:00
Jan Kundrát
5bc42332cd tests: Do not create JSON files in the source tree
Change-Id: I5ef71cc82466367fa9e9eea4d3f02453a4d2f469
2020-06-08 18:31:24 +02:00
Jan Kundrát
754be7ca08 Do not create *_auto_design.json by default
It's a bad habit to write files into the source code repository. It will
also become impossible if gnpy is installed into a systemwide, possible
read-only location.

The old behavior can be reactivated by using an extra option to tell
GNPy where to put the generated file.

Change-Id: I9ad43890ca5886f516885de5938a4778870a06c5
2020-06-08 18:28:59 +02:00
Jan Kundrát
1b2b048b47 reorganization: move request processing and request disjunction handling into topology.requests
Change-Id: I14902a2e15cc5fd27530cb294f4f549f6974fd49
2020-05-23 22:03:23 +02:00
Jan Kundrát
7da4ec08d8 reorganization: move JSON-specific bits from path_requests_run to tools.json_io
Change-Id: I03cf4e298300387ee5d56251e2e552e111b59f65
2020-05-23 21:28:06 +02:00
Jan Kundrát
648039521e reorganization: move all JSON processing into an extra module
We agreed that `gnpy.core` should only contain stuff for propagating
wavelengths. Conceptually, JSON parsing and even instantiating these
network elements from data obtained through JSON is *not* something that
is on the same level -- and this will become more important when we move
into YANG format in future.

Also, instead of former `gnpy.core.equipment.common`, use
`gnpy.tools.json_io._JsonThing`. It is not really an awesome name :),
but I think it sucks less than a thing called "common" which would be no
really longer any "common" in that new file.

Change-Id: Ifd85ea4423d418c14c8fae3d5054c5cb5638d283
2020-05-23 20:44:47 +02:00
Jan Kundrát
9faf6430a5 reorganization: gnpy/{core => tools}/service_sheet.py
Change-Id: I88559cc718536f222b8ea9829bcc72a425c062ca
2020-05-23 15:23:27 +02:00
Jan Kundrát
01c566a325 reorganization: gnpy/{core => topology}/spectrum_assignment.py
Change-Id: Ic6194ce639dcb2f9419372febe0f2b58473edb38
2020-05-23 15:05:42 +02:00
Jan Kundrát
0823f8de46 Move automatic_nch, automatic_fmax into utils
I think that gnpy/core/equipment.py should contain only stuff which
prepares the equipment_config, not anything "lower level" that is reused
from other places.

Change-Id: I0cd593fd3e5558178ddd0ad8fff5c596e022894a
2020-05-23 13:08:24 +02:00
Jan Kundrát
46f89aa770 coding style: autopep8 in an aggressive mode (-aaaaaaaaaa)
I decided to skip the following chunk of the diff because I think that
it would actually made the code a bit harder to read:

diff --git gnpy/core/service_sheet.py gnpy/core/service_sheet.py
index 9965840..9834111 100644
--- gnpy/core/service_sheet.py
+++ gnpy/core/service_sheet.py
@@ -41,8 +41,22 @@ logger = getLogger(__name__)

 class Request(namedtuple('Request', 'request_id source destination trx_type mode \
     spacing power nb_channel disjoint_from nodes_list is_loose path_bandwidth')):
-    def __new__(cls, request_id, source, destination, trx_type,  mode=None, spacing=None, power=None, nb_channel=None, disjoint_from='',  nodes_list=None, is_loose='', path_bandwidth=None):
-        return super().__new__(cls, request_id, source, destination, trx_type, mode, spacing, power, nb_channel, disjoint_from,  nodes_list, is_loose, path_bandwidth)
+    def __new__(
+            cls,
+            request_id,
+            source,
+            destination,
+            trx_type,
+            mode=None,
+            spacing=None,
+            power=None,
+            nb_channel=None,
+            disjoint_from='',
+            nodes_list=None,
+            is_loose='',
+            path_bandwidth=None):
+        return super().__new__(cls, request_id, source, destination, trx_type, mode, spacing,
+                               power, nb_channel, disjoint_from, nodes_list, is_loose, path_bandwidth)

 # Type for output data:  // from dutc

diff --git tests/test_automaticmodefeature.py tests/test_automaticmodefeature.py
index 0e5f633..5ba5881 100644
--- tests/test_automaticmodefeature.py
+++ tests/test_automaticmodefeature.py
@@ -32,7 +32,26 @@ eqpt_library_name = Path(__file__).parent.parent / 'tests/data/eqpt_config.json'
 @pytest.mark.parametrize("net", [network_file_name])
 @pytest.mark.parametrize("eqpt", [eqpt_library_name])
 @pytest.mark.parametrize("serv", [service_file_name])
-@pytest.mark.parametrize("expected_mode", [['16QAM', 'PS_SP64_1', 'PS_SP64_1', 'PS_SP64_1', 'mode 2 - fake', 'mode 2', 'PS_SP64_1', 'mode 3', 'PS_SP64_1', 'PS_SP64_1', '16QAM', 'mode 1', 'PS_SP64_1', 'PS_SP64_1', 'mode 1', 'mode 2', 'mode 1', 'mode 2', 'nok']])
+@pytest.mark.parametrize("expected_mode",
+                         [['16QAM',
+                           'PS_SP64_1',
+                           'PS_SP64_1',
+                           'PS_SP64_1',
+                           'mode 2 - fake',
+                           'mode 2',
+                           'PS_SP64_1',
+                           'mode 3',
+                           'PS_SP64_1',
+                           'PS_SP64_1',
+                           '16QAM',
+                           'mode 1',
+                           'PS_SP64_1',
+                           'PS_SP64_1',
+                           'mode 1',
+                           'mode 2',
+                           'mode 1',
+                           'mode 2',
+                           'nok']])
 def test_automaticmodefeature(net, eqpt, serv, expected_mode):
     equipment = load_equipment(eqpt)
     network = load_network(net, equipment)

Change-Id: I522c45c079b3a9540568657e2ae0a4bfc5fb1272
2020-05-19 12:53:11 +02:00
Jan Kundrát
3548ed74e2 coding style: autopep --in-place --recursive --jobs 4 --max-line-length 120 gnpy/ tests/
Change-Id: I2f0fca5aa1314f9bb546a3e6dc712a42580cd562
2020-05-19 12:40:00 +02:00
Jan Kundrát
145653df6e reorganization: gnpy/{core => topology}/request.py
Change-Id: Ib399549479b56634c681930aa444b657e5f58ca7
2020-05-19 11:56:02 +02:00
Jan Kundrát
63a6256b5e pep8: rename classes to use CamelCase
Change-Id: Ia696e05b72f1bc5feb570996f492042dafab262d
2020-05-19 11:54:27 +02:00
Jan Kundrát
8b1d8b3479 reorganization: XLS conversion goes to gnpy.tools
Change-Id: Ibbaddacd24a2d0f6f6d98fdc30d57da3be188338
2020-05-19 11:54:23 +02:00
EstherLerouzic
de58d7d7c2 Enable ILA and FUSED type in routing constraints with xls input
- builds correspondance dicts between input name from excel
  and names created with convert.py and autodesign in network.py
- correct the corresp_name dicts according to the effective
  network autodesign. This supports the case of fiber splitting
  and of fused elements
- include the case of parrallel links with only one hop
- interpret the node list constraint given by the user with the dict
- filter the constraints that are not applicable
- add tests for constraints
- correct equipment sheet of mesh_example_topologyv2.xls: morlaix and
  loudeac should not appear in node A column since they are fused

ILA and FUSED constraints must be filled with the next node
information in order to avoid confusion on the direction.
for example
     eg    a----b-----c
           |    |     |
           i    j     k
           |    |     |
           e----f-----g

a constraint 'j' given for service i to k leads to 2 possible direction:
i-a-b-j-f-g-k
i-e-f-j-b-c-k
the user must indicate the chossen direction. This ambiguity does not
exist with network input in json format (names are unique).

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: Ia7cf2026e569c8b566459791fc89546b91fb117c
2020-04-23 11:15:37 +02:00
Jan Kundrát
82ce3384ba tests: Use XLSX for the CORONET topology
Now that XLSX is officially supported, it should be tested as well.

Change-Id: I9286d3cb56950d554582d2eaf8153da5ffdd771a
2020-03-21 13:19:24 +01:00
Jan Kundrát
1f1877f7a9 tests: do not hardcode file suffix lengths
This will become useful for XLS -> XLSX conversion.

Change-Id: I025e4c24d00526d3bb48c23dcbdc82a65be9a477
2020-03-21 13:19:24 +01:00
Jan Kundrát
fe811f725c tests: use native pytest features for exception handling
Using `with pytest.raises` is better than open coding the equivalent
feature. Similarly, when a block is not expected to raise an exception,
let's just let it run outside of a `try` block and rely on the test
framework to report a possible failure when hitting an unhandled
exception.

Change-Id: Icb1bb83e649733b56fcdc9168cabf88c9cf8d478
2020-01-10 18:16:53 +00:00
EstherLerouzic
c577a75725 second set of modification due to codacy report
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2019-10-10 09:02:19 +01:00
EstherLerouzic
31e634615b Complete test on response comparison
If request is bidir and 'z-a-path-metric' is missing, raises an error
If present, should not raise an error

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2019-10-10 09:02:19 +01:00
EstherLerouzic
5b939bc57a Improve compare_response function
remove some prints, indicate which from actual or expected key
is printed.
preceise that test is also performed on values

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2019-10-10 09:02:19 +01:00
EstherLerouzic
42ba3eb98d Add a test to go through the new added code in spectrum_assignment
Verify that there is no raised error if M=0 and the blocking attribute is there

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2019-10-10 09:02:19 +01:00
EstherLerouzic
37bd5d0404 Code coverage improvement test service creation w/o sync vector
add one service  only excel file + changes on compare.py to support
no synchronization vector case

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2019-10-09 19:17:35 +01:00
EstherLerouzic
f788b81d21 Code coverage improvement test json generation with Z to A direction
add aa bidir request to test service error handling
TODO: write more detailed test on the bidir case

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2019-10-09 19:17:35 +01:00
EstherLerouzic
2ff1ce6b34 Code coverage improvement test ServiceError handling
For this purpose we create a wrong request with M=0 and verify
that serviceError is correctly raised when calling Result_element class

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2019-10-09 19:17:35 +01:00
EstherLerouzic
898eada097 Update test_parser
function compute_path_with_disjunction needs an additional reversed path
and results must contain wavelength assignment

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2019-10-09 19:17:35 +01:00
EstherLerouzic
87cc3dac00 Corrections with respect to second review
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2019-10-09 19:09:39 +01:00
EstherLerouzic
89e28cc7be Correct bug in parser: csv header comparison
previous comparison was done on the result from .sort(), ie None.
list.sort() method modifies the list in-place and returns None.

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2019-10-09 15:38:42 +01:00
EstherLerouzic
6a7a04ebb1 syntax correction
reordering imports call according to pylint3 + extra line removed

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2019-10-09 15:38:42 +01:00
EstherLerouzic
0366fc2956 Adding a no-path case for test coverage
add a no path case (request 6) in requests and expected responses.
response is also generated if path is not feasible: checks
that it is correctly handled in csv and json responses

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2019-10-09 15:38:42 +01:00