While adding router interface, if subnet-id value is an empty dict, neutron throws internal server error

Bug #1348993 reported by Vedamurthy Joshi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Fix Committed
Low
Sachin Bansal

Bug Description

Build 1.10 2271

root@nodec22:~# curl -i http://10.204.217.109:9696/v2.0/routers/021581ea-3512-473b-ba53-ecc47c831d40/add_router_interface.json -X PUT -H "X-Auth-Token: <token>" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient" -d '{"subnet_id": {}}'
HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=UTF-8
Content-Length: 88
Date: Fri, 25 Jul 2014 09:05:53 GMT

{"NeutronError": "Request Failed: internal server error while processing your request."}root@nodec22:~#

This is seen on openvswitch setup as well
--------

<type 'exceptions.UnboundLocalError'>
Python 2.7.3: /usr/bin/python
Fri Jul 25 02:07:29 2014

A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.

 /usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_interface.py in plugin_add_router_interface(self=<vnc_openstack.neutron_plugin_interface.NeutronPluginInterface object>, context={u'is_admin': True, u'operation': u'ADDINTERFACE', u'roles': [u'admin'], u'tenant': u'33d0c02842f64ae5a0f3acec9a7537d5', u'tenant_id': u'33d0c02842f64ae5a0f3acec9a7537d5', u'type': u'router', u'user_id': u'b0671841b7674851af3ba50897f1affa'}, interface_info={u'fields': None, u'filters': None, u'id': u'021581ea-3512-473b-ba53-ecc47c831d40', u'resource': {u'subnet_id': {}}})
  811 subnet_id = interface_info['resource']['subnet_id']
  812 return cfgdb.add_router_interface(router_id,
  813 subnet_id=subnet_id)
  814 except Exception as e:
  815 cgitb.Hook(format="text").handle(sys.exc_info())
subnet_id = {}

 /usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_db.py in add_router_interface(self=<vnc_openstack.neutron_plugin_db.DBInterface object>, router_id=u'021581ea-3512-473b-ba53-ecc47c831d40', port_id=None, subnet_id={})
 3045 port_id = port['id']
 3046
 3047 self._set_snat_routing_table(router_obj, subnet['network_id'])
 3048 vmi_obj = self._vnc_lib.virtual_machine_interface_read(id=port_id)
 3049 router_obj.add_virtual_machine_interface(vmi_obj)
self = <vnc_openstack.neutron_plugin_db.DBInterface object>
self._set_snat_routing_table = <bound method DBInterface._set_snat_routing_tabl..._openstack.neutron_plugin_db.DBInterface object>>
router_obj = <vnc_api.gen.resource_client.LogicalRouter object>
subnet undefined
<type 'exceptions.UnboundLocalError'>: local variable 'subnet' referenced before assignment
    __class__ = <type 'exceptions.UnboundLocalError'>
    __delattr__ = <method-wrapper '__delattr__' of exceptions.UnboundLocalError object>
    __dict__ = {}
    __doc__ = 'Local name referenced but not bound to a value.'
    __format__ = <built-in method __format__ of exceptions.UnboundLocalError object>
    __getattribute__ = <method-wrapper '__getattribute__' of exceptions.UnboundLocalError object>
    __getitem__ = <method-wrapper '__getitem__' of exceptions.UnboundLocalError object>
    __getslice__ = <method-wrapper '__getslice__' of exceptions.UnboundLocalError object>
    __hash__ = <method-wrapper '__hash__' of exceptions.UnboundLocalError object>
    __init__ = <method-wrapper '__init__' of exceptions.UnboundLocalError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of exceptions.UnboundLocalError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of exceptions.UnboundLocalError object>
    __repr__ = <method-wrapper '__repr__' of exceptions.UnboundLocalError object>
    __setattr__ = <method-wrapper '__setattr__' of exceptions.UnboundLocalError object>
    __setstate__ = <built-in method __setstate__ of exceptions.UnboundLocalError object>
    __sizeof__ = <built-in method __sizeof__ of exceptions.UnboundLocalError object>
    __str__ = <method-wrapper '__str__' of exceptions.UnboundLocalError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __unicode__ = <built-in method __unicode__ of exceptions.UnboundLocalError object>
    args = ("local variable 'subnet' referenced before assignment",)
    message = "local variable 'subnet' referenced before assignment"

The above is a description of an error in a Python program. Here is
the original traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_interface.py", line 813, in plugin_add_router_interface
    subnet_id=subnet_id)
  File "/usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_db.py", line 3047, in add_router_interface
    self._set_snat_routing_table(router_obj, subnet['network_id'])
UnboundLocalError: local variable 'subnet' referenced before assignment

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/bottle.py", line 764, in _handle
    return route.call(**args)
  File "/usr/lib/python2.7/dist-packages/bottle.py", line 1575, in wrapper
    rv = callback(*a, **ka)
  File "/usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_interface.py", line 856, in plugin_http_post_router
    return self.plugin_add_router_interface(context, router)
  File "/usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_interface.py", line 816, in plugin_add_router_interface
    raise e
UnboundLocalError: local variable 'subnet' referenced before assignment
10.204.217.109 - - [2014-07-25 02:07:29] "POST /neutron/router HTTP/1.1" 500 156 0.019274

Tags: config
Sachin Bansal (sbansal)
Changed in juniperopenstack:
status: New → In Progress
Revision history for this message
Sachin Bansal (sbansal) wrote :
summary: - While adding router interface, if subnet-id value is a dict, neutron
- throws internal server error
+ While adding router interface, if subnet-id value is an empty dict,
+ neutron throws internal server error
Changed in juniperopenstack:
status: In Progress → Fix Committed
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.