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

Introduce or reuse an exception when trying to get a Flow object from dict given an unregistered Experimenter Action #105

Open
viniarck opened this issue Feb 23, 2023 · 0 comments
Labels
enhancement New feature or request priority_low Low priority

Comments

@viniarck
Copy link
Member

Currently, it's expected that the supported experimenter actions is properly registered, which our kytos-ng/noviflow, does correctly.

However, if either a new experimenter action is introduced in the future and it's incorrectly registered, of_core isn't gracefully raising a different exception, making it harder for clients like flow_manager to capture this. Some methods from of_core ActionFactoryBase they might also fail open so leaving room for consistency check problems since it'll incorrectly don't install an action. So, having this a bit more explicitly to fail at least when it comes to the serialization is probably better.

For instance, here's an example of a mistaken registered action:

2023-02-23 16:19:31,304 - ERROR [kytos.core.controller] (Thread-92) Exception on /api/kytos/flow_manager/v2/flows/00:00:00:00:00:00:00:01 [POST]
Traceback (most recent call last):
  File "/home/viniarck/repos/kytos/.direnv/python-3.9.15/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.15/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.15/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.15/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.15/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/kytos/flow_manager/main.py", line 558, in add
    return self._send_flow_mods_from_request(dpid, "add")
  File "/home/viniarck/repos/napps/napps/kytos/flow_manager/main.py", line 621, in _send_flow_mods_from_request
    self._install_flows(command, flows_dict, [switch], reraise_conn=not force)
  File "/home/viniarck/repos/napps/napps/kytos/flow_manager/main.py", line 651, in _install_flows
    flow = serializer.from_dict(flow_dict, switch)
  File "/home/viniarck/repos/napps/napps/kytos/of_core/v0x04/flow.py", line 375, in from_dict
    action = cls._action_factory.from_dict(action_dict)
  File "/home/viniarck/repos/napps/napps/kytos/of_core/flow.py", line 331, in from_dict
    action_class = cls._action_class[action_type]
KeyError: 'push_int'
@viniarck viniarck added enhancement New feature or request priority_low Low priority future_release Planned for the next release labels Feb 23, 2023
@viniarck viniarck removed the future_release Planned for the next release label Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority_low Low priority
Projects
None yet
Development

No branches or pull requests

1 participant