Merge pull request #208 from Telecominfraproject/develop

Merge Develop to Master for v1.1 Release
This commit is contained in:
James
2019-01-30 15:52:50 -05:00
committed by GitHub
47 changed files with 12610 additions and 2531 deletions

View File

@@ -189,27 +189,30 @@ Service sheet must contain 11 columns::
route id ; Source ; Destination ; TRX type ; Mode ; System: spacing ; System: input power (dBm) ; System: nb of channels ; routing: disjoint from ; routing: path ; routing: is loose?
- **route id** is mandatory. It must be unique. It is the identifier of the request. It can be an integer or a string (do not use blank or dash)
- **route id** is mandatory. It must be unique. It is the identifier of the request. It can be an integer or a string (do not use blank or dash or coma)
- **Source** is mandatory. It is the name of the source node (as listed in Nodes sheet). Source MUST be a ROADM node. (TODO: relax this and accept trx entries)
- **Destination** is mandatory. It is the name of the destination node (as listed in Nodes sheet). Source MUST be a ROADM node. (TODO: relax this and accept trx entries)
- **TRX type and mode** are mandatory. They are the variety type and selected mode of the transceiver to be used for the propagation simulation. These modes MUST be defined in the equipment library. The format of the mode is used as the name of the mode. (TODO: maybe add another mode id on Transceiver library ?). In particular the mode selection defines the channel baudrate to be used for the propagation simulation.
- **TRX type ** is mandatory. They are the variety type and selected mode of the transceiver to be used for the propagation simulation. These modes MUST be defined in the equipment library. The format of the mode is used as the name of the mode. (TODO: maybe add another mode id on Transceiver library ?). In particular the mode selection defines the channel baudrate to be used for the propagation simulation.
- **System: spacing ; System: input power (dBm) ; System: nb of channels** are mandatory input defining the system parameters for the propagation simulation.
- **mode** is optional. If not specified, the program will search for the mode of the defined transponder with the highest baudrate fitting within the spacing value.
- **System: spacing** is mandatory. Spacing is the channel spacing defined in GHz difined for the feasibility propagation simulation, assuming system full load.
- **System: input power (dBm) ; System: nb of channels** are optional input defining the system parameters for the propagation simulation.
- spacing is the channel spacing defined in GHz
- input power is the channel optical input power in dBm
- nb of channels is the number of channels to be used for the simulation.
- **routing: disjoint from ; routing: path ; routing: is loose?** are optional.
- disjoint from: (work not started) identifies the requests from which this request must be disjoint. It is not used yet
- path: is the set of ROADM nodes that must be used by the path. It must contain the list of ROADM names that the path must cross. TODO : only ROADM nodes are accepted in this release. Relax this with any type of nodes.
- is loose? (in progress) 'no' value means that the list of nodes should be strictly followed, while any other value means that the constraint may be relaxed if the node is not reachable.
- disjoint from: identifies the requests from which this request must be disjoint. If filled it must contain request ids separated by ' | '
- path: is the set of ROADM nodes that must be used by the path. It must contain the list of ROADM names that the path must cross. TODO : only ROADM nodes are accepted in this release. Relax this with any type of nodes. If filled it must contain ROADM ids separated by ' | '. Exact names are required.
- is loose? 'no' value means that the list of nodes should be strictly followed, while any other value means that the constraint may be relaxed if the node is not reachable.
# to be completed #
- ** path bandwidth** is optional. It is the amount of capacity required between source and destination in Gbit/s. Default value is 0.0 Gbit/s.
convert_service_sheet.py
------------------------

View File

