kytos-ng / sdntrace_cp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PUT /api/amlight/sdntrace_cp/trace can raise HTTP internal error 500

viniarck opened this issue · comments

I've caught this traceback when I was shutting down kytosd, mef_eline tried to run a sdntrace_cp during its consistency, and then match_flows assumed that a switch would always be present in the response:

2022-11-01 15:06:50,751 - INFO [werkzeug] [_internal.py:225:_log] (Thread-111) 127.0.0.1 - - [01/Nov/2022 15:06:50] "PUT /api/amlight/sdntrace_cp/trace HTTP/1.1" 500 -
2022-11-01 15:06:50,747 - ERROR [kytos.core.controller] [app.py:1449:log_exception] (Thread-111) Exception on /api/amlight/sdntrace_cp/trace [PUT]
Traceback (most recent call last):
  File "/home/viniarck/repos/kytos/.direnv/python-3.9.12/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/viniarck/repos/kytos/.direnv/python-3.9.12/lib/python3.9/site-packages/flask/app.py", line 1519, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/viniarck/repos/kytos/.direnv/python-3.9.12/lib/python3.9/site-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/home/viniarck/repos/kytos/.direnv/python-3.9.12/lib/python3.9/site-packages/flask/app.py", line 1517, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/viniarck/repos/kytos/.direnv/python-3.9.12/lib/python3.9/site-packages/flask/app.py", line 1503, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/viniarck/repos/napps/napps/amlight/sdntrace_cp/main.py", line 66, in trace
    result = self.tracepath(entries, stored_flows)
  File "/home/viniarck/repos/napps/napps/amlight/sdntrace_cp/main.py", line 103, in tracepath
    result = self.trace_step(switch, entries, stored_flows)
  File "/home/viniarck/repos/napps/napps/amlight/sdntrace_cp/main.py", line 144, in trace_step
    flow, entries, port = self.match_and_apply(
  File "/home/viniarck/repos/napps/napps/amlight/sdntrace_cp/main.py", line 244, in match_and_apply
    flow = self.match_flows(switch, args, stored_flows, False)
  File "/home/viniarck/repos/napps/napps/amlight/sdntrace_cp/main.py", line 223, in match_flows
    for flow in stored_flows[switch.dpid]:
KeyError: '00:00:00:00:00:00:00:01'
2022-11-01 15:06:50,753 - ERROR [kytos.napps.kytos/mef_eline] [evc.py:1047:run_sdntrace] (mef_eline) Failed to run sdntrace-cp: {"code":500,"description":"The server encountered an inte
rnal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.","name":"Internal Server Error"}

I was running Kytos-ng with this topology, and an EVC between s1 and s3, mn --controller=remote,ip=127.0.0.1,port=6653 --switch=ovsk,protocols=OpenFlow13 --custom custom_topos/ring.py --topo mytopo:

"""Custom topology example

Two directly connected switches plus a host for each switch:

   host --- switch --- switch --- host

Adding the 'topos' dict with a key/value pair to generate our newly defined
topology enables one to pass in '--topo=mytopo' from the command line.
"""

from mininet.topo import Topo


class MyTopo(Topo):
    "Simple topology example."

    def build(self):
        "Create custom topo."

        # Add hosts and switches
        h11 = self.addHost("h11")
        h12 = self.addHost("h12")
        h2 = self.addHost("h2")
        h3 = self.addHost("h3")

        s1 = self.addSwitch("s1")
        s2 = self.addSwitch("s2")
        s3 = self.addSwitch("s3")

        self.addLink(s1, h11)
        self.addLink(s1, h12)
        self.addLink(s2, h2)
        self.addLink(s3, h3)

        self.addLink(s1, s2)
        self.addLink(s2, s3)
        self.addLink(s1, s3)



topos = {"mytopo": (lambda: MyTopo())}

@gretelliz, since you've been working with this feature could you add it to your list and assign this issue to yourself? Thanks.

Ideally, we'll need this to land in this release, mef_eline consitency check relies on this functionality.

Yes, sure

Yes, sure

Thanks.

Landed on #49