Neutron network API throws error code 500 when an Invalid VLAN is provided (should throw 400)

Bug #1348056 reported by Sudipta Biswas
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Sudipta Biswas

Bug Description

The neutron network API currently throws a error code 500 for an invalid input against the VLAN field.

The error can be reproduced by having the following JSON request body:

{
            "network": {
                "admin_state_up": "false",
                "provider:segmentation_id": "abc",
                "name": "Network1",
                "provider:physical_network": "XYZ",
                "provider:network_type": "vlan"
            }
        }

An error code 400 should be thrown much like how it is thrown for the other fields - if they correspond to incorrect values.

Tags: api
Changed in neutron:
assignee: nobody → Sudipta Biswas (sbiswas7)
Revision history for this message
Eugene Nikanorov (enikanorov) wrote :

Please provide neutron-server logs for the issue?

Changed in neutron:
status: New → Incomplete
tags: added: api
Changed in neutron:
importance: Undecided → Medium
Revision history for this message
Sudipta Biswas (sbiswas7) wrote :

2014-08-03 13:48:47.280 31326 TRACE neutron.api.v2.resource Traceback (most recent call last):
2014-08-03 13:48:47.280 31326 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/api/v2/resource.py", line 86, in resource
2014-08-03 13:48:47.280 31326 TRACE neutron.api.v2.resource result = method(request=request, **args)
2014-08-03 13:48:47.280 31326 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/api/v2/base.py", line 355, in create
2014-08-03 13:48:47.280 31326 TRACE neutron.api.v2.resource allow_bulk=self._allow_bulk)
2014-08-03 13:48:47.280 31326 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/api/v2/base.py", line 605, in prepare_request_body
2014-08-03 13:48:47.280 31326 TRACE neutron.api.v2.resource res_dict[attr] = attr_vals['convert_to'](res_dict[attr])
2014-08-03 13:48:47.280 31326 TRACE neutron.api.v2.resource ValueError: invalid literal for int() with base 10: 'fg'

This is the exception trace.
I have a fix for this issue which i would be pushing out shortly.

Changed in neutron:
status: Incomplete → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/112031

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/112031
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=6b8a5f0e1d26d2721e7ad7fc67099ff8b880d9ec
Submitter: Jenkins
Branch: master

commit 6b8a5f0e1d26d2721e7ad7fc67099ff8b880d9ec
Author: Sudipta Biswas <email address hidden>
Date: Tue Aug 5 19:40:06 2014 +0530

    Fix to throw correct error code for bad attribute

    Currently the neutron network API throws up error code 500 for
    the extended attribute for segmentation id. This can be reproduced
    if the user types in a random string in place of an integer value
    for the segmentation id. The proper behavior should throw an error
    code 400 with the appropriate failure message. This patch fixes the
    same issue and covers it with a test case.

    Change-Id: I4735e20f5b8b23c5b2a9d896415c2e84561a279c
    Closes-bug: #1348056

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: juno-3 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.