@@ -9,7 +9,7 @@ planning and optimization tools in real-world mesh optical networks.**
`gnpy <http://github.com/telecominfraproject/oopt-gnpy>`__ is:
- a sponsored project of the `OOPT/PSE <https://telecominfraproject.com/open-optical-packet-transport/>`_ working group of the `Telecom Infra Project <http://telecominfraproject.com>`_.
- a sponsored project of the `OOPT/PSE <https://telecominfraproject.com/open-optical-packet-transport/>`_ working group of the `Telecom Infra Project <http://telecominfraproject.com>`_
- fully community-driven, fully open source library
- driven by a consortium of operators, vendors, and academic researchers
- intended for rapid development of production-grade route planning tools
@@ -30,7 +30,11 @@ A brief outline of major (tagged) `gnpy` releases:
+---------------+-------------+-----------------------------------------------+
| release date | version tag | notes |
+===============+=============+===============================================+
| Oct 16, 2018 | v1.0 | - first "production"-ready release |
| Jan 30, 2019 | v1.1 | - XLS parser enhancements |
| | | - carrier probe feature |
| | | - bug fixes |
+---------------+-------------+-----------------------------------------------+
| Oct 16, 2018 | v1.0 | - first "production"-ready release |
| | | - open network element model (EDFA, GN-model) |
| | | - auto-design functionality |
| | | - path request functionality |
@@ -135,8 +139,8 @@ By default, this script operates on a single span network defined in
`examples/edfa_example_network.json <examples/edfa_example_network.json>`_
You can specify a different network at the command line as follows. For
example, to use the CORONET Continental US (CONUS) network defined in
`examples/coronet_conus_example.json <examples/coronet_conus_example.json>`_:
example, to use the CORONET Global network defined in
`examples/CORONET_Global_Topology.json <examples/CORONET_Global_Topology.json>`_:
.. code-block:: shell
@@ -150,10 +154,9 @@ further instructions on how to prepare the Excel input file, see
`Excel_userguide.rst <Excel_userguide.rst>`_.
The main transmission example will calculate the average signal OSNR and SNR
across 93 network elements (transceiver, ROADMs, fibers, and amplifiers)
between two transceivers selected by the user. (By default, for the CORONET US
network, it will show the transmission of spectral information between Abilene,
Texas and Albany, New York.)
across network elements (transceiver, ROADMs, fibers, and amplifiers)
between two transceivers selected by the user. Additional details are provided by doing ``transmission_main_example.py -h``. (By default, for the CORONET Global
network, it will show the transmission of spectral information between Abilene and Albany)
This script calculates the average signal OSNR = |OSNR| and SNR = |SNR|.
@@ -171,8 +174,8 @@ Further Instructions for Use (`transmission_main_example.py`, `path_requests_run
Design and transmission parameters are defined in a dedicated json file. By
default, this information is read from `examples/eqpt_config.json
<examples/eqpt_config.json>`_. This file defines the equipement librairies that
can be customized (EDFAs, fibers, and transcievers).
<examples/eqpt_config.json>`_. This file defines the equipment libraries that
can be customized (EDFAs, fibers, and transceivers).
It also defines the simulation parameters (spans, ROADMs, and the spectral
information to transmit.)
@@ -182,7 +185,7 @@ can be added and existing ones removed. Three different noise models are availab
1. `'type_def': 'variable_gain'` is a simplified model simulating a 2-coil EDFA with internal, input and output VOAs. The NF vs gain response is calculated accordingly based on the input parameters: `nf_min`, `nf_max`, and `gain_flatmax`. It is not a simple interpolation but a 2-stage NF calculation.
2. `'type_def': 'fixed_gain'` is a fixed gain model. `NF == Cte == nf0` if `gain_min < gain < gain_flatmax`
3. `'type_def': None` is an advanced model. A detailed json configuration file is required (by default `examples/advanced_config_from.json <examples/advanced_config_from.json>`_.) It uses a 3rd order polynomial where NF = f(gain), NF_ripple = f(frequency), gain_ripple = f(frequency), N-array dgt = f(frequency). Compared to the previous models, NF ripple and gain ripple are modelled.
3. `'type_def': None` is an advanced model. A detailed json configuration file is required (by default `examples/std_medium_gain_advanced_config.json <examples/std_medium_gain_advanced_config.json>`_.) It uses a 3rd order polynomial where NF = f(gain), NF_ripple = f(frequency), gain_ripple = f(frequency), N-array dgt = f(frequency). Compared to the previous models, NF ripple and gain ripple are modelled.
For all amplifier models:
@@ -204,12 +207,12 @@ For all amplifier models:
| | | Excel template topology files.) |
+----------------------+-----------+-----------------------------------------+
The fiber library currently describes SSMF but additional fiber types can be entered by the user following the same model:
The fiber library currently describes SSMF and NZDF but additional fiber types can be entered by the user following the same model:
+----------------------+-----------+-----------------------------------------+
| field | type | description |
+======================+===========+=========================================+
| `type_variety` | (string) | a unique name to ID the amplifier in the|
| `type_variety` | (string) | a unique name to ID the fiber in the |
| | | JSON or Excel template topology input |
| | | file |
+----------------------+-----------+-----------------------------------------+
@@ -226,7 +229,7 @@ path_request_run.py routine.
+----------------------+-----------+-----------------------------------------+
| field | type | description |
+======================+===========+=========================================+
| `type_variety` | (string) | a unique name to ID the amplifier in |
| `type_variety` | (string) | a unique name to ID the transceiver in |
| | | the JSON or Excel template topology |
| | | input file |
+----------------------+-----------+-----------------------------------------+
@@ -252,7 +255,11 @@ The modes are defined as follows:
+----------------------+-----------+-----------------------------------------+
| `bit_rate` | (number) | in bit/s |
+----------------------+-----------+-----------------------------------------+
| `roll_off` | (number) | |
| `roll_off` | (number) | Not used. |
+----------------------+-----------+-----------------------------------------+
| `tx_osnr` | (number) | In dB. OSNR out from transponder. |
+----------------------+-----------+-----------------------------------------+
| `cost` | (number) | Arbitrary unit |
+----------------------+-----------+-----------------------------------------+
Simulation parameters are defined as follows.
@@ -269,15 +276,15 @@ For amplifiers defined in the topology JSON input but whose gain = 0
(placeholder), auto-design will set its gain automatically: see `power_mode` in
the `Spans` library to find out how the gain is calculated.
Span configuration is performed as followws. It is not a list (which may change
in later releases,) and the user can only modify the value of existing
Span configuration is performed as follows. It is not a list (which may change
in later releases) and the user can only modify the value of existing
parameters:
+------------------------+-----------+---------------------------------------------+
| field | type | description |
+========================+===========+=============================================+
| `power_mode` | (boolean) | If false, gain mode. Auto-design sets |
| | | amplifier gain = preceeding span loss, |
| | | amplifier gain = preceding span loss, |
| | | unless the amplifier exists and its |
| | | gain > 0 in the topology input json. |
| | | If true, power mode (recommended for |
@@ -291,7 +298,7 @@ parameters:
| | | (see power_range_db in the SI |
| | | configuration library) the power sweep |
| | | is performed w/r/t this power target, |
| | | regardless of preceeding amplifiers |
| | | regardless of preceding amplifiers |
| | | power saturation/limitations. |
+------------------------+-----------+---------------------------------------------+
| `delta_power_range_db` | (number) | Auto-design only, power-mode |
@@ -396,7 +403,7 @@ parameters:
}
ROADMs can be configured as follows. The user can only modify the value of
existing parmeters:
existing parameters:
+-------------------------+-----------+---------------------------------------------+
| field | type | description |
@@ -416,7 +423,7 @@ existing parmeters:
| | | its egress channel power = power_mode_pref, |
| | | regardless of existing loss settings |
| | | from the topology JSON input. It means |
| | | that the ouput power from a ROADM (and |
| | | that the output power from a ROADM (and |
| | | therefore its OSNR contribution) is Cte |
| | | and not depending from power_dbm and |
| | | power_range_db sweep settings. This |
@@ -445,6 +452,8 @@ one power/channel definition.
+----------------------+-----------+-------------------------------------------+
| `bit_rate` | (number) | Not used. |
+----------------------+-----------+-------------------------------------------+
| `tx_osnr` | (number) | In dB. OSNR out from transponder. |
+----------------------+-----------+-------------------------------------------+
| `power_dbm` | (number) | Reference channel power. In gain mode |
| | | (see spans/power_mode = false), all gain |
| | | settings are offset w/r/t this reference |
@@ -465,16 +474,11 @@ one power/channel definition.
+----------------------+-----------+-------------------------------------------+
The `transmission_main_example.py <examples/transmission_main_example.py>`_
script propagates a specrum of channels at 32 Gbaud, 50 GHz spacing and 0
script propagates a spectrum of channels at 32 Gbaud, 50 GHz spacing and 0
dBm/channel. These are not yet parametrized but can be modified directly in the
script (via the SpectralInformation structure) to accomodate any baud rate,
script (via the SpectralInformation structure) to accommodate any baud rate,
spacing, power or channel count demand.
The amplifier's gain is set to exactly compensate for the loss in each network
element. The amplifier is currently defined with gain range of 15 dB to 25 dB
and 21 dBm max output power. Ripple and NF models are defined in
`examples/std_medium_gain_advanced_config.json <examples/std_medium_gain_advanced_config.json>`_
Use `examples/path_requests_run.py <examples/path_requests_run.py>`_ to run multiple optimizations as follows:
.. code-block:: shell
@@ -496,8 +500,8 @@ library. The program computes performances for the list of services (accepts
json or excel format) using the same spectrum propagation modules as
transmission_main_example.py. Explanation on the Excel template is provided in
the `Excel_userguide.rst <Excel_userguide.rst#service-sheet>`_. Template for
the json format can be found here: `service_template.json
<service_template.json>`_.
the json format can be found here: `service-template.json
<service-template.json>`_.
Contributing
------------
@@ -513,7 +517,7 @@ To get involved, please contact James Powell
See the `Onboarding Guide
<https://github.com/Telecominfraproject/gnpy/wiki/Onboarding-Guide>`_ for
specific details on code contribtions.
specific details on code contributions.
See `AUTHORS.rst <AUTHORS.rst>`_ for past and present contributors.
@@ -523,7 +527,7 @@ Project Background
Data Centers are built upon interchangeable, highly standardized node and
network architectures rather than a sum of isolated solutions. This also
translates to optical networking. It leads to a push in enabling multi-vendor
optical network by disaggregating HW and SW functions and focussing on
optical network by disaggregating HW and SW functions and focusing on
interoperability. In this paradigm, the burden of responsibility for ensuring
the performance of such disaggregated open optical systems falls on the
operators. Consequently, operators and vendors are collaborating in defining

View File

@@ -43,6 +43,10 @@ Contributors in alphabetical order
+==========+============+=======================+======================================+
| Alessio | Ferrari | Politecnico di Torino | alessio.ferrari@polito.it |
+----------+------------+-----------------------+--------------------------------------+
| Anders | Lindgren | Telia Company | Anders.X.Lindgren@teliacompany.com |
+----------+------------+-----------------------+--------------------------------------+
| Andrea | d'Amico | Politecnico di Torino | andrea.damico@polito.it |
+----------+------------+-----------------------+--------------------------------------+
| Brian | Taylor | Facebook | briantaylor@fb.com |
+----------+------------+-----------------------+--------------------------------------+
| David | Boertjes | Ciena | dboertje@ciena.com |
@@ -59,12 +63,19 @@ Contributors in alphabetical order
+----------+------------+-----------------------+--------------------------------------+
| Jeanluc | Auge | Orange | jeanluc.auge@orange.com |
+----------+------------+-----------------------+--------------------------------------+
| Jonas | Martensson | RISE Research Sweden | jonas.martensson@ri.se |
+----------+------------+-----------------------+--------------------------------------+
| Mattia | Cantono | Politecnico di Torino | mattia.cantono@polito.it |
+----------+------------+-----------------------+--------------------------------------+
| Miguel | Garrich | University Catalunya | miquel.garrich@upct.es |
+----------+------------+-----------------------+--------------------------------------+
| Stefan | Melin | Telia Company | Stefan.Melin@teliacompany.com |
+----------+------------+-----------------------+--------------------------------------+
| Raj | Nagarajan | Lumentum | raj.nagarajan@lumentum.com |
+----------+------------+-----------------------+--------------------------------------+
| Vittorio | Curri | Politecnico di Torino | vittorio.curri@polito.it |
+----------+------------+-----------------------+--------------------------------------+
PSE WG Charter
--------------
- Goal is to build an end-to-end simulation environment which defines the

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -1,31 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
convert_service_sheet.py
========================
XLS parser that can be called to create a JSON request file in accordance with
Yang model for requesting path computation.
See: draft-ietf-teas-yang-path-computation-01.txt
"""
from argparse import ArgumentParser
from logging import getLogger, basicConfig, CRITICAL, DEBUG, INFO
from json import dumps
from gnpy.core.service_sheet import Request, Element, Request_element
from gnpy.core.service_sheet import parse_row, parse_excel, convert_service_sheet
logger = getLogger(__name__)
if __name__ == '__main__':
args = parser.parse_args()
basicConfig(level={2: DEBUG, 1: INFO, 0: CRITICAL}.get(args.verbose, CRITICAL))
logger.info(f'Converting Service sheet {args.workbook!r} into gnpy JSON format')
if args.output is None:
data = convert_service_sheet(args.workbook,'eqpt_config.json')
print(dumps(data, indent=2))
else:
data = convert_service_sheet(args.workbook,'eqpt_config.json',args.output)

View File

@@ -70,7 +70,7 @@ def read_excel(input_filename):
def create_eqt_template(links,nodes, links_by_src , links_by_dest, input_filename):
output_filename = f'{input_filename[:-4]}_eqpt_sheet.txt'
with open(output_filename,'w') as my_file :
with open(output_filename, 'w', encoding='utf-8') as my_file:
# print header similar to excel
my_file.write('OPTIONAL\n\n\n\
\t\tNode a egress amp (from a to z)\t\t\t\t\tNode a ingress amp (from z to a) \

View File

@@ -19,6 +19,24 @@
"allowed_for_design": false
},
{
"type_variety": "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
},
{
"type_variety": "standard",
"type_def": "openroadm",
"gain_flatmax": 27,
"gain_min": 12,
"p_max": 22,
"nf_coef": [-5.952e-4,-6.250e-2,-1.071,28.99],
"allowed_for_design": false
},
{
"type_variety": "std_medium_gain",
"type_def": "variable_gain",
"gain_flatmax": 26,
@@ -48,22 +66,22 @@
"p_max": 21,
"nf0": 5.5,
"allowed_for_design": false
},
{
"type_variety": "test",
"type_def": "variable_gain",
"gain_flatmax": 25,
"gain_min": 15,
"p_max": 21,
"nf_min": 7,
"nf_max": 11,
"allowed_for_design": false
}
}
],
"Fiber":[{
"type_variety": "SSMF",
"dispersion": 1.67e-05,
"gamma": 0.00127
},
{
"type_variety": "NZDF",
"dispersion": 0.5e-05,
"gamma": 0.00146
},
{
"type_variety": "LOF",
"dispersion": 2.2e-05,
"gamma": 0.000843
}
],
"Spans":[{
@@ -80,7 +98,8 @@
],
"Roadms":[{
"gain_mode_default_loss": 20,
"power_mode_pref": -20
"power_mode_pout_target": -20,
"add_drop_osnr": 38
}],
"SI":[{
"f_min": 191.3e12,
@@ -90,8 +109,8 @@
"power_dbm": 0,
"power_range_db": [0,0,0.5],
"roll_off": 0.15,
"OSNR": 11,
"bit_rate":100e9
"tx_osnr": 40,
"sys_margins": 0
}],
"Transceiver":[
{
@@ -107,28 +126,20 @@
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15
"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
},
{
"format": "PS_SP64_1",
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15
},
{
"format": "mode_2",
"baud_rate": 66e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 75e9,
"cost":1
}
]
},
@@ -140,44 +151,45 @@
},
"mode":[
{
"format": "16QAM",
"baud_rate": 32e9,
"OSNR": 19,
"bit_rate": 200e9,
"roll_off": 0.15
},
{
"format": "QPSK",
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 12,
"bit_rate": 100e9,
"roll_off": 0.15
}
]
},
{
"type_variety": "Voyager_16QAM",
"frequency":{
"min": 191.35e12,
"max": 196.1e12
},
"mode":[
{
"format": "16QAM",
"baud_rate": 32e9,
"OSNR": 19,
"bit_rate": 200e9,
"roll_off": 0.15
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 37.5e9,
"cost":1
},
{
"format": "QPSK",
"baud_rate": 32e9,
"OSNR": 12,
"bit_rate": 100e9,
"roll_off": 0.15
"format": "mode 3",
"baud_rate": 44e9,
"OSNR": 18,
"bit_rate": 300e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 62.5e9,
"cost":1
},
{
"format": "mode 2",
"baud_rate": 66e9,
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 75e9,
"cost":1
},
{
"format": "mode 4",
"baud_rate": 66e9,
"OSNR": 16,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 40,
"min_spacing": 75e9,
"cost":1
}
]
}
]

View File

@@ -121,7 +121,7 @@
"type": "Roadm"
},
{
"uid": "ingress fused spans in Corlay",
"uid": "west fused spans in Corlay",
"metadata": {
"location": {
"city": "Corlay",
@@ -133,7 +133,7 @@
"type": "Fused"
},
{
"uid": "ingress fused spans in Loudeac",
"uid": "west fused spans in Loudeac",
"metadata": {
"location": {
"city": "Loudeac",
@@ -145,7 +145,7 @@
"type": "Fused"
},
{
"uid": "ingress fused spans in Morlaix",
"uid": "west fused spans in Morlaix",
"metadata": {
"location": {
"city": "Morlaix",
@@ -157,7 +157,7 @@
"type": "Fused"
},
{
"uid": "egress fused spans in Corlay",
"uid": "east fused spans in Corlay",
"metadata": {
"location": {
"city": "Corlay",
@@ -169,7 +169,7 @@
"type": "Fused"
},
{
"uid": "egress fused spans in Loudeac",
"uid": "east fused spans in Loudeac",
"metadata": {
"location": {
"city": "Loudeac",
@@ -181,7 +181,7 @@
"type": "Fused"
},
{
"uid": "egress fused spans in Morlaix",
"uid": "east fused spans in Morlaix",
"metadata": {
"location": {
"city": "Morlaix",
@@ -193,7 +193,7 @@
"type": "Fused"
},
{
"uid": "fiber (Lannion_CAS \u2192 Corlay)-F061",
"uid": "fiber (Lannion_CAS Corlay)-F061",
"metadata": {
"location": {
"latitude": 2.0,
@@ -211,7 +211,7 @@
}
},
{
"uid": "fiber (Corlay \u2192 Loudeac)-F010",
"uid": "fiber (Corlay Loudeac)-F010",
"metadata": {
"location": {
"latitude": 2.0,
@@ -229,7 +229,7 @@
}
},
{
"uid": "fiber (Loudeac \u2192 Lorient_KMA)-F054",
"uid": "fiber (Loudeac Lorient_KMA)-F054",
"metadata": {
"location": {
"latitude": 2.0,
@@ -247,7 +247,7 @@
}
},
{
"uid": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F055",
"uid": "fiber (Lorient_KMA Vannes_KBE)-F055",
"metadata": {
"location": {
"latitude": 2.0,
@@ -265,7 +265,7 @@
}
},
{
"uid": "fiber (Lannion_CAS \u2192 Stbrieuc)-F056",
"uid": "fiber (Lannion_CAS Stbrieuc)-F056",
"metadata": {
"location": {
"latitude": 1.5,
@@ -283,7 +283,7 @@
}
},
{
"uid": "fiber (Stbrieuc \u2192 Rennes_STA)-F057",
"uid": "fiber (Stbrieuc Rennes_STA)-F057",
"metadata": {
"location": {
"latitude": 0.5,
@@ -301,7 +301,7 @@
}
},
{
"uid": "fiber (Lannion_CAS \u2192 Morlaix)-F059",
"uid": "fiber (Lannion_CAS Morlaix)-F059",
"metadata": {
"location": {
"latitude": 2.5,
@@ -319,7 +319,7 @@
}
},
{
"uid": "fiber (Morlaix \u2192 Brest_KLA)-F060",
"uid": "fiber (Morlaix Brest_KLA)-F060",
"metadata": {
"location": {
"latitude": 3.5,
@@ -337,7 +337,79 @@
}
},
{
"uid": "fiber (Corlay \u2192 Lannion_CAS)-F061",
"uid": "fiber (Brest_KLA → Quimper)-",
"metadata": {
"location": {
"latitude": 2.5,
"longitude": 0.5
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 75.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (Quimper → Lorient_KMA)-",
"metadata": {
"location": {
"latitude": 1.5,
"longitude": 2.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 70.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (Ploermel → Vannes_KBE)-",
"metadata": {
"location": {
"latitude": 1.5,
"longitude": 3.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 50.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (Ploermel → Rennes_STA)-",
"metadata": {
"location": {
"latitude": 0.5,
"longitude": 1.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 55.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (Corlay → Lannion_CAS)-F061",
"metadata": {
"location": {
"latitude": 2.0,
@@ -355,7 +427,7 @@
}
},
{
"uid": "fiber (Loudeac \u2192 Corlay)-F010",
"uid": "fiber (Loudeac Corlay)-F010",
"metadata": {
"location": {
"latitude": 2.0,
@@ -373,7 +445,7 @@
}
},
{
"uid": "fiber (Lorient_KMA \u2192 Loudeac)-F054",
"uid": "fiber (Lorient_KMA Loudeac)-F054",
"metadata": {
"location": {
"latitude": 2.0,
@@ -391,7 +463,7 @@
}
},
{
"uid": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F055",
"uid": "fiber (Vannes_KBE Lorient_KMA)-F055",
"metadata": {
"location": {
"latitude": 2.0,
@@ -409,7 +481,7 @@
}
},
{
"uid": "fiber (Stbrieuc \u2192 Lannion_CAS)-F056",
"uid": "fiber (Stbrieuc Lannion_CAS)-F056",
"metadata": {
"location": {
"latitude": 1.5,
@@ -427,7 +499,7 @@
}
},
{
"uid": "fiber (Rennes_STA \u2192 Stbrieuc)-F057",
"uid": "fiber (Rennes_STA Stbrieuc)-F057",
"metadata": {
"location": {
"latitude": 0.5,
@@ -445,7 +517,7 @@
}
},
{
"uid": "fiber (Morlaix \u2192 Lannion_CAS)-F059",
"uid": "fiber (Morlaix Lannion_CAS)-F059",
"metadata": {
"location": {
"latitude": 2.5,
@@ -463,7 +535,7 @@
}
},
{
"uid": "fiber (Brest_KLA \u2192 Morlaix)-F060",
"uid": "fiber (Brest_KLA Morlaix)-F060",
"metadata": {
"location": {
"latitude": 3.5,
@@ -479,129 +551,249 @@
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (Quimper → Brest_KLA)-",
"metadata": {
"location": {
"latitude": 2.5,
"longitude": 0.5
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 75.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (Lorient_KMA → Quimper)-",
"metadata": {
"location": {
"latitude": 1.5,
"longitude": 2.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 70.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (Vannes_KBE → Ploermel)-",
"metadata": {
"location": {
"latitude": 1.5,
"longitude": 3.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 50.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (Rennes_STA → Ploermel)-",
"metadata": {
"location": {
"latitude": 0.5,
"longitude": 1.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 55.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
}
],
"connections": [
{
"from_node": "roadm Lannion_CAS",
"to_node": "fiber (Lannion_CAS \u2192 Corlay)-F061"
"to_node": "fiber (Lannion_CAS Corlay)-F061"
},
{
"from_node": "fiber (Corlay \u2192 Lannion_CAS)-F061",
"from_node": "fiber (Corlay Lannion_CAS)-F061",
"to_node": "roadm Lannion_CAS"
},
{
"from_node": "roadm Lannion_CAS",
"to_node": "fiber (Lannion_CAS \u2192 Stbrieuc)-F056"
"to_node": "fiber (Lannion_CAS Stbrieuc)-F056"
},
{
"from_node": "fiber (Stbrieuc \u2192 Lannion_CAS)-F056",
"from_node": "fiber (Stbrieuc Lannion_CAS)-F056",
"to_node": "roadm Lannion_CAS"
},
{
"from_node": "roadm Lannion_CAS",
"to_node": "fiber (Lannion_CAS \u2192 Morlaix)-F059"
"to_node": "fiber (Lannion_CAS Morlaix)-F059"
},
{
"from_node": "fiber (Morlaix \u2192 Lannion_CAS)-F059",
"from_node": "fiber (Morlaix Lannion_CAS)-F059",
"to_node": "roadm Lannion_CAS"
},
{
"from_node": "fiber (Lannion_CAS \u2192 Corlay)-F061",
"to_node": "ingress fused spans in Corlay"
"from_node": "fiber (Lannion_CAS Corlay)-F061",
"to_node": "west fused spans in Corlay"
},
{
"from_node": "ingress fused spans in Corlay",
"to_node": "fiber (Corlay \u2192 Loudeac)-F010"
"from_node": "west fused spans in Corlay",
"to_node": "fiber (Corlay Loudeac)-F010"
},
{
"from_node": "fiber (Loudeac \u2192 Corlay)-F010",
"to_node": "egress fused spans in Corlay"
"from_node": "fiber (Loudeac Corlay)-F010",
"to_node": "east fused spans in Corlay"
},
{
"from_node": "egress fused spans in Corlay",
"to_node": "fiber (Corlay \u2192 Lannion_CAS)-F061"
"from_node": "east fused spans in Corlay",
"to_node": "fiber (Corlay Lannion_CAS)-F061"
},
{
"from_node": "fiber (Corlay \u2192 Loudeac)-F010",
"to_node": "ingress fused spans in Loudeac"
"from_node": "fiber (Corlay Loudeac)-F010",
"to_node": "west fused spans in Loudeac"
},
{
"from_node": "ingress fused spans in Loudeac",
"to_node": "fiber (Loudeac \u2192 Lorient_KMA)-F054"
"from_node": "west fused spans in Loudeac",
"to_node": "fiber (Loudeac Lorient_KMA)-F054"
},
{
"from_node": "fiber (Lorient_KMA \u2192 Loudeac)-F054",
"to_node": "egress fused spans in Loudeac"
"from_node": "fiber (Lorient_KMA Loudeac)-F054",
"to_node": "east fused spans in Loudeac"
},
{
"from_node": "egress fused spans in Loudeac",
"to_node": "fiber (Loudeac \u2192 Corlay)-F010"
"from_node": "east fused spans in Loudeac",
"to_node": "fiber (Loudeac Corlay)-F010"
},
{
"from_node": "roadm Lorient_KMA",
"to_node": "fiber (Lorient_KMA \u2192 Loudeac)-F054"
"to_node": "fiber (Lorient_KMA Loudeac)-F054"
},
{
"from_node": "fiber (Loudeac \u2192 Lorient_KMA)-F054",
"from_node": "fiber (Loudeac Lorient_KMA)-F054",
"to_node": "roadm Lorient_KMA"
},
{
"from_node": "roadm Lorient_KMA",
"to_node": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F055"
"to_node": "fiber (Lorient_KMA Vannes_KBE)-F055"
},
{
"from_node": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F055",
"from_node": "fiber (Vannes_KBE Lorient_KMA)-F055",
"to_node": "roadm Lorient_KMA"
},
{
"from_node": "roadm Lorient_KMA",
"to_node": "fiber (Lorient_KMA → Quimper)-"
},
{
"from_node": "fiber (Quimper → Lorient_KMA)-",
"to_node": "roadm Lorient_KMA"
},
{
"from_node": "roadm Vannes_KBE",
"to_node": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F055"
"to_node": "fiber (Vannes_KBE Lorient_KMA)-F055"
},
{
"from_node": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F055",
"from_node": "fiber (Lorient_KMA Vannes_KBE)-F055",
"to_node": "roadm Vannes_KBE"
},
{
"from_node": "fiber (Lannion_CAS \u2192 Stbrieuc)-F056",
"to_node": "fiber (Stbrieuc \u2192 Rennes_STA)-F057"
"from_node": "roadm Vannes_KBE",
"to_node": "fiber (Vannes_KBE → Ploermel)-"
},
{
"from_node": "fiber (Rennes_STA \u2192 Stbrieuc)-F057",
"to_node": "fiber (Stbrieuc \u2192 Lannion_CAS)-F056"
"from_node": "fiber (Ploermel → Vannes_KBE)-",
"to_node": "roadm Vannes_KBE"
},
{
"from_node": "fiber (Lannion_CAS → Stbrieuc)-F056",
"to_node": "fiber (Stbrieuc → Rennes_STA)-F057"
},
{
"from_node": "fiber (Rennes_STA → Stbrieuc)-F057",
"to_node": "fiber (Stbrieuc → Lannion_CAS)-F056"
},
{
"from_node": "roadm Rennes_STA",
"to_node": "fiber (Rennes_STA \u2192 Stbrieuc)-F057"
"to_node": "fiber (Rennes_STA Stbrieuc)-F057"
},
{
"from_node": "fiber (Stbrieuc \u2192 Rennes_STA)-F057",
"from_node": "fiber (Stbrieuc Rennes_STA)-F057",
"to_node": "roadm Rennes_STA"
},
{
"from_node": "fiber (Lannion_CAS \u2192 Morlaix)-F059",
"to_node": "ingress fused spans in Morlaix"
"from_node": "roadm Rennes_STA",
"to_node": "fiber (Rennes_STA → Ploermel)-"
},
{
"from_node": "ingress fused spans in Morlaix",
"to_node": "fiber (Morlaix \u2192 Brest_KLA)-F060"
"from_node": "fiber (Ploermel → Rennes_STA)-",
"to_node": "roadm Rennes_STA"
},
{
"from_node": "fiber (Brest_KLA \u2192 Morlaix)-F060",
"to_node": "egress fused spans in Morlaix"
"from_node": "fiber (Lannion_CAS → Morlaix)-F059",
"to_node": "west fused spans in Morlaix"
},
{
"from_node": "egress fused spans in Morlaix",
"to_node": "fiber (Morlaix \u2192 Lannion_CAS)-F059"
"from_node": "west fused spans in Morlaix",
"to_node": "fiber (Morlaix → Brest_KLA)-F060"
},
{
"from_node": "fiber (Brest_KLA → Morlaix)-F060",
"to_node": "east fused spans in Morlaix"
},
{
"from_node": "east fused spans in Morlaix",
"to_node": "fiber (Morlaix → Lannion_CAS)-F059"
},
{
"from_node": "roadm Brest_KLA",
"to_node": "fiber (Brest_KLA \u2192 Morlaix)-F060"
"to_node": "fiber (Brest_KLA Morlaix)-F060"
},
{
"from_node": "fiber (Morlaix \u2192 Brest_KLA)-F060",
"from_node": "fiber (Morlaix Brest_KLA)-F060",
"to_node": "roadm Brest_KLA"
},
{
"from_node": "roadm Brest_KLA",
"to_node": "fiber (Brest_KLA → Quimper)-"
},
{
"from_node": "fiber (Quimper → Brest_KLA)-",
"to_node": "roadm Brest_KLA"
},
{
"from_node": "fiber (Brest_KLA → Quimper)-",
"to_node": "fiber (Quimper → Lorient_KMA)-"
},
{
"from_node": "fiber (Lorient_KMA → Quimper)-",
"to_node": "fiber (Quimper → Brest_KLA)-"
},
{
"from_node": "fiber (Vannes_KBE → Ploermel)-",
"to_node": "fiber (Ploermel → Rennes_STA)-"
},
{
"from_node": "fiber (Rennes_STA → Ploermel)-",
"to_node": "fiber (Ploermel → Vannes_KBE)-"
},
{
"from_node": "trx Lannion_CAS",
"to_node": "roadm Lannion_CAS"

Binary file not shown.

View File

@@ -1,7 +1,7 @@
{
"path-request": [
{
"request-id": 0,
"request-id": "0",
"source": "Lorient_KMA",
"destination": "Vannes_KBE",
"src-tp-id": "trx Lorient_KMA",
@@ -9,8 +9,8 @@
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager_16QAM",
"trx_mode": "16QAM",
"trx_type": "Voyager",
"trx_mode": null,
"effective-freq-slot": [
{
"n": "null",
@@ -19,7 +19,8 @@
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.0012589254117941673
"output-power": 0.0012589254117941673,
"path_bandwidth": 100000000000.0
}
},
"optimizations": {
@@ -27,7 +28,7 @@
}
},
{
"request-id": 1,
"request-id": "1",
"source": "Brest_KLA",
"destination": "Vannes_KBE",
"src-tp-id": "trx Brest_KLA",
@@ -35,8 +36,8 @@
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager_16QAM",
"trx_mode": "16QAM",
"trx_type": "Voyager",
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"n": "null",
@@ -44,8 +45,9 @@
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.0012589254117941673
"max-nb-of-channel": null,
"output-power": 0.0012589254117941673,
"path_bandwidth": 200000000000.0
}
},
"optimizations": {
@@ -53,7 +55,7 @@
{
"index": 0,
"unnumbered-hop": {
"node-id": "Lannion_CAS",
"node-id": "roadm Brest_KLA",
"link-tp-id": "link-tp-id is not used",
"hop-type": "loose",
"direction": "direction is not used"
@@ -68,7 +70,37 @@
{
"index": 1,
"unnumbered-hop": {
"node-id": "Lorient_KMA",
"node-id": "roadm Lannion_CAS",
"link-tp-id": "link-tp-id is not used",
"hop-type": "loose",
"direction": "direction is not used"
},
"label-hop": {
"te-label": {
"generic": "generic is not used",
"direction": "direction is not used"
}
}
},
{
"index": 2,
"unnumbered-hop": {
"node-id": "roadm Lorient_KMA",
"link-tp-id": "link-tp-id is not used",
"hop-type": "loose",
"direction": "direction is not used"
},
"label-hop": {
"te-label": {
"generic": "generic is not used",
"direction": "direction is not used"
}
}
},
{
"index": 3,
"unnumbered-hop": {
"node-id": "roadm Vannes_KBE",
"link-tp-id": "link-tp-id is not used",
"hop-type": "loose",
"direction": "direction is not used"
@@ -84,7 +116,7 @@
}
},
{
"request-id": 3,
"request-id": "3",
"source": "Lannion_CAS",
"destination": "Rennes_STA",
"src-tp-id": "trx Lannion_CAS",
@@ -93,7 +125,7 @@
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "vendorA_trx-type1",
"trx_mode": "PS_SP64_1",
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"n": "null",
@@ -101,8 +133,9 @@
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.0012589254117941673
"max-nb-of-channel": null,
"output-power": null,
"path_bandwidth": 60000000000.0
}
},
"optimizations": {
@@ -110,7 +143,7 @@
}
},
{
"request-id": 4,
"request-id": "4",
"source": "Rennes_STA",
"destination": "Lannion_CAS",
"src-tp-id": "trx Rennes_STA",
@@ -119,7 +152,7 @@
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "vendorA_trx-type1",
"trx_mode": "PS_SP64_1",
"trx_mode": null,
"effective-freq-slot": [
{
"n": "null",
@@ -127,8 +160,117 @@
}
],
"spacing": 75000000000.0,
"max-nb-of-channel": 64,
"output-power": 0.0019952623149688794
"max-nb-of-channel": null,
"output-power": 0.0019952623149688794,
"path_bandwidth": 150000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "5",
"source": "Rennes_STA",
"destination": "Lannion_CAS",
"src-tp-id": "trx Rennes_STA",
"dst-tp-id": "trx Lannion_CAS",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "vendorA_trx-type1",
"trx_mode": "mode 2",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 75000000000.0,
"max-nb-of-channel": 63,
"output-power": 0.0019952623149688794,
"path_bandwidth": 20000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "6",
"source": "Lannion_CAS",
"destination": "Lorient_KMA",
"src-tp-id": "trx Lannion_CAS",
"dst-tp-id": "trx Lorient_KMA",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager",
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": 76,
"output-power": 0.001,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "7",
"source": "Lannion_CAS",
"destination": "Lorient_KMA",
"src-tp-id": "trx Lannion_CAS",
"dst-tp-id": "trx Lorient_KMA",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager",
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": 76,
"output-power": 0.001,
"path_bandwidth": 400000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "7b",
"source": "Lannion_CAS",
"destination": "Lorient_KMA",
"src-tp-id": "trx Lannion_CAS",
"dst-tp-id": "trx Lorient_KMA",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager",
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 75000000000.0,
"max-nb-of-channel": 50,
"output-power": 0.001,
"path_bandwidth": 400000000000.0
}
},
"optimizations": {
@@ -136,30 +278,30 @@
}
}
],
"synchronisation": [
"synchronization": [
{
"synchonization-id": 0,
"synchronization-id": "3",
"svec": {
"relaxable": "False",
"link-diverse": "True",
"node-diverse": "True",
"request-id-number": [
0,
0
"3",
"1"
]
}
},
{
"synchonization-id": 3,
"synchronization-id": "4",
"svec": {
"relaxable": "False",
"link-diverse": "True",
"node-diverse": "True",
"request-id-number": [
3,
4
"4",
"5"
]
}
}
]
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -19,16 +19,21 @@ from collections import namedtuple
from logging import getLogger, basicConfig, CRITICAL, DEBUG, INFO
from json import dumps, loads
from networkx import (draw_networkx_nodes, draw_networkx_edges,
draw_networkx_labels, dijkstra_path, NetworkXNoPath)
draw_networkx_labels)
from numpy import mean
from examples.convert_service_sheet import convert_service_sheet, Request_element, Element
from gnpy.core.service_sheet import convert_service_sheet, Request_element, Element
from gnpy.core.utils import load_json
from gnpy.core.network import load_network, build_network, set_roadm_loss
from gnpy.core.equipment import load_equipment, trx_mode_params
from gnpy.core.elements import Transceiver, Roadm, Edfa, Fused
from gnpy.core.network import load_network, build_network, set_roadm_loss, save_network
from gnpy.core.equipment import load_equipment, trx_mode_params, automatic_nch, automatic_spacing
from gnpy.core.elements import Transceiver, Roadm, Edfa, Fused, Fiber
from gnpy.core.utils import db2lin, lin2db
from gnpy.core.request import Path_request, Result_element, compute_constrained_path, propagate, jsontocsv
from gnpy.core.request import (Path_request, Result_element, compute_constrained_path,
propagate, jsontocsv, Disjunction, compute_path_dsjctn, requests_aggregation,
propagate_and_optimize_mode)
from copy import copy, deepcopy
from textwrap import dedent
from math import ceil
import time
#EQPT_LIBRARY_FILENAME = Path(__file__).parent / 'eqpt_config.json'
@@ -38,15 +43,15 @@ parser = ArgumentParser(description = 'A function that computes performances for
parser.add_argument('network_filename', nargs='?', type = Path, default= Path(__file__).parent / 'meshTopologyExampleV2.xls')
parser.add_argument('service_filename', nargs='?', type = Path, default= Path(__file__).parent / 'meshTopologyExampleV2.xls')
parser.add_argument('eqpt_filename', nargs='?', type = Path, default=Path(__file__).parent / 'eqpt_config.json')
parser.add_argument('-v', '--verbose', action='count')
parser.add_argument('-o', '--output', default=None)
parser.add_argument('-v', '--verbose', action='count', default=0, help='increases verbosity for each occurence')
parser.add_argument('-o', '--output', type = Path)
def requests_from_json(json_data,equipment):
requests_list = []
for req in json_data['path-request']:
#print(f'{req}')
# init all params from request
params = {}
params['request_id'] = req['request-id']
params['source'] = req['src-tp-id']
@@ -59,27 +64,89 @@ def requests_from_json(json_data,equipment):
params['loose_list'] = [n['unnumbered-hop']['hop-type'] for n in nd_list]
params['spacing'] = req['path-constraints']['te-bandwidth']['spacing']
# recover trx physical param (baudrate, ...) from type and mode
# in trx_mode_params optical power is read from equipment['SI']['default'] and
# nb_channel is computed based on min max frequency and spacing
trx_params = trx_mode_params(equipment,params['trx_type'],params['trx_mode'],True)
params.update(trx_params)
params['power'] = req['path-constraints']['te-bandwidth']['output-power']
params['nb_channel'] = req['path-constraints']['te-bandwidth']['max-nb-of-channel']
# print(trx_params['min_spacing'])
# optical power might be set differently in the request. if it is indicated then the
# params['power'] is updated
if req['path-constraints']['te-bandwidth']['output-power']:
params['power'] = req['path-constraints']['te-bandwidth']['output-power']
# same process for nb-channel
f_min = params['f_min']
f_max_from_si = params['f_max']
if req['path-constraints']['te-bandwidth']['max-nb-of-channel'] is not None :
nch = req['path-constraints']['te-bandwidth']['max-nb-of-channel']
params['nb_channel'] = nch
spacing = params['spacing']
params['f_max'] = f_min + nch*spacing
else :
params['nb_channel'] = automatic_nch(f_min,f_max_from_si,params['spacing'])
consistency_check(params, f_max_from_si)
try :
params['path_bandwidth'] = req['path-constraints']['te-bandwidth']['path_bandwidth']
except KeyError:
pass
requests_list.append(Path_request(**params))
return requests_list
def consistency_check(params, f_max_from_si):
f_min = params['f_min']
f_max = params['f_max']
max_recommanded_nb_channels = automatic_nch(f_min,f_max,
params['spacing'])
if params['baud_rate'] is not None:
#implicitely means that a mode is defined with min_spacing
if params['min_spacing']>params['spacing'] :
msg = f'Request {params["request_id"]} has spacing below transponder {params["trx_type"]}'+\
f' {params["trx_mode"]} min spacing value {params["min_spacing"]*1e-9}GHz.\n'+\
'Computation stopped'
print(msg)
logger.critical(msg)
exit()
if f_max>f_max_from_si:
msg = dedent(f'''
Requested channel number {params["nb_channel"]}, baud rate {params["baud_rate"]} GHz and requested spacing {params["spacing"]*1e-9}GHz
is not consistent with frequency range {f_min*1e-12} THz, {f_max*1e-12} THz, min recommanded spacing {params["min_spacing"]*1e-9}GHz.
max recommanded nb of channels is {max_recommanded_nb_channels}
Computation stopped.''')
logger.critical(msg)
exit()
def disjunctions_from_json(json_data):
disjunctions_list = []
for snc in json_data['synchronization']:
params = {}
params['disjunction_id'] = snc['synchronization-id']
params['relaxable'] = snc['svec']['relaxable']
params['link_diverse'] = snc['svec']['link-diverse']
params['node_diverse'] = snc['svec']['node-diverse']
params['disjunctions_req'] = snc['svec']['request-id-number']
disjunctions_list.append(Disjunction(**params))
return disjunctions_list
def load_requests(filename,eqpt_filename):
if filename.suffix.lower() == '.xls':
logger.info('Automatically converting requests from XLS to JSON')
json_data = convert_service_sheet(filename,eqpt_filename)
else:
with open(filename) as f:
with open(filename, encoding='utf-8') as f:
json_data = loads(f.read())
return json_data
def compute_path(network, equipment, pathreqlist):
# This function is obsolete and not relevant with respect to network building: suggest either to correct
# or to suppress it
path_res_list = []
for pathreq in pathreqlist:
@@ -97,8 +164,7 @@ def compute_path(network, equipment, pathreqlist):
print(f'with path constraint: {[pathreq.source]+pathreq.nodes_list}') #adding first node to be clearer on the output
total_path = compute_constrained_path(network, pathreq)
print(f'Computed path (roadms):{[e.uid for e in total_path if isinstance(e, Roadm)]}\n')
# for debug
# print(f'{pathreq.baud_rate} {pathreq.power} {pathreq.spacing} {pathreq.nb_channel}')
if total_path :
total_path = propagate(total_path,pathreq,equipment, show=False)
else:
@@ -114,6 +180,117 @@ def compute_path(network, equipment, pathreqlist):
path_res_list.append(deepcopy(total_path))
return path_res_list
def compute_path_with_disjunction(network, equipment, pathreqlist, pathlist):
# use a list but a dictionnary might be helpful to find path bathsed on request_id
# TODO change all these req, dsjct, res lists into dict !
path_res_list = []
for i,pathreq in enumerate(pathreqlist):
# use the power specified in requests but might be different from the one specified for design
# the power is an optional parameter for requests definition
# if optional, use the one defines in eqt_config.json
p_db = lin2db(pathreq.power*1e3)
p_total_db = p_db + lin2db(pathreq.nb_channel)
print(f'request {pathreq.request_id}')
print(f'Computing path from {pathreq.source} to {pathreq.destination}')
print(f'with path constraint: {[pathreq.source]+pathreq.nodes_list}') #adding first node to be clearer on the output
total_path = pathlist[i]
print(f'Computed path (roadms):{[e.uid for e in total_path if isinstance(e, Roadm)]}\n')
# for debug
# print(f'{pathreq.baud_rate} {pathreq.power} {pathreq.spacing} {pathreq.nb_channel}')
if total_path :
if pathreq.baud_rate is not None:
total_path = propagate(total_path,pathreq,equipment, show=False)
temp_snr01nm = round(mean(total_path[-1].snr+lin2db(pathreq.baud_rate/(12.5e9))),2)
if temp_snr01nm < pathreq.OSNR :
msg = f'\tWarning! Request {pathreq.request_id} computed path from {pathreq.source} to {pathreq.destination} does not pass with {pathreq.tsp_mode}\n' +\
f'\tcomputedSNR in 0.1nm = {temp_snr01nm} - required osnr {pathreq.OSNR}\n'
print(msg)
logger.warning(msg)
total_path = []
else:
total_path,mode = propagate_and_optimize_mode(total_path,pathreq,equipment)
# if no baudrate satisfies spacing, no mode is returned and an empty path is returned
# a warning is shown in the propagate_and_optimize_mode
if mode is not None :
# propagate_and_optimize_mode function returns the mode with the highest bitrate
# that passes. if no mode passes, then it returns an empty path
pathreq.baud_rate = mode['baud_rate']
pathreq.tsp_mode = mode['format']
pathreq.format = mode['format']
pathreq.OSNR = mode['OSNR']
pathreq.tx_osnr = mode['tx_osnr']
pathreq.bit_rate = mode['bit_rate']
else :
total_path = []
# we record the last tranceiver object in order to have th whole
# information about spectrum. Important Note: since transceivers
# attached to roadms are actually logical elements to simulate
# performance, several demands having the same destination may use
# the same transponder for the performance simaulation. This is why
# we use deepcopy: to ensure each propagation is recorded and not
# overwritten
path_res_list.append(deepcopy(total_path))
return path_res_list
def correct_route_list(network, pathreqlist):
# prepares the format of route list of nodes to be consistant
# remove wrong names, remove endpoints
# also correct source and destination
anytype = [n.uid for n in network.nodes() if not isinstance(n, Transceiver) and not isinstance(n, Fiber)]
# TODO there is a problem of identification of fibers in case of parallel fibers bitween 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:
for i,n_id in enumerate(pathreq.nodes_list):
# replace possibly wrong name with a formated roadm name
# print(n_id)
if n_id not in anytype :
nodes_suggestion = [uid for uid in anytype \
if n_id.lower() in uid.lower()]
if pathreq.loose_list[i] == 'loose':
if len(nodes_suggestion)>0 :
new_n = nodes_suggestion[0]
print(f'invalid route node specified:\
\n\'{n_id}\', replaced with \'{new_n}\'')
pathreq.nodes_list[i] = new_n
else:
print(f'\x1b[1;33;40m'+f'invalid route node specified \'{n_id}\', could not use it as constraint, skipped!'+'\x1b[0m')
pathreq.nodes_list.remove(n_id)
pathreq.loose_list.pop(i)
else:
msg = f'\x1b[1;33;40m'+f'could not find node : {n_id} in network topology. Strict constraint can not be applied.'+'\x1b[0m'
logger.critical(msg)
raise ValueError(msg)
if pathreq.source not in transponders:
msg = f'\x1b[1;31;40m'+f'Request: {pathreq.request_id}: could not find transponder source : {pathreq.source}.'+'\x1b[0m'
logger.critical(msg)
print(f'{msg}\nComputation stopped.')
exit()
if pathreq.destination not in transponders:
msg = f'\x1b[1;31;40m'+f'Request: {pathreq.request_id}: could not find transponder destination : {pathreq.destination}.'+'\x1b[0m'
logger.critical(msg)
print(f'{msg}\nComputation stopped.')
exit()
# TODO remove endpoints from this list in case they were added by the user in the xls or json files
return pathreqlist
def correct_disjn(disjn):
local_disjn = disjn.copy()
for el in local_disjn:
for d in local_disjn:
if set(el.disjunctions_req) == set(d.disjunctions_req) and\
el.disjunction_id != d.disjunction_id:
local_disjn.remove(d)
return local_disjn
def path_result_json(pathresult):
data = {
'path': [n.json for n in pathresult]
@@ -122,44 +299,101 @@ def path_result_json(pathresult):
if __name__ == '__main__':
start = time.time()
args = parser.parse_args()
basicConfig(level={2: DEBUG, 1: INFO, 0: CRITICAL}.get(args.verbose, CRITICAL))
basicConfig(level={2: DEBUG, 1: INFO, 0: CRITICAL}.get(args.verbose, DEBUG))
logger.info(f'Computing path requests {args.service_filename} into JSON format')
print('\x1b[1;34;40m'+f'Computing path requests {args.service_filename} into JSON format'+ '\x1b[0m')
# for debug
# print( args.eqpt_filename)
data = load_requests(args.service_filename,args.eqpt_filename)
equipment = load_equipment(args.eqpt_filename)
network = load_network(args.network_filename,equipment)
pths = requests_from_json(data, equipment)
print(pths)
test = compute_path(network, equipment, pths)
#TODO write results
# 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
p_db = equipment['SI']['default'].power_dbm
p_total_db = p_db + lin2db(automatic_nch(equipment['SI']['default'].f_min,\
equipment['SI']['default'].f_max, equipment['SI']['default'].spacing))
build_network(network, equipment, p_db, p_total_db)
save_network(args.network_filename, network)
header = ['demand','snr@bandwidth','snr@0.1nm','Receiver minOSNR']
rqs = requests_from_json(data, equipment)
# check that request ids are unique. Non unique ids, may
# mess the computation : better to stop the computation
all_ids = [r.request_id for r in rqs]
if len(all_ids) != len(set(all_ids)):
for a in list(set(all_ids)):
all_ids.remove(a)
msg = f'Requests id {all_ids} are not unique'
logger.critical(msg)
exit()
rqs = correct_route_list(network, rqs)
# pths = compute_path(network, equipment, rqs)
dsjn = disjunctions_from_json(data)
print('\x1b[1;34;40m'+f'List of disjunctions'+ '\x1b[0m')
print(dsjn)
# need to warn or correct in case of wrong disjunction form
# disjunction must not be repeated with same or different ids
dsjn = correct_disjn(dsjn)
# Aggregate demands with same exact constraints
print('\x1b[1;34;40m'+f'Aggregating similar requests'+ '\x1b[0m')
rqs,dsjn = requests_aggregation(rqs,dsjn)
# TODO export novel set of aggregated demands in a json file
print('\x1b[1;34;40m'+'The following services have been requested:'+ '\x1b[0m')
print(rqs)
print('\x1b[1;34;40m'+f'Computing all paths with constraints'+ '\x1b[0m')
pths = compute_path_dsjctn(network, equipment, rqs, dsjn)
print('\x1b[1;34;40m'+f'Propagating on selected path'+ '\x1b[0m')
propagatedpths = compute_path_with_disjunction(network, equipment, rqs, pths)
end = time.time()
print(f'computation time {end-start}')
print('\x1b[1;34;40m'+f'Result summary'+ '\x1b[0m')
header = ['req id', ' demand',' snr@bandwidth',' snr@0.1nm',' Receiver minOSNR', ' mode', ' Gbit/s' , ' nb of tsp pairs']
data = []
data.append(header)
for i, p in enumerate(test):
for i, p in enumerate(propagatedpths):
if p:
line = [f'{pths[i].source} to {pths[i].destination} : ', f'{round(mean(p[-1].snr),2)}',\
f'{round(mean(p[-1].snr+lin2db(pths[i].baud_rate/(12.5e9))),2)}',\
f'{pths[i].OSNR}']
line = [f'{rqs[i].request_id}', f' {rqs[i].source} to {rqs[i].destination} : ', f'{round(mean(p[-1].snr),2)}',\
f'{round(mean(p[-1].snr+lin2db(rqs[i].baud_rate/(12.5e9))),2)}',\
f'{rqs[i].OSNR}', f'{rqs[i].tsp_mode}' , f'{round(rqs[i].path_bandwidth * 1e-9,2)}' , f'{ceil(rqs[i].path_bandwidth / rqs[i].bit_rate) }']
else:
line = [f'no path from {pths[i].source} to {pths[i].destination} ']
line = [f'{rqs[i].request_id}',f' {rqs[i].source} to {rqs[i].destination} : not feasible ']
data.append(line)
col_width = max(len(word) for row in data for word in row) # padding
col_width = max(len(word) for row in data for word in row[2:]) # padding
firstcol_width = max(len(row[0]) for row in data ) # padding
secondcol_width = max(len(row[1]) for row in data ) # padding
for row in data:
print(''.join(word.ljust(col_width) for word in row))
firstcol = ''.join(row[0].ljust(firstcol_width))
secondcol = ''.join(row[1].ljust(secondcol_width))
remainingcols = ''.join(word.center(col_width,' ') for word in row[2:])
print(f'{firstcol} {secondcol} {remainingcols}')
if args.output :
result = []
for p in test:
result.append(Result_element(pths[test.index(p)],p))
with open(args.output, 'w') as f:
f.write(dumps(path_result_json(result), indent=2))
fnamecsv = next(s for s in args.output.split('.')) + '.csv'
with open(fnamecsv,"w") as fcsv :
jsontocsv(path_result_json(result),equipment,fcsv)
# assumes that list of rqs and list of propgatedpths have same order
for i,p in enumerate(propagatedpths):
result.append(Result_element(rqs[i],p))
temp = path_result_json(result)
fnamecsv = f'{str(args.output)[0:len(str(args.output))-len(str(args.output.suffix))]}.csv'
fnamejson = f'{str(args.output)[0:len(str(args.output))-len(str(args.output.suffix))]}.json'
with open(fnamejson, 'w', encoding='utf-8') as f:
f.write(dumps(path_result_json(result), indent=2, ensure_ascii=False))
with open(fnamecsv,"w", encoding='utf-8') as fcsv :
jsontocsv(temp,equipment,fcsv)
print('\x1b[1;34;40m'+f'saving in {args.output} and {fnamecsv}'+ '\x1b[0m')

View File

@@ -18,7 +18,7 @@ from pathlib import Path
from json import loads
from collections import Counter
from logging import getLogger, basicConfig, INFO, ERROR, DEBUG
from numpy import arange, mean
from numpy import linspace, mean
from matplotlib.pyplot import show, axis, figure, title
from networkx import (draw_networkx_nodes, draw_networkx_edges,
draw_networkx_labels, dijkstra_path)
@@ -85,12 +85,9 @@ def main(network, equipment, source, destination, req = None):
print(f'\nNow propagating between {source.uid} and {destination.uid}:')
try:
power_range = list(arange(*equipment['SI']['default'].power_range_db))
last = equipment['SI']['default'].power_range_db[-2]
if len(power_range) == 0 : #bad input that will lead to no simulation
power_range = [0] #better than an error message
else:
power_range.append(last)
p_start, p_stop, p_step = equipment['SI']['default'].power_range_db
p_num = abs(int(round((p_stop - p_start)/p_step))) + 1 if p_step != 0 else 1
power_range = list(linspace(p_start, p_stop, p_num))
except TypeError:
print('invalid power range definition in eqpt_config, should be power_range_db: [lower, upper, step]')
power_range = [0]
@@ -101,6 +98,12 @@ def main(network, equipment, source, destination, req = None):
propagate(path, req, equipment, show=len(power_range)==1)
print(f'\nTransmission result for input power = {lin2db(req.power*1e3):.2f}dBm :')
print(destination)
#print(f'\n !!!!!!!!!!!!!!!!! TEST POINT !!!!!!!!!!!!!!!!!!!!!')
#print(f'carriers ase output of {path[1]} =\n {list(path[1].carriers("out", "nli"))}')
# => use "in" or "out" parameter
# => use "nli" or "ase" or "signal" or "total" parameter
simulation_data.append({
'Pch_dBm' : pref_ch_db + dp_db,
'OSNR_ASE_0.1nm' : round(mean(destination.osnr_ase_01nm),2),
@@ -115,10 +118,11 @@ def main(network, equipment, source, destination, req = None):
parser = ArgumentParser()
parser.add_argument('-e', '--equipment', type=Path,
default=Path(__file__).parent / 'eqpt_config.json')
parser.add_argument('-pl', '--plot', action='store_true', default=False)
parser.add_argument('-v', '--verbose', action='count')
parser.add_argument('-l', '--list-nodes', action='store_true', default=False, help='list all transceiver nodes')
parser.add_argument('-pl', '--plot', action='store_true')
parser.add_argument('-v', '--verbose', action='count', default=0, help='increases verbosity for each occurence')
parser.add_argument('-l', '--list-nodes', action='store_true', help='list all transceiver nodes')
parser.add_argument('-po', '--power', default=0, help='channel ref power in dBm')
parser.add_argument('-names', '--names-matching', action='store_true', help='display network names that are closed matches')
#parser.add_argument('-plb', '--power-lower-bound', default=0, help='power sweep lower bound')
#parser.add_argument('-pub', '--power-upper-bound', default=1, help='power sweep upper bound')
parser.add_argument('filename', nargs='?', type=Path,
@@ -129,12 +133,12 @@ parser.add_argument('destination', nargs='?', help='destination node')
if __name__ == '__main__':
args = parser.parse_args()
basicConfig(level={0: ERROR, 1: INFO, 2: DEBUG}.get(args.verbose, ERROR))
basicConfig(level={0: ERROR, 1: INFO, 2: DEBUG}.get(args.verbose, DEBUG))
equipment = load_equipment(args.equipment)
# logger.info(equipment)
# print(args.filename)
network = load_network(args.filename, equipment)
network = load_network(args.filename, equipment, args.names_matching)
# print(network)
transceivers = {n.uid: n for n in network.nodes() if isinstance(n, Transceiver)}
@@ -148,38 +152,40 @@ if __name__ == '__main__':
for uid in transceivers:
print(uid)
exit()
#First try to find exact match if source/destination provided
if args.source:
try:
source = next(transceivers[uid] for uid in transceivers if uid == args.source)
except StopIteration as e:
#TODO code a more advanced regex to find nodes match
nodes_suggestion = [uid for uid in transceivers \
if args.source.lower() in uid.lower()]
source = transceivers[nodes_suggestion[0]] \
if len(nodes_suggestion)>0 else list(transceivers.values())[0]
print(f'invalid souce node specified, did you mean:\
\n{nodes_suggestion}?\
\n{args.source!r}, replaced with {source.uid}')
del transceivers[source.uid]
source = transceivers.pop(args.source, None)
valid_source = True if source else False
else:
source = None
logger.info('No source node specified: picking random transceiver')
source = list(transceivers.values())[0]
if args.destination:
try:
destination = next(transceivers[uid] for uid in transceivers if uid == args.destination)
except StopIteration as e:
nodes_suggestion = [uid for uid in transceivers \
if args.destination.lower() in uid.lower()]
destination = transceivers[nodes_suggestion[0]] \
if len(nodes_suggestion)>0 else list(transceivers.values())[0]
print(f'invalid destination node specified, did you mean:\
\n{nodes_suggestion}?\
\n{args.destination!r}, replaced with {destination.uid}')
destination = transceivers.pop(args.destination, None)
valid_destination = True if destination else False
else:
destination = None
logger.info('No destination node specified: picking random transceiver')
destination = list(transceivers.values())[1]
#If no exact match try to find partial match
if args.source and not source:
#TODO code a more advanced regex to find nodes match
source = next((transceivers.pop(uid) for uid in transceivers \
if args.source.lower() in uid.lower()), None)
if args.destination and not destination:
#TODO code a more advanced regex to find nodes match
destination = next((transceivers.pop(uid) for uid in transceivers \
if args.destination.lower() in uid.lower()), None)
#If no partial match or no source/destination provided pick random
if not source:
source = list(transceivers.values())[0]
del transceivers[source.uid]
if not destination:
destination = list(transceivers.values())[0]
logger.info(f'source = {args.source!r}')
logger.info(f'destination = {args.destination!r}')
@@ -193,6 +199,7 @@ if __name__ == '__main__':
params['nodes_list'] = [destination.uid]
params['loose_list'] = ['strict']
params['format'] = ''
params['path_bandwidth'] = 0
trx_params = trx_mode_params(equipment)
if args.power:
trx_params['power'] = db2lin(float(args.power))*1e-3
@@ -201,5 +208,15 @@ if __name__ == '__main__':
path = main(network, equipment, source, destination, req)
save_network(args.filename, network)
if not args.source:
print(f'\n(No source node specified: picked {source.uid})')
elif not valid_source:
print(f'\n(Invalid source node {args.source!r} replaced with {source.uid})')
if not args.destination:
print(f'\n(No destination node specified: picked {destination.uid})')
elif not valid_destination:
print(f'\n(Invalid destination node {args.destination!r} replaced with {destination.uid})')
if args.plot:
plot_results(network, path, source, destination)

View File

@@ -26,8 +26,8 @@ parser.add_argument('eqpt_filename', nargs='?', type = Path, default=Path(__file
if __name__ == '__main__':
args = parser.parse_args()
with open(args.output_filename,"w") as file :
with open(args.filename) as f:
with open(args.output_filename, 'w', encoding='utf-8') as file:
with open(args.filename, encoding='utf-8') as f:
print(f'Reading {args.filename}')
json_data = loads(f.read())
equipment = load_equipment(args.eqpt_filename)

View File

@@ -30,49 +30,181 @@ from collections import namedtuple, Counter, defaultdict
from itertools import chain
from json import dumps
from pathlib import Path
from difflib import get_close_matches
import time
all_rows = lambda sh, start=0: (sh.row(x) for x in range(start, sh.nrows))
class Node(namedtuple('Node', 'city state country region latitude longitude node_type')):
def __new__(cls, city, state='', country='', region='', latitude=0, longitude=0, node_type='ILA'):
values = [latitude, longitude, node_type]
default_values = [0, 0, 'ILA']
values = [x[0] if x[0] != '' else x[1] for x in zip(values,default_values)]
return super().__new__(cls, city, state, country, region, *values)
class Node(object):
def __init__(self, **kwargs):
super(Node, self).__init__()
self.update_attr(kwargs)
class Link(namedtuple('Link', 'from_city to_city \
east_distance east_fiber east_lineic east_con_in east_con_out east_pmd east_cable \
west_distance west_fiber west_lineic west_con_in west_con_out west_pmd west_cable \
distance_units')):
def __new__(cls, from_city, to_city,
east_distance, east_fiber='SSMF', east_lineic=0.2,
east_con_in=None, east_con_out=None, east_pmd=0.1, east_cable='',
west_distance='', west_fiber='', west_lineic='',
west_con_in='', west_con_out='', west_pmd='', west_cable='',
distance_units='km'):
east_values = [east_distance, east_fiber, east_lineic, east_con_in, east_con_out,
east_pmd, east_cable]
west_values = [west_distance, west_fiber, west_lineic, west_con_in, west_con_out,
west_pmd, west_cable]
default_values = [80,'SSMF',0.2,None,None,0.1,'']
east_values = [x[0] if x[0] != '' else x[1] for x in zip(east_values,default_values)]
west_values = [x[0] if x[0] != '' else x[1] for x in zip(west_values,east_values)]
return super().__new__(cls, from_city, to_city, *east_values, *west_values, distance_units)
def update_attr(self, kwargs):
clean_kwargs = {k:v for k,v in kwargs.items() if v !=''}
for k,v in self.default_values.items():
v = clean_kwargs.get(k,v)
setattr(self, k, v)
default_values = \
{
'city': '',
'state': '',
'country': '',
'region': '',
'latitude': 0,
'longitude': 0,
'node_type': 'ILA'
}
class Eqpt(namedtuple('Eqpt', 'from_city to_city \
egress_amp_type egress_att_in egress_amp_gain egress_amp_tilt egress_amp_att_out\
ingress_amp_type ingress_att_in ingress_amp_gain ingress_amp_tilt ingress_amp_att_out')):
def __new__(cls, from_city='', to_city='',
egress_amp_type='', egress_att_in=0, egress_amp_gain=0, egress_amp_tilt=0, egress_amp_att_out=0,
ingress_amp_type='', ingress_att_in=0, ingress_amp_gain=0, ingress_amp_tilt=0, ingress_amp_att_out=0):
values = [from_city, to_city,
egress_amp_type, egress_att_in, egress_amp_gain, egress_amp_tilt, egress_amp_att_out,
ingress_amp_type, ingress_att_in, ingress_amp_gain, ingress_amp_tilt, ingress_amp_att_out]
default_values = ['','','',0,0,0,0,'',0,0,0,0]
values = [x[0] if x[0] != '' else x[1] for x in zip(values,default_values)]
return super().__new__(cls, *values)
class Link(object):
"""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__()
self.update_attr(kwargs)
self.distance_units = 'km'
def update_attr(self, kwargs):
clean_kwargs = {k:v for k,v in kwargs.items() if v !=''}
for k,v in self.default_values.items():
v = clean_kwargs.get(k,v)
setattr(self, k, v)
k = 'west' + k.split('east')[-1]
v = clean_kwargs.get(k,v)
setattr(self, k, v)
def __eq__(self, link):
return (self.from_city == link.from_city and self.to_city == link.to_city) \
or (self.from_city == link.to_city and self.to_city == link.from_city)
default_values = \
{
'from_city': '',
'to_city': '',
'east_distance': 80,
'east_fiber': 'SSMF',
'east_lineic': 0.2,
'east_con_in': None,
'east_con_out': None,
'east_pmd': 0.1,
'east_cable': ''
}
class Eqpt(object):
def __init__(self, **kwargs):
super(Eqpt, self).__init__()
self.update_attr(kwargs)
def update_attr(self, kwargs):
clean_kwargs = {k:v for k,v in kwargs.items() if v !=''}
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]
v_west = clean_kwargs.get(k,v)
setattr(self, k, v_west)
default_values = \
{
'from_city': '',
'to_city': '',
'east_amp_type': '',
'east_att_in': 0,
'east_amp_gain': 0,
'east_tilt': 0,
'east_att_out': 0
}
def read_header(my_sheet, line, slice_):
""" return the list of headers !:= ''
header_i = [(header, header_column_index), ...]
in a {line, slice1_x, slice_y} range
"""
Param_header = namedtuple('Param_header', 'header colindex')
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:
header_i = []
if header_i != [] and header_i[-1].colindex != slice_[1]:
header_i.append(Param_header('',slice_[1]))
return header_i
def read_slice(my_sheet, line, slice_, header):
"""return the slice range of a given header
in a defined range {line, slice_x, slice_y}"""
header_i = read_header(my_sheet, line, slice_)
slice_range = (-1,-1)
if header_i != []:
try:
slice_range = next((h.colindex,header_i[i+1].colindex) \
for i,h in enumerate(header_i) if header in h.header)
except:
pass
return slice_range
def parse_headers(my_sheet, input_headers_dict, headers, start_line, slice_in):
"""return a dict of header_slice
key = column index
value = header name"""
for h0 in input_headers_dict:
slice_out = read_slice(my_sheet, start_line, slice_in, h0)
iteration = 1
while slice_out == (-1,-1) and iteration < 10:
#try next lines
#print(h0, iteration)
slice_out = read_slice(my_sheet, start_line+iteration, slice_in, h0)
iteration += 1
if slice_out == (-1, -1):
if h0 == 'east':
print(f'\x1b[1;31;40m'+f'CRITICAL: missing _east_ header above other headers (hierarchical) _ ABORT'+ '\x1b[0m')
exit()
else:
print(f'missing header {h0}')
elif not isinstance(input_headers_dict[h0], dict):
headers[slice_out[0]] = input_headers_dict[h0]
else:
headers = parse_headers(my_sheet, input_headers_dict[h0], headers, start_line+1, slice_out)
if headers == {}:
print(f'\x1b[1;31;40m'+f'CRITICAL ERROR: could not find any header to read _ ABORT'+ '\x1b[0m')
exit()
return headers
def parse_row(row, headers):
#print([label for label in ept.values()])
#print([i for i in ept.keys()])
#print(row[i for i in ept.keys()])
return {f: r.value for f, r in \
zip([label for label in headers.values()], [row[i] for i in headers])}
#if r.ctype != XL_CELL_EMPTY}
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 sanity_check(nodes, links, nodes_by_city, links_by_city, eqpts_by_city):
duplicate_links = []
for l1 in links:
for l2 in links:
if l1 is not l2 and l1 == l2 and l2 not in duplicate_links:
print(f'\nWARNING\n \
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 != []:
#time.sleep(3)
for l in duplicate_links:
links.remove(l)
def sanity_check(nodes, nodes_by_city, links_by_city, eqpts_by_city):
try :
test_nodes = [n for n in nodes_by_city if not n in links_by_city]
test_links = [n for n in links_by_city if not n in nodes_by_city]
@@ -81,7 +213,7 @@ def sanity_check(nodes, nodes_by_city, links_by_city, eqpts_by_city):
and (test_links == [] or test_links ==[''])\
and (test_eqpts == [] or test_eqpts ==[''])
except AssertionError:
print(f'!names in Nodes and Links sheets do no match, check:\
print(f'CRITICAL error: \nNames in Nodes and Links sheets do no match, check:\
\n{test_nodes} in Nodes sheet\
\n{test_links} in Links sheet\
\n{test_eqpts} in Eqpt sheet')
@@ -94,11 +226,13 @@ def sanity_check(nodes, nodes_by_city, links_by_city, eqpts_by_city):
#TODO : put in log rather than print
print(f'invalid node type ({nodes_by_city[city].node_type})\
specified in {city}, replaced by ROADM')
nodes_by_city[city] = nodes_by_city[city]._replace(node_type='ROADM')
nodes = [n._replace(node_type='ROADM') if n.city==city else n for n in nodes]
return nodes
nodes_by_city[city].node_type = 'ROADM'
for n in nodes:
if n.city==city:
n.node_type='ROADM'
return nodes, links
def convert_file(input_filename, filter_region=[]):
def convert_file(input_filename, names_matching=False, filter_region=[]):
nodes, links, eqpts = parse_excel(input_filename)
if filter_region:
@@ -109,9 +243,32 @@ def convert_file(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}
#create matching dictionary for node name mismatch analysis
cities = {''.join(c.strip() for c in n.city.split('C+L')).lower(): n.city for n in nodes}
cities_to_match = [k for k in cities]
city_match_dic = defaultdict(list)
for city in cities:
if city in cities_to_match:
cities_to_match.remove(city)
matches = get_close_matches(city, cities_to_match, 4, 0.85)
for m in matches:
city_match_dic[cities[city]].append(cities[m])
#check lower case/upper case
for city in nodes_by_city:
for match_city in nodes_by_city:
if match_city.lower() == city.lower() and match_city != city:
city_match_dic[city].append(match_city)
if names_matching:
print('\ncity match dictionary:',city_match_dic)
with open('name_match_dictionary.json', 'w', encoding='utf-8') as city_match_dic_file:
city_match_dic_file.write(dumps(city_match_dic, indent=2, ensure_ascii=False))
global links_by_city
links_by_city = defaultdict(list)
for link in links:
@@ -123,7 +280,7 @@ def convert_file(input_filename, filter_region=[]):
for eqpt in eqpts:
eqpts_by_city[eqpt.from_city].append(eqpt)
nodes = sanity_check(nodes, nodes_by_city, links_by_city, eqpts_by_city)
nodes, links = sanity_check(nodes, links, nodes_by_city, links_by_city, eqpts_by_city)
data = {
'elements':
@@ -141,21 +298,21 @@ def convert_file(input_filename, filter_region=[]):
'longitude': x.longitude}},
'type': 'Roadm'}
for x in nodes_by_city.values() if x.node_type.lower() == 'roadm'] +
[{'uid': f'ingress fused spans in {x.city}',
[{'uid': f'west fused spans in {x.city}',
'metadata': {'location': {'city': x.city,
'region': x.region,
'latitude': x.latitude,
'longitude': x.longitude}},
'type': 'Fused'}
for x in nodes_by_city.values() if x.node_type.lower() == 'fused'] +
[{'uid': f'egress fused spans in {x.city}',
[{'uid': f'east fused spans in {x.city}',
'metadata': {'location': {'city': x.city,
'region': x.region,
'latitude': x.latitude,
'longitude': x.longitude}},
'type': 'Fused'}
for x in nodes_by_city.values() if x.node_type.lower() == 'fused'] +
[{'uid': f'fiber ({x.from_city} {x.to_city})-{x.east_cable}',
[{'uid': f'fiber ({x.from_city} \u2192 {x.to_city})-{x.east_cable}',
'metadata': {'location': midpoint(nodes_by_city[x.from_city],
nodes_by_city[x.to_city])},
'type': 'Fiber',
@@ -167,7 +324,7 @@ def convert_file(input_filename, filter_region=[]):
'con_out':x.east_con_out}
}
for x in links] +
[{'uid': f'fiber ({x.to_city} {x.from_city})-{x.west_cable}',
[{'uid': f'fiber ({x.to_city} \u2192 {x.from_city})-{x.west_cable}',
'metadata': {'location': midpoint(nodes_by_city[x.from_city],
nodes_by_city[x.to_city])},
'type': 'Fiber',
@@ -179,28 +336,30 @@ def convert_file(input_filename, filter_region=[]):
'con_out':x.west_con_out}
} # missing ILA construction
for x in links] +
[{'uid': f'egress edfa in {e.from_city} to {e.to_city}',
[{'uid': f'east edfa in {e.from_city} to {e.to_city}',
'metadata': {'location': {'city': nodes_by_city[e.from_city].city,
'region': nodes_by_city[e.from_city].region,
'latitude': nodes_by_city[e.from_city].latitude,
'longitude': nodes_by_city[e.from_city].longitude}},
'type': 'Edfa',
'type_variety': e.egress_amp_type,
'operational': {'gain_target': e.egress_amp_gain,
'tilt_target': e.egress_amp_tilt}
'type_variety': e.east_amp_type,
'operational': {'gain_target': e.east_amp_gain,
'tilt_target': e.east_tilt,
'out_voa' : e.east_att_out}
}
for e in eqpts if e.egress_amp_type.lower() != ''] +
[{'uid': f'ingress edfa in {e.from_city} to {e.to_city}',
for e in eqpts if e.east_amp_type.lower() != ''] +
[{'uid': f'west edfa in {e.from_city} to {e.to_city}',
'metadata': {'location': {'city': nodes_by_city[e.from_city].city,
'region': nodes_by_city[e.from_city].region,
'latitude': nodes_by_city[e.from_city].latitude,
'longitude': nodes_by_city[e.from_city].longitude}},
'type': 'Edfa',
'type_variety': e.ingress_amp_type,
'operational': {'gain_target': e.ingress_amp_gain,
'tilt_target': e.ingress_amp_tilt}
'type_variety': e.west_amp_type,
'operational': {'gain_target': e.west_amp_gain,
'tilt_target': e.west_tilt,
'out_voa' : e.west_att_out}
}
for e in eqpts if e.ingress_amp_type.lower() != ''],
for e in eqpts if e.west_amp_type.lower() != ''],
'connections':
list(chain.from_iterable([eqpt_connection_by_city(n.city)
for n in nodes]))
@@ -214,17 +373,65 @@ def convert_file(input_filename, filter_region=[]):
for x in nodes_by_city.values() if x.node_type.lower()=='roadm'])))
}
#print(dumps(data, indent=2))
# output_json_file_name = input_filename.split(".")[0]+".json"
suffix_filename = str(input_filename.suffixes[0])
full_input_filename = str(input_filename)
split_filename = [full_input_filename[0:len(full_input_filename)-len(suffix_filename)] , suffix_filename[1:]]
output_json_file_name = split_filename[0]+'.json'
with open(output_json_file_name,'w') as edfa_json_file:
edfa_json_file.write(dumps(data, indent=2))
with open(output_json_file_name, 'w', encoding='utf-8') as edfa_json_file:
edfa_json_file.write(dumps(data, indent=2, ensure_ascii=False))
return output_json_file_name
def parse_excel(input_filename):
link_headers = \
{ 'Node A': 'from_city',
'Node Z': 'to_city',
'east':{
'Distance (km)': 'east_distance',
'Fiber type': 'east_fiber',
'lineic att': 'east_lineic',
'Con_in': 'east_con_in',
'Con_out': 'east_con_out',
'PMD': 'east_pmd',
'Cable id': 'east_cable'
},
'west':{
'Distance (km)': 'west_distance',
'Fiber type': 'west_fiber',
'lineic att': 'west_lineic',
'Con_in': 'west_con_in',
'Con_out': 'west_con_out',
'PMD': 'west_pmd',
'Cable id': 'west_cable'
}
}
node_headers = \
{ 'City': 'city',
'State': 'state',
'Country': 'country',
'Region': 'region',
'Latitude': 'latitude',
'Longitude': 'longitude',
'Type': 'node_type'
}
eqpt_headers = \
{ 'Node A': 'from_city',
'Node Z': 'to_city',
'east':{
'amp type': 'east_amp_type',
'att_in': 'east_att_in',
'amp gain': 'east_amp_gain',
'tilt': 'east_tilt',
'att_out': 'east_att_out'
},
'west':{
'amp type': 'west_amp_type',
'att_in': 'west_att_in',
'amp gain': 'west_amp_gain',
'tilt': 'west_tilt',
'att_out': 'west_att_out'
}
}
with open_workbook(input_filename) as wb:
nodes_sheet = wb.sheet_by_name('Nodes')
links_sheet = wb.sheet_by_name('Links')
@@ -234,40 +441,23 @@ def parse_excel(input_filename):
#eqpt_sheet is optional
eqpt_sheet = None
# sanity check
"""
header = [x.value.strip() for x in nodes_sheet.row(4)]
expected = ['City', 'State', 'Country', 'Region', 'Latitude', 'Longitude']
if header != expected:
raise ValueError(f'Malformed header on Nodes sheet: {header} != {expected}')
"""
nodes = []
for row in all_rows(nodes_sheet, start=5):
nodes.append(Node(*(x.value for x in row[0:NODES_COLUMN])))
#check input
for node in parse_sheet(nodes_sheet, node_headers, NODES_LINE, NODES_LINE+1, NODES_COLUMN):
nodes.append(Node(**node))
expected_node_types = ('ROADM', 'ILA', 'FUSED')
nodes = [n._replace(node_type='ILA')
if not (n.node_type in expected_node_types) else n for n in nodes]
for n in nodes:
if not (n.node_type in expected_node_types):
n.node_type='ILA'
# sanity check
"""
header = [x.value.strip() for x in links_sheet.row(4)]
expected = ['Node A', 'Node Z',
'Distance (km)', 'Fiber type', 'lineic att', 'Con_in', 'Con_out', 'PMD', 'Cable id',
'Distance (km)', 'Fiber type', 'lineic att', 'Con_in', 'Con_out', 'PMD', 'Cable id']
if header != expected:
raise ValueError(f'Malformed header on Nodes sheet: {header} != {expected}')
"""
links = []
for row in all_rows(links_sheet, start=5):
links.append(Link(*(x.value for x in row[0:LINKS_COLUMN])))
for link in parse_sheet(links_sheet, link_headers, LINKS_LINE, LINKS_LINE+2, LINKS_COLUMN):
links.append(Link(**link))
#print('\n', [l.__dict__ for l in links])
eqpts = []
if eqpt_sheet != None:
for row in all_rows(eqpt_sheet, start=5):
eqpts.append(Eqpt(*(x.value for x in row[0:EQPTS_COLUMN])))
if eqpt_sheet != None:
for eqpt in parse_sheet(eqpt_sheet, eqpt_headers, EQPTS_LINE, EQPTS_LINE+2, EQPTS_COLUMN):
eqpts.append(Eqpt(**eqpt))
# sanity check
all_cities = Counter(n.city for n in nodes)
@@ -285,7 +475,7 @@ def eqpt_connection_by_city(city_name):
subdata = []
if nodes_by_city[city_name].node_type.lower() in ('ila', 'fused'):
# Then len(other_cities) == 2
direction = ['ingress', 'egress']
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])
@@ -299,7 +489,7 @@ def eqpt_connection_by_city(city_name):
subdata += connect_eqpt(from_, in_, to_)
from_ = fiber_link(other_city, city_name)
in_ = eqpt_in_city_to_city(city_name, other_city, "ingress")
in_ = eqpt_in_city_to_city(city_name, other_city, "west")
to_ = f'roadm {city_name}'
subdata += connect_eqpt(from_, in_, to_)
return subdata
@@ -315,8 +505,8 @@ def connect_eqpt(from_, in_, to_):
return connections
def eqpt_in_city_to_city(in_city, to_city, direction='egress'):
rev_direction = 'ingress' if direction == 'egress' else 'egress'
def eqpt_in_city_to_city(in_city, to_city, direction='east'):
rev_direction = 'west' if direction == 'east' else 'east'
amp_direction = f'{direction}_amp_type'
amp_rev_direction = f'{rev_direction}_amp_type'
return_eqpt = ''
@@ -352,9 +542,9 @@ def fiber_link(from_city, to_city):
link = links_by_city[from_city]
l = next(l for l in link if l.from_city in source_dest and l.to_city in source_dest)
if l.from_city == from_city:
fiber = f'fiber ({l.from_city} {l.to_city})-{l.east_cable}'
fiber = f'fiber ({l.from_city} \u2192 {l.to_city})-{l.east_cable}'
else:
fiber = f'fiber ({l.to_city} {l.from_city})-{l.west_cable}'
fiber = f'fiber ({l.to_city} \u2192 {l.from_city})-{l.west_cable}'
return fiber
@@ -375,8 +565,12 @@ def midpoint(city_a, city_b):
#output_json_file_name = 'coronet_conus_example.json'
#TODO get column size automatically from tupple size
NODES_COLUMN = 7
NODES_LINE = 4
LINKS_COLUMN = 16
LINKS_LINE = 3
EQPTS_LINE = 3
EQPTS_COLUMN = 12
parser = ArgumentParser()
parser.add_argument('workbook', nargs='?', type=Path , default='meshTopologyExampleV2.xls')

View File

@@ -18,14 +18,14 @@ Network elements MUST implement two attributes .uid and .name representing a
unique identifier and a printable name.
'''
from numpy import abs, arange, arcsinh, array, exp
from numpy import abs, arange, arcsinh, array, exp, divide, errstate
from numpy import interp, log10, mean, pi, polyfit, polyval, sum
from scipy.constants import c, h
from collections import namedtuple
from gnpy.core.node import Node
from gnpy.core.units import UNITS
from gnpy.core.utils import lin2db, db2lin, itufs
from gnpy.core.utils import lin2db, db2lin, itufs, snr_sum
class Transceiver(Node):
def __init__(self, *args, **kwargs):
@@ -35,23 +35,46 @@ class Transceiver(Node):
self.osnr_nli = None
self.snr = None
self.passive = False
self.baud_rate = None
def _calc_snr(self, spectral_info):
ase = [c.power.ase for c in spectral_info.carriers]
nli = [c.power.nli for c in spectral_info.carriers]
if min(ase) > 1e-20:
self.osnr_ase = [lin2db(c.power.signal/c.power.ase)
def _calc_snr(self, spectral_info):
with errstate(divide='ignore'):
self.baud_rate = [c.baud_rate for c in spectral_info.carriers]
ratio_01nm = [lin2db(12.5e9/b_rate) for b_rate in self.baud_rate]
#set raw values to record original calculation, before update_snr()
self.raw_osnr_ase = [lin2db(divide(c.power.signal, c.power.ase))
for c in spectral_info.carriers]
self.raw_osnr_ase_01nm = [ase - ratio for ase, ratio
in zip(self.raw_osnr_ase, ratio_01nm)]
self.raw_osnr_nli = [lin2db(divide(c.power.signal, c.power.nli))
for c in spectral_info.carriers]
ratio_01nm = [lin2db(12.5e9/c.baud_rate)
for c in spectral_info.carriers]
self.osnr_ase_01nm = [ase - ratio for ase, ratio
in zip(self.osnr_ase, ratio_01nm)]
if min(nli) > 1e-20:
self.osnr_nli = [lin2db(c.power.signal/c.power.nli)
for c in spectral_info.carriers]
self.snr = [lin2db(c.power.signal/(c.power.nli+c.power.ase))
self.raw_snr = [lin2db(divide(c.power.signal, c.power.nli+c.power.ase))
for c in spectral_info.carriers]
self.osnr_ase = self.raw_osnr_ase
self.osnr_ase_01nm = self.raw_osnr_ase_01nm
self.osnr_nli = self.raw_osnr_nli
self.snr = self.raw_snr
def update_snr(self, *args):
"""
snr_added in 0.1nm
compute SNR penalties such as transponder Tx_osnr or Roadm add_drop_osnr
only applied in request.py / propagate on the last Trasceiver node of the path
all penalties are added in a single call because to avoid uncontrolled cumul
"""
#use raw_values so that the added snr penalties are not cumulated
snr_added = 0
for s in args:
snr_added += db2lin(-s)
snr_added = -lin2db(snr_added)
self.osnr_ase = list(map(lambda x,y:snr_sum(x,y,snr_added),
self.raw_osnr_ase, self.baud_rate))
self.snr = list(map(lambda x,y:snr_sum(x,y,snr_added),
self.raw_snr, self.baud_rate))
self.osnr_ase_01nm = list(map(lambda x:snr_sum(x,12.5e9,snr_added),
self.raw_osnr_ase_01nm))
@property
def to_json(self):
@@ -80,7 +103,7 @@ class Transceiver(Node):
return '\n'.join([f'{type(self).__name__} {self.uid}',
f' OSNR ASE (1nm): {osnr_ase_01nm:.2f}',
f' OSNR ASE (0.1nm): {osnr_ase_01nm:.2f}',
f' OSNR ASE (signal bw): {osnr_ase:.2f}',
f' SNR total (signal bw): {snr:.2f}'])
@@ -98,7 +121,9 @@ class Roadm(Node):
params = {'loss':None}
super().__init__(*args, params=RoadmParams(**params), **kwargs)
self.loss = self.params.loss
self.pch_out = None
self.target_pch_out_db = None #set in Networks.py by def set_roadm_loss
self.effective_pch_out_db = None
self.effective_loss = None #set in self.propagate
self.passive = True
@property
@@ -116,11 +141,20 @@ class Roadm(Node):
def __str__(self):
return '\n'.join([f'{type(self).__name__} {self.uid}',
f' loss (dB): {self.loss:.2f}',
f' pch out (dBm): {self.pch_out!r}'])
f' loss (dB): {self.effective_loss:.2f}',
f' pch out (dBm): {self.effective_pch_out_db!r}'])
def propagate(self, *carriers):
attenuation = db2lin(self.loss)
def propagate(self, pref, *carriers):
#pin_target and loss are read from eqpt_config.json['Roadm']
#all ingress channels in xpress are set to this power level
#but add channels are not, so we define an effective loss
#in the case of add channels
if self.target_pch_out_db:
self.effective_loss = pref.pi - self.target_pch_out_db
else:
self.effective_loss = self.loss
self.effective_pch_out_db = pref.pi - self.effective_loss
attenuation = db2lin(self.effective_loss)
for carrier in carriers:
pwr = carrier.power
@@ -130,11 +164,10 @@ class Roadm(Node):
yield carrier._replace(power=pwr)
def update_pref(self, pref):
self.pch_out = round(pref.pi - self.loss, 2)
return pref._replace(p_span0=pref.p0, p_spani=pref.pi - self.loss)
return pref._replace(p_span0=pref.p0, p_spani=self.effective_pch_out_db)
def __call__(self, spectral_info):
carriers = tuple(self.propagate(*spectral_info.carriers))
carriers = tuple(self.propagate(spectral_info.pref, *spectral_info.carriers))
pref = self.update_pref(spectral_info.pref)
return spectral_info.update(carriers=carriers, pref=pref)
@@ -210,7 +243,9 @@ class Fiber(Node):
self.con_out = self.params.con_out
self.dispersion = self.params.dispersion # s/m/m
self.gamma = self.params.gamma # 1/W/m
self.pch_out = None
self.pch_out_db = None
self.carriers_in = None
self.carriers_out = None
# TODO|jla: discuss factor 2 in the linear lineic attenuation
@property
@@ -243,7 +278,8 @@ class Fiber(Node):
f' pad att_in (dB): {self.att_in:.2f}',
f' total loss (dB): {self.loss:.2f}',
f' (includes conn loss (dB) in: {self.con_in:.2f} out: {self.con_out:.2f})',
f' (conn loss out includes EOL margin defined in eqpt_config.json)'])
f' (conn loss out includes EOL margin defined in eqpt_config.json)',
f' pch out (dBm): {self.pch_out_db!r}'])
@property
def fiber_loss(self):
@@ -275,6 +311,25 @@ class Fiber(Node):
aleff = 1 / (2 * alpha)
return aleff
def carriers(self, loc, attr):
"""retrieve carriers information
loc = (in, out) of the class element
attr = (ase, nli, signal, total) power information"""
if not (loc in ('in', 'out') and attr in ('nli', 'signal', 'total', 'ase')):
yield None
return
power_dict = {
'nli': 'nonlinear_interference',
'ase': 'amplified_spontaneous_emission'
}
attr = power_dict.get(attr, attr)
loc_attr = 'carriers_'+loc
for c in getattr(self, loc_attr) :
if attr == 'total':
yield c.power.ase+c.power.nli+c.power.signal
else:
yield c.power._asdict().get(attr, None)
def beta2(self, ref_wavelength=None):
""" Returns beta2 from dispersion parameter.
Dispersion is entered in ps/nm/km.
@@ -359,12 +414,14 @@ class Fiber(Node):
yield carrier._replace(power=pwr)
def update_pref(self, pref):
self.pch_out = round(pref.pi - self.loss, 2)
return pref._replace(p_span0=pref.p0, p_spani=pref.pi - self.loss)
self.pch_out_db = round(pref.pi - self.loss, 2)
return pref._replace(p_span0=pref.p0, p_spani=self.pch_out_db)
def __call__(self, spectral_info):
self.carriers_in = spectral_info.carriers
carriers = tuple(self.propagate(*spectral_info.carriers))
pref = self.update_pref(spectral_info.pref)
self.carriers_out = carriers
return spectral_info.update(carriers=carriers, pref=pref)
class EdfaParams:
@@ -420,13 +477,16 @@ class Edfa(Node):
self.nf = None # dB edfa nf at operational.gain_target
self.gprofile = None
self.pin_db = None
self.nch = None
self.pout_db = None
self.dp_db = None #delta P with Pref (power swwep) in power mode
self.target_pch_db = None
self.effective_pch_db = None
self.target_pch_out_db = None
self.effective_pch_out_db = None
self.passive = False
self.effective_gain = self.operational.gain_target
self.att_in = None
self.carriers_in = None
self.carriers_out = None
@property
def to_json(self):
@@ -469,10 +529,29 @@ class Edfa(Node):
f' Power In (dBm): {self.pin_db:.2f}',
f' Power Out (dBm): {self.pout_db:.2f}',
f' Delta_P (dB): {self.dp_db!r}',
f' target pch (dBm): {self.target_pch_db!r}',
f' effective pch (dBm): {self.effective_pch_db!r}',
f' target pch (dBm): {self.target_pch_out_db!r}',
f' effective pch (dBm): {self.effective_pch_out_db!r}',
f' output VOA (dB): {self.operational.out_voa:.2f}'])
def carriers(self, loc, attr):
"""retrieve carriers information
loc = (in, out) of the class element
attr = (ase, nli, signal, total) power information"""
if not (loc in ('in', 'out') and attr in ('nli', 'signal', 'total', 'ase')):
yield None
return
power_dict = {
'nli': 'nonlinear_interference',
'ase': 'amplified_spontaneous_emission'
}
attr = power_dict.get(attr, attr)
loc_attr = 'carriers_'+loc
for c in getattr(self, loc_attr) :
if attr == 'total':
yield c.power.ase+c.power.nli+c.power.signal
else:
yield c.power._asdict().get(attr, None)
def interpol_params(self, frequencies, pin, baud_rates, pref):
"""interpolate SI channel frequencies with the edfa dgt and gain_ripple frquencies from json
set the edfa class __init__ None parameters :
@@ -485,15 +564,20 @@ class Edfa(Node):
self.interpol_gain_ripple = interp(self.channel_freq, amplifier_freq, self.params.gain_ripple)
self.interpol_nf_ripple =interp(self.channel_freq, amplifier_freq, self.params.nf_ripple)
self.nch = frequencies.size
self.pin_db = lin2db(sum(pin*1e3))
"""check power saturation and correct target_gain accordingly:"""
if self.dp_db is not None:
self.target_pch_db = round(self.dp_db + pref.p0, 2)
self.effective_gain = self.target_pch_db - pref.pi
"""in power mode: dp_db is defined and can be used to calculate the power target
This power target is used calculate the amplifier gain"""
if self.dp_db is not None:
self.target_pch_out_db = round(self.dp_db + pref.p0, 2)
self.effective_gain = self.target_pch_out_db - pref.pi
else:
self.effective_gain = self.operational.gain_target
"""check power saturation and correct target_gain accordingly:"""
self.effective_gain = min(self.effective_gain, self.params.p_max - self.pin_db)
self.effective_pch_db = round(pref.pi + self.effective_gain, 2)
self.effective_pch_out_db = round(pref.pi + self.effective_gain, 2)
self.nf = self._calc_nf()
self.gprofile = self._gain_profile(pin)
@@ -519,6 +603,10 @@ class Edfa(Node):
nf_avg = lin2db(db2lin(self.params.nf_model.nf1) + db2lin(self.params.nf_model.nf2)/db2lin(g1a))
elif self.params.type_def == 'fixed_gain':
nf_avg = self.params.nf_model.nf0
elif self.params.type_def == 'openroadm':
pin_ch = self.pin_db - lin2db(self.nch)
# model OSNR = f(Pin)
nf_avg = pin_ch - polyval(self.params.nf_model.nf_coef, pin_ch) + 58
else:
nf_avg = polyval(self.params.nf_fit_coeff, -dg)
if avg:
@@ -705,6 +793,8 @@ class Edfa(Node):
p_spani=pref.pi + self.effective_gain - self.operational.out_voa)
def __call__(self, spectral_info):
self.carriers_in = spectral_info.carriers
carriers = tuple(self.propagate(spectral_info.pref, *spectral_info.carriers))
pref = self.update_pref(spectral_info.pref)
self.carriers_out = carriers
return spectral_info.update(carriers=carriers, pref=pref)

View File

@@ -13,20 +13,21 @@ from sys import exit
from operator import itemgetter
from math import isclose
from pathlib import Path
from json import loads
from json import load
from gnpy.core.utils import lin2db, db2lin, load_json
from collections import namedtuple
from gnpy.core.elements import Edfa
Model_vg = namedtuple('Model_vg', 'nf1 nf2 delta_p')
Model_fg = namedtuple('Model_fg', 'nf0')
Model_openroadm = namedtuple('Model_openroadm', 'nf_coef')
Fiber = namedtuple('Fiber', 'type_variety dispersion gamma')
Spans = namedtuple('Spans', 'power_mode delta_power_range_db max_length length_units \
max_loss padding EOL con_in con_out')
Transceiver = namedtuple('Transceiver', 'type_variety frequency mode')
Roadms = namedtuple('Roadms', 'gain_mode_default_loss power_mode_pref')
Roadms = namedtuple('Roadms', 'gain_mode_default_loss power_mode_pout_target add_drop_osnr')
SI = namedtuple('SI', 'f_min f_max baud_rate spacing roll_off \
power_dbm power_range_db OSNR bit_rate')
power_dbm power_range_db tx_osnr sys_margins')
AmpBase = namedtuple(
'AmpBase',
'type_variety type_def gain_flatmax gain_min p_max'
@@ -43,14 +44,14 @@ class Amp(AmpBase):
@classmethod
def from_advanced_json(cls, filename, **kwargs):
with open(filename) as f:
json_data = loads(f.read())
with open(filename, encoding='utf-8') as f:
json_data = load(f)
return cls(**{**kwargs, **json_data, 'type_def':None, 'nf_model':None})
@classmethod
def from_default_json(cls, filename, **kwargs):
with open(filename) as f:
json_data = loads(f.read())
with open(filename, encoding='utf-8') as f:
json_data = load(f)
type_variety = kwargs['type_variety']
type_def = kwargs.get('type_def', 'variable_gain') #default compatibility with older json eqpt files
nf_def = None
@@ -79,6 +80,13 @@ class Amp(AmpBase):
except KeyError: pass #nf0 is not needed for variable gain amp
nf1, nf2, delta_p = nf_model(type_variety, gain_min, gain_max, nf_min, nf_max)
nf_def = Model_vg(nf1, nf2, delta_p)
elif type_def == 'openroadm':
try:
nf_coef = kwargs.pop('nf_coef')
except KeyError: #nf_coef is expected for openroadm amp
print(f'missing nf_coef input for amplifier: {type_variety} in eqpt_config.json')
exit()
nf_def = Model_openroadm(nf_coef)
return cls(**{**kwargs, **json_data, 'nf_model': nf_def})
@@ -140,24 +148,51 @@ def edfa_nf(gain_target, variety_type, equipment):
params = amp_params._asdict(),
operational = {
'gain_target': gain_target,
'tilt_target': 0,
})
'tilt_target': 0
}
)
amp.pin_db = 0
amp.nch = 88
return amp._calc_nf(True)
def trx_mode_params(equipment, trx_type_variety='', trx_mode='', error_message=False):
"""return the trx and SI parameters from eqpt_config for a given type_variety and mode (ie format)"""
trx_params = {}
default_si_data = equipment['SI']['default']
try:
trxs = equipment['Transceiver']
mode_params = next(mode for trx in trxs \
if trx == trx_type_variety \
for mode in trxs[trx].mode \
if mode['format'] == trx_mode)
trx_params = {**mode_params}
trx_params['frequency'] = equipment['Transceiver'][trx_type_variety].frequency
#if called from path_requests_run.py, trx_mode is filled with None when not specified by user
#if called from transmission_main.py, trx_mode is ''
if trx_mode is not None:
mode_params = next(mode for trx in trxs \
if trx == trx_type_variety \
for mode in trxs[trx].mode \
if mode['format'] == trx_mode)
trx_params = {**mode_params}
# sanity check: spacing baudrate must be smaller than min spacing
if trx_params['baud_rate'] > trx_params['min_spacing'] :
msg = f'Inconsistency in equipment library:\n Transpoder "{trx_type_variety}" mode "{trx_params["format"]}" '+\
f'has baud rate: {trx_params["baud_rate"]*1e-9} GHz greater than min_spacing {trx_params["min_spacing"]*1e-9}.'
print(msg)
exit()
else:
mode_params = {"format": "undetermined",
"baud_rate": None,
"OSNR": None,
"bit_rate": None,
"roll_off": None,
"tx_osnr":None,
"min_spacing":None,
"cost":None}
trx_params = {**mode_params}
trx_params['f_min'] = equipment['Transceiver'][trx_type_variety].frequency['min']
trx_params['f_max'] = equipment['Transceiver'][trx_type_variety].frequency['max']
# TODO: novel automatic feature maybe unwanted if spacing is specified
trx_params['spacing'] = automatic_spacing(trx_params['baud_rate'])
# trx_params['spacing'] = automatic_spacing(trx_params['baud_rate'])
# temp = trx_params['spacing']
# print(f'spacing {temp}')
except StopIteration :
if error_message:
print(f'could not find tsp : {trx_type_variety} with mode: {trx_mode} in eqpt library')
@@ -165,38 +200,49 @@ def trx_mode_params(equipment, trx_type_variety='', trx_mode='', error_message=F
exit()
else:
# default transponder charcteristics
trx_params['frequency'] = {'min': default_si_data.f_min, 'max': default_si_data.f_max}
# mainly used with transmission_main_example.py
trx_params['f_min'] = default_si_data.f_min
trx_params['f_max'] = default_si_data.f_max
trx_params['baud_rate'] = default_si_data.baud_rate
trx_params['spacing'] = default_si_data.spacing
trx_params['OSNR'] = default_si_data.OSNR
trx_params['bit_rate'] = default_si_data.bit_rate
trx_params['OSNR'] = None
trx_params['bit_rate'] = None
trx_params['cost'] = None
trx_params['roll_off'] = default_si_data.roll_off
trx_params['tx_osnr'] = default_si_data.tx_osnr
trx_params['min_spacing'] = None
nch = automatic_nch(trx_params['f_min'], trx_params['f_max'], trx_params['spacing'])
trx_params['nb_channel'] = nch
print(f'There are {nch} channels propagating')
trx_params['power'] = db2lin(default_si_data.power_dbm)*1e-3
trx_params['nb_channel'] = automatic_nch(trx_params['frequency']['min'],
trx_params['frequency']['max'],
trx_params['spacing'])
print('N channels = ', trx_params['nb_channel'])
return trx_params
def automatic_spacing(baud_rate):
"""return the min possible channel spacing for a given baud rate"""
spacing_list = [(38e9,50e9), (67e9,75e9), (92e9,100e9)] #list of possible tuples
# TODO : this should parametrized in a cfg file
spacing_list = [(33e9,37.5e9), (38e9,50e9), (50e9,62.5e9), (67e9,75e9), (92e9,100e9)] #list of possible tuples
#[(max_baud_rate, spacing_for_this_baud_rate)]
acceptable_spacing_list = list(filter(lambda x : x[0]>baud_rate, spacing_list))
if len(acceptable_spacing_list) < 1:
#can't find an adequate spacing from the list, so default to:
return baud_rate*1.2
else:
#chose the lowest possible spacing
return min(acceptable_spacing_list, key=itemgetter(0))[1]
return min((s[1] for s in spacing_list if s[0] > baud_rate), default=baud_rate*1.2)
def automatic_nch(f_min, f_max, spacing):
return int((f_max - f_min)//spacing)
def automatic_fmax(f_min, spacing, nch):
return f_min + spacing * nch
def load_equipment(filename):
json_data = load_json(filename)
return equipment_from_json(json_data, filename)
def update_trx_osnr(equipment):
"""add sys_margins to all Transceivers OSNR values"""
for trx in equipment['Transceiver'].values():
for m in trx.mode:
m['OSNR'] = m['OSNR'] + equipment['SI']['default'].sys_margins
return equipment
def equipment_from_json(json_data, filename):
"""build global dictionnary eqpt_library that stores all eqpt characteristics:
edfa type type_variety, fiber type_variety
@@ -208,17 +254,18 @@ def equipment_from_json(json_data, filename):
"""
equipment = {}
for key, entries in json_data.items():
equipment[key] = {}
typ = globals()[key]
for entry in entries:
if key not in equipment:
equipment[key] = {}
subkey = entry.get('type_variety', 'default')
typ = globals()[key]
subkey = entry.get('type_variety', 'default')
if key == 'Edfa':
if 'advanced_config_from_json' in entry:
config = Path(filename).parent / entry.pop('advanced_config_from_json')
typ = lambda **kws: Amp.from_advanced_json(config, **kws)
equipment[key][subkey] = Amp.from_advanced_json(config, **entry)
else:
config = Path(filename).parent / 'default_edfa_config.json'
typ = lambda **kws: Amp.from_default_json(config, **kws)
equipment[key][subkey] = typ(**entry)
equipment[key][subkey] = Amp.from_default_json(config, **entry)
else:
equipment[key][subkey] = typ(**entry)
equipment = update_trx_osnr(equipment)
return equipment

View File

@@ -11,9 +11,10 @@ This module contains classes for modelling SpectralInformation.
from collections import namedtuple
from numpy import array
from gnpy.core.utils import lin2db
from gnpy.core.utils import lin2db, db2lin
from json import loads
from gnpy.core.utils import load_json
from gnpy.core.equipment import automatic_nch, automatic_spacing
class ConvenienceAccess:
@@ -56,17 +57,17 @@ def merge_input_spectral_information(*si):
#TODO
pass
def create_input_spectral_information(f_min, roll_off, baud_rate, power, spacing, nb_channel):
def create_input_spectral_information(f_min, f_max, roll_off, baud_rate, power, spacing):
# pref in dB : convert power lin into power in dB
pref = lin2db(power * 1e3)
si = SpectralInformation(pref=Pref(pref, pref))
nb_channel = automatic_nch(f_min, f_max, spacing)
si = si.update(carriers=[
Channel(f, (f_min+spacing*f),
baud_rate, roll_off, Power(power, 0, 0)) for f in range(1,nb_channel+1)
])
return si
if __name__ == '__main__':
pref = lin2db(power * 1e3)
si = SpectralInformation(

View File

@@ -24,11 +24,11 @@ from collections import namedtuple
logger = getLogger(__name__)
def load_network(filename, equipment):
def load_network(filename, equipment, name_matching = False):
json_filename = ''
if filename.suffix.lower() == '.xls':
logger.info('Automatically generating topology JSON file')
json_filename = convert_file(filename)
json_filename = convert_file(filename, name_matching)
elif filename.suffix.lower() == '.json':
json_filename = filename
else:
@@ -64,7 +64,12 @@ def network_from_json(json_data, equipment):
for cx in json_data['connections']:
from_node, to_node = cx['from_node'], cx['to_node']
g.add_edge(nodes[from_node], nodes[to_node])
try:
g.add_edge(nodes[from_node], nodes[to_node])
except KeyError:
msg = f'In {__name__} network_from_json function:\n\tcan not find {from_node} or {to_node} defined in {cx}'
print(msg)
exit(1)
return g
@@ -126,16 +131,18 @@ def select_edfa(gain_target, power_target, equipment):
# =>chose the amp with the best NF among the acceptable ones:
return min(acceptable_power_list, key=itemgetter(3)).variety #filter on NF
def set_roadm_loss(network, equipment, pref_ch_db):
roadms = [roadm for roadm in network if isinstance(roadm, Roadm)]
power_mode = equipment['Spans']['default'].power_mode
default_roadm_loss = equipment['Roadms']['default'].gain_mode_default_loss
pref_roadm_db = equipment['Roadms']['default'].power_mode_pref
roadm_loss = pref_ch_db - pref_roadm_db
pout_target = equipment['Roadms']['default'].power_mode_pout_target
roadm_loss = pref_ch_db - pout_target
for roadm in roadms:
if power_mode:
roadm.loss = roadm_loss
roadm.target_pch_out_db = pout_target
elif roadm.loss == None:
roadm.loss = default_roadm_loss
@@ -171,7 +178,13 @@ def target_power(dp_from_gain, network, node, equipment): #get_fiber_dp
def prev_node_generator(network, node):
"""fused spans interest:
iterate over all predecessors while they are Fused or Fiber type"""
prev_node = next(n for n in network.predecessors(node))
try:
prev_node = next(n for n in network.predecessors(node))
except StopIteration:
msg = f'In {__name__} prev_node_generator function:\n\t{node.uid} is not properly connected, please check network topology'
print(msg)
logger.critical(msg)
exit(1)
# yield and re-iterate
if isinstance(prev_node, Fused) or isinstance(node, Fused):
yield prev_node
@@ -182,7 +195,11 @@ def prev_node_generator(network, node):
def next_node_generator(network, node):
"""fused spans interest:
iterate over all successors while they are Fused or Fiber type"""
next_node = next(n for n in network.successors(node))
try:
next_node = next(n for n in network.successors(node))
except StopIteration:
print(f'In {__name__} next_node_generator function:\n\t{node.uid} is not properly connected, please check network topology')
exit(1)
# yield and re-iterate
if isinstance(next_node, Fused) or isinstance(node, Fused):
yield next_node
@@ -334,26 +351,21 @@ def split_fiber(network, fiber, bounds, target_length, equipment):
next_node = next(network.successors(fiber))
prev_node = next(network.predecessors(fiber))
except StopIteration:
print(f'{repr(fiber)} is not properly connected, please check network topology')
print(f'In {__name__} split_fiber function:\n\t{fiber.uid} is not properly connected, please check network topology')
exit()
network.remove_edge(fiber, next_node)
network.remove_edge(prev_node, fiber)
network.remove_node(fiber)
# update connector loss parameter with default values
fiber_params = fiber.params._asdict()
fiber_params['length'] = new_length / UNITS[fiber.params.length_units]
fiber_params['con_in'] = fiber.con_in
fiber_params['con_out'] = fiber.con_out
new_spans = [
Fiber(
uid = f'{fiber.uid}_({span}/{n_spans})',
metadata = fiber.metadata,
params = fiber_params
) for span in range(n_spans)
]
for new_span in new_spans:
new_span.length = new_length
network.add_node(new_span)
for span in range(n_spans):
new_span = Fiber(uid = f'{fiber.uid}_({span+1}/{n_spans})',
metadata = fiber.metadata,
params = fiber_params)
network.add_edge(prev_node, new_span)
prev_node = new_span
network.add_edge(prev_node, next_node)
@@ -373,7 +385,13 @@ def add_fiber_padding(network, fibers, padding):
if isinstance(fiber, Fiber))"""
for fiber in fibers:
this_span_loss = span_loss(network, fiber)
next_node = next(network.successors(fiber))
try:
next_node = next(network.successors(fiber))
except StopIteration:
msg = f'In {__name__} add_fiber_padding function:\n\t{fiber.uid} is not properly connected, please check network topology'
print(msg)
logger.critical(msg)
exit(1)
if this_span_loss < padding and not (isinstance(next_node, Fused)):
#add a padding att_in at the input of the 1st fiber:
#address the case when several fibers are spliced together

View File

@@ -36,7 +36,7 @@ class Node:
@property
def coords(self):
return tuple(self.lng, self.lat)
return self.lng, self.lat
@property
def location(self):

View File

@@ -15,9 +15,11 @@ and feasibility
See: draft-ietf-teas-yang-path-computation-01.txt
"""
from sys import exit
from collections import namedtuple
from logging import getLogger, basicConfig, CRITICAL, DEBUG, INFO
from networkx import (dijkstra_path, NetworkXNoPath)
from networkx import (dijkstra_path, NetworkXNoPath, all_simple_paths)
from networkx.utils import pairwise
from numpy import mean
from gnpy.core.service_sheet import convert_service_sheet, Request_element, Element
from gnpy.core.elements import Transceiver, Roadm, Edfa, Fused
@@ -26,12 +28,14 @@ from gnpy.core.utils import db2lin, lin2db
from gnpy.core.info import create_input_spectral_information, SpectralInformation, Channel, Power
from copy import copy, deepcopy
from csv import writer
from math import ceil
logger = getLogger(__name__)
RequestParams = namedtuple('RequestParams','request_id source destination trx_type'+
' trx_mode nodes_list loose_list spacing power nb_channel frequency format baud_rate OSNR bit_rate roll_off')
' trx_mode nodes_list loose_list spacing power nb_channel f_min f_max format baud_rate OSNR bit_rate roll_off tx_osnr min_spacing cost path_bandwidth')
DisjunctionParams = namedtuple('DisjunctionParams','disjunction_id relaxable link_diverse node_diverse disjunctions_req')
class Path_request:
def __init__(self, *args, **params):
@@ -47,26 +51,64 @@ class Path_request:
self.spacing = params.spacing
self.power = params.power
self.nb_channel = params.nb_channel
self.frequency = params.frequency
self.f_min = params.f_min
self.f_max = params.f_max
self.format = params.format
self.OSNR = params.OSNR
self.bit_rate = params.bit_rate
self.roll_off = params.roll_off
self.tx_osnr = params.tx_osnr
self.min_spacing = params.min_spacing
self.cost = params.cost
self.path_bandwidth = params.path_bandwidth
def __str__(self):
return '\n\t'.join([ f'{type(self).__name__} {self.request_id}',
f'source: {self.source}',
f'destination: {self.destination}'])
def __repr__(self):
if self.baud_rate is not None:
temp = self.baud_rate * 1e-9
temp2 = self.bit_rate * 1e-9
else:
temp = self.baud_rate
temp2 = self.bit_rate
return '\n\t'.join([ f'{type(self).__name__} {self.request_id}',
f'source: \t{self.source}',
f'destination:\t{self.destination}',
f'trx type:\t{self.tsp}',
f'trx mode:\t{self.tsp_mode}',
f'baud_rate:\t{self.baud_rate * 1e-9} Gbaud',
f'bit_rate:\t{self.bit_rate * 1e-9} Gb/s',
f'baud_rate:\t{temp} Gbaud',
f'bit_rate:\t{temp2} Gb/s',
f'spacing:\t{self.spacing * 1e-9} GHz',
f'power: \t{round(lin2db(self.power)+30,2)} dBm'
f'power: \t{round(lin2db(self.power)+30,2)} dBm',
f'nb channels: \t{self.nb_channel}',
f'path_bandwidth: \t{round(self.path_bandwidth * 1e-9,2)} Gbit/s',
f'nodes-list:\t{self.nodes_list}',
f'loose-list:\t{self.loose_list}'
'\n'])
class Disjunction:
def __init__(self, *args, **params):
params = DisjunctionParams(**params)
self.disjunction_id = params.disjunction_id
self.relaxable = params.relaxable
self.link_diverse = params.link_diverse
self.node_diverse = params.node_diverse
self.disjunctions_req = params.disjunctions_req
def __str__(self):
return '\n\t'.join([f'relaxable: {self.relaxable}',
f'link-diverse: {self.link_diverse}',
f'node-diverse: {self.node_diverse}',
f'request-id-numbers: {self.disjunctions_req}']
)
def __repr__(self):
return '\n\t'.join([ f'{type(self).__name__} {self.disjunction_id}',
f'relaxable: {self.relaxable}',
f'link-diverse: {self.link_diverse}',
f'node-diverse: {self.node_diverse}',
f'request-id-numbers: {self.disjunctions_req}'
'\n'])
class Result_element(Element):
@@ -75,11 +117,17 @@ class Result_element(Element):
self.path_request = path_request
self.computed_path = computed_path
hop_type = []
for e in computed_path :
if isinstance(e, Transceiver) :
hop_type.append(' - '.join([path_request.tsp,path_request.tsp_mode]))
else:
hop_type.append('not recorded')
if len(computed_path)>0 :
for e in computed_path :
if isinstance(e, Transceiver) :
hop_type.append(' - '.join([path_request.tsp,path_request.tsp_mode]))
else:
hop_type.append('not recorded')
else:
# TODO differentiate empty path in case not feasible because of tsp or not feasible because
# ther is no path connecting the nodes (whatever the tsp)
mode = 'not feasible with this transponder'
hop_type = ' - '.join([path_request.tsp,mode])
self.hop_type = hop_type
uid = property(lambda self: repr(self))
@property
@@ -108,6 +156,10 @@ class Result_element(Element):
{
'metric-type': 'reference_power',
'accumulative-value': self.path_request.power
},
{
'metric-type': 'path_bandwidth',
'accumulative-value': self.path_request.path_bandwidth
}
],
'path-srlgs': {
@@ -121,7 +173,7 @@ class Result_element(Element):
'unnumbered-hop': {
'node-id': self.path_request.source,
'link-tp-id': self.path_request.source,
'hop-type': ' - '.join([self.path_request.tsp, self.path_request.tsp_mode]),
'hop-type': self.hop_type,
'direction': 'not used'
},
'label-hop': {
@@ -138,7 +190,7 @@ class Result_element(Element):
'unnumbered-hop': {
'node-id': self.path_request.destination,
'link-tp-id': self.path_request.destination,
'hop-type': ' - '.join([self.path_request.tsp, self.path_request.tsp_mode]),
'hop-type': self.hop_type,
'direction': 'not used'
},
'label-hop': {
@@ -176,6 +228,10 @@ class Result_element(Element):
{
'metric-type': 'reference_power',
'accumulative-value': self.path_request.power
},
{
'metric-type': 'path_bandwidth',
'accumulative-value': self.path_request.path_bandwidth
}
],
'path-srlgs': {
@@ -212,50 +268,120 @@ def compute_constrained_path(network, req):
trx = [n for n in network.nodes() if isinstance(n, Transceiver)]
roadm = [n for n in network.nodes() if isinstance(n, Roadm)]
edfa = [n for n in network.nodes() if isinstance(n, Edfa)]
anytypenode = [n for n in network.nodes()]
source = next(el for el in trx if el.uid == req.source)
# start the path with its source
# TODO : avoid loops due to constraints , guess name base on string,
# avoid crashing if on req is not correct
total_path = [source]
for n in req.nodes_list:
# print(n)
# This method ensures that the constraint can be satisfied without loops
# except when it is not possible : eg if constraints makes a loop
# It requires that the source, dest and nodes are correct (no error in the names)
destination = next(el for el in trx if el.uid == req.destination)
nodes_list = []
for n in req.nodes_list :
# for debug excel print(n)
nodes_list.append(next(el for el in anytypenode if el.uid == n))
# nodes_list contains at least the destination
if nodes_list is None :
msg = f'Request {req.request_id} problem in the constitution of nodes_list: should at least include destination'
logger.critical(msg)
exit()
if req.nodes_list[-1] != req.destination:
msg = f'Request {req.request_id} malformed list of nodes: last node should be destination trx'
logger.critical(msg)
exit()
if len(nodes_list) == 1 :
try :
node = next(el for el in trx if el.uid == n)
except StopIteration:
try:
node = next(el for el in roadm if el.uid == f'roadm {n}')
except StopIteration:
try:
node = next(el for el in edfa
if el.uid.startswith(f'egress edfa in {n}'))
except StopIteration:
msg = f'could not find node : {n} in network topology: \
not a trx, roadm, edfa or fused element'
logger.critical(msg)
raise ValueError(msg)
# extend path list without repeating source -> skip first element in the list
try:
total_path.extend(dijkstra_path(network, source, node)[1:])
source = node
total_path = dijkstra_path(network, source, destination)
except NetworkXNoPath:
# for debug
# print(req.loose_list)
# print(req.nodes_list.index(n))
msg = f'\x1b[1;33;40m'+f'Request {req.request_id} could not find a path from {source.uid} to node : {destination.uid} in network topology'+ '\x1b[0m'
logger.critical(msg)
print(msg)
total_path = []
else :
all_simp_pths = list(all_simple_paths(network,source=source,\
target=destination, cutoff=120))
candidate = []
for p in all_simp_pths :
if ispart(nodes_list, p) :
# print(f'selection{[el.uid for el in p if el in roadm]}')
candidate.append(p)
# select the shortest path (in nb of hops)
if len(candidate)>0 :
candidate.sort(key=lambda x: len(x))
total_path = candidate[0]
else:
if req.loose_list[req.nodes_list.index(n)] == 'loose':
print(f'could not find a path from {source.uid} to loose node : {n} in network topology')
print(f'node {n} is skipped')
print(f'\x1b[1;33;40m'+f'Request {req.request_id} could not find a path crossing {nodes_list} in network topology'+ '\x1b[0m')
print(f'constraint ignored')
total_path = dijkstra_path(network, source, destination)
else:
msg = f'could not find a path from {source.uid} to node : {n} in network topology'
msg = f'\x1b[1;33;40m'+f'Request {req.request_id} could not find a path crossing {nodes_list}.\nNo path computed'+ '\x1b[0m'
logger.critical(msg)
#raise ValueError(msg)
print(msg)
total_path = []
# preparing disjonction feature
# for p in all_simple_paths(network,\
# source=next(el for el in trx if el.uid == req.source),\
# target=next(el for el in trx if el.uid == req.destination)):
# print([e.uid for e in p if isinstance(e,Roadm)])
# obsolete method: this does not guaranty to avoid loops or correct results
# Here is the demonstration :
# 1 1
# eg a----b-----c
# |1 |0.5 |1
# e----f--h--g
# 1 0.5 0.5
# if I have to compute a to g with constraint f-c
# result will be a concatenation of: a-b-f and f-b-c and c-g
# which means a loop.
# if to avoid loops I iteratively suppress edges of the segmenst in the topo
# segment 1 = a-b-f
# 1
# eg a b-----c
# |1 |1
# e----f--h--g
# 1 0.5 0.5
# then
# segment 2 = f-h-g-c
# 1
# eg a b-----c
# |1
# e----f h g
# 1
# then there is no more path to g destination
#
#
# total_path = [source]
# for n in req.nodes_list:
# try :
# node = next(el for el in trx if el.uid == n)
# except StopIteration:
# try:
# node = next(el for el in anytypenode if el.uid == n)
# except StopIteration:
# try:
# # TODO this test is not giving good results: full name of the
# # amp is required to avoid ambiguity on the direction
# node = next(el for el in anytypenode
# if n in el.uid)
# except StopIteration:
# msg = f'could not find node : {n} in network topology: \
# not a trx, roadm, edfa, fiber or fused element'
# logger.critical(msg)
# raise ValueError(msg)
# # extend path list without repeating source -> skip first element in the list
# try:
# # to avoid looping back: use an alternate graph were current path edges and vertex are suppressed
# total_path.extend(dijkstra_path(network, source, node)[1:])
# source = node
# except NetworkXNoPath:
# if req.loose_list[req.nodes_list.index(n)] == 'loose':
# print(f'could not find a path from {source.uid} to loose node : {n} in network topology')
# print(f'node {n} is skipped')
# else:
# msg = f'could not find a path from {source.uid} to node : {n} in network topology'
# logger.critical(msg)
# print(msg)
# total_path = []
return total_path
@@ -263,14 +389,63 @@ def propagate(path, req, equipment, show=False):
#update roadm loss in case of power sweep (power mode only)
set_roadm_loss(path, equipment, lin2db(req.power*1e3))
si = create_input_spectral_information(
req.frequency['min'], req.roll_off,
req.baud_rate, req.power, req.spacing, req.nb_channel)
req.f_min, req.f_max, req.roll_off, req.baud_rate,
req.power, req.spacing)
for el in path:
si = el(si)
if show :
print(el)
path[-1].update_snr(req.tx_osnr, equipment['Roadms']['default'].add_drop_osnr)
return path
def propagate_and_optimize_mode(path, req, equipment):
#update roadm loss in case of power sweep (power mode only)
set_roadm_loss(path, equipment, lin2db(req.power*1e3))
# if mode is unknown : loops on the modes starting from the highest baudrate fiting in the
# step 1: create an ordered list of modes based on baudrate
baudrate_to_explore = list(set([m['baud_rate'] for m in equipment['Transceiver'][req.tsp].mode
if float(m['min_spacing'])<= req.spacing]))
# TODO be carefull on limits cases if spacing very close to req spacing eg 50.001 50.000
baudrate_to_explore = sorted(baudrate_to_explore, reverse=True)
if baudrate_to_explore :
# at least 1 baudrate can be tested wrt spacing
for b in baudrate_to_explore :
modes_to_explore = [m for m in equipment['Transceiver'][req.tsp].mode
if m['baud_rate'] == b]
modes_to_explore = sorted(modes_to_explore,
key = lambda x: x['bit_rate'], reverse=True)
# print(modes_to_explore)
# step2 : computes propagation for each baudrate: stop and select the first that passes
found_a_feasible_mode = False
# TODO : the case of roll of is not included: for now use SI one
# TODO : if the loop in mode optimization does not have a feasible path, then bugs
si = create_input_spectral_information(
req.f_min, req.f_max, equipment['SI']['default'].roll_off,
b, req.power, req.spacing)
for el in path:
si = el(si)
for m in modes_to_explore :
if path[-1].snr is not None:
path[-1].update_snr(m['tx_osnr'], equipment['Roadms']['default'].add_drop_osnr)
if round(min(path[-1].snr+lin2db(b/(12.5e9))),2) > m['OSNR'] :
found_a_feasible_mode = True
return path, m
else:
return [], None
# only get to this point if no baudrate/mode satisfies OSNR requirement
# returns the last propagated path and mode
msg = f'\tWarning! Request {req.request_id}: no mode satisfies path SNR requirement.\n'
print(msg)
logger.info(msg)
return [],None
else :
# no baudrate satisfying spacing
msg = f'\tWarning! Request {req.request_id}: no baudrate satisfies spacing requirement.\n'
print(msg)
logger.info(msg)
return [], None
def jsontocsv(json_data,equipment,fileout):
# read json path result file in accordance with:
@@ -279,9 +454,10 @@ def jsontocsv(json_data,equipment,fileout):
# and write results in an CSV file
mywriter = writer(fileout)
mywriter.writerow(('path-id','source','destination','transponder-type',\
'transponder-mode','baud rate (Gbaud)', 'input power (dBm)','path',\
'OSNR@bandwidth','OSNR@0.1nm','SNR@bandwidth','SNR@0.1nm','Pass?'))
mywriter.writerow(('path-id','source','destination','path_bandwidth','Pass?',\
'nb of tsp pairs','total cost','transponder-type','transponder-mode',\
'OSNR@0.1nm','SNR@0.1nm','SNR@bandwidth','baud rate (Gbaud)',\
'input power (dBm)','path'))
tspjsondata = equipment['Transceiver']
#print(tspjsondata)
for p in json_data['path']:
@@ -290,24 +466,22 @@ def jsontocsv(json_data,equipment,fileout):
['path-route-object']['unnumbered-hop']['node-id']
destination = p['path-properties']['path-route-objects'][-1]\
['path-route-object']['unnumbered-hop']['node-id']
# selects only roadm nodes
pth = ' | '.join([ e['path-route-object']['unnumbered-hop']['node-id']
for e in p['path-properties']['path-route-objects']])
for e in p['path-properties']['path-route-objects']
if e['path-route-object']['unnumbered-hop']['node-id'].startswith('roadm') or e['path-route-object']['unnumbered-hop']['node-id'].startswith('Edfa')])
[tsp,mode] = p['path-properties']['path-route-objects'][0]\
['path-route-object']['unnumbered-hop']['hop-type'].split(' - ')
# find the min acceptable OSNR, baud rate from the eqpt library based on tsp (tupe) and mode (format)
try:
[minosnr, baud_rate] = next([m['OSNR'] , m['baud_rate']]
# loading equipment already tests the existence of tsp type and mode:
if mode !='not feasible with this transponder' :
[minosnr, baud_rate, bit_rate, cost] = next([m['OSNR'] , m['baud_rate'] , m['bit_rate'], m['cost']]
for m in equipment['Transceiver'][tsp].mode if m['format']==mode)
# for debug
# print(f'coucou {baud_rate}')
except IndexError:
msg = f'could not find tsp : {self.tsp} with mode: {self.tsp_mode} in eqpt library'
raise ValueError(msg)
output_snr = next(e['accumulative-value']
# else:
# [minosnr, baud_rate, bit_rate] = ['','','','']
output_snr = next(e['accumulative-value']
for e in p['path-properties']['path-metric'] if e['metric-type'] == 'SNR@0.1nm')
output_snrbandwidth = next(e['accumulative-value']
for e in p['path-properties']['path-metric'] if e['metric-type'] == 'SNR@bandwidth')
@@ -317,21 +491,417 @@ def jsontocsv(json_data,equipment,fileout):
for e in p['path-properties']['path-metric'] if e['metric-type'] == 'OSNR@bandwidth')
power = next(e['accumulative-value']
for e in p['path-properties']['path-metric'] if e['metric-type'] == 'reference_power')
path_bandwidth = next(e['accumulative-value']
for e in p['path-properties']['path-metric'] if e['metric-type'] == 'path_bandwidth')
if isinstance(output_snr, str):
isok = ''
isok = False
nb_tsp = 0
pthbdbw = round(path_bandwidth*1e-9,2)
rosnr = ''
rsnr = ''
rsnrb = ''
br = ''
pw = ''
total_cost = ''
else:
isok = output_snr >= minosnr
isok = output_snr >= minosnr
nb_tsp = ceil(path_bandwidth / bit_rate)
pthbdbw = round(path_bandwidth*1e-9,2)
rosnr = round(output_osnr,2)
rsnr = round(output_snr,2)
rsnrb = round(output_snrbandwidth,2)
br = round(baud_rate*1e-9,2)
pw = round(lin2db(power)+30,2)
total_cost = nb_tsp * cost
mywriter.writerow((path_id,
source,
destination,
pthbdbw,
isok,
nb_tsp,
total_cost,
tsp,
mode,
baud_rate*1e-9,
round(lin2db(power)+30,2),
pth,
output_osnrbandwidth,
output_osnr,
output_snrbandwidth,
output_snr,
isok
rosnr,
rsnr,
rsnrb,
br,
pw,
pth
))
def compute_path_dsjctn(network, equipment, pathreqlist, disjunctions_list):
# pathreqlist is a list of Path_request objects
# disjunctions_list a list of Disjunction objects
# given a network, a list of requests with the set of disjunction features between
# request, the function computes the set of path satisfying : first the disjunction
# constraint and second the routing constraint if the request include an explicit
# set of elements to pass through.
# the algorithm used allows to specify disjunction for demands not sharing source or
# destination.
# a request might be declared as disjoint from several requests
# it is a iterative process:
# first computes a list of all shortest path (this may add computation time)
# second elaborate the set of path solution for each synchronization vector
# third select only the candidates that satisfy all synchronization vectors they belong to
# fourth apply route constraints : remove candidate path that do not satisfy the constraint
# fifth select the first candidate among the set of candidates.
# the example network used in comments has been added to the set of data tests files
# define the list to be returned
path_res_list = []
# all disjctn must be computed at once together to avoid blocking
# 1 1
# eg a----b-----c
# |1 |0.5 |1
# e----f--h--g
# 1 0.5 0.5
# if I have to compute a to g and a to h
# I must not compute a-b-f-h-g, otherwise there is no disjoint path remaining for a to h
# instead I should list all most disjoint path and select the one that have the less
# number of commonalities
# \ path abfh aefh abcgh
# \___cost 2 2.5 3.5
# path| cost
# abfhg| 2.5 x x x
# abcg | 3 x x
# aefhg| 3 x x x
# from this table abcg and aefh have no common links and should be preferred
# even they are not the shortest paths
# build the list of pathreqlist elements not concerned by disjunction
global_disjunctions_list = [e for d in disjunctions_list for e in d.disjunctions_req ]
pathreqlist_simple = [e for e in pathreqlist if e.request_id not in global_disjunctions_list]
pathreqlist_disjt = [e for e in pathreqlist if e.request_id in global_disjunctions_list]
# use a mirror class to record path and the corresponding requests
class Pth:
def __init__(self, req, pth, simplepth):
self.req = req
self.pth = pth
self.simplepth = simplepth
# step 1
# for each remaining request compute a set of simple path
allpaths = {}
rqs = {}
simple_rqs = {}
simple_rqs_reversed = {}
for pathreq in pathreqlist_disjt :
all_simp_pths = list(all_simple_paths(network,\
source=next(el for el in network.nodes() if el.uid == pathreq.source),\
target=next(el for el in network.nodes() if el.uid == pathreq.destination),\
cutoff=80))
# sort them
all_simp_pths = sorted(all_simp_pths, key=lambda path: len(path))
# reversed direction paths required to check disjunction on both direction
all_simp_pths_reversed = []
for pth in all_simp_pths:
all_simp_pths_reversed.append(find_reversed_path(pth,network))
rqs[pathreq.request_id] = all_simp_pths
temp =[]
for p in all_simp_pths :
# build a short list representing each roadm+direction with the first item
# start enumeration at 1 to avoid Trx in the list
s = [e.uid for i,e in enumerate(p[1:-1]) \
if (isinstance(e,Roadm) | (isinstance(p[i],Roadm) ))]
temp.append(s)
# id(s) is unique even if path is the same: two objects with same
# path have two different ids
allpaths[id(s)] = Pth(pathreq,p,s)
simple_rqs[pathreq.request_id] = temp
temp =[]
for p in all_simp_pths_reversed :
# build a short list representing each roadm+direction with the first item
# start enumeration at 1 to avoid Trx in the list
temp.append([e.uid for i,e in enumerate(p[1:-1]) \
if (isinstance(e,Roadm) | (isinstance(p[i],Roadm) ))] )
simple_rqs_reversed[pathreq.request_id] = temp
# step 2
# for each set of requests that need to be disjoint
# select the disjoint path combination
candidates = {}
for d in disjunctions_list :
dlist = d.disjunctions_req.copy()
# each line of dpath is one combination of path that satisfies disjunction
dpath = []
for i,p in enumerate(simple_rqs[dlist[0]]):
dpath.append([p])
# allpaths[id(p)].d_id = d.disjunction_id
# in each loop, dpath is updated with a path for rq that satisfies
# disjunction with each path in dpath
# for example, assume set of requests in the vector (disjunction_list) is {rq1,rq2, rq3}
# rq1 p1: abfhg
# p2: aefhg
# p3: abcg
# rq2 p8: bf
# rq3 p4: abcgh
# p6: aefh
# p7: abfh
# initiate with rq1
# dpath = [[p1]
# [p2]
# [p3]]
# after first loop:
# dpath = [[p1 p8]
# [p3 p8]]
# since p2 and p8 are not disjoint
# after second loop:
# dpath = [ p3 p8 p6 ]
# since p1 and p4 are not disjoint
# p1 and p7 are not disjoint
# p3 and p4 are not disjoint
# p3 and p7 are not disjoint
for e1 in dlist[1:] :
temp = []
for j,p1 in enumerate(simple_rqs[e1]):
# allpaths[id(p1)].d_id = d.disjunction_id
# can use index j in simple_rqs_reversed because index
# of direct and reversed paths have been kept identical
p1_reversed = simple_rqs_reversed[e1][j]
# print(p1_reversed)
# print('\n\n')
for k,c in enumerate(dpath) :
# print(f' c: \t{c}')
temp2 = c.copy()
all_disjoint = 0
for p in c :
all_disjoint += isdisjoint(p1,p)+ isdisjoint(p1_reversed,p)
if all_disjoint ==0:
temp2.append(p1)
temp.append(temp2)
# print(f' coucou {e1}: \t{temp}')
dpath = temp
# print(dpath)
candidates[d.disjunction_id] = dpath
# for i in disjunctions_list :
# print(f'\n{candidates[i.disjunction_id]}')
# step 3
# now for each request, select the path that satisfies all disjunctions
# path must be in candidates[id] for all concerned ids
# for example, assume set of sync vectors (disjunction groups) is
# s1 = {rq1 rq2} s2 = {rq1 rq3}
# candidate[s1] = [[p1 p8]
# [p3 p8]]
# candidate[s2] = [[p3 p6]]
# for rq1 p3 should be preferred
for pathreq in pathreqlist_disjt:
concerned_d_id = [d.disjunction_id for d in disjunctions_list if pathreq.request_id in d.disjunctions_req]
# for each set of solution, verify that the same path is used for the same request
candidate_paths = simple_rqs[pathreq.request_id]
# print('coucou')
# print(pathreq.request_id)
for p in candidate_paths :
iscandidate = 0
for sol in concerned_d_id :
test = 1
# for each solution test if p is part of the solution
# if yes, then p can remain a candidate
for i,m in enumerate(candidates[sol]) :
if p in m:
if allpaths[id(m[m.index(p)])].req.request_id == pathreq.request_id :
test = 0
break
iscandidate += test
if iscandidate != 0:
for l in concerned_d_id :
for m in candidates[l] :
if p in m :
candidates[l].remove(m)
# for i in disjunctions_list :
# print(i.disjunction_id)
# print(f'\n{candidates[i.disjunction_id]}')
# step 4 apply route constraints : remove candidate path that do not satisfy the constraint
# only in the case of disjounction: the simple path is processed in request.compute_constrained_path
# TODO : keep a version without the loose constraint
for d in disjunctions_list :
temp = []
for j,sol in enumerate(candidates[d.disjunction_id]) :
testispartok = True
for i,p in enumerate(sol) :
# print(f'test {allpaths[id(p)].req.request_id}')
# print(f'length of route {len(allpaths[id(p)].req.nodes_list)}')
if allpaths[id(p)].req.nodes_list :
# if p does not containt the ordered list node, remove sol from the candidate
# except if this was the last solution: then check if the constraint is loose or not
if not ispart(allpaths[id(p)].req.nodes_list, p) :
# print(f'nb of solutions {len(temp)}')
if j < len(candidates[d.disjunction_id])-1 :
msg = f'removing {sol}'
logger.info(msg)
testispartok = False
#break
else:
if 'loose' in allpaths[id(p)].req.loose_list:
logger.info(f'Could not apply route constraint'+
f'{allpaths[id(p)].req.nodes_list} on request {allpaths[id(p)].req.request_id}')
else :
logger.info(f'removing last solution from candidate paths\n{sol}')
testispartok = False
if testispartok :
temp.append(sol)
candidates[d.disjunction_id] = temp
# step 5 select the first combination that works
pathreslist_disjoint = {}
for d in disjunctions_list :
test_sol = True
while test_sol:
# print('coucou')
if candidates[d.disjunction_id] :
for p in candidates[d.disjunction_id][0]:
if allpaths[id(p)].req in pathreqlist_disjt:
# print(f'selected path :{p} for req {allpaths[id(p)].req.request_id}')
pathreslist_disjoint[allpaths[id(p)].req] = allpaths[id(p)].pth
pathreqlist_disjt.remove(allpaths[id(p)].req)
candidates = remove_candidate(candidates, allpaths, allpaths[id(p)].req, p)
test_sol = False
else:
msg = f'No disjoint path found with added constraint'
logger.critical(msg)
print(f'{msg}\nComputation stopped.')
# TODO in this case: replay step 5 with the candidate without constraints
exit()
# for i in disjunctions_list :
# print(i.disjunction_id)
# print(f'\n{candidates[i.disjunction_id]}')
# list the results in the same order as initial pathreqlist
for req in pathreqlist :
req.nodes_list.append(req.destination)
# we assume that the destination is a strict constraint
req.loose_list.append('strict')
if req in pathreqlist_simple:
path_res_list.append(compute_constrained_path(network, req))
else:
path_res_list.append(pathreslist_disjoint[req])
return path_res_list
def isdisjoint(p1,p2) :
# returns 0 if disjoint
edge1 = list(pairwise(p1))
edge2 = list(pairwise(p2))
for e in edge1 :
if e in edge2 :
return 1
return 0
def find_reversed_path(p,network) :
# select of intermediate roadms and find the path between them
# note that this function may not give an exact result in case of multiple
# links between two adjacent nodes.
# TODO add some indication on elements to indicate from which other they
# are the reversed direction
reversed_roadm_path = list(reversed([e for e in p if isinstance (e,Roadm)]))
source = p[-1]
destination = p[0]
total_path = [source]
for node in reversed_roadm_path :
total_path.extend(dijkstra_path(network, source, node)[1:])
source = node
total_path.append(destination)
return total_path
def ispart(a,b) :
# the functions takes two paths a and b and retrns True
# if all a elements are part of b and in the same order
j = 0
for i, el in enumerate(a):
if el in b :
if b.index(el) >= j :
j = b.index(el)
else:
return False
else:
return False
return True
def remove_candidate(candidates, allpaths, rq, pth) :
# print(f'coucou {rq.request_id}')
for key, candidate in candidates.items() :
temp = candidate.copy()
for i,sol in enumerate(candidate) :
for p in sol :
if allpaths[id(p)].req.request_id == rq.request_id :
if id(p) != id(pth) :
temp.remove(sol)
break
candidates[key] = temp
return candidates
def compare_reqs(req1,req2,disjlist) :
dis1 = [d for d in disjlist if req1.request_id in d.disjunctions_req]
dis2 = [d for d in disjlist if req2.request_id in d.disjunctions_req]
same_disj = False
if dis1 and dis2 :
temp1 = []
for d in dis1:
temp1.extend(d.disjunctions_req)
temp1.remove(req1.request_id)
temp2 = []
for d in dis2:
temp2.extend(d.disjunctions_req)
temp2.remove(req2.request_id)
if set(temp1) == set(temp2) :
same_disj = True
elif not dis2 and not dis1:
same_disj = True
if req1.source == req2.source and \
req1.destination == req2.destination and \
req1.tsp == req2.tsp and \
req1.tsp_mode == req2.tsp_mode and \
req1.baud_rate == req2.baud_rate and \
req1.nodes_list == req2.nodes_list and \
req1.loose_list == req2.loose_list and \
req1.spacing == req2.spacing and \
req1.power == req2.power and \
req1.nb_channel == req2.nb_channel and \
req1.f_min == req2.f_min and \
req1.f_max == req2.f_max and \
req1.format == req2.format and \
req1.OSNR == req2.OSNR and \
req1.roll_off == req2.roll_off and \
same_disj :
return True
else:
return False
def requests_aggregation(pathreqlist,disjlist) :
# this function aggregates requests so that if several requests
# exist between same source and destination and with same transponder type
# todo maybe add conditions on mode ??, spacing ...
# currently if undefined takes the default values
local_list = pathreqlist.copy()
for req in pathreqlist:
for r in local_list :
if req.request_id != r.request_id and compare_reqs(req, r, disjlist):
# aggregate
r.path_bandwidth += req.path_bandwidth
temp_r_id = r.request_id
r.request_id = ' | '.join((r.request_id,req.request_id))
# remove request from list
local_list.remove(req)
# todo change also disjunction req with new demand
for d in disjlist :
if req.request_id in d.disjunctions_req :
d.disjunctions_req.remove(req.request_id)
d.disjunctions_req.append(r.request_id)
for d in disjlist :
if temp_r_id in d.disjunctions_req :
disjlist.remove(d)
break
return local_list, disjlist

View File

@@ -23,7 +23,7 @@ from pathlib import Path
from gnpy.core.equipment import load_equipment
from gnpy.core.utils import db2lin, lin2db
SERVICES_COLUMN = 11
SERVICES_COLUMN = 12
#EQPT_LIBRARY_FILENAME = Path(__file__).parent / 'eqpt_config.json'
all_rows = lambda sheet, start=0: (sheet.row(x) for x in range(start, sheet.nrows))
@@ -31,9 +31,9 @@ logger = getLogger(__name__)
# Type for input data
class Request(namedtuple('Request', 'request_id source destination trx_type mode \
spacing power nb_channel disjoint_from nodes_list is_loose')):
def __new__(cls, request_id, source, destination, trx_type, mode , spacing , power , nb_channel , disjoint_from ='' , nodes_list = None, is_loose = ''):
return super().__new__(cls, request_id, source, destination, trx_type, mode, spacing, power, nb_channel, disjoint_from, nodes_list, is_loose)
spacing power nb_channel disjoint_from nodes_list is_loose path_bandwidth')):
def __new__(cls, request_id, source, destination, trx_type, mode=None , spacing= None , power = None, nb_channel = None , disjoint_from ='' , nodes_list = None, is_loose = '', path_bandwidth = None):
return super().__new__(cls, request_id, source, destination, trx_type, mode, spacing, power, nb_channel, disjoint_from, nodes_list, is_loose, path_bandwidth)
# Type for output data: // from dutc
class Element:
@@ -47,15 +47,11 @@ class Request_element(Element):
# 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
if not isinstance(Request.request_id,str):
value = str(int(Request.request_id))
if value.endswith('.0'):
value = value[:-2]
self.request_id = value
else:
self.request_id = Request.request_id
self.request_id = correct_xlrd_int_to_str_reading(Request.request_id)
self.source = Request.source
self.destination = Request.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}'
# test that trx_type belongs to eqpt_config.json
@@ -63,55 +59,80 @@ class Request_element(Element):
equipment = load_equipment(eqpt_filename)
try :
if equipment['Transceiver'][Request.trx_type]:
self.trx_type = Request.trx_type
if [mode for mode in equipment['Transceiver'][Request.trx_type].mode]:
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
else :
msg = f'Request Id: {self.request_id} - could not find tsp : \'{Request.trx_type}\' with mode: \'{Requestmode}\' in eqpt library \nComputation stopped.'
#print(msg)
logger.critical(msg)
exit(1)
else:
Requestmode = None
self.mode = Request.mode
except KeyError:
msg = f'could not find tsp : {Request.trx_type} with mode: {Request.mode} in eqpt library \nComputation stopped.'
msg = f'Request Id: {self.request_id} - could not find tsp : \'{Request.trx_type}\' with mode: \'{Requestmode}\' in eqpt library \nComputation stopped.'
#print(msg)
logger.critical(msg)
exit()
# excel input are in GHz and dBm
self.spacing = Request.spacing * 1e9
self.power = db2lin(Request.power) * 1e-3
self.nb_channel = int(Request.nb_channel)
if not isinstance(Request.disjoint_from,str):
value = str(int(Request.disjoint_from))
if value.endswith('.0'):
value = value[:-2]
if Request.spacing is not None:
self.spacing = Request.spacing * 1e9
else:
value = Request.disjoint_from
self.disjoint_from = [n for n in value.split()]
msg = f'Request {self.request_id} missing spacing: spacing is mandatory.\ncomputation stopped'
logger.critical(msg)
exit()
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:
self.nb_channel = None
value = correct_xlrd_int_to_str_reading(Request.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(' | ')
# cleaning the list of nodes to remove source and destination
# (because the remaining of the program assumes that the nodes list are nodes
# on the path and should not include source and destination)
try :
self.nodes_list.remove(self.source)
msg = f'{self.source} removed from explicit path node-list'
logger.info(msg)
# print(msg)
except ValueError:
msg = f'{self.source} already removed from explicit path node-list'
logger.info(msg)
# print(msg)
try :
self.nodes_list.remove(self.destination)
msg = f'{self.destination} removed from explicit path node-list'
logger.info(msg)
# print(msg)
except ValueError:
msg = f'{self.destination} already removed from explicit path node-list'
logger.info(msg)
# print(msg)
# the excel parser applies the same hop-type to all nodes in the route nodes_list.
# user can change this per node in the generated json
self.loose = 'loose'
if Request.is_loose == '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))
@property
def pathrequest(self):
return {
req_dictionnary = {
'request-id':self.request_id,
'source': self.source,
'destination': self.destination,
@@ -126,6 +147,7 @@ class Request_element(Element):
'spacing' : self.spacing,
'max-nb-of-channel' : self.nb_channel,
'output-power' : self.power
# 'path_bandwidth' : self.path_bandwidth
}
},
'optimizations': {
@@ -135,7 +157,7 @@ class Request_element(Element):
'unnumbered-hop':{
'node-id': f'{node}',
'link-tp-id': 'link-tp-id is not used',
'hop-type': 'loose',
'hop-type': f'{self.loose}',
'direction': 'direction is not used'
},
'label-hop':{
@@ -150,10 +172,14 @@ class Request_element(Element):
}
}
if self.path_bandwidth is not None:
req_dictionnary['path-constraints']['te-bandwidth']['path_bandwidth'] = self.path_bandwidth
return req_dictionnary
@property
def pathsync(self):
if self.disjoint_from :
return {'synchonization-id':self.request_id,
return {'synchronization-id':self.request_id,
'svec': {
'relaxable' : 'False',
'link-diverse': 'True',
@@ -177,13 +203,22 @@ def convert_service_sheet(input_filename, eqpt_filename, output_filename='', fil
# print(json_filename)
data = {
'path-request': [n.json[0] for n in req],
'synchronisation': [n.json[1] for n in req
'synchronization': [n.json[1] for n in req
if n.json[1] is not None]
}
with open(output_filename, 'w') as f:
f.write(dumps(data, indent=2))
with open(output_filename, 'w', encoding='utf-8') as f:
f.write(dumps(data, indent=2, ensure_ascii=False))
return data
def correct_xlrd_int_to_str_reading(v) :
if not isinstance(v,str):
value = str(int(v))
if value.endswith('.0'):
value = value[:-2]
else:
value = v
return value
# to be used from dutc
def parse_row(row, fieldnames):
return {f: r.value for f, r in zip(fieldnames, row[0:SERVICES_COLUMN])
@@ -198,19 +233,24 @@ def parse_excel(input_filename):
def parse_service_sheet(service_sheet):
logger.info(f'Validating headers on {service_sheet.name!r}')
header = [x.value.strip() for x in service_sheet.row(4)[0:SERVICES_COLUMN]]
expected = ['route id', 'Source', 'Destination', 'TRX type', \
'Mode', 'System: spacing', 'System: input power (dBm)', 'System: nb of channels',\
'routing: disjoint from', 'routing: path', 'routing: is loose?']
if header != expected:
msg = f'Malformed header on Service sheet: {header} != {expected}'
# 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] if len(x.value.strip())>0]
# create a service_fieldname independant from the excel column order
# to be compatible with any version of the sheet
# the following dictionnary records the excel field names and the corresponding parameter's name
authorized_fieldnames = {'route id':'request_id', 'Source':'source', 'Destination':'destination', \
'TRX type':'trx_type', 'Mode' : 'mode', 'System: spacing':'spacing', \
'System: input power (dBm)':'power', 'System: nb of channels':'nb_channel',\
'routing: disjoint from': 'disjoint_from', 'routing: path':'nodes_list',\
'routing: is loose?':'is_loose', 'path bandwidth':'path_bandwidth'}
try :
service_fieldnames = [authorized_fieldnames[e] for e in header]
except KeyError:
msg = f'Malformed header on Service sheet: {header} field not in {authorized_fieldnames}'
logger.critical(msg)
raise ValueError(msg)
service_fieldnames = 'request_id source destination trx_type mode spacing power nb_channel disjoint_from nodes_list is_loose'.split()
# Important Note: it reads all colum on each row so that
# it is not possible to write annotation in the excel sheet
# outside the SERVICES_COLUMN ... TO BE IMPROVED
# request_id should be unique for disjunction constraints (not used yet)
for row in all_rows(service_sheet, start=5):
yield Request(**parse_row(row[0:SERVICES_COLUMN], service_fieldnames))

View File

@@ -18,14 +18,14 @@ from scipy import constants
def load_json(filename):
with open(filename, 'r') as f:
with open(filename, 'r', encoding='utf-8') as f:
data = json.load(f)
return data
def save_json(obj, filename):
with open(filename, 'w') as f:
json.dump(obj, f, indent=2)
with open(filename, 'w', encoding='utf-8') as f:
json.dump(obj, f, indent=2, ensure_ascii=False)
def write_csv(obj, filename):
"""
@@ -55,7 +55,7 @@ def write_csv(obj, filename):
result_category 2
...
"""
with open(filename, 'w') as f:
with open(filename, 'w', encoding='utf-8') as f:
w = writer(f)
for data_key, data_list in obj.items():
#main header
@@ -120,6 +120,10 @@ def freq2wavelength(value):
"""
return c() / value
def snr_sum(snr, bw, snr_added, bw_added=12.5e9):
snr_added = snr_added - lin2db(bw/bw_added)
snr = -lin2db(db2lin(-snr)+db2lin(-snr_added))
return snr
def deltawl2deltaf(delta_wl, wavelength):
""" deltawl2deltaf(delta_wl, wavelength):

View File

@@ -19,7 +19,8 @@
],
"spacing": null,
"max-nb-of-channel": null,
"output-power": null
"output-power": null,
"path_bandwidth": null
}
},
"optimizations": {

View File

@@ -77,8 +77,8 @@ def compare_networks(expected, actual):
def compare_services(expected, actual):
requests = compare(expected['path-request'], actual['path-request'],
key=lambda el: el['request-id'])
synchronizations = compare(expected['synchronisation'], actual['synchronisation'],
key=lambda el: el['synchonization-id'])
synchronizations = compare(expected['synchronization'], actual['synchronization'],
key=lambda el: el['synchronization-id'])
return ServicesResults(requests, synchronizations)
def compare_paths(expected_output, actual_output):
@@ -105,16 +105,16 @@ def encode_sets(obj):
if __name__ == '__main__':
args = parser.parse_args()
with open(args.expected_output) as f:
with open(args.expected_output, encoding='utf-8') as f:
expected = load(f)
with open(args.actual_output) as f:
with open(args.actual_output, encoding='utf-8') as f:
actual = load(f)
result = COMPARISONS[args.comparison](expected, actual)
if args.output:
with open(args.output, 'w') as f:
dump(result, f, default=encode_sets, indent=2)
with open(args.output, 'w', encoding='utf-8') as f:
dump(result, f, default=encode_sets, indent=2, ensure_ascii=False)
else:
print(str(result))

File diff suppressed because it is too large Load Diff

View File

@@ -66,7 +66,8 @@
],
"Roadms":[{
"gain_mode_default_loss": 20,
"power_mode_pref": -20
"power_mode_pout_target": -20,
"add_drop_osnr": 100
}],
"SI":[{
"f_min": 191.3e12,
@@ -76,8 +77,8 @@
"power_dbm": 0,
"power_range_db": [0,0.5,0.5],
"roll_off": 0.15,
"OSNR": 15,
"bit_rate":100e9
"tx_osnr": 100,
"sys_margins": 0
}],
"Transceiver":[
{
@@ -92,15 +93,41 @@
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost":1
},
{
"format": "PS_SP64_2",
"baud_rate": 64e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15
}
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 75e9,
"cost":1
},
{
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost":1
},
{
"format": "mode 2",
"baud_rate": 64e9,
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 75e9,
"cost":1
}
]
},
{
@@ -115,7 +142,69 @@
"baud_rate": 32e9,
"OSNR": 19,
"bit_rate": 200e9,
"roll_off": 0.15
"roll_off": 0.15,
"tx_osnr": 100,
"min_spacing": 50e9,
"cost":1
}
]
},
{
"type_variety": "Voyager",
"frequency":{
"min": 191.35e12,
"max": 196.1e12
},
"mode":[
{
"format": "mode 1",
"baud_rate": 32e9,
"OSNR": 12,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 50e9,
"cost":1
},
{
"format": "mode 3",
"baud_rate": 44e9,
"OSNR": 18,
"bit_rate": 300e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 62.5e9,
"cost":1
},
{
"format": "mode 2",
"baud_rate": 66e9,
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost":1
},
{
"format": "mode 2 - fake",
"baud_rate": 66e9,
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost":1
},
{
"format": "mode 4",
"baud_rate": 66e9,
"OSNR": 16,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 45,
"min_spacing": 75e9,
"cost":1
}
]
}

Binary file not shown.

View File

@@ -121,7 +121,7 @@
"type": "Roadm"
},
{
"uid": "ingress fused spans in Corlay",
"uid": "west fused spans in Corlay",
"metadata": {
"location": {
"city": "Corlay",
@@ -133,7 +133,7 @@
"type": "Fused"
},
{
"uid": "ingress fused spans in Loudeac",
"uid": "west fused spans in Loudeac",
"metadata": {
"location": {
"city": "Loudeac",
@@ -145,7 +145,7 @@
"type": "Fused"
},
{
"uid": "egress fused spans in Corlay",
"uid": "east fused spans in Corlay",
"metadata": {
"location": {
"city": "Corlay",
@@ -157,7 +157,7 @@
"type": "Fused"
},
{
"uid": "egress fused spans in Loudeac",
"uid": "east fused spans in Loudeac",
"metadata": {
"location": {
"city": "Loudeac",
@@ -169,7 +169,7 @@
"type": "Fused"
},
{
"uid": "fiber (Lannion_CAS \u2192 Corlay)-",
"uid": "fiber (Lannion_CAS Corlay)-",
"metadata": {
"location": {
"latitude": 0.0,
@@ -187,7 +187,7 @@
}
},
{
"uid": "fiber (Corlay \u2192 Loudeac)-",
"uid": "fiber (Corlay Loudeac)-",
"metadata": {
"location": {
"latitude": 0.0,
@@ -205,7 +205,7 @@
}
},
{
"uid": "fiber (Loudeac \u2192 Lorient_KMA)-",
"uid": "fiber (Loudeac Lorient_KMA)-",
"metadata": {
"location": {
"latitude": 0.0,
@@ -223,7 +223,7 @@
}
},
{
"uid": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F01",
"uid": "fiber (Lorient_KMA Vannes_KBE)-F01",
"metadata": {
"location": {
"latitude": 0.0,
@@ -241,7 +241,7 @@
}
},
{
"uid": "fiber (Lannion_CAS \u2192 Stbrieuc)-",
"uid": "fiber (Lannion_CAS Stbrieuc)-",
"metadata": {
"location": {
"latitude": 0.0,
@@ -259,7 +259,7 @@
}
},
{
"uid": "fiber (Stbrieuc \u2192 Rennes_STA)-",
"uid": "fiber (Stbrieuc Rennes_STA)-",
"metadata": {
"location": {
"latitude": 0.0,
@@ -277,7 +277,7 @@
}
},
{
"uid": "fiber (Lannion_CAS \u2192 Morlaix)-",
"uid": "fiber (Lannion_CAS Morlaix)-",
"metadata": {
"location": {
"latitude": 0.0,
@@ -295,7 +295,7 @@
}
},
{
"uid": "fiber (Morlaix \u2192 Brest_KLA)-",
"uid": "fiber (Morlaix Brest_KLA)-",
"metadata": {
"location": {
"latitude": 0.0,
@@ -313,7 +313,7 @@
}
},
{
"uid": "fiber (Corlay \u2192 Lannion_CAS)-",
"uid": "fiber (Corlay Lannion_CAS)-",
"metadata": {
"location": {
"latitude": 0.0,
@@ -331,7 +331,7 @@
}
},
{
"uid": "fiber (Loudeac \u2192 Corlay)-",
"uid": "fiber (Loudeac Corlay)-",
"metadata": {
"location": {
"latitude": 0.0,
@@ -349,7 +349,7 @@
}
},
{
"uid": "fiber (Lorient_KMA \u2192 Loudeac)-",
"uid": "fiber (Lorient_KMA Loudeac)-",
"metadata": {
"location": {
"latitude": 0.0,
@@ -367,7 +367,7 @@
}
},
{
"uid": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F01",
"uid": "fiber (Vannes_KBE Lorient_KMA)-F01",
"metadata": {
"location": {
"latitude": 0.0,
@@ -385,7 +385,7 @@
}
},
{
"uid": "fiber (Stbrieuc \u2192 Lannion_CAS)-",
"uid": "fiber (Stbrieuc Lannion_CAS)-",
"metadata": {
"location": {
"latitude": 0.0,
@@ -403,7 +403,7 @@
}
},
{
"uid": "fiber (Rennes_STA \u2192 Stbrieuc)-",
"uid": "fiber (Rennes_STA Stbrieuc)-",
"metadata": {
"location": {
"latitude": 0.0,
@@ -421,7 +421,7 @@
}
},
{
"uid": "fiber (Morlaix \u2192 Lannion_CAS)-",
"uid": "fiber (Morlaix Lannion_CAS)-",
"metadata": {
"location": {
"latitude": 0.0,
@@ -439,7 +439,7 @@
}
},
{
"uid": "fiber (Brest_KLA \u2192 Morlaix)-",
"uid": "fiber (Brest_KLA Morlaix)-",
"metadata": {
"location": {
"latitude": 0.0,
@@ -457,7 +457,7 @@
}
},
{
"uid": "egress edfa in Lannion_CAS to Morlaix",
"uid": "east edfa in Lannion_CAS to Morlaix",
"metadata": {
"location": {
"city": "Lannion_CAS",
@@ -470,11 +470,12 @@
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
"tilt_target": 0,
"out_voa": 0
}
},
{
"uid": "egress edfa in Lannion_CAS to Corlay",
"uid": "east edfa in Lannion_CAS to Corlay",
"metadata": {
"location": {
"city": "Lannion_CAS",
@@ -487,11 +488,12 @@
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
"tilt_target": 0,
"out_voa": 0
}
},
{
"uid": "egress edfa in Lannion_CAS to Stbrieuc",
"uid": "east edfa in Lannion_CAS to Stbrieuc",
"metadata": {
"location": {
"city": "Lannion_CAS",
@@ -504,11 +506,12 @@
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
"tilt_target": 0,
"out_voa": 0
}
},
{
"uid": "egress edfa in Corlay to Loudeac",
"uid": "east edfa in Corlay to Loudeac",
"metadata": {
"location": {
"city": "Corlay",
@@ -521,133 +524,134 @@
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
"tilt_target": 0,
"out_voa": 0
}
}
],
"connections": [
{
"from_node": "roadm Lannion_CAS",
"to_node": "egress edfa in Lannion_CAS to Corlay"
"to_node": "east edfa in Lannion_CAS to Corlay"
},
{
"from_node": "egress edfa in Lannion_CAS to Corlay",
"to_node": "fiber (Lannion_CAS \u2192 Corlay)-"
"from_node": "east edfa in Lannion_CAS to Corlay",
"to_node": "fiber (Lannion_CAS Corlay)-"
},
{
"from_node": "fiber (Corlay \u2192 Lannion_CAS)-",
"from_node": "fiber (Corlay Lannion_CAS)-",
"to_node": "roadm Lannion_CAS"
},
{
"from_node": "roadm Lannion_CAS",
"to_node": "egress edfa in Lannion_CAS to Stbrieuc"
"to_node": "east edfa in Lannion_CAS to Stbrieuc"
},
{
"from_node": "egress edfa in Lannion_CAS to Stbrieuc",
"to_node": "fiber (Lannion_CAS \u2192 Stbrieuc)-"
"from_node": "east edfa in Lannion_CAS to Stbrieuc",
"to_node": "fiber (Lannion_CAS Stbrieuc)-"
},
{
"from_node": "fiber (Stbrieuc \u2192 Lannion_CAS)-",
"from_node": "fiber (Stbrieuc Lannion_CAS)-",
"to_node": "roadm Lannion_CAS"
},
{
"from_node": "roadm Lannion_CAS",
"to_node": "egress edfa in Lannion_CAS to Morlaix"
"to_node": "east edfa in Lannion_CAS to Morlaix"
},
{
"from_node": "egress edfa in Lannion_CAS to Morlaix",
"to_node": "fiber (Lannion_CAS \u2192 Morlaix)-"
"from_node": "east edfa in Lannion_CAS to Morlaix",
"to_node": "fiber (Lannion_CAS Morlaix)-"
},
{
"from_node": "fiber (Morlaix \u2192 Lannion_CAS)-",
"from_node": "fiber (Morlaix Lannion_CAS)-",
"to_node": "roadm Lannion_CAS"
},
{
"from_node": "fiber (Lannion_CAS \u2192 Corlay)-",
"to_node": "ingress fused spans in Corlay"
"from_node": "fiber (Lannion_CAS Corlay)-",
"to_node": "west fused spans in Corlay"
},
{
"from_node": "ingress fused spans in Corlay",
"to_node": "fiber (Corlay \u2192 Loudeac)-"
"from_node": "west fused spans in Corlay",
"to_node": "fiber (Corlay Loudeac)-"
},
{
"from_node": "fiber (Loudeac \u2192 Corlay)-",
"to_node": "egress fused spans in Corlay"
"from_node": "fiber (Loudeac Corlay)-",
"to_node": "east fused spans in Corlay"
},
{
"from_node": "egress fused spans in Corlay",
"to_node": "fiber (Corlay \u2192 Lannion_CAS)-"
"from_node": "east fused spans in Corlay",
"to_node": "fiber (Corlay Lannion_CAS)-"
},
{
"from_node": "fiber (Corlay \u2192 Loudeac)-",
"to_node": "ingress fused spans in Loudeac"
"from_node": "fiber (Corlay Loudeac)-",
"to_node": "west fused spans in Loudeac"
},
{
"from_node": "ingress fused spans in Loudeac",
"to_node": "fiber (Loudeac \u2192 Lorient_KMA)-"
"from_node": "west fused spans in Loudeac",
"to_node": "fiber (Loudeac Lorient_KMA)-"
},
{
"from_node": "fiber (Lorient_KMA \u2192 Loudeac)-",
"to_node": "egress fused spans in Loudeac"
"from_node": "fiber (Lorient_KMA Loudeac)-",
"to_node": "east fused spans in Loudeac"
},
{
"from_node": "egress fused spans in Loudeac",
"to_node": "fiber (Loudeac \u2192 Corlay)-"
"from_node": "east fused spans in Loudeac",
"to_node": "fiber (Loudeac Corlay)-"
},
{
"from_node": "roadm Lorient_KMA",
"to_node": "fiber (Lorient_KMA \u2192 Loudeac)-"
"to_node": "fiber (Lorient_KMA Loudeac)-"
},
{
"from_node": "fiber (Loudeac \u2192 Lorient_KMA)-",
"from_node": "fiber (Loudeac Lorient_KMA)-",
"to_node": "roadm Lorient_KMA"
},
{
"from_node": "roadm Lorient_KMA",
"to_node": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F01"
"to_node": "fiber (Lorient_KMA Vannes_KBE)-F01"
},
{
"from_node": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F01",
"from_node": "fiber (Vannes_KBE Lorient_KMA)-F01",
"to_node": "roadm Lorient_KMA"
},
{
"from_node": "roadm Vannes_KBE",
"to_node": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F01"
"to_node": "fiber (Vannes_KBE Lorient_KMA)-F01"
},
{
"from_node": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F01",
"from_node": "fiber (Lorient_KMA Vannes_KBE)-F01",
"to_node": "roadm Vannes_KBE"
},
{
"from_node": "fiber (Lannion_CAS \u2192 Stbrieuc)-",
"to_node": "fiber (Stbrieuc \u2192 Rennes_STA)-"
"from_node": "fiber (Lannion_CAS Stbrieuc)-",
"to_node": "fiber (Stbrieuc Rennes_STA)-"
},
{
"from_node": "fiber (Rennes_STA \u2192 Stbrieuc)-",
"to_node": "fiber (Stbrieuc \u2192 Lannion_CAS)-"
"from_node": "fiber (Rennes_STA Stbrieuc)-",
"to_node": "fiber (Stbrieuc Lannion_CAS)-"
},
{
"from_node": "roadm Rennes_STA",
"to_node": "fiber (Rennes_STA \u2192 Stbrieuc)-"
"to_node": "fiber (Rennes_STA Stbrieuc)-"
},
{
"from_node": "fiber (Stbrieuc \u2192 Rennes_STA)-",
"from_node": "fiber (Stbrieuc Rennes_STA)-",
"to_node": "roadm Rennes_STA"
},
{
"from_node": "fiber (Lannion_CAS \u2192 Morlaix)-",
"to_node": "fiber (Morlaix \u2192 Brest_KLA)-"
"from_node": "fiber (Lannion_CAS Morlaix)-",
"to_node": "fiber (Morlaix Brest_KLA)-"
},
{
"from_node": "fiber (Brest_KLA \u2192 Morlaix)-",
"to_node": "fiber (Morlaix \u2192 Lannion_CAS)-"
"from_node": "fiber (Brest_KLA Morlaix)-",
"to_node": "fiber (Morlaix Lannion_CAS)-"
},
{
"from_node": "roadm Brest_KLA",
"to_node": "fiber (Brest_KLA \u2192 Morlaix)-"
"to_node": "fiber (Brest_KLA Morlaix)-"
},
{
"from_node": "fiber (Morlaix \u2192 Brest_KLA)-",
"from_node": "fiber (Morlaix Brest_KLA)-",
"to_node": "roadm Brest_KLA"
},
{

View File

@@ -19,7 +19,8 @@
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.001
"output-power": 0.001,
"path_bandwidth": 0
}
},
"optimizations": {
@@ -45,7 +46,8 @@
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.001
"output-power": 0.001,
"path_bandwidth": 0
}
},
"optimizations": {
@@ -53,9 +55,9 @@
}
}
],
"synchronisation": [
"synchronization": [
{
"synchonization-id": "0",
"synchronization-id": "0",
"svec": {
"relaxable": "False",
"link-diverse": "True",
@@ -67,7 +69,7 @@
}
},
{
"synchonization-id": "1",
"synchronization-id": "1",
"svec": {
"relaxable": "False",
"link-diverse": "True",
@@ -79,4 +81,4 @@
}
}
]
}
}

Binary file not shown.

View File

@@ -169,7 +169,7 @@
"type": "Roadm"
},
{
"uid": "ingress fused spans in Corlay",
"uid": "west fused spans in Corlay",
"metadata": {
"location": {
"city": "Corlay",
@@ -181,7 +181,7 @@
"type": "Fused"
},
{
"uid": "ingress fused spans in Loudeac",
"uid": "west fused spans in Loudeac",
"metadata": {
"location": {
"city": "Loudeac",
@@ -193,7 +193,7 @@
"type": "Fused"
},
{
"uid": "ingress fused spans in Morlaix",
"uid": "west fused spans in Morlaix",
"metadata": {
"location": {
"city": "Morlaix",
@@ -205,7 +205,7 @@
"type": "Fused"
},
{
"uid": "egress fused spans in Corlay",
"uid": "east fused spans in Corlay",
"metadata": {
"location": {
"city": "Corlay",
@@ -217,7 +217,7 @@
"type": "Fused"
},
{
"uid": "egress fused spans in Loudeac",
"uid": "east fused spans in Loudeac",
"metadata": {
"location": {
"city": "Loudeac",
@@ -229,7 +229,7 @@
"type": "Fused"
},
{
"uid": "egress fused spans in Morlaix",
"uid": "east fused spans in Morlaix",
"metadata": {
"location": {
"city": "Morlaix",
@@ -241,7 +241,7 @@
"type": "Fused"
},
{
"uid": "fiber (Lannion_CAS \u2192 Corlay)-F061",
"uid": "fiber (Lannion_CAS Corlay)-F061",
"metadata": {
"location": {
"latitude": 2.0,
@@ -259,7 +259,7 @@
}
},
{
"uid": "fiber (Corlay \u2192 Loudeac)-F010",
"uid": "fiber (Corlay Loudeac)-F010",
"metadata": {
"location": {
"latitude": 2.0,
@@ -277,7 +277,7 @@
}
},
{
"uid": "fiber (Loudeac \u2192 Lorient_KMA)-F054",
"uid": "fiber (Loudeac Lorient_KMA)-F054",
"metadata": {
"location": {
"latitude": 2.0,
@@ -295,7 +295,7 @@
}
},
{
"uid": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F055",
"uid": "fiber (Lorient_KMA Vannes_KBE)-F055",
"metadata": {
"location": {
"latitude": 2.0,
@@ -313,7 +313,7 @@
}
},
{
"uid": "fiber (Lannion_CAS \u2192 Stbrieuc)-F056",
"uid": "fiber (Lannion_CAS Stbrieuc)-F056",
"metadata": {
"location": {
"latitude": 1.5,
@@ -331,7 +331,7 @@
}
},
{
"uid": "fiber (Stbrieuc \u2192 Rennes_STA)-F057",
"uid": "fiber (Stbrieuc Rennes_STA)-F057",
"metadata": {
"location": {
"latitude": 0.5,
@@ -349,7 +349,7 @@
}
},
{
"uid": "fiber (Lannion_CAS \u2192 Morlaix)-F059",
"uid": "fiber (Lannion_CAS Morlaix)-F059",
"metadata": {
"location": {
"latitude": 2.5,
@@ -367,7 +367,7 @@
}
},
{
"uid": "fiber (Morlaix \u2192 Brest_KLA)-F060",
"uid": "fiber (Morlaix Brest_KLA)-F060",
"metadata": {
"location": {
"latitude": 3.5,
@@ -385,7 +385,7 @@
}
},
{
"uid": "fiber (toto \u2192 tata)-",
"uid": "fiber (toto tata)-",
"metadata": {
"location": {
"latitude": 6.5,
@@ -403,7 +403,7 @@
}
},
{
"uid": "fiber (Corlay \u2192 Lannion_CAS)-F061",
"uid": "fiber (Corlay Lannion_CAS)-F061",
"metadata": {
"location": {
"latitude": 2.0,
@@ -421,7 +421,7 @@
}
},
{
"uid": "fiber (Loudeac \u2192 Corlay)-F010",
"uid": "fiber (Loudeac Corlay)-F010",
"metadata": {
"location": {
"latitude": 2.0,
@@ -439,7 +439,7 @@
}
},
{
"uid": "fiber (Lorient_KMA \u2192 Loudeac)-F054",
"uid": "fiber (Lorient_KMA Loudeac)-F054",
"metadata": {
"location": {
"latitude": 2.0,
@@ -457,7 +457,7 @@
}
},
{
"uid": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F055",
"uid": "fiber (Vannes_KBE Lorient_KMA)-F055",
"metadata": {
"location": {
"latitude": 2.0,
@@ -475,7 +475,7 @@
}
},
{
"uid": "fiber (Stbrieuc \u2192 Lannion_CAS)-F056",
"uid": "fiber (Stbrieuc Lannion_CAS)-F056",
"metadata": {
"location": {
"latitude": 1.5,
@@ -493,7 +493,7 @@
}
},
{
"uid": "fiber (Rennes_STA \u2192 Stbrieuc)-F057",
"uid": "fiber (Rennes_STA Stbrieuc)-F057",
"metadata": {
"location": {
"latitude": 0.5,
@@ -511,7 +511,7 @@
}
},
{
"uid": "fiber (Morlaix \u2192 Lannion_CAS)-F059",
"uid": "fiber (Morlaix Lannion_CAS)-F059",
"metadata": {
"location": {
"latitude": 2.5,
@@ -529,7 +529,7 @@
}
},
{
"uid": "fiber (Brest_KLA \u2192 Morlaix)-F060",
"uid": "fiber (Brest_KLA Morlaix)-F060",
"metadata": {
"location": {
"latitude": 3.5,
@@ -547,7 +547,7 @@
}
},
{
"uid": "fiber (tata \u2192 toto)-",
"uid": "fiber (tata toto)-",
"metadata": {
"location": {
"latitude": 6.5,
@@ -565,7 +565,7 @@
}
},
{
"uid": "egress edfa in Lannion_CAS to Corlay",
"uid": "east edfa in Lannion_CAS to Corlay",
"metadata": {
"location": {
"city": "Lannion_CAS",
@@ -578,11 +578,12 @@
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
"tilt_target": 0,
"out_voa": 0
}
},
{
"uid": "egress edfa in Lorient_KMA to Loudeac",
"uid": "east edfa in Lorient_KMA to Loudeac",
"metadata": {
"location": {
"city": "Lorient_KMA",
@@ -595,153 +596,154 @@
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
"tilt_target": 0,
"out_voa": 0
}
}
],
"connections": [
{
"from_node": "roadm Lannion_CAS",
"to_node": "egress edfa in Lannion_CAS to Corlay"
"to_node": "east edfa in Lannion_CAS to Corlay"
},
{
"from_node": "egress edfa in Lannion_CAS to Corlay",
"to_node": "fiber (Lannion_CAS \u2192 Corlay)-F061"
"from_node": "east edfa in Lannion_CAS to Corlay",
"to_node": "fiber (Lannion_CAS Corlay)-F061"
},
{
"from_node": "fiber (Corlay \u2192 Lannion_CAS)-F061",
"from_node": "fiber (Corlay Lannion_CAS)-F061",
"to_node": "roadm Lannion_CAS"
},
{
"from_node": "roadm Lannion_CAS",
"to_node": "fiber (Lannion_CAS \u2192 Stbrieuc)-F056"
"to_node": "fiber (Lannion_CAS Stbrieuc)-F056"
},
{
"from_node": "fiber (Stbrieuc \u2192 Lannion_CAS)-F056",
"from_node": "fiber (Stbrieuc Lannion_CAS)-F056",
"to_node": "roadm Lannion_CAS"
},
{
"from_node": "roadm Lannion_CAS",
"to_node": "fiber (Lannion_CAS \u2192 Morlaix)-F059"
"to_node": "fiber (Lannion_CAS Morlaix)-F059"
},
{
"from_node": "fiber (Morlaix \u2192 Lannion_CAS)-F059",
"from_node": "fiber (Morlaix Lannion_CAS)-F059",
"to_node": "roadm Lannion_CAS"
},
{
"from_node": "fiber (Lannion_CAS \u2192 Corlay)-F061",
"to_node": "ingress fused spans in Corlay"
"from_node": "fiber (Lannion_CAS Corlay)-F061",
"to_node": "west fused spans in Corlay"
},
{
"from_node": "ingress fused spans in Corlay",
"to_node": "fiber (Corlay \u2192 Loudeac)-F010"
"from_node": "west fused spans in Corlay",
"to_node": "fiber (Corlay Loudeac)-F010"
},
{
"from_node": "fiber (Loudeac \u2192 Corlay)-F010",
"to_node": "egress fused spans in Corlay"
"from_node": "fiber (Loudeac Corlay)-F010",
"to_node": "east fused spans in Corlay"
},
{
"from_node": "egress fused spans in Corlay",
"to_node": "fiber (Corlay \u2192 Lannion_CAS)-F061"
"from_node": "east fused spans in Corlay",
"to_node": "fiber (Corlay Lannion_CAS)-F061"
},
{
"from_node": "fiber (Corlay \u2192 Loudeac)-F010",
"to_node": "ingress fused spans in Loudeac"
"from_node": "fiber (Corlay Loudeac)-F010",
"to_node": "west fused spans in Loudeac"
},
{
"from_node": "ingress fused spans in Loudeac",
"to_node": "fiber (Loudeac \u2192 Lorient_KMA)-F054"
"from_node": "west fused spans in Loudeac",
"to_node": "fiber (Loudeac Lorient_KMA)-F054"
},
{
"from_node": "fiber (Lorient_KMA \u2192 Loudeac)-F054",
"to_node": "egress fused spans in Loudeac"
"from_node": "fiber (Lorient_KMA Loudeac)-F054",
"to_node": "east fused spans in Loudeac"
},
{
"from_node": "egress fused spans in Loudeac",
"to_node": "fiber (Loudeac \u2192 Corlay)-F010"
"from_node": "east fused spans in Loudeac",
"to_node": "fiber (Loudeac Corlay)-F010"
},
{
"from_node": "roadm Lorient_KMA",
"to_node": "egress edfa in Lorient_KMA to Loudeac"
"to_node": "east edfa in Lorient_KMA to Loudeac"
},
{
"from_node": "egress edfa in Lorient_KMA to Loudeac",
"to_node": "fiber (Lorient_KMA \u2192 Loudeac)-F054"
"from_node": "east edfa in Lorient_KMA to Loudeac",
"to_node": "fiber (Lorient_KMA Loudeac)-F054"
},
{
"from_node": "fiber (Loudeac \u2192 Lorient_KMA)-F054",
"from_node": "fiber (Loudeac Lorient_KMA)-F054",
"to_node": "roadm Lorient_KMA"
},
{
"from_node": "roadm Lorient_KMA",
"to_node": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F055"
"to_node": "fiber (Lorient_KMA Vannes_KBE)-F055"
},
{
"from_node": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F055",
"from_node": "fiber (Vannes_KBE Lorient_KMA)-F055",
"to_node": "roadm Lorient_KMA"
},
{
"from_node": "roadm Vannes_KBE",
"to_node": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F055"
"to_node": "fiber (Vannes_KBE Lorient_KMA)-F055"
},
{
"from_node": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F055",
"from_node": "fiber (Lorient_KMA Vannes_KBE)-F055",
"to_node": "roadm Vannes_KBE"
},
{
"from_node": "fiber (Lannion_CAS \u2192 Stbrieuc)-F056",
"to_node": "fiber (Stbrieuc \u2192 Rennes_STA)-F057"
"from_node": "fiber (Lannion_CAS Stbrieuc)-F056",
"to_node": "fiber (Stbrieuc Rennes_STA)-F057"
},
{
"from_node": "fiber (Rennes_STA \u2192 Stbrieuc)-F057",
"to_node": "fiber (Stbrieuc \u2192 Lannion_CAS)-F056"
"from_node": "fiber (Rennes_STA Stbrieuc)-F057",
"to_node": "fiber (Stbrieuc Lannion_CAS)-F056"
},
{
"from_node": "roadm Rennes_STA",
"to_node": "fiber (Rennes_STA \u2192 Stbrieuc)-F057"
"to_node": "fiber (Rennes_STA Stbrieuc)-F057"
},
{
"from_node": "fiber (Stbrieuc \u2192 Rennes_STA)-F057",
"from_node": "fiber (Stbrieuc Rennes_STA)-F057",
"to_node": "roadm Rennes_STA"
},
{
"from_node": "fiber (Lannion_CAS \u2192 Morlaix)-F059",
"to_node": "ingress fused spans in Morlaix"
"from_node": "fiber (Lannion_CAS Morlaix)-F059",
"to_node": "west fused spans in Morlaix"
},
{
"from_node": "ingress fused spans in Morlaix",
"to_node": "fiber (Morlaix \u2192 Brest_KLA)-F060"
"from_node": "west fused spans in Morlaix",
"to_node": "fiber (Morlaix Brest_KLA)-F060"
},
{
"from_node": "fiber (Brest_KLA \u2192 Morlaix)-F060",
"to_node": "egress fused spans in Morlaix"
"from_node": "fiber (Brest_KLA Morlaix)-F060",
"to_node": "east fused spans in Morlaix"
},
{
"from_node": "egress fused spans in Morlaix",
"to_node": "fiber (Morlaix \u2192 Lannion_CAS)-F059"
"from_node": "east fused spans in Morlaix",
"to_node": "fiber (Morlaix Lannion_CAS)-F059"
},
{
"from_node": "roadm Brest_KLA",
"to_node": "fiber (Brest_KLA \u2192 Morlaix)-F060"
"to_node": "fiber (Brest_KLA Morlaix)-F060"
},
{
"from_node": "fiber (Morlaix \u2192 Brest_KLA)-F060",
"from_node": "fiber (Morlaix Brest_KLA)-F060",
"to_node": "roadm Brest_KLA"
},
{
"from_node": "roadm toto",
"to_node": "fiber (toto \u2192 tata)-"
"to_node": "fiber (toto tata)-"
},
{
"from_node": "fiber (tata \u2192 toto)-",
"from_node": "fiber (tata toto)-",
"to_node": "roadm toto"
},
{
"from_node": "roadm tata",
"to_node": "fiber (tata \u2192 toto)-"
"to_node": "fiber (tata toto)-"
},
{
"from_node": "fiber (toto \u2192 tata)-",
"from_node": "fiber (toto tata)-",
"to_node": "roadm tata"
},
{

View File

@@ -19,7 +19,8 @@
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.0012589254117941673
"output-power": 0.0012589254117941673,
"path_bandwidth": 0
}
},
"optimizations": {
@@ -45,7 +46,8 @@
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.0012589254117941673
"output-power": 0.0012589254117941673,
"path_bandwidth": 0
}
},
"optimizations": {
@@ -102,7 +104,8 @@
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.0012589254117941673
"output-power": 0.0012589254117941673,
"path_bandwidth": 0
}
},
"optimizations": {
@@ -128,7 +131,8 @@
],
"spacing": 75000000000.0,
"max-nb-of-channel": 64,
"output-power": 0.0019952623149688794
"output-power": 0.0019952623149688794,
"path_bandwidth": 0
}
},
"optimizations": {
@@ -154,7 +158,8 @@
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.0012589254117941673
"output-power": 0.0012589254117941673,
"path_bandwidth": 0
}
},
"optimizations": {
@@ -178,9 +183,9 @@
}
}
],
"synchronisation": [
"synchronization": [
{
"synchonization-id": "0",
"synchronization-id": "0",
"svec": {
"relaxable": "False",
"link-diverse": "True",
@@ -192,7 +197,7 @@
}
},
{
"synchonization-id": "3",
"synchronization-id": "3",
"svec": {
"relaxable": "False",
"link-diverse": "True",
@@ -204,7 +209,7 @@
}
},
{
"synchonization-id": "5",
"synchronization-id": "5",
"svec": {
"relaxable": "False",
"link-diverse": "True",
@@ -216,4 +221,4 @@
}
}
]
}
}

View File

@@ -169,7 +169,7 @@
"type": "Roadm"
},
{
"uid": "ingress fused spans in Corlay",
"uid": "west fused spans in Corlay",
"metadata": {
"location": {
"city": "Corlay",
@@ -181,7 +181,7 @@
"type": "Fused"
},
{
"uid": "ingress fused spans in Loudeac",
"uid": "west fused spans in Loudeac",
"metadata": {
"location": {
"city": "Loudeac",
@@ -193,7 +193,7 @@
"type": "Fused"
},
{
"uid": "ingress fused spans in Morlaix",
"uid": "west fused spans in Morlaix",
"metadata": {
"location": {
"city": "Morlaix",
@@ -205,7 +205,7 @@
"type": "Fused"
},
{
"uid": "egress fused spans in Corlay",
"uid": "east fused spans in Corlay",
"metadata": {
"location": {
"city": "Corlay",
@@ -217,7 +217,7 @@
"type": "Fused"
},
{
"uid": "egress fused spans in Loudeac",
"uid": "east fused spans in Loudeac",
"metadata": {
"location": {
"city": "Loudeac",
@@ -229,7 +229,7 @@
"type": "Fused"
},
{
"uid": "egress fused spans in Morlaix",
"uid": "east fused spans in Morlaix",
"metadata": {
"location": {
"city": "Morlaix",
@@ -241,7 +241,7 @@
"type": "Fused"
},
{
"uid": "fiber (Lannion_CAS \u2192 Corlay)-F061",
"uid": "fiber (Lannion_CAS Corlay)-F061",
"metadata": {
"location": {
"latitude": 2.0,
@@ -259,7 +259,7 @@
}
},
{
"uid": "fiber (Corlay \u2192 Loudeac)-F010",
"uid": "fiber (Corlay Loudeac)-F010",
"metadata": {
"location": {
"latitude": 2.0,
@@ -277,7 +277,7 @@
}
},
{
"uid": "fiber (Loudeac \u2192 Lorient_KMA)-F054",
"uid": "fiber (Loudeac Lorient_KMA)-F054",
"metadata": {
"location": {
"latitude": 2.0,
@@ -295,7 +295,7 @@
}
},
{
"uid": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F055",
"uid": "fiber (Lorient_KMA Vannes_KBE)-F055",
"metadata": {
"location": {
"latitude": 2.0,
@@ -313,7 +313,7 @@
}
},
{
"uid": "fiber (Lannion_CAS \u2192 Stbrieuc)-F056",
"uid": "fiber (Lannion_CAS Stbrieuc)-F056",
"metadata": {
"location": {
"latitude": 1.5,
@@ -331,7 +331,7 @@
}
},
{
"uid": "fiber (Stbrieuc \u2192 Rennes_STA)-F057",
"uid": "fiber (Stbrieuc Rennes_STA)-F057",
"metadata": {
"location": {
"latitude": 0.5,
@@ -349,7 +349,7 @@
}
},
{
"uid": "fiber (Lannion_CAS \u2192 Morlaix)-F059",
"uid": "fiber (Lannion_CAS Morlaix)-F059",
"metadata": {
"location": {
"latitude": 2.5,
@@ -367,7 +367,7 @@
}
},
{
"uid": "fiber (Morlaix \u2192 Brest_KLA)-F060",
"uid": "fiber (Morlaix Brest_KLA)-F060",
"metadata": {
"location": {
"latitude": 3.5,
@@ -385,7 +385,7 @@
}
},
{
"uid": "fiber (toto \u2192 tata)-",
"uid": "fiber (toto tata)-",
"metadata": {
"location": {
"latitude": 6.5,
@@ -403,7 +403,7 @@
}
},
{
"uid": "fiber (Corlay \u2192 Lannion_CAS)-F061",
"uid": "fiber (Corlay Lannion_CAS)-F061",
"metadata": {
"location": {
"latitude": 2.0,
@@ -421,7 +421,7 @@
}
},
{
"uid": "fiber (Loudeac \u2192 Corlay)-F010",
"uid": "fiber (Loudeac Corlay)-F010",
"metadata": {
"location": {
"latitude": 2.0,
@@ -439,7 +439,7 @@
}
},
{
"uid": "fiber (Lorient_KMA \u2192 Loudeac)-F054",
"uid": "fiber (Lorient_KMA Loudeac)-F054",
"metadata": {
"location": {
"latitude": 2.0,
@@ -457,7 +457,7 @@
}
},
{
"uid": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F055",
"uid": "fiber (Vannes_KBE Lorient_KMA)-F055",
"metadata": {
"location": {
"latitude": 2.0,
@@ -475,7 +475,7 @@
}
},
{
"uid": "fiber (Stbrieuc \u2192 Lannion_CAS)-F056",
"uid": "fiber (Stbrieuc Lannion_CAS)-F056",
"metadata": {
"location": {
"latitude": 1.5,
@@ -493,7 +493,7 @@
}
},
{
"uid": "fiber (Rennes_STA \u2192 Stbrieuc)-F057",
"uid": "fiber (Rennes_STA Stbrieuc)-F057",
"metadata": {
"location": {
"latitude": 0.5,
@@ -511,7 +511,7 @@
}
},
{
"uid": "fiber (Morlaix \u2192 Lannion_CAS)-F059",
"uid": "fiber (Morlaix Lannion_CAS)-F059",
"metadata": {
"location": {
"latitude": 2.5,
@@ -529,7 +529,7 @@
}
},
{
"uid": "fiber (Brest_KLA \u2192 Morlaix)-F060",
"uid": "fiber (Brest_KLA Morlaix)-F060",
"metadata": {
"location": {
"latitude": 3.5,
@@ -547,7 +547,7 @@
}
},
{
"uid": "fiber (tata \u2192 toto)-",
"uid": "fiber (tata toto)-",
"metadata": {
"location": {
"latitude": 6.5,
@@ -568,138 +568,138 @@
"connections": [
{
"from_node": "roadm Lannion_CAS",
"to_node": "fiber (Lannion_CAS \u2192 Corlay)-F061"
"to_node": "fiber (Lannion_CAS Corlay)-F061"
},
{
"from_node": "fiber (Corlay \u2192 Lannion_CAS)-F061",
"from_node": "fiber (Corlay Lannion_CAS)-F061",
"to_node": "roadm Lannion_CAS"
},
{
"from_node": "roadm Lannion_CAS",
"to_node": "fiber (Lannion_CAS \u2192 Stbrieuc)-F056"
"to_node": "fiber (Lannion_CAS Stbrieuc)-F056"
},
{
"from_node": "fiber (Stbrieuc \u2192 Lannion_CAS)-F056",
"from_node": "fiber (Stbrieuc Lannion_CAS)-F056",
"to_node": "roadm Lannion_CAS"
},
{
"from_node": "roadm Lannion_CAS",
"to_node": "fiber (Lannion_CAS \u2192 Morlaix)-F059"
"to_node": "fiber (Lannion_CAS Morlaix)-F059"
},
{
"from_node": "fiber (Morlaix \u2192 Lannion_CAS)-F059",
"from_node": "fiber (Morlaix Lannion_CAS)-F059",
"to_node": "roadm Lannion_CAS"
},
{
"from_node": "fiber (Lannion_CAS \u2192 Corlay)-F061",
"to_node": "ingress fused spans in Corlay"
"from_node": "fiber (Lannion_CAS Corlay)-F061",
"to_node": "west fused spans in Corlay"
},
{
"from_node": "ingress fused spans in Corlay",
"to_node": "fiber (Corlay \u2192 Loudeac)-F010"
"from_node": "west fused spans in Corlay",
"to_node": "fiber (Corlay Loudeac)-F010"
},
{
"from_node": "fiber (Loudeac \u2192 Corlay)-F010",
"to_node": "egress fused spans in Corlay"
"from_node": "fiber (Loudeac Corlay)-F010",
"to_node": "east fused spans in Corlay"
},
{
"from_node": "egress fused spans in Corlay",
"to_node": "fiber (Corlay \u2192 Lannion_CAS)-F061"
"from_node": "east fused spans in Corlay",
"to_node": "fiber (Corlay Lannion_CAS)-F061"
},
{
"from_node": "fiber (Corlay \u2192 Loudeac)-F010",
"to_node": "ingress fused spans in Loudeac"
"from_node": "fiber (Corlay Loudeac)-F010",
"to_node": "west fused spans in Loudeac"
},
{
"from_node": "ingress fused spans in Loudeac",
"to_node": "fiber (Loudeac \u2192 Lorient_KMA)-F054"
"from_node": "west fused spans in Loudeac",
"to_node": "fiber (Loudeac Lorient_KMA)-F054"
},
{
"from_node": "fiber (Lorient_KMA \u2192 Loudeac)-F054",
"to_node": "egress fused spans in Loudeac"
"from_node": "fiber (Lorient_KMA Loudeac)-F054",
"to_node": "east fused spans in Loudeac"
},
{
"from_node": "egress fused spans in Loudeac",
"to_node": "fiber (Loudeac \u2192 Corlay)-F010"
"from_node": "east fused spans in Loudeac",
"to_node": "fiber (Loudeac Corlay)-F010"
},
{
"from_node": "roadm Lorient_KMA",
"to_node": "fiber (Lorient_KMA \u2192 Loudeac)-F054"
"to_node": "fiber (Lorient_KMA Loudeac)-F054"
},
{
"from_node": "fiber (Loudeac \u2192 Lorient_KMA)-F054",
"from_node": "fiber (Loudeac Lorient_KMA)-F054",
"to_node": "roadm Lorient_KMA"
},
{
"from_node": "roadm Lorient_KMA",
"to_node": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F055"
"to_node": "fiber (Lorient_KMA Vannes_KBE)-F055"
},
{
"from_node": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F055",
"from_node": "fiber (Vannes_KBE Lorient_KMA)-F055",
"to_node": "roadm Lorient_KMA"
},
{
"from_node": "roadm Vannes_KBE",
"to_node": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F055"
"to_node": "fiber (Vannes_KBE Lorient_KMA)-F055"
},
{
"from_node": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F055",
"from_node": "fiber (Lorient_KMA Vannes_KBE)-F055",
"to_node": "roadm Vannes_KBE"
},
{
"from_node": "fiber (Lannion_CAS \u2192 Stbrieuc)-F056",
"to_node": "fiber (Stbrieuc \u2192 Rennes_STA)-F057"
"from_node": "fiber (Lannion_CAS Stbrieuc)-F056",
"to_node": "fiber (Stbrieuc Rennes_STA)-F057"
},
{
"from_node": "fiber (Rennes_STA \u2192 Stbrieuc)-F057",
"to_node": "fiber (Stbrieuc \u2192 Lannion_CAS)-F056"
"from_node": "fiber (Rennes_STA Stbrieuc)-F057",
"to_node": "fiber (Stbrieuc Lannion_CAS)-F056"
},
{
"from_node": "roadm Rennes_STA",
"to_node": "fiber (Rennes_STA \u2192 Stbrieuc)-F057"
"to_node": "fiber (Rennes_STA Stbrieuc)-F057"
},
{
"from_node": "fiber (Stbrieuc \u2192 Rennes_STA)-F057",
"from_node": "fiber (Stbrieuc Rennes_STA)-F057",
"to_node": "roadm Rennes_STA"
},
{
"from_node": "fiber (Lannion_CAS \u2192 Morlaix)-F059",
"to_node": "ingress fused spans in Morlaix"
"from_node": "fiber (Lannion_CAS Morlaix)-F059",
"to_node": "west fused spans in Morlaix"
},
{
"from_node": "ingress fused spans in Morlaix",
"to_node": "fiber (Morlaix \u2192 Brest_KLA)-F060"
"from_node": "west fused spans in Morlaix",
"to_node": "fiber (Morlaix Brest_KLA)-F060"
},
{
"from_node": "fiber (Brest_KLA \u2192 Morlaix)-F060",
"to_node": "egress fused spans in Morlaix"
"from_node": "fiber (Brest_KLA Morlaix)-F060",
"to_node": "east fused spans in Morlaix"
},
{
"from_node": "egress fused spans in Morlaix",
"to_node": "fiber (Morlaix \u2192 Lannion_CAS)-F059"
"from_node": "east fused spans in Morlaix",
"to_node": "fiber (Morlaix Lannion_CAS)-F059"
},
{
"from_node": "roadm Brest_KLA",
"to_node": "fiber (Brest_KLA \u2192 Morlaix)-F060"
"to_node": "fiber (Brest_KLA Morlaix)-F060"
},
{
"from_node": "fiber (Morlaix \u2192 Brest_KLA)-F060",
"from_node": "fiber (Morlaix Brest_KLA)-F060",
"to_node": "roadm Brest_KLA"
},
{
"from_node": "roadm toto",
"to_node": "fiber (toto \u2192 tata)-"
"to_node": "fiber (toto tata)-"
},
{
"from_node": "fiber (tata \u2192 toto)-",
"from_node": "fiber (tata toto)-",
"to_node": "roadm toto"
},
{
"from_node": "roadm tata",
"to_node": "fiber (tata \u2192 toto)-"
"to_node": "fiber (tata toto)-"
},
{
"from_node": "fiber (toto \u2192 tata)-",
"from_node": "fiber (toto tata)-",
"to_node": "roadm tata"
},
{

View File

@@ -19,7 +19,8 @@
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.0012589254117941673
"output-power": 0.0012589254117941673,
"path_bandwidth": 0
}
},
"optimizations": {
@@ -45,7 +46,8 @@
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.0012589254117941673
"output-power": 0.0012589254117941673,
"path_bandwidth": 0
}
},
"optimizations": {
@@ -102,7 +104,8 @@
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.0012589254117941673
"output-power": 0.0012589254117941673,
"path_bandwidth": 0
}
},
"optimizations": {
@@ -128,7 +131,8 @@
],
"spacing": 75000000000.0,
"max-nb-of-channel": 64,
"output-power": 0.0019952623149688794
"output-power": 0.0019952623149688794,
"path_bandwidth": 0
}
},
"optimizations": {
@@ -154,7 +158,8 @@
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.0012589254117941673
"output-power": 0.0012589254117941673,
"path_bandwidth": 0
}
},
"optimizations": {
@@ -178,9 +183,9 @@
}
}
],
"synchronisation": [
"synchronization": [
{
"synchonization-id": "0",
"synchronization-id": "0",
"svec": {
"relaxable": "False",
"link-diverse": "True",
@@ -192,7 +197,7 @@
}
},
{
"synchonization-id": "3",
"synchronization-id": "3",
"svec": {
"relaxable": "False",
"link-diverse": "True",
@@ -204,7 +209,7 @@
}
},
{
"synchonization-id": "5",
"synchronization-id": "5",
"svec": {
"relaxable": "False",
"link-diverse": "True",
@@ -216,4 +221,4 @@
}
}
]
}
}

View File

@@ -0,0 +1,730 @@
{
"elements": [
{
"uid": "trx a",
"metadata": {
"location": {
"city": "a",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Transceiver"
},
{
"uid": "trx b",
"metadata": {
"location": {
"city": "b",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Transceiver"
},
{
"uid": "trx c",
"metadata": {
"location": {
"city": "c",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Transceiver"
},
{
"uid": "trx d",
"metadata": {
"location": {
"city": "d",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Transceiver"
},
{
"uid": "trx e",
"metadata": {
"location": {
"city": "e",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Transceiver"
},
{
"uid": "trx f",
"metadata": {
"location": {
"city": "f",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Transceiver"
},
{
"uid": "trx g",
"metadata": {
"location": {
"city": "g",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Transceiver"
},
{
"uid": "trx h",
"metadata": {
"location": {
"city": "h",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Transceiver"
},
{
"uid": "roadm a",
"metadata": {
"location": {
"city": "a",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Roadm"
},
{
"uid": "roadm b",
"metadata": {
"location": {
"city": "b",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Roadm"
},
{
"uid": "roadm c",
"metadata": {
"location": {
"city": "c",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Roadm"
},
{
"uid": "roadm d",
"metadata": {
"location": {
"city": "d",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Roadm"
},
{
"uid": "roadm e",
"metadata": {
"location": {
"city": "e",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Roadm"
},
{
"uid": "roadm f",
"metadata": {
"location": {
"city": "f",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Roadm"
},
{
"uid": "roadm g",
"metadata": {
"location": {
"city": "g",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Roadm"
},
{
"uid": "roadm h",
"metadata": {
"location": {
"city": "h",
"region": "",
"latitude": 0,
"longitude": 0
}
},
"type": "Roadm"
},
{
"uid": "fiber (a \u2192 b)-",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 30.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (a \u2192 c)-",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 30.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (c \u2192 d)-",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 50.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (c \u2192 f)-",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 60.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (b \u2192 f)-",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 70.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (e \u2192 d)-",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 80.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (e \u2192 g)-",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 90.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (f \u2192 h)-",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 100.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (h \u2192 g)-",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 110.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (b \u2192 a)-F061",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 30.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (c \u2192 a)-F010",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 30.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (d \u2192 c)-F054",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 50.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (f \u2192 c)-F055",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 60.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (f \u2192 b)-F056",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 70.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (d \u2192 e)-F057",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 80.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (g \u2192 e)-F059",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 90.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (h \u2192 f)-F060",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 100.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
},
{
"uid": "fiber (g \u2192 h)-",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 110.0,
"length_units": "km",
"loss_coef": 0.2,
"con_in": null,
"con_out": null
}
}
],
"connections": [
{
"from_node": "roadm a",
"to_node": "fiber (a \u2192 b)-"
},
{
"from_node": "fiber (b \u2192 a)-F061",
"to_node": "roadm a"
},
{
"from_node": "roadm a",
"to_node": "fiber (a \u2192 c)-"
},
{
"from_node": "fiber (c \u2192 a)-F010",
"to_node": "roadm a"
},
{
"from_node": "roadm b",
"to_node": "fiber (b \u2192 a)-F061"
},
{
"from_node": "fiber (a \u2192 b)-",
"to_node": "roadm b"
},
{
"from_node": "roadm b",
"to_node": "fiber (b \u2192 f)-"
},
{
"from_node": "fiber (f \u2192 b)-F056",
"to_node": "roadm b"
},
{
"from_node": "roadm c",
"to_node": "fiber (c \u2192 a)-F010"
},
{
"from_node": "fiber (a \u2192 c)-",
"to_node": "roadm c"
},
{
"from_node": "roadm c",
"to_node": "fiber (c \u2192 d)-"
},
{
"from_node": "fiber (d \u2192 c)-F054",
"to_node": "roadm c"
},
{
"from_node": "roadm c",
"to_node": "fiber (c \u2192 f)-"
},
{
"from_node": "fiber (f \u2192 c)-F055",
"to_node": "roadm c"
},
{
"from_node": "roadm d",
"to_node": "fiber (d \u2192 c)-F054"
},
{
"from_node": "fiber (c \u2192 d)-",
"to_node": "roadm d"
},
{
"from_node": "roadm d",
"to_node": "fiber (d \u2192 e)-F057"
},
{
"from_node": "fiber (e \u2192 d)-",
"to_node": "roadm d"
},
{
"from_node": "roadm e",
"to_node": "fiber (e \u2192 d)-"
},
{
"from_node": "fiber (d \u2192 e)-F057",
"to_node": "roadm e"
},
{
"from_node": "roadm e",
"to_node": "fiber (e \u2192 g)-"
},
{
"from_node": "fiber (g \u2192 e)-F059",
"to_node": "roadm e"
},
{
"from_node": "roadm f",
"to_node": "fiber (f \u2192 c)-F055"
},
{
"from_node": "fiber (c \u2192 f)-",
"to_node": "roadm f"
},
{
"from_node": "roadm f",
"to_node": "fiber (f \u2192 b)-F056"
},
{
"from_node": "fiber (b \u2192 f)-",
"to_node": "roadm f"
},
{
"from_node": "roadm f",
"to_node": "fiber (f \u2192 h)-"
},
{
"from_node": "fiber (h \u2192 f)-F060",
"to_node": "roadm f"
},
{
"from_node": "roadm g",
"to_node": "fiber (g \u2192 e)-F059"
},
{
"from_node": "fiber (e \u2192 g)-",
"to_node": "roadm g"
},
{
"from_node": "roadm g",
"to_node": "fiber (g \u2192 h)-"
},
{
"from_node": "fiber (h \u2192 g)-",
"to_node": "roadm g"
},
{
"from_node": "roadm h",
"to_node": "fiber (h \u2192 f)-F060"
},
{
"from_node": "fiber (f \u2192 h)-",
"to_node": "roadm h"
},
{
"from_node": "roadm h",
"to_node": "fiber (h \u2192 g)-"
},
{
"from_node": "fiber (g \u2192 h)-",
"to_node": "roadm h"
},
{
"from_node": "trx a",
"to_node": "roadm a"
},
{
"from_node": "roadm a",
"to_node": "trx a"
},
{
"from_node": "trx b",
"to_node": "roadm b"
},
{
"from_node": "roadm b",
"to_node": "trx b"
},
{
"from_node": "trx c",
"to_node": "roadm c"
},
{
"from_node": "roadm c",
"to_node": "trx c"
},
{
"from_node": "trx d",
"to_node": "roadm d"
},
{
"from_node": "roadm d",
"to_node": "trx d"
},
{
"from_node": "trx e",
"to_node": "roadm e"
},
{
"from_node": "roadm e",
"to_node": "trx e"
},
{
"from_node": "trx f",
"to_node": "roadm f"
},
{
"from_node": "roadm f",
"to_node": "trx f"
},
{
"from_node": "trx g",
"to_node": "roadm g"
},
{
"from_node": "roadm g",
"to_node": "trx g"
},
{
"from_node": "trx h",
"to_node": "roadm h"
},
{
"from_node": "roadm h",
"to_node": "trx h"
}
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,692 @@
{
"path-request": [
{
"request-id": "1",
"source": "a",
"destination": "g",
"src-tp-id": "trx a",
"dst-tp-id": "trx g",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager_16QAM",
"trx_mode": "16QAM",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.001,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "2a",
"source": "a",
"destination": "h",
"src-tp-id": "trx a",
"dst-tp-id": "trx h",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "vendorA_trx-type1",
"trx_mode": "PS_SP64_1",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.001,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "3",
"source": "f",
"destination": "b",
"src-tp-id": "trx f",
"dst-tp-id": "trx b",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "vendorA_trx-type1",
"trx_mode": "PS_SP64_1",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.001,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "ee",
"source": "c",
"destination": "f",
"src-tp-id": "trx c",
"dst-tp-id": "trx f",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "vendorA_trx-type1",
"trx_mode": "PS_SP64_1",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.001,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": [
{
"index": 0,
"unnumbered-hop": {
"node-id": "roadm e",
"link-tp-id": "link-tp-id is not used",
"hop-type": "loose",
"direction": "direction is not used"
},
"label-hop": {
"te-label": {
"generic": "generic is not used",
"direction": "direction is not used"
}
}
},
{
"index": 1,
"unnumbered-hop": {
"node-id": "roadm g",
"link-tp-id": "link-tp-id is not used",
"hop-type": "loose",
"direction": "direction is not used"
},
"label-hop": {
"te-label": {
"generic": "generic is not used",
"direction": "direction is not used"
}
}
}
]
}
},
{
"request-id": "ff",
"source": "c",
"destination": "f",
"src-tp-id": "trx c",
"dst-tp-id": "trx f",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager",
"trx_mode": "mode 2 - fake",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 75000000000.0,
"max-nb-of-channel": 63,
"output-power": 0.001,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "10",
"source": "a",
"destination": "g",
"src-tp-id": "trx a",
"dst-tp-id": "trx g",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager",
"trx_mode": "mode 2",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 75000000000.0,
"max-nb-of-channel": 63,
"output-power": 0.001,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "11",
"source": "a",
"destination": "h",
"src-tp-id": "trx a",
"dst-tp-id": "trx h",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "vendorA_trx-type1",
"trx_mode": "PS_SP64_1",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.001,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": [
{
"index": 0,
"unnumbered-hop": {
"node-id": "bb",
"link-tp-id": "link-tp-id is not used",
"hop-type": "loose",
"direction": "direction is not used"
},
"label-hop": {
"te-label": {
"generic": "generic is not used",
"direction": "direction is not used"
}
}
}
]
}
},
{
"request-id": "12",
"source": "f",
"destination": "b",
"src-tp-id": "trx f",
"dst-tp-id": "trx b",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager",
"trx_mode": "mode 3",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 62500000000.0,
"max-nb-of-channel": 76,
"output-power": 0.001,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": [
{
"index": 0,
"unnumbered-hop": {
"node-id": "trx b",
"link-tp-id": "link-tp-id is not used",
"hop-type": "loose",
"direction": "direction is not used"
},
"label-hop": {
"te-label": {
"generic": "generic is not used",
"direction": "direction is not used"
}
}
}
]
}
},
{
"request-id": "13",
"source": "c",
"destination": "f",
"src-tp-id": "trx c",
"dst-tp-id": "trx f",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "vendorA_trx-type1",
"trx_mode": "PS_SP64_1",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.001,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "14",
"source": "c",
"destination": "f",
"src-tp-id": "trx c",
"dst-tp-id": "trx f",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "vendorA_trx-type1",
"trx_mode": "PS_SP64_1",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.001,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": [
{
"index": 0,
"unnumbered-hop": {
"node-id": "roadm e",
"link-tp-id": "link-tp-id is not used",
"hop-type": "loose",
"direction": "direction is not used"
},
"label-hop": {
"te-label": {
"generic": "generic is not used",
"direction": "direction is not used"
}
}
},
{
"index": 1,
"unnumbered-hop": {
"node-id": "roadm g",
"link-tp-id": "link-tp-id is not used",
"hop-type": "loose",
"direction": "direction is not used"
},
"label-hop": {
"te-label": {
"generic": "generic is not used",
"direction": "direction is not used"
}
}
}
]
}
},
{
"request-id": "e:1# /",
"source": "a",
"destination": "g",
"src-tp-id": "trx a",
"dst-tp-id": "trx g",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager_16QAM",
"trx_mode": "16QAM",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": null,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "b-2a",
"source": "a",
"destination": "h",
"src-tp-id": "trx a",
"dst-tp-id": "trx h",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager",
"trx_mode": "mode 1",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": null,
"output-power": 0.001,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "3a;?",
"source": "f",
"destination": "b",
"src-tp-id": "trx f",
"dst-tp-id": "trx b",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "vendorA_trx-type1",
"trx_mode": "PS_SP64_1",
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": null,
"output-power": null,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "ee-s",
"source": "c",
"destination": "f",
"src-tp-id": "trx c",
"dst-tp-id": "trx f",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "vendorA_trx-type1",
"trx_mode": null,
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": 80,
"output-power": 0.001,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": [
{
"index": 0,
"unnumbered-hop": {
"node-id": "roadm e",
"link-tp-id": "link-tp-id is not used",
"hop-type": "loose",
"direction": "direction is not used"
},
"label-hop": {
"te-label": {
"generic": "generic is not used",
"direction": "direction is not used"
}
}
},
{
"index": 1,
"unnumbered-hop": {
"node-id": "roadm g",
"link-tp-id": "link-tp-id is not used",
"hop-type": "loose",
"direction": "direction is not used"
},
"label-hop": {
"te-label": {
"generic": "generic is not used",
"direction": "direction is not used"
}
}
}
]
}
},
{
"request-id": "ff-b",
"source": "c",
"destination": "f",
"src-tp-id": "trx c",
"dst-tp-id": "trx f",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager",
"trx_mode": null,
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": null,
"output-power": 0.001,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "10-z",
"source": "a",
"destination": "g",
"src-tp-id": "trx a",
"dst-tp-id": "trx g",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager",
"trx_mode": null,
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 75000000000.0,
"max-nb-of-channel": 63,
"output-power": null,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "11 g",
"source": "a",
"destination": "h",
"src-tp-id": "trx a",
"dst-tp-id": "trx h",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager",
"trx_mode": null,
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 50000000000.0,
"max-nb-of-channel": null,
"output-power": null,
"path_bandwidth": 300000000000.0
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "12<",
"source": "f",
"destination": "b",
"src-tp-id": "trx f",
"dst-tp-id": "trx b",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager",
"trx_mode": null,
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 75000000000.0,
"max-nb-of-channel": null,
"output-power": null,
"path_bandwidth": null
}
},
"optimizations": {
"explicit-route-include-objects": []
}
},
{
"request-id": "12>",
"source": "f",
"destination": "b",
"src-tp-id": "trx f",
"dst-tp-id": "trx b",
"path-constraints": {
"te-bandwidth": {
"technology": "flexi-grid",
"trx_type": "Voyager",
"trx_mode": null,
"effective-freq-slot": [
{
"n": "null",
"m": "null"
}
],
"spacing": 30000000000.0,
"max-nb-of-channel": null,
"output-power": null,
"path_bandwidth": null
}
},
"optimizations": {
"explicit-route-include-objects": []
}
}
],
"synchronization": [
{
"synchronization-id": "1",
"svec": {
"relaxable": "False",
"link-diverse": "True",
"node-diverse": "True",
"request-id-number": [
"1",
"2a"
]
}
},
{
"synchronization-id": "3",
"svec": {
"relaxable": "False",
"link-diverse": "True",
"node-diverse": "True",
"request-id-number": [
"3",
"1"
]
}
},
{
"synchronization-id": "ff",
"svec": {
"relaxable": "False",
"link-diverse": "True",
"node-diverse": "True",
"request-id-number": [
"ff",
"13"
]
}
},
{
"synchronization-id": "13",
"svec": {
"relaxable": "False",
"link-diverse": "True",
"node-diverse": "True",
"request-id-number": [
"13",
"14"
]
}
}
]
}

View File

@@ -5,11 +5,11 @@
from gnpy.core.elements import Edfa
from numpy import zeros, array
from json import load, dumps
from json import load
from gnpy.core.elements import Transceiver, Fiber, Edfa
from gnpy.core.utils import lin2db, db2lin
from gnpy.core.info import create_input_spectral_information, SpectralInformation, Channel, Power, Pref
from gnpy.core.equipment import load_equipment
from gnpy.core.equipment import load_equipment, automatic_fmax
from gnpy.core.network import build_network, load_network, set_roadm_loss
from pathlib import Path
import pytest
@@ -66,7 +66,9 @@ def setup_trx():
def si(nch_and_spacing, bw):
"""parametrize a channel comb with nb_channel, spacing and signal bw"""
nb_channel, spacing = nch_and_spacing
return create_input_spectral_information(191.3e12, 0.15, bw, 1e-3, spacing, nb_channel)
f_min = 191.3e12
f_max = automatic_fmax(f_min, spacing, nb_channel)
return create_input_spectral_information(f_min, f_max, 0.15, bw, 1e-3, spacing)
@pytest.mark.parametrize("gain, nf_expected", [(10, 15), (15, 10), (25, 5.8)])
def test_variable_gain_nf(gain, nf_expected, setup_edfa_variable_gain, si):

View File

@@ -0,0 +1,88 @@
#!/usr/bin/env python3
# TelecomInfraProject/gnpy/examples
# Module name : test_automaticmodefeature.py
# Version :
# License : BSD 3-Clause Licence
# Copyright (c) 2018, Telecom Infra Project
"""
@author: esther.lerouzic
checks that empty info on mode, power, nbchannel in service file are supported
uses combination of [mode, pow, nb channel] filled or empty defined in meshTopologyToy_services.json
leading to feasible path or not, and check the propagate and propagate_and_optimize_mode
return the expected based on a reference toy example
"""
from pathlib import Path
import pytest
from gnpy.core.equipment import load_equipment, trx_mode_params, automatic_nch
from gnpy.core.network import load_network, build_network
from examples.path_requests_run import (requests_from_json , correct_route_list ,
load_requests , disjunctions_from_json)
from gnpy.core.request import (compute_path_dsjctn, isdisjoint , find_reversed_path,
propagate,propagate_and_optimize_mode)
from gnpy.core.utils import db2lin, lin2db
from gnpy.core.elements import Roadm
network_file_name = Path(__file__).parent.parent / 'tests/data/meshTopologyToy.json'
service_file_name = Path(__file__).parent.parent / 'tests/data/meshTopologyToy_services.json'
result_file_name = Path(__file__).parent.parent / 'tests/data/meshTopologyToy_results.json'
eqpt_library_name = Path(__file__).parent.parent / 'tests/data/eqpt_config.json'
@pytest.mark.parametrize("net",[network_file_name])
@pytest.mark.parametrize("eqpt", [eqpt_library_name])
@pytest.mark.parametrize("serv",[service_file_name])
@pytest.mark.parametrize("expected_mode",[['16QAM', 'PS_SP64_1', 'PS_SP64_1', 'PS_SP64_1', 'mode 2 - fake', 'mode 2', 'PS_SP64_1', 'mode 3', 'PS_SP64_1', 'PS_SP64_1', '16QAM', 'mode 1', 'PS_SP64_1', 'PS_SP64_1', 'mode 1', 'mode 2', 'mode 1', 'mode 2', 'nok']])
def test_automaticmodefeature(net,eqpt,serv,expected_mode):
data = load_requests(serv,eqpt)
equipment = load_equipment(eqpt)
network = load_network(net,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
# spacing, f_min and f_max
p_db = equipment['SI']['default'].power_dbm
p_total_db = p_db + lin2db(automatic_nch(equipment['SI']['default'].f_min,\
equipment['SI']['default'].f_max, equipment['SI']['default'].spacing))
build_network(network, equipment, p_db, p_total_db)
rqs = requests_from_json(data, equipment)
rqs = correct_route_list(network, rqs)
dsjn = []
pths = compute_path_dsjctn(network, equipment, rqs, dsjn)
path_res_list = []
for i,pathreq in enumerate(rqs):
# use the power specified in requests but might be different from the one specified for design
# the power is an optional parameter for requests definition
# if optional, use the one defines in eqt_config.json
p_db = lin2db(pathreq.power*1e3)
p_total_db = p_db + lin2db(pathreq.nb_channel)
print(f'request {pathreq.request_id}')
print(f'Computing path from {pathreq.source} to {pathreq.destination}')
print(f'with path constraint: {[pathreq.source]+pathreq.nodes_list}') #adding first node to be clearer on the output
total_path = pths[i]
print(f'Computed path (roadms):{[e.uid for e in total_path if isinstance(e, Roadm)]}\n')
# for debug
# print(f'{pathreq.baud_rate} {pathreq.power} {pathreq.spacing} {pathreq.nb_channel}')
if pathreq.baud_rate is not None:
print(pathreq.format)
path_res_list.append(pathreq.format)
total_path = propagate(total_path,pathreq,equipment, show=False)
else:
total_path,mode = propagate_and_optimize_mode(total_path,pathreq,equipment)
# if no baudrate satisfies spacing, no mode is returned and an empty path is returned
# a warning is shown in the propagate_and_optimize_mode
if mode is not None :
print (mode['format'])
path_res_list.append(mode['format'])
else :
print('nok')
path_res_list.append('nok')
print(path_res_list)
assert path_res_list==expected_mode

107
tests/test_disjunction.py Normal file
View File

@@ -0,0 +1,107 @@
#!/usr/bin/env python3
# TelecomInfraProject/gnpy/examples
# Module name : test_disjunction.py
# Version :
# License : BSD 3-Clause Licence
# Copyright (c) 2018, Telecom Infra Project
"""
@author: esther.lerouzic
checks that computed paths are disjoint as specified in the json service file
"""
from pathlib import Path
import pytest
from gnpy.core.equipment import load_equipment, trx_mode_params, automatic_nch
from gnpy.core.network import load_network, build_network
from examples.path_requests_run import (requests_from_json , correct_route_list ,
load_requests , disjunctions_from_json)
from gnpy.core.request import compute_path_dsjctn, isdisjoint , find_reversed_path
from gnpy.core.utils import db2lin, lin2db
from gnpy.core.elements import Roadm
network_file_name = Path(__file__).parent.parent / 'tests/data/meshTopologyToy.json'
service_file_name = Path(__file__).parent.parent / 'tests/data/meshTopologyToy_services.json'
result_file_name = Path(__file__).parent.parent / 'tests/data/meshTopologyToy_results.json'
eqpt_library_name = Path(__file__).parent.parent / 'tests/data/eqpt_config.json'
@pytest.mark.parametrize("net",[network_file_name])
@pytest.mark.parametrize("eqpt", [eqpt_library_name])
@pytest.mark.parametrize("serv",[service_file_name])
def test_disjunction(net,eqpt,serv):
data = load_requests(serv,eqpt)
equipment = load_equipment(eqpt)
network = load_network(net,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
# spacing, f_min and f_max
p_db = equipment['SI']['default'].power_dbm
p_total_db = p_db + lin2db(automatic_nch(equipment['SI']['default'].f_min,\
equipment['SI']['default'].f_max, equipment['SI']['default'].spacing))
build_network(network, equipment, p_db, p_total_db)
rqs = requests_from_json(data, equipment)
rqs = correct_route_list(network, rqs)
dsjn = disjunctions_from_json(data)
pths = compute_path_dsjctn(network, equipment, rqs, dsjn)
print(dsjn)
dsjn_list = [d.disjunctions_req for d in dsjn ]
# assumes only pairs in dsjn list
test = True
for e in dsjn_list:
rqs_id_list = [r.request_id for r in rqs]
p1 = pths[rqs_id_list.index(e[0])][1:-1]
p2 = pths[rqs_id_list.index(e[1])][1:-1]
if isdisjoint(p1,p2) + isdisjoint(p1,find_reversed_path(p2, network)) > 0:
test = False
print(f'Computed path (roadms):{[e.uid for e in p1 if isinstance(e, Roadm)]}\n')
print(f'Computed path (roadms):{[e.uid for e in p2 if isinstance(e, Roadm)]}\n')
break
print(dsjn_list)
assert test
@pytest.mark.parametrize("net",[network_file_name])
@pytest.mark.parametrize("eqpt", [eqpt_library_name])
@pytest.mark.parametrize("serv",[service_file_name])
def test_does_not_loop_back(net,eqpt,serv):
data = load_requests(serv,eqpt)
equipment = load_equipment(eqpt)
network = load_network(net,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
# spacing, f_min and f_max
p_db = equipment['SI']['default'].power_dbm
p_total_db = p_db + lin2db(automatic_nch(equipment['SI']['default'].f_min,\
equipment['SI']['default'].f_max, equipment['SI']['default'].spacing))
build_network(network, equipment, p_db, p_total_db)
rqs = requests_from_json(data, equipment)
rqs = correct_route_list(network, rqs)
dsjn = disjunctions_from_json(data)
pths = compute_path_dsjctn(network, equipment, rqs, dsjn)
# check that computed paths do not loop back ie each element appears only once
test = True
for p in pths :
for el in p:
p.remove(el)
a = [e for e in p if e.uid == el.uid]
if a :
test = False
break
assert test
# TODO : test that identical requests are correctly agregated
# and reproduce disjunction vector as well as route constraints
# check that requests with different parameters are not aggregated
# check that the total agregated bandwidth is the same after aggregation
#

View File

@@ -37,11 +37,11 @@ def test_excel_json_generation(xls_input, expected_json_output):
convert_file(xls_input)
actual_json_output = xls_input.with_suffix('.json')
with open(actual_json_output) as f:
with open(actual_json_output, encoding='utf-8') as f:
actual = load(f)
unlink(actual_json_output)
#unlink(actual_json_output)
with open(expected_json_output) as f:
with open(expected_json_output, encoding='utf-8') as f:
expected = load(f)
results = compare_networks(expected, actual)
@@ -65,11 +65,11 @@ def test_excel_service_json_generation(xls_input, expected_json_output):
convert_service_sheet(xls_input, eqpt_filename)
actual_json_output = f'{str(xls_input)[:-4]}_services.json'
with open(actual_json_output) as f:
with open(actual_json_output, encoding='utf-8') as f:
actual = load(f)
unlink(actual_json_output)
with open(expected_json_output) as f:
with open(expected_json_output, encoding='utf-8') as f:
expected = load(f)
results = compare_services(expected, actual)

View File

@@ -5,7 +5,7 @@
from gnpy.core.elements import Edfa
import numpy as np
from json import load, dumps
from json import load
import pytest
from gnpy.core.elements import Transceiver, Fiber, Edfa
from gnpy.core.utils import lin2db, db2lin