mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-11-02 02:57:52 +00:00
Detect unconnected nodes via span generators
Change-Id: I6962b9f193723dc7856b324d5da94d2f46b21c06
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
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
|
||||
|
||||
@@ -29,8 +30,6 @@ NETWORK_FILENAME = TEST_DIR / 'data/bugfixiteratortopo.json'
|
||||
# fourth span
|
||||
['fiber6', 17],
|
||||
['fused7', 17],
|
||||
# not connected anywhere
|
||||
['fused4', 1],
|
||||
# all other nodes
|
||||
['Site_A', 0],
|
||||
['nodeA', 0],
|
||||
@@ -50,3 +49,13 @@ def test_span_loss(node, attenuation):
|
||||
assert attenuation == span_loss(network, x)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user