mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-10-30 17:47:50 +00:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
101eb8f969 | ||
|
|
7ce6650109 | ||
|
|
252e67a71e | ||
|
|
f83869392b | ||
|
|
94a3714aba | ||
|
|
ccab4835fc | ||
|
|
e55f7a5d4c | ||
|
|
4fda8c6002 | ||
|
|
8717156712 | ||
|
|
d2c0836164 | ||
|
|
eac4ba80ea | ||
|
|
4ef01d54a5 | ||
|
|
4b50ee0c2d | ||
|
|
33a289e22b | ||
|
|
e593b8c9ec | ||
|
|
94a6f922cd | ||
|
|
fbe387915b | ||
|
|
fce9d1d293 | ||
|
|
a59db8fd12 | ||
|
|
de509139b3 | ||
|
|
bb77b3f4a8 | ||
|
|
34c7fd1b60 | ||
|
|
89a962ffaf | ||
|
|
1722fbec13 | ||
|
|
e48aa57c35 | ||
|
|
e3e37b1986 | ||
|
|
abf42afaf8 | ||
|
|
310995045e | ||
|
|
c840bb1a44 | ||
|
|
4b6f4af3a5 | ||
|
|
dc68d38293 | ||
|
|
defe3bee5c | ||
|
|
32adc0fc53 | ||
|
|
4796266657 |
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@@ -118,10 +118,10 @@ jobs:
|
||||
python_version: "3.11"
|
||||
- os: windows-2022
|
||||
python_version: "3.12"
|
||||
- os: macos-12
|
||||
python_version: "3.11"
|
||||
- os: macos-13
|
||||
python_version: "3.12"
|
||||
- os: macos-14
|
||||
python_version: "3.12"
|
||||
|
||||
paywalled-platforms:
|
||||
name: Tests on paywalled platforms
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
*********************************************
|
||||
.. _amp_models:
|
||||
|
||||
Amplifier models and configuration
|
||||
*********************************************
|
||||
==================================
|
||||
|
||||
|
||||
1. Equipment configuration description
|
||||
#######################################
|
||||
--------------------------------------
|
||||
|
||||
Equipment description defines equipment types and parameters.
|
||||
It takes place in the default **eqpt_config.json** file.
|
||||
It takes place in the equipment library such as **eqpt_config.json** file defined in example-data folder.
|
||||
By default **gnpy-transmission-example** uses **eqpt_config.json** file and that
|
||||
can be changed with **-e** or **--equipment** command line parameter.
|
||||
|
||||
2. Amplifier parameters and subtypes
|
||||
#######################################
|
||||
------------------------------------
|
||||
|
||||
Several amplifiers can be used by GNpy, so they are defined as an array of equipment parameters in **eqpt_config.json** file.
|
||||
|
||||
@@ -28,9 +29,16 @@ Several amplifiers can be used by GNpy, so they are defined as an array of equip
|
||||
- *"variable_gain"*
|
||||
- *"fixed_gain"*
|
||||
- *"dual_stage"*
|
||||
- *"multi_band"*
|
||||
- *"openroadm"*
|
||||
*see next section for a full description of these models*
|
||||
|
||||
|
||||
- *"default_config_from_json"*:
|
||||
Use a custom per frequency dynamic gain tilt, gain and noise ripple arrays defined in the file specified with
|
||||
this option, instead of the default values from GNPy.
|
||||
|
||||
|
||||
- *"advanced_config_from_json"*:
|
||||
**This parameter is only applicable to the _"advanced_model"_ model**
|
||||
|
||||
@@ -135,7 +143,7 @@ Several amplifiers can be used by GNpy, so they are defined as an array of equip
|
||||
|
||||
|
||||
3. Amplifier models
|
||||
#######################################
|
||||
-------------------
|
||||
|
||||
In an opensource and multi-vendor environnement, it is needed to support different use cases and context. Therefore several models are supported for amplifiers.
|
||||
|
||||
@@ -179,7 +187,7 @@ In an opensource and multi-vendor environnement, it is needed to support differe
|
||||
- *"variable_gain"*
|
||||
This model is refered as an operator model because a lower level of knowledge is required. A full polynomial description of the NF cross the gain range is not required. Instead, NF_min and NF_max values are required and used by the code to model a dual stage amplifier with an internal mid stage VOA. NF_min and NF_max values are typically available from equipment suppliers data-sheet.
|
||||
|
||||
There is a default JSON file ”default_edfa_config.json”* to enforce 0 tilt and ripple values because GNpy core algorithm is a multi-carrier propogation.
|
||||
There is a default configuration to enforce 0 tilt and ripple values because GNPy core algorithm is a multi-carrier propagation.
|
||||
- gain_ripple =[0,...,0]
|
||||
- nf_ripple = [0,...,0]
|
||||
- dgt = [...] generic dgt comb
|
||||
@@ -250,7 +258,7 @@ In an opensource and multi-vendor environnement, it is needed to support differe
|
||||
|
||||
- gain_min indicates to auto_design when this dual_stage should be used
|
||||
|
||||
But unlike other models the 1st stage input will not be padded: it is always operated to its maximu gain and min NF. Therefore if gain adaptation and padding is needed it will be performed by the 2nd stage.
|
||||
But unlike other models the 1st stage input will not be padded: it is always operated to its maximum gain and min NF. Therefore if gain adaptation and padding is needed it will be performed by the 2nd stage.
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
@@ -263,8 +271,18 @@ In an opensource and multi-vendor environnement, it is needed to support differe
|
||||
"allowed_for_design": true
|
||||
}
|
||||
|
||||
|
||||
- *"multiband"*
|
||||
This model enables the definition of multiband amplifiers that consist of multiple single-band
|
||||
amplifier elements, with each amplifier responsible for amplifying a different portion of the spectrum.
|
||||
The types of single-band amplifiers that can be included in these multiband amplifiers are specified,
|
||||
allowing for multiple options to be available for the same spectrum band (for instance, providing
|
||||
several permitted type varieties for both the C-band and the L-band). The actual element utilizing the
|
||||
type_variety must implement only one option for each band.
|
||||
|
||||
|
||||
4. advanced_config_from_json
|
||||
#######################################
|
||||
----------------------------
|
||||
|
||||
The build_oa_json.py library in ``gnpy/example-data/edfa_model/`` can be used to build the json file required for the amplifier advanced_model type_def:
|
||||
|
||||
162
docs/biblio.bib
162
docs/biblio.bib
@@ -1860,3 +1860,165 @@ month={Sept},}
|
||||
pages={3499-3511},
|
||||
doi={10.1109/JLT.2022.3162134}
|
||||
}
|
||||
|
||||
@inproceedings{grammel2018physical,
|
||||
title={Physical simulation environment of the telecommunications infrastructure project (TIP)},
|
||||
author={Grammel, Gert and Curri, Vittorio and Auge, Jean-Luc},
|
||||
booktitle={Optical Fiber Communication Conference},
|
||||
pages={M1D--3},
|
||||
year={2018},
|
||||
organization={Optica Publishing Group}
|
||||
}
|
||||
|
||||
@inproceedings{taylor2018towards,
|
||||
title={Towards a route planning tool for open optical networks in the telecom infrastructure project},
|
||||
author={Taylor, Brian D and Goldfarb, Gilad and Bandyopadhyay, Saumil and Curri, Vittorio and Schmidtke, Hans-Juergen},
|
||||
booktitle={Optical Fiber Communication Conference},
|
||||
pages={Tu3E--4},
|
||||
year={2018},
|
||||
organization={Optica Publishing Group}
|
||||
}
|
||||
|
||||
@article{filer2018multi,
|
||||
title={Multi-vendor experimental validation of an open source QoT estimator for optical networks},
|
||||
author={Filer, Mark and Cantono, Mattia and Ferrari, Alessio and Grammel, Gert and Galimberti, Gabriele and Curri, Vittorio},
|
||||
journal={Journal of Lightwave Technology},
|
||||
volume={36},
|
||||
number={15},
|
||||
pages={3073--3082},
|
||||
year={2018},
|
||||
publisher={IEEE}
|
||||
}
|
||||
|
||||
@inproceedings{auge2019open,
|
||||
title={Open optical network planning demonstration},
|
||||
author={Auge, Jean-Luc and Grammel, Gert and Le Rouzic, Esther and Curri, Vittorio and Galimberti, Gabriele and Powell, James},
|
||||
booktitle={Optical Fiber Communication Conference},
|
||||
pages={M3Z--9},
|
||||
year={2019},
|
||||
organization={Optica Publishing Group}
|
||||
}
|
||||
|
||||
@inproceedings{kundrat2020physical,
|
||||
title={Physical-layer awareness: GNPy and ONOS for end-to-end circuits in disaggregated networks},
|
||||
author={Kundr{\'a}t, Jan and Campanella, Andrea and Le Rouzic, Esther and Ferrari, Alessio and Havli{\v{s}}, Ond{\v{r}}ej and Ha{\v{z}}linsk{\`y}, Michal and Grammel, Gert and Galimberti, Gabriele and Curri, Vittorio},
|
||||
booktitle={2020 Optical Fiber Communications Conference and Exhibition (OFC)},
|
||||
pages={1--3},
|
||||
year={2020},
|
||||
organization={IEEE}
|
||||
}
|
||||
|
||||
@inproceedings{ferrari2020experimental,
|
||||
title={Experimental validation of an open source quality of transmission estimator for open optical networks},
|
||||
author={Ferrari, Alessio and Filer, Mark and Balasubramanian, Karthikeyan and Yin, Yawei and Le Rouzic, Esther and Kundr{\'a}t, Jan and Grammel, Gert and Galimberti, Gabriele and Curri, Vittorio},
|
||||
booktitle={2020 Optical Fiber Communications Conference and Exhibition (OFC)},
|
||||
pages={1--3},
|
||||
year={2020},
|
||||
organization={IEEE}
|
||||
}
|
||||
|
||||
@article{ferrari2020gnpy,
|
||||
title={GNPy: an open source application for physical layer aware open optical networks},
|
||||
author={Ferrari, Alessio and Filer, Mark and Balasubramanian, Karthikeyan and Yin, Yawei and Le Rouzic, Esther and Kundr{\'a}t, Jan and Grammel, Gert and Galimberti, Gabriele and Curri, Vittorio},
|
||||
journal={Journal of Optical Communications and Networking},
|
||||
volume={12},
|
||||
number={6},
|
||||
pages={C31--C40},
|
||||
year={2020},
|
||||
publisher={Optica Publishing Group}
|
||||
}
|
||||
|
||||
@inproceedings{ferrari2020softwarized,
|
||||
title={Softwarized optical transport QoT in production optical network: a Brownfield validation},
|
||||
author={Ferrari, Alessio and Balasubramanian, Karthikeyan and Filer, Mark and Yin, Yawei and Le Rouzic, Esther and Kundr{\'a}t, Jan and Grammel, Gert and Galimberti, Gabriele and Curri, Vittorio},
|
||||
booktitle={2020 European Conference on Optical Communications (ECOC)},
|
||||
pages={1--4},
|
||||
year={2020},
|
||||
organization={IEEE}
|
||||
}
|
||||
|
||||
@article{ferrari2021assessment,
|
||||
title={Assessment on the in-field lightpath QoT computation including connector loss uncertainties},
|
||||
author={Ferrari, Alessio and Balasubramanian, Karthikeyan and Filer, Mark and Yin, Yawei and Le Rouzic, Esther and Kundr{\'a}t, Jan and Grammel, Gert and Galimberti, Gabriele and Curri, Vittorio},
|
||||
journal={Journal of Optical Communications and Networking},
|
||||
volume={13},
|
||||
number={2},
|
||||
pages={A156--A164},
|
||||
year={2021},
|
||||
publisher={Optica Publishing Group}
|
||||
}
|
||||
|
||||
@inproceedings{kundrat2021gnpy,
|
||||
title={GNPy \& YANG: open APIs for end-to-end service provisioning in optical networks},
|
||||
author={Kundr{\'a}t, Jan and Le Rouzic, Esther and M{\aa}rtensson, Jonas and Campanella, Andrea and Havli{\v{s}}, Ond{\v{r}}ej and D’Amico, Andrea and Grammel, Gert and Galimberti, Gabriele and Curri, Vittorio and Vojt{\v{e}}ch, Josef},
|
||||
booktitle={Optical Fiber Communication Conference},
|
||||
pages={M1B--6},
|
||||
year={2021},
|
||||
organization={Optica Publishing Group}
|
||||
}
|
||||
|
||||
@inproceedings{d2021gnpy,
|
||||
title={GNPy experimental validation on flex-grid, flex-rate WDM optical transport scenarios},
|
||||
author={D’Amico, Andrea and London, Elliot and Le Guyader, Bertrand and Frank, Florian and Le Rouzic, Esther and Pincemin, Erwan and Brochier, Nicolas and Curri, Vittorio},
|
||||
booktitle={Optical fiber communication conference},
|
||||
pages={W1G--2},
|
||||
year={2021},
|
||||
organization={Optica Publishing Group}
|
||||
}
|
||||
|
||||
@inproceedings{virgillito2021testing,
|
||||
title={Testing TIP open source solutions in deployed optical networks},
|
||||
author={Virgillito, Emanuele and Braun, Ralf-Peter and Breuer, Dirk and Gladisch, Andreas and Curri, Vittorio and Grammel, Gert},
|
||||
booktitle={Optical Fiber Communication Conference},
|
||||
pages={F1C--3},
|
||||
year={2021},
|
||||
organization={Optica Publishing Group}
|
||||
}
|
||||
|
||||
@article{d2022experimental,
|
||||
title={Experimental validation of GNPy in a multi-vendor flex-grid flex-rate WDM optical transport scenario},
|
||||
author={D’Amico, Andrea and London, Elliot and Le Guyader, Bertrand and Frank, Florian and Le Rouzic, Esther and Pincemin, Erwan and Brochier, Nicolas and Curri, Vittorio},
|
||||
journal={Journal of Optical Communications and Networking},
|
||||
volume={14},
|
||||
number={3},
|
||||
pages={79--88},
|
||||
year={2022},
|
||||
publisher={Optica Publishing Group}
|
||||
}
|
||||
|
||||
@inproceedings{mano2022accuracy,
|
||||
title={Accuracy of nonlinear interference estimation on launch power optimization in short-reach systems with field trial},
|
||||
author={Mano, Toru and D’Amico, Andrea and Virgillito, Emanuele and Borraccini, Giacomo and Huang, Yue-Kai and Kitamura, Kei and Anazawa, Kazuya and Masuda, Akira and Nishizawa, Hideki and Wang, Ting and others},
|
||||
booktitle={European Conference and Exhibition on Optical Communication},
|
||||
pages={We3B--1},
|
||||
year={2022},
|
||||
organization={Optica Publishing Group}
|
||||
}
|
||||
|
||||
@inproceedings{kundrat2022gnpy,
|
||||
title={GNPy: Lessons learned and future plans},
|
||||
author={Kundr{\'a}t, Jan and Le Rouzic, Esther and M{\aa}rtensson, Jonas and Melin, Stefan and D’Amico, Andrea and Grammel, Gert and Galimberti, Gabriele and Curri, Vittorio},
|
||||
booktitle={European Conference and Exhibition on Optical Communication},
|
||||
pages={We3B--6},
|
||||
year={2022},
|
||||
organization={Optica Publishing Group}
|
||||
}
|
||||
|
||||
@inproceedings{grammel2023open,
|
||||
title={Open Optical Networks: the good, the bad and the ugly},
|
||||
author={Grammel, Gert and Kundrat, Jan and Le Rouzic, Esther and Melin, Stefan and Curri, Vittorio and d'Amico, Andrea and Manzotti, Roberto},
|
||||
booktitle={49th European Conference on Optical Communications (ECOC 2023)},
|
||||
volume={2023},
|
||||
pages={1585--1588},
|
||||
year={2023},
|
||||
organization={IET}
|
||||
}
|
||||
|
||||
@inproceedings{d2024gnpy,
|
||||
title={GNPy Experimental Validation in a C+ L Multiband Optical Multiplex Section},
|
||||
author={D’Amico, Andrea and Gatto, Vittorio and Nespola, Antonino and Borraccini, Giacomo and Jiang, Yanchao and Poggiolini, Pierluigi and Le Rouzic, Esther and de Lerma, Arturo Mayoral L{\'o}pez and Grammel, Gert and Manzotti, Roberto and others},
|
||||
booktitle={2024 24th International Conference on Transparent Optical Networks (ICTON)},
|
||||
pages={1--4},
|
||||
year={2024},
|
||||
organization={IEEE}
|
||||
}
|
||||
|
||||
298
docs/cli_options.rst
Normal file
298
docs/cli_options.rst
Normal file
@@ -0,0 +1,298 @@
|
||||
.. _cli-options:
|
||||
|
||||
Options Documentation for `gnpy-path-request` and `gnpy-transmission-example`
|
||||
=============================================================================
|
||||
|
||||
Common options
|
||||
--------------
|
||||
|
||||
**Option**: `--no-insert-edfas`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Purpose**: Disables the automatic insertion of EDFAs after ROADMs and fibers, as well as the splitting
|
||||
of fibers during the auto-design process.
|
||||
|
||||
The `--no-insert-edfas` option is a command-line argument available in GNPy that allows users to control the
|
||||
automatic insertion of amplifiers during the network design process. This option provides flexibility for
|
||||
users who may want to manually manage amplifier placements or who have specific design requirements that
|
||||
do not necessitate automatic amplification.
|
||||
|
||||
To use the `--no-insert-edfas` option, simply include it in the command line when running your GNPy program. For example:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
gnpy-transmission-example my_network.json --no-insert-edfas
|
||||
|
||||
When the `--no-insert-edfas` option is specified:
|
||||
|
||||
1. **No Automatic Amplifiers**: The program will not automatically add EDFAs to the network topology after
|
||||
ROADMs or fiber elements. This means that if the network design requires amplification, users must ensure
|
||||
that amplifiers are manually defined in the network topology file. Users should be aware that disabling
|
||||
automatic amplifier insertion may lead to insufficient amplification in the network if not managed properly.
|
||||
It is essential to ensure that the network topology includes the necessary amplifiers to meet performance requirements.
|
||||
|
||||
2. **No Fiber Splitting**: The option also prevents the automatic splitting of fibers during the design process.
|
||||
This is particularly useful for users who want to maintain specific fiber lengths or configurations without
|
||||
the program altering them.
|
||||
|
||||
|
||||
**Option**: `--equipment`, `-e`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Description**: Specifies the equipment library file.
|
||||
|
||||
**Usage**:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
gnpy-transmission-example my_network.json --equipment <FILE.json>
|
||||
|
||||
**Default**: Uses the default equipment configuration in the example-data folder if not specified.
|
||||
|
||||
**Functionality**: This option allows users to load a specific equipment configuration that defines the characteristics of the network elements.
|
||||
|
||||
**Option**: `--extra-equipment` and `--extra-config`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The `--extra-equipment` and `--extra-config` options allow users to extend the default equipment library and configuration
|
||||
settings used by the GNPy program. This feature is particularly useful for users who need to incorporate additional
|
||||
equipment types or specific configurations that are not included in the standard equipment library (such as third party pluggables).
|
||||
|
||||
**Usage**:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
--extra-equipment <file1.json> [<file2.json> ...]
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `<file1.json>`: Path to the first additional equipment file.
|
||||
- `<file2.json>`: Path to any subsequent additional equipment files (optional).
|
||||
|
||||
**Functionality**:
|
||||
|
||||
- The program will merge the equipment definitions from the specified files into the main equipment library.
|
||||
- If an equipment type defined in the additional files has the same name as one in the main library, the program
|
||||
will issue a warning about the duplicate entry and will include ony the last definition.
|
||||
- This allows for flexibility in defining equipment that may be specific to certain use cases or vendor-specific models.
|
||||
|
||||
**`--extra-config`**:
|
||||
|
||||
**Description**: This option allows users to specify additional configuration files that can override
|
||||
or extend the default configuration settings used by the program. This is useful for customizing simulation
|
||||
parameters or equipment settings. To set an amplifier with a specific such config, it must be defined in the
|
||||
library with the keyword "default_config_from_json" filled with the file name containing the config in the case of
|
||||
"variable_gain" amplifier or with the "advanced_config_from_json" for the "advanced_model" amplifier.
|
||||
|
||||
**Usage**:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
--extra-config <file1.json> [<file2.json> ...]
|
||||
|
||||
**Parameters**:
|
||||
- `<file1.json>`: Path to the first additional configuration file.
|
||||
- `<file2.json>`: Path to any subsequent additional configuration files (optional).
|
||||
|
||||
**Functionality**:
|
||||
The program will load the configurations from the specified files and consider them instead of the
|
||||
default configurations for the amplifiers that use the "default_config_from_json" or "advanced_config_from_json" keywords.
|
||||
|
||||
Example
|
||||
-------
|
||||
To run the program with additional equipment and configuration files, you can use the following command:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
gnpy-transmission-example --equipment main_equipment.json \
|
||||
--extra-equipment additional_equipment1.json additional_equipment2.json \
|
||||
--extra-config additional_config1.json
|
||||
|
||||
|
||||
In this example:
|
||||
- `main_equipment.json` is the primary equipment file.
|
||||
- `additional_equipment1.json` and `additional_equipment2.json` are additional equipment files that will be merged into the main library.
|
||||
- `additional_config1.json` is an additional configuration file that will override the default settings for the amplifiers pointing to it.
|
||||
|
||||
|
||||
**Option**: `--save-network`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Description**: Saves the final network configuration to a specified JSON file.
|
||||
|
||||
**Usage**:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
--save-network <FILE.json>
|
||||
|
||||
**Functionality**: This option allows users to save the network state after the simulation, which can be useful for future reference or analysis.
|
||||
|
||||
|
||||
**Option**: `--save-network-before-autodesign`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Description**: Dumps the network into a JSON file prior to autodesign.
|
||||
|
||||
**Usage**:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
gnpy-path-request my_network.json my_services.json --save-network-before-autodesign <FILE.json>
|
||||
|
||||
**Functionality**: This option is useful for users who want to inspect the network configuration before any automatic design adjustments are made.
|
||||
|
||||
|
||||
**Option**: `--sim-params`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Description**: Path to the JSON file containing simulation parameters.
|
||||
|
||||
**Usage**:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
gnpy-transmission-example my_network.json --sim-params <FILE.json>
|
||||
|
||||
**Functionality**: The `--sim-params` option is a command-line argument available in GNPy that allows users to specify a
|
||||
JSON file containing simulation parameters. This option is crucial for customizing the behavior of the simulation:
|
||||
the file ``sim_params.json`` contains the tuning parameters used within both the ``gnpy.science_utils.RamanSolver`` and
|
||||
the ``gnpy.science_utils.NliSolver`` for the evaluation of the Raman profile and the NLI generation, respectively.
|
||||
|
||||
The tuning of the parameters is detailed here: :ref:`json input sim-params<sim-params>`.
|
||||
|
||||
|
||||
`gnpy-transmission-example` options
|
||||
-----------------------------------
|
||||
|
||||
**Option**: `--show-channels`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Description**: Displays the final per-channel OSNR and GSNR summary.
|
||||
|
||||
**Usage**:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
gnpy-transmission-example my_network.json --show-channels
|
||||
|
||||
**Functionality**: This option provides a summary of the optical signal-to-noise ratio (OSNR)
|
||||
and generalized signal-to-noise ratio (GSNR) for each channel after the simulation.
|
||||
|
||||
|
||||
**Option**: `-pl`, `--plot`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Description**: Generates plots of the results.
|
||||
|
||||
**Usage**:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
gnpy-transmission-example my_network.json -pl
|
||||
|
||||
**Functionality**: This option allows users to visualize the results of the simulation through graphical plots.
|
||||
|
||||
|
||||
**Option**: `-l`, `--list-nodes`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Description**: Lists all transceiver nodes in the network.
|
||||
|
||||
**Usage**:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
gnpy-transmission-example my_network.json -l
|
||||
|
||||
**Functionality**: This option provides a quick way to view all transceiver nodes present in the network topology.
|
||||
|
||||
**Option**: `-po`, `--power`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Description**: Specifies the reference channel power in span in dBm.
|
||||
|
||||
**Usage**:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
gnpy-transmission-example my_network.json -po <value>
|
||||
|
||||
**Functionality**: This option allows users to set the input power level for the reference channel used in the simulation.
|
||||
It replaces the value specified in the `SI` section of the equipment library (:ref:`power_dbm<spectral_info>`).
|
||||
|
||||
|
||||
**Option**: `--spectrum`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Description**: Specifies a user-defined mixed rate spectrum JSON file for propagation.
|
||||
|
||||
**Usage**:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
gnpy-transmission-example my_network.json --spectrum <FILE.json>
|
||||
|
||||
**Functionality**: This option allows users to define a custom spectrum for the simulation, which can
|
||||
include varying channel rates and configurations. More details here: :ref:`mixed-rate<mixed-rate>`.
|
||||
|
||||
|
||||
Options for `path_requests_run`
|
||||
-------------------------------
|
||||
|
||||
The `gnpy-path-request` script provides a simple path computation function that supports routing, transceiver mode selection, and spectrum assignment.
|
||||
|
||||
It supports include and disjoint constraints for the path computation, but does not provide any optimisation.
|
||||
It requires two mandatory arguments: network file and service file (see :ref:`XLS files<excel-service-sheet>` or :ref:`JSON files<legacy-json>`).
|
||||
|
||||
The `gnpy-path-request` computes:
|
||||
|
||||
- design network once and propagate the service requests on this design
|
||||
- computes performance of each request defined in the service file independently from each other, considering full load (based on the request settings),
|
||||
- assigns spectrum for each request according to the remaining spectrum, on a first arrived first served basis.
|
||||
Lack of spectrum leads to blocking, but performance estimation is still returned for information.
|
||||
|
||||
|
||||
**Option**: `-bi`, `--bidir`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Description**: Indicates that all demands are bidirectional.
|
||||
|
||||
**Usage**:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
gnpy-path-request my_network.json my_service.json -e my_equipment.json -bi
|
||||
|
||||
**Functionality**: This option allows users to specify that the performance of the service requests should be
|
||||
computed in both directions (source to destination and destination to source). This forces the 'bidirectional'
|
||||
attribute to true in the service file, possibly affecting feasibility if one direction is not feasible.
|
||||
|
||||
|
||||
**Option**: `-o`, `--output`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Description**: Stores computation results requests into a JSON or CSV file.
|
||||
|
||||
**Usage**:
|
||||
|
||||
.. code-block:: shell-session
|
||||
|
||||
gnpy-path-request my_network.json my_service.json -o <FILE.json|FILE.csv>
|
||||
|
||||
**Functionality**: This option allows users to save the results of the path requests into a specified output file
|
||||
for further analysis.
|
||||
|
||||
|
||||
**Option**: `--redesign-per-request`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Description**: Redesigns the network for each request using the request as the reference channel
|
||||
(replaces the `SI` section of the equipment library with the request specifications).
|
||||
|
||||
**Usage**:
|
||||
.. code-block:: shell-session
|
||||
|
||||
gnpy-path-request my_network.json my_services.json --redesign-per-request
|
||||
|
||||
**Functionality**: This option enables checking different scenarios for design.
|
||||
@@ -114,10 +114,6 @@ and a fiber span from node3 to node6::
|
||||
If filled they must contain strings with the same constraint as "City" names. Its value is used to differenate links having the same end points. In this case different Id should be used. Cable Ids are not meant to be unique in general.
|
||||
|
||||
|
||||
|
||||
|
||||
(in progress)
|
||||
|
||||
.. _excel-equipment-sheet:
|
||||
|
||||
Eqpt sheet
|
||||
@@ -192,7 +188,42 @@ This generates a text file meshTopologyExampleV2_eqt_sheet.txt whose content ca
|
||||
|
||||
- **delta_p**, in dBm, is not mandatory. If filled it is used to set the output target power per channel at the output of the amplifier, if power_mode is True. The output power is then set to power_dbm + delta_power.
|
||||
|
||||
# to be completed #
|
||||
|
||||
.. _excel-roadms-sheet:
|
||||
|
||||
Roadms sheet
|
||||
------------
|
||||
|
||||
The ROADM sheet (named "Roadms") is optional.
|
||||
If provided, it can be used to specify:
|
||||
|
||||
- per channel power target on a specific ROADM degree (*per_degree_pch_out_db*),
|
||||
- ROADM type variety,
|
||||
- impairment ID (identifier) on a particular ROADM path (from degree - to degree).
|
||||
|
||||
This sheet contains six columns:
|
||||
|
||||
Node A ; Node Z ; per degree target power (dBm) ; type_variety ; from degrees ; from degree to degree impairment id
|
||||
|
||||
- **Node A** is mandatory. Name of the ROADM node (as listed in Nodes sheet).
|
||||
Must be a 'ROADM' (Type attribute in Node sheet), its number of occurence may be equal to its degree.
|
||||
|
||||
- **Node Z** is mandatory. Egress direction from the *Node A* ROADM site. Multiple Links between the same Node A
|
||||
and NodeZ is not supported.
|
||||
|
||||
- **per degree target power (dBm)** (optional).
|
||||
If filled it must contain a value in dBm corresponding to :ref:`per_degree_pch_out_db<roadm_json_instance>` on the **Node Z** degree.
|
||||
Defaults to equipment library value if not filled.
|
||||
|
||||
- **type_variety** (optional). Must be the same for all ROADM entries if filled,
|
||||
and defined in the :ref:`equipment library<roadm>`. Defaults to 'default' if not filled.
|
||||
|
||||
- **from degrees** (optional): List of Node names separated by ' | '. Names must be present in Node sheet.
|
||||
Together with Node Z, they define a list of internal path in ROADM for which the impairment ID applies
|
||||
|
||||
- **from degree to degree impairment id** (optional):List of impairment IDs separated by ' | '. Must be filled
|
||||
if **from degrees** is defined.
|
||||
The impairment ID must be defined in the equipment library and be of "express" type.
|
||||
|
||||
(in progress)
|
||||
|
||||
|
||||
@@ -7,3 +7,4 @@
|
||||
.. automodule:: gnpy.tools.json_io
|
||||
.. automodule:: gnpy.tools.plots
|
||||
.. automodule:: gnpy.tools.service_sheet
|
||||
.. automodule:: gnpy.tools.worker_utils
|
||||
|
||||
@@ -11,13 +11,17 @@ in real-world mesh optical networks. It is based on the Gaussian Noise Model.
|
||||
intro
|
||||
concepts
|
||||
install
|
||||
cli_options
|
||||
amplifier_models_description
|
||||
json
|
||||
json_instance_examples
|
||||
excel
|
||||
extending
|
||||
about-project
|
||||
model
|
||||
gnpy-api
|
||||
release-notes
|
||||
publications
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
@@ -11,9 +11,11 @@ Equipment Library
|
||||
|
||||
Design and transmission parameters are defined in a dedicated json file.
|
||||
By default, this information is read from `gnpy/example-data/eqpt_config.json <https://github.com/Telecominfraproject/oopt-gnpy/blob/master/gnpy/example-data/eqpt_config.json>`_.
|
||||
This file defines the equipment libraries that can be customized (EDFAs, fibers, and transceivers).
|
||||
This file defines the equipment libraries that can be customized (Amplifiers, ROADMs, fibers, and transceivers).
|
||||
|
||||
It also defines the simulation parameters (spans, ROADMs, and the spectral information to transmit.)
|
||||
It also defines the simulation parameters (spans and the spectral information to transmit.)
|
||||
|
||||
Examples of instances are commented here :ref:`json instances examples<json-instance-examples>`.
|
||||
|
||||
EDFA
|
||||
~~~~
|
||||
@@ -65,10 +67,16 @@ For all single band amplifier models:
|
||||
| | | within this range (center frequency and |
|
||||
| | | spectrum width). |
|
||||
| | | Default is 191.275e-12 Hz and |
|
||||
| | | 196.125e-12 (tunable in |
|
||||
| | | default_edfa_config.json) |
|
||||
| | | 196.125e-12. |
|
||||
+------------------------+-----------+-----------------------------------------+
|
||||
|
||||
Default values are defined for the frequency range for:
|
||||
- noise figure ripple
|
||||
- gain ripple
|
||||
- dynamic gain tilt
|
||||
|
||||
Users can introduce custom values using ``default_config_from_json`` which should be populated with a file name containing the desired parameters.
|
||||
|
||||
|
||||
For multi_band amplifier models:
|
||||
|
||||
@@ -490,6 +498,8 @@ If nothing is stated for impairments on roadm-paths, the program identifies the
|
||||
|
||||
On the previous example, all «implicit» express roadm-path are assigned roadm-path-impairment-id = 0
|
||||
|
||||
.. _sim-params:
|
||||
|
||||
Global parameters
|
||||
-----------------
|
||||
|
||||
@@ -1280,6 +1290,8 @@ allowed ``amplifiers`` list defined in the library.
|
||||
Roadm
|
||||
~~~~~
|
||||
|
||||
.. _roadm_json_instance:
|
||||
|
||||
+----------------------------------------+-----------+----------------------------------------------------+
|
||||
| field | type | description |
|
||||
+========================================+===========+====================================================+
|
||||
|
||||
1035
docs/json_instance_examples.rst
Normal file
1035
docs/json_instance_examples.rst
Normal file
File diff suppressed because it is too large
Load Diff
24
docs/publications.rst
Normal file
24
docs/publications.rst
Normal file
@@ -0,0 +1,24 @@
|
||||
.. _publications:
|
||||
|
||||
Publications
|
||||
============
|
||||
|
||||
Below is a chronological list of notable publications that emerged from the PSE group's collaborative work.
|
||||
These articles detail the evolution of GNPy and confirm its performance through experimental trials:
|
||||
|
||||
- `G. Grammel, V. Curri, and J. Auge, "Physical Simulation Environment of The Telecommunications Infrastructure Project (TIP)," in Optical Fiber Communication Conference, OSA Technical Digest (online) (Optica Publishing Group, 2018), paper M1D.3. <https://opg.optica.org/abstract.cfm?uri=OFC-2018-M1D.3>`_
|
||||
- `B. D. Taylor, G. Goldfarb, S. Bandyopadhyay, V. Curri, and H. Schmidtke, "Towards a Route Planning Tool for Open Optical Networks in the Telecom Infrastructure Project," in Optical Fiber Communication Conference, OSA Technical Digest (online) (Optica Publishing Group, 2018), paper Tu3E.4. <https://opg.optica.org/abstract.cfm?uri=OFC-2018-Tu3E.4>`_
|
||||
- `M. Filer, M. Cantono, A. Ferrari, G. Grammel, G. Galimberti, and V. Curri, "Multi-Vendor Experimental Validation of an Open Source QoT Estimator for Optical Networks," J. Lightwave Technol. 36, 3073-3082 (2018). <https://opg.optica.org/jlt/abstract.cfm?uri=jlt-36-15-3073>`_
|
||||
- `J. Auge, G. Grammel, E. le Rouzic, V. Curri, G. Galimberti, and J. Powell, "Open optical network planning demonstration," in Optical Fiber Communication Conference (OFC) 2019, OSA Technical Digest (Optica Publishing Group, 2019), paper M3Z.9. <https://opg.optica.org/abstract.cfm?uri=OFC-2019-M3Z.9>`_
|
||||
- `J. Kundrát, A. Campanella, E. Le Rouzic, A. Ferrari, O. Havliš, M. Hažlinský, G. Grammel, G. Galimberti, and V. Curri, "Physical-Layer Awareness: GNPy and ONOS for End-to-End Circuits in Disaggregated Networks," in Optical Fiber Communication Conference (OFC) 2020, OSA Technical Digest (Optica Publishing Group, 2020), paper M3Z.17. <https://opg.optica.org/abstract.cfm?uri=ofc-2020-m3z.17>`_
|
||||
- `A. Ferrari, M. Filer, K. Balasubramanian, Y. Yin, E. Le Rouzic, J. Kundrát, G. Grammel, G. Galimberti, and V. Curri, "Experimental Validation of an Open Source Quality of Transmission Estimator for Open Optical Networks," in Optical Fiber Communication Conference (OFC) 2020, OSA Technical Digest (Optica Publishing Group, 2020), paper W3C.2. <https://opg.optica.org/abstract.cfm?uri=ofc-2020-W3C.2>`_
|
||||
- `A. Ferrari, M. Filer, K. Balasubramanian, Y. Yin, E. Le Rouzic, J. Kundrát, G. Grammel, G. Galimberti, and V. Curri, "GNPy: an open source application for physical layer aware open optical networks," J. Opt. Commun. Netw. 12, C31-C40 (2020). <https://opg.optica.org/jocn/fulltext.cfm?uri=jocn-12-6-C31&id=429003>`_
|
||||
- `A. Ferrari, K. Balasubramanian, M. Filer, Y. Yin, E. Le Rouzic, J. Kundrát, G. Grammel, G. Galimberti, and V. Curri, "Softwarized Optical Transport QoT in Production Optical Network: a Brownfield Validation," 2020 European Conference on Optical Communications (ECOC), Brussels, Belgium, 2020. <https://ieeexplore.ieee.org/document/9333280>`_
|
||||
- `A. Ferrari, K. Balasubramanian, M. Filer, Y. Yin, E. Le Rouzic, J. Kundrát, G. Grammel, G. Galimberti, and V. Curri, "Assessment on the in-field lightpath QoT computation including connector loss uncertainties," in Journal of Optical Communications and Networking, vol. 13, no. 2, pp. A156-A164, February 2021. <https://ieeexplore.ieee.org/document/9308057>`_
|
||||
- `J. Kundrát, E. Le Rouzic, J. Mårtensson, A. Campanella, O. Havliš, A. D’Amico, G. Grammel, G. Galimberti, V. Curri, and J. Vojtěch, "GNPy & YANG: Open APIs for End-to-End Service Provisioning in Optical Networks," in Optical Fiber Communication Conference (OFC) 2021, P. Dong, J. Kani, C. Xie, R. Casellas, C. Cole, and M. Li, eds., OSA Technical Digest (Optica Publishing Group, 2021), paper M1B.6. <https://opg.optica.org/abstract.cfm?uri=ofc-2021-M1B.6>`_
|
||||
- `A. D’Amico, E. London, B. Le Guyader, F. Frank, E. Le Rouzic, E. Pincemin, N. Brochier, and V. Curri, "GNPy experimental validation on flex-grid, flex-rate WDM optical transport scenarios," in Optical Fiber Communication Conference (OFC) 2021, P. Dong, J. Kani, C. Xie, R. Casellas, C. Cole, and M. Li, eds., OSA Technical Digest (Optica Publishing Group, 2021), paper W1G.2. <https://opg.optica.org/abstract.cfm?uri=ofc-2021-W1G.2>`_
|
||||
- `E. Virgillito, R. Braun, D. Breuer, A. Gladisch, V. Curri, and G. Grammel, "Testing TIP Open Source Solutions in Deployed Optical Networks," in Optical Fiber Communication Conference (OFC) 2021, P. Dong, J. Kani, C. Xie, R. Casellas, C. Cole, and M. Li, eds., OSA Technical Digest (Optica Publishing Group, 2021), paper F1C.3. <https://opg.optica.org/abstract.cfm?uri=ofc-2021-F1C.3>`_
|
||||
- `A. D’Amico, E. London, B. Le Guyader, F. Frank, E. Le Rouzic, E. Pincemin, N. Brochier, and V. Curri, "Experimental validation of GNPy in a multi-vendor flex-grid flex-rate WDM optical transport scenario," J. Opt. Commun. Netw. 14, 79-88 (2022). <https://opg.optica.org/jocn/fulltext.cfm?uri=jocn-14-3-79&id=466355>`_
|
||||
- `J. Kundrát, E. Le Rouzic, J. Mårtensson, S. Melin, A. D’Amico, G. Grammel, G. Galimberti, and V. Curri, "GNPy: Lessons Learned and Future Plans [Invited]," in European Conference on Optical Communication (ECOC) 2022, J. Leuthold, C. Harder, B. Offrein, and H. Limberger, eds., Technical Digest Series (Optica Publishing Group, 2022), paper We3B.6. <https://opg.optica.org/abstract.cfm?uri=ECEOC-2022-We3B.6>`_
|
||||
- `G. Grammel, J. Kundrat, E. Le Rouzic, S. Melin, V. Curri, A. D'Amico, R. Manzotti, "Open Optical Networks: the good, the bad and the ugly," 49th European Conference on Optical Communications (ECOC 2023), Hybrid Conference, Glasgow, UK, 2023. <https://ieeexplore.ieee.org/document/10484723>`_
|
||||
- `A. D’Amico, V. Gatto, A. Nespola, G. Borraccini, Y. Jiang, P. Poggiolini, E. Le Rouzic, A. M. L. de Lerma, G. Grammel, R. Manzotti, V. Curri, "GNPy Experimental Validation in a C+L Multiband Optical Multiplex Section," 2024 24th International Conference on Transparent Optical Networks (ICTON), Bari, Italy, 2024. <https://ieeexplore.ieee.org/document/10648172>`_
|
||||
@@ -6,6 +6,14 @@ Release change log
|
||||
Each release introduces some changes and new features.
|
||||
|
||||
(prepare text for next release)
|
||||
**Important Changes:**
|
||||
|
||||
The default values for EDFA configuration, including frequency range, gain ripple, noise figure ripple, or dynamic gain tilt
|
||||
are now hardcoded in parameters.py and are no longer read from the default_edfa_config.json file (the file has been removed).
|
||||
However, users can define their own custom parameters using the default_config_from_json variable, which should be populated with a file name containing the desired parameter description. This applies to both variable_gain and fixed_gain amplifier types.
|
||||
|
||||
This change streamlines the configuration process but requires users to explicitly set parameters through the new
|
||||
model if the default values do not suit their needs.
|
||||
|
||||
v2.11
|
||||
-----
|
||||
|
||||
@@ -331,7 +331,7 @@ class Roadm(_Node):
|
||||
if self.per_degree_pch_psw:
|
||||
to_json['params']['per_degree_psd_out_mWperSlotWidth'] = self.per_degree_pch_psw
|
||||
if self.per_degree_impairments:
|
||||
to_json['per_degree_impairments'] = list(self.per_degree_impairments.values())
|
||||
to_json['params']['per_degree_impairments'] = list(self.per_degree_impairments.values())
|
||||
|
||||
if self.params.design_bands is not None:
|
||||
if len(self.params.design_bands) > 1:
|
||||
@@ -917,7 +917,10 @@ class Edfa(_Node):
|
||||
if operational is None:
|
||||
operational = {}
|
||||
self.variety_list = kwargs.pop('variety_list', None)
|
||||
try:
|
||||
super().__init__(*args, params=EdfaParams(**params), operational=EdfaOperational(**operational), **kwargs)
|
||||
except ParametersError as e:
|
||||
raise ParametersError(f'{kwargs["uid"]}: {e}') from e
|
||||
self.interpol_dgt = None # interpolated dynamic gain tilt defined per frequency on amp band
|
||||
self.interpol_gain_ripple = None # gain ripple
|
||||
self.interpol_nf_ripple = None # nf_ripple
|
||||
@@ -985,7 +988,8 @@ class Edfa(_Node):
|
||||
f' type_variety: {self.params.type_variety}',
|
||||
f' effective gain(dB): {self.effective_gain:.2f}',
|
||||
' (before att_in and before output VOA)',
|
||||
f' tilt-target(dB) {self.tilt_target:.2f}',
|
||||
f' tilt-target(dB) {self.tilt_target if self.tilt_target else 0:.2f}',
|
||||
# avoids -0.00 value for tilt_target
|
||||
f' noise figure (dB): {nf:.2f}',
|
||||
f' (including att_in)',
|
||||
f' pad att_in (dB): {self.att_in:.2f}',
|
||||
@@ -1317,7 +1321,7 @@ class Multiband_amplifier(_Node):
|
||||
try:
|
||||
super().__init__(params=MultiBandParams(**params), **kwargs)
|
||||
except ParametersError as e:
|
||||
raise ParametersError(f'{kwargs["uid"]}: {e}')
|
||||
raise ParametersError(f'{kwargs["uid"]}: {e}') from e
|
||||
self.amplifiers = {}
|
||||
if 'type_variety' in kwargs:
|
||||
kwargs.pop('type_variety')
|
||||
|
||||
@@ -85,7 +85,7 @@ def trx_mode_params(equipment, trx_type_variety='', trx_mode='', error_message=F
|
||||
return trx_params
|
||||
|
||||
|
||||
def find_type_variety(amps: List[str], equipment: dict) -> str:
|
||||
def find_type_variety(amps: List[str], equipment: dict) -> List[str]:
|
||||
"""Returns the multiband type_variety associated with a list of single band type_varieties
|
||||
Args:
|
||||
amps (List[str]): A list of single band type_varieties.
|
||||
@@ -106,7 +106,7 @@ def find_type_variety(amps: List[str], equipment: dict) -> str:
|
||||
if not _found_type:
|
||||
msg = f'{amps} amps do not belong to the same amp type {listes}'
|
||||
raise ConfigurationError(msg)
|
||||
return _found_type[0]
|
||||
return _found_type
|
||||
|
||||
|
||||
def find_type_varieties(amps: List[str], equipment: dict) -> List[List[str]]:
|
||||
|
||||
@@ -11,7 +11,7 @@ This module contains classes for modelling :class:`SpectralInformation`.
|
||||
from __future__ import annotations
|
||||
from collections import namedtuple
|
||||
from collections.abc import Iterable
|
||||
from typing import Union, List
|
||||
from typing import Union, List, Optional
|
||||
from dataclasses import dataclass
|
||||
from numpy import argsort, mean, array, append, ones, ceil, any, zeros, outer, full, ndarray, asarray
|
||||
|
||||
@@ -325,7 +325,7 @@ def is_in_band(frequency: float, band: dict) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def demuxed_spectral_information(input_si: SpectralInformation, band: dict) -> SpectralInformation:
|
||||
def demuxed_spectral_information(input_si: SpectralInformation, band: dict) -> Optional[SpectralInformation]:
|
||||
"""extract a si based on band
|
||||
"""
|
||||
filtered_indices = [i for i, f in enumerate(input_si.frequency)
|
||||
|
||||
@@ -118,7 +118,7 @@ def select_edfa(raman_allowed: bool, gain_target: float, power_target: float, ed
|
||||
tilt_target = 0
|
||||
with warnings.catch_warnings(record=True) as caught_warnings:
|
||||
acceptable_power_list = \
|
||||
filter_edfa_list_based_on_targets(edfa_eqpt, power_target, gain_target,
|
||||
filter_edfa_list_based_on_targets(uid, edfa_eqpt, power_target, gain_target,
|
||||
tilt_target, target_extended_gain,
|
||||
raman_allowed, verbose)
|
||||
if caught_warnings:
|
||||
@@ -247,7 +247,6 @@ def estimate_raman_gain(node, equipment, power_dbm):
|
||||
node.estimated_gain = estimated_gain
|
||||
SimParams.set_params(save_sim_params)
|
||||
return round(estimated_gain, 2)
|
||||
else:
|
||||
return 0.0
|
||||
|
||||
|
||||
@@ -369,7 +368,7 @@ def compute_band_power_deviation_and_tilt(srs_power_deviation, design_bands: dic
|
||||
return deviation_db, tilt_target
|
||||
|
||||
|
||||
def compute_tilt_using_previous_and_next_spans(prev_node, next_node, design_bands: List[str],
|
||||
def compute_tilt_using_previous_and_next_spans(prev_node, next_node, design_bands: Dict[str, float],
|
||||
input_powers: Dict[str, float], equipment: dict, network: DiGraph, prev_weight: float = 1.0,
|
||||
next_weight: float = 0) -> Tuple[Dict[str, float], Dict[str, float]]:
|
||||
"""Compute the power deviation per band and the tilt target based on previous and next spans.
|
||||
@@ -557,7 +556,7 @@ def compute_gain_power_and_tilt_target(node: elements.Edfa, prev_node, next_node
|
||||
return gain_target, power_target, _tilt_target, dp, voa, node_loss
|
||||
|
||||
|
||||
def filter_edfa_list_based_on_targets(edfa_eqpt: dict, power_target: float, gain_target: float,
|
||||
def filter_edfa_list_based_on_targets(uid: str, edfa_eqpt: dict, power_target: float, gain_target: float,
|
||||
tilt_target: float, target_extended_gain: float,
|
||||
raman_allowed: bool = True, verbose: bool = False):
|
||||
"""Filter the amplifiers based on power, gain, and tilt targets.
|
||||
@@ -626,7 +625,7 @@ def filter_edfa_list_based_on_targets(edfa_eqpt: dict, power_target: float, gain
|
||||
please increase span fiber padding')
|
||||
else:
|
||||
if verbose:
|
||||
logger.warning('\n\tWARNING: target gain is below all available amplifiers min gain: '
|
||||
logger.warning(f'\n\tWARNING: target gain in node {uid} is below all available amplifiers min gain: '
|
||||
+ '\n\tamplifier input padding will be assumed, consider increase span fiber padding '
|
||||
+ 'instead.\n')
|
||||
acceptable_gain_min_list = edfa_list
|
||||
@@ -646,7 +645,7 @@ def filter_edfa_list_based_on_targets(edfa_eqpt: dict, power_target: float, gain
|
||||
return acceptable_power_list
|
||||
|
||||
|
||||
def preselect_multiband_amps(_amplifiers: dict, prev_node, next_node, power_mode: bool, prev_voa: dict, prev_dp: dict,
|
||||
def preselect_multiband_amps(uid: str, _amplifiers: dict, prev_node, next_node, power_mode: bool, prev_voa: dict, prev_dp: dict,
|
||||
pref_total_db: float, network: DiGraph, equipment: dict, restrictions: List,
|
||||
_design_bands: dict, deviation_db: dict, tilt_target: dict):
|
||||
"""Preselect multiband amplifiers that are eligible with respect to power, gain and tilt target
|
||||
@@ -691,7 +690,7 @@ def preselect_multiband_amps(_amplifiers: dict, prev_node, next_node, power_mode
|
||||
compute_gain_power_and_tilt_target(amp, prev_node, next_node, power_mode, prev_voa[band], prev_dp[band],
|
||||
pref_total_db, network, equipment, deviation_db[band], tilt_target[band])
|
||||
_selection = [a.variety
|
||||
for a in filter_edfa_list_based_on_targets(edfa_eqpt, power_target, gain_target, _tilt_target,
|
||||
for a in filter_edfa_list_based_on_targets(uid, edfa_eqpt, power_target, gain_target, _tilt_target,
|
||||
target_extended_gain)]
|
||||
listes = find_type_varieties(_selection, equipment)
|
||||
_selected_type_varieties = []
|
||||
@@ -780,7 +779,12 @@ def set_one_amplifier(node: elements.Edfa, prev_node, next_node, power_mode: boo
|
||||
+ '\tmax flat gain: '
|
||||
+ f'{equipment["Edfa"][node.params.type_variety].gain_flatmax}dB ; '
|
||||
+ f'required gain: {round(gain_target, 2)}dB. Please check amplifier type.\n')
|
||||
|
||||
if gain_target - equipment['Edfa'][node.params.type_variety].gain_min < 0 and verbose:
|
||||
logger.warning(f'\n\tWARNING: effective gain in Node {node.uid}\n'
|
||||
+ f'\tis below user specified amplifier {node.params.type_variety}\n'
|
||||
+ '\tmin gain: '
|
||||
+ f'{equipment["Edfa"][node.params.type_variety].gain_min}dB ; '
|
||||
+ f'required gain: {round(gain_target, 2)}dB. Please check amplifier type.\n')
|
||||
node.delta_p = dp if power_mode else None
|
||||
node.effective_gain = gain_target
|
||||
node.tilt_target = _tilt_target
|
||||
@@ -942,7 +946,7 @@ def set_egress_amplifier(network: DiGraph, this_node: Union[elements.Roadm, elem
|
||||
# only select amplifiers which match the design bands
|
||||
restrictions_multi = get_node_restrictions(node, prev_node, next_node, equipment, _design_bands)
|
||||
restrictions_edfa = \
|
||||
preselect_multiband_amps(node.amplifiers, prev_node, next_node, power_mode,
|
||||
preselect_multiband_amps(node.uid, node.amplifiers, prev_node, next_node, power_mode,
|
||||
prev_voa, prev_dp, pref_total_db,
|
||||
network, equipment, restrictions_multi, _design_bands,
|
||||
deviation_db=deviation_db, tilt_target=tilt_target)
|
||||
@@ -957,7 +961,7 @@ def set_egress_amplifier(network: DiGraph, this_node: Union[elements.Roadm, elem
|
||||
deviation_db=deviation_db[band_name], tilt_target=tilt_target[band_name])
|
||||
amps_type_varieties = [a.type_variety for a in node.amplifiers.values()]
|
||||
try:
|
||||
node.type_variety = find_type_variety(amps_type_varieties, equipment)
|
||||
node.type_variety = find_type_variety(amps_type_varieties, equipment)[0]
|
||||
except ConfigurationError as e:
|
||||
# should never come here... only for debugging
|
||||
msg = f'In {node.uid}: {e}'
|
||||
|
||||
@@ -562,7 +562,9 @@ class EdfaParams:
|
||||
else:
|
||||
self.nf_ripple = asarray(nf_ripple)
|
||||
if self.nf_ripple.size != self.gain_ripple.size:
|
||||
raise ParametersError("The noise figure ripple and the gain ripple must have the same size.")
|
||||
raise ParametersError(
|
||||
"The noise figure ripple and the gain ripple must have the same size. %s, %s",
|
||||
self.nf_ripple.size, self.gain_ripple.size)
|
||||
|
||||
# VOA
|
||||
self.out_voa_auto = params['out_voa_auto']
|
||||
@@ -626,6 +628,39 @@ class EdfaOperational:
|
||||
f'tilt_target={self.tilt_target!r})')
|
||||
|
||||
|
||||
DEFAULT_EDFA_CONFIG = {
|
||||
"nf_ripple": [
|
||||
0.0
|
||||
],
|
||||
"gain_ripple": [
|
||||
0.0
|
||||
],
|
||||
"f_min": 191.275e12,
|
||||
"f_max": 196.125e12,
|
||||
"dgt": [
|
||||
1.0, 1.017807767853702, 1.0356155337864215, 1.0534217504465226, 1.0712204022764056, 1.0895983485572227,
|
||||
1.108555289615659, 1.1280891949729075, 1.1476135933863398, 1.1672278304018044, 1.1869318618366975,
|
||||
1.2067249615595257, 1.2264996957264114, 1.2428104897182262, 1.2556591482982988, 1.2650555289898042,
|
||||
1.2744470198196236, 1.2838336236692311, 1.2932153453410835, 1.3040618749785347, 1.316383926863083,
|
||||
1.3301807335621048, 1.3439818461440451, 1.3598972673004606, 1.3779439775587023, 1.3981208704326855,
|
||||
1.418273806730323, 1.4340878115214444, 1.445565137158368, 1.45273959485914, 1.4599103316162523,
|
||||
1.4670307626366115, 1.474100442252211, 1.48111939735681, 1.488134243479226, 1.495145456062699,
|
||||
1.502153039909686, 1.5097346239790443, 1.5178910621476225, 1.5266220576235803, 1.5353620432989845,
|
||||
1.545374152761467, 1.5566577309558969, 1.569199764184379, 1.5817353179379183, 1.5986915141218316,
|
||||
1.6201194134191075, 1.6460167077689267, 1.6719047669939942, 1.6918150918099673, 1.7057507692361864,
|
||||
1.7137640932265894, 1.7217732861435076, 1.7297783508684146, 1.737780757913635, 1.7459181197626403,
|
||||
1.7541903672600494, 1.7625959636196327, 1.7709972329654864, 1.7793941781790852, 1.7877868031023945,
|
||||
1.7961751115773796, 1.8045606557581335, 1.8139629377087627, 1.824381436842932, 1.835814081380705,
|
||||
1.847275503201129, 1.862235672444246, 1.8806927939516411, 1.9026104247588487, 1.9245345552113182,
|
||||
1.9482128147680253, 1.9736443063300082, 2.0008103857988204, 2.0279625371819305, 2.055100772005235,
|
||||
2.082225099873648, 2.1183028432496016, 2.16337565384239, 2.2174389328192197, 2.271520771371253,
|
||||
2.322373696229342, 2.3699990328716107, 2.414398437185221, 2.4587748041127506, 2.499446286796604,
|
||||
2.5364027376452056, 2.5696460593920065, 2.602860350286428, 2.630396440815385, 2.6521732021128046,
|
||||
2.6681935771243177, 2.6841217449620203, 2.6947834587664494, 2.705443819238505, 2.714526681131686
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
class MultiBandParams:
|
||||
default_values = {
|
||||
'bands': [],
|
||||
|
||||
@@ -12,7 +12,7 @@ from csv import writer
|
||||
from numpy import pi, cos, sqrt, log10, linspace, zeros, shape, where, logical_and, mean, array
|
||||
from scipy import constants
|
||||
from copy import deepcopy
|
||||
from typing import List
|
||||
from typing import List, Union
|
||||
|
||||
from gnpy.core.exceptions import ConfigurationError
|
||||
|
||||
@@ -444,6 +444,16 @@ def restore_order(elements, order):
|
||||
return [elements[i[0]] for i in sorted(enumerate(order), key=lambda x:x[1]) if elements[i[0]] is not None]
|
||||
|
||||
|
||||
def unique_ordered(elements):
|
||||
"""
|
||||
"""
|
||||
unique_elements = []
|
||||
for element in elements:
|
||||
if element not in unique_elements:
|
||||
unique_elements.append(element)
|
||||
return unique_elements
|
||||
|
||||
|
||||
def calculate_absolute_min_or_zero(x: array) -> array:
|
||||
"""Calculates the element-wise absolute minimum between the x and zero.
|
||||
|
||||
@@ -525,3 +535,26 @@ def find_common_range(amp_bands: List[List[dict]], default_band_f_min: float, de
|
||||
for first in common_range for second in bands
|
||||
if max(first['f_min'], second['f_min']) < min(first['f_max'], second['f_max'])]
|
||||
return sorted(common_range, key=lambda x: x['f_min'])
|
||||
|
||||
|
||||
def transform_data(data: str) -> Union[List[int], None]:
|
||||
"""Transforms a float into an list of one integer or a string separated by "|" into a list of integers.
|
||||
|
||||
Args:
|
||||
data (float or str): The data to transform.
|
||||
|
||||
Returns:
|
||||
list of int: The transformed data as a list of integers.
|
||||
|
||||
Examples:
|
||||
>>> transform_data(5.0)
|
||||
[5]
|
||||
|
||||
>>> transform_data('1 | 2 | 3')
|
||||
[1, 2, 3]
|
||||
"""
|
||||
if isinstance(data, float):
|
||||
return [int(data)]
|
||||
if isinstance(data, str):
|
||||
return [int(x) for x in data.split(' | ')]
|
||||
return None
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
{
|
||||
"nf_ripple": [
|
||||
0.0
|
||||
],
|
||||
"gain_ripple": [
|
||||
0.0
|
||||
],
|
||||
"f_min": 191.275e12,
|
||||
"f_max": 196.125e12,
|
||||
"dgt": [
|
||||
1.0,
|
||||
1.017807767853702,
|
||||
1.0356155337864215,
|
||||
1.0534217504465226,
|
||||
1.0712204022764056,
|
||||
1.0895983485572227,
|
||||
1.108555289615659,
|
||||
1.1280891949729075,
|
||||
1.1476135933863398,
|
||||
1.1672278304018044,
|
||||
1.1869318618366975,
|
||||
1.2067249615595257,
|
||||
1.2264996957264114,
|
||||
1.2428104897182262,
|
||||
1.2556591482982988,
|
||||
1.2650555289898042,
|
||||
1.2744470198196236,
|
||||
1.2838336236692311,
|
||||
1.2932153453410835,
|
||||
1.3040618749785347,
|
||||
1.316383926863083,
|
||||
1.3301807335621048,
|
||||
1.3439818461440451,
|
||||
1.3598972673004606,
|
||||
1.3779439775587023,
|
||||
1.3981208704326855,
|
||||
1.418273806730323,
|
||||
1.4340878115214444,
|
||||
1.445565137158368,
|
||||
1.45273959485914,
|
||||
1.4599103316162523,
|
||||
1.4670307626366115,
|
||||
1.474100442252211,
|
||||
1.48111939735681,
|
||||
1.488134243479226,
|
||||
1.495145456062699,
|
||||
1.502153039909686,
|
||||
1.5097346239790443,
|
||||
1.5178910621476225,
|
||||
1.5266220576235803,
|
||||
1.5353620432989845,
|
||||
1.545374152761467,
|
||||
1.5566577309558969,
|
||||
1.569199764184379,
|
||||
1.5817353179379183,
|
||||
1.5986915141218316,
|
||||
1.6201194134191075,
|
||||
1.6460167077689267,
|
||||
1.6719047669939942,
|
||||
1.6918150918099673,
|
||||
1.7057507692361864,
|
||||
1.7137640932265894,
|
||||
1.7217732861435076,
|
||||
1.7297783508684146,
|
||||
1.737780757913635,
|
||||
1.7459181197626403,
|
||||
1.7541903672600494,
|
||||
1.7625959636196327,
|
||||
1.7709972329654864,
|
||||
1.7793941781790852,
|
||||
1.7877868031023945,
|
||||
1.7961751115773796,
|
||||
1.8045606557581335,
|
||||
1.8139629377087627,
|
||||
1.824381436842932,
|
||||
1.835814081380705,
|
||||
1.847275503201129,
|
||||
1.862235672444246,
|
||||
1.8806927939516411,
|
||||
1.9026104247588487,
|
||||
1.9245345552113182,
|
||||
1.9482128147680253,
|
||||
1.9736443063300082,
|
||||
2.0008103857988204,
|
||||
2.0279625371819305,
|
||||
2.055100772005235,
|
||||
2.082225099873648,
|
||||
2.1183028432496016,
|
||||
2.16337565384239,
|
||||
2.2174389328192197,
|
||||
2.271520771371253,
|
||||
2.322373696229342,
|
||||
2.3699990328716107,
|
||||
2.414398437185221,
|
||||
2.4587748041127506,
|
||||
2.499446286796604,
|
||||
2.5364027376452056,
|
||||
2.5696460593920065,
|
||||
2.602860350286428,
|
||||
2.630396440815385,
|
||||
2.6521732021128046,
|
||||
2.6681935771243177,
|
||||
2.6841217449620203,
|
||||
2.6947834587664494,
|
||||
2.705443819238505,
|
||||
2.714526681131686
|
||||
]
|
||||
}
|
||||
74
gnpy/example-data/extra_eqpt_config.json
Normal file
74
gnpy/example-data/extra_eqpt_config.json
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"Edfa": [
|
||||
{
|
||||
"type_variety": "user_defined",
|
||||
"type_def": "variable_gain",
|
||||
"f_min": 192.0e12,
|
||||
"f_max": 195.9e12,
|
||||
"gain_flatmax": 25,
|
||||
"gain_min": 15,
|
||||
"p_max": 21,
|
||||
"nf_min": 6,
|
||||
"nf_max": 10,
|
||||
"default_config_from_json": "user_edfa_config.json",
|
||||
"out_voa_auto": false,
|
||||
"allowed_for_design": true
|
||||
}, {
|
||||
"type_variety": "user_high_detail_model_example",
|
||||
"type_def": "advanced_model",
|
||||
"gain_flatmax": 25,
|
||||
"gain_min": 15,
|
||||
"p_max": 21,
|
||||
"advanced_config_from_json": "std_medium_gain_advanced_config.json",
|
||||
"out_voa_auto": false,
|
||||
"allowed_for_design": false
|
||||
}
|
||||
],
|
||||
"Transceiver": [
|
||||
{
|
||||
"type_variety": "ZR400G",
|
||||
"frequency": {
|
||||
"min": 191.3e12,
|
||||
"max": 196.1e12
|
||||
},
|
||||
"mode": [
|
||||
{
|
||||
"format": "SFF-ID:70",
|
||||
"baud_rate": 60138546798,
|
||||
"OSNR": 24,
|
||||
"bit_rate": 400e9,
|
||||
"roll_off": 0.2,
|
||||
"tx_osnr": 34,
|
||||
"min_spacing": 75e9,
|
||||
"penalties": [
|
||||
{
|
||||
"chromatic_dispersion": 20e3,
|
||||
"penalty_value": 0.5
|
||||
},
|
||||
{
|
||||
"chromatic_dispersion": 0,
|
||||
"penalty_value": 0
|
||||
},
|
||||
{
|
||||
"pmd": 20,
|
||||
"penalty_value": 0.5
|
||||
},
|
||||
{
|
||||
"pdl": 1.5,
|
||||
"penalty_value": 0
|
||||
},
|
||||
{
|
||||
"pdl": 3.5,
|
||||
"penalty_value": 1.8
|
||||
},
|
||||
{
|
||||
"pdl": 3,
|
||||
"penalty_value": 1.3
|
||||
}
|
||||
],
|
||||
"cost": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
22
gnpy/example-data/service_pluggable.json
Normal file
22
gnpy/example-data/service_pluggable.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"path-request": [
|
||||
{
|
||||
"request-id": "0",
|
||||
"source": "trx Brest_KLA",
|
||||
"destination": "trx Lannion_CAS",
|
||||
"src-tp-id": "trx Brest_KLA",
|
||||
"dst-tp-id": "trx Lannion_CAS",
|
||||
"bidirectional": false,
|
||||
"path-constraints": {
|
||||
"te-bandwidth": {
|
||||
"technology": "flexi-grid",
|
||||
"trx_type": "ZR400G",
|
||||
"trx_mode": "SFF-ID:70",
|
||||
"spacing": 100000000000.0,
|
||||
"tx_power": 0.0015,
|
||||
"path_bandwidth": 400000000000.0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -11,25 +11,28 @@ Common code for CLI examples
|
||||
import argparse
|
||||
import logging
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
from math import ceil
|
||||
from numpy import mean
|
||||
from pathlib import Path
|
||||
from copy import deepcopy
|
||||
|
||||
import gnpy.core.ansi_escapes as ansi_escapes
|
||||
from gnpy.core.elements import Transceiver, Fiber, RamanFiber, Roadm
|
||||
import gnpy.core.exceptions as exceptions
|
||||
from gnpy.core import ansi_escapes
|
||||
from gnpy.core.elements import Transceiver, Fiber, RamanFiber
|
||||
from gnpy.core import exceptions
|
||||
from gnpy.core.parameters import SimParams
|
||||
from gnpy.core.utils import lin2db, pretty_summary_print, per_label_average, watt2dbm
|
||||
from gnpy.topology.request import (ResultElement, jsontocsv, BLOCKING_NOPATH)
|
||||
from gnpy.tools.json_io import (load_equipment, load_network, load_json, load_requests, save_network,
|
||||
requests_from_json, save_json, load_initial_spectrum)
|
||||
from gnpy.tools.json_io import (load_equipments_and_configs, load_network, load_json, load_requests, save_network,
|
||||
requests_from_json, save_json, load_initial_spectrum, DEFAULT_EQPT_CONFIG)
|
||||
from gnpy.tools.plots import plot_baseline, plot_results
|
||||
from gnpy.tools.worker_utils import designed_network, transmission_simulation, planning
|
||||
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
_examples_dir = Path(__file__).parent.parent / 'example-data'
|
||||
_default_config_files = ['example-data/std_medium_gain_advanced_config.json',
|
||||
'example-data/Juniper-BoosterHG.json',
|
||||
'parameters.DEFAULT_EDFA_CONFIG']
|
||||
_help_footer = '''
|
||||
This program is part of GNPy, https://github.com/TelecomInfraProject/oopt-gnpy
|
||||
|
||||
@@ -44,11 +47,12 @@ def show_example_data_dir():
|
||||
print(f'{_examples_dir}/')
|
||||
|
||||
|
||||
def load_common_data(equipment_filename, topology_filename, simulation_filename, save_raw_network_filename):
|
||||
"""Load common configuration from JSON files"""
|
||||
def load_common_data(equipment_filename: Path, extra_equipment_filenames: List[Path], extra_config_filenames: List[Path],
|
||||
topology_filename: Path, simulation_filename: Path, save_raw_network_filename: Path):
|
||||
"""Load common configuration from JSON files, merging additional equipment if provided."""
|
||||
|
||||
try:
|
||||
equipment = load_equipment(equipment_filename)
|
||||
equipment = load_equipments_and_configs(equipment_filename, extra_equipment_filenames, extra_config_filenames)
|
||||
network = load_network(topology_filename, equipment)
|
||||
if save_raw_network_filename is not None:
|
||||
save_network(network, save_raw_network_filename)
|
||||
@@ -92,7 +96,7 @@ def _add_common_options(parser: argparse.ArgumentParser, network_default: Path):
|
||||
parser.add_argument('-v', '--verbose', action='count', default=0,
|
||||
help='Increase verbosity (can be specified several times)')
|
||||
parser.add_argument('-e', '--equipment', type=Path, metavar=_help_fname_json,
|
||||
default=_examples_dir / 'eqpt_config.json', help='Equipment library')
|
||||
default=DEFAULT_EQPT_CONFIG, help='Equipment library')
|
||||
parser.add_argument('--sim-params', type=Path, metavar=_help_fname_json,
|
||||
default=None, help='Path to the JSON containing simulation parameters (required for Raman). '
|
||||
f'Example: {_examples_dir / "sim_params.json"}')
|
||||
@@ -103,9 +107,22 @@ def _add_common_options(parser: argparse.ArgumentParser, network_default: Path):
|
||||
parser.add_argument('--no-insert-edfas', action='store_true',
|
||||
help='Disable insertion of EDFAs after ROADMs and fibers '
|
||||
'as well as splitting of fibers by auto-design.')
|
||||
# Option for additional equipment files
|
||||
parser.add_argument('--extra-equipment', nargs='+', type=Path,
|
||||
metavar=_help_fname_json, default=None,
|
||||
help='List of additional equipment files to complement the main equipment file.')
|
||||
# Option for additional config files
|
||||
parser.add_argument('--extra-config', nargs='+', type=Path,
|
||||
metavar=_help_fname_json,
|
||||
help='List of additional config files as referenced in equipment files with '
|
||||
'"advanced_config_from_json" or "default_config_from_json".'
|
||||
f'Existing configs:\n{_default_config_files}')
|
||||
|
||||
|
||||
def transmission_main_example(args=None):
|
||||
"""Main script running a single simulation. It returns the detailed power across crossed elements and
|
||||
average performance accross all channels.
|
||||
"""
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Send a full spectrum load through the network from point A to point B',
|
||||
epilog=_help_footer,
|
||||
@@ -123,7 +140,8 @@ def transmission_main_example(args=None):
|
||||
args = parser.parse_args(args if args is not None else sys.argv[1:])
|
||||
_setup_logging(args)
|
||||
|
||||
(equipment, network) = load_common_data(args.equipment, args.topology, args.sim_params, args.save_network_before_autodesign)
|
||||
(equipment, network) = load_common_data(args.equipment, args.extra_equipment, args.extra_config, args.topology,
|
||||
args.sim_params, args.save_network_before_autodesign)
|
||||
|
||||
if args.plot:
|
||||
plot_baseline(network)
|
||||
@@ -144,14 +162,14 @@ def transmission_main_example(args=None):
|
||||
source = None
|
||||
if args.source:
|
||||
source = transceivers.pop(args.source, None)
|
||||
valid_source = True if source else False
|
||||
valid_source = bool(source)
|
||||
|
||||
destination = None
|
||||
nodes_list = []
|
||||
loose_list = []
|
||||
if args.destination:
|
||||
destination = transceivers.pop(args.destination, None)
|
||||
valid_destination = True if destination else False
|
||||
valid_destination = bool(destination)
|
||||
|
||||
# If no exact match try to find partial match
|
||||
if args.source and not source:
|
||||
@@ -209,8 +227,8 @@ def transmission_main_example(args=None):
|
||||
except ValueError:
|
||||
sys.exit(1)
|
||||
# print or export results
|
||||
spans = [s.params.length for s in path if isinstance(s, RamanFiber) or isinstance(s, Fiber)]
|
||||
print(f'\nThere are {len(spans)} fiber spans over {sum(spans)/1000:.0f} km between {source.uid} '
|
||||
spans = [s.params.length for s in path if isinstance(s, (Fiber, RamanFiber))]
|
||||
print(f'\nThere are {len(spans)} fiber spans over {sum(spans) / 1000:.0f} km between {source.uid} '
|
||||
f'and {destination.uid}')
|
||||
print(f'\nNow propagating between {source.uid} and {destination.uid}:')
|
||||
print(f'Reference used for design: (Input optical power reference in span = {watt2dbm(ref_req.power):.2f}dBm,\n'
|
||||
@@ -223,22 +241,22 @@ def transmission_main_example(args=None):
|
||||
+ ' transceiver output power = '
|
||||
+ f'{pretty_summary_print(per_label_average(watt2dbm(infos.tx_power), infos.label))}dBm,\n'
|
||||
+ f' nb_channels = {infos.number_of_channels})')
|
||||
for path, power_dbm in zip(propagations_for_path, powers_dbm):
|
||||
for mypath, power_dbm in zip(propagations_for_path, powers_dbm):
|
||||
if power_mode:
|
||||
print(f'Input optical power reference in span = {ansi_escapes.cyan}{power_dbm:.2f} '
|
||||
+ f'dBm{ansi_escapes.reset}:')
|
||||
else:
|
||||
print('\nPropagating in {ansi_escapes.cyan}gain mode{ansi_escapes.reset}: power cannot be set manually')
|
||||
if len(powers_dbm) == 1:
|
||||
for elem in path:
|
||||
for elem in mypath:
|
||||
print(elem)
|
||||
if power_mode:
|
||||
print(f'\nTransmission result for input optical power reference in span = {power_dbm:.2f} dBm:')
|
||||
else:
|
||||
print(f'\nTransmission results:')
|
||||
print('\nTransmission results:')
|
||||
print(f' Final GSNR (0.1 nm): {ansi_escapes.cyan}{mean(destination.snr_01nm):.02f} dB{ansi_escapes.reset}')
|
||||
else:
|
||||
print(path[-1])
|
||||
print(mypath[-1])
|
||||
|
||||
if args.save_network is not None:
|
||||
save_network(network, args.save_network)
|
||||
@@ -286,6 +304,9 @@ def _path_result_json(pathresult):
|
||||
|
||||
|
||||
def path_requests_run(args=None):
|
||||
"""Main script running several services simulations. It returns a summary of the average performance
|
||||
for each service.
|
||||
"""
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Compute performance for a list of services provided in a json file or an excel sheet',
|
||||
epilog=_help_footer,
|
||||
@@ -302,28 +323,23 @@ def path_requests_run(args=None):
|
||||
parser.add_argument('--redesign-per-request', action='store_true', help='Redesign the network at each request'
|
||||
+ ' computation using the request as the reference channel')
|
||||
|
||||
|
||||
args = parser.parse_args(args if args is not None else sys.argv[1:])
|
||||
_setup_logging(args)
|
||||
|
||||
_logger.info(f'Computing path requests {args.service_filename.name} into JSON format')
|
||||
|
||||
(equipment, network) = \
|
||||
load_common_data(args.equipment, args.topology, args.sim_params, args.save_network_before_autodesign)
|
||||
load_common_data(args.equipment, args.extra_equipment, args.extra_config, args.topology, args.sim_params,
|
||||
args.save_network_before_autodesign)
|
||||
|
||||
# Build the network once using the default power defined in SI in eqpt config
|
||||
# TODO power density: db2linp(ower_dbm": 0)/power_dbm": 0 * nb channels as defined by
|
||||
# spacing, f_min and f_max
|
||||
if args.save_network is not None:
|
||||
save_network(network, args.save_network)
|
||||
print(f'Network (after autodesign) saved to {args.save_network}')
|
||||
|
||||
try:
|
||||
network, _, _ = designed_network(equipment, network, no_insert_edfas=args.no_insert_edfas)
|
||||
data = load_requests(args.service_filename, equipment, bidir=args.bidir,
|
||||
network=network, network_filename=args.topology)
|
||||
_data = requests_from_json(data, equipment)
|
||||
oms_list, propagatedpths, reversed_propagatedpths, rqs, dsjn, result = \
|
||||
_, propagatedpths, reversed_propagatedpths, rqs, dsjn, result = \
|
||||
planning(network, equipment, data, redesign=args.redesign_per_request)
|
||||
except exceptions.NetworkTopologyError as e:
|
||||
print(f'{ansi_escapes.red}Invalid network definition:{ansi_escapes.reset} {e}')
|
||||
@@ -344,6 +360,10 @@ def path_requests_run(args=None):
|
||||
print(f'{ansi_escapes.blue}The following services have been requested:{ansi_escapes.reset}')
|
||||
print(_data)
|
||||
|
||||
if args.save_network is not None:
|
||||
save_network(network, args.save_network)
|
||||
print(f'Network (after autodesign) saved to {args.save_network}')
|
||||
|
||||
print(f'{ansi_escapes.blue}Result summary{ansi_escapes.reset}')
|
||||
header = ['req id', ' demand', ' GSNR@bandwidth A-Z (Z-A)', ' GSNR@0.1nm A-Z (Z-A)',
|
||||
' Receiver minOSNR', ' mode', ' Gbit/s', ' nb of tsp pairs',
|
||||
@@ -353,27 +373,27 @@ def path_requests_run(args=None):
|
||||
for i, this_p in enumerate(propagatedpths):
|
||||
rev_pth = reversed_propagatedpths[i]
|
||||
if rev_pth and this_p:
|
||||
psnrb = f'{round(mean(this_p[-1].snr),2)} ({round(mean(rev_pth[-1].snr),2)})'
|
||||
psnrb = f'{round(mean(this_p[-1].snr), 2)} ({round(mean(rev_pth[-1].snr), 2)})'
|
||||
psnr = f'{round(mean(this_p[-1].snr_01nm), 2)}' +\
|
||||
f' ({round(mean(rev_pth[-1].snr_01nm),2)})'
|
||||
f' ({round(mean(rev_pth[-1].snr_01nm), 2)})'
|
||||
elif this_p:
|
||||
psnrb = f'{round(mean(this_p[-1].snr),2)}'
|
||||
psnr = f'{round(mean(this_p[-1].snr_01nm),2)}'
|
||||
psnrb = f'{round(mean(this_p[-1].snr), 2)}'
|
||||
psnr = f'{round(mean(this_p[-1].snr_01nm), 2)}'
|
||||
|
||||
try:
|
||||
if rqs[i].blocking_reason in BLOCKING_NOPATH:
|
||||
line = [f'{rqs[i].request_id}', f' {rqs[i].source} to {rqs[i].destination} :',
|
||||
f'-', f'-', f'-', f'{rqs[i].tsp_mode}', f'{round(rqs[i].path_bandwidth * 1e-9,2)}',
|
||||
f'-', f'{rqs[i].blocking_reason}']
|
||||
'-', '-', '-', f'{rqs[i].tsp_mode}', f'{round(rqs[i].path_bandwidth * 1e-9, 2)}',
|
||||
'-', '{rqs[i].blocking_reason}']
|
||||
else:
|
||||
line = [f'{rqs[i].request_id}', f' {rqs[i].source} to {rqs[i].destination} : ', psnrb,
|
||||
psnr, f'-', f'{rqs[i].tsp_mode}', f'{round(rqs[i].path_bandwidth * 1e-9, 2)}',
|
||||
f'-', f'{rqs[i].blocking_reason}']
|
||||
psnr, '-', f'{rqs[i].tsp_mode}', f'{round(rqs[i].path_bandwidth * 1e-9, 2)}',
|
||||
'-', f'{rqs[i].blocking_reason}']
|
||||
except AttributeError:
|
||||
line = [f'{rqs[i].request_id}', f' {rqs[i].source} to {rqs[i].destination} : ', psnrb,
|
||||
psnr, f'{rqs[i].OSNR + equipment["SI"]["default"].sys_margins}',
|
||||
f'{rqs[i].tsp_mode}', f'{round(rqs[i].path_bandwidth * 1e-9,2)}',
|
||||
f'{ceil(rqs[i].path_bandwidth / rqs[i].bit_rate) }', f'({rqs[i].N},{rqs[i].M})']
|
||||
f'{rqs[i].tsp_mode}', f'{round(rqs[i].path_bandwidth * 1e-9, 2)}',
|
||||
f'{ceil(rqs[i].path_bandwidth / rqs[i].bit_rate)}', f'({rqs[i].N},{rqs[i].M})']
|
||||
data.append(line)
|
||||
|
||||
col_width = max(len(word) for row in data for word in row[2:]) # padding
|
||||
|
||||
@@ -20,7 +20,6 @@ In the "Links" sheet, only the first three columns ("Node A", "Node Z" and
|
||||
the "east" information so that it is possible to input undirected data.
|
||||
"""
|
||||
|
||||
from xlrd import open_workbook
|
||||
from logging import getLogger
|
||||
from argparse import ArgumentParser
|
||||
from collections import namedtuple, Counter, defaultdict
|
||||
@@ -28,8 +27,12 @@ from itertools import chain
|
||||
from json import dumps
|
||||
from pathlib import Path
|
||||
from copy import copy
|
||||
from typing import Dict, List, Tuple, DefaultDict
|
||||
from xlrd import open_workbook
|
||||
from xlrd.biffh import XLRDError
|
||||
from networkx import DiGraph
|
||||
|
||||
from gnpy.core.utils import silent_remove
|
||||
from gnpy.core.utils import silent_remove, transform_data
|
||||
from gnpy.core.exceptions import NetworkTopologyError
|
||||
from gnpy.core.elements import Edfa, Fused, Fiber
|
||||
|
||||
@@ -38,12 +41,16 @@ _logger = getLogger(__name__)
|
||||
|
||||
|
||||
def all_rows(sh, start=0):
|
||||
"""Returns all rows of the xls(x) sheet starting from start row
|
||||
"""
|
||||
return (sh.row(x) for x in range(start, sh.nrows))
|
||||
|
||||
|
||||
class Node(object):
|
||||
class Node:
|
||||
"""Node data class
|
||||
"""
|
||||
def __init__(self, **kwargs):
|
||||
super(Node, self).__init__()
|
||||
super().__init__()
|
||||
self.update_attr(kwargs)
|
||||
|
||||
def update_attr(self, kwargs):
|
||||
@@ -65,13 +72,13 @@ class Node(object):
|
||||
}
|
||||
|
||||
|
||||
class Link(object):
|
||||
class Link:
|
||||
"""attribtes from west parse_ept_headers dict
|
||||
+node_a, node_z, west_fiber_con_in, east_fiber_con_in
|
||||
"""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(Link, self).__init__()
|
||||
super().__init__()
|
||||
self.update_attr(kwargs)
|
||||
self.distance_units = 'km'
|
||||
|
||||
@@ -80,7 +87,7 @@ class Link(object):
|
||||
for k, v in self.default_values.items():
|
||||
v = clean_kwargs.get(k, v)
|
||||
setattr(self, k, v)
|
||||
k = 'west' + k.split('east')[-1]
|
||||
k = 'west' + k.rsplit('east', maxsplit=1)[-1]
|
||||
v = clean_kwargs.get(k, v)
|
||||
setattr(self, k, v)
|
||||
|
||||
@@ -101,9 +108,11 @@ class Link(object):
|
||||
}
|
||||
|
||||
|
||||
class Eqpt(object):
|
||||
class Eqpt:
|
||||
"""
|
||||
"""
|
||||
def __init__(self, **kwargs):
|
||||
super(Eqpt, self).__init__()
|
||||
super().__init__()
|
||||
self.update_attr(kwargs)
|
||||
|
||||
def update_attr(self, kwargs):
|
||||
@@ -111,7 +120,7 @@ class Eqpt(object):
|
||||
for k, v in self.default_values.items():
|
||||
v_east = clean_kwargs.get(k, v)
|
||||
setattr(self, k, v_east)
|
||||
k = 'west' + k.split('east')[-1]
|
||||
k = 'west' + k.rsplit('east', maxsplit=1)[-1]
|
||||
v_west = clean_kwargs.get(k, v)
|
||||
setattr(self, k, v_west)
|
||||
|
||||
@@ -119,17 +128,18 @@ class Eqpt(object):
|
||||
'from_city': '',
|
||||
'to_city': '',
|
||||
'east_amp_type': '',
|
||||
'east_att_in': 0,
|
||||
'east_amp_gain': None,
|
||||
'east_amp_dp': None,
|
||||
'east_tilt_vs_wavelength': 0,
|
||||
'east_tilt_vs_wavelength': None,
|
||||
'east_att_out': None
|
||||
}
|
||||
|
||||
|
||||
class Roadm(object):
|
||||
class Roadm:
|
||||
"""
|
||||
"""
|
||||
def __init__(self, **kwargs):
|
||||
super(Roadm, self).__init__()
|
||||
super().__init__()
|
||||
self.update_attr(kwargs)
|
||||
|
||||
def update_attr(self, kwargs):
|
||||
@@ -140,7 +150,10 @@ class Roadm(object):
|
||||
|
||||
default_values = {'from_node': '',
|
||||
'to_node': '',
|
||||
'target_pch_out_db': None
|
||||
'target_pch_out_db': None,
|
||||
'type_variety': None,
|
||||
'from_degrees': None,
|
||||
'impairment_ids': None
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +166,7 @@ def read_header(my_sheet, line, slice_):
|
||||
try:
|
||||
header = [x.value.strip() for x in my_sheet.row_slice(line, slice_[0], slice_[1])]
|
||||
header_i = [Param_header(header, i + slice_[0]) for i, header in enumerate(header) if header != '']
|
||||
except Exception:
|
||||
except (AttributeError, IndexError):
|
||||
header_i = []
|
||||
if header_i != [] and header_i[-1].colindex != slice_[1]:
|
||||
header_i.append(Param_header('', slice_[1]))
|
||||
@@ -169,7 +182,7 @@ def read_slice(my_sheet, line, slice_, header):
|
||||
try:
|
||||
slice_range = next((h.colindex, header_i[i + 1].colindex)
|
||||
for i, h in enumerate(header_i) if header in h.header)
|
||||
except Exception:
|
||||
except StopIteration:
|
||||
pass
|
||||
return slice_range
|
||||
|
||||
@@ -190,7 +203,6 @@ def parse_headers(my_sheet, input_headers_dict, headers, start_line, slice_in):
|
||||
msg = f'missing header {h0}'
|
||||
if h0 in ('east', 'Node A', 'Node Z', 'City'):
|
||||
raise NetworkTopologyError(msg)
|
||||
else:
|
||||
_logger.warning(msg)
|
||||
elif not isinstance(input_headers_dict[h0], dict):
|
||||
headers[slice_out[0]] = input_headers_dict[h0]
|
||||
@@ -203,22 +215,33 @@ def parse_headers(my_sheet, input_headers_dict, headers, start_line, slice_in):
|
||||
|
||||
|
||||
def parse_row(row, headers):
|
||||
"""
|
||||
"""
|
||||
return {f: r.value for f, r in
|
||||
zip([label for label in headers.values()], [row[i] for i in headers])}
|
||||
zip(list(headers.values()), [row[i] for i in headers])}
|
||||
|
||||
|
||||
def parse_sheet(my_sheet, input_headers_dict, header_line, start_line, column):
|
||||
"""
|
||||
"""
|
||||
headers = parse_headers(my_sheet, input_headers_dict, {}, header_line, (0, column))
|
||||
for row in all_rows(my_sheet, start=start_line):
|
||||
yield parse_row(row[0: column], headers)
|
||||
|
||||
|
||||
def _format_items(items):
|
||||
def _format_items(items: List[str]):
|
||||
"""formating utils
|
||||
"""
|
||||
return '\n'.join(f' - {item}' for item in items)
|
||||
|
||||
|
||||
def sanity_check(nodes, links, nodes_by_city, links_by_city, eqpts_by_city):
|
||||
|
||||
def sanity_check(nodes: List[Node], links: List[Link],
|
||||
nodes_by_city: Dict[str, Node], links_by_city: DefaultDict[str, List[Link]],
|
||||
eqpts_by_city: DefaultDict[str, List[Eqpt]]) -> Tuple[List[Node], List[Link]]:
|
||||
"""Raise correct issues if xls(x) is not correct, Correct type to ROADM if more tha 2-degrees
|
||||
checks duplicate links, unreferenced nodes in links, in eqpts, unreferenced link in eqpts,
|
||||
duplicate items
|
||||
"""
|
||||
duplicate_links = []
|
||||
for l1 in links:
|
||||
for l2 in links:
|
||||
@@ -227,6 +250,7 @@ def sanity_check(nodes, links, nodes_by_city, links_by_city, eqpts_by_city):
|
||||
link {l1.from_city}-{l1.to_city} is duplicate \
|
||||
\nthe 1st duplicate link will be removed but you should check Links sheet input')
|
||||
duplicate_links.append(l1)
|
||||
|
||||
if duplicate_links:
|
||||
msg = 'XLS error: ' \
|
||||
+ f'links {_format_items([(d.from_city, d.to_city) for d in duplicate_links])} are duplicate'
|
||||
@@ -315,13 +339,29 @@ def create_roadm_element(node, roadms_by_city):
|
||||
'booster_variety_list': silent_remove(node.booster_restriction.split(' | '), '')}
|
||||
}
|
||||
if node.city in roadms_by_city.keys():
|
||||
if 'params' not in roadm.keys():
|
||||
if 'params' not in roadm:
|
||||
roadm['params'] = {}
|
||||
roadm['params']['per_degree_pch_out_db'] = {}
|
||||
for elem in roadms_by_city[node.city]:
|
||||
to_node = f'east edfa in {node.city} to {elem.to_node}'
|
||||
if elem.target_pch_out_db is not None:
|
||||
roadm['params']['per_degree_pch_out_db'][to_node] = elem.target_pch_out_db
|
||||
if elem.from_degrees is not None and elem.impairment_ids is not None:
|
||||
# only set per degree impairment if there is an entry (reduce verbose)
|
||||
if roadm['params'].get('per_degree_impairments') is None:
|
||||
roadm['params']['per_degree_impairments'] = []
|
||||
fromdegrees = elem.from_degrees.split(' | ')
|
||||
impairment_ids = transform_data(elem.impairment_ids)
|
||||
if len(fromdegrees) != len(impairment_ids):
|
||||
msg = f'Roadm {node.city} per degree impairment id do not match with from degree definition'
|
||||
raise NetworkTopologyError(msg)
|
||||
for from_degree, impairment_id in zip(fromdegrees, impairment_ids):
|
||||
from_node = f'west edfa in {node.city} to {from_degree}'
|
||||
roadm['params']['per_degree_impairments'].append({'from_degree': from_node,
|
||||
'to_degree': to_node,
|
||||
'impairment_id': impairment_id})
|
||||
if elem.type_variety is not None:
|
||||
roadm['type_variety'] = elem.type_variety
|
||||
roadm['metadata'] = {'location': {'city': node.city,
|
||||
'region': node.region,
|
||||
'latitude': node.latitude,
|
||||
@@ -330,7 +370,7 @@ def create_roadm_element(node, roadms_by_city):
|
||||
return roadm
|
||||
|
||||
|
||||
def create_east_eqpt_element(node):
|
||||
def create_east_eqpt_element(node: Node, nodes_by_city: Dict[str, Node]) -> dict:
|
||||
""" create amplifiers json elements for the east direction.
|
||||
this includes the case where the case of a fused element defined instead of an
|
||||
ILA in eqpt sheet
|
||||
@@ -363,7 +403,7 @@ def create_east_eqpt_element(node):
|
||||
return eqpt
|
||||
|
||||
|
||||
def create_west_eqpt_element(node):
|
||||
def create_west_eqpt_element(node: Node, nodes_by_city: Dict[str, Node]) -> dict:
|
||||
""" create amplifiers json elements for the west direction.
|
||||
this includes the case where the case of a fused element defined instead of an
|
||||
ILA in eqpt sheet
|
||||
@@ -390,7 +430,13 @@ def create_west_eqpt_element(node):
|
||||
eqpt['params'] = {'loss': 0}
|
||||
return eqpt
|
||||
|
||||
def xls_to_json_data(input_filename, filter_region=[]):
|
||||
|
||||
def xls_to_json_data(input_filename: Path, filter_region: List[str] = None) -> Dict:
|
||||
"""Read the excel sheets and produces the json dict in GNPy format (legacy)
|
||||
returns json dict
|
||||
"""
|
||||
if filter_region is None:
|
||||
filter_region = []
|
||||
nodes, links, eqpts, roadms = parse_excel(input_filename)
|
||||
if filter_region:
|
||||
nodes = [n for n in nodes if n.region.lower() in filter_region]
|
||||
@@ -400,16 +446,13 @@ def xls_to_json_data(input_filename, filter_region=[]):
|
||||
cities = {lnk.from_city for lnk in links} | {lnk.to_city for lnk in links}
|
||||
nodes = [n for n in nodes if n.city in cities]
|
||||
|
||||
global nodes_by_city
|
||||
nodes_by_city = {n.city: n for n in nodes}
|
||||
|
||||
global links_by_city
|
||||
links_by_city = defaultdict(list)
|
||||
for link in links:
|
||||
links_by_city[link.from_city].append(link)
|
||||
links_by_city[link.to_city].append(link)
|
||||
|
||||
global eqpts_by_city
|
||||
eqpts_by_city = defaultdict(list)
|
||||
for eqpt in eqpts:
|
||||
eqpts_by_city[eqpt.from_city].append(eqpt)
|
||||
@@ -475,7 +518,7 @@ def xls_to_json_data(input_filename, filter_region=[]):
|
||||
'longitude': x.longitude}},
|
||||
'type': 'Edfa',
|
||||
'operational': {'gain_target': None,
|
||||
'tilt_target': 0}
|
||||
'tilt_target': None}
|
||||
} for x in nodes_by_city.values() if x.node_type.lower() == 'ila' and x.city not in eqpts_by_city] +
|
||||
[{'uid': f'east edfa in {x.city}',
|
||||
'metadata': {'location': {'city': x.city,
|
||||
@@ -484,25 +527,26 @@ def xls_to_json_data(input_filename, filter_region=[]):
|
||||
'longitude': x.longitude}},
|
||||
'type': 'Edfa',
|
||||
'operational': {'gain_target': None,
|
||||
'tilt_target': 0}
|
||||
} for x in nodes_by_city.values() if x.node_type.lower() == 'ila' and x.city not in eqpts_by_city] +
|
||||
[create_east_eqpt_element(e) for e in eqpts] +
|
||||
[create_west_eqpt_element(e) for e in eqpts],
|
||||
'tilt_target': None}
|
||||
} for x in nodes_by_city.values() if x.node_type.lower() == 'ila' and x.city not in eqpts_by_city]
|
||||
+ [create_east_eqpt_element(e, nodes_by_city) for e in eqpts]
|
||||
+ [create_west_eqpt_element(e, nodes_by_city) for e in eqpts],
|
||||
'connections':
|
||||
list(chain.from_iterable([eqpt_connection_by_city(n.city)
|
||||
list(chain.from_iterable([eqpt_connection_by_city(n.city, eqpts_by_city, links_by_city, nodes_by_city)
|
||||
for n in nodes]))
|
||||
+
|
||||
list(chain.from_iterable(zip(
|
||||
[{'from_node': f'trx {x.city}',
|
||||
'to_node': f'roadm {x.city}'}
|
||||
+ list(chain.from_iterable(zip(
|
||||
[{'from_node': f'trx {x.city}', 'to_node': f'roadm {x.city}'}
|
||||
for x in nodes_by_city.values() if x.node_type.lower() == 'roadm'],
|
||||
[{'from_node': f'roadm {x.city}',
|
||||
'to_node': f'trx {x.city}'}
|
||||
[{'from_node': f'roadm {x.city}', 'to_node': f'trx {x.city}'}
|
||||
for x in nodes_by_city.values() if x.node_type.lower() == 'roadm'])))
|
||||
}
|
||||
|
||||
|
||||
def convert_file(input_filename, filter_region=[], output_json_file_name=None):
|
||||
def convert_file(input_filename: Path, filter_region: List[str] = None, output_json_file_name: Path = None):
|
||||
"""Save the conversion into
|
||||
"""
|
||||
if filter_region is None:
|
||||
filter_region = []
|
||||
data = xls_to_json_data(input_filename, filter_region)
|
||||
if output_json_file_name is None:
|
||||
output_json_file_name = input_filename.with_suffix('.json')
|
||||
@@ -512,79 +556,77 @@ def convert_file(input_filename, filter_region=[], output_json_file_name=None):
|
||||
return output_json_file_name
|
||||
|
||||
|
||||
def corresp_names(input_filename, network):
|
||||
def corresp_names(input_filename: Path, network: DiGraph):
|
||||
""" a function that builds the correspondance between names given in the excel,
|
||||
and names used in the json, and created by the autodesign.
|
||||
All names are listed
|
||||
"""
|
||||
nodes, links, eqpts, roadms = parse_excel(input_filename)
|
||||
nodes, links, eqpts, _ = parse_excel(input_filename)
|
||||
fused = [n.uid for n in network.nodes() if isinstance(n, Fused)]
|
||||
ila = [n.uid for n in network.nodes() if isinstance(n, Edfa)]
|
||||
|
||||
corresp_roadm = {x.city: [f'roadm {x.city}'] for x in nodes
|
||||
if x.node_type.lower() == 'roadm'}
|
||||
corresp_fused = {x.city: [f'west fused spans in {x.city}', f'east fused spans in {x.city}']
|
||||
for x in nodes if x.node_type.lower() == 'fused' and
|
||||
f'west fused spans in {x.city}' in fused and
|
||||
f'east fused spans in {x.city}' in fused}
|
||||
|
||||
for x in nodes if x.node_type.lower() == 'fused'
|
||||
and f'west fused spans in {x.city}' in fused
|
||||
and f'east fused spans in {x.city}' in fused}
|
||||
corresp_ila = defaultdict(list)
|
||||
# add the special cases when an ila is changed into a fused
|
||||
for my_e in eqpts:
|
||||
name = f'east edfa in {my_e.from_city} to {my_e.to_city}'
|
||||
if my_e.east_amp_type.lower() == 'fused' and name in fused:
|
||||
if my_e.from_city in corresp_fused.keys():
|
||||
corresp_fused[my_e.from_city].append(name)
|
||||
else:
|
||||
corresp_fused[my_e.from_city] = [name]
|
||||
corresp_fused.get(my_e.from_city, []).append(name)
|
||||
name = f'west edfa in {my_e.from_city} to {my_e.to_city}'
|
||||
if my_e.west_amp_type.lower() == 'fused' and name in fused:
|
||||
if my_e.from_city in corresp_fused.keys():
|
||||
corresp_fused[my_e.from_city].append(name)
|
||||
else:
|
||||
corresp_fused[my_e.from_city] = [name]
|
||||
corresp_fused.get(my_e.from_city, []).append(name)
|
||||
# build corresp ila based on eqpt sheet
|
||||
# start with east direction
|
||||
corresp_ila = {e.from_city: [f'east edfa in {e.from_city} to {e.to_city}']
|
||||
for e in eqpts if f'east edfa in {e.from_city} to {e.to_city}' in ila}
|
||||
# west direction, append name or create a new item in dict
|
||||
for my_e in eqpts:
|
||||
name = f'west edfa in {my_e.from_city} to {my_e.to_city}'
|
||||
for name in [f'east edfa in {my_e.from_city} to {my_e.to_city}',
|
||||
f'west edfa in {my_e.from_city} to {my_e.to_city}']:
|
||||
if name in ila:
|
||||
if my_e.from_city in corresp_ila.keys():
|
||||
corresp_ila[my_e.from_city].append(name)
|
||||
else:
|
||||
corresp_ila[my_e.from_city] = [name]
|
||||
# complete with potential autodesign names: amplifiers
|
||||
for my_l in links:
|
||||
name = f'Edfa0_fiber ({my_l.to_city} \u2192 {my_l.from_city})-{my_l.west_cable}'
|
||||
# create names whatever the type and filter them out
|
||||
# from-to direction
|
||||
names = [f'Edfa_preamp_roadm {my_l.from_city}_from_fiber ({my_l.to_city} \u2192 {my_l.from_city})-{my_l.west_cable}',
|
||||
f'Edfa_booster_roadm {my_l.from_city}_to_fiber ({my_l.from_city} \u2192 {my_l.to_city})-{my_l.east_cable}']
|
||||
for name in names:
|
||||
if name in ila:
|
||||
if my_l.from_city in corresp_ila.keys():
|
||||
# "east edfa in Stbrieuc to Rennes_STA" is equivalent name as
|
||||
# "Edfa0_fiber (Lannion_CAS → Stbrieuc)-F056"
|
||||
# "Edfa_booster_roadm Stbrieuc_to_fiber (Lannion_CAS → Stbrieuc)-F056"
|
||||
# "west edfa in Stbrieuc to Rennes_STA" is equivalent name as
|
||||
# "Edfa0_fiber (Rennes_STA → Stbrieuc)-F057"
|
||||
# does not filter names: all types (except boosters) are created.
|
||||
# in case fibers are splitted the name here is a prefix
|
||||
# "Edfa_preamp_roadm Stbrieuc_to_fiber (Rennes_STA → Stbrieuc)-F057"
|
||||
# in case fibers are splitted the name here is a
|
||||
corresp_ila[my_l.from_city].append(name)
|
||||
else:
|
||||
corresp_ila[my_l.from_city] = [name]
|
||||
name = f'Edfa0_fiber ({my_l.from_city} \u2192 {my_l.to_city})-{my_l.east_cable}'
|
||||
# to-from direction
|
||||
names = [f'Edfa_preamp_roadm {my_l.to_city}_from_fiber ({my_l.from_city} \u2192 {my_l.to_city})-{my_l.east_cable}',
|
||||
f'Edfa_booster_roadm {my_l.to_city}_to_fiber ({my_l.to_city} \u2192 {my_l.from_city})-{my_l.west_cable}']
|
||||
for name in names:
|
||||
if name in ila:
|
||||
if my_l.to_city in corresp_ila.keys():
|
||||
corresp_ila[my_l.to_city].append(name)
|
||||
else:
|
||||
corresp_ila[my_l.to_city] = [name]
|
||||
for node in nodes:
|
||||
names = [f'east edfa in {node.city}', f'west edfa in {node.city}']
|
||||
for name in names:
|
||||
if name in ila:
|
||||
# "east edfa in Stbrieuc to Rennes_STA" (created with Eqpt) is equivalent name as
|
||||
# "east edfa in Stbrieuc" or "west edfa in Stbrieuc" (created with Links sheet)
|
||||
# depending on link node order
|
||||
corresp_ila[node.city].append(name)
|
||||
|
||||
# merge fused with ila:
|
||||
for key, val in corresp_fused.items():
|
||||
if key in corresp_ila.keys():
|
||||
corresp_ila[key].extend(val)
|
||||
else:
|
||||
corresp_ila[key] = val
|
||||
# no need of roadm booster
|
||||
return corresp_roadm, corresp_fused, corresp_ila
|
||||
|
||||
|
||||
def parse_excel(input_filename):
|
||||
def parse_excel(input_filename: Path) -> Tuple[List[Node], List[Link], List[Eqpt], List[Roadm]]:
|
||||
"""reads xls(x) sheets among Nodes, Eqpts, Links, Roadms and parse the data in the sheets
|
||||
into internal data structure Node, Link, Eqpt, Roadm, classes
|
||||
"""
|
||||
link_headers = {
|
||||
'Node A': 'from_city',
|
||||
'Node Z': 'to_city',
|
||||
@@ -623,7 +665,6 @@ def parse_excel(input_filename):
|
||||
'Node Z': 'to_city',
|
||||
'east': {
|
||||
'amp type': 'east_amp_type',
|
||||
'att_in': 'east_att_in',
|
||||
'amp gain': 'east_amp_gain',
|
||||
'delta p': 'east_amp_dp',
|
||||
'tilt': 'east_tilt',
|
||||
@@ -631,7 +672,6 @@ def parse_excel(input_filename):
|
||||
},
|
||||
'west': {
|
||||
'amp type': 'west_amp_type',
|
||||
'att_in': 'west_att_in',
|
||||
'amp gain': 'west_amp_gain',
|
||||
'delta p': 'west_amp_dp',
|
||||
'tilt': 'west_tilt',
|
||||
@@ -640,7 +680,10 @@ def parse_excel(input_filename):
|
||||
}
|
||||
roadm_headers = {'Node A': 'from_node',
|
||||
'Node Z': 'to_node',
|
||||
'per degree target power (dBm)': 'target_pch_out_db'
|
||||
'per degree target power (dBm)': 'target_pch_out_db',
|
||||
'type_variety': 'type_variety',
|
||||
'from degrees': 'from_degrees',
|
||||
'from degree to degree impairment id': 'impairment_ids'
|
||||
}
|
||||
|
||||
with open_workbook(input_filename) as wb:
|
||||
@@ -648,36 +691,32 @@ def parse_excel(input_filename):
|
||||
links_sheet = wb.sheet_by_name('Links')
|
||||
try:
|
||||
eqpt_sheet = wb.sheet_by_name('Eqpt')
|
||||
except Exception:
|
||||
except XLRDError:
|
||||
# eqpt_sheet is optional
|
||||
eqpt_sheet = None
|
||||
try:
|
||||
roadm_sheet = wb.sheet_by_name('Roadms')
|
||||
except Exception:
|
||||
except XLRDError:
|
||||
# roadm_sheet is optional
|
||||
roadm_sheet = None
|
||||
|
||||
nodes = []
|
||||
for node in parse_sheet(nodes_sheet, node_headers, NODES_LINE, NODES_LINE + 1, NODES_COLUMN):
|
||||
nodes.append(Node(**node))
|
||||
nodes = [Node(**node) for node in parse_sheet(nodes_sheet, node_headers,
|
||||
NODES_LINE, NODES_LINE + 1, NODES_COLUMN)]
|
||||
expected_node_types = {'ROADM', 'ILA', 'FUSED'}
|
||||
for n in nodes:
|
||||
if n.node_type not in expected_node_types:
|
||||
n.node_type = 'ILA'
|
||||
|
||||
links = []
|
||||
for link in parse_sheet(links_sheet, link_headers, LINKS_LINE, LINKS_LINE + 2, LINKS_COLUMN):
|
||||
links.append(Link(**link))
|
||||
|
||||
links = [Link(**link) for link in parse_sheet(links_sheet, link_headers,
|
||||
LINKS_LINE, LINKS_LINE + 2, LINKS_COLUMN)]
|
||||
eqpts = []
|
||||
if eqpt_sheet is not None:
|
||||
for eqpt in parse_sheet(eqpt_sheet, eqpt_headers, EQPTS_LINE, EQPTS_LINE + 2, EQPTS_COLUMN):
|
||||
eqpts.append(Eqpt(**eqpt))
|
||||
|
||||
eqpts = [Eqpt(**eqpt) for eqpt in parse_sheet(eqpt_sheet, eqpt_headers,
|
||||
EQPTS_LINE, EQPTS_LINE + 2, EQPTS_COLUMN)]
|
||||
roadms = []
|
||||
if roadm_sheet is not None:
|
||||
for roadm in parse_sheet(roadm_sheet, roadm_headers, ROADMS_LINE, ROADMS_LINE+2, ROADMS_COLUMN):
|
||||
roadms.append(Roadm(**roadm))
|
||||
roadms = [Roadm(**roadm) for roadm in parse_sheet(roadm_sheet, roadm_headers,
|
||||
ROADMS_LINE, ROADMS_LINE + 2, ROADMS_COLUMN)]
|
||||
|
||||
# sanity check
|
||||
all_cities = Counter(n.city for n in nodes)
|
||||
@@ -699,32 +738,37 @@ def parse_excel(input_filename):
|
||||
return nodes, links, eqpts, roadms
|
||||
|
||||
|
||||
def eqpt_connection_by_city(city_name):
|
||||
other_cities = fiber_dest_from_source(city_name)
|
||||
def eqpt_connection_by_city(city_name: str, eqpts_by_city: DefaultDict[str, List[Eqpt]],
|
||||
links_by_city: DefaultDict[str, List[Link]], nodes_by_city: Dict[str, Node]) -> list:
|
||||
"""
|
||||
"""
|
||||
other_cities = fiber_dest_from_source(city_name, links_by_city)
|
||||
subdata = []
|
||||
if nodes_by_city[city_name].node_type.lower() in {'ila', 'fused'}:
|
||||
# Then len(other_cities) == 2
|
||||
direction = ['west', 'east']
|
||||
for i in range(2):
|
||||
from_ = fiber_link(other_cities[i], city_name)
|
||||
in_ = eqpt_in_city_to_city(city_name, other_cities[0], direction[i])
|
||||
to_ = fiber_link(city_name, other_cities[1 - i])
|
||||
from_ = fiber_link(other_cities[i], city_name, links_by_city)
|
||||
in_ = eqpt_in_city_to_city(city_name, other_cities[0], eqpts_by_city, nodes_by_city, direction[i])
|
||||
to_ = fiber_link(city_name, other_cities[1 - i], links_by_city)
|
||||
subdata += connect_eqpt(from_, in_, to_)
|
||||
elif nodes_by_city[city_name].node_type.lower() == 'roadm':
|
||||
for other_city in other_cities:
|
||||
from_ = f'roadm {city_name}'
|
||||
in_ = eqpt_in_city_to_city(city_name, other_city)
|
||||
to_ = fiber_link(city_name, other_city)
|
||||
in_ = eqpt_in_city_to_city(city_name, other_city, eqpts_by_city, nodes_by_city)
|
||||
to_ = fiber_link(city_name, other_city, links_by_city)
|
||||
subdata += connect_eqpt(from_, in_, to_)
|
||||
|
||||
from_ = fiber_link(other_city, city_name)
|
||||
in_ = eqpt_in_city_to_city(city_name, other_city, "west")
|
||||
from_ = fiber_link(other_city, city_name, links_by_city)
|
||||
in_ = eqpt_in_city_to_city(city_name, other_city, eqpts_by_city, nodes_by_city, "west")
|
||||
to_ = f'roadm {city_name}'
|
||||
subdata += connect_eqpt(from_, in_, to_)
|
||||
return subdata
|
||||
|
||||
|
||||
def connect_eqpt(from_, in_, to_):
|
||||
def connect_eqpt(from_: str, in_: str, to_: str) -> List[dict]:
|
||||
"""Utils: create the topology connection json dict between in and to
|
||||
"""
|
||||
connections = []
|
||||
if in_ != '':
|
||||
connections = [{'from_node': from_, 'to_node': in_},
|
||||
@@ -734,7 +778,11 @@ def connect_eqpt(from_, in_, to_):
|
||||
return connections
|
||||
|
||||
|
||||
def eqpt_in_city_to_city(in_city, to_city, direction='east'):
|
||||
def eqpt_in_city_to_city(in_city: str, to_city: str,
|
||||
eqpts_by_city: DefaultDict[str, List[Eqpt]], nodes_by_city: Dict[str, Node],
|
||||
direction: str = 'east') -> str:
|
||||
"""Utils: returns the formatted dtring corresponding to in_city types and direction
|
||||
"""
|
||||
rev_direction = 'west' if direction == 'east' else 'east'
|
||||
return_eqpt = ''
|
||||
if in_city in eqpts_by_city:
|
||||
@@ -753,22 +801,25 @@ def eqpt_in_city_to_city(in_city, to_city, direction='east'):
|
||||
return return_eqpt
|
||||
|
||||
|
||||
def corresp_next_node(network, corresp_ila, corresp_roadm):
|
||||
def corresp_next_node(network: DiGraph, corresp_ila: dict, corresp_roadm: dict) -> Tuple[dict, dict]:
|
||||
""" for each name in corresp dictionnaries find the next node in network and its name
|
||||
given by user in excel. for meshTopology_exampleV2.xls:
|
||||
user ILA name Stbrieuc covers the two direction. convert.py creates 2 different ILA
|
||||
with possible names (depending on the direction and if the eqpt was defined in eqpt
|
||||
sheet)
|
||||
for an ILA and if it is defined in eqpt:
|
||||
- east edfa in Stbrieuc to Rennes_STA
|
||||
- west edfa in Stbrieuc to Rennes_STA
|
||||
- Edfa0_fiber (Lannion_CAS → Stbrieuc)-F056
|
||||
- Edfa0_fiber (Rennes_STA → Stbrieuc)-F057
|
||||
for an ILA and if it is not defined in eqpt:
|
||||
- east edfa in Stbrieuc
|
||||
- west edfa in Stbrieuc
|
||||
for a roadm
|
||||
"Edfa_preamp_roadm node1_from_fiber (siteE → node1)-CABLES#19"
|
||||
"Edfa_booster_roadm node1_to_fiber (node1 → siteE)-CABLES#19"
|
||||
next_nodes finds the user defined name of next node to be able to map the path constraints
|
||||
- east edfa in Stbrieuc to Rennes_STA next node = Rennes_STA
|
||||
- west edfa in Stbrieuc to Rennes_STA next node Lannion_CAS
|
||||
|
||||
Edfa0_fiber (Lannion_CAS → Stbrieuc)-F056 and Edfa0_fiber (Rennes_STA → Stbrieuc)-F057
|
||||
do not exist
|
||||
the function supports fiber splitting, fused nodes and shall only be called if
|
||||
excel format is used for both network and service
|
||||
"""
|
||||
@@ -779,8 +830,8 @@ def corresp_next_node(network, corresp_ila, corresp_roadm):
|
||||
for ila_elem in ila_list:
|
||||
# find the node with ila_elem string _in_ the node uid. 'in' is used instead of
|
||||
# '==' to find composed nodes due to fiber splitting in autodesign.
|
||||
# eg if elem_ila is 'Edfa0_fiber (Lannion_CAS → Stbrieuc)-F056',
|
||||
# node uid 'Edfa0_fiber (Lannion_CAS → Stbrieuc)-F056_(1/2)' is possible
|
||||
# eg if elem_ila is 'east edfa in Stbrieuc to Rennes_STA',
|
||||
# node uid 'east edfa in Stbrieuc to Rennes_STA-_(1/2)' is possible
|
||||
correct_ila_name = next(n.uid for n in network.nodes() if ila_elem in n.uid)
|
||||
temp.remove(ila_elem)
|
||||
temp.append(correct_ila_name)
|
||||
@@ -797,7 +848,7 @@ def corresp_next_node(network, corresp_ila, corresp_roadm):
|
||||
break
|
||||
# if next_nd was not already added in the dict with the previous loop,
|
||||
# add the first found correspondance in ila names
|
||||
if correct_ila_name not in next_node.keys():
|
||||
if correct_ila_name not in next_node:
|
||||
for key, val in corresp_ila.items():
|
||||
# in case of splitted fibers the ila name might not be exact match
|
||||
if [e for e in val if e in next_nd.uid]:
|
||||
@@ -808,7 +859,9 @@ def corresp_next_node(network, corresp_ila, corresp_roadm):
|
||||
return corresp_ila, next_node
|
||||
|
||||
|
||||
def fiber_dest_from_source(city_name):
|
||||
def fiber_dest_from_source(city_name: str, links_by_city: DefaultDict[str, List[Link]]) -> List[str]:
|
||||
"""Returns the list of cities city_name is connected to
|
||||
"""
|
||||
destinations = []
|
||||
links_from_city = links_by_city[city_name]
|
||||
for l in links_from_city:
|
||||
@@ -819,7 +872,9 @@ def fiber_dest_from_source(city_name):
|
||||
return destinations
|
||||
|
||||
|
||||
def fiber_link(from_city, to_city):
|
||||
def fiber_link(from_city: str, to_city: str, links_by_city: DefaultDict[str, List[Link]]) -> str:
|
||||
"""utils: returns formatted uid for fibers between from_city and to_city
|
||||
"""
|
||||
source_dest = (from_city, to_city)
|
||||
links = links_by_city[from_city]
|
||||
link = next(l for l in links if l.from_city in source_dest and l.to_city in source_dest)
|
||||
@@ -830,7 +885,9 @@ def fiber_link(from_city, to_city):
|
||||
return fiber
|
||||
|
||||
|
||||
def midpoint(city_a, city_b):
|
||||
def midpoint(city_a: Node, city_b:Node) -> dict:
|
||||
"""Computes mipoint coordinates
|
||||
"""
|
||||
lats = city_a.latitude, city_b.latitude
|
||||
longs = city_a.longitude, city_b.longitude
|
||||
try:
|
||||
@@ -855,10 +912,12 @@ LINKS_LINE = 3
|
||||
EQPTS_LINE = 3
|
||||
EQPTS_COLUMN = 14
|
||||
ROADMS_LINE = 3
|
||||
ROADMS_COLUMN = 3
|
||||
ROADMS_COLUMN = 6
|
||||
|
||||
|
||||
def _do_convert():
|
||||
"""Main function for xls(x) topology conversion to JSON format
|
||||
"""
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument('workbook', type=Path)
|
||||
parser.add_argument('-f', '--filter-region', action='append', default=[])
|
||||
|
||||
@@ -8,13 +8,15 @@ gnpy.tools.json_io
|
||||
Loading and saving data from JSON files in GNPy's internal data format
|
||||
"""
|
||||
|
||||
from networkx import DiGraph
|
||||
from logging import getLogger
|
||||
from pathlib import Path
|
||||
import json
|
||||
from collections import namedtuple
|
||||
from numpy import arange
|
||||
from copy import deepcopy
|
||||
from typing import Union, Dict, List, Tuple
|
||||
from networkx import DiGraph
|
||||
from numpy import arange
|
||||
|
||||
|
||||
from gnpy.core import elements
|
||||
from gnpy.core.equipment import trx_mode_params, find_type_variety
|
||||
@@ -22,8 +24,8 @@ from gnpy.core.exceptions import ConfigurationError, EquipmentConfigError, Netwo
|
||||
from gnpy.core.science_utils import estimate_nf_model
|
||||
from gnpy.core.info import Carrier
|
||||
from gnpy.core.utils import automatic_nch, automatic_fmax, merge_amplifier_restrictions, dbm2watt
|
||||
from gnpy.core.parameters import DEFAULT_RAMAN_COEFFICIENT, EdfaParams, MultiBandParams
|
||||
from gnpy.topology.request import PathRequest, Disjunction, compute_spectrum_slot_vs_bandwidth
|
||||
from gnpy.core.parameters import DEFAULT_RAMAN_COEFFICIENT, EdfaParams, MultiBandParams, DEFAULT_EDFA_CONFIG
|
||||
from gnpy.topology.request import PathRequest, Disjunction, compute_spectrum_slot_vs_bandwidth, ResultElement
|
||||
from gnpy.topology.spectrum_assignment import mvalue_to_slots
|
||||
from gnpy.tools.convert import xls_to_json_data
|
||||
from gnpy.tools.service_sheet import read_service_sheet
|
||||
@@ -37,18 +39,28 @@ Model_fg = namedtuple('Model_fg', 'nf0')
|
||||
Model_openroadm_ila = namedtuple('Model_openroadm_ila', 'nf_coef')
|
||||
Model_hybrid = namedtuple('Model_hybrid', 'nf_ram gain_ram edfa_variety')
|
||||
Model_dual_stage = namedtuple('Model_dual_stage', 'preamp_variety booster_variety')
|
||||
_examples_dir = Path(__file__).parent.parent / 'example-data'
|
||||
DEFAULT_EXTRA_CONFIG = {"std_medium_gain_advanced_config.json": _examples_dir / "std_medium_gain_advanced_config.json",
|
||||
"Juniper-BoosterHG.json": _examples_dir / "Juniper-BoosterHG.json"}
|
||||
DEFAULT_EQPT_CONFIG = _examples_dir / "eqpt_config.json"
|
||||
|
||||
|
||||
class Model_openroadm_preamp:
|
||||
pass
|
||||
"""class to hold nf model specific to OpenROADM preamp
|
||||
"""
|
||||
|
||||
|
||||
class Model_openroadm_booster:
|
||||
pass
|
||||
"""class to hold nf model specific to OpenROADM booster
|
||||
"""
|
||||
|
||||
|
||||
class _JsonThing:
|
||||
"""Base class for json equipment
|
||||
"""
|
||||
def update_attr(self, default_values, kwargs, name):
|
||||
"""Build the attributes based on kwargs dict
|
||||
"""
|
||||
clean_kwargs = {k: v for k, v in kwargs.items() if v != ''}
|
||||
for k, v in default_values.items():
|
||||
setattr(self, k, clean_kwargs.get(k, v))
|
||||
@@ -60,6 +72,8 @@ class _JsonThing:
|
||||
|
||||
|
||||
class SI(_JsonThing):
|
||||
"""Spectrum Information
|
||||
"""
|
||||
default_values = {
|
||||
"f_min": 191.35e12,
|
||||
"f_max": 196.1e12,
|
||||
@@ -78,6 +92,8 @@ class SI(_JsonThing):
|
||||
|
||||
|
||||
class Span(_JsonThing):
|
||||
"""Span simulations definition
|
||||
"""
|
||||
default_values = {
|
||||
'power_mode': True,
|
||||
'delta_power_range_db': None,
|
||||
@@ -97,6 +113,8 @@ class Span(_JsonThing):
|
||||
|
||||
|
||||
class Roadm(_JsonThing):
|
||||
"""List of ROADM and their specs
|
||||
"""
|
||||
default_values = {
|
||||
'type_variety': 'default',
|
||||
'add_drop_osnr': 100,
|
||||
@@ -129,6 +147,8 @@ class Roadm(_JsonThing):
|
||||
|
||||
|
||||
class Transceiver(_JsonThing):
|
||||
"""List of transceivers and their modes
|
||||
"""
|
||||
default_values = {
|
||||
'type_variety': None,
|
||||
'frequency': None,
|
||||
@@ -161,6 +181,8 @@ class Transceiver(_JsonThing):
|
||||
|
||||
|
||||
class Fiber(_JsonThing):
|
||||
"""Fiber default settings
|
||||
"""
|
||||
default_values = {
|
||||
'type_variety': '',
|
||||
'dispersion': None,
|
||||
@@ -181,19 +203,26 @@ class Fiber(_JsonThing):
|
||||
|
||||
|
||||
class RamanFiber(Fiber):
|
||||
pass
|
||||
"""Raman Fiber default settings
|
||||
"""
|
||||
|
||||
|
||||
class Amp(_JsonThing):
|
||||
"""List of amplifiers with their specs
|
||||
"""
|
||||
default_values = EdfaParams.default_values
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.update_attr(self.default_values, kwargs, 'Amp')
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, filename, **kwargs):
|
||||
config = Path(filename).parent / 'default_edfa_config.json'
|
||||
# default_edfa_config.json assumes a DGT profile independantly from fmin/fmax, that's a generic profile
|
||||
def from_json(cls, extra_configs, **kwargs):
|
||||
"""
|
||||
"""
|
||||
# default EDFA DGT and ripples are defined in parameters DEFAULT_EDFA_CONFIG. copy these values when
|
||||
# creating a new amplifier
|
||||
config = {k: v for k, v in DEFAULT_EDFA_CONFIG.items()}
|
||||
config_filename = 'default' # default value to display in case of error
|
||||
type_variety = kwargs['type_variety']
|
||||
type_def = kwargs.get('type_def', 'variable_gain') # default compatibility with older json eqpt files
|
||||
nf_def = None
|
||||
@@ -201,11 +230,15 @@ class Amp(_JsonThing):
|
||||
amplifiers = None
|
||||
|
||||
if type_def == 'fixed_gain':
|
||||
if 'default_config_from_json' in kwargs:
|
||||
# use user defined default instead of DEFAULT_EDFA_CONFIG
|
||||
config_filename = extra_configs[kwargs.pop('default_config_from_json')]
|
||||
config = load_json(config_filename)
|
||||
try:
|
||||
nf0 = kwargs.pop('nf0')
|
||||
except KeyError: # nf0 is expected for a fixed gain amp
|
||||
except KeyError as exc: # nf0 is expected for a fixed gain amp
|
||||
msg = f'missing nf0 value input for amplifier: {type_variety} in equipment config'
|
||||
raise EquipmentConfigError(msg)
|
||||
raise EquipmentConfigError(msg) from exc
|
||||
for k in ('nf_min', 'nf_max'):
|
||||
try:
|
||||
del kwargs[k]
|
||||
@@ -213,15 +246,21 @@ class Amp(_JsonThing):
|
||||
pass
|
||||
nf_def = Model_fg(nf0)
|
||||
elif type_def == 'advanced_model':
|
||||
config = Path(filename).parent / kwargs.pop('advanced_config_from_json')
|
||||
# use the user file name define in library instead of default config
|
||||
config_filename = extra_configs[kwargs.pop('advanced_config_from_json')]
|
||||
config = load_json(config_filename)
|
||||
elif type_def == 'variable_gain':
|
||||
if 'default_config_from_json' in kwargs:
|
||||
# use user defined default instead of DEFAULT_EDFA_CONFIG
|
||||
config_filename = extra_configs[kwargs.pop('default_config_from_json')]
|
||||
config = load_json(config_filename)
|
||||
gain_min, gain_max = kwargs['gain_min'], kwargs['gain_flatmax']
|
||||
try: # nf_min and nf_max are expected for a variable gain amp
|
||||
nf_min = kwargs.pop('nf_min')
|
||||
nf_max = kwargs.pop('nf_max')
|
||||
except KeyError:
|
||||
except KeyError as exc:
|
||||
msg = f'missing nf_min or nf_max value input for amplifier: {type_variety} in equipment config'
|
||||
raise EquipmentConfigError(msg)
|
||||
raise EquipmentConfigError(msg) from exc
|
||||
try: # remove all remaining nf inputs
|
||||
del kwargs['nf0']
|
||||
except KeyError:
|
||||
@@ -231,8 +270,8 @@ class Amp(_JsonThing):
|
||||
elif type_def == 'openroadm':
|
||||
try:
|
||||
nf_coef = kwargs.pop('nf_coef')
|
||||
except KeyError: # nf_coef is expected for openroadm amp
|
||||
raise EquipmentConfigError(f'missing nf_coef input for amplifier: {type_variety} in equipment config')
|
||||
except KeyError as exc: # nf_coef is expected for openroadm amp
|
||||
raise EquipmentConfigError(f'missing nf_coef input for amplifier: {type_variety} in equipment config') from exc
|
||||
nf_def = Model_openroadm_ila(nf_coef)
|
||||
elif type_def == 'openroadm_preamp':
|
||||
nf_def = Model_openroadm_preamp()
|
||||
@@ -242,37 +281,28 @@ class Amp(_JsonThing):
|
||||
try: # nf_ram and gain_ram are expected for a hybrid amp
|
||||
preamp_variety = kwargs.pop('preamp_variety')
|
||||
booster_variety = kwargs.pop('booster_variety')
|
||||
except KeyError:
|
||||
except KeyError as exc:
|
||||
raise EquipmentConfigError(f'missing preamp/booster variety input for amplifier: {type_variety}'
|
||||
+ ' in equipment config')
|
||||
+ ' in equipment config') from exc
|
||||
dual_stage_def = Model_dual_stage(preamp_variety, booster_variety)
|
||||
elif type_def == 'multi_band':
|
||||
amplifiers = kwargs['amplifiers']
|
||||
else:
|
||||
raise EquipmentConfigError(f'Edfa type_def {type_def} does not exist')
|
||||
|
||||
json_data = load_json(config)
|
||||
# raise an error if config does not contain f_min, f_max
|
||||
if 'f_min' not in json_data or 'f_max' not in json_data:
|
||||
raise EquipmentConfigError('default Edfa config does not contain f_min and f_max values.'
|
||||
if 'f_min' not in config or 'f_max' not in config:
|
||||
raise EquipmentConfigError(f'Config file {config_filename} does not contain f_min and f_max values.'
|
||||
+ ' Please correct file.')
|
||||
# use f_min, f_max from kwargs
|
||||
if 'f_min' in kwargs:
|
||||
json_data.pop('f_min', None)
|
||||
json_data.pop('f_max', None)
|
||||
return cls(**{**kwargs, **json_data,
|
||||
config.pop('f_min', None)
|
||||
config.pop('f_max', None)
|
||||
return cls(**{**kwargs, **config,
|
||||
'nf_model': nf_def, 'dual_stage_model': dual_stage_def, 'multi_band': amplifiers})
|
||||
|
||||
|
||||
def _automatic_spacing(baud_rate):
|
||||
"""return the min possible channel spacing for a given baud rate"""
|
||||
# TODO : this should parametrized in a cfg file
|
||||
# list of possible tuples [(max_baud_rate, spacing_for_this_baud_rate)]
|
||||
spacing_list = [(33e9, 37.5e9), (38e9, 50e9), (50e9, 62.5e9), (67e9, 75e9), (92e9, 100e9)]
|
||||
return min((s[1] for s in spacing_list if s[0] > baud_rate), default=baud_rate * 1.2)
|
||||
|
||||
|
||||
def _spectrum_from_json(json_data):
|
||||
def _spectrum_from_json(json_data: dict):
|
||||
"""JSON_data is a list of spectrum partitions each with
|
||||
{f_min, f_max, baud_rate, roll_off, delta_pdb, slot_width, tx_osnr, label}
|
||||
Creates the per freq Carrier's dict.
|
||||
@@ -314,17 +344,13 @@ def _spectrum_from_json(json_data):
|
||||
previous_part_max_freq = 0.0
|
||||
for index, part in enumerate(json_data):
|
||||
# default delta_pdb is 0 dB
|
||||
if 'delta_pdb' not in part:
|
||||
part['delta_pdb'] = 0
|
||||
part.setdefault('delta_pdb', 0)
|
||||
# add a label to the partition for the printings
|
||||
if 'label' not in part:
|
||||
part['label'] = f'{index}-{part["baud_rate"] * 1e-9 :.2f}G'
|
||||
part.setdefault('label', f'{index}-{part["baud_rate"] * 1e-9:.2f}G')
|
||||
# default tx_osnr is set to 40 dB
|
||||
if 'tx_osnr' not in part:
|
||||
part['tx_osnr'] = 40
|
||||
part.setdefault('tx_osnr', 40)
|
||||
# default tx_power_dbm is set to 0 dBn
|
||||
if 'tx_power_dbm' not in part:
|
||||
part['tx_power_dbm'] = 0
|
||||
part.setdefault('tx_power_dbm', 0)
|
||||
# starting freq is exactly f_min to be consistent with utils.automatic_nch
|
||||
# first partition min occupation is f_min - slot_width / 2 (central_frequency is f_min)
|
||||
# supposes that carriers are centered on frequency
|
||||
@@ -332,12 +358,13 @@ def _spectrum_from_json(json_data):
|
||||
# check that previous part last channel does not overlap on next part first channel
|
||||
# max center of the part should be below part['f_max'] and aligned on the slot_width
|
||||
msg = 'Not a valid initial spectrum definition:\nprevious spectrum last carrier max occupation ' +\
|
||||
f'{previous_part_max_freq * 1e-12 :.5f}GHz ' +\
|
||||
f'{previous_part_max_freq * 1e-12:.5f}GHz ' +\
|
||||
'overlaps on next spectrum first carrier occupation ' +\
|
||||
f'{(part["f_min"] - part["slot_width"] / 2) * 1e-12 :.5f}GHz'
|
||||
f'{(part["f_min"] - part["slot_width"] / 2) * 1e-12:.5f}GHz'
|
||||
raise ValueError(msg)
|
||||
|
||||
max_range = ((part['f_max'] - part['f_min']) // part['slot_width'] + 1) * part['slot_width']
|
||||
previous_part_max_freq = None
|
||||
for current_freq in arange(part['f_min'],
|
||||
part['f_min'] + max_range,
|
||||
part['slot_width']):
|
||||
@@ -349,17 +376,77 @@ def _spectrum_from_json(json_data):
|
||||
return spectrum
|
||||
|
||||
|
||||
def load_equipment(filename):
|
||||
def merge_equipment(equipment: dict, additional_filenames: List[Path], extra_configs: Dict[str, Path]):
|
||||
"""Merge additional equipment libraries into the base equipment dictionary.
|
||||
Typical case is the use of third party transceivers which are not part of a the supplier library.
|
||||
|
||||
raise warnings if the same reference is used on two different libraries
|
||||
"""
|
||||
for filename in additional_filenames:
|
||||
extra_eqpt = load_equipment(filename, extra_configs)
|
||||
# populate with default eqpt to streamline loading
|
||||
for eqpt_type, extra_items in extra_eqpt.items():
|
||||
for type_variety, item in extra_items.items():
|
||||
if type_variety not in equipment[eqpt_type]:
|
||||
equipment[eqpt_type][type_variety] = item
|
||||
else:
|
||||
msg = f'\n\tEquipment file {filename.name}: duplicate equipment entry found: {eqpt_type}-{type_variety}\n'
|
||||
_logger.warning(msg)
|
||||
|
||||
|
||||
def load_equipments_and_configs(equipment_filename: Path,
|
||||
extra_equipment_filenames: List[Path],
|
||||
extra_config_filenames: List[Path]) -> dict:
|
||||
"""Loads equipment configurations and merge with additional equipment and configuration files.
|
||||
|
||||
Args:
|
||||
equipment_filename (Path): The path to the primary equipment configuration file.
|
||||
extra_equipment_filenames (List[Path]): A list of paths to additional equipment configuration files to merge.
|
||||
extra_config_filenames (List[Path]): A list of paths to additional configuration files to include.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing the loaded equipment configurations.
|
||||
|
||||
Notes:
|
||||
If no equipment filename is provided, a default equipment configuration will be used.
|
||||
Additional configurations from `extra_config_filenames` will override the default configurations.
|
||||
If `extra_equipment_filenames` are provided, their contents will be merged into the loaded equipment.
|
||||
"""
|
||||
extra_configs = DEFAULT_EXTRA_CONFIG
|
||||
if not equipment_filename:
|
||||
equipment_filename = DEFAULT_EQPT_CONFIG
|
||||
if extra_config_filenames:
|
||||
extra_configs = {f.name: f for f in extra_config_filenames}
|
||||
for k, v in DEFAULT_EXTRA_CONFIG.items():
|
||||
extra_configs[k] = v
|
||||
equipment = load_equipment(equipment_filename, extra_configs)
|
||||
if extra_equipment_filenames:
|
||||
merge_equipment(equipment, extra_equipment_filenames, extra_configs)
|
||||
return equipment
|
||||
|
||||
|
||||
def load_equipment(filename: Path, extra_configs: Dict[str, Path] = DEFAULT_EXTRA_CONFIG) -> dict:
|
||||
"""Load equipment, returns equipment dict
|
||||
"""
|
||||
json_data = load_json(filename)
|
||||
return _equipment_from_json(json_data, filename)
|
||||
return _equipment_from_json(json_data, extra_configs)
|
||||
|
||||
|
||||
def load_initial_spectrum(filename):
|
||||
def load_initial_spectrum(filename: Path) -> dict:
|
||||
"""Load spectrum to propagate, returns spectrum dict
|
||||
"""
|
||||
json_data = load_json(filename)
|
||||
return _spectrum_from_json(json_data['spectrum'])
|
||||
|
||||
|
||||
def _update_dual_stage(equipment):
|
||||
def _update_dual_stage(equipment: dict):
|
||||
"""Update attributes of all dual stage amps with the preamp and booster attributes
|
||||
(defined in the equipment dictionary)
|
||||
|
||||
Returns the updated equiment dictionary
|
||||
"""
|
||||
if 'Edfa' not in equipment:
|
||||
return
|
||||
edfa_dict = equipment['Edfa']
|
||||
for edfa in edfa_dict.values():
|
||||
if edfa.type_def == 'dual_stage':
|
||||
@@ -378,9 +465,11 @@ def _update_dual_stage(equipment):
|
||||
return equipment
|
||||
|
||||
|
||||
def _update_band(equipment: dict) -> dict:
|
||||
def _update_band(equipment: dict):
|
||||
"""Creates a list of bands for this amplifier, and remove other parameters which are not applicable
|
||||
"""
|
||||
if 'Edfa' not in equipment:
|
||||
return
|
||||
amp_dict = equipment['Edfa']
|
||||
for amplifier in amp_dict.values():
|
||||
if amplifier.type_def != 'multi_band':
|
||||
@@ -400,11 +489,11 @@ def _update_band(equipment: dict) -> dict:
|
||||
'nf_fit_coeff', 'nf_ripple', 'dgt', 'gain_ripple']:
|
||||
delattr(amplifier, key)
|
||||
|
||||
return equipment
|
||||
|
||||
|
||||
def _roadm_restrictions_sanity_check(equipment):
|
||||
def _roadm_restrictions_sanity_check(equipment: dict):
|
||||
"""verifies that booster and preamp restrictions specified in roadm equipment are listed in the edfa."""
|
||||
if 'Roadm' not in equipment:
|
||||
return equipment
|
||||
for roadm_type, roadm_eqpt in equipment['Roadm'].items():
|
||||
restrictions = roadm_eqpt.restrictions['booster_variety_list'] + \
|
||||
roadm_eqpt.restrictions['preamp_variety_list']
|
||||
@@ -414,7 +503,7 @@ def _roadm_restrictions_sanity_check(equipment):
|
||||
+ 'defined EDFA name')
|
||||
|
||||
|
||||
def _check_fiber_vs_raman_fiber(equipment):
|
||||
def _check_fiber_vs_raman_fiber(equipment: dict):
|
||||
"""Ensure that Fiber and RamanFiber with the same name define common properties equally"""
|
||||
if 'RamanFiber' not in equipment:
|
||||
return
|
||||
@@ -429,7 +518,20 @@ def _check_fiber_vs_raman_fiber(equipment):
|
||||
f'disagrees for "{attr}": {a} != {b}')
|
||||
|
||||
|
||||
def _equipment_from_json(json_data, filename):
|
||||
def _si_sanity_check(equipment):
|
||||
"""Check that 'default' key correctly exists in SI list. (There must be at list one element and it must be default)
|
||||
If not create one entry in the list with this key.
|
||||
"""
|
||||
if 'SI' not in equipment:
|
||||
return
|
||||
possible_SI = list(equipment['SI'].keys())
|
||||
if 'default' not in possible_SI:
|
||||
# Use "default" key in the equipment, using the first listed keys
|
||||
equipment['SI']['default'] = equipment['SI'][possible_SI[0]]
|
||||
del equipment['SI'][possible_SI[0]]
|
||||
|
||||
|
||||
def _equipment_from_json(json_data: dict, extra_configs: Dict[str, Path]) -> dict:
|
||||
"""build global dictionnary eqpt_library that stores all eqpt characteristics:
|
||||
edfa type type_variety, fiber type_variety
|
||||
from the eqpt_config.json (filename parameter)
|
||||
@@ -444,7 +546,7 @@ def _equipment_from_json(json_data, filename):
|
||||
for entry in entries:
|
||||
subkey = entry.get('type_variety', 'default')
|
||||
if key == 'Edfa':
|
||||
equipment[key][subkey] = Amp.from_json(filename, **entry)
|
||||
equipment[key][subkey] = Amp.from_json(extra_configs, **entry)
|
||||
elif key == 'Fiber':
|
||||
equipment[key][subkey] = Fiber(**entry)
|
||||
elif key == 'Span':
|
||||
@@ -463,18 +565,19 @@ def _equipment_from_json(json_data, filename):
|
||||
else:
|
||||
raise EquipmentConfigError(f'Unrecognized network element type "{key}"')
|
||||
_check_fiber_vs_raman_fiber(equipment)
|
||||
equipment = _update_dual_stage(equipment)
|
||||
equipment = _update_band(equipment)
|
||||
_update_dual_stage(equipment)
|
||||
_update_band(equipment)
|
||||
_roadm_restrictions_sanity_check(equipment)
|
||||
possible_SI = list(equipment['SI'].keys())
|
||||
if 'default' not in possible_SI:
|
||||
# Use "default" key in the equipment, using the first listed keys
|
||||
equipment['SI']['default'] = equipment['SI'][possible_SI[0]]
|
||||
del equipment['SI'][possible_SI[0]]
|
||||
_si_sanity_check(equipment)
|
||||
return equipment
|
||||
|
||||
|
||||
def load_network(filename, equipment):
|
||||
def load_network(filename: Path, equipment: dict) -> DiGraph:
|
||||
"""load network json or excel
|
||||
|
||||
:param filename: input file to read from
|
||||
:param equipment: equipment library
|
||||
"""
|
||||
if filename.suffix.lower() in ('.xls', '.xlsx'):
|
||||
json_data = xls_to_json_data(filename)
|
||||
elif filename.suffix.lower() == '.json':
|
||||
@@ -498,21 +601,22 @@ def _cls_for(equipment_type):
|
||||
return elements.Edfa
|
||||
if equipment_type == 'Fused':
|
||||
return elements.Fused
|
||||
elif equipment_type == 'Roadm':
|
||||
if equipment_type == 'Roadm':
|
||||
return elements.Roadm
|
||||
elif equipment_type == 'Transceiver':
|
||||
if equipment_type == 'Transceiver':
|
||||
return elements.Transceiver
|
||||
elif equipment_type == 'Fiber':
|
||||
if equipment_type == 'Fiber':
|
||||
return elements.Fiber
|
||||
elif equipment_type == 'RamanFiber':
|
||||
if equipment_type == 'RamanFiber':
|
||||
return elements.RamanFiber
|
||||
elif equipment_type == 'Multiband_amplifier':
|
||||
if equipment_type == 'Multiband_amplifier':
|
||||
return elements.Multiband_amplifier
|
||||
else:
|
||||
raise ConfigurationError(f'Unknown network equipment "{equipment_type}"')
|
||||
|
||||
|
||||
def network_from_json(json_data, equipment):
|
||||
def network_from_json(json_data: dict, equipment: dict) -> DiGraph:
|
||||
"""create digraph based on json input dict and using equipment library to fill in the gaps
|
||||
"""
|
||||
# NOTE|dutc: we could use the following, but it would tie our data format
|
||||
# too closely to the graph library
|
||||
# from networkx import node_link_graph
|
||||
@@ -553,7 +657,7 @@ def network_from_json(json_data, equipment):
|
||||
except ConfigurationError as e:
|
||||
msg = f'Node {el_config["uid"]}: {e}'
|
||||
raise ConfigurationError(msg)
|
||||
if variety is not None and variety != multiband_type_variety:
|
||||
if variety is not None and variety not in multiband_type_variety:
|
||||
raise ConfigurationError(f'In node {el_config["uid"]}: multiband amplifier type_variety is not '
|
||||
+ 'consistent with its amps type varieties.')
|
||||
if not amps and extra_params is not None:
|
||||
@@ -608,14 +712,16 @@ def network_from_json(json_data, equipment):
|
||||
else:
|
||||
edge_length = 0.01
|
||||
g.add_edge(nodes[from_node], nodes[to_node], weight=edge_length)
|
||||
except KeyError:
|
||||
except KeyError as exc:
|
||||
msg = f'can not find {from_node} or {to_node} defined in {cx}'
|
||||
raise NetworkTopologyError(msg)
|
||||
raise NetworkTopologyError(msg) from exc
|
||||
|
||||
return g
|
||||
|
||||
|
||||
def network_to_json(network):
|
||||
def network_to_json(network: DiGraph) -> dict:
|
||||
"""Export network graph as a json dict
|
||||
"""
|
||||
data = {
|
||||
'elements': [n.to_json for n in network]
|
||||
}
|
||||
@@ -629,53 +735,61 @@ def network_to_json(network):
|
||||
return data
|
||||
|
||||
|
||||
def load_json(filename):
|
||||
def load_json(filename: Path) -> dict:
|
||||
"""load json data, convert from the yang to the legacy
|
||||
supports both legacy ang yang formatted inputs based on yang models
|
||||
"""
|
||||
with open(filename, 'r', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
return data
|
||||
|
||||
|
||||
def save_json(obj, filename):
|
||||
def save_json(obj: Dict, filename: Path):
|
||||
"""Save in json format. Use yang formatted data for Topo and Services
|
||||
"""
|
||||
with open(filename, 'w', encoding='utf-8') as f:
|
||||
json.dump(obj, f, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
def load_requests(filename, eqpt, bidir, network, network_filename):
|
||||
def load_requests(filename: Path, eqpt: dict, bidir: bool, network: DiGraph, network_filename: str) -> dict:
|
||||
"""loads the requests from a json or an excel file into a data string"""
|
||||
if filename.suffix.lower() in ('.xls', '.xlsx'):
|
||||
_logger.info('Automatically converting requests from XLS to JSON')
|
||||
try:
|
||||
return convert_service_sheet(filename, eqpt, network, network_filename=network_filename, bidir=bidir)
|
||||
except ServiceError as this_e:
|
||||
raise ServiceError(f'Service error: {this_e}')
|
||||
raise ServiceError(f'Service error: {this_e}') from this_e
|
||||
else:
|
||||
return load_json(filename)
|
||||
|
||||
|
||||
def requests_from_json(json_data, equipment):
|
||||
def requests_from_json(json_data: dict, equipment: dict) -> List[PathRequest]:
|
||||
"""Extract list of requests from data parsed from JSON"""
|
||||
requests_list = []
|
||||
|
||||
for req in json_data['path-request']:
|
||||
# init all params from request
|
||||
params = {}
|
||||
params['request_id'] = f'{req["request-id"]}'
|
||||
params['source'] = req['source']
|
||||
params['bidir'] = req['bidirectional']
|
||||
params['destination'] = req['destination']
|
||||
params['trx_type'] = req['path-constraints']['te-bandwidth']['trx_type']
|
||||
if params['trx_type'] is None:
|
||||
trx_type = req['path-constraints']['te-bandwidth']['trx_type']
|
||||
trx_mode = req['path-constraints']['te-bandwidth'].get('trx_mode', None)
|
||||
if trx_type is None:
|
||||
msg = f'Request {req["request-id"]} has no transceiver type defined.'
|
||||
raise ServiceError(msg)
|
||||
params['trx_mode'] = req['path-constraints']['te-bandwidth'].get('trx_mode', None)
|
||||
params['format'] = params['trx_mode']
|
||||
params['spacing'] = req['path-constraints']['te-bandwidth']['spacing']
|
||||
try:
|
||||
nd_list = sorted(req['explicit-route-objects']['route-object-include-exclude'], key=lambda x: x['index'])
|
||||
except KeyError:
|
||||
nd_list = []
|
||||
params['nodes_list'] = [n['num-unnum-hop']['node-id'] for n in nd_list]
|
||||
params['loose_list'] = [n['num-unnum-hop']['hop-type'] for n in nd_list]
|
||||
params = {
|
||||
'request_id': f'{req["request-id"]}',
|
||||
'source': req['source'],
|
||||
'destination': req['destination'],
|
||||
'bidir': req['bidirectional'],
|
||||
'trx_type': trx_type,
|
||||
'trx_mode': trx_mode,
|
||||
'format': trx_mode,
|
||||
'spacing': req['path-constraints']['te-bandwidth']['spacing'],
|
||||
'nodes_list': [n['num-unnum-hop']['node-id'] for n in nd_list],
|
||||
'loose_list': [n['num-unnum-hop']['hop-type'] for n in nd_list]
|
||||
}
|
||||
# recover trx physical param (baudrate, ...) from type and mode
|
||||
# nb_channel is computed based on min max frequency and spacing
|
||||
try:
|
||||
@@ -721,7 +835,7 @@ def requests_from_json(json_data, equipment):
|
||||
return requests_list
|
||||
|
||||
|
||||
def _check_one_request(params, f_max_from_si):
|
||||
def _check_one_request(params: dict, f_max_from_si: float):
|
||||
"""Checks that the requested parameters are consistant (spacing vs nb channel vs transponder mode...)"""
|
||||
f_min = params['f_min']
|
||||
f_max = params['f_max']
|
||||
@@ -731,17 +845,17 @@ def _check_one_request(params, f_max_from_si):
|
||||
if params['min_spacing'] > params['spacing']:
|
||||
msg = f'Request {params["request_id"]} has spacing below transponder ' +\
|
||||
f'{params["trx_type"]} {params["trx_mode"]} min spacing value ' +\
|
||||
f'{params["min_spacing"]*1e-9}GHz.\nComputation stopped'
|
||||
f'{params["min_spacing"] * 1e-9}GHz.\nComputation stopped'
|
||||
raise ServiceError(msg)
|
||||
if f_max > f_max_from_si:
|
||||
msg = f'Requested channel number {params["nb_channel"]}, baud rate {params["baud_rate"] * 1e-9} GHz' \
|
||||
+ f' and requested spacing {params["spacing"]*1e-9}GHz is not consistent with frequency range' \
|
||||
+ f' {f_min*1e-12} THz, {f_max_from_si*1e-12} THz.' \
|
||||
+ f' and requested spacing {params["spacing"] * 1e-9}GHz is not consistent with frequency range' \
|
||||
+ f' {f_min * 1e-12} THz, {f_max_from_si * 1e-12} THz.' \
|
||||
+ f' Max recommanded nb of channels is {max_recommanded_nb_channels}.'
|
||||
raise ServiceError(msg)
|
||||
# Transponder mode already selected; will it fit to the requested bandwidth?
|
||||
if params['trx_mode'] is not None and params['effective_freq_slot'] is not None:
|
||||
required_nb_of_channels, requested_m = compute_spectrum_slot_vs_bandwidth(params['path_bandwidth'],
|
||||
required_nb_of_channels, _ = compute_spectrum_slot_vs_bandwidth(params['path_bandwidth'],
|
||||
params['spacing'],
|
||||
params['bit_rate'])
|
||||
_, per_channel_m = compute_spectrum_slot_vs_bandwidth(params['bit_rate'],
|
||||
@@ -782,7 +896,7 @@ def _check_one_request(params, f_max_from_si):
|
||||
i += 1
|
||||
|
||||
|
||||
def disjunctions_from_json(json_data):
|
||||
def disjunctions_from_json(json_data: dict) -> List[Disjunction]:
|
||||
"""reads the disjunction requests from the json dict and create the list
|
||||
of requested disjunctions for this set of requests
|
||||
"""
|
||||
@@ -801,20 +915,30 @@ def disjunctions_from_json(json_data):
|
||||
|
||||
|
||||
def convert_service_sheet(
|
||||
input_filename,
|
||||
eqpt,
|
||||
network,
|
||||
network_filename=None,
|
||||
output_filename='',
|
||||
bidir=False):
|
||||
input_filename: Path,
|
||||
eqpt: dict,
|
||||
network: DiGraph,
|
||||
network_filename: Union[Path, None] = None,
|
||||
output_filename: str = '',
|
||||
bidir: bool = False):
|
||||
"""Converts xls into json format services
|
||||
|
||||
:param input_filename: xls(x) file containing the service sheet
|
||||
:param eqpt: equipment library
|
||||
:param network: network for which these services apply (required for xls inputs to correct names)
|
||||
:param network_filename: optional network file name that was used for network creation
|
||||
(required for xls inputs to correct names)
|
||||
:param output_filename: name of the file where converted data are savec
|
||||
:param bidir: set all services bidir attribute with this bool
|
||||
"""
|
||||
if output_filename == '':
|
||||
output_filename = f'{str(input_filename)[0:len(str(input_filename))-len(str(input_filename.suffixes[0]))]}_services.json'
|
||||
output_filename = f'{str(input_filename)[0:len(str(input_filename)) - len(str(input_filename.suffixes[0]))]}_services.json'
|
||||
data = read_service_sheet(input_filename, eqpt, network, network_filename, bidir)
|
||||
save_json(data, output_filename)
|
||||
return data
|
||||
|
||||
|
||||
def find_equalisation(params, equalization_types):
|
||||
def find_equalisation(params: Dict, equalization_types: List[str]):
|
||||
"""Find the equalization(s) defined in params. params can be a dict or a Roadm object.
|
||||
|
||||
>>> roadm = {'add_drop_osnr': 100, 'pmd': 1, 'pdl': 0.5,
|
||||
@@ -831,7 +955,7 @@ def find_equalisation(params, equalization_types):
|
||||
return equalization
|
||||
|
||||
|
||||
def merge_equalization(params, extra_params):
|
||||
def merge_equalization(params: dict, extra_params: dict) -> Union[dict, None]:
|
||||
"""params contains ROADM element config and extra_params default values from equipment library.
|
||||
If equalization is not defined in ROADM element use the one defined in equipment library.
|
||||
Only one type of equalization must be defined: power (target_pch_out_db) or PSD (target_psd_out_mWperGHz)
|
||||
@@ -851,3 +975,33 @@ def merge_equalization(params, extra_params):
|
||||
# If ROADM config doesn't contain any equalization type, keep the default one
|
||||
return extra_params
|
||||
return None
|
||||
|
||||
|
||||
def results_to_json(pathresults: List[ResultElement]):
|
||||
"""Converts a list of `ResultElement` objects into a JSON-compatible dictionary.
|
||||
|
||||
:param pathresults: List of `ResultElement` objects to be converted.
|
||||
:return: A dictionary with a single key `"response"`, containing a list of
|
||||
the `json` attributes of the provided `ResultElement` objects.
|
||||
"""
|
||||
return {'response': [n.json for n in pathresults]}
|
||||
|
||||
|
||||
def load_eqpt_topo_from_json(eqpt: dict, topology: dict) -> Tuple[dict, DiGraph]:
|
||||
"""Loads equipment configuration and network topology from JSON data.
|
||||
|
||||
:param eqpt: Dictionary containing the equipment configuration in JSON format.
|
||||
It includes details about the devices to be processed and structured.
|
||||
:param topology: Dictionary representing the network topology in JSON format,
|
||||
defining the structure of the network and its connections.
|
||||
|
||||
:return: A tuple containing:
|
||||
|
||||
- A dictionary with the processed equipment configuration.
|
||||
- A directed graph (DiGraph) representing the network topology, where nodes
|
||||
correspond to equipment and edges define their connections.
|
||||
"""
|
||||
equipment = _equipment_from_json(eqpt, DEFAULT_EXTRA_CONFIG)
|
||||
network = network_from_json(topology, equipment)
|
||||
return equipment, network
|
||||
|
||||
|
||||
@@ -11,105 +11,150 @@ Yang model for requesting path computation.
|
||||
See: draft-ietf-teas-yang-path-computation-01.txt
|
||||
"""
|
||||
|
||||
from xlrd import open_workbook, XL_CELL_EMPTY
|
||||
from collections import namedtuple
|
||||
from logging import getLogger
|
||||
from copy import deepcopy
|
||||
from pathlib import Path
|
||||
from typing import Dict, List
|
||||
from networkx import DiGraph
|
||||
from xlrd import open_workbook, XL_CELL_EMPTY
|
||||
|
||||
from gnpy.core.utils import db2lin
|
||||
from gnpy.core.exceptions import ServiceError
|
||||
from gnpy.core.elements import Transceiver, Roadm, Edfa, Fiber
|
||||
from gnpy.tools.convert import corresp_names, corresp_next_node
|
||||
from gnpy.tools.convert import corresp_names, corresp_next_node, all_rows
|
||||
|
||||
SERVICES_COLUMN = 12
|
||||
|
||||
|
||||
def all_rows(sheet, start=0):
|
||||
return (sheet.row(x) for x in range(start, sheet.nrows))
|
||||
|
||||
|
||||
logger = getLogger(__name__)
|
||||
|
||||
|
||||
class Request(namedtuple('Request', 'request_id source destination trx_type mode \
|
||||
class Request(namedtuple('request_param', '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)
|
||||
"""DATA class for a request.
|
||||
|
||||
:params request_id (int): The unique identifier for the request.
|
||||
:params source (str): The source node for the communication.
|
||||
:params destination (str): The destination node for the communication.
|
||||
:params trx_type (str): The type of transmission for the communication.
|
||||
:params mode (str, optional): The mode of transmission. Defaults to None.
|
||||
:params spacing (float, optional): The spacing between channels. Defaults to None.
|
||||
:params power (float, optional): The power level for the communication. Defaults to None.
|
||||
:params nb_channel (int, optional): The number of channels required for the communication. Defaults to None.
|
||||
:params disjoint_from (str, optional): The node to be disjoint from. Defaults to ''.
|
||||
:params nodes_list (list, optional): The list of nodes involved in the communication. Defaults to None.
|
||||
:params is_loose (str, optional): Indicates if the communication is loose. Defaults to ''.
|
||||
:params path_bandwidth (float, optional): The bandwidth required for the communication. Defaults to None.
|
||||
"""
|
||||
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)
|
||||
|
||||
|
||||
class Element:
|
||||
"""
|
||||
"""
|
||||
def __init__(self, uid):
|
||||
self.uid = uid
|
||||
|
||||
def __eq__(self, other):
|
||||
return type(self) == type(other) and self.uid == other.uid
|
||||
return isinstance(other, type(self)) and self.uid == other.ui
|
||||
|
||||
def __hash__(self):
|
||||
return hash((type(self), self.uid))
|
||||
|
||||
|
||||
class Request_element(Element):
|
||||
def __init__(self, Request, equipment, bidir):
|
||||
"""Class that generate the request in the json format
|
||||
|
||||
:params request_param (Request): The request object containing the information for the element.
|
||||
:params equipment (dict): The equipment configuration for the communication.
|
||||
:params bidir (bool): Indicates if the communication is bidirectional.
|
||||
|
||||
Attributes:
|
||||
request_id (str): The unique identifier for the request.
|
||||
source (str): The source node for the communication.
|
||||
destination (str): The destination node for the communication.
|
||||
srctpid (str): The source TP ID for the communication.
|
||||
dsttpid (str): The destination TP ID for the communication.
|
||||
bidir (bool): Indicates if the communication is bidirectional.
|
||||
trx_type (str): The type of transmission for the communication.
|
||||
mode (str): The mode of transmission for the communication.
|
||||
spacing (float): The spacing between channels for the communication.
|
||||
power (float): The power level for the communication.
|
||||
nb_channel (int): The number of channels required for the communication.
|
||||
disjoint_from (list): The list of nodes to be disjoint from.
|
||||
nodes_list (list): The list of nodes involved in the communication.
|
||||
loose (str): Indicates if the communication is loose or strict.
|
||||
path_bandwidth (float): The bandwidth required for the communication.
|
||||
"""
|
||||
def __init__(self, request_param: Request, equipment: Dict, bidir: bool):
|
||||
"""
|
||||
"""
|
||||
super().__init__(uid=request_param.request_id)
|
||||
# request_id is str
|
||||
# excel has automatic number formatting that adds .0 on integer values
|
||||
# the next lines recover the pure int value, assuming this .0 is unwanted
|
||||
self.request_id = correct_xlrd_int_to_str_reading(Request.request_id)
|
||||
self.source = f'trx {Request.source}'
|
||||
self.destination = f'trx {Request.destination}'
|
||||
self.request_id = correct_xlrd_int_to_str_reading(request_param.request_id)
|
||||
self.source = f'trx {request_param.source}'
|
||||
self.destination = f'trx {request_param.destination}'
|
||||
# TODO: the automatic naming generated by excel parser requires that source and dest name
|
||||
# be a string starting with 'trx' : this is manually added here.
|
||||
self.srctpid = f'trx {Request.source}'
|
||||
self.dsttpid = f'trx {Request.destination}'
|
||||
self.srctpid = f'trx {request_param.source}'
|
||||
self.dsttpid = f'trx {request_param.destination}'
|
||||
self.bidir = bidir
|
||||
# test that trx_type belongs to eqpt_config.json
|
||||
# if not replace it with a default
|
||||
try:
|
||||
if equipment['Transceiver'][Request.trx_type]:
|
||||
self.trx_type = correct_xlrd_int_to_str_reading(Request.trx_type)
|
||||
if Request.mode is not None:
|
||||
Requestmode = correct_xlrd_int_to_str_reading(Request.mode)
|
||||
if [mode for mode in equipment['Transceiver'][Request.trx_type].mode if mode['format'] == Requestmode]:
|
||||
self.mode = Requestmode
|
||||
if equipment['Transceiver'][request_param.trx_type]:
|
||||
self.trx_type = correct_xlrd_int_to_str_reading(request_param.trx_type)
|
||||
if request_param.mode is not None:
|
||||
request_mode = correct_xlrd_int_to_str_reading(request_param.mode)
|
||||
if [mode for mode in equipment['Transceiver'][request_param.trx_type].mode
|
||||
if mode['format'] == request_mode]:
|
||||
self.mode = request_mode
|
||||
else:
|
||||
msg = f'Request Id: {self.request_id} - could not find tsp : \'{Request.trx_type}\' ' \
|
||||
+ f'with mode: \'{Requestmode}\' in eqpt library \nComputation stopped.'
|
||||
msg = f'Request Id: {self.request_id} - could not find tsp : \'{request_param.trx_type}\' ' \
|
||||
+ f'with mode: \'{request_mode}\' in eqpt library \nComputation stopped.'
|
||||
raise ServiceError(msg)
|
||||
else:
|
||||
Requestmode = None
|
||||
self.mode = Request.mode
|
||||
except KeyError:
|
||||
msg = f'Request Id: {self.request_id} - could not find tsp : \'{Request.trx_type}\' ' \
|
||||
+ f'with mode: \'{Request.mode}\' in eqpt library \nComputation stopped.'
|
||||
raise ServiceError(msg)
|
||||
request_mode = None
|
||||
self.mode = request_param.mode
|
||||
except KeyError as e:
|
||||
msg = f'Request Id: {self.request_id} - could not find tsp : \'{request_param.trx_type}\' with mode: ' \
|
||||
+ f'\'{request_param.mode}\' in eqpt library \nComputation stopped.'
|
||||
raise ServiceError(msg) from e
|
||||
# excel input are in GHz and dBm
|
||||
if Request.spacing is not None:
|
||||
self.spacing = Request.spacing * 1e9
|
||||
if request_param.spacing is not None:
|
||||
self.spacing = request_param.spacing * 1e9
|
||||
else:
|
||||
msg = f'Request {self.request_id} missing spacing: spacing is mandatory.\ncomputation stopped'
|
||||
raise ServiceError(msg)
|
||||
if Request.power is not None:
|
||||
self.power = db2lin(Request.power) * 1e-3
|
||||
else:
|
||||
self.power = None
|
||||
if Request.nb_channel is not None:
|
||||
self.nb_channel = int(Request.nb_channel)
|
||||
else:
|
||||
if request_param.power is not None:
|
||||
self.power = db2lin(request_param.power) * 1e-3
|
||||
self.nb_channel = None
|
||||
if request_param.nb_channel is not None:
|
||||
self.nb_channel = int(request_param.nb_channel)
|
||||
|
||||
value = correct_xlrd_int_to_str_reading(Request.disjoint_from)
|
||||
value = correct_xlrd_int_to_str_reading(request_param.disjoint_from)
|
||||
self.disjoint_from = [n for n in value.split(' | ') if value]
|
||||
self.nodes_list = []
|
||||
if Request.nodes_list:
|
||||
self.nodes_list = Request.nodes_list.split(' | ')
|
||||
if request_param.nodes_list:
|
||||
self.nodes_list = request_param.nodes_list.split(' | ')
|
||||
self.loose = 'LOOSE'
|
||||
if Request.is_loose.lower() == 'no':
|
||||
if request_param.is_loose.lower() == 'no':
|
||||
self.loose = 'STRICT'
|
||||
self.path_bandwidth = None
|
||||
if Request.path_bandwidth is not None:
|
||||
self.path_bandwidth = Request.path_bandwidth * 1e9
|
||||
else:
|
||||
self.path_bandwidth = 0
|
||||
|
||||
uid = property(lambda self: repr(self))
|
||||
if request_param.path_bandwidth is not None:
|
||||
self.path_bandwidth = request_param.path_bandwidth * 1e9
|
||||
|
||||
@property
|
||||
def pathrequest(self):
|
||||
"""Creates json dictionnary for the request
|
||||
"""
|
||||
# Default assumption for bidir is False
|
||||
req_dictionnary = {
|
||||
'request-id': self.request_id,
|
||||
@@ -152,29 +197,32 @@ class Request_element(Element):
|
||||
|
||||
@property
|
||||
def pathsync(self):
|
||||
"""Creates json dictionnary for disjunction list (synchronization vector)
|
||||
"""
|
||||
if self.disjoint_from:
|
||||
return {'synchronization-id': self.request_id,
|
||||
'svec': {
|
||||
'relaxable': 'false',
|
||||
'disjointness': 'node link',
|
||||
'request-id-number': [self.request_id] + [n for n in self.disjoint_from]
|
||||
'request-id-number': [self.request_id] + list(self.disjoint_from)
|
||||
}
|
||||
}
|
||||
else:
|
||||
return None
|
||||
# TO-DO: avoid multiple entries with same synchronisation vectors
|
||||
|
||||
@property
|
||||
def json(self):
|
||||
"""Returns the json dictionnary for requests and for synchronisation vector
|
||||
"""
|
||||
return self.pathrequest, self.pathsync
|
||||
|
||||
|
||||
def read_service_sheet(
|
||||
input_filename,
|
||||
eqpt,
|
||||
network,
|
||||
network_filename=None,
|
||||
bidir=False):
|
||||
input_filename: Path,
|
||||
eqpt: Dict,
|
||||
network: DiGraph,
|
||||
network_filename: Path = None,
|
||||
bidir: bool = False) -> Dict:
|
||||
""" converts a service sheet into a json structure
|
||||
"""
|
||||
if network_filename is None:
|
||||
@@ -184,19 +232,16 @@ def read_service_sheet(
|
||||
req = correct_xls_route_list(network_filename, network, req)
|
||||
# if there is no sync vector , do not write any synchronization
|
||||
synchro = [n.json[1] for n in req if n.json[1] is not None]
|
||||
data = {'path-request': [n.json[0] for n in req]}
|
||||
if synchro:
|
||||
data = {
|
||||
'path-request': [n.json[0] for n in req],
|
||||
'synchronization': synchro
|
||||
}
|
||||
else:
|
||||
data = {
|
||||
'path-request': [n.json[0] for n in req]
|
||||
}
|
||||
data['synchronization'] = synchro
|
||||
return data
|
||||
|
||||
|
||||
def correct_xlrd_int_to_str_reading(v):
|
||||
"""Utils: ensure that int values in id are read as strings containing the int and
|
||||
do not use the automatic float conversion from xlrd
|
||||
"""
|
||||
if not isinstance(v, str):
|
||||
value = str(int(v))
|
||||
if value.endswith('.0'):
|
||||
@@ -206,22 +251,27 @@ def correct_xlrd_int_to_str_reading(v):
|
||||
return value
|
||||
|
||||
|
||||
def parse_row(row, fieldnames):
|
||||
def parse_row(row: List, fieldnames: List[str]) -> Dict:
|
||||
"""Reads each values in a row and creates a dict using field names
|
||||
"""
|
||||
return {f: r.value for f, r in zip(fieldnames, row[0:SERVICES_COLUMN])
|
||||
if r.ctype != XL_CELL_EMPTY}
|
||||
|
||||
|
||||
def parse_excel(input_filename):
|
||||
def parse_excel(input_filename: Path) -> List[Request]:
|
||||
"""Opens xls_file and reads 'Service' sheet
|
||||
Returns the list of services data in Request class
|
||||
"""
|
||||
with open_workbook(input_filename) as wb:
|
||||
service_sheet = wb.sheet_by_name('Service')
|
||||
services = list(parse_service_sheet(service_sheet))
|
||||
return services
|
||||
|
||||
|
||||
def parse_service_sheet(service_sheet):
|
||||
def parse_service_sheet(service_sheet) -> Request:
|
||||
""" reads each column according to authorized fieldnames. order is not important.
|
||||
"""
|
||||
logger.debug(f'Validating headers on {service_sheet.name!r}')
|
||||
logger.debug('Validating headers on %r', service_sheet.name)
|
||||
# add a test on field to enable the '' field case that arises when columns on the
|
||||
# right hand side are used as comments or drawing in the excel sheet
|
||||
header = [x.value.strip() for x in service_sheet.row(4)[0:SERVICES_COLUMN]
|
||||
@@ -239,14 +289,52 @@ def parse_service_sheet(service_sheet):
|
||||
'routing: is loose?': 'is_loose', 'path bandwidth': 'path_bandwidth'}
|
||||
try:
|
||||
service_fieldnames = [authorized_fieldnames[e] for e in header]
|
||||
except KeyError:
|
||||
except KeyError as e:
|
||||
msg = f'Malformed header on Service sheet: {header} field not in {authorized_fieldnames}'
|
||||
raise ValueError(msg)
|
||||
raise ValueError(msg) from e
|
||||
for row in all_rows(service_sheet, start=5):
|
||||
yield Request(**parse_row(row[0:SERVICES_COLUMN], service_fieldnames))
|
||||
|
||||
|
||||
def correct_xls_route_list(network_filename, network, pathreqlist):
|
||||
def check_end_points(pathreq: Request_element, network: DiGraph):
|
||||
"""Raise error if end point is not correct
|
||||
"""
|
||||
transponders = [n.uid for n in network.nodes() if isinstance(n, Transceiver)]
|
||||
if pathreq.source not in transponders:
|
||||
msg = f'Request: {pathreq.request_id}: could not find' +\
|
||||
f' transponder source : {pathreq.source}.'
|
||||
logger.critical(msg)
|
||||
raise ServiceError(msg)
|
||||
if pathreq.destination not in transponders:
|
||||
msg = f'Request: {pathreq.request_id}: could not find' +\
|
||||
f' transponder destination: {pathreq.destination}.'
|
||||
logger.critical(msg)
|
||||
raise ServiceError(msg)
|
||||
|
||||
|
||||
def find_node_sugestion(n_id, corresp_roadm, corresp_fused, corresp_ila, network):
|
||||
"""
|
||||
"""
|
||||
roadmtype = [n.uid for n in network.nodes() if isinstance(n, Roadm)]
|
||||
edfatype = [n.uid for n in network.nodes() if isinstance(n, Edfa)]
|
||||
# check that n_id is in the node list, if not find a correspondance name
|
||||
if n_id in roadmtype + edfatype:
|
||||
return [n_id]
|
||||
# checks first roadm, fused, and ila in this order, because ila automatic name
|
||||
# contains roadm names. If it is a fused node, next ila names might be correct
|
||||
# suggestions, especially if following fibers were splitted and ila names
|
||||
# created with the name of the fused node
|
||||
if n_id in corresp_roadm.keys():
|
||||
return corresp_roadm[n_id]
|
||||
if n_id in corresp_fused.keys():
|
||||
return corresp_fused[n_id] + corresp_ila[n_id]
|
||||
if n_id in corresp_ila.keys():
|
||||
return corresp_ila[n_id]
|
||||
return []
|
||||
|
||||
|
||||
def correct_xls_route_list(network_filename: Path, network: DiGraph,
|
||||
pathreqlist: List[Request_element]) -> List[Request_element]:
|
||||
""" prepares the format of route list of nodes to be consistant with nodes names:
|
||||
remove wrong names, find correct names for ila, roadm and fused if the entry was
|
||||
xls.
|
||||
@@ -260,30 +348,17 @@ def correct_xls_route_list(network_filename, network, pathreqlist):
|
||||
corresp_ila, next_node = corresp_next_node(network, corresp_ila, corresp_roadm)
|
||||
# finally correct constraints based on these dict
|
||||
trxfibertype = [n.uid for n in network.nodes() if isinstance(n, (Transceiver, Fiber))]
|
||||
roadmtype = [n.uid for n in network.nodes() if isinstance(n, Roadm)]
|
||||
edfatype = [n.uid for n in network.nodes() if isinstance(n, Edfa)]
|
||||
# TODO there is a problem of identification of fibers in case of parallel
|
||||
# fibers between two adjacent roadms so fiber constraint is not supported
|
||||
transponders = [n.uid for n in network.nodes() if isinstance(n, Transceiver)]
|
||||
for pathreq in pathreqlist:
|
||||
# first check that source and dest are transceivers
|
||||
if pathreq.source not in transponders:
|
||||
msg = f'Request: {pathreq.request_id}: could not find' +\
|
||||
f' transponder source : {pathreq.source}.'
|
||||
raise ServiceError(msg)
|
||||
|
||||
if pathreq.destination not in transponders:
|
||||
msg = f'Request: {pathreq.request_id}: could not find' +\
|
||||
f' transponder destination: {pathreq.destination}.'
|
||||
raise ServiceError(msg)
|
||||
check_end_points(pathreq, network)
|
||||
# silently pop source and dest nodes from the list if they were added by the user as first
|
||||
# and last elem in the constraints respectively. Other positions must lead to an error
|
||||
# caught later on
|
||||
if pathreq.nodes_list and pathreq.source == pathreq.nodes_list[0]:
|
||||
pathreq.loose_list.pop(0)
|
||||
pathreq.nodes_list.pop(0)
|
||||
if pathreq.nodes_list and pathreq.destination == pathreq.nodes_list[-1]:
|
||||
pathreq.loose_list.pop(-1)
|
||||
pathreq.nodes_list.pop(-1)
|
||||
# Then process user defined constraints with respect to automatic namings
|
||||
temp = deepcopy(pathreq)
|
||||
@@ -293,73 +368,56 @@ def correct_xls_route_list(network_filename, network, pathreqlist):
|
||||
# n_id must not be a transceiver and must not be a fiber (non supported, user
|
||||
# can not enter fiber names in excel)
|
||||
if n_id not in trxfibertype:
|
||||
# check that n_id is in the node list, if not find a correspondance name
|
||||
if n_id in roadmtype + edfatype:
|
||||
nodes_suggestion = [n_id]
|
||||
else:
|
||||
# checks first roadm, fused, and ila in this order, because ila automatic name
|
||||
# contain roadm names. If it is a fused node, next ila names might be correct
|
||||
# suggestions, especially if following fibers were splitted and ila names
|
||||
# created with the name of the fused node
|
||||
if n_id in corresp_roadm.keys():
|
||||
nodes_suggestion = corresp_roadm[n_id]
|
||||
elif n_id in corresp_fused.keys():
|
||||
nodes_suggestion = corresp_fused[n_id] + corresp_ila[n_id]
|
||||
elif n_id in corresp_ila.keys():
|
||||
nodes_suggestion = corresp_ila[n_id]
|
||||
else:
|
||||
nodes_suggestion = []
|
||||
if nodes_suggestion:
|
||||
nodes_suggestion = find_node_sugestion(n_id, corresp_roadm, corresp_fused, corresp_ila, network)
|
||||
try:
|
||||
if len(nodes_suggestion) > 1:
|
||||
# if there is more than one suggestion, we need to choose the direction
|
||||
# we rely on the next node provided by the user for this purpose
|
||||
new_n = next(n for n in nodes_suggestion
|
||||
if n in next_node.keys() and next_node[n]
|
||||
in temp.nodes_list[i:] + [pathreq.destination] and
|
||||
next_node[n] not in temp.nodes_list[:i])
|
||||
else:
|
||||
if n in next_node
|
||||
and next_node[n] in temp.nodes_list[i:] + [pathreq.destination]
|
||||
and next_node[n] not in temp.nodes_list[:i])
|
||||
elif len(nodes_suggestion) == 1:
|
||||
new_n = nodes_suggestion[0]
|
||||
else:
|
||||
if temp.loose == 'LOOSE':
|
||||
# if no matching can be found in the network just ignore this constraint
|
||||
# if it is a loose constraint
|
||||
# warns the user that this node is not part of the topology
|
||||
msg = f'{pathreq.request_id}: Invalid node specified:\n\t\'{n_id}\'' \
|
||||
+ ', could not use it as constraint, skipped!'
|
||||
print(msg)
|
||||
logger.info(msg)
|
||||
pathreq.nodes_list.remove(n_id)
|
||||
continue
|
||||
msg = f'{pathreq.request_id}: Could not find node:\n\t\'{n_id}\' in network' \
|
||||
+ ' topology. Strict constraint can not be applied.'
|
||||
raise ServiceError(msg)
|
||||
if new_n != n_id:
|
||||
# warns the user when the correct name is used only in verbose mode,
|
||||
# eg 'a' is a roadm and correct name is 'roadm a' or when there was
|
||||
# too much ambiguity, 'b' is an ila, its name can be:
|
||||
# Edfa0_fiber (a → b)-xx if next node is c or
|
||||
# Edfa0_fiber (c → b)-xx if next node is a
|
||||
msg = f'Request {pathreq.request_id}: Invalid route node specified:' \
|
||||
# "east edfa in b to c", or "west edfa in b to a" if next node is c or
|
||||
# "west edfa in b to c", or "east edfa in b to a" if next node is a
|
||||
msg = f'{pathreq.request_id}: Invalid route node specified:' \
|
||||
+ f'\n\t\'{n_id}\', replaced with \'{new_n}\''
|
||||
logger.warning(msg)
|
||||
logger.info(msg)
|
||||
pathreq.nodes_list[pathreq.nodes_list.index(n_id)] = new_n
|
||||
except StopIteration:
|
||||
# shall not come in this case, unless requested direction does not exist
|
||||
msg = f'Request {pathreq.request_id}: Invalid route specified {n_id}: could' \
|
||||
msg = f'{pathreq.request_id}: Invalid route specified {n_id}: could' \
|
||||
+ ' not decide on direction, skipped!.\nPlease add a valid' \
|
||||
+ ' direction in constraints (next neighbour node)'
|
||||
logger.info(msg)
|
||||
pathreq.nodes_list.remove(n_id)
|
||||
else:
|
||||
if temp.loose == 'LOOSE':
|
||||
msg = f'{pathreq.request_id}: Invalid route node specified:\n\t\'{n_id}\'' \
|
||||
+ ' type is not supported as constraint with xls network input, skipped!'
|
||||
logger.warning(msg)
|
||||
pathreq.loose_list.pop(pathreq.nodes_list.index(n_id))
|
||||
pathreq.nodes_list.remove(n_id)
|
||||
else:
|
||||
if temp.loose_list[i] == 'LOOSE':
|
||||
# if no matching can be found in the network just ignore this constraint
|
||||
# if it is a loose constraint
|
||||
# warns the user that this node is not part of the topology
|
||||
msg = f'Request {pathreq.request_id}: Invalid node specified:\n\t\'{n_id}\'' \
|
||||
+ ', could not use it as constraint, skipped!'
|
||||
logger.warning(msg)
|
||||
pathreq.loose_list.pop(pathreq.nodes_list.index(n_id))
|
||||
pathreq.nodes_list.remove(n_id)
|
||||
else:
|
||||
msg = f'Request {pathreq.request_id}: Could not find node:\n\t\'{n_id}\' in network' \
|
||||
+ ' topology. Strict constraint can not be applied.'
|
||||
raise ServiceError(msg)
|
||||
else:
|
||||
if temp.loose_list[i] == 'LOOSE':
|
||||
logger.warning(f'Request {pathreq.request_id}: Invalid route node specified:\n\t\'{n_id}\''
|
||||
+ ' type is not supported as constraint with xls network input, skipped!')
|
||||
pathreq.loose_list.pop(pathreq.nodes_list.index(n_id))
|
||||
pathreq.nodes_list.remove(n_id)
|
||||
else:
|
||||
msg = f'Invalid route node specified \n\t\'{n_id}\'' \
|
||||
msg = f'{pathreq.request_id}: Invalid route node specified \n\t\'{n_id}\'' \
|
||||
+ ' type is not supported as constraint with xls network input,' \
|
||||
+ ', Strict constraint can not be applied.'
|
||||
raise ServiceError(msg)
|
||||
|
||||
@@ -24,7 +24,7 @@ from networkx.utils import pairwise
|
||||
from numpy import mean, argmin
|
||||
|
||||
from gnpy.core.elements import Transceiver, Roadm, Edfa, Multiband_amplifier
|
||||
from gnpy.core.utils import lin2db, find_common_range
|
||||
from gnpy.core.utils import lin2db, unique_ordered, find_common_range
|
||||
from gnpy.core.info import create_input_spectral_information, carriers_to_spectral_information, \
|
||||
demuxed_spectral_information, muxed_spectral_information, SpectralInformation
|
||||
from gnpy.core import network as network_module
|
||||
@@ -301,7 +301,9 @@ def compute_constrained_path(network, req):
|
||||
nodes_list = []
|
||||
for node in req.nodes_list[:-1]:
|
||||
nodes_list.append(next(el for el in network if el.uid == node))
|
||||
|
||||
total_path = explicit_path(nodes_list, source, destination, network)
|
||||
if total_path is not None:
|
||||
return total_path
|
||||
try:
|
||||
path_generator = shortest_simple_paths(network, source, destination, weight='weight')
|
||||
total_path = next(path for path in path_generator if ispart(nodes_list, path))
|
||||
@@ -1176,6 +1178,7 @@ def compute_path_with_disjunction(network, equipment, pathreqlist, pathlist, red
|
||||
pathreq.tx_osnr = mode['tx_osnr']
|
||||
pathreq.bit_rate = mode['bit_rate']
|
||||
pathreq.penalties = mode['penalties']
|
||||
pathreq.offset_db = mode['equalization_offset_db']
|
||||
# other blocking reason should not appear at this point
|
||||
except AttributeError:
|
||||
pathreq.baud_rate = mode['baud_rate']
|
||||
@@ -1185,6 +1188,7 @@ def compute_path_with_disjunction(network, equipment, pathreqlist, pathlist, red
|
||||
pathreq.tx_osnr = mode['tx_osnr']
|
||||
pathreq.bit_rate = mode['bit_rate']
|
||||
pathreq.penalties = mode['penalties']
|
||||
pathreq.offset_db = mode['equalization_offset_db']
|
||||
|
||||
# reversed path is needed for correct spectrum assignment
|
||||
reversed_path = find_reversed_path(pathlist[i])
|
||||
@@ -1253,6 +1257,44 @@ def _penalty_msg(total_path, msg, min_ind):
|
||||
return msg
|
||||
|
||||
|
||||
def is_adjacent(oms1, oms2):
|
||||
""" oms1's egress ROADM is oms2's ingress ROADM
|
||||
"""
|
||||
return oms1.el_list[-1] == oms2.el_list[0]
|
||||
|
||||
|
||||
def explicit_path(node_list, source, destination, network):
|
||||
""" if list of nodes leads to adjacent oms, then means that the path is explicit, and no need to compute
|
||||
the function returns the explicit path (including source and destination ROADMs)
|
||||
"""
|
||||
path_oms = []
|
||||
for elem in node_list:
|
||||
if hasattr(elem, 'oms'):
|
||||
path_oms.append(elem.oms)
|
||||
if not path_oms:
|
||||
return None
|
||||
path_oms = unique_ordered(path_oms)
|
||||
try:
|
||||
next_node = next(network.successors(source))
|
||||
source_roadm = next_node if isinstance(next_node, Roadm) else source
|
||||
previous_node = next(network.predecessors(destination))
|
||||
destination_roadm = previous_node if isinstance(previous_node, Roadm) else destination
|
||||
if not (path_oms[0].el_list[0] == source_roadm and path_oms[-1].el_list[-1] == destination_roadm):
|
||||
return None
|
||||
except StopIteration:
|
||||
return None
|
||||
|
||||
oms0 = path_oms[0]
|
||||
path = [source] + oms0.el_list
|
||||
for oms in path_oms[1:]:
|
||||
if not is_adjacent(oms0, oms):
|
||||
return None
|
||||
oms0 = oms
|
||||
path.extend(oms.el_list)
|
||||
path.append(destination)
|
||||
return unique_ordered(path)
|
||||
|
||||
|
||||
def find_elements_common_range(el_list: list, equipment: dict) -> List[dict]:
|
||||
"""Find the common frequency range of amps of a given list of elements (for example an OMS or a path)
|
||||
If there are no amplifiers in the path, then use the SI
|
||||
|
||||
@@ -1,559 +0,0 @@
|
||||
*********************************************
|
||||
Equipment and Network description definitions
|
||||
*********************************************
|
||||
|
||||
1. Equipment description
|
||||
########################
|
||||
|
||||
Equipment description defines equipment types and those parameters.
|
||||
Description is made in JSON file with predefined structure. By default
|
||||
**gnpy-transmission-example** uses **eqpt_config.json** file and that
|
||||
can be changed with **-e** or **--equipment** command line parameter.
|
||||
Parsing of JSON file is made with
|
||||
**gnpy.core.equipment.load_equipment(equipment_description)** and return
|
||||
value is a dictionary of format **dict[‘equipment
|
||||
type’][‘subtype’]=object**
|
||||
|
||||
1.1. Structure definition
|
||||
*************************
|
||||
|
||||
1.1.1. Equipment types
|
||||
*************************
|
||||
|
||||
Every equipment type is defined in JSON root with according name and
|
||||
array of parameters as value.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
{"Edfa": [...],
|
||||
"Fiber": [...]
|
||||
}
|
||||
|
||||
|
||||
1.1.2. Equipment parameters and subtypes
|
||||
*****************************************
|
||||
|
||||
|
||||
Array of parameters is a list of objects with unordered parameter name
|
||||
and its value definition. In case of multiple equipment subtypes each
|
||||
object contains **"type_variety":”type name”** name:value combination,
|
||||
if only one subtype exists **"type_variety"** name is not mandatory and
|
||||
it will be marked with **”default”** value.
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{"Edfa": [{
|
||||
"type_variety": "std_medium_gain",
|
||||
"type_def": "variable_gain",
|
||||
"gain_flatmax": 26,
|
||||
"gain_min": 15,
|
||||
"p_max": 23,
|
||||
"nf_min": 6,
|
||||
"nf_max": 10,
|
||||
"out_voa_auto": false,
|
||||
"allowed_for_design": true
|
||||
},
|
||||
{
|
||||
"type_variety": "std_low_gain",
|
||||
"type_def": "variable_gain",
|
||||
"gain_flatmax": 16,
|
||||
"gain_min": 8,
|
||||
"p_max": 23,
|
||||
"nf_min": 6.5,
|
||||
"nf_max": 11,
|
||||
"out_voa_auto": false,
|
||||
"allowed_for_design": true
|
||||
}
|
||||
],
|
||||
"Fiber": [{
|
||||
"type_variety": "SSMF",
|
||||
"dispersion": 1.67e-05,
|
||||
"gamma": 0.00127
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
1.2. Equipment parameters by type
|
||||
*********************************
|
||||
|
||||
1.2.1. EDFA element
|
||||
*******************
|
||||
|
||||
Four types of EDFA definition are possible. Description JSON file
|
||||
location is in **gnpy-transmission-example** folder:
|
||||
|
||||
- Advanced – with JSON file describing gain/noise figure tilt and
|
||||
gain/noise figure ripple. **"advanced_config_from_json"** value
|
||||
contains filename.
|
||||
|
||||
.. code-block:: json-object
|
||||
|
||||
"Edfa":[{
|
||||
"type_variety": "high_detail_model_example",
|
||||
"gain_flatmax": 25,
|
||||
"gain_min": 15,
|
||||
"p_max": 21,
|
||||
"advanced_config_from_json": "std_medium_gain_advanced_config.json",
|
||||
"out_voa_auto": false,
|
||||
"allowed_for_design": false
|
||||
}
|
||||
]
|
||||
|
||||
- Variable gain – with JSON file describing gain figure tilt and gain/noise
|
||||
figure ripple. **”default_edfa_config.json”** as source file.
|
||||
|
||||
.. code-block:: json-object
|
||||
|
||||
"Edfa":[{
|
||||
"type_variety": "std_medium_gain",
|
||||
"type_def": "variable_gain",
|
||||
"gain_flatmax": 26,
|
||||
"gain_min": 15,
|
||||
"p_max": 23,
|
||||
"nf_min": 6,
|
||||
"nf_max": 10,
|
||||
"out_voa_auto": false,
|
||||
"allowed_for_design": true
|
||||
}
|
||||
]
|
||||
|
||||
- Fixed gain – with JSON file describing gain figure tilt and gain/noise
|
||||
figure ripple. **”default_edfa_config.json”** as source file.
|
||||
|
||||
.. code-block:: json-object
|
||||
|
||||
"Edfa":[{
|
||||
"type_variety": "std_fixed_gain",
|
||||
"type_def": "fixed_gain",
|
||||
"gain_flatmax": 21,
|
||||
"gain_min": 20,
|
||||
"p_max": 21,
|
||||
"nf0": 5.5,
|
||||
"allowed_for_design": false
|
||||
}
|
||||
]
|
||||
|
||||
- openroadm – with JSON file describing gain figure tilt and gain/noise
|
||||
figure ripple. **”default_edfa_config.json”** as source file.
|
||||
|
||||
.. code-block:: json-object
|
||||
|
||||
"Edfa":[{
|
||||
"type_variety": "openroadm_ila_low_noise",
|
||||
"type_def": "openroadm",
|
||||
"gain_flatmax": 27,
|
||||
"gain_min": 12,
|
||||
"p_max": 22,
|
||||
"nf_coef": [-8.104e-4,-6.221e-2,-5.889e-1,37.62],
|
||||
"allowed_for_design": false
|
||||
}
|
||||
]
|
||||
|
||||
1.2.2. Fiber element
|
||||
********************
|
||||
|
||||
Fiber element with its parameters:
|
||||
|
||||
.. code-block:: json-object
|
||||
|
||||
"Fiber":[{
|
||||
"type_variety": "SSMF",
|
||||
"dispersion": 1.67e-05,
|
||||
"gamma": 0.00127
|
||||
}
|
||||
]
|
||||
|
||||
RamanFiber element
|
||||
******************
|
||||
|
||||
A special variant of the regular ``Fiber`` where the simulation engine accounts for the Raman effect.
|
||||
The newly added parameters are nested in the ``raman_efficiency`` dictionary.
|
||||
Its shape corresponds to typical properties of silica.
|
||||
More details are available from :cite:`curri_merit_2016`.
|
||||
|
||||
The ``cr`` property is the normailzed Raman efficiency, so it is is (almost) independent of the fiber type, while the coefficient actually giving Raman gain is g_R=C_R/Aeff.
|
||||
|
||||
The ``frequency_offset`` represents the spectral difference between the pumping photon and the one receiving energy.
|
||||
|
||||
.. code-block:: json-object
|
||||
|
||||
"RamanFiber":[{
|
||||
"type_variety": "SSMF",
|
||||
"dispersion": 1.67e-05,
|
||||
"gamma": 0.00127,
|
||||
"raman_efficiency": {
|
||||
"cr":[
|
||||
0, 9.4E-06, 2.92E-05, 4.88E-05, 6.82E-05, 8.31E-05, 9.4E-05, 0.0001014, 0.0001069, 0.0001119,
|
||||
0.0001217, 0.0001268, 0.0001365, 0.000149, 0.000165, 0.000181, 0.0001977, 0.0002192, 0.0002469,
|
||||
0.0002749, 0.0002999, 0.0003206, 0.0003405, 0.0003592, 0.000374, 0.0003826, 0.0003841, 0.0003826,
|
||||
0.0003802, 0.0003756, 0.0003549, 0.0003795, 0.000344, 0.0002933, 0.0002024, 0.0001158, 8.46E-05,
|
||||
7.14E-05, 6.86E-05, 8.5E-05, 8.93E-05, 9.01E-05, 8.15E-05, 6.67E-05, 4.37E-05, 3.28E-05, 2.96E-05,
|
||||
2.65E-05, 2.57E-05, 2.81E-05, 3.08E-05, 3.67E-05, 5.85E-05, 6.63E-05, 6.36E-05, 5.5E-05, 4.06E-05,
|
||||
2.77E-05, 2.42E-05, 1.87E-05, 1.6E-05, 1.4E-05, 1.13E-05, 1.05E-05, 9.8E-06, 9.8E-06, 1.13E-05,
|
||||
1.64E-05, 1.95E-05, 2.38E-05, 2.26E-05, 2.03E-05, 1.48E-05, 1.09E-05, 9.8E-06, 1.05E-05, 1.17E-05,
|
||||
1.25E-05, 1.21E-05, 1.09E-05, 9.8E-06, 8.2E-06, 6.6E-06, 4.7E-06, 2.7E-06, 1.9E-06, 1.2E-06, 4E-07,
|
||||
2E-07, 1E-07
|
||||
],
|
||||
"frequency_offset":[
|
||||
0, 0.5e12, 1e12, 1.5e12, 2e12, 2.5e12, 3e12, 3.5e12, 4e12, 4.5e12, 5e12, 5.5e12, 6e12, 6.5e12, 7e12,
|
||||
7.5e12, 8e12, 8.5e12, 9e12, 9.5e12, 10e12, 10.5e12, 11e12, 11.5e12, 12e12, 12.5e12, 12.75e12,
|
||||
13e12, 13.25e12, 13.5e12, 14e12, 14.5e12, 14.75e12, 15e12, 15.5e12, 16e12, 16.5e12, 17e12,
|
||||
17.5e12, 18e12, 18.25e12, 18.5e12, 18.75e12, 19e12, 19.5e12, 20e12, 20.5e12, 21e12, 21.5e12,
|
||||
22e12, 22.5e12, 23e12, 23.5e12, 24e12, 24.5e12, 25e12, 25.5e12, 26e12, 26.5e12, 27e12, 27.5e12, 28e12,
|
||||
28.5e12, 29e12, 29.5e12, 30e12, 30.5e12, 31e12, 31.5e12, 32e12, 32.5e12, 33e12, 33.5e12, 34e12, 34.5e12,
|
||||
35e12, 35.5e12, 36e12, 36.5e12, 37e12, 37.5e12, 38e12, 38.5e12, 39e12, 39.5e12, 40e12, 40.5e12, 41e12,
|
||||
41.5e12, 42e12
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
1.2.3 Roadm element
|
||||
*******************
|
||||
|
||||
Roadm element with its parameters:
|
||||
|
||||
.. code-block:: json-object
|
||||
|
||||
"Roadms":[{
|
||||
"gain_mode_default_loss": 20,
|
||||
"power_mode_pout_target": -20,
|
||||
"add_drop_osnr": 38
|
||||
}
|
||||
]
|
||||
|
||||
1.2.3. Spans element
|
||||
********************
|
||||
|
||||
Spans element with its parameters:
|
||||
|
||||
.. code-block:: json-object
|
||||
|
||||
"Spans":[{
|
||||
"power_mode":true,
|
||||
"delta_power_range_db": [0,0,0.5],
|
||||
"max_length": 150,
|
||||
"length_units": "km",
|
||||
"max_loss": 28,
|
||||
"padding": 10,
|
||||
"EOL": 0,
|
||||
"con_in": 0,
|
||||
"con_out": 0
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
1.2.4. Spectral Information
|
||||
***************************
|
||||
|
||||
Spectral information with its parameters:
|
||||
|
||||
.. code-block:: json-object
|
||||
|
||||
"SI":[{
|
||||
"f_min": 191.3e12,
|
||||
"baud_rate": 32e9,
|
||||
"f_max":195.1e12,
|
||||
"spacing": 50e9,
|
||||
"power_dbm": 0,
|
||||
"power_range_db": [0,0,0.5],
|
||||
"roll_off": 0.15,
|
||||
"tx_osnr": 40,
|
||||
"sys_margins": 0
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
1.2.5. Transceiver element
|
||||
**************************
|
||||
|
||||
Transceiver element with its parameters. **”mode”** can contain multiple
|
||||
Transceiver operation formats.
|
||||
|
||||
Note that ``OSNR`` parameter refers to the receiver's minimal OSNR threshold for a given mode.
|
||||
|
||||
.. code-block:: json-object
|
||||
|
||||
"Transceiver":[{
|
||||
"frequency":{
|
||||
"min": 191.35e12,
|
||||
"max": 196.1e12
|
||||
},
|
||||
"mode":[
|
||||
{
|
||||
"format": "mode 1",
|
||||
"baud_rate": 32e9,
|
||||
"OSNR": 11,
|
||||
"bit_rate": 100e9,
|
||||
"roll_off": 0.15,
|
||||
"tx_osnr": 40,
|
||||
"min_spacing": 37.5e9,
|
||||
"cost":1
|
||||
},
|
||||
{
|
||||
"format": "mode 2",
|
||||
"baud_rate": 66e9,
|
||||
"OSNR": 15,
|
||||
"bit_rate": 200e9,
|
||||
"roll_off": 0.15,
|
||||
"tx_osnr": 40,
|
||||
"min_spacing": 75e9,
|
||||
"cost":1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
***********************
|
||||
2. Network description
|
||||
***********************
|
||||
|
||||
Network description defines network elements with additional to
|
||||
equipment description parameters, metadata and elements interconnection.
|
||||
Description is made in JSON file with predefined structure. By default
|
||||
**gnpy-transmission-example** uses **edfa_example_network.json** file
|
||||
and can be changed from command line. Parsing of JSON file is made with
|
||||
**gnpy.core.network.load_network(network_description,
|
||||
equipment_description)** and return value is **DiGraph** object which
|
||||
mimics network description.
|
||||
|
||||
2.1. Structure definition
|
||||
##########################
|
||||
|
||||
2.1.1. File root structure
|
||||
***************************
|
||||
|
||||
Network description JSON file root consist of three unordered parts:
|
||||
|
||||
- network_name – name of described network or service, is not used as
|
||||
of now
|
||||
|
||||
- elements - contains array of network element objects with their
|
||||
respective parameters
|
||||
|
||||
- connections – contains array of unidirectional connection objects
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
{"network_name": "Example Network",
|
||||
"elements": [{...},
|
||||
{...}
|
||||
],
|
||||
"connections": [{...},
|
||||
{...}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
2.1.2. Elements parameters and subtypes
|
||||
****************************************
|
||||
|
||||
Array of network element objects consist of unordered parameter names
|
||||
and those values. In case of **"type_variety"** absence
|
||||
**"type_variety":”default”** name:value combination is used. As of the
|
||||
moment, existence of used **"type_variety"** in equipment description is
|
||||
obligatory.
|
||||
|
||||
2.2. Element parameters by type
|
||||
*********************************
|
||||
|
||||
2.2.1. Transceiver element
|
||||
***************************
|
||||
|
||||
Transceiver element with its parameters.
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{"uid": "trx Site_A",
|
||||
"metadata": {
|
||||
"location": {
|
||||
"city": "Site_A",
|
||||
"region": "",
|
||||
"latitude": 0,
|
||||
"longitude": 0
|
||||
}
|
||||
},
|
||||
"type": "Transceiver"
|
||||
}
|
||||
|
||||
|
||||
|
||||
2.2.2. ROADM element
|
||||
*********************
|
||||
|
||||
ROADM element with its parameters. **“params”** is optional, if not used
|
||||
default loss value of 20dB is used.
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{"uid": "roadm Site_A",
|
||||
"metadata": {
|
||||
"location": {
|
||||
"city": "Site_A",
|
||||
"region": "",
|
||||
"latitude": 0,
|
||||
"longitude": 0
|
||||
}
|
||||
},
|
||||
"type": "Roadm",
|
||||
"params": {
|
||||
"loss": 17
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2.2.3. Fused element
|
||||
*********************
|
||||
|
||||
Fused element with its parameters. **“params”** is optional, if not used
|
||||
default loss value of 1dB is used.
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{"uid": "ingress fused spans in Site_B",
|
||||
"metadata": {
|
||||
"location": {
|
||||
"city": "Site_B",
|
||||
"region": "",
|
||||
"latitude": 0,
|
||||
"longitude": 0
|
||||
}
|
||||
},
|
||||
"type": "Fused",
|
||||
"params": {
|
||||
"loss": 0.5
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2.2.4. Fiber element
|
||||
*********************
|
||||
|
||||
Fiber element with its parameters.
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{"uid": "fiber (Site_A \\u2192 Site_B)",
|
||||
"metadata": {
|
||||
"location": {
|
||||
"city": "",
|
||||
"region": "",
|
||||
"latitude": 0.0,
|
||||
"longitude": 0.0
|
||||
}
|
||||
},
|
||||
"type": "Fiber",
|
||||
"type_variety": "SSMF",
|
||||
"params": {
|
||||
"length": 40.0,
|
||||
"length_units": "km",
|
||||
"loss_coef": 0.2
|
||||
}
|
||||
}
|
||||
|
||||
2.2.5. RamanFiber element
|
||||
*************************
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"uid": "Span1",
|
||||
"type": "RamanFiber",
|
||||
"type_variety": "SSMF",
|
||||
"operational": {
|
||||
"temperature": 283,
|
||||
"raman_pumps": [
|
||||
{
|
||||
"power": 200e-3,
|
||||
"frequency": 205e12,
|
||||
"propagation_direction": "counterprop"
|
||||
},
|
||||
{
|
||||
"power": 206e-3,
|
||||
"frequency": 201e12,
|
||||
"propagation_direction": "counterprop"
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"type_variety": "SSMF",
|
||||
"length": 80.0,
|
||||
"loss_coef": 0.2,
|
||||
"length_units": "km",
|
||||
"att_in": 0,
|
||||
"con_in": 0.5,
|
||||
"con_out": 0.5
|
||||
},
|
||||
"metadata": {
|
||||
"location": {
|
||||
"latitude": 1,
|
||||
"longitude": 0,
|
||||
"city": null,
|
||||
"region": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2.2.6. EDFA element
|
||||
********************
|
||||
|
||||
EDFA element with its parameters.
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{"uid": "Edfa1",
|
||||
"type": "Edfa",
|
||||
"type_variety": "std_low_gain",
|
||||
"operational": {
|
||||
"gain_target": 16,
|
||||
"tilt_target": 0
|
||||
},
|
||||
"metadata": {
|
||||
"location": {
|
||||
"city": "Site_A",
|
||||
"region": "",
|
||||
"latitude": 2,
|
||||
"longitude": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2.3. Connections objects
|
||||
*************************
|
||||
|
||||
Each unidirectional connection object in connections array consist of
|
||||
two unordered **”from_node”** and **”to_node”** name pair with values
|
||||
corresponding to element **”uid”**
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{"from_node": "roadm Site_C",
|
||||
"to_node": "trx Site_C"
|
||||
}
|
||||
|
||||
************************
|
||||
3. Simulation Parameters
|
||||
************************
|
||||
|
||||
Additional details of the simulation are controlled via ``sim_params.json``:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"raman_parameters": {
|
||||
"flag_raman": true,
|
||||
"space_resolution": 10e3,
|
||||
"tolerance": 1e-8
|
||||
},
|
||||
"nli_parameters": {
|
||||
"nli_method_name": "ggn_spectrally_separated",
|
||||
"wdm_grid_size": 50e9,
|
||||
"dispersion_tolerance": 1,
|
||||
"phase_shift_tolerance": 0.1,
|
||||
"computed_channels": [1, 18, 37, 56, 75]
|
||||
}
|
||||
}
|
||||
31
tests/data/copy_default_edfa_config.json
Normal file
31
tests/data/copy_default_edfa_config.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"nf_ripple": [
|
||||
0.0
|
||||
],
|
||||
"gain_ripple": [
|
||||
0.0
|
||||
],
|
||||
"f_min": 191.275e12,
|
||||
"f_max": 196.125e12,
|
||||
"dgt": [
|
||||
1.0, 1.017807767853702, 1.0356155337864215, 1.0534217504465226, 1.0712204022764056, 1.0895983485572227,
|
||||
1.108555289615659, 1.1280891949729075, 1.1476135933863398, 1.1672278304018044, 1.1869318618366975,
|
||||
1.2067249615595257, 1.2264996957264114, 1.2428104897182262, 1.2556591482982988, 1.2650555289898042,
|
||||
1.2744470198196236, 1.2838336236692311, 1.2932153453410835, 1.3040618749785347, 1.316383926863083,
|
||||
1.3301807335621048, 1.3439818461440451, 1.3598972673004606, 1.3779439775587023, 1.3981208704326855,
|
||||
1.418273806730323, 1.4340878115214444, 1.445565137158368, 1.45273959485914, 1.4599103316162523,
|
||||
1.4670307626366115, 1.474100442252211, 1.48111939735681, 1.488134243479226, 1.495145456062699,
|
||||
1.502153039909686, 1.5097346239790443, 1.5178910621476225, 1.5266220576235803, 1.5353620432989845,
|
||||
1.545374152761467, 1.5566577309558969, 1.569199764184379, 1.5817353179379183, 1.5986915141218316,
|
||||
1.6201194134191075, 1.6460167077689267, 1.6719047669939942, 1.6918150918099673, 1.7057507692361864,
|
||||
1.7137640932265894, 1.7217732861435076, 1.7297783508684146, 1.737780757913635, 1.7459181197626403,
|
||||
1.7541903672600494, 1.7625959636196327, 1.7709972329654864, 1.7793941781790852, 1.7877868031023945,
|
||||
1.7961751115773796, 1.8045606557581335, 1.8139629377087627, 1.824381436842932, 1.835814081380705,
|
||||
1.847275503201129, 1.862235672444246, 1.8806927939516411, 1.9026104247588487, 1.9245345552113182,
|
||||
1.9482128147680253, 1.9736443063300082, 2.0008103857988204, 2.0279625371819305, 2.055100772005235,
|
||||
2.082225099873648, 2.1183028432496016, 2.16337565384239, 2.2174389328192197, 2.271520771371253,
|
||||
2.322373696229342, 2.3699990328716107, 2.414398437185221, 2.4587748041127506, 2.499446286796604,
|
||||
2.5364027376452056, 2.5696460593920065, 2.602860350286428, 2.630396440815385, 2.6521732021128046,
|
||||
2.6681935771243177, 2.6841217449620203, 2.6947834587664494, 2.705443819238505, 2.714526681131686
|
||||
]
|
||||
}
|
||||
@@ -1,298 +0,0 @@
|
||||
{
|
||||
"f_min": 191.275e12,
|
||||
"f_max": 196.125e12,
|
||||
"nf_ripple": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"gain_ripple": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"dgt": [
|
||||
1.0,
|
||||
1.017807767853702,
|
||||
1.0356155337864215,
|
||||
1.0534217504465226,
|
||||
1.0712204022764056,
|
||||
1.0895983485572227,
|
||||
1.108555289615659,
|
||||
1.1280891949729075,
|
||||
1.1476135933863398,
|
||||
1.1672278304018044,
|
||||
1.1869318618366975,
|
||||
1.2067249615595257,
|
||||
1.2264996957264114,
|
||||
1.2428104897182262,
|
||||
1.2556591482982988,
|
||||
1.2650555289898042,
|
||||
1.2744470198196236,
|
||||
1.2838336236692311,
|
||||
1.2932153453410835,
|
||||
1.3040618749785347,
|
||||
1.316383926863083,
|
||||
1.3301807335621048,
|
||||
1.3439818461440451,
|
||||
1.3598972673004606,
|
||||
1.3779439775587023,
|
||||
1.3981208704326855,
|
||||
1.418273806730323,
|
||||
1.4340878115214444,
|
||||
1.445565137158368,
|
||||
1.45273959485914,
|
||||
1.4599103316162523,
|
||||
1.4670307626366115,
|
||||
1.474100442252211,
|
||||
1.48111939735681,
|
||||
1.488134243479226,
|
||||
1.495145456062699,
|
||||
1.502153039909686,
|
||||
1.5097346239790443,
|
||||
1.5178910621476225,
|
||||
1.5266220576235803,
|
||||
1.5353620432989845,
|
||||
1.545374152761467,
|
||||
1.5566577309558969,
|
||||
1.569199764184379,
|
||||
1.5817353179379183,
|
||||
1.5986915141218316,
|
||||
1.6201194134191075,
|
||||
1.6460167077689267,
|
||||
1.6719047669939942,
|
||||
1.6918150918099673,
|
||||
1.7057507692361864,
|
||||
1.7137640932265894,
|
||||
1.7217732861435076,
|
||||
1.7297783508684146,
|
||||
1.737780757913635,
|
||||
1.7459181197626403,
|
||||
1.7541903672600494,
|
||||
1.7625959636196327,
|
||||
1.7709972329654864,
|
||||
1.7793941781790852,
|
||||
1.7877868031023945,
|
||||
1.7961751115773796,
|
||||
1.8045606557581335,
|
||||
1.8139629377087627,
|
||||
1.824381436842932,
|
||||
1.835814081380705,
|
||||
1.847275503201129,
|
||||
1.862235672444246,
|
||||
1.8806927939516411,
|
||||
1.9026104247588487,
|
||||
1.9245345552113182,
|
||||
1.9482128147680253,
|
||||
1.9736443063300082,
|
||||
2.0008103857988204,
|
||||
2.0279625371819305,
|
||||
2.055100772005235,
|
||||
2.082225099873648,
|
||||
2.1183028432496016,
|
||||
2.16337565384239,
|
||||
2.2174389328192197,
|
||||
2.271520771371253,
|
||||
2.322373696229342,
|
||||
2.3699990328716107,
|
||||
2.414398437185221,
|
||||
2.4587748041127506,
|
||||
2.499446286796604,
|
||||
2.5364027376452056,
|
||||
2.5696460593920065,
|
||||
2.602860350286428,
|
||||
2.630396440815385,
|
||||
2.6521732021128046,
|
||||
2.6681935771243177,
|
||||
2.6841217449620203,
|
||||
2.6947834587664494,
|
||||
2.705443819238505,
|
||||
2.714526681131686
|
||||
]
|
||||
}
|
||||
37
tests/data/extra_eqpt_config.json
Normal file
37
tests/data/extra_eqpt_config.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"Transceiver": [
|
||||
{
|
||||
"type_variety": "ZR400G",
|
||||
"frequency": {
|
||||
"min": 191.35e12,
|
||||
"max": 196.1e12
|
||||
},
|
||||
"mode": [
|
||||
{
|
||||
"format": "400G",
|
||||
"baud_rate": 60e9,
|
||||
"OSNR": 24,
|
||||
"bit_rate": 400e9,
|
||||
"roll_off": 0.2,
|
||||
"tx_osnr": 38,
|
||||
"min_spacing": 75e9,
|
||||
"cost": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Edfa": [
|
||||
{
|
||||
"type_variety": "user_defined_default_amplifier",
|
||||
"type_def": "variable_gain",
|
||||
"gain_flatmax": 25,
|
||||
"gain_min": 15,
|
||||
"p_max": 21,
|
||||
"nf_min": 6,
|
||||
"nf_max": 10,
|
||||
"advanced_config_from_json": "default_edfa_config.json",
|
||||
"out_voa_auto": false,
|
||||
"allowed_for_design": false
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
tests/data/ila_constraint.xlsx
Executable file
BIN
tests/data/ila_constraint.xlsx
Executable file
Binary file not shown.
Binary file not shown.
@@ -63,7 +63,7 @@
|
||||
{
|
||||
"uid": "roadm Lannion_CAS",
|
||||
"type": "Roadm",
|
||||
"type_variety": "default",
|
||||
"type_variety": "example_detailed_impairments",
|
||||
"params": {
|
||||
"target_pch_out_db": -18.6,
|
||||
"restrictions": {
|
||||
@@ -74,7 +74,14 @@
|
||||
"east edfa in Lannion_CAS to Corlay": -18.6,
|
||||
"east edfa in Lannion_CAS to Morlaix": -23.0,
|
||||
"east edfa in Lannion_CAS to Stbrieuc": -20
|
||||
},
|
||||
"per_degree_impairments": [
|
||||
{
|
||||
"from_degree": "west edfa in Lannion_CAS to Morlaix",
|
||||
"to_degree": "east edfa in Lannion_CAS to Stbrieuc",
|
||||
"impairment_id": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"metadata": {
|
||||
"location": {
|
||||
|
||||
@@ -62,7 +62,12 @@
|
||||
},
|
||||
{
|
||||
"uid": "roadm Lannion_CAS",
|
||||
"type_variety": "example_detailed_impairments",
|
||||
"params": {
|
||||
"per_degree_impairments": [{
|
||||
"from_degree": "west edfa in Lannion_CAS to Morlaix",
|
||||
"impairment_id": 0,
|
||||
"to_degree": "east edfa in Lannion_CAS to Stbrieuc"}],
|
||||
"per_degree_pch_out_db": {
|
||||
"east edfa in Lannion_CAS to Corlay": -18.6,
|
||||
"east edfa in Lannion_CAS to Morlaix": -23.0
|
||||
@@ -661,7 +666,7 @@
|
||||
"type": "Edfa",
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"tilt_target": 0
|
||||
"tilt_target": null
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -677,7 +682,7 @@
|
||||
"type": "Edfa",
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"tilt_target": 0
|
||||
"tilt_target": null
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -693,7 +698,7 @@
|
||||
"type": "Edfa",
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"tilt_target": 0
|
||||
"tilt_target": null
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -709,7 +714,7 @@
|
||||
"type": "Edfa",
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"tilt_target": 0
|
||||
"tilt_target": null
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -727,7 +732,7 @@
|
||||
"operational": {
|
||||
"gain_target": 20.0,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -761,7 +766,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -779,7 +784,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -797,7 +802,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -815,7 +820,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -833,7 +838,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -851,7 +856,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -869,7 +874,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -887,7 +892,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -905,7 +910,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -923,7 +928,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -941,7 +946,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -959,7 +964,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -978,7 +983,7 @@
|
||||
"operational": {
|
||||
"gain_target": 18.0,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -996,7 +1001,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1014,7 +1019,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1032,7 +1037,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1171,7 +1171,7 @@
|
||||
"operational": {
|
||||
"gain_target": 19.0,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1190,7 +1190,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1209,7 +1209,7 @@
|
||||
"operational": {
|
||||
"gain_target": 18.0,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": 0.5
|
||||
}
|
||||
},
|
||||
@@ -1227,7 +1227,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1245,7 +1245,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1263,7 +1263,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1281,7 +1281,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1299,7 +1299,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1318,7 +1318,7 @@
|
||||
"operational": {
|
||||
"gain_target": 18.5,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1336,7 +1336,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1354,7 +1354,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1372,7 +1372,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1391,7 +1391,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1409,7 +1409,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1428,7 +1428,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1446,7 +1446,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1464,7 +1464,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1482,7 +1482,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1500,7 +1500,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1518,7 +1518,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1551,7 +1551,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1569,7 +1569,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1587,7 +1587,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1605,7 +1605,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1623,7 +1623,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1641,7 +1641,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1659,7 +1659,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1677,7 +1677,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1695,7 +1695,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1713,7 +1713,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1731,7 +1731,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1749,7 +1749,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1768,7 +1768,7 @@
|
||||
"operational": {
|
||||
"gain_target": 18.0,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1786,7 +1786,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1805,7 +1805,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1823,7 +1823,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1841,7 +1841,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1859,7 +1859,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1877,7 +1877,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1895,7 +1895,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1913,7 +1913,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1931,7 +1931,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1949,7 +1949,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1967,7 +1967,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -1985,7 +1985,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2003,7 +2003,7 @@
|
||||
"operational": {
|
||||
"gain_target": 19.0,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2021,7 +2021,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2039,7 +2039,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2057,7 +2057,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2075,7 +2075,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2093,7 +2093,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2111,7 +2111,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2129,7 +2129,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2147,7 +2147,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2165,7 +2165,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2183,7 +2183,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2201,7 +2201,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2219,7 +2219,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2237,7 +2237,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2255,7 +2255,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2273,7 +2273,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2291,7 +2291,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2309,7 +2309,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2327,7 +2327,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
},
|
||||
@@ -2345,7 +2345,7 @@
|
||||
"operational": {
|
||||
"gain_target": null,
|
||||
"delta_p": null,
|
||||
"tilt_target": 0,
|
||||
"tilt_target": null,
|
||||
"out_voa": null
|
||||
}
|
||||
}
|
||||
|
||||
154
tests/data/user_edfa_config.json
Normal file
154
tests/data/user_edfa_config.json
Normal file
@@ -0,0 +1,154 @@
|
||||
{
|
||||
"f_min": 193.0e12,
|
||||
"f_max": 195.0e12,
|
||||
"nf_ripple": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"gain_ripple": [
|
||||
-0.15656302345061,
|
||||
-0.22244242043552,
|
||||
-0.25188965661642,
|
||||
-0.23575900335007,
|
||||
-0.20897508375209,
|
||||
-0.19440221943049,
|
||||
-0.18324644053602,
|
||||
-0.18053287269681,
|
||||
-0.17113588777219,
|
||||
-0.15460322445561,
|
||||
-0.13550774706866,
|
||||
-0.10606051088777,
|
||||
-0.0765630234506,
|
||||
-0.04962835008375,
|
||||
-0.01319618927973,
|
||||
0.01027114740367,
|
||||
0.03378873534338,
|
||||
0.04961788107202,
|
||||
0.04494451423784,
|
||||
0.0399193886097,
|
||||
0.01584903685091,
|
||||
-0.00420121440538,
|
||||
-0.01847257118928,
|
||||
-0.02475397822447,
|
||||
-0.01053287269681,
|
||||
0.01509526800668,
|
||||
0.05921587102177,
|
||||
0.1191656197655,
|
||||
0.18147717755444,
|
||||
0.23579878559464,
|
||||
0.26941687604691,
|
||||
0.27836159966498,
|
||||
0.26956762981574,
|
||||
0.23826109715241,
|
||||
0.18936662479061,
|
||||
0.1204721524288,
|
||||
0.0453465242881,
|
||||
-0.00877407872698,
|
||||
-0.02199015912898,
|
||||
0.00107516750419,
|
||||
0.02795958961474,
|
||||
0.02740682579566,
|
||||
-0.01028161641541,
|
||||
-0.05982935510889,
|
||||
-0.06701528475711,
|
||||
0.00223094639866,
|
||||
0.14157768006701,
|
||||
0.15017064489112
|
||||
],
|
||||
"dgt": [
|
||||
2.714526681131686,
|
||||
2.6947834587664494,
|
||||
2.630396440815385,
|
||||
2.602860350286428,
|
||||
2.5696460593920065,
|
||||
2.5364027376452056,
|
||||
2.414398437185221,
|
||||
2.2174389328192197,
|
||||
2.16337565384239,
|
||||
2.1183028432496016,
|
||||
2.082225099873648,
|
||||
2.0279625371819305,
|
||||
1.9245345552113182,
|
||||
1.8806927939516411,
|
||||
1.862235672444246,
|
||||
1.847275503201129,
|
||||
1.8045606557581335,
|
||||
1.7793941781790852,
|
||||
1.737780757913635,
|
||||
1.7297783508684146,
|
||||
1.7057507692361864,
|
||||
1.6201194134191075,
|
||||
1.5986915141218316,
|
||||
1.5817353179379183,
|
||||
1.5353620432989845,
|
||||
1.5097346239790443,
|
||||
1.4670307626366115,
|
||||
1.445565137158368,
|
||||
1.4340878115214444,
|
||||
1.418273806730323,
|
||||
1.3981208704326855,
|
||||
1.3779439775587023,
|
||||
1.3598972673004606,
|
||||
1.3439818461440451,
|
||||
1.316383926863083,
|
||||
1.2932153453410835,
|
||||
1.2744470198196236,
|
||||
1.2650555289898042,
|
||||
1.2556591482982988,
|
||||
1.2428104897182262,
|
||||
1.1672278304018044,
|
||||
1.1476135933863398,
|
||||
1.1280891949729075,
|
||||
1.108555289615659,
|
||||
1.0895983485572227,
|
||||
1.0712204022764056,
|
||||
1.017807767853702,
|
||||
1.0
|
||||
]
|
||||
}
|
||||
33
tests/invocation/logs_path_requests_run_extra_equipment
Normal file
33
tests/invocation/logs_path_requests_run_extra_equipment
Normal file
@@ -0,0 +1,33 @@
|
||||
INFO gnpy.tools.cli_examples:cli_examples.py Computing path requests service_pluggable.json into JSON format
|
||||
WARNING gnpy.tools.json_io:json_io.py
|
||||
WARNING missing type_variety attribute in eqpt_config.json[Roadm]
|
||||
default value is type_variety = default
|
||||
|
||||
WARNING gnpy.tools.json_io:json_io.py
|
||||
Equipment file extra_eqpt_config.json: duplicate equipment entry found: Transceiver-ZR400G
|
||||
|
||||
INFO gnpy.tools.worker_utils:worker_utils.py List of disjunctions:
|
||||
[]
|
||||
INFO gnpy.tools.worker_utils:worker_utils.py Aggregating similar requests
|
||||
INFO gnpy.tools.worker_utils:worker_utils.py The following services have been requested:
|
||||
[PathRequest 0
|
||||
source: trx Brest_KLA
|
||||
destination: trx Lannion_CAS
|
||||
trx type: ZR400G
|
||||
trx mode: SFF-ID:70
|
||||
baud_rate: 60.13854679800001 Gbaud
|
||||
bit_rate: 400.0 Gb/s
|
||||
spacing: 100.0 GHz
|
||||
power: 0.0 dBm
|
||||
tx_power_dbm: 1.76 dBm
|
||||
nb channels: 48
|
||||
path_bandwidth: 400.0 Gbit/s
|
||||
nodes-list: []
|
||||
loose-list: []
|
||||
]
|
||||
INFO gnpy.tools.worker_utils:worker_utils.py Propagating on selected path
|
||||
INFO gnpy.topology.request:request.py
|
||||
request 0
|
||||
Computing path from trx Brest_KLA to trx Lannion_CAS
|
||||
with path constraint: ['trx Brest_KLA', 'trx Lannion_CAS']
|
||||
Computed path (roadms):['roadm Brest_KLA', 'roadm Lannion_CAS']
|
||||
@@ -14,6 +14,11 @@ WARNING gnpy.core.network:network.py
|
||||
is above user specified amplifier std_low_gain
|
||||
max flat gain: 16dB ; required gain: 21.22dB. Please check amplifier type.
|
||||
|
||||
WARNING gnpy.core.network:network.py
|
||||
WARNING: effective gain in Node east edfa in Stbrieuc to Rennes_STA
|
||||
is below user specified amplifier std_medium_gain
|
||||
min gain: 15dB ; required gain: 12.0dB. Please check amplifier type.
|
||||
|
||||
WARNING gnpy.core.network:network.py
|
||||
WARNING: target gain and power in node west edfa in Rennes_STA to Stbrieuc
|
||||
is beyond all available amplifiers capabilities and/or extended_gain_range:
|
||||
|
||||
@@ -14,6 +14,11 @@ WARNING gnpy.core.network:network.py
|
||||
is above user specified amplifier std_low_gain
|
||||
max flat gain: 16dB ; required gain: 21.18dB. Please check amplifier type.
|
||||
|
||||
WARNING gnpy.core.network:network.py
|
||||
WARNING: effective gain in Node east edfa in Stbrieuc to Rennes_STA
|
||||
is below user specified amplifier std_medium_gain
|
||||
min gain: 15dB ; required gain: 12.0dB. Please check amplifier type.
|
||||
|
||||
WARNING gnpy.core.network:network.py
|
||||
WARNING: target gain and power in node west edfa in Rennes_STA to Stbrieuc
|
||||
is beyond all available amplifiers capabilities and/or extended_gain_range:
|
||||
|
||||
22
tests/invocation/path_requests_run_extra_equipment
Normal file
22
tests/invocation/path_requests_run_extra_equipment
Normal file
@@ -0,0 +1,22 @@
|
||||
[1;34;40mList of disjunctions[0m
|
||||
[]
|
||||
[1;34;40mThe following services have been requested:[0m
|
||||
[PathRequest 0
|
||||
source: trx Brest_KLA
|
||||
destination: trx Lannion_CAS
|
||||
trx type: ZR400G
|
||||
trx mode: SFF-ID:70
|
||||
baud_rate: 60.13854679800001 Gbaud
|
||||
bit_rate: 400.0 Gb/s
|
||||
spacing: 100.0 GHz
|
||||
power: 0.0 dBm
|
||||
tx_power_dbm: 1.76 dBm
|
||||
nb channels: 48
|
||||
path_bandwidth: 400.0 Gbit/s
|
||||
nodes-list: []
|
||||
loose-list: []
|
||||
]
|
||||
[1;34;40mResult summary[0m
|
||||
req id demand GSNR@bandwidth A-Z (Z-A) GSNR@0.1nm A-Z (Z-A) Receiver minOSNR mode Gbit/s nb of tsp pairs N,M or blocking reason
|
||||
0 trx Brest_KLA to trx Lannion_CAS : 21.3 28.12 26 SFF-ID:70 400.0 1 ([-280],[8])
|
||||
[1;33;40mResult summary shows mean GSNR and OSNR (average over all channels)[0m
|
||||
@@ -17,6 +17,8 @@ TEST_DIR = Path(__file__).parent
|
||||
DATA_DIR = TEST_DIR / 'data'
|
||||
test_network = DATA_DIR / 'test_network.json'
|
||||
eqpt_library = DATA_DIR / 'eqpt_config.json'
|
||||
extra_configs = {"std_medium_gain_advanced_config.json": DATA_DIR / "std_medium_gain_advanced_config.json",
|
||||
"Juniper-BoosterHG.json": DATA_DIR / "Juniper-BoosterHG.json"}
|
||||
|
||||
# TODO in elements.py code: pytests doesn't pass with 1 channel: interpolate fail
|
||||
|
||||
@@ -39,7 +41,7 @@ def bw():
|
||||
def setup_edfa_variable_gain():
|
||||
"""init edfa class by reading test_network.json file
|
||||
remove all gain and nf ripple"""
|
||||
equipment = load_equipment(eqpt_library)
|
||||
equipment = load_equipment(eqpt_library, extra_configs)
|
||||
network = load_network(test_network, equipment)
|
||||
build_network(network, equipment, 0, 20)
|
||||
edfa = [n for n in network.nodes() if isinstance(n, Edfa)][0]
|
||||
@@ -51,7 +53,7 @@ def setup_edfa_variable_gain():
|
||||
@pytest.fixture()
|
||||
def setup_edfa_fixed_gain():
|
||||
"""init edfa class by reading the 2nd edfa in test_network.json file"""
|
||||
equipment = load_equipment(eqpt_library)
|
||||
equipment = load_equipment(eqpt_library, extra_configs)
|
||||
network = load_network(test_network, equipment)
|
||||
build_network(network, equipment, 0, 20)
|
||||
edfa = [n for n in network.nodes() if isinstance(n, Edfa)][1]
|
||||
@@ -61,7 +63,7 @@ def setup_edfa_fixed_gain():
|
||||
@pytest.fixture()
|
||||
def setup_trx():
|
||||
"""init transceiver class to access snr and osnr calculations"""
|
||||
equipment = load_equipment(eqpt_library)
|
||||
equipment = load_equipment(eqpt_library, extra_configs)
|
||||
network = load_network(test_network, equipment)
|
||||
build_network(network, equipment, 0, 20)
|
||||
trx = [n for n in network.nodes() if isinstance(n, Transceiver)][0]
|
||||
@@ -144,7 +146,7 @@ def test_compare_nf_models(gain, setup_edfa_variable_gain, si):
|
||||
}
|
||||
}
|
||||
}
|
||||
equipment = load_equipment(eqpt_library)
|
||||
equipment = load_equipment(eqpt_library, extra_configs)
|
||||
extra_params = equipment['Edfa']['CienaDB_medium_gain']
|
||||
temp = el_config.setdefault('params', {})
|
||||
temp = merge_amplifier_restrictions(temp, extra_params.__dict__)
|
||||
@@ -165,7 +167,7 @@ def test_ase_noise(gain, si, setup_trx, bw):
|
||||
2-pout/pase afet propagate
|
||||
3-Transceiver osnr_ase_01nm
|
||||
=> unitary test for Edfa.noise_profile (Edfa.interpol_params, Edfa.propagate)"""
|
||||
equipment = load_equipment(eqpt_library)
|
||||
equipment = load_equipment(eqpt_library, extra_configs)
|
||||
network = load_network(test_network, equipment)
|
||||
edfa = next(n for n in network.nodes() if n.uid == 'Edfa1')
|
||||
span = next(n for n in network.nodes() if n.uid == 'Span1')
|
||||
@@ -225,7 +227,7 @@ def test_amp_behaviour(tilt_target, delta_p):
|
||||
}],
|
||||
"connections": []
|
||||
}
|
||||
equipment = load_equipment(eqpt_library)
|
||||
equipment = load_equipment(eqpt_library, extra_configs)
|
||||
network = network_from_json(json_data, equipment)
|
||||
edfa = [n for n in network.nodes() if isinstance(n, Edfa)][0]
|
||||
fiber = [n for n in network.nodes() if isinstance(n, Fiber)][0]
|
||||
@@ -310,7 +312,7 @@ def test_amp_saturation(delta_pdb_per_channel, base_power, delta_p):
|
||||
}],
|
||||
"connections": []
|
||||
}
|
||||
equipment = load_equipment(eqpt_library)
|
||||
equipment = load_equipment(eqpt_library, extra_configs)
|
||||
network = network_from_json(json_data, equipment)
|
||||
edfa = [n for n in network.nodes()][0]
|
||||
frequency = 193e12 + array([0, 50e9, 150e9, 225e9, 275e9])
|
||||
@@ -354,7 +356,7 @@ def test_set_out_voa():
|
||||
}],
|
||||
"connections": []
|
||||
}
|
||||
equipment = load_equipment(eqpt_library)
|
||||
equipment = load_equipment(eqpt_library, extra_configs)
|
||||
network = network_from_json(json_data, equipment)
|
||||
amp = [n for n in network.nodes()][0]
|
||||
print(amp.out_voa)
|
||||
@@ -408,7 +410,7 @@ def test_multiband():
|
||||
]
|
||||
equipment_json['Edfa'].extend(amps)
|
||||
|
||||
equipment = _equipment_from_json(equipment_json, eqpt_library)
|
||||
equipment = _equipment_from_json(equipment_json, extra_configs)
|
||||
|
||||
el_config = {
|
||||
"uid": "Edfa1",
|
||||
@@ -505,3 +507,165 @@ def test_multiband():
|
||||
assert freq >= 191.25e12
|
||||
if freq < 191.25e12:
|
||||
assert freq <= 190.25e12
|
||||
|
||||
|
||||
def test_user_defined_config():
|
||||
"""Checks that a user defined config is correctly used instead of DEFAULT_EDFA_CONFIG
|
||||
"""
|
||||
extra_configs['user_edfa_config.json'] = DATA_DIR / 'user_edfa_config.json'
|
||||
user_edfa = {
|
||||
"type_variety": "user_defined",
|
||||
"type_def": "variable_gain",
|
||||
"gain_flatmax": 25,
|
||||
"gain_min": 15,
|
||||
"p_max": 21,
|
||||
"nf_min": 6,
|
||||
"nf_max": 10,
|
||||
"default_config_from_json": "user_edfa_config.json",
|
||||
"out_voa_auto": False,
|
||||
"allowed_for_design": True
|
||||
}
|
||||
|
||||
# add the reference to
|
||||
json_data = load_json(eqpt_library)
|
||||
json_data['Edfa'].append(user_edfa)
|
||||
equipment = _equipment_from_json(json_data, extra_configs)
|
||||
json_data = {
|
||||
"elements": [{
|
||||
"uid": "Edfa1",
|
||||
"type": "Edfa",
|
||||
"type_variety": "user_defined",
|
||||
"operational": {
|
||||
"delta_p": -3,
|
||||
"gain_target": 20,
|
||||
"tilt_target": 0,
|
||||
"out_voa": 0
|
||||
}
|
||||
}],
|
||||
"connections": []
|
||||
}
|
||||
network = network_from_json(json_data, equipment)
|
||||
amp = [n for n in network.nodes()][0]
|
||||
assert_allclose(amp.params.f_min, 193.0e12, rtol=1e-13)
|
||||
assert_allclose(amp.params.f_max, 195.0e12, rtol=1e-13)
|
||||
assert_allclose(amp.params.gain_ripple[15], 0.01027114740367, rtol=1e-13)
|
||||
assert_allclose(amp.params.nf_ripple[15], 0.0, rtol=1e-13)
|
||||
assert_allclose(amp.params.dgt[15], 1.847275503201129, rtol=1e-13)
|
||||
|
||||
|
||||
def test_default_config():
|
||||
"""Checks that a config using a file gives the exact same result as the default config if values are identical
|
||||
to DEFAULT_EDFA_CONFIG
|
||||
"""
|
||||
extra_configs['copy_default_edfa_config.json'] = DATA_DIR / 'copy_default_edfa_config.json'
|
||||
user_edfa = {
|
||||
"type_variety": "user_defined",
|
||||
"type_def": "variable_gain",
|
||||
"gain_flatmax": 25,
|
||||
"gain_min": 15,
|
||||
"p_max": 21,
|
||||
"nf_min": 6,
|
||||
"nf_max": 10,
|
||||
"default_config_from_json": "copy_default_edfa_config.json",
|
||||
"out_voa_auto": False,
|
||||
"allowed_for_design": True
|
||||
}
|
||||
|
||||
default_edfa = {
|
||||
"type_variety": "default",
|
||||
"type_def": "variable_gain",
|
||||
"gain_flatmax": 25,
|
||||
"gain_min": 15,
|
||||
"p_max": 21,
|
||||
"nf_min": 6,
|
||||
"nf_max": 10,
|
||||
"out_voa_auto": False,
|
||||
"allowed_for_design": True
|
||||
}
|
||||
|
||||
# add the reference to
|
||||
json_data = load_json(eqpt_library)
|
||||
json_data['Edfa'].append(user_edfa)
|
||||
json_data['Edfa'].append(default_edfa)
|
||||
equipment = _equipment_from_json(json_data, extra_configs)
|
||||
json_data = {
|
||||
"elements": [{
|
||||
"uid": "Edfa1",
|
||||
"type": "Edfa",
|
||||
"type_variety": "user_defined",
|
||||
"operational": {
|
||||
"delta_p": -3,
|
||||
"gain_target": 20,
|
||||
"tilt_target": 0,
|
||||
"out_voa": 0
|
||||
}
|
||||
}, {
|
||||
"uid": "Edfa2",
|
||||
"type": "Edfa",
|
||||
"type_variety": "default",
|
||||
"operational": {
|
||||
"delta_p": -3,
|
||||
"gain_target": 20,
|
||||
"tilt_target": 0,
|
||||
"out_voa": 0
|
||||
}
|
||||
}],
|
||||
"connections": []
|
||||
}
|
||||
network = network_from_json(json_data, equipment)
|
||||
amp1, amp2 = [n for n in network.nodes()]
|
||||
assert_allclose(amp1.params.f_min, amp2.params.f_min, rtol=1e-13)
|
||||
assert_allclose(amp1.params.f_max, amp2.params.f_max, rtol=1e-13)
|
||||
assert_allclose(amp1.params.gain_ripple, amp2.params.gain_ripple, rtol=1e-13)
|
||||
assert_allclose(amp1.params.nf_ripple, amp2.params.nf_ripple, rtol=1e-13)
|
||||
assert_allclose(amp1.params.dgt, amp2.params.dgt, rtol=1e-13)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("file", [None, {"name": "copy_default_edfa_config.json",
|
||||
"path": DATA_DIR / "copy_default_edfa_config.json"}])
|
||||
def test_frequency_range(file):
|
||||
"""Checks that a frequency range is correctly read from the library and pre-empts DEFAULT_EDFA_CONFIG
|
||||
"""
|
||||
user_edfa = {
|
||||
"type_variety": "user_defined",
|
||||
"type_def": "variable_gain",
|
||||
"f_min": 192.0e12,
|
||||
"f_max": 195.9e12,
|
||||
"gain_flatmax": 25,
|
||||
"gain_min": 15,
|
||||
"p_max": 21,
|
||||
"nf_min": 6,
|
||||
"nf_max": 10,
|
||||
"out_voa_auto": False,
|
||||
"allowed_for_design": True
|
||||
}
|
||||
if file:
|
||||
user_edfa["default_config_from_json"] = file['name']
|
||||
extra_configs[file['name']] = file['path']
|
||||
# add the reference to
|
||||
json_data = load_json(eqpt_library)
|
||||
json_data['Edfa'].append(user_edfa)
|
||||
equipment = _equipment_from_json(json_data, extra_configs)
|
||||
json_data = {
|
||||
"elements": [{
|
||||
"uid": "Edfa1",
|
||||
"type": "Edfa",
|
||||
"type_variety": "user_defined",
|
||||
"operational": {
|
||||
"delta_p": -3,
|
||||
"gain_target": 20,
|
||||
"tilt_target": 0,
|
||||
"out_voa": 0
|
||||
}
|
||||
}],
|
||||
"connections": []
|
||||
}
|
||||
network = network_from_json(json_data, equipment)
|
||||
amp = [n for n in network.nodes()][0]
|
||||
si = create_input_spectral_information(f_min=191.3e12, f_max=196.05e12, roll_off=0.15, baud_rate=64e9,
|
||||
spacing=75e9, tx_osnr=None, tx_power=1e-5)
|
||||
si = amp(si)
|
||||
assert_allclose(amp.params.f_min, 192.0e12, rtol=1e-13)
|
||||
assert_allclose(amp.params.f_max, 195.9e12, rtol=1e-13)
|
||||
assert si.frequency[0] >= 192.0e12 + 75e9 / 2
|
||||
assert si.frequency[-1] <= 195.9e12 - 75e9 / 2
|
||||
|
||||
@@ -26,10 +26,13 @@ from gnpy.tools.json_io import load_network, load_equipment, requests_from_json,
|
||||
_equipment_from_json
|
||||
|
||||
|
||||
network_file_name = Path(__file__).parent.parent / 'tests/data/testTopology_expected.json'
|
||||
service_file_name = Path(__file__).parent.parent / 'tests/data/testTopology_testservices.json'
|
||||
result_file_name = Path(__file__).parent.parent / 'tests/data/testTopology_testresults.json'
|
||||
eqpt_library_name = Path(__file__).parent.parent / 'tests/data/eqpt_config.json'
|
||||
data_dir = Path(__file__).parent.parent / 'tests/data'
|
||||
network_file_name = data_dir / 'testTopology_expected.json'
|
||||
service_file_name = data_dir / 'testTopology_testservices.json'
|
||||
result_file_name = data_dir / 'testTopology_testresults.json'
|
||||
eqpt_library_name = data_dir / 'eqpt_config.json'
|
||||
extra_configs = {"std_medium_gain_advanced_config.json": data_dir / "std_medium_gain_advanced_config.json",
|
||||
"Juniper-BoosterHG.json": data_dir / "Juniper-BoosterHG.json"}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("net", [network_file_name])
|
||||
@@ -39,7 +42,7 @@ eqpt_library_name = Path(__file__).parent.parent / 'tests/data/eqpt_config.json'
|
||||
'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)
|
||||
equipment = load_equipment(eqpt, extra_configs)
|
||||
network = load_network(net, equipment)
|
||||
data = load_requests(serv, eqpt, bidir=False, network=network, network_filename=net)
|
||||
|
||||
@@ -155,7 +158,7 @@ def test_propagate_and_optimize_mode(caplog):
|
||||
# change default ROADM PDL so that crossing 2 ROADMs leasd to inifinte penalty for mode 1
|
||||
eqpt_roadm = next(r for r in json_data['Roadm'] if 'type_variety' not in r)
|
||||
eqpt_roadm['pdl'] = 0.5
|
||||
equipment = _equipment_from_json(json_data, eqpt_library_name)
|
||||
equipment = _equipment_from_json(json_data, extra_configs)
|
||||
network = load_network(network_file_name, equipment)
|
||||
data = load_requests(filename=Path(__file__).parent.parent / 'tests/data/testTopology_services_expected.json',
|
||||
eqpt=eqpt_library_name, bidir=False, network=network, network_filename=network_file_name)
|
||||
|
||||
@@ -23,10 +23,14 @@ from gnpy.topology.request import (compute_path_dsjctn, isdisjoint, find_reverse
|
||||
from gnpy.topology.spectrum_assignment import build_oms_list
|
||||
from gnpy.tools.json_io import requests_from_json, load_requests, load_network, load_equipment, disjunctions_from_json
|
||||
|
||||
NETWORK_FILE_NAME = Path(__file__).parent.parent / 'tests/data/testTopology_expected.json'
|
||||
SERVICE_FILE_NAME = Path(__file__).parent.parent / 'tests/data/testTopology_testservices.json'
|
||||
RESULT_FILE_NAME = Path(__file__).parent.parent / 'tests/data/testTopology_testresults.json'
|
||||
EQPT_LIBRARY_NAME = Path(__file__).parent.parent / 'tests/data/eqpt_config.json'
|
||||
|
||||
DATA_DIR = Path(__file__).parent.parent / 'tests/data'
|
||||
NETWORK_FILE_NAME = DATA_DIR / 'testTopology_expected.json'
|
||||
SERVICE_FILE_NAME = DATA_DIR / 'testTopology_testservices.json'
|
||||
RESULT_FILE_NAME = DATA_DIR / 'testTopology_testresults.json'
|
||||
EQPT_LIBRARY_NAME = DATA_DIR / 'eqpt_config.json'
|
||||
EXTRA_CONFIGS = {"std_medium_gain_advanced_config.json": DATA_DIR / "std_medium_gain_advanced_config.json",
|
||||
"Juniper-BoosterHG.json": DATA_DIR / "Juniper-BoosterHG.json"}
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
@@ -43,7 +47,7 @@ def serv(test_setup):
|
||||
@pytest.fixture()
|
||||
def test_setup():
|
||||
"""common setup for tests: builds network, equipment and oms only once"""
|
||||
equipment = load_equipment(EQPT_LIBRARY_NAME)
|
||||
equipment = load_equipment(EQPT_LIBRARY_NAME, EXTRA_CONFIGS)
|
||||
network = load_network(NETWORK_FILE_NAME, equipment)
|
||||
# Build the network once using the default power defined in SI in eqpt config
|
||||
# power density : db2linp(ower_dbm': 0)/power_dbm': 0 * nb channels as defined by
|
||||
@@ -297,7 +301,7 @@ def test_aggregation(ids, modes, req_n, req_m, disjunction, final_ids, final_ns,
|
||||
if mode is not defined, requests must not be merged,
|
||||
if requests are in a synchronization vector, they should not be merged
|
||||
"""
|
||||
equipment = load_equipment(EQPT_LIBRARY_NAME)
|
||||
equipment = load_equipment(EQPT_LIBRARY_NAME, EXTRA_CONFIGS)
|
||||
requests = []
|
||||
for request_id, mode, req_n, req_m in zip(ids, modes, req_n, req_m):
|
||||
params = request_set
|
||||
|
||||
@@ -28,8 +28,11 @@ from gnpy.topology.spectrum_assignment import build_oms_list
|
||||
|
||||
|
||||
TEST_DIR = Path(__file__).parent
|
||||
EQPT_FILENAME = TEST_DIR / 'data/eqpt_config.json'
|
||||
NETWORK_FILENAME = TEST_DIR / 'data/testTopology_expected.json'
|
||||
DATA_DIR = TEST_DIR / 'data'
|
||||
EQPT_FILENAME = DATA_DIR / 'eqpt_config.json'
|
||||
NETWORK_FILENAME = DATA_DIR / 'testTopology_expected.json'
|
||||
EXTRA_CONFIGS = {"std_medium_gain_advanced_config.json": DATA_DIR / "std_medium_gain_advanced_config.json",
|
||||
"Juniper-BoosterHG.json": DATA_DIR / "Juniper-BoosterHG.json"}
|
||||
|
||||
|
||||
@pytest.mark.parametrize('degree, equalization_type, target, expected_pch_out_dbm, expected_si',
|
||||
@@ -151,7 +154,7 @@ def test_merge_equalization():
|
||||
"type": "Roadm"}],
|
||||
"connections": []
|
||||
}
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
network = network_from_json(json_data, equipment)
|
||||
roadm = [n for n in network.nodes()][0]
|
||||
assert roadm.target_pch_out_dbm == -20
|
||||
@@ -352,7 +355,7 @@ def create_voyager_req(equipment, source, dest, bidir, nodes_list, loose_list, m
|
||||
def test_initial_spectrum(mode, slot_width, power_dbm):
|
||||
"""checks that propagation using the user defined spectrum identical to SI, gives same result as SI"""
|
||||
# first propagate without any req.initial_spectrum attribute
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
req = create_voyager_req(equipment, 'trx Brest_KLA', 'trx Vannes_KBE', False, ['trx Vannes_KBE'], ['STRICT'],
|
||||
mode, slot_width, power_dbm)
|
||||
network = net_setup(equipment)
|
||||
@@ -389,7 +392,7 @@ def test_initial_spectrum_not_identical():
|
||||
"""checks that user defined spectrum overrides spectrum defined in SI
|
||||
"""
|
||||
# first propagate without any req.initial_spectrum attribute
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
req = create_voyager_req(equipment, 'trx Brest_KLA', 'trx Vannes_KBE', False, ['trx Vannes_KBE'], ['STRICT'],
|
||||
'mode 1', 50e9, 0)
|
||||
network = net_setup(equipment)
|
||||
@@ -424,7 +427,7 @@ def test_target_psd_or_psw(power_dbm, equalization, target_value):
|
||||
"""checks that if target_out_mWperSlotWidth or target_psd_out_mWperGHz is defined, it is used as equalization
|
||||
and it gives same result if computed target is the same
|
||||
"""
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
network = net_setup(equipment)
|
||||
req = create_voyager_req(equipment, 'trx Brest_KLA', 'trx Vannes_KBE', False, ['trx Vannes_KBE'], ['STRICT'],
|
||||
'mode 1', 50e9, power_dbm)
|
||||
@@ -452,7 +455,7 @@ def test_target_psd_or_psw(power_dbm, equalization, target_value):
|
||||
|
||||
def ref_network():
|
||||
"""Create a network instance with a instance of propagated path"""
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
network = net_setup(equipment)
|
||||
req0 = create_voyager_req(equipment, 'trx Brest_KLA', 'trx Vannes_KBE', False, ['trx Vannes_KBE'], ['STRICT'],
|
||||
'mode 1', 50e9, 0)
|
||||
@@ -467,7 +470,7 @@ def test_target_psd_out_mwperghz_deltap(deltap):
|
||||
|
||||
Power over 1.18dBm saturate amp with this test: TODO add a test on this saturation
|
||||
"""
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
network = net_setup(equipment, deltap)
|
||||
req = create_voyager_req(equipment, 'trx Brest_KLA', 'trx Vannes_KBE', False, ['trx Vannes_KBE'], ['STRICT'],
|
||||
'mode 1', 50e9, deltap)
|
||||
@@ -510,7 +513,7 @@ def test_equalization(case, deltap, target, mode, slot_width, equalization):
|
||||
- per degree : target_pch_out_db / target_psd_out_mWperGHz
|
||||
for these cases with and without power from user
|
||||
"""
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
setattr(equipment['Roadm']['default'], 'target_pch_out_db', target)
|
||||
req = create_voyager_req(equipment, 'trx Brest_KLA', 'trx Rennes_STA', False,
|
||||
['east edfa in Brest_KLA to Quimper', 'roadm Lannion_CAS', 'trx Rennes_STA'],
|
||||
@@ -567,7 +570,7 @@ def test_equalization(case, deltap, target, mode, slot_width, equalization):
|
||||
def test_power_option(req_power):
|
||||
"""check that --po option adds correctly power with spectral information
|
||||
"""
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
setattr(equipment['Roadm']['default'], 'target_pch_out_db', None)
|
||||
setattr(equipment['Roadm']['default'], 'target_psd_out_mWperGHz', power_dbm_to_psd_mw_ghz(-20, 32e9))
|
||||
network = net_setup(equipment)
|
||||
@@ -718,7 +721,7 @@ def test_power_offset_trx_equalization_psw(slot_width, value):
|
||||
"""Check that the equalization with the offset is giving the same result as with reference slot_width
|
||||
Check that larger slot width but no offset takes larger slot width for equalization
|
||||
"""
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
trx = transceiver(slot_width, value)
|
||||
equipment['Transceiver'][trx['type_variety']] = Transceiver(**trx)
|
||||
setattr(equipment['Roadm']['default'], 'target_pch_out_db', None)
|
||||
@@ -751,7 +754,7 @@ def test_power_offset_trx_equalization_psw(slot_width, value):
|
||||
def test_power_offset_trx_equalization_p(slot_width, value):
|
||||
"""Check that the constant power equalization with the offset is applied
|
||||
"""
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
trx = transceiver(slot_width, value)
|
||||
equipment['Transceiver'][trx['type_variety']] = Transceiver(**trx)
|
||||
setattr(equipment['Roadm']['default'], 'target_pch_out_db', -20)
|
||||
@@ -777,7 +780,7 @@ def test_power_offset_automatic_mode_selection(slot_width, value, equalization,
|
||||
"""Check that the same result is obtained if the mode is user defined or if it is
|
||||
automatically selected
|
||||
"""
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
trx = transceiver(slot_width, value)
|
||||
equipment['Transceiver'][trx['type_variety']] = Transceiver(**trx)
|
||||
setattr(equipment['Roadm']['default'], 'target_pch_out_db', None)
|
||||
@@ -859,7 +862,7 @@ def test_tx_power(tx_power_dbm):
|
||||
for el in json_data['elements']:
|
||||
if el['uid'] == 'roadm Lannion_CAS':
|
||||
el['type_variety'] = 'example_detailed_impairments'
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
network = network_from_json(json_data, equipment)
|
||||
default_spectrum = equipment['SI']['default']
|
||||
p_db = default_spectrum.power_dbm
|
||||
|
||||
@@ -22,8 +22,11 @@ from gnpy.topology.request import PathRequest, compute_constrained_path, propaga
|
||||
|
||||
|
||||
TEST_DIR = Path(__file__).parent
|
||||
EQPT_FILENAME = TEST_DIR / 'data/eqpt_config.json'
|
||||
NETWORK_FILENAME = TEST_DIR / 'data/perdegreemeshTopologyExampleV2_auto_design_expected.json'
|
||||
DATA_DIR = TEST_DIR / 'data'
|
||||
EQPT_FILENAME = DATA_DIR / 'eqpt_config.json'
|
||||
NETWORK_FILENAME = DATA_DIR / 'perdegreemeshTopologyExampleV2_auto_design_expected.json'
|
||||
EXTRA_CONFIGS = {"std_medium_gain_advanced_config.json": DATA_DIR / "std_medium_gain_advanced_config.json",
|
||||
"Juniper-BoosterHG.json": DATA_DIR / "Juniper-BoosterHG.json"}
|
||||
|
||||
|
||||
def net_setup(equipment):
|
||||
@@ -71,7 +74,7 @@ def test_gain_mode(req_power, power_dbm):
|
||||
in gain mode, whatever the value of equipment power_dbm or request power, the network is unchanged
|
||||
and the propagation remains the same as for power mode and 0dBm
|
||||
"""
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
network = net_setup(equipment)
|
||||
req = create_rq(equipment, 'trx Brest_KLA', 'trx Rennes_STA', False,
|
||||
['Edfa0_roadm Brest_KLA', 'roadm Lannion_CAS', 'trx Rennes_STA'],
|
||||
|
||||
@@ -18,11 +18,11 @@ SRC_ROOT = Path(__file__).parent.parent
|
||||
('transmission_main_example__raman', None, transmission_main_example,
|
||||
['gnpy/example-data/raman_edfa_example_network.json', '--sim', 'gnpy/example-data/sim_params.json', '--show-channels', ]),
|
||||
('openroadm-v4-Stockholm-Gothenburg', None, transmission_main_example,
|
||||
['-e', 'gnpy/example-data/eqpt_config_openroadm_ver4.json', 'gnpy/example-data/Sweden_OpenROADMv4_example_network.json', ]),
|
||||
['gnpy/example-data/Sweden_OpenROADMv4_example_network.json', '-e', 'gnpy/example-data/eqpt_config_openroadm_ver4.json', ]),
|
||||
('openroadm-v5-Stockholm-Gothenburg', None, transmission_main_example,
|
||||
['-e', 'gnpy/example-data/eqpt_config_openroadm_ver5.json', 'gnpy/example-data/Sweden_OpenROADMv5_example_network.json', ]),
|
||||
['gnpy/example-data/Sweden_OpenROADMv5_example_network.json', '-e', 'gnpy/example-data/eqpt_config_openroadm_ver5.json', ]),
|
||||
('transmission_main_example_long', None, transmission_main_example,
|
||||
['-e', 'tests/data/eqpt_config.json', 'tests/data/test_long_network.json']),
|
||||
['tests/data/test_long_network.json', '-e', 'tests/data/eqpt_config.json']),
|
||||
('spectrum1_transmission_main_example', None, transmission_main_example,
|
||||
['--spectrum', 'gnpy/example-data/initial_spectrum1.json', 'gnpy/example-data/meshTopologyExampleV2.xls', ]),
|
||||
('spectrum2_transmission_main_example', None, transmission_main_example,
|
||||
@@ -32,14 +32,17 @@ SRC_ROOT = Path(__file__).parent.parent
|
||||
('power_sweep_example', 'logs_power_sweep_example', transmission_main_example,
|
||||
['tests/data/testTopology_expected.json', 'brest', 'rennes', '-e', 'tests/data/eqpt_config_sweep.json', '--pow', '3']),
|
||||
('transmission_long_pow', None, transmission_main_example,
|
||||
['-e', 'tests/data/eqpt_config.json', 'tests/data/test_long_network.json', '--spectrum', 'gnpy/example-data/initial_spectrum2.json']),
|
||||
['tests/data/test_long_network.json', '-e', 'tests/data/eqpt_config.json', '--spectrum', 'gnpy/example-data/initial_spectrum2.json']),
|
||||
('transmission_long_psd', None, transmission_main_example,
|
||||
['-e', 'tests/data/eqpt_config_psd.json', 'tests/data/test_long_network.json', '--spectrum', 'gnpy/example-data/initial_spectrum2.json', ]),
|
||||
['tests/data/test_long_network.json', '-e', 'tests/data/eqpt_config_psd.json', '--spectrum', 'gnpy/example-data/initial_spectrum2.json', ]),
|
||||
('transmission_long_psw', None, transmission_main_example,
|
||||
['-e', 'tests/data/eqpt_config_psw.json', 'tests/data/test_long_network.json', '--spectrum', 'gnpy/example-data/initial_spectrum2.json', ]),
|
||||
['tests/data/test_long_network.json', '-e', 'tests/data/eqpt_config_psw.json', '--spectrum', 'gnpy/example-data/initial_spectrum2.json', ]),
|
||||
('multiband_transmission', None, transmission_main_example,
|
||||
['gnpy/example-data/multiband_example_network.json', 'Site_A', 'Site_D', '-e', 'gnpy/example-data/eqpt_config_multiband.json',
|
||||
'--spectrum', 'gnpy/example-data/multiband_spectrum.json', '--show-channels'])
|
||||
'--spectrum', 'gnpy/example-data/multiband_spectrum.json', '--show-channels']),
|
||||
('path_requests_run_extra_equipment', 'logs_path_requests_run_extra_equipment', path_requests_run,
|
||||
['gnpy/example-data/meshTopologyExampleV2.xls', 'gnpy/example-data/service_pluggable.json', '--extra-equipment', 'gnpy/example-data/extra_eqpt_config.json', 'tests/data/extra_eqpt_config.json',
|
||||
'--extra-config', 'tests/data/user_edfa_config.json'])
|
||||
))
|
||||
def test_example_invocation(capfd, caplog, output, log, handler, args):
|
||||
"""Make sure that our examples produce useful output"""
|
||||
|
||||
@@ -16,7 +16,10 @@ from gnpy.tools.convert import xls_to_json_data
|
||||
|
||||
TEST_DIR = Path(__file__).parent
|
||||
EQPT_FILENAME = TEST_DIR / 'data/eqpt_config.json'
|
||||
MULTIBAND_EQPT_FILENAME = TEST_DIR / 'data/eqpt_config_multiband.json'
|
||||
DATA_DIR = TEST_DIR / 'data'
|
||||
EXTRA_CONFIGS = {"std_medium_gain_advanced_config.json": DATA_DIR / "std_medium_gain_advanced_config.json",
|
||||
"Juniper-BoosterHG.json": DATA_DIR / "Juniper-BoosterHG.json"}
|
||||
|
||||
|
||||
def test_jsonthing(caplog):
|
||||
@@ -96,7 +99,7 @@ def test_wrong_equipment(caplog, error, equipment, json_data, expected_msg):
|
||||
def test_wrong_xls_service(xls_service_filename, xls_topo_filename, expected_msg):
|
||||
"""
|
||||
"""
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
network = load_network(DATA_DIR / xls_topo_filename, equipment)
|
||||
with pytest.raises(ServiceError, match=expected_msg):
|
||||
_ = load_requests(DATA_DIR / xls_service_filename, equipment, False, network, DATA_DIR / xls_topo_filename)
|
||||
@@ -292,7 +295,7 @@ def test_json_request(error, json_data, expected_msg):
|
||||
"""
|
||||
Check that a missing key is correctly raisong the logger
|
||||
"""
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
|
||||
with pytest.raises(error, match=re.escape(expected_msg)):
|
||||
_ = requests_from_json(json_data, equipment)
|
||||
@@ -386,7 +389,7 @@ def test_json_network(error, json_data, expected_msg):
|
||||
"""
|
||||
Check that a missing key is correctly raisong the logger
|
||||
"""
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
with pytest.raises(error, match=re.escape(expected_msg)):
|
||||
_ = network_from_json(json_data, equipment)
|
||||
|
||||
@@ -420,3 +423,167 @@ def test_log_wrong_xlsx(caplog, input_filename, expected_msg):
|
||||
"""
|
||||
_ = xls_to_json_data(input_filename)
|
||||
assert expected_msg in caplog.text
|
||||
|
||||
|
||||
def wrong_configs():
|
||||
wrong_config = [[{
|
||||
"uid": "Edfa1",
|
||||
"type": "Edfa",
|
||||
"type_variety": "std_medium_gain_multiband",
|
||||
"operational": {
|
||||
"gain_target": 21,
|
||||
"delta_p": 3.0,
|
||||
"out_voa": 3.0,
|
||||
"in_voa": 0.0,
|
||||
"tilt_target": 0.0,
|
||||
"f_min": 186.2,
|
||||
"f_max": 190.2
|
||||
}},
|
||||
ParametersError]
|
||||
]
|
||||
wrong_config.append([{
|
||||
"uid": "[83/WR-2-4-SIG=>930/WRT-1-2-SIG]-PhysicalConn/2056",
|
||||
"type": "Fiber",
|
||||
"type_variety": "SSMF",
|
||||
"params": {
|
||||
"dispersion_per_frequency": {
|
||||
"frequency": [
|
||||
185.49234135667396e12,
|
||||
186.05251641137855e12,
|
||||
188.01312910284463e12,
|
||||
189.99124726477024e12],
|
||||
"value": [
|
||||
1.60e-05,
|
||||
1.67e-05,
|
||||
1.7e-05,
|
||||
1.8e-05]
|
||||
},
|
||||
"loss_coef": 2.85,
|
||||
"length_units": "km",
|
||||
"att_in": 0.0,
|
||||
"con_in": 0.0,
|
||||
"con_out": 0.0
|
||||
}},
|
||||
ParametersError
|
||||
])
|
||||
wrong_config.append([{
|
||||
"uid": "east edfa in Lannion_CAS to Stbrieuc",
|
||||
"metadata": {
|
||||
"location": {
|
||||
"city": "Lannion_CAS",
|
||||
"region": "RLD",
|
||||
"latitude": 2.0,
|
||||
"longitude": 0.0
|
||||
}
|
||||
},
|
||||
"type": "Multiband_amplifier",
|
||||
"type_variety": "std_low_gain_multiband",
|
||||
"amplifiers": [{
|
||||
"type_variety": "std_low_gain",
|
||||
"operational": {
|
||||
"gain_target": 20.0,
|
||||
"delta_p": 0,
|
||||
"tilt_target": 0,
|
||||
"out_voa": 0
|
||||
}
|
||||
}, {
|
||||
"type_variety": "std_low_gain_L_ter",
|
||||
"operational": {
|
||||
"gain_target": 20.0,
|
||||
"delta_p": 1,
|
||||
"tilt_target": 0,
|
||||
"out_voa": 1
|
||||
}
|
||||
}]},
|
||||
ConfigurationError])
|
||||
wrong_config.append([{
|
||||
"uid": "east edfa in Lannion_CAS to Stbrieuc",
|
||||
"metadata": {
|
||||
"location": {
|
||||
"city": "Lannion_CAS",
|
||||
"region": "RLD",
|
||||
"latitude": 2.0,
|
||||
"longitude": 0.0
|
||||
}
|
||||
},
|
||||
"type": "Edfa",
|
||||
"type_variety": "std_low_gain_multiband",
|
||||
"amplifiers": [{
|
||||
"type_variety": "std_low_gain",
|
||||
"operational": {
|
||||
"gain_target": 20.0,
|
||||
"delta_p": 0,
|
||||
"tilt_target": 0,
|
||||
"out_voa": 0
|
||||
}
|
||||
}, {
|
||||
"type_variety": "std_low_gain_L",
|
||||
"operational": {
|
||||
"gain_target": 20.0,
|
||||
"delta_p": 1,
|
||||
"tilt_target": 0,
|
||||
"out_voa": 1
|
||||
}
|
||||
}]},
|
||||
ParametersError])
|
||||
wrong_config.append([{
|
||||
"uid": "east edfa in Lannion_CAS to Stbrieuc",
|
||||
"metadata": {
|
||||
"location": {
|
||||
"city": "Lannion_CAS",
|
||||
"region": "RLD",
|
||||
"latitude": 2.0,
|
||||
"longitude": 0.0
|
||||
}
|
||||
},
|
||||
"type": "Multiband_amplifier",
|
||||
"type_variety": "std_low_gain_multiband",
|
||||
"amplifiers": [{
|
||||
"type_variety": "std_low_gain",
|
||||
"operational": {
|
||||
"gain_target": 20.0,
|
||||
"delta_p": 0,
|
||||
"tilt_target": 0,
|
||||
"out_voa": 0
|
||||
}
|
||||
}, {
|
||||
"type_variety": "std_low_gain_L",
|
||||
"operational": {
|
||||
"gain_target": 20.0,
|
||||
"delta_p": 1,
|
||||
"tilt_target": 0,
|
||||
"out_voa": 1
|
||||
}
|
||||
}, {
|
||||
"type_variety": "std_low_gain",
|
||||
"operational": {
|
||||
"gain_target": 20.0,
|
||||
"delta_p": 1,
|
||||
"tilt_target": 0,
|
||||
"out_voa": 1
|
||||
}
|
||||
}]},
|
||||
ParametersError])
|
||||
return wrong_config
|
||||
|
||||
|
||||
@pytest.mark.parametrize('el_config, error_type', wrong_configs())
|
||||
def test_wrong_multiband(el_config, error_type):
|
||||
|
||||
equipment = load_equipment(MULTIBAND_EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
fused_config = {
|
||||
"uid": "[83/WR-2-4-SIG=>930/WRT-1-2-SIG]-Tl/9300",
|
||||
"type": "Fused",
|
||||
"params": {
|
||||
"loss": 20
|
||||
}
|
||||
}
|
||||
json_data = {
|
||||
"elements": [
|
||||
el_config,
|
||||
fused_config
|
||||
],
|
||||
"connections": []
|
||||
}
|
||||
with pytest.raises(error_type):
|
||||
_ = network_from_json(json_data, equipment)
|
||||
|
||||
@@ -18,9 +18,12 @@ from gnpy.core.parameters import SimParams, EdfaParams, MultiBandParams
|
||||
|
||||
|
||||
TEST_DIR = Path(__file__).parent
|
||||
EQPT_FILENAME = TEST_DIR / 'data/eqpt_config.json'
|
||||
EQPT_MULTBAND_FILENAME = TEST_DIR / 'data/eqpt_config_multiband.json'
|
||||
NETWORK_FILENAME = TEST_DIR / 'data/bugfixiteratortopo.json'
|
||||
DATA_DIR = TEST_DIR / 'data'
|
||||
EQPT_FILENAME = DATA_DIR / 'eqpt_config.json'
|
||||
EQPT_MULTBAND_FILENAME = DATA_DIR / 'eqpt_config_multiband.json'
|
||||
NETWORK_FILENAME = DATA_DIR / 'bugfixiteratortopo.json'
|
||||
EXTRA_CONFIGS = {"std_medium_gain_advanced_config.json": DATA_DIR / "std_medium_gain_advanced_config.json",
|
||||
"Juniper-BoosterHG.json": DATA_DIR / "Juniper-BoosterHG.json"}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("node, attenuation", [
|
||||
@@ -52,7 +55,7 @@ NETWORK_FILENAME = TEST_DIR / 'data/bugfixiteratortopo.json'
|
||||
['Site_B', 0],
|
||||
])
|
||||
def test_span_loss(node, attenuation):
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
network = load_network(NETWORK_FILENAME, equipment)
|
||||
for x in network.nodes():
|
||||
if x.uid == node:
|
||||
@@ -64,7 +67,7 @@ def test_span_loss(node, attenuation):
|
||||
@pytest.mark.parametrize("node", ['fused4'])
|
||||
def test_span_loss_unconnected(node):
|
||||
'''Fused node that has no next and no previous nodes should be detected'''
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
network = load_network(NETWORK_FILENAME, equipment)
|
||||
x = next(x for x in network.nodes() if x.uid == node)
|
||||
with pytest.raises(NetworkTopologyError):
|
||||
@@ -164,7 +167,7 @@ def test_eol(typ, expected_loss):
|
||||
}
|
||||
]
|
||||
}
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
equipment['Span']['default'].EOL = 1
|
||||
network = network_from_json(json_data, equipment)
|
||||
p_db = equipment['SI']['default'].power_dbm
|
||||
@@ -230,7 +233,7 @@ def test_design_non_amplified_link(elem1, elem2, expected_gain, expected_delta_p
|
||||
}
|
||||
]
|
||||
}
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
equipment['Span']['default'].power_mode = power_mode
|
||||
equipment['SI']['default'].power_dbm = p_db
|
||||
equipment['SI']['default'].tx_power_dbm = p_db
|
||||
@@ -441,7 +444,7 @@ def test_design_band(case, site_type, amplifier_type, expected_design_bands, exp
|
||||
EOL is then added on the first fiber only.
|
||||
"""
|
||||
json_data = network_base(case, site_type, amplifier_type=amplifier_type)
|
||||
equipment = load_equipment(EQPT_MULTBAND_FILENAME)
|
||||
equipment = load_equipment(EQPT_MULTBAND_FILENAME, EXTRA_CONFIGS)
|
||||
network = network_from_json(json_data, equipment)
|
||||
p_db = equipment['SI']['default'].power_dbm
|
||||
p_total_db = p_db + lin2db(automatic_nch(equipment['SI']['default'].f_min,
|
||||
@@ -462,7 +465,7 @@ def test_design_band(case, site_type, amplifier_type, expected_design_bands, exp
|
||||
def test_select_edfa(caplog, raman_allowed, gain_target, power_target, target_extended_gain, warning, expected_selection):
|
||||
"""
|
||||
"""
|
||||
equipment = load_equipment(EQPT_MULTBAND_FILENAME)
|
||||
equipment = load_equipment(EQPT_MULTBAND_FILENAME, EXTRA_CONFIGS)
|
||||
edfa_eqpt = {n: a for n, a in equipment['Edfa'].items() if a.type_def != 'multi_band'}
|
||||
selection = select_edfa(raman_allowed, gain_target, power_target, edfa_eqpt, "toto", target_extended_gain, verbose=True)
|
||||
assert selection == expected_selection
|
||||
@@ -499,7 +502,7 @@ def test_select_edfa(caplog, raman_allowed, gain_target, power_target, target_ex
|
||||
def test_get_node_restrictions(cls, defaultparams, variety_list, booster_list, band, expected_restrictions):
|
||||
"""Check that all combinations of restrictions are correctly captured
|
||||
"""
|
||||
equipment = load_equipment(EQPT_MULTBAND_FILENAME)
|
||||
equipment = load_equipment(EQPT_MULTBAND_FILENAME, EXTRA_CONFIGS)
|
||||
edfa_config = {"uid": "Edfa1"}
|
||||
if cls == Multiband_amplifier:
|
||||
edfa_config['amplifiers'] = {}
|
||||
@@ -570,7 +573,7 @@ def test_multiband(case, site_type, band, expected_gain, expected_tilt, expected
|
||||
EOL is then added on the first fiber only.
|
||||
"""
|
||||
json_data = network_base(case, site_type)
|
||||
equipment = load_equipment(EQPT_MULTBAND_FILENAME)
|
||||
equipment = load_equipment(EQPT_MULTBAND_FILENAME, EXTRA_CONFIGS)
|
||||
network = network_from_json(json_data, equipment)
|
||||
p_db = equipment['SI']['default'].power_dbm
|
||||
p_total_db = p_db + lin2db(automatic_nch(equipment['SI']['default'].f_min,
|
||||
@@ -600,12 +603,12 @@ def test_tilt_fused():
|
||||
SimParams.set_params(load_json(TEST_DIR / 'data' / 'sim_params.json'))
|
||||
input_powers = {'CBAND': 0.001, 'LBAND': 0.001}
|
||||
json_data = network_base("design", "Multiband_amplifier", length=100)
|
||||
equipment = load_equipment(EQPT_MULTBAND_FILENAME)
|
||||
equipment = load_equipment(EQPT_MULTBAND_FILENAME, EXTRA_CONFIGS)
|
||||
network = network_from_json(json_data, equipment)
|
||||
node = next(n for n in network.nodes() if n.uid == 'fiber (SITE1 → ILA1)')
|
||||
tilt_db, tilt_target = estimate_srs_power_deviation(network, node, equipment, design_bands, input_powers)
|
||||
json_data = network_base("design", "Fused", length=50)
|
||||
equipment = load_equipment(EQPT_MULTBAND_FILENAME)
|
||||
equipment = load_equipment(EQPT_MULTBAND_FILENAME, EXTRA_CONFIGS)
|
||||
network = network_from_json(json_data, equipment)
|
||||
node = next(n for n in network.nodes() if n.uid == 'fiber (ILA1 → ILA2)')
|
||||
fused_tilt_db, fused_tilt_target = \
|
||||
@@ -734,7 +737,7 @@ def test_insert_amp(site_type, expected_type, bands, expected_bands):
|
||||
EOL is then added on the first fiber only.
|
||||
"""
|
||||
json_data = network_wo_booster(site_type, bands)
|
||||
equipment = load_equipment(EQPT_MULTBAND_FILENAME)
|
||||
equipment = load_equipment(EQPT_MULTBAND_FILENAME, EXTRA_CONFIGS)
|
||||
network = network_from_json(json_data, equipment)
|
||||
p_db = equipment['SI']['default'].power_dbm
|
||||
p_total_db = p_db + lin2db(automatic_nch(equipment['SI']['default'].f_min,
|
||||
|
||||
@@ -32,12 +32,14 @@ from gnpy.topology.spectrum_assignment import build_oms_list, pth_assign_spectru
|
||||
from gnpy.tools.convert import convert_file
|
||||
from gnpy.tools.json_io import (load_json, load_network, save_network, load_equipment, requests_from_json,
|
||||
disjunctions_from_json, network_to_json, network_from_json)
|
||||
from gnpy.tools.service_sheet import read_service_sheet, correct_xls_route_list
|
||||
from gnpy.tools.service_sheet import read_service_sheet, correct_xls_route_list, Request_element, Request
|
||||
|
||||
TEST_DIR = Path(__file__).parent
|
||||
DATA_DIR = TEST_DIR / 'data'
|
||||
eqpt_filename = DATA_DIR / 'eqpt_config.json'
|
||||
equipment = load_equipment(eqpt_filename)
|
||||
EQPT_FILENAME = DATA_DIR / 'eqpt_config.json'
|
||||
EXTRA_CONFIGS = {"std_medium_gain_advanced_config.json": DATA_DIR / "std_medium_gain_advanced_config.json",
|
||||
"Juniper-BoosterHG.json": DATA_DIR / "Juniper-BoosterHG.json"}
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('xls_input,expected_json_output', {
|
||||
@@ -69,7 +71,7 @@ def test_excel_json_generation(tmpdir, xls_input, expected_json_output):
|
||||
}.items())
|
||||
def test_auto_design_generation_fromxlsgainmode(tmpdir, xls_input, expected_json_output):
|
||||
"""tests generation of topology json and that the build network gives correct results in gain mode"""
|
||||
equipment = load_equipment(eqpt_filename)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
network = load_network(xls_input, equipment)
|
||||
add_missing_elements_in_network(network, equipment)
|
||||
# in order to test the Eqpt sheet and load gain target,
|
||||
@@ -100,7 +102,7 @@ def test_auto_design_generation_fromxlsgainmode(tmpdir, xls_input, expected_json
|
||||
}.items())
|
||||
def test_auto_design_generation_fromjson(tmpdir, json_input, power_mode):
|
||||
"""test that autodesign creates same file as an input file already autodesigned"""
|
||||
equipment = load_equipment(eqpt_filename)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
network = load_network(json_input, equipment)
|
||||
# in order to test the Eqpt sheet and load gain target,
|
||||
# change the power-mode to False (to be in gain mode)
|
||||
@@ -127,7 +129,7 @@ def test_auto_design_generation_fromjson(tmpdir, json_input, power_mode):
|
||||
}.items())
|
||||
def test_excel_service_json_generation(xls_input, expected_json_output):
|
||||
"""test services creation"""
|
||||
equipment = load_equipment(eqpt_filename)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
network = load_network(DATA_DIR / 'testTopology.xls', equipment)
|
||||
# Build the network once using the default power defined in SI in eqpt config
|
||||
p_db = equipment['SI']['default'].power_dbm
|
||||
@@ -148,7 +150,7 @@ def test_excel_service_json_generation(xls_input, expected_json_output):
|
||||
def test_csv_response_generation(tmpdir, json_input):
|
||||
"""tests if generated csv is consistant with expected generation same columns (order not important)"""
|
||||
json_data = load_json(json_input)
|
||||
equipment = load_equipment(eqpt_filename)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
csv_filename = Path(tmpdir / json_input.name).with_suffix('.csv')
|
||||
with open(csv_filename, 'w', encoding='utf-8') as fcsv:
|
||||
jsontocsv(json_data, equipment, fcsv)
|
||||
@@ -213,7 +215,7 @@ def test_csv_response_generation(tmpdir, json_input):
|
||||
def test_json_response_generation(xls_input, expected_response_file):
|
||||
"""tests if json response is correctly generated for all combinations of requests"""
|
||||
|
||||
equipment = load_equipment(eqpt_filename)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
network = load_network(xls_input, equipment)
|
||||
p_db = equipment['SI']['default'].power_dbm
|
||||
|
||||
@@ -274,54 +276,45 @@ def test_json_response_generation(xls_input, expected_response_file):
|
||||
else:
|
||||
assert expected['response'][i] == response
|
||||
|
||||
# test the correspondance names dict in case of excel input
|
||||
# test that using the created json network still works with excel input
|
||||
# test all configurations of names: trx names, roadm, fused, ila and fiber
|
||||
# as well as splitted case
|
||||
|
||||
# initial network is based on the couple testTopology.xls/ testTopology_auto_design_expected.json
|
||||
# with added constraints to cover more test cases
|
||||
|
||||
|
||||
@pytest.mark.parametrize('source, destination, route_list, hoptype, expected_correction', [
|
||||
('trx Brest_KLA', 'trx Vannes_KBE',
|
||||
('Brest_KLA', 'Vannes_KBE',
|
||||
'roadm Brest_KLA | roadm Lannion_CAS | roadm Lorient_KMA | roadm Vannes_KBE',
|
||||
'STRICT',
|
||||
'no',
|
||||
['roadm Brest_KLA', 'roadm Lannion_CAS', 'roadm Lorient_KMA', 'roadm Vannes_KBE']),
|
||||
('trx Brest_KLA', 'trx Vannes_KBE',
|
||||
('Brest_KLA', 'Vannes_KBE',
|
||||
'trx Brest_KLA | roadm Lannion_CAS | roadm Lorient_KMA | roadm Vannes_KBE',
|
||||
'STRICT',
|
||||
'No',
|
||||
['roadm Lannion_CAS', 'roadm Lorient_KMA', 'roadm Vannes_KBE']),
|
||||
('trx Lannion_CAS', 'trx Rennes_STA', 'trx Rennes_STA', 'LOOSE', []),
|
||||
('trx Lannion_CAS', 'trx Lorient_KMA', 'toto', 'LOOSE', []),
|
||||
('trx Lannion_CAS', 'trx Lorient_KMA', 'toto', 'STRICT', 'Fail'),
|
||||
('trx Lannion_CAS', 'trx Lorient_KMA', 'Corlay | Loudeac | Lorient_KMA', 'LOOSE',
|
||||
('Lannion_CAS', 'Rennes_STA', 'trx Rennes_STA', 'yes', []),
|
||||
('Lannion_CAS', 'Lorient_KMA', 'toto', 'yes', []),
|
||||
('Lannion_CAS', 'Lorient_KMA', 'toto', 'no', 'Fail'),
|
||||
('Lannion_CAS', 'Lorient_KMA', 'Corlay | Loudeac | Lorient_KMA', 'yes',
|
||||
['west fused spans in Corlay', 'west fused spans in Loudeac', 'roadm Lorient_KMA']),
|
||||
('trx Lannion_CAS', 'trx Lorient_KMA', 'Ploermel | Vannes_KBE', 'LOOSE',
|
||||
('Lannion_CAS', 'Lorient_KMA', 'Ploermel | Vannes_KBE', 'yes',
|
||||
['east edfa in Ploermel to Vannes_KBE', 'roadm Vannes_KBE']),
|
||||
('trx Rennes_STA', 'trx Brest_KLA', 'Vannes_KBE | Quimper | Brest_KLA', 'LOOSE',
|
||||
('Rennes_STA', 'Brest_KLA', 'Vannes_KBE | Quimper | Brest_KLA', 'yes',
|
||||
['roadm Vannes_KBE', 'west edfa in Quimper to Lorient_KMA', 'roadm Brest_KLA']),
|
||||
('trx Brest_KLA', 'trx Rennes_STA', 'Brest_KLA | Quimper | Lorient_KMA', 'LOOSE',
|
||||
('Brest_KLA', 'Rennes_STA', 'Brest_KLA | Quimper | Lorient_KMA', 'yes',
|
||||
['roadm Brest_KLA', 'east edfa in Quimper to Lorient_KMA', 'roadm Lorient_KMA']),
|
||||
('Brest_KLA', 'trx Rennes_STA', '', 'LOOSE', 'Fail'),
|
||||
('trx Brest_KLA', 'Rennes_STA', '', 'LOOSE', 'Fail'),
|
||||
('Brest_KLA', 'Rennes_STA', '', 'LOOSE', 'Fail'),
|
||||
('Brest_KLA', 'trx Rennes_STA', '', 'STRICT', 'Fail'),
|
||||
('trx Brest_KLA', 'trx Rennes_STA', 'trx Rennes_STA', 'STRICT', []),
|
||||
('trx Brest_KLA', 'trx Rennes_STA', None, '', []),
|
||||
('trx Brest_KLA', 'trx Rennes_STA', 'Brest_KLA | Quimper | Ploermel', 'LOOSE',
|
||||
('Brest_KLA', 'trx Rennes_STA', '', 'yes', 'Fail'),
|
||||
('trx Brest_KLA', 'Rennes_STA', '', 'yes', 'Fail'),
|
||||
('trx Brest_KLA', 'trx Rennes_STA', '', 'yes', 'Fail'),
|
||||
('Brest_KLA', 'trx Rennes_STA', '', 'no', 'Fail'),
|
||||
('Brest_KLA', 'Rennes_STA', 'trx Rennes_STA', 'no', []),
|
||||
('Brest_KLA', 'Rennes_STA', None, '', []),
|
||||
('Brest_KLA', 'Rennes_STA', 'Brest_KLA | Quimper | Ploermel', 'yes',
|
||||
['roadm Brest_KLA']),
|
||||
('trx Brest_KLA', 'trx Rennes_STA', 'Brest_KLA | Quimper | Ploermel', 'STRICT',
|
||||
('Brest_KLA', 'Rennes_STA', 'Brest_KLA | Quimper | Ploermel', 'no',
|
||||
['roadm Brest_KLA']),
|
||||
('trx Brest_KLA', 'trx Rennes_STA', 'Brest_KLA | trx Quimper', 'LOOSE', ['roadm Brest_KLA']),
|
||||
('trx Brest_KLA', 'trx Rennes_STA', 'Brest_KLA | trx Lannion_CAS', 'LOOSE', ['roadm Brest_KLA']),
|
||||
('trx Brest_KLA', 'trx Rennes_STA', 'Brest_KLA | trx Lannion_CAS', 'STRICT', 'Fail')
|
||||
('Brest_KLA', 'Rennes_STA', 'Brest_KLA | trx Quimper', 'yes', ['roadm Brest_KLA']),
|
||||
('Brest_KLA', 'Rennes_STA', 'Brest_KLA | trx Lannion_CAS', 'yes', ['roadm Brest_KLA']),
|
||||
('Brest_KLA', 'Rennes_STA', 'Brest_KLA | trx Lannion_CAS', 'no', 'Fail')
|
||||
])
|
||||
def test_excel_ila_constraints(source, destination, route_list, hoptype, expected_correction):
|
||||
"""add different kind of constraints to test all correct_route cases"""
|
||||
service_xls_input = DATA_DIR / 'testTopology.xls'
|
||||
network_json_input = DATA_DIR / 'testTopology_auto_design_expected.json'
|
||||
equipment = load_equipment(eqpt_filename)
|
||||
network = load_network(network_json_input, equipment)
|
||||
# increase length of one span to trigger automatic fiber splitting included by autodesign
|
||||
# so that the test also covers this case
|
||||
@@ -331,37 +324,20 @@ def test_excel_ila_constraints(source, destination, route_list, hoptype, expecte
|
||||
p_db = default_si.power_dbm
|
||||
p_total_db = p_db + lin2db(automatic_nch(default_si.f_min, default_si.f_max, default_si.spacing))
|
||||
build_network(network, equipment, p_db, p_total_db)
|
||||
# create params for a request based on input
|
||||
nodes_list = route_list.split(' | ') if route_list is not None else []
|
||||
# create params for a xls request based on input (note that this not the same type as PathRequest)
|
||||
params = {
|
||||
'request_id': '0',
|
||||
'source': source,
|
||||
'bidir': False,
|
||||
'destination': destination,
|
||||
'trx_type': '',
|
||||
'trx_mode': '',
|
||||
'format': '',
|
||||
'spacing': '',
|
||||
'nodes_list': nodes_list,
|
||||
'loose_list': [hoptype for node in nodes_list] if route_list is not None else '',
|
||||
'f_min': 0,
|
||||
'f_max': 0,
|
||||
'baud_rate': 0,
|
||||
'OSNR': None,
|
||||
'bit_rate': None,
|
||||
'cost': None,
|
||||
'roll_off': 0,
|
||||
'tx_osnr': 0,
|
||||
'tx_power': 0,
|
||||
'penalties': None,
|
||||
'min_spacing': None,
|
||||
'trx_type': 'Voyager',
|
||||
'spacing': 50,
|
||||
'nodes_list': route_list,
|
||||
'is_loose': hoptype,
|
||||
'nb_channel': 0,
|
||||
'power': 0,
|
||||
'path_bandwidth': 0,
|
||||
'effective_freq_slot': None,
|
||||
'equalization_offset_db': 0
|
||||
}
|
||||
request = PathRequest(**params)
|
||||
request = Request_element(Request(**params), equipment, False)
|
||||
|
||||
if expected_correction != 'Fail':
|
||||
[request] = correct_xls_route_list(service_xls_input, network, [request])
|
||||
@@ -371,6 +347,55 @@ def test_excel_ila_constraints(source, destination, route_list, hoptype, expecte
|
||||
[request] = correct_xls_route_list(service_xls_input, network, [request])
|
||||
|
||||
|
||||
@pytest.mark.parametrize('route_list, hoptype, expected_amp_route', [
|
||||
('node1 | siteE | node2', 'no',
|
||||
['roadm node1', 'west edfa in siteE', 'roadm node2']),
|
||||
('node2 | siteE | node1', 'no',
|
||||
['roadm node2', 'east edfa in siteE', 'roadm node1']),
|
||||
('node1 | siteF | node2', 'no',
|
||||
['roadm node1', 'west edfa in siteF', 'roadm node2']),
|
||||
('node1 | siteA | siteB', 'yes',
|
||||
['roadm node1', 'west edfa in siteA']),
|
||||
('node1 | siteA | siteB | node2', 'yes',
|
||||
['roadm node1', 'west edfa in siteA', 'west edfa in siteB', 'roadm node2']),
|
||||
('node1 | siteC | node2', 'yes',
|
||||
['roadm node1', 'east edfa in siteC', 'roadm node2']),
|
||||
('node1 | siteD | node2', 'no',
|
||||
['roadm node1', 'west edfa in siteD to node1', 'roadm node2']),
|
||||
('roadm node1 | Edfa_booster_roadm node1_to_fiber (node1 → siteE)-CABLES#19 | west edfa in siteE | node2',
|
||||
'no',
|
||||
['roadm node1', 'Edfa_booster_roadm node1_to_fiber (node1 → siteE)-CABLES#19',
|
||||
'west edfa in siteE', 'roadm node2'])])
|
||||
def test_excel_ila_constraints2(route_list, hoptype, expected_amp_route):
|
||||
"""Check different cases for ILA constraints definition
|
||||
"""
|
||||
network_xls_input = DATA_DIR / 'ila_constraint.xlsx'
|
||||
network = load_network(network_xls_input, equipment)
|
||||
add_missing_elements_in_network(network, equipment)
|
||||
default_si = equipment['SI']['default']
|
||||
p_db = default_si.power_dbm
|
||||
p_total_db = p_db + lin2db(automatic_nch(default_si.f_min, default_si.f_max, default_si.spacing))
|
||||
build_network(network, equipment, p_db, p_total_db)
|
||||
# create params for a request based on input
|
||||
|
||||
params = {
|
||||
'request_id': '0',
|
||||
'source': 'node1',
|
||||
'destination': 'node2',
|
||||
'trx_type': 'Voyager',
|
||||
'mode': None,
|
||||
'spacing': 50,
|
||||
'nodes_list': route_list,
|
||||
'is_loose': hoptype,
|
||||
'nb_channel': 80,
|
||||
'power': 0,
|
||||
'path_bandwidth': 100,
|
||||
}
|
||||
request = Request_element(Request(**params), equipment, False)
|
||||
[request] = correct_xls_route_list(network_xls_input, network, [request])
|
||||
assert request.nodes_list == expected_amp_route
|
||||
|
||||
|
||||
def setup_per_degree(case):
|
||||
"""common setup for degree: returns the dict network for different cases"""
|
||||
json_network = load_json(DATA_DIR / 'testTopology_expected.json')
|
||||
@@ -607,7 +632,7 @@ def test_roadm_type_variety(type_variety, target_pch_out_db, correct_variety):
|
||||
# Do not add type variety in json_data to test that it creates a 'default' type_variety
|
||||
expected_roadm['type_variety'] = 'default'
|
||||
expected_roadm['params']['target_pch_out_db'] = target_pch_out_db
|
||||
equipment = load_equipment(eqpt_filename)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
if correct_variety:
|
||||
network = network_from_json(json_data, equipment)
|
||||
roadm = [n for n in network.nodes()][0]
|
||||
|
||||
138
tests/test_path_computation_functions.py
Normal file
138
tests/test_path_computation_functions.py
Normal file
@@ -0,0 +1,138 @@
|
||||
#!/usr/bin/env python3
|
||||
# Module name: test_path_computation_functions.py
|
||||
# Version:
|
||||
# License: BSD 3-Clause Licence
|
||||
# Copyright (c) 2018, Telecom Infra Project
|
||||
|
||||
"""
|
||||
@author: esther.lerouzic
|
||||
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
import pytest
|
||||
from gnpy.core.network import build_network
|
||||
from gnpy.core.utils import lin2db, automatic_nch
|
||||
from gnpy.topology.request import explicit_path
|
||||
from gnpy.topology.spectrum_assignment import build_oms_list
|
||||
from gnpy.tools.json_io import load_equipment, load_network, requests_from_json
|
||||
|
||||
|
||||
TEST_DIR = Path(__file__).parent
|
||||
DATA_DIR = TEST_DIR / 'data'
|
||||
EQPT_FILENAME = DATA_DIR / 'eqpt_config.json'
|
||||
NETWORK_FILENAME = DATA_DIR / 'testTopology_auto_design_expected.json'
|
||||
SERVICE_FILENAME = DATA_DIR / 'testTopology_services_expected.json'
|
||||
EXTRA_CONFIGS = {"std_medium_gain_advanced_config.json": DATA_DIR / "std_medium_gain_advanced_config.json",
|
||||
"Juniper-BoosterHG.json": DATA_DIR / "Juniper-BoosterHG.json"}
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def setup_without_oms():
|
||||
""" common setup for tests: builds network, equipment and oms only once
|
||||
"""
|
||||
network = load_network(NETWORK_FILENAME, equipment)
|
||||
spectrum = equipment['SI']['default']
|
||||
p_db = spectrum.power_dbm
|
||||
p_total_db = p_db + lin2db(automatic_nch(spectrum.f_min, spectrum.f_max, spectrum.spacing))
|
||||
build_network(network, equipment, p_db, p_total_db)
|
||||
return network
|
||||
|
||||
|
||||
def some_request(explicit_route):
|
||||
"""Create a request with an explicit route
|
||||
"""
|
||||
route = {
|
||||
"route-object-include-exclude": [
|
||||
{
|
||||
"explicit-route-usage": "route-include-ero",
|
||||
"index": i,
|
||||
"num-unnum-hop": {
|
||||
"node-id": node_id,
|
||||
"link-tp-id": "link-tp-id is not used",
|
||||
"hop-type": "STRICT"
|
||||
}
|
||||
} for i, node_id in enumerate(explicit_route)
|
||||
]
|
||||
}
|
||||
return {
|
||||
"path-request": [{
|
||||
"request-id": "2",
|
||||
"source": explicit_route[0],
|
||||
"destination": explicit_route[-1],
|
||||
"src-tp-id": explicit_route[0],
|
||||
"dst-tp-id": explicit_route[-1],
|
||||
"bidirectional": False,
|
||||
"path-constraints": {
|
||||
"te-bandwidth": {
|
||||
"technology": "flexi-grid",
|
||||
"trx_type": "Voyager",
|
||||
"trx_mode": "mode 1",
|
||||
"spacing": 75000000000.0,
|
||||
"path_bandwidth": 100000000000.0
|
||||
}
|
||||
},
|
||||
"explicit-route-objects": route}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize('setup', ["with_oms", "without_oms"])
|
||||
@pytest.mark.parametrize('explicit_route, expected_path', [
|
||||
(['trx Brest_KLA', 'trx Vannes_KBE'], None),
|
||||
# path contains one element per oms
|
||||
(['trx Brest_KLA', 'east edfa in Brest_KLA to Morlaix', 'trx Lannion_CAS'],
|
||||
['trx Brest_KLA', 'roadm Brest_KLA', 'east edfa in Brest_KLA to Morlaix', 'fiber (Brest_KLA → Morlaix)-F060',
|
||||
'east fused spans in Morlaix', 'fiber (Morlaix → Lannion_CAS)-F059', 'west edfa in Lannion_CAS to Morlaix',
|
||||
'roadm Lannion_CAS', 'trx Lannion_CAS']),
|
||||
# path contains several elements per oms
|
||||
(['trx Brest_KLA', 'east edfa in Brest_KLA to Morlaix', 'west edfa in Lannion_CAS to Morlaix',
|
||||
'roadm Lannion_CAS', 'trx Lannion_CAS'],
|
||||
['trx Brest_KLA', 'roadm Brest_KLA', 'east edfa in Brest_KLA to Morlaix', 'fiber (Brest_KLA → Morlaix)-F060',
|
||||
'east fused spans in Morlaix', 'fiber (Morlaix → Lannion_CAS)-F059', 'west edfa in Lannion_CAS to Morlaix',
|
||||
'roadm Lannion_CAS', 'trx Lannion_CAS']),
|
||||
# path contains all elements
|
||||
(['trx Brest_KLA', 'roadm Brest_KLA', 'east edfa in Brest_KLA to Morlaix', 'fiber (Brest_KLA → Morlaix)-F060',
|
||||
'east fused spans in Morlaix', 'fiber (Morlaix → Lannion_CAS)-F059', 'west edfa in Lannion_CAS to Morlaix',
|
||||
'roadm Lannion_CAS', 'trx Lannion_CAS'],
|
||||
['trx Brest_KLA', 'roadm Brest_KLA', 'east edfa in Brest_KLA to Morlaix', 'fiber (Brest_KLA → Morlaix)-F060',
|
||||
'east fused spans in Morlaix', 'fiber (Morlaix → Lannion_CAS)-F059', 'west edfa in Lannion_CAS to Morlaix',
|
||||
'roadm Lannion_CAS', 'trx Lannion_CAS']),
|
||||
# path conteains element for only 1 oms (2 oms path)
|
||||
(['trx Brest_KLA', 'east edfa in Brest_KLA to Morlaix', 'trx Rennes_STA'], None),
|
||||
# path contains roadm edges for all OMS, but no element of the OMS
|
||||
(['trx Brest_KLA', 'roadm Brest_KLA', 'roadm Lannion_CAS', 'trx Lannion_CAS'], None),
|
||||
# path contains one element for all 3 OMS
|
||||
(['trx Brest_KLA', 'east edfa in Brest_KLA to Morlaix', 'east edfa in Lannion_CAS to Corlay',
|
||||
'east edfa in Lorient_KMA to Vannes_KBE', 'trx Vannes_KBE'],
|
||||
['trx Brest_KLA', 'roadm Brest_KLA', 'east edfa in Brest_KLA to Morlaix', 'fiber (Brest_KLA → Morlaix)-F060',
|
||||
'east fused spans in Morlaix', 'fiber (Morlaix → Lannion_CAS)-F059', 'west edfa in Lannion_CAS to Morlaix',
|
||||
'roadm Lannion_CAS', 'east edfa in Lannion_CAS to Corlay', 'fiber (Lannion_CAS → Corlay)-F061',
|
||||
'west fused spans in Corlay', 'fiber (Corlay → Loudeac)-F010', 'west fused spans in Loudeac',
|
||||
'fiber (Loudeac → Lorient_KMA)-F054', 'west edfa in Lorient_KMA to Loudeac', 'roadm Lorient_KMA',
|
||||
'east edfa in Lorient_KMA to Vannes_KBE', 'fiber (Lorient_KMA → Vannes_KBE)-F055',
|
||||
'west edfa in Vannes_KBE to Lorient_KMA', 'roadm Vannes_KBE', 'trx Vannes_KBE'])])
|
||||
def test_explicit_path(setup, setup_without_oms, explicit_route, expected_path):
|
||||
"""tests that explicit path correctly returns the full path if it is possible else that it returns None
|
||||
"""
|
||||
network = setup_without_oms
|
||||
if setup == "with_oms":
|
||||
# OMS are initiated in elements, so that explicit path can be verified
|
||||
build_oms_list(network, equipment)
|
||||
else:
|
||||
# OMS are not initiated, explicit path can not be computed.
|
||||
expected_path = None
|
||||
json_data = some_request(explicit_route)
|
||||
[req] = requests_from_json(json_data, equipment)
|
||||
|
||||
node_list = []
|
||||
for node in req.nodes_list:
|
||||
node_list.append(next(el for el in network if el.uid == node))
|
||||
source = node_list[0]
|
||||
destination = node_list[-1]
|
||||
if expected_path is None:
|
||||
assert explicit_path(node_list, source, destination, network) is None
|
||||
else:
|
||||
actual_path = [e.uid for e in explicit_path(node_list, source, destination, network)]
|
||||
assert actual_path == expected_path
|
||||
@@ -18,8 +18,12 @@ from gnpy.core.network import build_network
|
||||
from gnpy.tools.json_io import load_network, load_equipment, network_from_json
|
||||
|
||||
|
||||
network_file_name = Path(__file__).parent.parent / 'tests/LinkforTest.json'
|
||||
eqpt_library_name = Path(__file__).parent.parent / 'tests/data/eqpt_config.json'
|
||||
TEST_DIR = Path(__file__).parent
|
||||
DATA_DIR = TEST_DIR / 'data'
|
||||
network_file_name = DATA_DIR / 'LinkforTest.json'
|
||||
eqpt_library_name = DATA_DIR / 'eqpt_config.json'
|
||||
EXTRA_CONFIGS = {"std_medium_gain_advanced_config.json": DATA_DIR / "std_medium_gain_advanced_config.json",
|
||||
"Juniper-BoosterHG.json": DATA_DIR / "Juniper-BoosterHG.json"}
|
||||
|
||||
|
||||
@pytest.fixture(params=[(96, 0.05e12), (60, 0.075e12), (45, 0.1e12), (2, 0.1e12)],
|
||||
@@ -31,7 +35,7 @@ def nch_and_spacing(request):
|
||||
|
||||
|
||||
def propagation(input_power, con_in, con_out, dest):
|
||||
equipment = load_equipment(eqpt_library_name)
|
||||
equipment = load_equipment(eqpt_library_name, EXTRA_CONFIGS)
|
||||
network = load_network(network_file_name, equipment)
|
||||
|
||||
# parametrize the network elements with the con losses and adapt gain
|
||||
@@ -178,7 +182,7 @@ def test_json_element(error, json_data, expected_msg):
|
||||
"""
|
||||
Check that a missing key is correctly raisong the logger
|
||||
"""
|
||||
equipment = load_equipment(eqpt_library_name)
|
||||
equipment = load_equipment(eqpt_library_name, EXTRA_CONFIGS)
|
||||
network = network_from_json(json_data, equipment)
|
||||
elem = next(e for e in network.nodes() if e.uid == 'Elem')
|
||||
si = create_input_spectral_information(f_min=191.3e12, f_max=196.1e12, roll_off=0.15,
|
||||
|
||||
@@ -28,8 +28,11 @@ from gnpy.core.exceptions import ConfigurationError, NetworkTopologyError
|
||||
|
||||
|
||||
TEST_DIR = Path(__file__).parent
|
||||
EQPT_LIBRARY_NAME = TEST_DIR / 'data/eqpt_config.json'
|
||||
NETWORK_FILE_NAME = TEST_DIR / 'data/testTopology_expected.json'
|
||||
DATA_DIR = TEST_DIR / 'data'
|
||||
EQPT_FILENAME = DATA_DIR / 'eqpt_config.json'
|
||||
NETWORK_FILE_NAME = DATA_DIR / 'testTopology_expected.json'
|
||||
EXTRA_CONFIGS = {"std_medium_gain_advanced_config.json": DATA_DIR / "std_medium_gain_advanced_config.json",
|
||||
"Juniper-BoosterHG.json": DATA_DIR / "Juniper-BoosterHG.json"}
|
||||
# adding tests to check the roadm restrictions
|
||||
|
||||
# mark node_uid amps as fused for testing purpose
|
||||
@@ -39,7 +42,7 @@ def test_no_amp_feature(node_uid):
|
||||
test_parser covers partly this behaviour. This test should guaranty that the
|
||||
feature is preserved even if convert is changed
|
||||
"""
|
||||
equipment = load_equipment(EQPT_LIBRARY_NAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
json_network = load_json(NETWORK_FILE_NAME)
|
||||
|
||||
for elem in json_network['elements']:
|
||||
@@ -82,7 +85,7 @@ def test_no_amp_feature(node_uid):
|
||||
@pytest.fixture()
|
||||
def equipment():
|
||||
"""init transceiver class to access snr and osnr calculations"""
|
||||
equipment = load_equipment(EQPT_LIBRARY_NAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
# define some booster and preamps
|
||||
restrictions_list = [
|
||||
{
|
||||
@@ -131,7 +134,7 @@ def equipment():
|
||||
}]
|
||||
# add them to the library
|
||||
for entry in restrictions_list:
|
||||
equipment['Edfa'][entry['type_variety']] = Amp.from_json(EQPT_LIBRARY_NAME, **entry)
|
||||
equipment['Edfa'][entry['type_variety']] = Amp.from_json(EXTRA_CONFIGS, **entry)
|
||||
return equipment
|
||||
|
||||
|
||||
@@ -223,7 +226,7 @@ def test_roadm_target_power(prev_node_type, effective_pch_out_db, power_dbm, roa
|
||||
for the test where the prev_node in ROADM B is either an amplifier or a fused, so that the target
|
||||
power can not be met in this last case.
|
||||
"""
|
||||
equipment = load_equipment(EQPT_LIBRARY_NAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
equipment['SI']['default'].power_dbm = power_dbm
|
||||
json_network = load_json(TEST_DIR / 'data/twohops_roadm_power_test.json')
|
||||
prev_node = next(n for n in json_network['elements'] if n['uid'] == 'west edfa in node B to ila2')
|
||||
@@ -448,7 +451,7 @@ def test_compare_design_propagation_settings(power_dbm, req_power, amp_with_delt
|
||||
This test also checks all the possible combinations and expected before/after propagation
|
||||
gain differences. It also checks delta_p applied due to saturation during design.
|
||||
"""
|
||||
eqpt = load_equipment(EQPT_LIBRARY_NAME)
|
||||
eqpt = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
eqpt['SI']['default'].power_dbm = power_dbm
|
||||
json_network = load_json(NETWORK_FILE_NAME)
|
||||
for element in json_network['elements']:
|
||||
@@ -550,14 +553,14 @@ def test_wrong_restrictions(restrictions, fail):
|
||||
"""Check that sanity_check correctly raises an error when restriction is incorrect and that library
|
||||
correctly includes restrictions.
|
||||
"""
|
||||
json_data = load_json(EQPT_LIBRARY_NAME)
|
||||
json_data = load_json(EQPT_FILENAME)
|
||||
# define wrong restriction
|
||||
json_data['Roadm'][0]['restrictions'] = restrictions
|
||||
if fail:
|
||||
with pytest.raises(ConfigurationError):
|
||||
_ = _equipment_from_json(json_data, EQPT_LIBRARY_NAME)
|
||||
_ = _equipment_from_json(json_data, EXTRA_CONFIGS)
|
||||
else:
|
||||
equipment = _equipment_from_json(json_data, EQPT_LIBRARY_NAME)
|
||||
equipment = _equipment_from_json(json_data, EXTRA_CONFIGS)
|
||||
assert equipment['Roadm']['example_test'].restrictions == restrictions
|
||||
|
||||
|
||||
@@ -574,7 +577,7 @@ def test_roadm_impairments(roadm, from_degree, to_degree, expected_impairment_id
|
||||
for el in json_data['elements']:
|
||||
if el['uid'] == 'roadm Lannion_CAS':
|
||||
el['type_variety'] = 'example_detailed_impairments'
|
||||
equipment = load_equipment(EQPT_LIBRARY_NAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
network = network_from_json(json_data, equipment)
|
||||
build_network(network, equipment, 0.0, 20.0)
|
||||
roadm = next(n for n in network.nodes() if n.uid == roadm)
|
||||
@@ -590,7 +593,7 @@ def test_roadm_impairments(roadm, from_degree, to_degree, expected_impairment_id
|
||||
def test_roadm_per_degree_impairments(type_variety, from_degree, to_degree, impairment_id, expected_type):
|
||||
"""Check that impairment type is correct also if per degree impairment is defined
|
||||
"""
|
||||
json_data = load_json(EQPT_LIBRARY_NAME)
|
||||
json_data = load_json(EQPT_FILENAME)
|
||||
assert 'type_variety' not in json_data['Roadm'][2]
|
||||
json_data['Roadm'][2]['roadm-path-impairments'] = [
|
||||
{
|
||||
@@ -614,7 +617,7 @@ def test_roadm_per_degree_impairments(type_variety, from_degree, to_degree, impa
|
||||
"roadm-noise-figure": 23
|
||||
}]
|
||||
}]
|
||||
equipment = _equipment_from_json(json_data, EQPT_LIBRARY_NAME)
|
||||
equipment = _equipment_from_json(json_data, EXTRA_CONFIGS)
|
||||
assert equipment['Roadm']['default'].type_variety == 'default'
|
||||
|
||||
json_data = load_json(NETWORK_FILE_NAME)
|
||||
@@ -647,7 +650,7 @@ def test_roadm_per_degree_impairments(type_variety, from_degree, to_degree, impa
|
||||
def test_wrong_roadm_per_degree_impairments(from_degree, to_degree, impairment_id, error, message):
|
||||
"""Check that wrong per degree definitions are correctly catched
|
||||
"""
|
||||
equipment = load_equipment(EQPT_LIBRARY_NAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
json_data = load_json(NETWORK_FILE_NAME)
|
||||
for el in json_data['elements']:
|
||||
if el['uid'] == 'roadm Lannion_CAS':
|
||||
@@ -680,7 +683,7 @@ def test_impairment_initialization(path_type, type_variety, expected_pmd, expect
|
||||
- use roadm detailed impairment for the corresponding path_type if roadm type_variety has detailed impairments
|
||||
- use roadm per degree impairment if they are defined
|
||||
"""
|
||||
equipment = load_equipment(EQPT_LIBRARY_NAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
extra_params = equipment['Roadm'][type_variety].__dict__
|
||||
roadm_config = {
|
||||
"uid": "roadm Lannion_CAS",
|
||||
|
||||
@@ -30,6 +30,8 @@ DATA_DIR = TEST_DIR / 'data'
|
||||
EQPT_FILENAME = DATA_DIR / 'eqpt_config.json'
|
||||
NETWORK_FILENAME = DATA_DIR / 'testTopology_auto_design_expected.json'
|
||||
SERVICE_FILENAME = DATA_DIR / 'testTopology_services_expected.json'
|
||||
EXTRA_CONFIGS = {"std_medium_gain_advanced_config.json": DATA_DIR / "std_medium_gain_advanced_config.json",
|
||||
"Juniper-BoosterHG.json": DATA_DIR / "Juniper-BoosterHG.json"}
|
||||
|
||||
grid = 0.00625e12
|
||||
slot = 0.0125e12
|
||||
@@ -40,7 +42,7 @@ cband_freq_max = 196.1e12
|
||||
|
||||
@pytest.fixture()
|
||||
def equipment():
|
||||
equipment = load_equipment(EQPT_FILENAME)
|
||||
equipment = load_equipment(EQPT_FILENAME, EXTRA_CONFIGS)
|
||||
return equipment
|
||||
|
||||
|
||||
|
||||
@@ -17,8 +17,11 @@ from gnpy.tools.json_io import load_equipment, load_json, _equipment_from_json
|
||||
|
||||
|
||||
TEST_DIR = Path(__file__).parent
|
||||
EQPT_LIBRARY_NAME = TEST_DIR / 'data/eqpt_config.json'
|
||||
NETWORK_FILE_NAME = TEST_DIR / 'data/testTopology_expected.json'
|
||||
DATA_DIR = TEST_DIR / 'data'
|
||||
EQPT_LIBRARY_NAME = DATA_DIR / 'eqpt_config.json'
|
||||
NETWORK_FILE_NAME = DATA_DIR / 'testTopology_expected.json'
|
||||
EXTRA_CONFIGS = {"std_medium_gain_advanced_config.json": DATA_DIR / "std_medium_gain_advanced_config.json",
|
||||
"Juniper-BoosterHG.json": DATA_DIR / "Juniper-BoosterHG.json"}
|
||||
|
||||
|
||||
@pytest.mark.parametrize('trx_type, trx_mode, error_message, no_error, expected_result',
|
||||
@@ -91,7 +94,7 @@ def test_trx_mode_params(trx_type, trx_mode, error_message, no_error, expected_r
|
||||
'penalties': None,
|
||||
'cost': None
|
||||
}
|
||||
equipment = load_equipment(EQPT_LIBRARY_NAME)
|
||||
equipment = load_equipment(EQPT_LIBRARY_NAME, EXTRA_CONFIGS)
|
||||
if no_error:
|
||||
trx_params = trx_mode_params(equipment, trx_type, trx_mode, error_message)
|
||||
print(trx_params)
|
||||
@@ -150,7 +153,7 @@ def test_wrong_baudrate_spacing(baudrate, spacing, error_message):
|
||||
'equalization_offset_db': 0}]
|
||||
}
|
||||
json_data['Transceiver'].append(wrong_transceiver)
|
||||
equipment = _equipment_from_json(json_data, EQPT_LIBRARY_NAME)
|
||||
equipment = _equipment_from_json(json_data, EXTRA_CONFIGS)
|
||||
|
||||
with pytest.raises(EquipmentConfigError, match=error_message):
|
||||
_ = trx_mode_params(equipment, 'vendorB_trx-type1', 'wrong mode', error_message=False)
|
||||
|
||||
Reference in New Issue
Block a user