mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-10-31 18:18:00 +00:00
Add a DisjunctionError exception and use it
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>
This commit is contained in:
@@ -436,7 +436,11 @@ def main(args):
|
||||
print(rqs)
|
||||
|
||||
print('\x1b[1;34;40m' + f'Computing all paths with constraints' + '\x1b[0m')
|
||||
try:
|
||||
pths = compute_path_dsjctn(network, equipment, rqs, dsjn)
|
||||
except DisjunctionError as this_e:
|
||||
print(f'{ansi_escapes.red}Disjunction error:{ansi_escapes.reset} {this_e}')
|
||||
exit(1)
|
||||
|
||||
print('\x1b[1;34;40m' + f'Propagating on selected path' + '\x1b[0m')
|
||||
propagatedpths, reversed_pths, reversed_propagatedpths = \
|
||||
|
||||
@@ -21,3 +21,5 @@ class NetworkTopologyError(ConfigurationError):
|
||||
class ServiceError(Exception):
|
||||
'''Service of user-provided request is wrong'''
|
||||
|
||||
class DisjunctionError(ServiceError):
|
||||
'''Disjunction of user-provided request can not be satisfied'''
|
||||
|
||||
@@ -24,7 +24,7 @@ from gnpy.core.service_sheet import convert_service_sheet, Request_element, Elem
|
||||
from gnpy.core.elements import Transceiver, Roadm, Edfa, Fused
|
||||
from gnpy.core.utils import db2lin, lin2db
|
||||
from gnpy.core.info import create_input_spectral_information, SpectralInformation, Channel, Power
|
||||
from gnpy.core.exceptions import ServiceError
|
||||
from gnpy.core.exceptions import ServiceError, DisjunctionError
|
||||
from copy import copy, deepcopy
|
||||
from csv import writer
|
||||
from math import ceil
|
||||
@@ -878,7 +878,7 @@ def compute_path_dsjctn(network, equipment, pathreqlist, disjunctions_list):
|
||||
LOGGER.critical(msg)
|
||||
print(f'{msg}\nComputation stopped.')
|
||||
# TODO in this case: replay step 5 with the candidate without constraints
|
||||
exit()
|
||||
raise DisjunctionError(msg)
|
||||
|
||||
# for i in disjunctions_list:
|
||||
# print(i.disjunction_id)
|
||||
|
||||
Reference in New Issue
Block a user