gnpy.topology

Tracking request for spectrum and their spectrum_assignment.

gnpy.topology.request

This module contains path request functionality.

This functionality allows the user to provide a JSON request file in accordance with a Yang model for requesting path computations and returns path results in terms of path and feasibility

See: draft-ietf-teas-yang-path-computation-01.txt

class gnpy.topology.request.Disjunction(*args, **params)

Bases: object

the class that contains all attributes related to disjunction constraints

class gnpy.topology.request.DisjunctionParams(disjunction_id, relaxable, link_diverse, node_diverse, disjunctions_req)

Bases: tuple

_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('disjunction_id', 'relaxable', 'link_diverse', 'node_diverse', 'disjunctions_req')
classmethod _make(iterable)

Make a new DisjunctionParams object from a sequence or iterable

_replace(**kwds)

Return a new DisjunctionParams object replacing specified fields with new values

disjunction_id

Alias for field number 0

disjunctions_req

Alias for field number 4

Alias for field number 2

node_diverse

Alias for field number 3

relaxable

Alias for field number 1

class gnpy.topology.request.PathRequest(*args, **params)

Bases: object

the class that contains all attributes related to a request

class gnpy.topology.request.RequestParams(request_id, source, destination, bidir, trx_type, trx_mode, nodes_list, loose_list, spacing, power, nb_channel, f_min, f_max, format, baud_rate, OSNR, penalties, bit_rate, roll_off, tx_osnr, min_spacing, cost, path_bandwidth, effective_freq_slot, equalization_offset_db)

Bases: tuple

OSNR

Alias for field number 15

_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('request_id', 'source', 'destination', 'bidir', 'trx_type', 'trx_mode', 'nodes_list', 'loose_list', 'spacing', 'power', 'nb_channel', 'f_min', 'f_max', 'format', 'baud_rate', 'OSNR', 'penalties', 'bit_rate', 'roll_off', 'tx_osnr', 'min_spacing', 'cost', 'path_bandwidth', 'effective_freq_slot', 'equalization_offset_db')
classmethod _make(iterable)

Make a new RequestParams object from a sequence or iterable

_replace(**kwds)

Return a new RequestParams object replacing specified fields with new values

baud_rate

Alias for field number 14

bidir

Alias for field number 3

bit_rate

Alias for field number 17

cost

Alias for field number 21

destination

Alias for field number 2

effective_freq_slot

Alias for field number 23

equalization_offset_db

Alias for field number 24

f_max

Alias for field number 12

f_min

Alias for field number 11

format

Alias for field number 13

loose_list

Alias for field number 7

min_spacing

Alias for field number 20

nb_channel

Alias for field number 10

nodes_list

Alias for field number 6

path_bandwidth

Alias for field number 22

penalties

Alias for field number 16

power

Alias for field number 9

request_id

Alias for field number 0

roll_off

Alias for field number 18

source

Alias for field number 1

spacing

Alias for field number 8

trx_mode

Alias for field number 5

trx_type

Alias for field number 4

tx_osnr

Alias for field number 19

class gnpy.topology.request.ResultElement(path_request, computed_path, reversed_computed_path=None)

Bases: object

property detailed_path_json

a function that builds path object for normal and blocking cases

property json
property path_properties

a function that returns the path properties (metrics, crossed elements) into a dict

property pathresult

create the result dictionnary (response for a request)

property uid
gnpy.topology.request._penalty_msg(total_path, msg, min_ind)

formatting helper for reporting unfeasible paths

The penalty info are optional, so this checks that penalty exists before creating a message.

gnpy.topology.request.compare_reqs(req1, req2, disjlist)

compare two requests: returns True or False

gnpy.topology.request.compute_constrained_path(network, req)
gnpy.topology.request.compute_path_dsjctn(network, equipment, pathreqlist, disjunctions_list)
gnpy.topology.request.compute_path_with_disjunction(network, equipment, pathreqlist, pathlist)

use a list but a dictionnary might be helpful to find path based on request_id

TODO change all these req, dsjct, res lists into dict !

gnpy.topology.request.compute_spectrum_slot_vs_bandwidth(bandwidth, spacing, bit_rate, slot_width=12500000000.0)

Compute the number of required wavelengths and the M value (number of consumed slots)

Each wavelength consumes one spacing, and the result is rounded up to consume a natural number of slots.

>>> compute_spectrum_slot_vs_bandwidth(400e9, 50e9, 200e9)
(2, 8)
gnpy.topology.request.correct_json_route_list(network, pathreqlist)

all names in list should be exact name in the network, and there is no ambiguity

This function only checks that list is correct, warns user if the name is incorrect and suppresses the constraint it it is loose or raises an error if it is strict

gnpy.topology.request.deduplicate_disjunctions(disjn)

clean disjunctions to remove possible repetition

gnpy.topology.request.find_reversed_path(pth)

select of intermediate roadms and find the path between them note that this function may not give an exact result in case of multiple links between two adjacent nodes.

gnpy.topology.request.isdisjoint(pth1, pth2)

returns 0 if disjoint

gnpy.topology.request.ispart(ptha, pthb)

the functions takes two paths a and b and retrns True if all a elements are part of b and in the same order

gnpy.topology.request.jsontocsv(json_data, equipment, fileout)

reads json path result file in accordance with: Yang model for requesting Path Computation draft-ietf-teas-yang-path-computation-01.txt. and write results in an CSV file

gnpy.topology.request.jsontoparams(my_p, tsp, mode, equipment)

a function that derives optical params from transponder type and mode supports the no mode case

gnpy.topology.request.jsontopath_metric(path_metric)

a functions that reads resulting metric from json string

gnpy.topology.request.propagate(path, req, equipment)

propagates signals in each element according to initial spectrum set by user

gnpy.topology.request.propagate_and_optimize_mode(path, req, equipment)
gnpy.topology.request.remove_candidate(candidates, allpaths, rqst, pth)

filter duplicate candidates

gnpy.topology.request.requests_aggregation(pathreqlist, disjlist)

this function aggregates requests so that if several requests exist between same source and destination and with same transponder type If transponder mode is defined and identical, then also agregates demands.

gnpy.topology.spectrum_assignment

This module contains the Oms and Bitmap classes and methods to select and assign spectrum. The spectrum_selection() function identifies the free slots and select_candidate() selects the candidate spectrum according to strategy: for example first fit oms records its elements, and elements are updated with an oms to have element/oms correspondace

class gnpy.topology.spectrum_assignment.Bitmap(f_min, f_max, grid, guardband=150000000000.0, bitmap=None)

Bases: object

records the spectrum occupation

geti(nvalue)

converts the local index into n (itu grid)

getn(i)

converts the n (itu grid) into a local index

insert_left(newbitmap)

insert bitmap on the left to align oms bitmaps if their start frequencies are different

insert_right(newbitmap)

insert bitmap on the right to align oms bitmaps if their stop frequencies are different

class gnpy.topology.spectrum_assignment.OMS(*args, **params)

Bases: object

OMS class is the logical container that represent a link between two adjacent ROADMs and records the crossed elements and the occupied spectrum

add_element(elem)

records oms elements

add_service(service_id, nb_wl)

record service and mark spectrum as occupied

assign_spectrum(nvalue, mvalue)

change oms spectrum to mark spectrum assigned

update_spectrum(f_min, f_max, guardband=150000000000.0, existing_spectrum=None, grid=6250000000.0)

Frequencies expressed in Hz. Add 150 GHz margin to enable a center channel on f_min Use ITU-T G694.1 Flexible DWDM grid definition For the flexible DWDM grid, the allowed frequency slots have a nominal central frequency (in THz) defined by: 193.1 + n × 0.00625 where n is a positive or negative integer including 0 and 0.00625 is the nominal central frequency granularity in THz and a slot width defined by: 12.5 × m where m is a positive integer and 12.5 is the slot width granularity in GHz. Any combination of frequency slots is allowed as long as no two frequency slots overlap. If bitmap is not None, then use it: Bitmap checks its consistency with f_min f_max else a brand new bitmap is created

class gnpy.topology.spectrum_assignment.OMSParams(oms_id, el_id_list, el_list)

Bases: tuple

_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('oms_id', 'el_id_list', 'el_list')
classmethod _make(iterable)

Make a new OMSParams object from a sequence or iterable

_replace(**kwds)

