Web-UI exception while configuring subnet and Allocation pool for virtual-router through Config Editor.
Steps
----
1. Create a flat-subnet IPAM, create a vrouter specific allocation pool
2. Configure subnet and Allocation pool on virtual-routers through config Editor.
Above step is failing with following exception and web-UI error snapshot is attached .
Build Info
---------
4.1.0.0-27 Mitaka
Please see log below:
10/27/2017 04:52:28 PM - error: URL [http://10.204.217.127:8082/virtual-router/cc15ffd5-2008-4060-bc79-0dc3a3b3f6be] returned error ["<type 'exceptions.KeyError'>\nPython 2.7.6: /usr/bin/python\nFri Oct 27 16:52:28 2017\n\nA problem occurred in a Python script. Here is the sequence of\nfunction calls leading up to the error, in the order they occurred.\n\n /usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_api_server.py in _put_common(self=<vnc_cfg_api_server.vnc_cfg_api_server.VncApiServer object>, api_name='http_put', obj_type='virtual_router', obj_uuid='cc15ffd5-2008-4060-bc79-0dc3a3b3f6be', db_obj_dict={'display_name': 'nodek11', 'fq_name': ['default-global-system-config', 'nodek11'], 'id_perms': {'created': '2017-10-27T07:53:32.191127', 'creator': None, 'description': None, 'enable': True, 'last_modified': '2017-10-27T11:06:19.356666', 'permissions': {'group': 'admin', 'group_access': 7, 'other_access': 7, 'owner': 'cloud-admin', 'owner_access': 7}, 'user_visible': True, 'uuid': {'uuid_lslong': 13580901285228705470L, 'uuid_mslong': 14705941449078751328L}}, 'parent_type': 'global-system-config', 'parent_uuid': '52bed2b0-d2cf-4353-9fd4-2f1c0919758b', 'perms2': {'global_access': 0, 'owner': 'cloud-admin', 'owner_access': 7, 'share': []}, 'uuid': 'cc15ffd5-2008-4060-bc79-0dc3a3b3f6be', 'virtual_router_dpdk_enabled': False, 'virtual_router_ip_address': '10.204.216.231'}, req_obj_dict={'network_ipam_refs': [{'attr': {'allocation_pools': [{'end': '11.1.1.18', 'start': '11.1.1.16', 'vrouter_specific_pool': True}], 'subnet': [{'ip_prefix': '11.1.1.0', 'ip_prefix_len': 24}]}, 'to': ['default-domain', 'admin', 'ipam0']}], 'uuid': 'cc15ffd5-2008-4060-bc79-0dc3a3b3f6be'}, req_prop_coll_updates=None, ref_args=None, quota_dict=None)\n 3399 \n 3400 try:\n 3401 ok, result = stateful_update()\n 3402 except Exception as e:\n 3403 ok = False\nok = False\nresult = 'RWX'\nstateful_update = <function stateful_update>\n\n /usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_api_server.py in stateful_update()\n 3355 (ok, result) = r_class.pre_dbe_update(\n 3356 obj_uuid, obj_fq_name, req_obj_dict or {}, self._db_conn,\n 3357 prop_collection_updates=req_prop_coll_updates)\n 3358 if not ok:\n 3359 return (ok, result)\nprop_collection_updates undefined\nreq_prop_coll_updates = None\n\n /usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py in pre_dbe_update(cls=<class 'vnc_cfg_api_server.vnc_cfg_types.VirtualRouterServer'>, id='cc15ffd5-2008-4060-bc79-0dc3a3b3f6be', fq_name=['default-global-system-config', 'nodek11'], obj_dict={'network_ipam_refs': [{'attr': {'allocation_pools': [{'end': '11.1.1.18', 'start': '11.1.1.16', 'vrouter_specific_pool': True}], 'subnet': [{'ip_prefix': '11.1.1.0', 'ip_prefix_len': 24}]}, 'to': ['default-domain', 'admin', 'ipam0']}], 'uuid': 'cc15ffd5-2008-4060-bc79-0dc3a3b3f6be'}, db_conn=<vnc_cfg_api_server.vnc_db.VncDbClient object>, **kwargs={'prop_collection_updates': None})\n 2061 (ok, result) = cls._validate_vrouter_alloc_pools(obj_dict,\n 2062 db_conn,\n 2063 ipam_refs)\n 2064 if not ok:\n 2065 return (False, (400, result))\nipam_refs = [{'attr': {'allocation_pools': [{'end': '11.1.1.18', 'start': '11.1.1.16', 'vrouter_specific_pool': True}], 'subnet': [{'ip_prefix': '11.1.1.0', 'ip_prefix_len': 24}]}, 'to': ['default-domain', 'admin', 'ipam0']}]\n\n /usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py in _validate_vrouter_alloc_pools(cls=<class 'vnc_cfg_api_server.vnc_cfg_types.VirtualRouterServer'>, vrouter_dict={'network_ipam_refs': [{'attr': {'allocation_pools': [{'end': '11.1.1.18', 'start': '11.1.1.16', 'vrouter_specific_pool': True}], 'subnet': [{'ip_prefix': '11.1.1.0', 'ip_prefix_len': 24}]}, 'to': ['default-domain', 'admin', 'ipam0']}], 'uuid': 'cc15ffd5-2008-4060-bc79-0dc3a3b3f6be'}, db_conn=<vnc_cfg_api_server.vnc_db.VncDbClient object>, ipam_refs=[{'attr': {'allocation_pools': [{'end': '11.1.1.18', 'start': '11.1.1.16', 'vrouter_specific_pool': True}], 'subnet': [{'ip_prefix': '11.1.1.0', 'ip_prefix_len': 24}]}, 'to': ['default-domain', 'admin', 'ipam0']}])\n 1976 return True, ''\n 1977 \n 1978 ipam_uuid_list = [(ipam_ref['uuid']) for ipam_ref in ipam_refs]\n 1979 (ok, ipam_list, _) = db_conn.dbe_list('network_ipam',\n 1980 obj_uuids=ipam_uuid_list,\nipam_uuid_list undefined\nipam_ref = {'attr': {'allocation_pools': [{'end': '11.1.1.18', 'start': '11.1.1.16', 'vrouter_specific_pool': True}], 'subnet': [{'ip_prefix': '11.1.1.0', 'ip_prefix_len': 24}]}, 'to': ['default-domain', 'admin', 'ipam0']}\nipam_refs = [{'attr': {'allocation_pools': [{'end': '11.1.1.18', 'start': '11.1.1.16', 'vrouter_specific_pool': True}], 'subnet': [{'ip_prefix': '11.1.1.0', 'ip_prefix_len': 24}]}, 'to': ['default-domain', 'admin', 'ipam0']}]\n<type 'exceptions.KeyError'>: 'uuid'\n __class__ = <type 'exceptions.KeyError'>\n __delattr__ = <method-wrapper '__delattr__' of exceptions.KeyError object>\n __dict__ = {}\n __doc__ = 'Mapping key not found.'\n __format__ = <built-in method __format__ of exceptions.KeyError object>\n __getattribute__ = <method-wrapper '__getattribute__' of exceptions.KeyError object>\n __getitem__ = <method-wrapper '__getitem__' of exceptions.KeyError object>\n __getslice__ = <method-wrapper '__getslice__' of exceptions.KeyError object>\n __hash__ = <method-wrapper '__hash__' of exceptions.KeyError object>\n __init__ = <method-wrapper '__init__' of exceptions.KeyError object>\n __new__ = <built-in method __new__ of type object>\n __reduce__ = <built-in method __reduce__ of exceptions.KeyError object>\n __reduce_ex__ = <built-in method __reduce_ex__ of exceptions.KeyError object>\n __repr__ = <method-wrapper '__repr__' of exceptions.KeyError object>\n __setattr__ = <method-wrapper '__setattr__' of exceptions.KeyError object>\n __setstate__ = <built-in method __setstate__ of exceptions.KeyError object>\n __sizeof__ = <built-in method __sizeof__ of exceptions.KeyError object>\n __str__ = <method-wrapper '__str__' of exceptions.KeyError object>\n __subclasshook__ = <built-in method __subclasshook__ of type object>\n __unicode__ = <built-in method __unicode__ of exceptions.KeyError object>\n args = ('uuid',)\n message = 'uuid'\n\nThe above is a description of an error in a Python program. Here is\nthe original traceback:\n\nTraceback (most recent call last):\n File \"/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_api_server.py\", line 3401, in _put_common\n ok, result = stateful_update()\n File \"/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_api_server.py\", line 3357, in stateful_update\n prop_collection_updates=req_prop_coll_updates)\n File \"/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py\", line 2063, in pre_dbe_update\n ipam_refs)\n File \"/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py\", line 1978, in _validate_vrouter_alloc_pools\n ipam_uuid_list = [(ipam_ref['uuid']) for ipam_ref in ipam_refs]\nKeyError: 'uuid'\n\n\n"]
10/27/2017 04:52:28 PM - error: REST Server Error: <type 'exceptions.KeyError'>
Python 2.7.6: /usr/bin/python
Fri Oct 27 16:52:28 2017
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_cfg_api_server/vnc_cfg_api_server.py in _put_common(self=<vnc_cfg_api_server.vnc_cfg_api_server.VncApiServer object>, api_name='http_put', obj_type='virtual_router', obj_uuid='cc15ffd5-2008-4060-bc79-0dc3a3b3f6be', db_obj_dict={'display_name': 'nodek11', 'fq_name': ['default-global-system-config', 'nodek11'], 'id_perms': {'created': '2017-10-27T07:53:32.191127', 'creator': None, 'description': None, 'enable': True, 'last_modified': '2017-10-27T11:06:19.356666', 'permissions': {'group': 'admin', 'group_access': 7, 'other_access': 7, 'owner': 'cloud-admin', 'owner_access': 7}, 'user_visible': True, 'uuid': {'uuid_lslong': 13580901285228705470L, 'uuid_mslong': 14705941449078751328L}}, 'parent_type': 'global-system-config', 'parent_uuid': '52bed2b0-d2cf-4353-9fd4-2f1c0919758b', 'perms2': {'global_access': 0, 'owner': 'cloud-admin', 'owner_access': 7, 'share': []}, 'uuid': 'cc15ffd5-2008-4060-bc79-0dc3a3b3f6be', 'virtual_router_dpdk_enabled': False, 'virtual_router_ip_address': '10.204.216.231'}, req_obj_dict={'network_ipam_refs': [{'attr': {'allocation_pools': [{'end': '11.1.1.18', 'start': '11.1.1.16', 'vrouter_specific_pool': True}], 'subnet': [{'ip_prefix': '11.1.1.0', 'ip_prefix_len': 24}]}, 'to': ['default-domain', 'admin', 'ipam0']}], 'uuid': 'cc15ffd5-2008-4060-bc79-0dc3a3b3f6be'}, req_prop_coll_updates=None, ref_args=None, quota_dict=None)
3399
3400 try:
3401 ok, result = stateful_update()
3402 except Exception as e:
3403 ok = False
ok = False
result = 'RWX'
stateful_update = <function stateful_update>
/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_api_server.py in stateful_update()
3355 (ok, result) = r_class.pre_dbe_update(
3356 obj_uuid, obj_fq_name, req_obj_dict or {}, self._db_conn,
3357 prop_collection_updates=req_prop_coll_updates)
3358 if not ok:
3359 return (ok, result)
prop_collection_updates undefined
req_prop_coll_updates = None
/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py in pre_dbe_update(cls=<class 'vnc_cfg_api_server.vnc_cfg_types.VirtualRouterServer'>, id='cc15ffd5-2008-4060-bc79-0dc3a3b3f6be', fq_name=['default-global-system-config', 'nodek11'], obj_dict={'network_ipam_refs': [{'attr': {'allocation_pools': [{'end': '11.1.1.18', 'start': '11.1.1.16', 'vrouter_specific_pool': True}], 'subnet': [{'ip_prefix': '11.1.1.0', 'ip_prefix_len': 24}]}, 'to': ['default-domain', 'admin', 'ipam0']}], 'uuid': 'cc15ffd5-2008-4060-bc79-0dc3a3b3f6be'}, db_conn=<vnc_cfg_api_server.vnc_db.VncDbClient object>, **kwargs={'prop_collection_updates': None})
2061 (ok, result) = cls._validate_vrouter_alloc_pools(obj_dict,
2062 db_conn,
2063 ipam_refs)
2064 if not ok:
2065 return (False, (400, result))
ipam_refs = [{'attr': {'allocation_pools': [{'end': '11.1.1.18', 'start': '11.1.1.16', 'vrouter_specific_pool': True}], 'subnet': [{'ip_prefix': '11.1.1.0', 'ip_prefix_len': 24}]}, 'to': ['default-domain', 'admin', 'ipam0']}]
/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py in _validate_vrouter_alloc_pools(cls=<class 'vnc_cfg_api_server.vnc_cfg_types.VirtualRouterServer'>, vrouter_dict={'network_ipam_refs': [{'attr': {'allocation_pools': [{'end': '11.1.1.18', 'start': '11.1.1.16', 'vrouter_specific_pool': True}], 'subnet': [{'ip_prefix': '11.1.1.0', 'ip_prefix_len': 24}]}, 'to': ['default-domain', 'admin', 'ipam0']}], 'uuid': 'cc15ffd5-2008-4060-bc79-0dc3a3b3f6be'}, db_conn=<vnc_cfg_api_server.vnc_db.VncDbClient object>, ipam_refs=[{'attr': {'allocation_pools': [{'end': '11.1.1.18', 'start': '11.1.1.16', 'vrouter_specific_pool': True}], 'subnet': [{'ip_prefix': '11.1.1.0', 'ip_prefix_len': 24}]}, 'to': ['default-domain', 'admin', 'ipam0']}])
1976 return True, ''
1977
1978 ipam_uuid_list = [(ipam_ref['uuid']) for ipam_ref in ipam_refs]
1979 (ok, ipam_list, _) = db_conn.dbe_list('network_ipam',
1980 obj_uuids=ipam_uuid_list,
ipam_uuid_list undefined
ipam_ref = {'attr': {'allocation_pools': [{'end': '11.1.1.18', 'start': '11.1.1.16', 'vrouter_specific_pool': True}], 'subnet': [{'ip_prefix': '11.1.1.0', 'ip_prefix_len': 24}]}, 'to': ['default-domain', 'admin', 'ipam0']}
ipam_refs = [{'attr': {'allocation_pools': [{'end': '11.1.1.18', 'start': '11.1.1.16', 'vrouter_specific_pool': True}], 'subnet': [{'ip_prefix': '11.1.1.0', 'ip_prefix_len': 24}]}, 'to': ['default-domain', 'admin', 'ipam0']}]
<type 'exceptions.KeyError'>: 'uuid'
__class__ = <type 'exceptions.KeyError'>
__delattr__ = <method-wrapper '__delattr__' of exceptions.KeyError object>
__dict__ = {}
__doc__ = 'Mapping key not found.'
__format__ = <built-in method __format__ of exceptions.KeyError object>
__getattribute__ = <method-wrapper '__getattribute__' of exceptions.KeyError object>
__getitem__ = <method-wrapper '__getitem__' of exceptions.KeyError object>
__getslice__ = <method-wrapper '__getslice__' of exceptions.KeyError object>
__hash__ = <method-wrapper '__hash__' of exceptions.KeyError object>
__init__ = <method-wrapper '__init__' of exceptions.KeyError object>
__new__ = <built-in method __new__ of type object>
__reduce__ = <built-in method __reduce__ of exceptions.KeyError object>
__reduce_ex__ = <built-in method __reduce_ex__ of exceptions.KeyError object>
__repr__ = <method-wrapper '__repr__' of exceptions.KeyError object>
__setattr__ = <method-wrapper '__setattr__' of exceptions.KeyError object>
__setstate__ = <built-in method __setstate__ of exceptions.KeyError object>
__sizeof__ = <built-in method __sizeof__ of exceptions.KeyError object>
__str__ = <method-wrapper '__str__' of exceptions.KeyError object>
__subclasshook__ = <built-in method __subclasshook__ of type object>
__unicode__ = <built-in method __unicode__ of exceptions.KeyError object>
args = ('uuid',)
message = 'uuid'
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_cfg_api_server/vnc_cfg_api_server.py", line 3401, in _put_common
ok, result = stateful_update()
File "/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_api_server.py", line 3357, in stateful_update
prop_collection_updates=req_prop_coll_updates)
File "/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py", line 2063, in pre_dbe_update
ipam_refs)
File "/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py", line 1978, in _validate_vrouter_alloc_pools
ipam_uuid_list = [(ipam_ref['uuid']) for ipam_ref in ipam_refs]
KeyError: 'uuid'
at APIServer.retryMakeCall (/usr/src/contrail/contrail-web-core/src/serverroot/common/rest.api.js:202:13)
at Request.<anonymous> (/usr/src/contrail/contrail-web-core/src/serverroot/common/rest.api.js:333:18)
at Request.emit (events.js:98:17)
at Request.mixin._fireSuccess (/usr/lib64/node_modules/restler/lib/restler.js:250:10)
at /usr/lib64/node_modules/restler/lib/restler.js:181:20
at IncomingMessage.parsers.auto (/usr/lib64/node_modules/restler/lib/restler.js:414:7)
at Request.mixin._encode (/usr/lib64/node_modules/restler/lib/restler.js:218:29)
at /usr/lib64/node_modules/restler/lib/restler.js:177:16
at Request.mixin._decode (/usr/lib64/node_modules/restler/lib/restler.js:193:7)
at IncomingMessage.<anonymous> (/usr/lib64/node_modules/restler/lib/restler.js:170:14)
In API Server, we should handle this by not relying on uuid from ipam_refs like way we deal with other refs.