Enable to select specific network service type
Network service type is selected as 'network' statically. This will select the service_type from environment variables or CLI options. The option works like the service type option in the novaclient. Implements blueprint specify-service-type Change-Id: If21bd2b5cb35da5bcabca79aa0567870331a3a6f
This commit is contained in:
parent
fba38c6b27
commit
1cb7abd3be
neutronclient
@ -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
|
||||
@ -212,6 +214,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):
|
||||
|
@ -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,
|
||||
|
@ -414,6 +414,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'),
|
||||
@ -605,6 +610,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,
|
||||
|
@ -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(),
|
||||
|
@ -123,6 +123,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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user