mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-11-01 10:38:10 +00:00
small linter fixes
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
"""
|
||||
@author: esther.lerouzic
|
||||
checks that computed paths are disjoint as specified in the json service file
|
||||
that computed paths do not loop
|
||||
that include node constraints are correctly taken into account
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
@@ -18,19 +20,21 @@ from gnpy.core.exceptions import ServiceError
|
||||
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, Path_request
|
||||
from gnpy.core.utils import db2lin, lin2db
|
||||
from gnpy.core.utils import lin2db
|
||||
from gnpy.core.elements import Roadm
|
||||
from gnpy.core.spectrum_assignment import build_oms_list
|
||||
|
||||
network_file_name = Path(__file__).parent.parent / 'tests/data/testTopology_expected.json'
|
||||
service_file_name = Path(__file__).parent.parent / 'tests/data/testTopology_testservices.json'
|
||||
result_file_name = Path(__file__).parent.parent / 'tests/data/testTopology_testresults.json'
|
||||
eqpt_library_name = Path(__file__).parent.parent / 'tests/data/eqpt_config.json'
|
||||
NETWORK_FILE_NAME = Path(__file__).parent.parent / 'tests/data/testTopology_expected.json'
|
||||
SERVICE_FILE_NAME = Path(__file__).parent.parent / 'tests/data/testTopology_testservices.json'
|
||||
RESULT_FILE_NAME = Path(__file__).parent.parent / 'tests/data/testTopology_testresults.json'
|
||||
EQPT_LIBRARY_NAME = Path(__file__).parent.parent / 'tests/data/eqpt_config.json'
|
||||
|
||||
@pytest.fixture()
|
||||
def serv(test_setup):
|
||||
""" common setup for service list
|
||||
"""
|
||||
network, equipment = test_setup
|
||||
data = load_requests(service_file_name, eqpt_library_name, bidir=False)
|
||||
data = load_requests(SERVICE_FILE_NAME, EQPT_LIBRARY_NAME, bidir=False)
|
||||
rqs = requests_from_json(data, equipment)
|
||||
rqs = correct_route_list(network, rqs)
|
||||
dsjn = disjunctions_from_json(data)
|
||||
@@ -40,8 +44,8 @@ def serv(test_setup):
|
||||
def test_setup():
|
||||
""" common setup for tests: builds network, equipment and oms only once
|
||||
"""
|
||||
equipment = load_equipment(eqpt_library_name)
|
||||
network = load_network(network_file_name,equipment)
|
||||
equipment = load_equipment(EQPT_LIBRARY_NAME)
|
||||
network = load_network(NETWORK_FILE_NAME, 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
|
||||
@@ -83,7 +87,6 @@ def test_does_not_loop_back(serv):
|
||||
"""
|
||||
network, equipment, rqs, dsjn = serv
|
||||
pths = compute_path_dsjctn(network, equipment, rqs, dsjn)
|
||||
|
||||
test = True
|
||||
for p in pths:
|
||||
for el in p:
|
||||
@@ -92,19 +95,16 @@ def test_does_not_loop_back(serv):
|
||||
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
|
||||
|
||||
#
|
||||
|
||||
def create_rq(equipment, srce, dest, bdir, nd_list, ls_list):
|
||||
""" co
|
||||
""" create the usual request list according to parameters
|
||||
"""
|
||||
requests_list = []
|
||||
params = {}
|
||||
@@ -158,9 +158,6 @@ def test_include_constraints(test_setup, srce, dest, result, pth, nd_list, ls_li
|
||||
"""
|
||||
network, equipment = test_setup
|
||||
dsjn = []
|
||||
# case 1 wrong source or dest
|
||||
# srce = 'a'
|
||||
# dest = 'trx h'
|
||||
bdir = False
|
||||
rqs = create_rq(equipment, srce, dest, bdir, nd_list, ls_list)
|
||||
print(rqs)
|
||||
|
||||
Reference in New Issue
Block a user