diff --git a/docs/gnpy-api-core.rst b/docs/gnpy-api-core.rst index 3866e276..671248a1 100644 --- a/docs/gnpy-api-core.rst +++ b/docs/gnpy-api-core.rst @@ -11,7 +11,6 @@ .. automodule:: gnpy.core.network .. automodule:: gnpy.core.node .. automodule:: gnpy.core.parameters -.. automodule:: gnpy.core.request .. automodule:: gnpy.core.science_utils .. automodule:: gnpy.core.service_sheet .. automodule:: gnpy.core.spectrum_assignment diff --git a/docs/gnpy-api-topology.rst b/docs/gnpy-api-topology.rst new file mode 100644 index 00000000..25a8d7d8 --- /dev/null +++ b/docs/gnpy-api-topology.rst @@ -0,0 +1,5 @@ +``gnpy.topology`` +----------------- + +.. automodule:: gnpy.topology +.. automodule:: gnpy.topology.request diff --git a/docs/gnpy-api.rst b/docs/gnpy-api.rst index 666b587a..38123b87 100644 --- a/docs/gnpy-api.rst +++ b/docs/gnpy-api.rst @@ -10,4 +10,5 @@ API Reference Documentation .. toctree:: gnpy-api-core + gnpy-api-topology gnpy-api-tools diff --git a/examples/path_requests_run.py b/examples/path_requests_run.py index 7406251f..e233fe91 100755 --- a/examples/path_requests_run.py +++ b/examples/path_requests_run.py @@ -25,15 +25,15 @@ from gnpy.core.network import load_network, build_network, save_network from gnpy.core.equipment import load_equipment, trx_mode_params, automatic_nch from gnpy.core.elements import Roadm from gnpy.core.utils import db2lin, lin2db -from gnpy.core.request import (PathRequest, ResultElement, - propagate, jsontocsv, Disjunction, compute_path_dsjctn, - requests_aggregation, propagate_and_optimize_mode, - BLOCKING_NOPATH, BLOCKING_NOMODE, - find_reversed_path, correct_json_route_list) from gnpy.core.exceptions import (ConfigurationError, EquipmentConfigError, NetworkTopologyError, ServiceError, DisjunctionError) import gnpy.core.ansi_escapes as ansi_escapes from gnpy.core.spectrum_assignment import (build_oms_list, pth_assign_spectrum) +from gnpy.topology.request import (PathRequest, ResultElement, + propagate, jsontocsv, Disjunction, compute_path_dsjctn, + requests_aggregation, propagate_and_optimize_mode, + BLOCKING_NOPATH, BLOCKING_NOMODE, + find_reversed_path, correct_json_route_list) from copy import copy, deepcopy from textwrap import dedent from math import ceil diff --git a/examples/transmission_main_example.py b/examples/transmission_main_example.py index d7e23580..f6f00908 100755 --- a/examples/transmission_main_example.py +++ b/examples/transmission_main_example.py @@ -25,12 +25,12 @@ from networkx import (draw_networkx_nodes, draw_networkx_edges, from gnpy.core.network import load_network, build_network, save_network from gnpy.core.elements import Transceiver, Fiber, RamanFiber, Edfa, Roadm from gnpy.core.info import create_input_spectral_information, SpectralInformation, Channel, Power, Pref -from gnpy.core.request import PathRequest, compute_constrained_path, propagate2 from gnpy.core.exceptions import ConfigurationError, EquipmentConfigError, NetworkTopologyError from gnpy.core.parameters import SimParams from gnpy.core.science_utils import Simulation from gnpy.core.utils import load_json import gnpy.core.ansi_escapes as ansi_escapes +from gnpy.topology.request import PathRequest, compute_constrained_path, propagate2 logger = getLogger(__name__) diff --git a/examples/write_path_jsontocsv.py b/examples/write_path_jsontocsv.py index b7b50dd2..269c4950 100644 --- a/examples/write_path_jsontocsv.py +++ b/examples/write_path_jsontocsv.py @@ -14,8 +14,8 @@ See: draft-ietf-teas-yang-path-computation-01.txt from argparse import ArgumentParser from pathlib import Path from json import loads -from gnpy.core.equipment import load_equipment -from gnpy.core.request import jsontocsv +from gnpy.core.equipment import load_equipment +from gnpy.topology.request import jsontocsv parser = ArgumentParser(description = 'A function that writes json path results in an excel sheet.') diff --git a/gnpy/core/request.py b/gnpy/topology/request.py similarity index 99% rename from gnpy/core/request.py rename to gnpy/topology/request.py index 49b994cd..f7fac917 100644 --- a/gnpy/core/request.py +++ b/gnpy/topology/request.py @@ -2,8 +2,8 @@ # -*- coding: utf-8 -*- """ -gnpy.core.request -================= +gnpy.topology.request +===================== This module contains path request functionality. diff --git a/tests/test_automaticmodefeature.py b/tests/test_automaticmodefeature.py index 93aa8021..5e5ad922 100644 --- a/tests/test_automaticmodefeature.py +++ b/tests/test_automaticmodefeature.py @@ -19,9 +19,9 @@ import pytest from gnpy.core.equipment import load_equipment, trx_mode_params, automatic_nch from gnpy.core.network import load_network, build_network from examples.path_requests_run import requests_from_json, correct_json_route_list, load_requests -from gnpy.core.request import compute_path_dsjctn, propagate, propagate_and_optimize_mode from gnpy.core.utils import db2lin, lin2db from gnpy.core.elements import Roadm +from gnpy.topology.request import compute_path_dsjctn, propagate, propagate_and_optimize_mode network_file_name = Path(__file__).parent.parent / 'tests/data/testTopology_expected.json' service_file_name = Path(__file__).parent.parent / 'tests/data/testTopology_testservices.json' @@ -41,7 +41,7 @@ def test_automaticmodefeature(net,eqpt,serv,expected_mode): # power density : db2linp(ower_dbm": 0)/power_dbm": 0 * nb channels as defined by # spacing, f_min and f_max p_db = equipment['SI']['default'].power_dbm - + p_total_db = p_db + lin2db(automatic_nch(equipment['SI']['default'].f_min,\ equipment['SI']['default'].f_max, equipment['SI']['default'].spacing)) build_network(network, equipment, p_db, p_total_db) diff --git a/tests/test_disjunction.py b/tests/test_disjunction.py index d87f56cc..59ab829a 100644 --- a/tests/test_disjunction.py +++ b/tests/test_disjunction.py @@ -18,11 +18,11 @@ from gnpy.core.equipment import load_equipment, trx_mode_params, automatic_nch from gnpy.core.network import load_network, build_network from gnpy.core.exceptions import ServiceError from examples.path_requests_run import (requests_from_json, load_requests, disjunctions_from_json) -from gnpy.core.request import (compute_path_dsjctn, isdisjoint, find_reversed_path, PathRequest, - correct_json_route_list) from gnpy.core.utils import lin2db from gnpy.core.elements import Roadm from gnpy.core.spectrum_assignment import build_oms_list +from gnpy.topology.request import (compute_path_dsjctn, isdisjoint, find_reversed_path, PathRequest, + correct_json_route_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' diff --git a/tests/test_parser.py b/tests/test_parser.py index 50c31b5f..3a297ce1 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -27,10 +27,10 @@ from gnpy.core.network import save_network, build_network from gnpy.core.service_sheet import convert_service_sheet, correct_xls_route_list from gnpy.core.equipment import load_equipment, automatic_nch from gnpy.core.network import load_network -from gnpy.core.request import (jsontocsv, requests_aggregation, compute_path_dsjctn, - ResultElement, PathRequest) from gnpy.core.spectrum_assignment import build_oms_list, pth_assign_spectrum from gnpy.core.exceptions import ServiceError +from gnpy.topology.request import (jsontocsv, requests_aggregation, compute_path_dsjctn, + ResultElement, PathRequest) from gnpy.tools.convert import convert_file from examples.path_requests_run import (requests_from_json, disjunctions_from_json, correct_disjn, compute_path_with_disjunction) diff --git a/tests/test_spectrum_assignment.py b/tests/test_spectrum_assignment.py index f820ef22..969b35bb 100644 --- a/tests/test_spectrum_assignment.py +++ b/tests/test_spectrum_assignment.py @@ -22,7 +22,7 @@ from gnpy.core.elements import Roadm, Transceiver from gnpy.core.spectrum_assignment import (build_oms_list, align_grids, nvalue_to_frequency, bitmap_sum, Bitmap, spectrum_selection, pth_assign_spectrum) from gnpy.core.exceptions import SpectrumError -from gnpy.core.request import compute_path_dsjctn, find_reversed_path +from gnpy.topology.request import compute_path_dsjctn, find_reversed_path from examples.path_requests_run import requests_from_json, disjunctions_from_json, correct_disjn TEST_DIR = Path(__file__).parent