When a request is blocked and its M value is set to 0. This should not raise
an error in pth_assign_spectrum. This test verify that the function
does not raise an error.
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
in case there is no possible disjoint path with the added constraints
(most of the time due to an inconsistant user request)
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
removing unused import
change short variable names to conform to [a-z_][a-z0-9_]{2,30}$
change main variable names to conform to [A-Z_][A-Z0-9_]{2,30}$
add or remove spaces
add docstrings
correct comments and indents of cut lines
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
remove unused imports
add docstrings
conform to '[A-Z_][A-Z0-9_]{2,30}$' pattern in main
remove trailing spaces
add/remove extra spaces
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
for codacy report:
removing extra spces before , and :
adding spaces after , :
adding spaces around < > =
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
- use a new jsontopath_metric function to collect metrics
out of a json response.
- path metrics must be shown also for reversed path if this
is requested. This function avoids repeading code here
- add reversed metrics on the last columns of the CSV
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
- Instead applying bidir option independantly from service demands (json or xls)
the "bidirectional" attribute is introduced per request in the json.
This enables bidirectional option per requests.
if --bidir option is used on the main program, the field is set
to true for all demands in case demands are expressed in an excel
sheet. --bidir option does not change bidir field if the service
file is in json format.
Default value of "bidirectional" attribute is False.
- As a result the reversed path is propagated only if the birectional
field of the request is True. (remember that the reversed path must
be computed whatever the option because it is needed to compute
spectral occupation on both directions).
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
reversed_oms was introdused in order to identify which oms correspond
to the reversed direction of a given oms.
with this commit we make use of this functionality and avoid the cumbersome
way that recovered the reversed path by computing shortest path in the
reversed way for each roadm. This function could not support multiple links
in parallel between two roadms, and was adding computation time.
The function first lists the oms of the pth in the reversed order and then
appends all its elements to the path. the first and last elements are transponder
and are append separately.
Unidir topology are not supported: if there is no reversed path, this raises an error
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
The couple (N,M) is added on the last column only for non blocked requests
an empty string is used instead
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
The label object is added in the response. It contains center index N value
and number of slots M, required by the request according to the computation.
The label object directly follows the hop attribute as detailed in
draft-ietf-teas-yang-path-computation.
If the path is not blocked this changes the index of the last hop information
(-3 instead of -2) and the index of the transponder for the first hop
(2 instead of 1)
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
creation of a function to avoid code duplication: json_param creates
the relevant parameters to show on the csv based on json input
replace try/except by a test on keys:
previous way tried to get pth_el['no-path'] and is the path was
not blocked this raised a key error. Now the there is a simple check if
the key is present.
Besides, as the no-path has been change to 'no-path' container containing
a 'no-path' attribute with the blocking reason, the test is made on the
attribute so on pth_el['no-path']['no-path'].
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
if the path is empty NO_PATH reason or NO_PATH_WITH_CONSTRAINT reason
is returned in the blocking_reason attribute
if no mode is feasible, the last explored mode is returned with the path (and
implicitly the last computed SNR). The baud_rate is derived from this last
mode
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
if path could be computed: gives details of the path and on the propagation.
- the 'no-path' attribute is changed to a 'no-path' container that contains:
o the 'response-id' attribute
o a 'no-path' attribute with blocking reason
o if a path could be computed, the 'path-properties' of the path that
was computed with the metrics
Note that this proposal to add information for blocking in the json output (instead
of a bare NO PATH) corresponds to the way PCEp is working in general, but is not yet
integrated in draft-ietf-teas-yang-path-computation model. Returning the whole path
in case of blocking in addition to blocking reason is a novelty from GNPy and was a
request from the users
TODO : use correct ietf model when ready
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Before continuing on spectrum assignment we need to clearly identify blocking reasons:
implicit previous way (a path is missing) is not satisfactory because in case of
spectrum blocking a path was possible. So we introduce a 'blocking_reason' attribute
on requests, that will only exist if the path is blocked during the process.
The 'blocking_reason' attribute refflects the blocking reason.
Commit defines blocking types and group them depending on the existence of path or
feasibility:
'NO_PATH': no path was computed,
'NO_PATH_WITH_CONSTRAINT': no path was computed with this constraint
'NO_FEASIBLE_BAUDRATE_WITH_SPACING': no path was computed due to the spacing constraint
'NO_COMPUTED_SNR': the computed path could not give any SNR result
'NO_FEASIBLE_MODE': the user let the program choose a mode and path was computed but
no mode was feasible for the set of constraints
'MODE_NOT_FEASIBLE': the user imposed a mode, a path was computed but this mode
is not feasible
'NO_SPECTRUM': a path, a mode were selected but there is not enough spectrum available on
this path
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
if name of the constraint input from user is not part of networks names
(typically in the case of excel input), then the program try to find a
name that is clode to the user name and that is in the network list of
names. This list must not include trnasponder names (because transponder
end points are already listed as constraints and transponder in the
middle of a path are not supported yet)
This will be improved in the PR Ila names in constraints #278
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
previously reported the requested bandwidth, now fill it with an
empty string, same as the other fields.
This will be updated in a later PR when different kind of blocking
will be supported
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
previous way used a wrong interpretation of hop-type. in ietf model,
hop-type is reserved for LOOSE or STRICT constraint description.
Instead, transponder info , according to ietf usual way, should be
included aas a new path-route-object type. such object is not yet
defined in IETF so this is a GNPY proposal to use a 'transponder' object
with type and mode attributes.
this is what has been ecncoded in reques.py for requests and for answers
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
in case no path could be computed, the answer is changed according to
ietf path-computation model to a simple 'no-path' object
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
This is inspired by #293. The original issue was that the transponder
OSNR was not accounted for. Rather than making the propagate() and
propagate2() more complex, let's move the actual path printing to the
demo code. There's no secret sauce in there, it's just a simple
for-each-print thingy, so let's remove it from the library code.
fixes#262
exception KeyError type in service sheet not correctly catched
print Request.mode instead of Requestmode (not defined at this point)
selection of modes did not respect min spacing criterium:
constraint added
transmission_main did not give SNR in 0.1 nm: added in std out
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
when constraints such as include noe or disjuntion is applied
the candidates are sorted with shortest path in length first
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
add weight = length of fiber nodes on connections wher from_node is a fiber
add weight = 0.01 km on other edges
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
add Tx_osnr or add_drop_osnr on raw snr values to avoid cumulated adding
Signed-off-by: Jean-Luc Auge <jeanluc.auge@orange.com>
bug fix: forgot to add add_drop_osnr with tx_osnr
Signed-off-by: Jean-Luc Auge <jeanluc.auge@orange.com>