Skip to content

Commit

Permalink
Update pce error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
congwang09 committed Oct 25, 2024
1 parent d4b6a4e commit a4bca1c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sdx_controller/handlers/connection_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from sdx_pce.load_balancing.te_solver import TESolver
from sdx_pce.topology.temanager import TEManager
from sdx_pce.utils.exceptions import TEError

from sdx_controller.messaging.topic_queue_producer import TopicQueueProducer
from sdx_controller.models.simple_link import SimpleLink
Expand Down Expand Up @@ -143,7 +144,7 @@ def place_connection(
connection_request=connection_request
)
if traffic_matrix is None:
return "Could not generate a traffic matrix", 400
return "Could not generate a traffic matrix", 402

logger.info(f"Generated graph: '{graph}', traffic matrix: '{traffic_matrix}'")

Expand All @@ -152,7 +153,7 @@ def place_connection(
logger.debug(f"TESolver result: {solution}")

if solution is None or solution.connection_map is None:
return "Could not solve the request", 400
return "Could not solve the request", 410

try:
breakdown = te_manager.generate_connection_breakdown(
Expand All @@ -166,6 +167,8 @@ def place_connection(
)
logger.debug(f"Breakdown sent to LC, status: {status}, code: {code}")
return status, code
except TEError as te_err:
return te_err
except Exception as e:
err = traceback.format_exc().replace("\n", ", ")
logger.error(f"Error when generating/publishing breakdown: {e} - {err}")
Expand Down

0 comments on commit a4bca1c

Please sign in to comment.