Reviewed: https://review.openstack.org/424716 Committed: https://git.openstack.org/cgit/openstack/neutron-fwaas/commit/?id=0f02e18a4505bff06e7dd1eb0fb5ec4e48921df5 Submitter: Jenkins Branch: master
commit 0f02e18a4505bff06e7dd1eb0fb5ec4e48921df5 Author: Yushiro FURUKAWA <[email protected]> Date: Wed Jan 25 00:57:04 2017 +0900 Fix validation in converting 'protocol' This commit fixes validation in converting 'protocol' for firewall_rule from integer or integer of string value. Ex. it is possible to specify '6' or 6 as a 'protocol'. Change-Id: Ie2a61b744decaad0fe168669d1a9df47633a0608 Closes-Bug: #1659031 ** Changed in: neutron Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1659031 Title: FWaaS - Cannot specify 8bit integer for 'protocol' in firewall_rule Status in neutron: Fix Released Bug description: In current FWaaS, we cannot specify integer value for 'protocol' in firewall_rule. [How to reproduce] $source devstack/openrc admin admin $export TOKEN=`openstack token issue| grep ' id ' | get_field 2` $curl -X POST -d '{"firewall_rule":{"name":"test", "protocol": "6", "action": "deny"}}' -H "x-auth-token:$TOKEN" 192.168.122.253:9696/v2.0/fwaas/firewall_rules {"NeutronError": {"message": "Invalid input for protocol. Reason: 6 is not in valid_values.", "type": "HTTPBadRequest", "detail": ""}} $curl -X POST -d '{"firewall_rule":{"name":"test", "protocol": 6, "action": "deny"}}' -H "x-auth-token:$TOKEN" 192.168.122.253:9696/v2.0/fwaas/firewall_rules {"NeutronError": {"message": "Request Failed: internal server error while processing your request.", "type": "HTTPInternalServerError", "detail": ""}} [q-svc.log] 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource Traceback (most recent call last): 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/resource.py", line 79, in resource 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource result = method(request=request, **args) 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 438, in create 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource return self._create(request, body, **kwargs) 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/db/api.py", line 92, in wrapped 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource setattr(e, '_RETRY_EXCEEDED', True) 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__ 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource self.force_reraise() 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb) 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/db/api.py", line 88, in wrapped 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource return f(*args, **kwargs) 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 151, in wrapper 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource ectxt.value = e.inner_exc 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__ 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource self.force_reraise() 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb) 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 139, in wrapper 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource return f(*args, **kwargs) 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/db/api.py", line 128, in wrapped 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource traceback.format_exc()) 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__ 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource self.force_reraise() 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb) 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/db/api.py", line 123, in wrapped 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource return f(*dup_args, **dup_kwargs) 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 447, in _create 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource allow_bulk=self._allow_bulk) 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 727, in prepare_request_body 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource attributes.convert_value(attr_info, res_dict, webob.exc.HTTPBadRequest) 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/attributes.py", line 325, in convert_value 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource res_dict[attr] = attr_vals['convert_to'](res_dict[attr]) 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource File "/opt/stack/neutron-fwaas/neutron_fwaas/extensions/firewall.py", line 179, in convert_protocol 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource if value.isdigit(): 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource AttributeError: 'int' object has no attribute 'isdigit' 2017-01-25 00:25:13.517 TRACE neutron.api.v2.resource To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1659031/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

