Merge: merge completed

Path_requests_run and convert_service_sheet.py now use funtions from transmission main

ISSUE from develop refactor : the json generation of the topology is missing all amplifiers !
- ILA are not included
- some edfa appear in the json topo when Eqpt sheet is used, but not all of them (only for
the requested path when running transmission_main_example)

TODO : identify if this is a new behaviour or if this is a regression

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
This commit is contained in:
EstherLerouzic
2018-06-13 16:42:10 +01:00
parent 2ca141baba
commit b93c6dbcbd
6 changed files with 249 additions and 358 deletions

View File

@@ -167,7 +167,7 @@ def convert_file(input_filename, filter_region=[]):
'params': {'length': round(x.west_distance, 3),
'length_units': x.distance_units,
'loss_coef': x.west_lineic}
}
} # missing ILA construction
for x in links] +
[{'uid': f'egress edfa in {e.from_city} to {e.to_city}',
'metadata': {'location': {'city': nodes_by_city[e.from_city].city,

View File

@@ -24,7 +24,7 @@ from collections import namedtuple
from logging import getLogger, basicConfig, CRITICAL, DEBUG, INFO
from json import dumps
from pathlib import Path
from gnpy.core.equipment import get_eqpt_params, eqpt_exists, read_eqpt_library
from examples.transmission_main_example import load_equipment
from gnpy.core.utils import db2lin, lin2db
SERVICES_COLUMN = 11
@@ -60,8 +60,8 @@ class Request_element(Element):
self.dsttpid = f'trx {Request.destination}'
# test that trx_type belongs to eqpt_config.json
# if not replace it with a default
read_eqpt_library(eqpt_filename)
if eqpt_exists(Request.trx_type):
equipment = load_equipment(eqpt_filename)
if equipment['Transceiver'][Request.trx_type]:
self.trx_type = Request.trx_type
self.mode = Request.mode
else:

View File

@@ -6,8 +6,8 @@
"location": {
"city": "Lannion_CAS",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 2.0,
"longitude": 0.0
}
},
"type": "Transceiver"
@@ -18,8 +18,8 @@
"location": {
"city": "Lorient_KMA",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 2.0,
"longitude": 3.0
}
},
"type": "Transceiver"
@@ -30,8 +30,8 @@
"location": {
"city": "Vannes_KBE",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 2.0,
"longitude": 4.0
}
},
"type": "Transceiver"
@@ -42,8 +42,8 @@
"location": {
"city": "Rennes_STA",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Transceiver"
@@ -54,8 +54,32 @@
"location": {
"city": "Brest_KLA",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 4.0,
"longitude": 0.0
}
},
"type": "Transceiver"
},
{
"uid": "trx toto",
"metadata": {
"location": {
"city": "toto",
"region": "",
"latitude": 6.0,
"longitude": 0.0
}
},
"type": "Transceiver"
},
{
"uid": "trx tata",
"metadata": {
"location": {
"city": "tata",
"region": "",
"latitude": 7.0,
"longitude": 0.0
}
},
"type": "Transceiver"
@@ -66,8 +90,8 @@
"location": {
"city": "Lannion_CAS",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 2.0,
"longitude": 0.0
}
},
"type": "Roadm"
@@ -78,8 +102,8 @@
"location": {
"city": "Lorient_KMA",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 2.0,
"longitude": 3.0
}
},
"type": "Roadm"
@@ -90,8 +114,8 @@
"location": {
"city": "Vannes_KBE",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 2.0,
"longitude": 4.0
}
},
"type": "Roadm"
@@ -102,8 +126,8 @@
"location": {
"city": "Rennes_STA",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 0.0,
"longitude": 0.0
}
},
"type": "Roadm"
@@ -114,8 +138,32 @@
"location": {
"city": "Brest_KLA",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 4.0,
"longitude": 0.0
}
},
"type": "Roadm"
},
{
"uid": "roadm toto",
"metadata": {
"location": {
"city": "toto",
"region": "",
"latitude": 6.0,
"longitude": 0.0
}
},
"type": "Roadm"
},
{
"uid": "roadm tata",
"metadata": {
"location": {
"city": "tata",
"region": "",
"latitude": 7.0,
"longitude": 0.0
}
},
"type": "Roadm"
@@ -126,8 +174,8 @@
"location": {
"city": "Corlay",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 2.0,
"longitude": 1.0
}
},
"type": "Fused"
@@ -138,8 +186,8 @@
"location": {
"city": "Loudeac",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 2.0,
"longitude": 2.0
}
},
"type": "Fused"
@@ -150,8 +198,8 @@
"location": {
"city": "Morlaix",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 3.0,
"longitude": 0.0
}
},
"type": "Fused"
@@ -162,8 +210,8 @@
"location": {
"city": "Corlay",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 2.0,
"longitude": 1.0
}
},
"type": "Fused"
@@ -174,8 +222,8 @@
"location": {
"city": "Loudeac",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 2.0,
"longitude": 2.0
}
},
"type": "Fused"
@@ -186,18 +234,18 @@
"location": {
"city": "Morlaix",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 3.0,
"longitude": 0.0
}
},
"type": "Fused"
},
{
"uid": "fiber (Lannion_CAS \u2192 Corlay)-",
"uid": "fiber (Lannion_CAS \u2192 Corlay)-F061",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
"latitude": 2.0,
"longitude": 0.5
}
},
"type": "Fiber",
@@ -209,11 +257,11 @@
}
},
{
"uid": "fiber (Corlay \u2192 Loudeac)-",
"uid": "fiber (Corlay \u2192 Loudeac)-F010",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
"latitude": 2.0,
"longitude": 1.5
}
},
"type": "Fiber",
@@ -225,11 +273,11 @@
}
},
{
"uid": "fiber (Loudeac \u2192 Lorient_KMA)-",
"uid": "fiber (Loudeac \u2192 Lorient_KMA)-F054",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
"latitude": 2.0,
"longitude": 2.5
}
},
"type": "Fiber",
@@ -241,11 +289,11 @@
}
},
{
"uid": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F01",
"uid": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F055",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
"latitude": 2.0,
"longitude": 3.5
}
},
"type": "Fiber",
@@ -257,10 +305,10 @@
}
},
{
"uid": "fiber (Lannion_CAS \u2192 Stbrieuc)-",
"uid": "fiber (Lannion_CAS \u2192 Stbrieuc)-F056",
"metadata": {
"location": {
"latitude": 0.0,
"latitude": 1.5,
"longitude": 0.0
}
},
@@ -273,10 +321,10 @@
}
},
{
"uid": "fiber (Stbrieuc \u2192 Rennes_STA)-",
"uid": "fiber (Stbrieuc \u2192 Rennes_STA)-F057",
"metadata": {
"location": {
"latitude": 0.0,
"latitude": 0.5,
"longitude": 0.0
}
},
@@ -289,10 +337,10 @@
}
},
{
"uid": "fiber (Lannion_CAS \u2192 Morlaix)-",
"uid": "fiber (Lannion_CAS \u2192 Morlaix)-F059",
"metadata": {
"location": {
"latitude": 0.0,
"latitude": 2.5,
"longitude": 0.0
}
},
@@ -305,10 +353,10 @@
}
},
{
"uid": "fiber (Morlaix \u2192 Brest_KLA)-",
"uid": "fiber (Morlaix \u2192 Brest_KLA)-F060",
"metadata": {
"location": {
"latitude": 0.0,
"latitude": 3.5,
"longitude": 0.0
}
},
@@ -321,15 +369,31 @@
}
},
{
"uid": "fiber (Corlay \u2192 Lannion_CAS)-",
"uid": "fiber (toto \u2192 tata)-",
"metadata": {
"location": {
"latitude": 0.0,
"latitude": 6.5,
"longitude": 0.0
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 80.0,
"length_units": "km",
"loss_coef": 0.2
}
},
{
"uid": "fiber (Corlay \u2192 Lannion_CAS)-F061",
"metadata": {
"location": {
"latitude": 2.0,
"longitude": 0.5
}
},
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 20.0,
"length_units": "km",
@@ -337,11 +401,11 @@
}
},
{
"uid": "fiber (Loudeac \u2192 Corlay)-",
"uid": "fiber (Loudeac \u2192 Corlay)-F010",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
"latitude": 2.0,
"longitude": 1.5
}
},
"type": "Fiber",
@@ -353,11 +417,11 @@
}
},
{
"uid": "fiber (Lorient_KMA \u2192 Loudeac)-",
"uid": "fiber (Lorient_KMA \u2192 Loudeac)-F054",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
"latitude": 2.0,
"longitude": 2.5
}
},
"type": "Fiber",
@@ -369,11 +433,11 @@
}
},
{
"uid": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F01",
"uid": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F055",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0
"latitude": 2.0,
"longitude": 3.5
}
},
"type": "Fiber",
@@ -385,10 +449,10 @@
}
},
{
"uid": "fiber (Stbrieuc \u2192 Lannion_CAS)-",
"uid": "fiber (Stbrieuc \u2192 Lannion_CAS)-F056",
"metadata": {
"location": {
"latitude": 0.0,
"latitude": 1.5,
"longitude": 0.0
}
},
@@ -401,10 +465,10 @@
}
},
{
"uid": "fiber (Rennes_STA \u2192 Stbrieuc)-",
"uid": "fiber (Rennes_STA \u2192 Stbrieuc)-F057",
"metadata": {
"location": {
"latitude": 0.0,
"latitude": 0.5,
"longitude": 0.0
}
},
@@ -417,10 +481,10 @@
}
},
{
"uid": "fiber (Morlaix \u2192 Lannion_CAS)-",
"uid": "fiber (Morlaix \u2192 Lannion_CAS)-F059",
"metadata": {
"location": {
"latitude": 0.0,
"latitude": 2.5,
"longitude": 0.0
}
},
@@ -433,10 +497,10 @@
}
},
{
"uid": "fiber (Brest_KLA \u2192 Morlaix)-",
"uid": "fiber (Brest_KLA \u2192 Morlaix)-F060",
"metadata": {
"location": {
"latitude": 0.0,
"latitude": 3.5,
"longitude": 0.0
}
},
@@ -449,350 +513,159 @@
}
},
{
"uid": "egress edfa in Lannion_CAS to Corlay",
"uid": "fiber (tata \u2192 toto)-",
"metadata": {
"location": {
"city": "Lannion_CAS",
"region": "RLD",
"latitude": 0,
"longitude": 0
"latitude": 6.5,
"longitude": 0.0
}
},
"type": "Edfa",
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
}
},
{
"uid": "egress edfa in Loudeac to Lorient_KMA",
"metadata": {
"location": {
"city": "Loudeac",
"region": "RLD",
"latitude": 0,
"longitude": 0
}
},
"type": "Edfa",
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
}
},
{
"uid": "egress edfa in Lorient_KMA to Vannes_KBE",
"metadata": {
"location": {
"city": "Lorient_KMA",
"region": "RLD",
"latitude": 0,
"longitude": 0
}
},
"type": "Edfa",
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
}
},
{
"uid": "egress edfa in Lannion_CAS to Stbrieuc",
"metadata": {
"location": {
"city": "Lannion_CAS",
"region": "RLD",
"latitude": 0,
"longitude": 0
}
},
"type": "Edfa",
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
}
},
{
"uid": "egress edfa in Stbrieuc to Rennes_STA",
"metadata": {
"location": {
"city": "Stbrieuc",
"region": "RLD",
"latitude": 0,
"longitude": 0
}
},
"type": "Edfa",
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
}
},
{
"uid": "egress edfa in Lannion_CAS to Morlaix",
"metadata": {
"location": {
"city": "Lannion_CAS",
"region": "RLD",
"latitude": 0,
"longitude": 0
}
},
"type": "Edfa",
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
}
},
{
"uid": "egress edfa in Morlaix to Brest_KLA",
"metadata": {
"location": {
"city": "Morlaix",
"region": "RLD",
"latitude": 0,
"longitude": 0
}
},
"type": "Edfa",
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
}
},
{
"uid": "egress edfa in Lorient_KMA to Loudeac",
"metadata": {
"location": {
"city": "Lorient_KMA",
"region": "RLD",
"latitude": 0,
"longitude": 0
}
},
"type": "Edfa",
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
}
},
{
"uid": "egress edfa in Vannes_KBE to Lorient_KMA",
"metadata": {
"location": {
"city": "Vannes_KBE",
"region": "RLD",
"latitude": 0,
"longitude": 0
}
},
"type": "Edfa",
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
}
},
{
"uid": "egress edfa in Rennes_STA to Stbrieuc",
"metadata": {
"location": {
"city": "Rennes_STA",
"region": "RLD",
"latitude": 0,
"longitude": 0
}
},
"type": "Edfa",
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
}
},
{
"uid": "egress edfa in Brest_KLA to Morlaix",
"metadata": {
"location": {
"city": "Brest_KLA",
"region": "RLD",
"latitude": 0,
"longitude": 0
}
},
"type": "Edfa",
"type_variety": "test",
"operational": {
"gain_target": 0,
"tilt_target": 0
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 80.0,
"length_units": "km",
"loss_coef": 0.2
}
}
],
"connections": [
{
"from_node": "roadm Lannion_CAS",
"to_node": "egress edfa in Lannion_CAS to Corlay"
"to_node": "fiber (Lannion_CAS \u2192 Corlay)-F061"
},
{
"from_node": "egress edfa in Lannion_CAS to Corlay",
"to_node": "fiber (Lannion_CAS \u2192 Corlay)-"
},
{
"from_node": "fiber (Corlay \u2192 Lannion_CAS)-",
"from_node": "fiber (Corlay \u2192 Lannion_CAS)-F061",
"to_node": "roadm Lannion_CAS"
},
{
"from_node": "roadm Lannion_CAS",
"to_node": "egress edfa in Lannion_CAS to Stbrieuc"
"to_node": "fiber (Lannion_CAS \u2192 Stbrieuc)-F056"
},
{
"from_node": "egress edfa in Lannion_CAS to Stbrieuc",
"to_node": "fiber (Lannion_CAS \u2192 Stbrieuc)-"
},
{
"from_node": "fiber (Stbrieuc \u2192 Lannion_CAS)-",
"from_node": "fiber (Stbrieuc \u2192 Lannion_CAS)-F056",
"to_node": "roadm Lannion_CAS"
},
{
"from_node": "roadm Lannion_CAS",
"to_node": "egress edfa in Lannion_CAS to Morlaix"
"to_node": "fiber (Lannion_CAS \u2192 Morlaix)-F059"
},
{
"from_node": "egress edfa in Lannion_CAS to Morlaix",
"to_node": "fiber (Lannion_CAS \u2192 Morlaix)-"
},
{
"from_node": "fiber (Morlaix \u2192 Lannion_CAS)-",
"from_node": "fiber (Morlaix \u2192 Lannion_CAS)-F059",
"to_node": "roadm Lannion_CAS"
},
{
"from_node": "fiber (Lannion_CAS \u2192 Corlay)-",
"from_node": "fiber (Lannion_CAS \u2192 Corlay)-F061",
"to_node": "ingress fused spans in Corlay"
},
{
"from_node": "ingress fused spans in Corlay",
"to_node": "fiber (Corlay \u2192 Loudeac)-"
"to_node": "fiber (Corlay \u2192 Loudeac)-F010"
},
{
"from_node": "fiber (Loudeac \u2192 Corlay)-",
"from_node": "fiber (Loudeac \u2192 Corlay)-F010",
"to_node": "egress fused spans in Corlay"
},
{
"from_node": "egress fused spans in Corlay",
"to_node": "fiber (Corlay \u2192 Lannion_CAS)-"
"to_node": "fiber (Corlay \u2192 Lannion_CAS)-F061"
},
{
"from_node": "fiber (Corlay \u2192 Loudeac)-",
"from_node": "fiber (Corlay \u2192 Loudeac)-F010",
"to_node": "ingress fused spans in Loudeac"
},
{
"from_node": "ingress fused spans in Loudeac",
"to_node": "fiber (Loudeac \u2192 Lorient_KMA)-"
"to_node": "fiber (Loudeac \u2192 Lorient_KMA)-F054"
},
{
"from_node": "fiber (Lorient_KMA \u2192 Loudeac)-",
"from_node": "fiber (Lorient_KMA \u2192 Loudeac)-F054",
"to_node": "egress fused spans in Loudeac"
},
{
"from_node": "egress fused spans in Loudeac",
"to_node": "fiber (Loudeac \u2192 Corlay)-"
"to_node": "fiber (Loudeac \u2192 Corlay)-F010"
},
{
"from_node": "roadm Lorient_KMA",
"to_node": "egress edfa in Lorient_KMA to Loudeac"
"to_node": "fiber (Lorient_KMA \u2192 Loudeac)-F054"
},
{
"from_node": "egress edfa in Lorient_KMA to Loudeac",
"to_node": "fiber (Lorient_KMA \u2192 Loudeac)-"
},
{
"from_node": "fiber (Loudeac \u2192 Lorient_KMA)-",
"from_node": "fiber (Loudeac \u2192 Lorient_KMA)-F054",
"to_node": "roadm Lorient_KMA"
},
{
"from_node": "roadm Lorient_KMA",
"to_node": "egress edfa in Lorient_KMA to Vannes_KBE"
"to_node": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F055"
},
{
"from_node": "egress edfa in Lorient_KMA to Vannes_KBE",
"to_node": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F01"
},
{
"from_node": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F01",
"from_node": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F055",
"to_node": "roadm Lorient_KMA"
},
{
"from_node": "roadm Vannes_KBE",
"to_node": "egress edfa in Vannes_KBE to Lorient_KMA"
"to_node": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F055"
},
{
"from_node": "egress edfa in Vannes_KBE to Lorient_KMA",
"to_node": "fiber (Vannes_KBE \u2192 Lorient_KMA)-F01"
},
{
"from_node": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F01",
"from_node": "fiber (Lorient_KMA \u2192 Vannes_KBE)-F055",
"to_node": "roadm Vannes_KBE"
},
{
"from_node": "fiber (Lannion_CAS \u2192 Stbrieuc)-",
"to_node": "egress edfa in Stbrieuc to Rennes_STA"
"from_node": "fiber (Lannion_CAS \u2192 Stbrieuc)-F056",
"to_node": "fiber (Stbrieuc \u2192 Rennes_STA)-F057"
},
{
"from_node": "egress edfa in Stbrieuc to Rennes_STA",
"to_node": "fiber (Stbrieuc \u2192 Rennes_STA)-"
},
{
"from_node": "fiber (Rennes_STA \u2192 Stbrieuc)-",
"to_node": "fiber (Stbrieuc \u2192 Lannion_CAS)-"
"from_node": "fiber (Rennes_STA \u2192 Stbrieuc)-F057",
"to_node": "fiber (Stbrieuc \u2192 Lannion_CAS)-F056"
},
{
"from_node": "roadm Rennes_STA",
"to_node": "egress edfa in Rennes_STA to Stbrieuc"
"to_node": "fiber (Rennes_STA \u2192 Stbrieuc)-F057"
},
{
"from_node": "egress edfa in Rennes_STA to Stbrieuc",
"to_node": "fiber (Rennes_STA \u2192 Stbrieuc)-"
},
{
"from_node": "fiber (Stbrieuc \u2192 Rennes_STA)-",
"from_node": "fiber (Stbrieuc \u2192 Rennes_STA)-F057",
"to_node": "roadm Rennes_STA"
},
{
"from_node": "fiber (Lannion_CAS \u2192 Morlaix)-",
"from_node": "fiber (Lannion_CAS \u2192 Morlaix)-F059",
"to_node": "ingress fused spans in Morlaix"
},
{
"from_node": "ingress fused spans in Morlaix",
"to_node": "fiber (Morlaix \u2192 Brest_KLA)-"
"to_node": "fiber (Morlaix \u2192 Brest_KLA)-F060"
},
{
"from_node": "fiber (Brest_KLA \u2192 Morlaix)-",
"from_node": "fiber (Brest_KLA \u2192 Morlaix)-F060",
"to_node": "egress fused spans in Morlaix"
},
{
"from_node": "egress fused spans in Morlaix",
"to_node": "fiber (Morlaix \u2192 Lannion_CAS)-"
"to_node": "fiber (Morlaix \u2192 Lannion_CAS)-F059"
},
{
"from_node": "roadm Brest_KLA",
"to_node": "egress edfa in Brest_KLA to Morlaix"
"to_node": "fiber (Brest_KLA \u2192 Morlaix)-F060"
},
{
"from_node": "egress edfa in Brest_KLA to Morlaix",
"to_node": "fiber (Brest_KLA \u2192 Morlaix)-"
},
{
"from_node": "fiber (Morlaix \u2192 Brest_KLA)-",
"from_node": "fiber (Morlaix \u2192 Brest_KLA)-F060",
"to_node": "roadm Brest_KLA"
},
{
"from_node": "roadm toto",
"to_node": "fiber (toto \u2192 tata)-"
},
{
"from_node": "fiber (tata \u2192 toto)-",
"to_node": "roadm toto"
},
{
"from_node": "roadm tata",
"to_node": "fiber (tata \u2192 toto)-"
},
{
"from_node": "fiber (toto \u2192 tata)-",
"to_node": "roadm tata"
},
{
"from_node": "trx Lannion_CAS",
"to_node": "roadm Lannion_CAS"
@@ -832,6 +705,22 @@
{
"from_node": "roadm Brest_KLA",
"to_node": "trx Brest_KLA"
},
{
"from_node": "trx toto",
"to_node": "roadm toto"
},
{
"from_node": "roadm toto",
"to_node": "trx toto"
},
{
"from_node": "trx tata",
"to_node": "roadm tata"
},
{
"from_node": "roadm tata",
"to_node": "trx tata"
}
]
}