Return a new OMSParams object replacing specified fields with new values

el_id_list

Alias for field number 1

el_list

Alias for field number 2

oms_id

Alias for field number 0

gnpy.topology.spectrum_assignment.aggregate_oms_bitmap(path_oms, oms_list)
gnpy.topology.spectrum_assignment.align_grids(oms_list)

Used to apply same grid to all oms : same starting n, stop n and slot size. Out of grid slots are set to 0.

gnpy.topology.spectrum_assignment.bitmap_sum(band1, band2)

mark occupied bitmap by 0 if the slot is occupied in band1 or in band2

gnpy.topology.spectrum_assignment.build_oms_list(network, equipment)

initialization of OMS list in the network

an oms is build reading all intermediate nodes between two adjacent ROADMs each element within the list is being added an oms and oms_id to record the oms it belongs to. the function supports different spectrum width and supposes that the whole network works with the min range among OMSs

gnpy.topology.spectrum_assignment.build_path_oms_id_list(pth)
gnpy.topology.spectrum_assignment.compute_n_m(required_m, rq, path_oms, oms_list, per_channel_m, policy='first_fit')

based on requested path_bandwidth fill in M=None values with uint values, using per_channel_m and center frequency, with first fit strategy. The function checks the available spectrum but check consistencies among M values of the request, but not with other requests. For example, if request is for 32 slots corresponding to 8 x 4 slots of 32Gbauds channels, the following frequency slots will result in the following assignment

N = 0, 8, 16, 32 -> 0, 8, 16, 32 M = 8, None, 8, None -> 8, 8, 8, 8

N = 0, 8, 16, 32 -> 0, , 16 M = None, None, 8, None -> 24, , 8

gnpy.topology.spectrum_assignment.determine_slot_numbers(test_oms, requested_n, required_m, per_channel_m)

determines max availability around requested_n. requested_n should not be None

gnpy.topology.spectrum_assignment.frequency_to_n(freq, grid=6250000000.0)

converts frequency into the n value (ITU grid)

reference to Recommendation G.694.1 (02/12), Figure I.3 https://www.itu.int/rec/T-REC-G.694.1-201202-I/en

>>> frequency_to_n(193.1375e12)
6
>>> frequency_to_n(193.225e12)
20
gnpy.topology.spectrum_assignment.m_to_freq(nvalue, mvalue, grid=6250000000.0)

converts m into frequency range

spectrum(13,7) is (193137500000000.0, 193225000000000.0) reference to Recommendation G.694.1 (02/12), Figure I.3 https://www.itu.int/rec/T-REC-G.694.1-201202-I/en

>>> fstart, fstop = m_to_freq(13, 7)
>>> fstart
193137500000000.0
>>> fstop
193225000000000.0
gnpy.topology.spectrum_assignment.mvalue_to_slots(nvalue, mvalue)

convert center n an m into start and stop n

gnpy.topology.spectrum_assignment.nvalue_to_frequency(nvalue, grid=6250000000.0)

converts n value into a frequency

reference to Recommendation G.694.1 (02/12), Table 1 https://www.itu.int/rec/T-REC-G.694.1-201202-I/en

>>> nvalue_to_frequency(6)
193137500000000.0
>>> nvalue_to_frequency(-1, 0.1e12)
193000000000000.0
gnpy.topology.spectrum_assignment.pth_assign_spectrum(pths, rqs, oms_list, rpths)

basic first fit assignment

if reversed path are provided, means that occupation is bidir

gnpy.topology.spectrum_assignment.reversed_oms(oms_list)

identifies reversed OMS

only applicable for non parallel OMS

gnpy.topology.spectrum_assignment.select_candidate(candidates, policy)

selects a candidate among all available spectrum

gnpy.topology.spectrum_assignment.slots_to_m(startn, stopn)

converts the start and stop n values to the center n and m value

reference to Recommendation G.694.1 (02/12), Figure I.3 https://www.itu.int/rec/T-REC-G.694.1-201202-I/en

>>> nval, mval = slots_to_m(6, 20)
>>> nval
13
>>> mval
7
gnpy.topology.spectrum_assignment.spectrum_selection(test_oms, requested_m, requested_n=None)

Collects spectrum availability and call the select_candidate function