Merge "Enable to select specific network service type"
This commit is contained in:
@@ -99,6 +99,7 @@ class HTTPClient(httplib2.Http):
|
|||||||
endpoint_url=None, insecure=False,
|
endpoint_url=None, insecure=False,
|
||||||
endpoint_type='publicURL',
|
endpoint_type='publicURL',
|
||||||
auth_strategy='keystone', ca_cert=None, log_credentials=False,
|
auth_strategy='keystone', ca_cert=None, log_credentials=False,
|
||||||
|
service_type='network',
|
||||||
**kwargs):
|
**kwargs):
|
||||||
super(HTTPClient, self).__init__(timeout=timeout, ca_certs=ca_cert)
|
super(HTTPClient, self).__init__(timeout=timeout, ca_certs=ca_cert)
|
||||||
|
|
||||||
@@ -107,6 +108,7 @@ class HTTPClient(httplib2.Http):
|
|||||||
self.tenant_id = tenant_id
|
self.tenant_id = tenant_id
|
||||||
self.password = password
|
self.password = password
|
||||||
self.auth_url = auth_url.rstrip('/') if auth_url else None
|
self.auth_url = auth_url.rstrip('/') if auth_url else None
|
||||||
|
self.service_type = service_type
|
||||||
self.endpoint_type = endpoint_type
|
self.endpoint_type = endpoint_type
|
||||||
self.region_name = region_name
|
self.region_name = region_name
|
||||||
self.auth_token = token
|
self.auth_token = token
|
||||||
@@ -210,6 +212,7 @@ class HTTPClient(httplib2.Http):
|
|||||||
if not self.endpoint_url:
|
if not self.endpoint_url:
|
||||||
self.endpoint_url = self.service_catalog.url_for(
|
self.endpoint_url = self.service_catalog.url_for(
|
||||||
attr='region', filter_value=self.region_name,
|
attr='region', filter_value=self.region_name,
|
||||||
|
service_type=self.service_type,
|
||||||
endpoint_type=self.endpoint_type)
|
endpoint_type=self.endpoint_type)
|
||||||
|
|
||||||
def authenticate(self):
|
def authenticate(self):
|
||||||
|
|||||||
@@ -60,10 +60,12 @@ class ClientManager(object):
|
|||||||
insecure=False,
|
insecure=False,
|
||||||
ca_cert=None,
|
ca_cert=None,
|
||||||
log_credentials=False,
|
log_credentials=False,
|
||||||
|
service_type=None,
|
||||||
):
|
):
|
||||||
self._token = token
|
self._token = token
|
||||||
self._url = url
|
self._url = url
|
||||||
self._auth_url = auth_url
|
self._auth_url = auth_url
|
||||||
|
self._service_type = service_type
|
||||||
self._endpoint_type = endpoint_type
|
self._endpoint_type = endpoint_type
|
||||||
self._tenant_name = tenant_name
|
self._tenant_name = tenant_name
|
||||||
self._tenant_id = tenant_id
|
self._tenant_id = tenant_id
|
||||||
@@ -87,6 +89,7 @@ class ClientManager(object):
|
|||||||
password=self._password,
|
password=self._password,
|
||||||
region_name=self._region_name,
|
region_name=self._region_name,
|
||||||
auth_url=self._auth_url,
|
auth_url=self._auth_url,
|
||||||
|
service_type=self._service_type,
|
||||||
endpoint_type=self._endpoint_type,
|
endpoint_type=self._endpoint_type,
|
||||||
insecure=self._insecure,
|
insecure=self._insecure,
|
||||||
ca_cert=self._ca_cert,
|
ca_cert=self._ca_cert,
|
||||||
|
|||||||
@@ -426,6 +426,11 @@ class NeutronShell(app.App):
|
|||||||
'--os_token',
|
'--os_token',
|
||||||
help=argparse.SUPPRESS)
|
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(
|
parser.add_argument(
|
||||||
'--endpoint-type', metavar='<endpoint-type>',
|
'--endpoint-type', metavar='<endpoint-type>',
|
||||||
default=env('OS_ENDPOINT_TYPE', default='publicURL'),
|
default=env('OS_ENDPOINT_TYPE', default='publicURL'),
|
||||||
@@ -617,6 +622,7 @@ class NeutronShell(app.App):
|
|||||||
region_name=self.options.os_region_name,
|
region_name=self.options.os_region_name,
|
||||||
api_version=self.api_version,
|
api_version=self.api_version,
|
||||||
auth_strategy=self.options.os_auth_strategy,
|
auth_strategy=self.options.os_auth_strategy,
|
||||||
|
service_type=self.options.service_type,
|
||||||
endpoint_type=self.options.endpoint_type,
|
endpoint_type=self.options.endpoint_type,
|
||||||
insecure=self.options.insecure,
|
insecure=self.options.insecure,
|
||||||
ca_cert=self.options.os_cacert,
|
ca_cert=self.options.os_cacert,
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ class TestSSL(testtools.TestCase):
|
|||||||
api_version=mox.IgnoreArg(),
|
api_version=mox.IgnoreArg(),
|
||||||
auth_strategy=mox.IgnoreArg(),
|
auth_strategy=mox.IgnoreArg(),
|
||||||
auth_url=mox.IgnoreArg(),
|
auth_url=mox.IgnoreArg(),
|
||||||
|
service_type=mox.IgnoreArg(),
|
||||||
endpoint_type=mox.IgnoreArg(),
|
endpoint_type=mox.IgnoreArg(),
|
||||||
insecure=mox.IgnoreArg(),
|
insecure=mox.IgnoreArg(),
|
||||||
password=mox.IgnoreArg(),
|
password=mox.IgnoreArg(),
|
||||||
@@ -80,6 +81,7 @@ class TestSSL(testtools.TestCase):
|
|||||||
api_version=mox.IgnoreArg(),
|
api_version=mox.IgnoreArg(),
|
||||||
auth_strategy=mox.IgnoreArg(),
|
auth_strategy=mox.IgnoreArg(),
|
||||||
auth_url=mox.IgnoreArg(),
|
auth_url=mox.IgnoreArg(),
|
||||||
|
service_type=mox.IgnoreArg(),
|
||||||
endpoint_type=mox.IgnoreArg(),
|
endpoint_type=mox.IgnoreArg(),
|
||||||
insecure=mox.IgnoreArg(),
|
insecure=mox.IgnoreArg(),
|
||||||
password=mox.IgnoreArg(),
|
password=mox.IgnoreArg(),
|
||||||
|
|||||||
@@ -121,6 +121,8 @@ class Client(object):
|
|||||||
:param string tenant_name: Tenant name. (optional)
|
:param string tenant_name: Tenant name. (optional)
|
||||||
:param string tenant_id: Tenant id. (optional)
|
:param string tenant_id: Tenant id. (optional)
|
||||||
:param string auth_url: Keystone service endpoint for authorization.
|
: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
|
:param string endpoint_type: Network service endpoint type to pull from the
|
||||||
keystone catalog (e.g. 'publicURL',
|
keystone catalog (e.g. 'publicURL',
|
||||||
'internalURL', or 'adminURL') (optional)
|
'internalURL', or 'adminURL') (optional)
|
||||||
|
|||||||
Reference in New Issue
Block a user