atlanticwave-sdx / pce

Path Computation Element for AtlanticWave SDX.
https://www.atlanticwave-sdx.net
0 stars 3 forks source link

_get_ports_by_link early return is returning wrong number of argments #172

Closed italovalcy closed 6 months ago

italovalcy commented 9 months ago

Hi,

When running sdx-controller with pce in a scenario, I ended encountering this error:

sdx-controller    | INFO:sdx_pce.topology.temanager:Creating domain_breakdown: domain: urn:sdx:topology:ampath.net, links: [ConnectionPath(source=2, destination=3)]
sdx-controller    | ERROR:sdx_controller:Exception on /SDX-Controller/1.0.0/connection [POST]
sdx-controller    | Traceback (most recent call last):
sdx-controller    |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2529, in wsgi_app
sdx-controller    |     response = self.full_dispatch_request()
sdx-controller    |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1825, in full_dispatch_request
sdx-controller    |     rv = self.handle_user_exception(e)
sdx-controller    |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1823, in full_dispatch_request
sdx-controller    |     rv = self.dispatch_request()
sdx-controller    |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request
sdx-controller    |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
sdx-controller    |   File "/usr/local/lib/python3.9/site-packages/connexion/decorators/decorator.py", line 68, in wrapper
sdx-controller    |     response = function(request)
sdx-controller    |   File "/usr/local/lib/python3.9/site-packages/connexion/decorators/uri_parsing.py", line 149, in wrapper
sdx-controller    |     response = function(request)
sdx-controller    |   File "/usr/local/lib/python3.9/site-packages/connexion/decorators/validation.py", line 196, in wrapper
sdx-controller    |     response = function(request)
sdx-controller    |   File "/usr/local/lib/python3.9/site-packages/connexion/decorators/parameter.py", line 120, in wrapper
sdx-controller    |     return function(**kwargs)
sdx-controller    |   File "/usr/src/app/sdx_controller/controllers/connection_controller.py", line 90, in place_connection
sdx-controller    |     reason, code = connection_handler.place_connection(body)
sdx-controller    |   File "/usr/src/app/sdx_controller/handlers/connection_handler.py", line 158, in place_connection
sdx-controller    |     breakdown = temanager.generate_connection_breakdown(solution)
sdx-controller    |   File "/usr/local/lib/python3.9/site-packages/sdx_pce/topology/temanager.py", line 417, in generate_connection_breakdown
sdx-controller    |     ingress_port, _ = self._get_ports_by_link(links[0])
sdx-controller    | TypeError: cannot unpack non-iterable NoneType object

This is happening because inside _get_ports_by_link() function there is an early return that returns only None, while it should be None, None. https://github.com/atlanticwave-sdx/pce/blob/main/src/sdx_pce/topology/temanager.py#L470-L472

YufengXin commented 9 months ago

Thanks. @italovalcy for catching this. I'll see if I find time to fix it (mainly need to test it).