update and pass tests

Signed-off-by: Jean-Luc Auge <jeanluc.auge@orange.com>
This commit is contained in:
Jean-Luc Auge
2019-01-22 19:12:02 +01:00
parent 30234f913c
commit e23fef3f64
4 changed files with 11 additions and 8 deletions

View File

@@ -229,6 +229,9 @@ def automatic_spacing(baud_rate):
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)

View File

@@ -66,7 +66,8 @@
],
"Roadms":[{
"gain_mode_default_loss": 20,
"power_mode_pout_target": -20
"power_mode_pout_target": -20,
"add_drop_osnr": 100
}],
"SI":[{
"f_min": 191.3e12,
@@ -76,11 +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,
"min_spacing": 50e9,
"cost":1
"sys_margins": 0
}],
"Transceiver":[
{

View File

@@ -9,7 +9,7 @@ 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, 100)
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

@@ -74,7 +74,7 @@ def test_automaticmodefeature(net,eqpt,serv,expected_mode):
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, show=False)
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 :