Steps to repro:
==============
1. Go to Configure->Infrastructure->Global Config->Bgp Options.
2. click the Edit BGp Options button.
3. Fill all the values and save it.
While trying to save getting the key error. Issue is seen 4.0 - build 25
From contrail-webui-stdout.log:
==============================
07/26/2017 08:47:49 AM - error: URL [http://10.204.217.81:8082/global-system-config/b6b68682-53af-422f-a1f8-2eac96beff5f] returned error ["<type 'exceptions.KeyError'>\nPython 2.7.6: /usr/bin/python\nWed Jul 26 08:47:49 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='global_system_config', obj_uuid='b6b68682-53af-422f-a1f8-2eac96beff5f', db_obj_dict={'autonomous_system': 64512, 'config_version': '1.0', 'fq_name': ['default-global-system-config'], 'id_perms': {'created': '2017-07-21T09:49:59.586024', 'creator': None, 'description': None, 'enable': True, 'last_modified': '2017-07-24T20:15:20.189658', 'permissions': {'group': 'cloud-admin-group', 'group_access': 7, 'other_access': 7, 'owner': 'cloud-admin', 'owner_access': 7}, 'user_visible': True, 'uuid': {'uuid_lslong': 11671129753128992607L, 'uuid_mslong': 13165858454972088879L}}, 'mac_aging_time': 300, 'perms2': {'global_access': 0, 'owner': 'cloud-admin', 'owner_access': 7, 'share': []}, 'user_defined_log_statistics': {u'statlist': [{'name': 'stats_log', 'pattern': 'error'}]}, 'uuid': 'b6b68682-53af-422f-a1f8-2eac96beff5f'}, req_obj_dict={'autonomous_system': 65534, 'graceful_restart_parameters': {'bgp_helper_enable': False, 'enable': True, 'end_of_rib_timeout': 60, 'long_lived_restart_time': 600, 'restart_time': 120}, 'ibgp_auto_mesh': False, 'ip_fabric_subnets': {'subnet': [{'ip_prefix': '1.1.1.1', 'ip_prefix_len': 24}]}, 'uuid': 'b6b68682-53af-422f-a1f8-2eac96beff5f'}, req_prop_coll_updates=None, ref_args=None)\n 3093 \n 3094 try:\n 3095 ok, result = stateful_update()\n 3096 except Exception as e:\n 3097 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 3057 (ok, result) = r_class.pre_dbe_update(\n 3058 obj_uuid, obj_fq_name, req_obj_dict or {}, self._db_conn,\n 3059 prop_collection_updates=req_prop_coll_updates)\n 3060 if not ok:\n 3061 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.GlobalSystemConfigServer'>, id='b6b68682-53af-422f-a1f8-2eac96beff5f', fq_name=['default-global-system-config'], obj_dict={'autonomous_system': 65534, 'graceful_restart_parameters': {'bgp_helper_enable': False, 'enable': True, 'end_of_rib_timeout': 60, 'long_lived_restart_time': 600, 'restart_time': 120}, 'ibgp_auto_mesh': False, 'ip_fabric_subnets': {'subnet': [{'ip_prefix': '1.1.1.1', 'ip_prefix_len': 24}]}, 'uuid': 'b6b68682-53af-422f-a1f8-2eac96beff5f'}, db_conn=<vnc_cfg_api_server.vnc_db.VncDbClient object>, **kwargs={'prop_collection_updates': None})\n 216 if not ok:\n 217 return ok, result\n 218 ok, result = cls._check_asn(obj_dict, db_conn)\n 219 if not ok:\n 220 return ok, result\nok = True\nresult = ''\ncls = <class 'vnc_cfg_api_server.vnc_cfg_types.GlobalSystemConfigServer'>\ncls._check_asn = <bound method type._check_asn of <class 'vnc_cfg..._server.vnc_cfg_types.GlobalSystemConfigServer'>>\nobj_dict = {'autonomous_system': 65534, 'graceful_restart_parameters': {'bgp_helper_enable': False, 'enable': True, 'end_of_rib_timeout': 60, 'long_lived_restart_time': 600, 'restart_time': 120}, 'ibgp_auto_mesh': False, 'ip_fabric_subnets': {'subnet': [{'ip_prefix': '1.1.1.1', 'ip_prefix_len': 24}]}, 'uuid': 'b6b68682-53af-422f-a1f8-2eac96beff5f'}\ndb_conn = <vnc_cfg_api_server.vnc_db.VncDbClient object>\n\n /usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py in _check_asn(cls=<class 'vnc_cfg_api_server.vnc_cfg_types.GlobalSystemConfigServer'>, obj_dict={'autonomous_system': 65534, 'graceful_restart_parameters': {'bgp_helper_enable': False, 'enable': True, 'end_of_rib_timeout': 60, 'long_lived_restart_time': 600, 'restart_time': 120}, 'ibgp_auto_mesh': False, 'ip_fabric_subnets': {'subnet': [{'ip_prefix': '1.1.1.1', 'ip_prefix_len': 24}]}, 'uuid': 'b6b68682-53af-422f-a1f8-2eac96beff5f'}, db_conn=<vnc_cfg_api_server.vnc_db.VncDbClient object>)\n 173 \"with a route target with this ASN and route \"\n 174 \"target value in the same range as used by \"\n 175 \"automatically allocated route targets\" % vn['name']))\n 176 return (True, '')\n 177 # end _check_asn\nvn = {'fq_name': ['default-domain', 'ctest-WebuiTestSanity-36007785', 'vnet1'], 'parent_type': 'project', 'parent_uuid': '5a846cdc-f8f1-49b1-aea5-64a42755af5c', 'route_target_list': {'route_target': ['target:65534:4294967295']}, 'uuid': 'fb705fd8-ac3c-4e9d-abc5-5d71469217f8'}\n<type 'exceptions.KeyError'>: 'name'\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 = ('name',)\n message = 'name'\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 3095, 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 3059, 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 218, in pre_dbe_update\n ok, result = cls._check_asn(obj_dict, db_conn)\n File \"/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py\", line 175, in _check_asn\n \"automatically allocated route targets\" % vn['name']))\nKeyError: 'name'\n\n\n"]
07/26/2017 08:47:49 AM - error: REST Server Error: <type 'exceptions.KeyError'>
Python 2.7.6: /usr/bin/python
Wed Jul 26 08:47:49 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='global_system_config', obj_uuid='b6b68682-53af-422f-a1f8-2eac96beff5f', db_obj_dict={'autonomous_system': 64512, 'config_version': '1.0', 'fq_name': ['default-global-system-config'], 'id_perms': {'created': '2017-07-21T09:49:59.586024', 'creator': None, 'description': None, 'enable': True, 'last_modified': '2017-07-24T20:15:20.189658', 'permissions': {'group': 'cloud-admin-group', 'group_access': 7, 'other_access': 7, 'owner': 'cloud-admin', 'owner_access': 7}, 'user_visible': True, 'uuid': {'uuid_lslong': 11671129753128992607L, 'uuid_mslong': 13165858454972088879L}}, 'mac_aging_time': 300, 'perms2': {'global_access': 0, 'owner': 'cloud-admin', 'owner_access': 7, 'share': []}, 'user_defined_log_statistics': {u'statlist': [{'name': 'stats_log', 'pattern': 'error'}]}, 'uuid': 'b6b68682-53af-422f-a1f8-2eac96beff5f'}, req_obj_dict={'autonomous_system': 65534, 'graceful_restart_parameters': {'bgp_helper_enable': False, 'enable': True, 'end_of_rib_timeout': 60, 'long_lived_restart_time': 600, 'restart_time': 120}, 'ibgp_auto_mesh': False, 'ip_fabric_subnets': {'subnet': [{'ip_prefix': '1.1.1.1', 'ip_prefix_len': 24}]}, 'uuid': 'b6b68682-53af-422f-a1f8-2eac96beff5f'}, req_prop_coll_updates=None, ref_args=None)
3093
3094 try:
3095 ok, result = stateful_update()
3096 except Exception as e:
3097 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()
3057 (ok, result) = r_class.pre_dbe_update(
3058 obj_uuid, obj_fq_name, req_obj_dict or {}, self._db_conn,
3059 prop_collection_updates=req_prop_coll_updates)
3060 if not ok:
3061 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.GlobalSystemConfigServer'>, id='b6b68682-53af-422f-a1f8-2eac96beff5f', fq_name=['default-global-system-config'], obj_dict={'autonomous_system': 65534, 'graceful_restart_parameters': {'bgp_helper_enable': False, 'enable': True, 'end_of_rib_timeout': 60, 'long_lived_restart_time': 600, 'restart_time': 120}, 'ibgp_auto_mesh': False, 'ip_fabric_subnets': {'subnet': [{'ip_prefix': '1.1.1.1', 'ip_prefix_len': 24}]}, 'uuid': 'b6b68682-53af-422f-a1f8-2eac96beff5f'}, db_conn=<vnc_cfg_api_server.vnc_db.VncDbClient object>, **kwargs={'prop_collection_updates': None})
216 if not ok:
217 return ok, result
218 ok, result = cls._check_asn(obj_dict, db_conn)
219 if not ok:
220 return ok, result
ok = True
result = ''
cls = <class 'vnc_cfg_api_server.vnc_cfg_types.GlobalSystemConfigServer'>
cls._check_asn = <bound method type._check_asn of <class 'vnc_cfg..._server.vnc_cfg_types.GlobalSystemConfigServer'>>
obj_dict = {'autonomous_system': 65534, 'graceful_restart_parameters': {'bgp_helper_enable': False, 'enable': True, 'end_of_rib_timeout': 60, 'long_lived_restart_time': 600, 'restart_time': 120}, 'ibgp_auto_mesh': False, 'ip_fabric_subnets': {'subnet': [{'ip_prefix': '1.1.1.1', 'ip_prefix_len': 24}]}, 'uuid': 'b6b68682-53af-422f-a1f8-2eac96beff5f'}
db_conn = <vnc_cfg_api_server.vnc_db.VncDbClient object>
/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py in _check_asn(cls=<class 'vnc_cfg_api_server.vnc_cfg_types.GlobalSystemConfigServer'>, obj_dict={'autonomous_system': 65534, 'graceful_restart_parameters': {'bgp_helper_enable': False, 'enable': True, 'end_of_rib_timeout': 60, 'long_lived_restart_time': 600, 'restart_time': 120}, 'ibgp_auto_mesh': False, 'ip_fabric_subnets': {'subnet': [{'ip_prefix': '1.1.1.1', 'ip_prefix_len': 24}]}, 'uuid': 'b6b68682-53af-422f-a1f8-2eac96beff5f'}, db_conn=<vnc_cfg_api_server.vnc_db.VncDbClient object>)
173 "with a route target with this ASN and route "
174 "target value in the same range as used by "
175 "automatically allocated route targets" % vn['name']))
176 return (True, '')
177 # end _check_asn
vn = {'fq_name': ['default-domain', 'ctest-WebuiTestSanity-36007785', 'vnet1'], 'parent_type': 'project', 'parent_uuid': '5a846cdc-f8f1-49b1-aea5-64a42755af5c', 'route_target_list': {'route_target': ['target:65534:4294967295']}, 'uuid': 'fb705fd8-ac3c-4e9d-abc5-5d71469217f8'}
<type 'exceptions.KeyError'>: 'name'
__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 = ('name',)
message = 'name'
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 3095, in _put_common
ok, result = stateful_update()
File "/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_api_server.py", line 3059, 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 218, in pre_dbe_update
ok, result = cls._check_asn(obj_dict, db_conn)
File "/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py", line 175, in _check_asn
"automatically allocated route targets" % vn['name']))
KeyError: 'name'
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:325:18)
at Request.emit (events.js:98:17)
at Request.mixin._fireSuccess (/usr/lib64/node_modules/restler/lib/restler.js:226:10)
at /usr/lib64/node_modules/restler/lib/restler.js:157:20
at IncomingMessage.parsers.auto (/usr/lib64/node_modules/restler/lib/restler.js:390:7)
at Request.mixin._encode (/usr/lib64/node_modules/restler/lib/restler.js:194:29)
at /usr/lib64/node_modules/restler/lib/restler.js:153:16
at Request.mixin._decode (/usr/lib64/node_modules/restler/lib/restler.js:169:7)
at IncomingMessage.<anonymous> (/usr/lib64/node_modules/restler/lib/restler.js:146:14)
Review in progress for https:/ /review. opencontrail. org/34090
Submitter: Sachin Bansal (<email address hidden>)