gnpy.tools
¶
Processing of data via json_io
.
Utilities for Excel conversion in convert
and service_sheet
.
Example code in cli_examples
and plots
.
gnpy.tools.cli_examples¶
Common code for CLI examples
- gnpy.tools.cli_examples._add_common_options(parser: ArgumentParser, network_default: Path)¶
- gnpy.tools.cli_examples._path_result_json(pathresult)¶
- gnpy.tools.cli_examples._setup_logging(args)¶
- gnpy.tools.cli_examples.load_common_data(equipment_filename, topology_filename, simulation_filename, save_raw_network_filename)¶
Load common configuration from JSON files
- gnpy.tools.cli_examples.path_requests_run(args=None)¶
Main script running several services simulations. It returns a summary of the average performance for each service.
- gnpy.tools.cli_examples.show_example_data_dir()¶
- gnpy.tools.cli_examples.transmission_main_example(args=None)¶
Main script running a single simulation. It returns the detailed power across crossed elements and average performance accross all channels.
gnpy.tools.convert¶
This module contains utilities for converting between XLS and JSON.
The input XLS file must contain sheets named “Nodes” and “Links”. It may optionally contain a sheet named “Eqpt”.
In the “Nodes” sheet, only the “City” column is mandatory. The column “Type” can be determined automatically given the topology (e.g., if degree 2, ILA; otherwise, ROADM.) Incorrectly specified types (e.g., ILA for node of degree ≠ 2) will be automatically corrected.
In the “Links” sheet, only the first three columns (“Node A”, “Node Z” and “east Distance (km)”) are mandatory. Missing “west” information is copied from the “east” information so that it is possible to input undirected data.
- class gnpy.tools.convert.Eqpt(**kwargs)¶
Bases:
object
- default_values = {'east_amp_dp': None, 'east_amp_gain': None, 'east_amp_type': '', 'east_att_out': None, 'east_tilt_vs_wavelength': None, 'from_city': '', 'to_city': ''}¶
- update_attr(kwargs)¶
- class gnpy.tools.convert.Link(**kwargs)¶
Bases:
object
attribtes from west parse_ept_headers dict +node_a, node_z, west_fiber_con_in, east_fiber_con_in
- default_values = {'east_cable': '', 'east_con_in': None, 'east_con_out': None, 'east_distance': 80, 'east_fiber': 'SSMF', 'east_lineic': 0.2, 'east_pmd': 0.1, 'from_city': '', 'to_city': ''}¶
- update_attr(kwargs)¶
- class gnpy.tools.convert.Node(**kwargs)¶
Bases:
object
Node data class
- default_values = {'booster_restriction': '', 'city': '', 'country': '', 'latitude': 0, 'longitude': 0, 'node_type': 'ILA', 'preamp_restriction': '', 'region': '', 'state': ''}¶
- update_attr(kwargs)¶
- class gnpy.tools.convert.Roadm(**kwargs)¶
Bases:
object
- default_values = {'from_degrees': None, 'from_node': '', 'impairment_ids': None, 'target_pch_out_db': None, 'to_node': '', 'type_variety': None}¶
- update_attr(kwargs)¶
- gnpy.tools.convert._do_convert()¶
Main function for xls(x) topology conversion to JSON format
- gnpy.tools.convert._format_items(items: List[str])¶
formating utils
- gnpy.tools.convert.all_rows(sh, start=0)¶
Returns all rows of the xls(x) sheet starting from start row
- gnpy.tools.convert.connect_eqpt(from_: str, in_: str, to_: str) List[dict] ¶
Utils: create the topology connection json dict between in and to
- gnpy.tools.convert.convert_file(input_filename: Path, filter_region: List[str] = None, output_json_file_name: Path = None)¶
Save the conversion into
- gnpy.tools.convert.corresp_names(input_filename: Path, network: DiGraph)¶
a function that builds the correspondance between names given in the excel, and names used in the json, and created by the autodesign. All names are listed
- gnpy.tools.convert.corresp_next_node(network: DiGraph, corresp_ila: dict, corresp_roadm: dict) Tuple[dict, dict] ¶
for each name in corresp dictionnaries find the next node in network and its name given by user in excel. for meshTopology_exampleV2.xls: user ILA name Stbrieuc covers the two direction. convert.py creates 2 different ILA with possible names (depending on the direction and if the eqpt was defined in eqpt sheet) for an ILA and if it is defined in eqpt: - east edfa in Stbrieuc to Rennes_STA - west edfa in Stbrieuc to Rennes_STA for an ILA and if it is not defined in eqpt: - east edfa in Stbrieuc - west edfa in Stbrieuc for a roadm “Edfa_preamp_roadm node1_from_fiber (siteE → node1)-CABLES#19” “Edfa_booster_roadm node1_to_fiber (node1 → siteE)-CABLES#19” next_nodes finds the user defined name of next node to be able to map the path constraints - east edfa in Stbrieuc to Rennes_STA next node = Rennes_STA - west edfa in Stbrieuc to Rennes_STA next node Lannion_CAS
the function supports fiber splitting, fused nodes and shall only be called if excel format is used for both network and service
- gnpy.tools.convert.create_east_eqpt_element(node: Node, nodes_by_city: Dict[str, Node]) dict ¶
create amplifiers json elements for the east direction. this includes the case where the case of a fused element defined instead of an ILA in eqpt sheet
- gnpy.tools.convert.create_roadm_element(node, roadms_by_city)¶
create the json element for a roadm node, including the different cases: - if there are restrictions - if there are per degree target power defined on a direction direction is defined by the booster name, so that booster must also be created in eqpt sheet if the direction is defined in roadm
- gnpy.tools.convert.create_west_eqpt_element(node: Node, nodes_by_city: Dict[str, Node]) dict ¶
create amplifiers json elements for the west direction. this includes the case where the case of a fused element defined instead of an ILA in eqpt sheet
- gnpy.tools.convert.eqpt_connection_by_city(city_name: str, eqpts_by_city: DefaultDict[str, List[Eqpt]], links_by_city: DefaultDict[str, List[Link]], nodes_by_city: Dict[str, Node]) list ¶
- gnpy.tools.convert.eqpt_in_city_to_city(in_city: str, to_city: str, eqpts_by_city: DefaultDict[str, List[Eqpt]], nodes_by_city: Dict[str, Node], direction: str = 'east') str ¶
Utils: returns the formatted dtring corresponding to in_city types and direction
- gnpy.tools.convert.fiber_dest_from_source(city_name: str, links_by_city: DefaultDict[str, List[Link]]) List[str] ¶
Returns the list of cities city_name is connected to
- gnpy.tools.convert.fiber_link(from_city: str, to_city: str, links_by_city: DefaultDict[str, List[Link]]) str ¶
utils: returns formatted uid for fibers between from_city and to_city
- gnpy.tools.convert.parse_excel(input_filename: Path) Tuple[List[Node], List[Link], List[Eqpt], List[Roadm]] ¶
reads xls(x) sheets among Nodes, Eqpts, Links, Roadms and parse the data in the sheets into internal data structure Node, Link, Eqpt, Roadm, classes
- gnpy.tools.convert.parse_headers(my_sheet, input_headers_dict, headers, start_line, slice_in)¶
return a dict of header_slice key = column index value = header name
- gnpy.tools.convert.parse_row(row, headers)¶
- gnpy.tools.convert.parse_sheet(my_sheet, input_headers_dict, header_line, start_line, column)¶
- gnpy.tools.convert.read_header(my_sheet, line, slice_)¶
return the list of headers !:= ‘’ header_i = [(header, header_column_index), …] in a {line, slice1_x, slice_y} range
- gnpy.tools.convert.read_slice(my_sheet, line, slice_, header)¶
return the slice range of a given header in a defined range {line, slice_x, slice_y}
- gnpy.tools.convert.sanity_check(nodes: List[Node], links: List[Link], nodes_by_city: Dict[str, Node], links_by_city: DefaultDict[str, List[Link]], eqpts_by_city: DefaultDict[str, List[Eqpt]]) Tuple[List[Node], List[Link]] ¶
Raise correct issues if xls(x) is not correct, Correct type to ROADM if more tha 2-degrees checks duplicate links, unreferenced nodes in links, in eqpts, unreferenced link in eqpts, duplicate items
- gnpy.tools.convert.xls_to_json_data(input_filename: Path, filter_region: List[str] = None) Dict ¶
Read the excel sheets and produces the json dict in GNPy format (legacy) returns json dict
gnpy.tools.json_io¶
Loading and saving data from JSON files in GNPy’s internal data format
- class gnpy.tools.json_io.Amp(**kwargs)¶
Bases:
_JsonThing
List of amplifiers with their specs
- default_values = {'advance_configurations_from_json': None, 'allowed_for_design': False, 'bands': None, 'booster_variety': None, 'dgt': None, 'dual_stage_model': None, 'f_max': None, 'f_min': None, 'f_ripple_ref': None, 'gain_flatmax': None, 'gain_min': None, 'gain_ripple': 0, 'multi_band': None, 'nf0': None, 'nf_coef': None, 'nf_fit_coeff': None, 'nf_max': None, 'nf_min': None, 'nf_model': None, 'nf_ripple': 0, 'out_voa_auto': False, 'p_max': None, 'pdl': 0, 'pmd': 0, 'preamp_variety': None, 'raman': False, 'tilt_ripple': 0, 'type_def': '', 'type_variety': ''}¶
- classmethod from_json(filename, **kwargs)¶
- class gnpy.tools.json_io.Fiber(**kwargs)¶
Bases:
_JsonThing
Fiber default settings
- default_values = {'dispersion': None, 'effective_area': None, 'pmd_coef': 0, 'type_variety': ''}¶
- class gnpy.tools.json_io.Model_dual_stage(preamp_variety, booster_variety)¶
Bases:
tuple
- _asdict()¶
Return a new dict which maps field names to their values.
- _field_defaults = {}¶
- _fields = ('preamp_variety', 'booster_variety')¶
- classmethod _make(iterable)¶
Make a new Model_dual_stage object from a sequence or iterable
- _replace(**kwds)¶
Return a new Model_dual_stage object replacing specified fields with new values
- booster_variety¶
Alias for field number 1
- preamp_variety¶
Alias for field number 0
- class gnpy.tools.json_io.Model_fg(nf0)¶
Bases:
tuple
- _asdict()¶
Return a new dict which maps field names to their values.
- _field_defaults = {}¶
- _fields = ('nf0',)¶
- classmethod _make(iterable)¶
Make a new Model_fg object from a sequence or iterable
- _replace(**kwds)¶
Return a new Model_fg object replacing specified fields with new values
- nf0¶
Alias for field number 0
- class gnpy.tools.json_io.Model_hybrid(nf_ram, gain_ram, edfa_variety)¶
Bases:
tuple
- _asdict()¶
Return a new dict which maps field names to their values.
- _field_defaults = {}¶
- _fields = ('nf_ram', 'gain_ram', 'edfa_variety')¶
- classmethod _make(iterable)¶
Make a new Model_hybrid object from a sequence or iterable
- _replace(**kwds)¶
Return a new Model_hybrid object replacing specified fields with new values
- edfa_variety¶
Alias for field number 2
- gain_ram¶
Alias for field number 1
- nf_ram¶
Alias for field number 0
- class gnpy.tools.json_io.Model_openroadm_booster¶
Bases:
object
class to hold nf model specific to OpenROADM booster
- class gnpy.tools.json_io.Model_openroadm_ila(nf_coef)¶
Bases:
tuple
- _asdict()¶
Return a new dict which maps field names to their values.
- _field_defaults = {}¶
- _fields = ('nf_coef',)¶
- classmethod _make(iterable)¶
Make a new Model_openroadm_ila object from a sequence or iterable
- _replace(**kwds)¶
Return a new Model_openroadm_ila object replacing specified fields with new values
- nf_coef¶
Alias for field number 0
- class gnpy.tools.json_io.Model_openroadm_preamp¶
Bases:
object
class to hold nf model specific to OpenROADM preamp
- class gnpy.tools.json_io.Model_vg(nf1, nf2, delta_p, orig_nf_min, orig_nf_max)¶
Bases:
tuple
- _asdict()¶
Return a new dict which maps field names to their values.
- _field_defaults = {}¶
- _fields = ('nf1', 'nf2', 'delta_p', 'orig_nf_min', 'orig_nf_max')¶
- classmethod _make(iterable)¶
Make a new Model_vg object from a sequence or iterable
- _replace(**kwds)¶
Return a new Model_vg object replacing specified fields with new values
- delta_p¶
Alias for field number 2
- nf1¶
Alias for field number 0
- nf2¶
Alias for field number 1
- orig_nf_max¶
Alias for field number 4
- orig_nf_min¶
Alias for field number 3
- class gnpy.tools.json_io.Roadm(**kwargs)¶
Bases:
_JsonThing
List of ROADM and their specs
- default_values = {'add_drop_osnr': 100, 'pdl': 0, 'pmd': 0, 'restrictions': {'booster_variety_list': [], 'preamp_variety_list': []}, 'roadm-path-impairments': [], 'type_variety': 'default'}¶
- class gnpy.tools.json_io.SI(**kwargs)¶
Bases:
_JsonThing
Spectrum Information
- default_values = {'baud_rate': 32000000000.0, 'f_max': 196100000000000.0, 'f_min': 191350000000000.0, 'power_dbm': 0, 'power_range_db': [0, 0, 0.5], 'roll_off': 0.15, 'spacing': 50000000000.0, 'sys_margins': 0, 'tx_osnr': 45, 'tx_power_dbm': None}¶
- class gnpy.tools.json_io.Span(**kwargs)¶
Bases:
_JsonThing
Span simulations definition
- default_values = {'EOL': 0, 'con_in': 0, 'con_out': 0, 'delta_power_range_db': None, 'length_units': 'km', 'max_fiber_lineic_loss_for_raman': 0.25, 'max_length': 150, 'max_loss': None, 'padding': 10, 'power_mode': True, 'target_extended_gain': 2.5}¶
- class gnpy.tools.json_io.Transceiver(**kwargs)¶
Bases:
_JsonThing
List of transceivers and their modes
- default_values = {'frequency': None, 'mode': {}, 'type_variety': None}¶
- class gnpy.tools.json_io._JsonThing¶
Bases:
object
Base class for json equipment
- update_attr(default_values, kwargs, name)¶
Build the attributes based on kwargs dict
- gnpy.tools.json_io._check_fiber_vs_raman_fiber(equipment: dict)¶
Ensure that Fiber and RamanFiber with the same name define common properties equally
- gnpy.tools.json_io._check_one_request(params: dict, f_max_from_si: float)¶
Checks that the requested parameters are consistant (spacing vs nb channel vs transponder mode…)
- gnpy.tools.json_io._cls_for(equipment_type)¶
- gnpy.tools.json_io._equipment_from_json(json_data: dict, filename: Path) dict ¶
build global dictionnary eqpt_library that stores all eqpt characteristics: edfa type type_variety, fiber type_variety from the eqpt_config.json (filename parameter) also read advanced_config_from_json file parameters for edfa if they are available: typically nf_ripple, dfg gain ripple, dgt and nf polynomial nf_fit_coeff if advanced_config_from_json file parameter is not present: use nf_model: requires nf_min and nf_max values boundaries of the edfa gain range
- gnpy.tools.json_io._roadm_restrictions_sanity_check(equipment: dict)¶
verifies that booster and preamp restrictions specified in roadm equipment are listed in the edfa.
- gnpy.tools.json_io._spectrum_from_json(json_data: dict)¶
JSON_data is a list of spectrum partitions each with {f_min, f_max, baud_rate, roll_off, delta_pdb, slot_width, tx_osnr, label} Creates the per freq Carrier’s dict. f_min, f_max, baud_rate, slot_width and roll_off are mandatory label, tx_osnr and delta_pdb are created if not present label should be different for each partition >>> json_data = {‘spectrum’: [{‘f_min’: 193.2e12, ‘f_max’: 193.4e12, ‘slot_width’: 50e9, ‘baud_rate’: 32e9, ‘roll_off’: 0.15, ‘delta_pdb’: 1, ‘tx_osnr’: 45, ‘tx_power_dbm’: -7}, {‘f_min’: 193.4625e12, ‘f_max’: 193.9875e12, ‘slot_width’: 75e9, ‘baud_rate’: 64e9, ‘roll_off’: 0.15}, {‘f_min’: 194.075e12, ‘f_max’: 194.075e12, ‘slot_width’: 100e9, ‘baud_rate’: 90e9, ‘roll_off’: 0.15}, {‘f_min’: 194.2e12, ‘f_max’: 194.35e12, ‘slot_width’: 50e9, ‘baud_rate’: 32e9, ‘roll_off’: 0.15}]} >>> spectrum = _spectrum_from_json(json_data[‘spectrum’]) >>> for k, v in spectrum.items(): … print(f’{k}: {v}’) … 193200000000000.0: Carrier(delta_pdb=1, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=45, tx_power=0.00019952623149688798, label=’0-32.00G’) 193250000000000.0: Carrier(delta_pdb=1, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=45, tx_power=0.00019952623149688798, label=’0-32.00G’) 193300000000000.0: Carrier(delta_pdb=1, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=45, tx_power=0.00019952623149688798, label=’0-32.00G’) 193350000000000.0: Carrier(delta_pdb=1, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=45, tx_power=0.00019952623149688798, label=’0-32.00G’) 193400000000000.0: Carrier(delta_pdb=1, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=45, tx_power=0.00019952623149688798, label=’0-32.00G’) 193462500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label=’1-64.00G’) 193537500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label=’1-64.00G’) 193612500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label=’1-64.00G’) 193687500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label=’1-64.00G’) 193762500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label=’1-64.00G’) 193837500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label=’1-64.00G’) 193912500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label=’1-64.00G’) 193987500000000.0: Carrier(delta_pdb=0, baud_rate=64000000000.0, slot_width=75000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label=’1-64.00G’) 194075000000000.0: Carrier(delta_pdb=0, baud_rate=90000000000.0, slot_width=100000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label=’2-90.00G’) 194200000000000.0: Carrier(delta_pdb=0, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label=’3-32.00G’) 194250000000000.0: Carrier(delta_pdb=0, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label=’3-32.00G’) 194300000000000.0: Carrier(delta_pdb=0, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label=’3-32.00G’) 194350000000000.0: Carrier(delta_pdb=0, baud_rate=32000000000.0, slot_width=50000000000.0, roll_off=0.15, tx_osnr=40, tx_power=0.001, label=’3-32.00G’)
- gnpy.tools.json_io._update_band(equipment: dict) dict ¶
Creates a list of bands for this amplifier, and remove other parameters which are not applicable
- gnpy.tools.json_io._update_dual_stage(equipment: dict) dict ¶
Update attributes of all dual stage amps with the preamp and booster attributes (defined in the equipment dictionary)
Returns the updated equiment dictionary
- gnpy.tools.json_io.convert_service_sheet(input_filename: Path, eqpt: dict, network: DiGraph, network_filename: Optional[Path] = None, output_filename: str = '', bidir: bool = False)¶
Converts xls into json format services
- Parameters
input_filename – xls(x) file containing the service sheet
eqpt – equipment library
network – network for which these services apply (required for xls inputs to correct names)
network_filename – optional network file name that was used for network creation (required for xls inputs to correct names)
output_filename – name of the file where converted data are savec
bidir – set all services bidir attribute with this bool
- gnpy.tools.json_io.disjunctions_from_json(json_data: dict) List[Disjunction] ¶
reads the disjunction requests from the json dict and create the list of requested disjunctions for this set of requests
- gnpy.tools.json_io.find_equalisation(params: Dict, equalization_types: List[str])¶
Find the equalization(s) defined in params. params can be a dict or a Roadm object.
>>> roadm = {'add_drop_osnr': 100, 'pmd': 1, 'pdl': 0.5, ... 'restrictions': {'preamp_variety_list': ['a'], 'booster_variety_list': ['b']}, ... 'target_psd_out_mWperGHz': 4e-4} >>> equalization_types = ['target_pch_out_db', 'target_psd_out_mWperGHz'] >>> find_equalisation(roadm, equalization_types) {'target_pch_out_db': False, 'target_psd_out_mWperGHz': True}
- gnpy.tools.json_io.load_equipment(filename: Path) dict ¶
Load equipment, returns equipment dict
- gnpy.tools.json_io.load_initial_spectrum(filename: Path) dict ¶
Load spectrum to propagate, returns spectrum dict
- gnpy.tools.json_io.load_json(filename: Path) dict ¶
load json data, convert from the yang to the legacy supports both legacy ang yang formatted inputs based on yang models
- gnpy.tools.json_io.load_network(filename: Path, equipment: dict) DiGraph ¶
load network json or excel
- Parameters
filename – input file to read from
equipment – equipment library
- gnpy.tools.json_io.load_requests(filename: Path, eqpt: dict, bidir: bool, network: DiGraph, network_filename: str) dict ¶
loads the requests from a json or an excel file into a data string
- gnpy.tools.json_io.merge_equalization(params: dict, extra_params: dict) Optional[dict] ¶
params contains ROADM element config and extra_params default values from equipment library. If equalization is not defined in ROADM element use the one defined in equipment library. Only one type of equalization must be defined: power (target_pch_out_db) or PSD (target_psd_out_mWperGHz) or PSW (target_out_mWperSlotWidth) params and extra_params are dict
- gnpy.tools.json_io.network_from_json(json_data: dict, equipment: dict) DiGraph ¶
create digraph based on json input dict and using equipment library to fill in the gaps
- gnpy.tools.json_io.network_to_json(network: DiGraph) dict ¶
Export network graph as a json dict
- gnpy.tools.json_io.requests_from_json(json_data: dict, equipment: dict) List[PathRequest] ¶
Extract list of requests from data parsed from JSON
- gnpy.tools.json_io.save_json(obj: Dict, filename: Path)¶
Save in json format. Use yang formatted data for Topo and Services
- gnpy.tools.json_io.save_network(network: DiGraph, filename: str)¶
Dump the network into a JSON file
- Parameters
network – network to work on
filename – file to write to
gnpy.tools.plots¶
Graphs and plots usable from a CLI application
- gnpy.tools.plots._try_city(node)¶
- gnpy.tools.plots.plot_baseline(network)¶
- gnpy.tools.plots.plot_results(network, path, source, destination)¶
gnpy.tools.service_sheet¶
XLS parser that can be called to create a JSON request file in accordance with Yang model for requesting path computation.
See: draft-ietf-teas-yang-path-computation-01.txt
- class gnpy.tools.service_sheet.Element(uid)¶
Bases:
object
- class gnpy.tools.service_sheet.Request(request_id, source, destination, trx_type, mode=None, spacing=None, power=None, nb_channel=None, disjoint_from='', nodes_list=None, is_loose='', path_bandwidth=None)¶
Bases:
request_param
DATA class for a request.
- Params request_id (int)
The unique identifier for the request.
- Params source (str)
The source node for the communication.
- Params destination (str)
The destination node for the communication.
- Params trx_type (str)
The type of transmission for the communication.
- Params mode (str, optional)
The mode of transmission. Defaults to None.
- Params spacing (float, optional)
The spacing between channels. Defaults to None.
- Params power (float, optional)
The power level for the communication. Defaults to None.
- Params nb_channel (int, optional)
The number of channels required for the communication. Defaults to None.
- Params disjoint_from (str, optional)
The node to be disjoint from. Defaults to ‘’.
- Params nodes_list (list, optional)
The list of nodes involved in the communication. Defaults to None.
- Params is_loose (str, optional)
Indicates if the communication is loose. Defaults to ‘’.
- Params path_bandwidth (float, optional)
The bandwidth required for the communication. Defaults to None.
- class gnpy.tools.service_sheet.Request_element(request_param: Request, equipment: Dict, bidir: bool)¶
Bases:
Element
Class that generate the request in the json format
- Params request_param (Request)
The request object containing the information for the element.
- Params equipment (dict)
The equipment configuration for the communication.
- Params bidir (bool)
Indicates if the communication is bidirectional.
- Attributes:
request_id (str): The unique identifier for the request. source (str): The source node for the communication. destination (str): The destination node for the communication. srctpid (str): The source TP ID for the communication. dsttpid (str): The destination TP ID for the communication. bidir (bool): Indicates if the communication is bidirectional. trx_type (str): The type of transmission for the communication. mode (str): The mode of transmission for the communication. spacing (float): The spacing between channels for the communication. power (float): The power level for the communication. nb_channel (int): The number of channels required for the communication. disjoint_from (list): The list of nodes to be disjoint from. nodes_list (list): The list of nodes involved in the communication. loose (str): Indicates if the communication is loose or strict. path_bandwidth (float): The bandwidth required for the communication.
- property json¶
Returns the json dictionnary for requests and for synchronisation vector
- property pathrequest¶
Creates json dictionnary for the request
- property pathsync¶
Creates json dictionnary for disjunction list (synchronization vector)
- gnpy.tools.service_sheet.check_end_points(pathreq: Request_element, network: DiGraph)¶
Raise error if end point is not correct
- gnpy.tools.service_sheet.correct_xlrd_int_to_str_reading(v)¶
Utils: ensure that int values in id are read as strings containing the int and do not use the automatic float conversion from xlrd
- gnpy.tools.service_sheet.correct_xls_route_list(network_filename: Path, network: DiGraph, pathreqlist: List[Request_element]) List[Request_element] ¶
prepares the format of route list of nodes to be consistant with nodes names: remove wrong names, find correct names for ila, roadm and fused if the entry was xls. if it was not xls, all names in list should be exact name in the network.
- gnpy.tools.service_sheet.find_node_sugestion(n_id, corresp_roadm, corresp_fused, corresp_ila, network)¶
- gnpy.tools.service_sheet.parse_excel(input_filename: Path) List[Request] ¶
Opens xls_file and reads ‘Service’ sheet Returns the list of services data in Request class
- gnpy.tools.service_sheet.parse_row(row: List, fieldnames: List[str]) Dict ¶
Reads each values in a row and creates a dict using field names
- gnpy.tools.service_sheet.parse_service_sheet(service_sheet) Request ¶
reads each column according to authorized fieldnames. order is not important.
- gnpy.tools.service_sheet.read_service_sheet(input_filename: Path, eqpt: Dict, network: DiGraph, network_filename: Path = None, bidir: bool = False) Dict ¶
converts a service sheet into a json structure