Files
oopt-gnpy/tests/test_network_functions.py
EstherLerouzic 87211b35e9 Use design delta_p and gains instead of p_spani
Remove the visualisation of the effective_pch in amp because actual
and target are the relevant ones. effective_pch was artificially
related to a mix of reference channel and noisy channel (mixed between
on the fly redesign but using actual ROADM equalisation which includes noise
in its actual loss).

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

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

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

This commit also adds this estimation.

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: I960b85e99f85a7d168ac5349e325c4928fa5673b
2023-11-20 17:07:46 +01:00

65 lines
1.8 KiB
Python

# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright (C) 2020 Telecom Infra Project and GNPy contributors
# see LICENSE.md for a list of contributors
#
from pathlib import Path
import pytest
from gnpy.core.exceptions import NetworkTopologyError
from gnpy.core.network import span_loss
from gnpy.tools.json_io import load_equipment, load_network
TEST_DIR = Path(__file__).parent
EQPT_FILENAME = TEST_DIR / 'data/eqpt_config.json'
NETWORK_FILENAME = TEST_DIR / 'data/bugfixiteratortopo.json'
@pytest.mark.parametrize("node, attenuation", [
# first fiber span
['fiber1', 10.5],
['fiber2', 10.5],
['fused1', 10.5],
# second span
['fiber3', 16.0],
# third span
['fiber4', 16.0],
# direct link between a ROADM and an amplifier
['fused5', 0],
# fourth span
['fiber6', 17],
['fused7', 17],
# fifth span
['fiber7', 0.2],
['fiber8', 12],
# all other nodes
['Site_A', 0],
['nodeA', 0],
['amp2', 0],
['nodeC', 0],
['Site_C', 0],
['amp3', 0],
['amp4', 0],
['nodeB', 0],
['Site_B', 0],
])
def test_span_loss(node, attenuation):
equipment = load_equipment(EQPT_FILENAME)
network = load_network(NETWORK_FILENAME, equipment)
for x in network.nodes():
if x.uid == node:
assert attenuation == span_loss(network, x, equipment)
return
assert not f'node "{node}" referenced from test but not found in the topology' # pragma: no cover
@pytest.mark.parametrize("node", ['fused4'])
def test_span_loss_unconnected(node):
'''Fused node that has no next and no previous nodes should be detected'''
equipment = load_equipment(EQPT_FILENAME)
network = load_network(NETWORK_FILENAME, equipment)
x = next(x for x in network.nodes() if x.uid == node)
with pytest.raises(NetworkTopologyError):
span_loss(network, x, equipment)