Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return 404 status code when dpid is not found #57

Merged
merged 1 commit into from
Apr 5, 2018
Merged

return 404 status code when dpid is not found #57

merged 1 commit into from
Apr 5, 2018

Conversation

viniarck
Copy link
Contributor

@viniarck viniarck commented Apr 5, 2018

This PR fixes the first item of issue #23.

The error without this PR is, which could happen also when the switch got disconnected and a flow_mod is sent:

Traceback (most recent call last):
  File "/home/arcanjo/repos/kytos/.direnv/python-3.6.4/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/arcanjo/repos/kytos/.direnv/python-3.6.4/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/arcanjo/repos/kytos/.direnv/python-3.6.4/lib/python3.6/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/home/arcanjo/repos/kytos/.direnv/python-3.6.4/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/arcanjo/repos/kytos/.direnv/python-3.6.4/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/arcanjo/repos/kytos/.direnv/python-3.6.4/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/arcanjo/repos/kytos/.direnv/python-3.6.4/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/arcanjo/repos/kytos/.direnv/python-3.6.4/var/lib/kytos/napps/kytos/flow_manager/main.py", line 59, in add
    return self._send_flow_mods_from_request(dpid, "add")
  File "/home/arcanjo/repos/kytos/.direnv/python-3.6.4/var/lib/kytos/napps/kytos/flow_manager/main.py", line 80, in _send_flow_mods_from_request
    serializer = self._get_flow_serializer(switch)
  File "/home/arcanjo/repos/kytos/.direnv/python-3.6.4/var/lib/kytos/napps/kytos/flow_manager/main.py", line 117, in _get_flow_serializer
    version = switch.connection.protocol.version
AttributeError: 'NoneType' object has no attribute 'connection'

@beraldoleal beraldoleal merged commit cb3af0c into kytos:master Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants