The topology will be provisioned out-of-band, so let's simplify the REST
API so that it reflects that design. Also, let's make it obvious that
the API is subject to change and should not be relied upon at this time.
It's meant to be an experimental interface with data I/O format which
*will* change as we adapt a proper YANG model for both directions.
I do not think that proof-of-concept demos should implement HTTP auth
because GNPy has no concept of access lists. If people want to use this
in a "real scenario", they will likely wrap Python's HTTP server behind
a real HTTP reverse proxy, and they can then implement proper ACL at
that layer.
- remove unused abort and marshall
- change variable names to conform to upper letter rule,
[a-z_][a-z0-9_]{2,30}$
- add docstrings
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
- add the function launch_cli to launch the "cli" mode
- add the the class Gnpy_API to launch the "api" mode
- modify the main to enable the launch of Gnpy with two
modes "rest" and "cli"
Signed-off-by: ahmed <ahmed.triki@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>
reversed path must be computed even if bidir is not requested
because in WDM system service are all bidir.
bidir option is only to avoid lengthy propagation of reversed
path when it is not needed
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>
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.
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
all BLOCKING_NOMODE requests have the same type of response
so the test is simplified to account for this
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
- add some help input for the main program arguments
- move and correct comments
- add empty lines on stdout to have a nice printing
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
correct typos in comments and precise that results show the
mean value of SNR of all channels on stdout
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
in path assignment function, path elements and reversed path
elements are concatenated to compute the overall spectrum
availability on all elements
in main program, assignment is performed after computing reversed paths
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
add a bidir argument to make bidir propagation as optional.
Reversed path computation is not optional because it is needed
for spectrum assignment.
for all requests, if a path could be computed a reversed path is
computed and propagation is performed on it if bidir option is on.
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
previous way only check path existence to know if the request was blocked
or not.
Now the printing checks if the blocking_reason attribute exist, and if so
adapts the printing accordingly. The reason for blocking is added on the
output.
if no path could be computed, snr, osnr and other metrics depending on path
are replaced by empty strings
else, the metrics corresponding to the computed path are shown
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
In compute_path_with_disjunction, and in case user mode is not feasible
returns the blocking reason instead of an empty path.
If the user does not give the mode and the automatic selection does not
give any feasible mode instead of checking if a mode exists, the function
now checks the presence of a blocking reason.
if the blocking reason is among BLOCKING_NOPATH reasons, than an empty
path is returned
if the blocking reason is among BLOCKING_NOMODE, then a path could be computed
and the mode information correspond to the last explored mode.
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>
function is called to assign spectrum to each request
result shows an additionnal column for blocking reason
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
oms_list contains the list of OMS and each OMS contains the list
of uid of each crossed elements (ordered)
each element is updated with the oms_id to which it belongs
each oms contains a bitmap with frequency slots according to
frequency min max defined in eqpt_config.json (SI) and in case oms
are defined elsewhere, there is an alignment of grids to ease computation
the build_OMS_list function builds the OMS list and implements oms attributes
in all network elements
Commit also contains basic functions to handle spectrum bitmap and indexes
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>
previous try section encompass errors that should not be silently
ignored. Correction pointed a default in a test file.
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
anytype supported including transponder in order to accept well formed
route list from user (if user enters 'trx Lannion_CAS' this should be
accepted even if it repeats the source name)
A later PR better handles route list names
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
previously contained the user-given source name in excel file,
but could differ from effective transponder source/destination
now both source and src-tp-id contain the same info (gnpy does
not make difference between node and ports)
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
restriction was placed on fiber type because when using excel input
autodesign create fiber names with syntax not explicit to the user, so that
entering a node name as constraint may end up to a wrong interpretation eg
aa -bb -> create names such as 'fiber aa to bb', fiber bb to aa' .
If user constraint is bb there is a ambiguity on the fiber direction.
However this is not a problem for user using json format.
So I preferred to removed this constraint now.
a later PR solves this naming ambiguity
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
since empty attributes have been removed from the requests with
previous changes, some aditional tests are needed to continue supporting
optional power and nch. (previous objects were created with null
or default values)
user may enter requests without specifying these fields, in this
case the object 'output-power' or 'max-nb-of-channel' do not exist.
the try /except form handles the corresponding exception and
default values are kept else.
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
change the naming according to model update +
previous changes authorize empty list of nodes.
This new test supports this case
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
- removing empty objects (if no content , removes the object),
especially
- removing empty synchronization vector if no disjunction
constraint exists
- removing optional power and nb of channel fields, if user
did not specify any
when reading, first try if the object exists : try:/except to catch
this case
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
- changes concerning names due to ietf path-computation draft changes:
- 'unnumbered-hop' changed to 'num-unnum-hop'
- suppression of 'label-hop'
- 'link-diverse' and 'node-diverse' changed to 'disjointness'
- correction because of previously wrong interpretation of the model:
- detailed succession on include nodes moved from
'optimisation /explicit-route-include-objects'
to 'route-object-include-exclude'
in 'explicit-route-objects' attribute
- correction of keywords
- n and m replaced by N and M
- strict and loose replaces by STRICT and LOOSE strings
- change the name of respponse from 'path' to 'response'
example service file corrected accordingly
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
I'm trying to clean up the core code while not causing too much trouble
to our users. Esther pointed out that there's an internal use case at
Orange where people are looking at the incremental results when
computing paths.
I strongly dislike commented-out debugging code, but for the sake of
progress, let's put it in here. It's roughly as good as that unused
`show` parameter, and it allowed a refactoring to make the code more
readable.
This has been marked obsolete for 11 months. It's also one of the
callers of the propagate(), so it's being touched by that change which
removes the `show` parameter. This commit will make it easier to put
debug path printing just where it's really needed.
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