How-To: Make Contrail Python API Library Work Without Authentication
Distinguished Expert

How-To: Make Contrail Python API Library Work Without Authentication

by Distinguished Expert on ‎12-16-2015 09:28 AM - edited on ‎09-19-2017 10:27 AM by Administrator Administrator (3,285 Views)


Examples provided in Contrail Configuration API server documentation at

assume no authentication of the incoming API connection. However recent versions of Contrail (such as 2.21) require authentication of API requests by default.


By default, API calls require authentication. For the sake of lab testing, it is possible to disable this authentication.


root@openstack:~# cat /etc/contrail/contrail-api.conf | grep auth

auth = keystone


Replace "keystone" with "none" and restart.


Here is an example Python session that no longer requires authentication:


root@openstack:~# python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from vnc_api import vnc_api
>>> vnc_lib = vnc_api.VncApi()
>>> print(vnc_lib.virtual_networks_list())
{u'virtual-networks': [{u'href': u'', u'fq_name': [u'default-domain', u'default-project', u'__link_local__'], u'uuid': u'a3169c4b-ebb9-4b45-8452-9ad6a4de3c9f'}, {u'href': u'', u'fq_name': [u'default-domain', u'demo', u'VN-B'], u'uuid': u'ab93c42b-f24d-4b1f-9cd9-5306b5bda0bd'}, {u'href': u'', u'fq_name': [u'default-domain', u'demo', u'svc-vn-left'], u'uuid': u'0719a959-c0a2-4264-a67d-8a30a9eb8628'}, {u'href': u'', u'fq_name': [u'default-domain', u'default-project', u'ip-fabric'], u'uuid': u'ce2439e9-9aca-4de0-b1e0-088bd42dbec1'}, {u'href': u'', u'fq_name': [u'default-domain', u'demo', u'VN-A'], u'uuid': u'00105e7a-8b23-4333-afb4-d83d508cf5cd'}, {u'href': u'', u'fq_name': [u'default-domain', u'default-project', u'default-virtual-network'], u'uuid': u'bf5d86d4-12dd-49e4-bee2-3cb906b9c942'}, {u'href': u'', u'fq_name': [u'default-domain', u'demo', u'Ext'], u'uuid': u'f63f3f86-8d41-4d08-9892-bb4dfca85c29'}]}