Merge "Enable to select specific network service type"

This commit is contained in:
Jenkins
2014-03-14 18:31:21 +00:00
committed by Gerrit Code Review
5 changed files with 16 additions and 0 deletions

View File

@@ -99,6 +99,7 @@ class HTTPClient(httplib2.Http):
endpoint_url=None, insecure=False,
endpoint_type='publicURL',
auth_strategy='keystone', ca_cert=None, log_credentials=False,
service_type='network',
**kwargs):
super(HTTPClient, self).__init__(timeout=timeout, ca_certs=ca_cert)
@@ -107,6 +108,7 @@ class HTTPClient(httplib2.Http):
self.tenant_id = tenant_id
self.password = password
self.auth_url = auth_url.rstrip('/') if auth_url else None
self.service_type = service_type
self.endpoint_type = endpoint_type
self.region_name = region_name
self.auth_token = token
@@ -210,6 +212,7 @@ class HTTPClient(httplib2.Http):
if not self.endpoint_url:
self.endpoint_url = self.service_catalog.url_for(
attr='region', filter_value=self.region_name,
service_type=self.service_type,
endpoint_type=self.endpoint_type)
def authenticate(self):

View File

@@ -60,10 +60,12 @@ class ClientManager(object):
insecure=False,
ca_cert=None,
log_credentials=False,
service_type=None,
):
self._token = token
self._url = url
self._auth_url = auth_url
self._service_type = service_type
self._endpoint_type = endpoint_type
self._tenant_name = tenant_name
self._tenant_id = tenant_id
@@ -87,6 +89,7 @@ class ClientManager(object):
password=self._password,
region_name=self._region_name,
auth_url=self._auth_url,
service_type=self._service_type,
endpoint_type=self._endpoint_type,
insecure=self._insecure,
ca_cert=self._ca_cert,

View File

@@ -426,6 +426,11 @@ class NeutronShell(app.App):
'--os_token',
help=argparse.SUPPRESS)
parser.add_argument(
'--service-type', metavar='<service-type>',
default=env('OS_NETWORK_SERVICE_TYPE', default='network'),
help=_('Defaults to env[OS_NETWORK_SERVICE_TYPE] or network.'))
parser.add_argument(
'--endpoint-type', metavar='<endpoint-type>',
default=env('OS_ENDPOINT_TYPE', default='publicURL'),
@@ -617,6 +622,7 @@ class NeutronShell(app.App):
region_name=self.options.os_region_name,
api_version=self.api_version,
auth_strategy=self.options.os_auth_strategy,
service_type=self.options.service_type,
endpoint_type=self.options.endpoint_type,
insecure=self.options.insecure,
ca_cert=self.options.os_cacert,

View File

@@ -51,6 +51,7 @@ class TestSSL(testtools.TestCase):
api_version=mox.IgnoreArg(),
auth_strategy=mox.IgnoreArg(),
auth_url=mox.IgnoreArg(),
service_type=mox.IgnoreArg(),
endpoint_type=mox.IgnoreArg(),
insecure=mox.IgnoreArg(),
password=mox.IgnoreArg(),
@@ -80,6 +81,7 @@ class TestSSL(testtools.TestCase):
api_version=mox.IgnoreArg(),
auth_strategy=mox.IgnoreArg(),
auth_url=mox.IgnoreArg(),
service_type=mox.IgnoreArg(),
endpoint_type=mox.IgnoreArg(),
insecure=mox.IgnoreArg(),
password=mox.IgnoreArg(),

View File

@@ -121,6 +121,8 @@ class Client(object):
:param string tenant_name: Tenant name. (optional)
:param string tenant_id: Tenant id. (optional)
:param string auth_url: Keystone service endpoint for authorization.
:param string service_type: Network service type to pull from the
keystone catalog (e.g. 'network') (optional)
:param string endpoint_type: Network service endpoint type to pull from the
keystone catalog (e.g. 'publicURL',
'internalURL', or 'adminURL') (optional)