Skip to content

Commit

Permalink
Authentication token url is added in vnc_api
Browse files Browse the repository at this point in the history
Contrail neutron plugin expects keystone authentication variables
which needs to be updated to support latest SKU's from neutron.
Hence adding auth_token_url in VncApi will rectify this issue.

Change-Id: I3770e2ba19eafd212df281c79a23c73029917adf
Partial-Bug: 1639927
  • Loading branch information
sahilsabharwal committed Dec 5, 2016
1 parent 28bbb3c commit 86c8c9e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/api-lib/vnc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __init__(self, username=None, password=None, tenant_name=None,
auth_token=None, auth_host=None, auth_port=None,
auth_protocol = None, auth_url=None, auth_type=None,
wait_for_connect=False, api_server_use_ssl=False,
domain_name=None):
domain_name=None, auth_token_url=None):
# TODO allow for username/password to be present in creds file

self._obj_serializer = self._obj_serializer_diff
Expand Down Expand Up @@ -194,6 +194,8 @@ def __init__(self, username=None, password=None, tenant_name=None,
self._domain_name = domain_name or \
_read_cfg(cfg_parser, 'auth', 'AUTHN_DOMAIN',
self._DEFAULT_DOMAIN_ID)
self._authn_token_url = auth_token_url or \
_read_cfg(cfg_parser, 'auth', 'AUTHN_TOKEN_URL', None)

#contrail-api SSL support
try:
Expand Down Expand Up @@ -552,7 +554,11 @@ def _create_api_server_session(self):
def _authenticate(self, response=None, headers=None):
if self._authn_type is None:
return headers
url = "%s://%s:%s%s" % (self._authn_protocol, self._authn_server, self._authn_port,

if self._authn_token_url:
url = self._authn_token_url
else:
url = "%s://%s:%s%s" % (self._authn_protocol, self._authn_server, self._authn_port,
self._authn_url)
new_headers = headers or {}
try:
Expand Down
1 change: 1 addition & 0 deletions src/api-lib/vnc_api_lib.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ BASE_URL = /
;AUTHN_SERVER = 127.0.0.1
;AUTHN_PORT = 35357
;AUTHN_URL = /v2.0/tokens
;AUTHN_TOKEN_URL = http://127.0.0.1:35357/v2.0/tokens

0 comments on commit 86c8c9e

Please sign in to comment.