Binary file not shown.

View File

@@ -27,7 +27,7 @@ from numpy import mean
from examples.convert_service_sheet import convert_service_sheet, Request_element, Element
from gnpy.core.utils import load_json
from gnpy.core import network_from_json, build_network
from gnpy.core.equipment import read_eqpt_library
from examples.transmission_main_example import load_equipment, load_network
from examples.convert import convert_file
from gnpy.core.elements import Transceiver, Roadm, Edfa, Fused
from gnpy.core.utils import db2lin, lin2db
@@ -198,37 +198,37 @@ def load_requests(filename,eqpt_filename):
json_data = loads(f.read())
return json_data
def load_network(filename,eqpt_filename):
# to be replaced with the good load_network
# important note: network should be created only once for a given
# simulation. Note that it only generates infrastructure information.
# Only one transceiver element is attached per roadm: it represents the
# logical starting point / stopping point for the propagation of
# the spectral information to be prpagated along a path.
# at that point it is not meant to represent the capacity of add drop ports
# As a result transponder type is not part of the network info. it is related to
# the list of services requests
# def load_network(filename,eqpt_filename):
# # to be replaced with the good load_network
# # important note: network should be created only once for a given
# # simulation. Note that it only generates infrastructure information.
# # Only one transceiver element is attached per roadm: it represents the
# # logical starting point / stopping point for the propagation of
# # the spectral information to be prpagated along a path.
# # at that point it is not meant to represent the capacity of add drop ports
# # As a result transponder type is not part of the network info. it is related to
# # the list of services requests
input_filename = str(filename)
suffix_filename = str(filename.suffixes[0])
split_filename = [input_filename[0:len(input_filename)-len(suffix_filename)] , suffix_filename[1:]]
json_filename = split_filename[0]+'.json'
try:
assert split_filename[1] in ('json','xls','csv','xlsm')
except AssertionError as e:
print(f'invalid file extension .{split_filename[1]}')
raise e
if split_filename[1] != 'json':
print(f'parse excel input to {json_filename}')
convert_file(filename)
# input_filename = str(filename)
# suffix_filename = str(filename.suffixes[0])
# split_filename = [input_filename[0:len(input_filename)-len(suffix_filename)] , suffix_filename[1:]]
# json_filename = split_filename[0]+'.json'
# try:
# assert split_filename[1] in ('json','xls','csv','xlsm')
# except AssertionError as e:
# print(f'invalid file extension .{split_filename[1]}')
# raise e
# if split_filename[1] != 'json':
# print(f'parse excel input to {json_filename}')
# convert_file(filename)
json_data = load_json(json_filename)
read_eqpt_library(eqpt_filename)
#print(json_data)
# json_data = load_json(json_filename)
# read_eqpt_library(eqpt_filename)
# #print(json_data)
network = network_from_json(json_data)
build_network(network)
return network
# network = network_from_json(json_data)
# build_network(network)
# return network
def compute_path(network, pathreqlist):
# temporary : repeats calls from transmission_main_example
@@ -320,7 +320,9 @@ if __name__ == '__main__':
# for debug
# print( args.eqpt_filename)
data = load_requests(args.service_filename,args.eqpt_filename)
network = load_network(args.network_filename,args.eqpt_filename)
equipment = load_equipment(args.eqpt_filename)
network = load_network(args.network_filename,equipment)
build_network(network, equipment=equipment)
pths = requests_from_json(data, args.eqpt_filename)
test = compute_path(network,pths)

View File

@@ -51,13 +51,13 @@ def plot_results(network, path, source, sink):
def load_network(filename, equipment):
json_filename = ''
if args.filename.suffix.lower() == '.xls':
if filename.suffix.lower() == '.xls':
logger.info('Automatically generating topology JSON file')
json_filename = convert_file(args.filename)
elif args.filename.suffix.lower() == '.json':
json_filename = args.filename
json_filename = convert_file(filename)
elif filename.suffix.lower() == '.json':
json_filename = filename
else:
raise ValueError(f'unsuported topology filename extension {args.filename.suffix.lower()}')
raise ValueError(f'unsuported topology filename extension {filename.suffix.lower()}')
json_data = load_json(json_filename)
return network_from_json(json_data, equipment)