** Also affects: neutron/kilo
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1477829

Title:
  Create port API with invalid value returns 500(Internal Server Error)

Status in neutron:
  Fix Released
Status in neutron kilo series:
  New

Bug description:
  I executed "POST /v2.0/ports" with invalid value like a "null" as the 
parameter "allowed_address_pairs".
  Then Neutron Server returned 500(Internal Server Error).

  I expected Neutron Server just returns 400(Bad Request).

  API Result and Logs are as follows.
  [API Result]
  stack@ubuntu:~/deg$ curl -g -i -X POST -H "Content-Type: application/json" -H 
"X-Auth-Token: ${token}" http://192.168.122.99:9696/v2.0/ports -d 
"{\"port\":{\"network_id\":\"7da5015b-4e6a-4c9f-af47-42467a4a34c5\",\"allowed_address_pairs\":null}}"
 ; echo
  HTTP/1.1 500 Internal Server Error
  Content-Type: application/json; charset=UTF-8
  Content-Length: 150
  X-Openstack-Request-Id: req-f44e7756-dd17-42c9-81e2-1c38e60a748e
  Date: Thu, 23 Jul 2015 09:35:26 GMT

  {"NeutronError": {"message": "Request Failed: internal server error
  while processing your request.", "type": "HTTPInternalServerError",
  "detail": ""}}

  [Neutron Server Log]
  2015-07-23 18:35:26.373 DEBUG neutron.api.v2.base 
[req-f44e7756-dd17-42c9-81e2-1c38e60a748e demo 
0522fc19a56b4d7ca32a9140d3d36a08] Request body: {u'port': {u'network_id': 
u'7da5015b-4e6a-4c9f-af47-42467a4a34c5', u'allowed_address_pairs': None}} from 
(pid=24318) prepare_request_body /opt/stack/neutron/neutron/api/v2/base.py:606
  2015-07-23 18:35:26.376 ERROR neutron.api.v2.resource 
[req-f44e7756-dd17-42c9-81e2-1c38e60a748e demo 
0522fc19a56b4d7ca32a9140d3d36a08] create failed
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource Traceback (most recent 
call last):
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource   File 
"/opt/stack/neutron/neutron/api/v2/resource.py", line 83, in resource
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource     result = 
method(request=request, **args)
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource   File 
"/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 146, in wrapper
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource     ectxt.value = 
e.inner_exc
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource   File 
"/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 119, in 
__exit__
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource     
six.reraise(self.type_, self.value, self.tb)
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource   File 
"/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 136, in wrapper
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource     return f(*args, 
**kwargs)
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource   File 
"/opt/stack/neutron/neutron/api/v2/base.py", line 396, in create
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource     
allow_bulk=self._allow_bulk)
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource   File 
"/opt/stack/neutron/neutron/api/v2/base.py", line 664, in prepare_request_body
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource     
attr_vals['validate'][rule])
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource   File 
"/opt/stack/neutron/neutron/extensions/allowedaddresspairs.py", line 52, in 
_validate_allowed_address_pairs
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource     if 
len(address_pairs) > cfg.CONF.max_allowed_address_pair:
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource TypeError: object of 
type 'NoneType' has no len()
  2015-07-23 18:35:26.376 TRACE neutron.api.v2.resource

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1477829/+subscriptions

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to