Change default endpoint_type to "public"

Change-Id: Ic8935d3069225d95ef800e98c1d9c842f17b4639
This commit is contained in:
Rohan Kanade 2014-10-06 14:20:24 +02:00
parent bf8381435d
commit d3ba7792f4
7 changed files with 37 additions and 29 deletions

View File

@ -2,7 +2,7 @@
"type": "ExistingCloud", "type": "ExistingCloud",
"auth_url": "http://example.net:5000/v3/", "auth_url": "http://example.net:5000/v3/",
"region_name": "RegionOne", "region_name": "RegionOne",
"endpoint_type": "internal", "endpoint_type": "public",
"admin_port": 35357, "admin_port": 35357,
"admin": { "admin": {
"username": "admin", "username": "admin",

View File

@ -2,7 +2,7 @@
"type": "ExistingCloud", "type": "ExistingCloud",
"auth_url": "http://example.net:5000/v2.0/", "auth_url": "http://example.net:5000/v2.0/",
"region_name": "RegionOne", "region_name": "RegionOne",
"endpoint_type": "internal", "endpoint_type": "public",
"admin_port": 35357, "admin_port": 35357,
"admin": { "admin": {
"username": "admin", "username": "admin",

View File

@ -57,12 +57,12 @@ This engine in fact does not deploy anything, but uses an existing OpenStack ins
{ {
"type": "ExistingCloud", "type": "ExistingCloud",
"endpoint": { "auth_url": "http://192.168.122.22:5000/v2.0/",
"auth_url": "http://192.168.122.22:5000/v2.0/", "endpoint_type": "public",
"admin": {
"username": "admin", "username": "admin",
"password": "password", "password": "password",
"tenant_name": "admin", "tenant_name": "admin",
"endpoint_type": "internal"
} }
} }
@ -71,17 +71,17 @@ Or using keystone v3 API endpoint:
.. code-block:: none .. code-block:: none
{ {
"type": "ExistingCloud, "type": "ExistingCloud",
"endpoint": { "auth_url": "http://localhost:5000/v3/",
"auth_url": "http://localhost:5000/v3/, "endpoint_type": "public",
"username": "engineer1, "admin_port": 35357,
"user_domain_name": "qa, "admin": {
"project_name": "qa_admin_project, "username": "engineer1",
"project_domain_name": "qa, "user_domain_name": "qa",
"password": "password, "project_name": "qa_admin_project",
"region_name": "RegionOne, "project_domain_name": "qa",
"endpoint_type": "internal", "password": "password",
"admin_port": 35357 "region_name": "RegionOne",
} }
} }
.. ..

View File

@ -27,7 +27,7 @@ class ExistingCloud(engine.EngineFactory):
"type": "ExistingCloud", "type": "ExistingCloud",
"auth_url": "http://localhost:5000/v2.0/", "auth_url": "http://localhost:5000/v2.0/",
"region_name": "RegionOne", "region_name": "RegionOne",
"endpoint_type": "admin", "endpoint_type": "public",
"admin_port": 35357, "admin_port": 35357,
"admin": { "admin": {
"username": "admin", "username": "admin",
@ -42,7 +42,7 @@ class ExistingCloud(engine.EngineFactory):
"type": "ExistingCloud", "type": "ExistingCloud",
"auth_url": "http://localhost:5000/v3/", "auth_url": "http://localhost:5000/v3/",
"region_name": "RegionOne", "region_name": "RegionOne",
"endpoint_type": "admin", "endpoint_type": "public",
"admin_port": 35357, "admin_port": 35357,
"admin": { "admin": {
"username": "admin", "username": "admin",
@ -123,7 +123,7 @@ class ExistingCloud(engine.EngineFactory):
permission=permission, permission=permission,
region_name=common.get("region_name"), region_name=common.get("region_name"),
endpoint_type=common.get("endpoint_type", endpoint_type=common.get("endpoint_type",
consts.EndpointType.INTERNAL), consts.EndpointType.PUBLIC),
admin_port=common.get("admin_port", 35357), admin_port=common.get("admin_port", 35357),
domain_name=user.get("domain_name"), domain_name=user.get("domain_name"),
user_domain_name=user.get("user_domain_name", "Default"), user_domain_name=user.get("user_domain_name", "Default"),

View File

@ -20,7 +20,7 @@ class Endpoint(object):
def __init__(self, auth_url, username, password, tenant_name=None, def __init__(self, auth_url, username, password, tenant_name=None,
permission=consts.EndpointPermission.USER, permission=consts.EndpointPermission.USER,
region_name=None, endpoint_type=consts.EndpointType.INTERNAL, region_name=None, endpoint_type=consts.EndpointType.PUBLIC,
admin_port=35357, domain_name=None, admin_port=35357, domain_name=None,
user_domain_name='Default', user_domain_name='Default',
project_domain_name='Default'): project_domain_name='Default'):

View File

@ -27,7 +27,7 @@ class EndpointTestCase(test.TestCase):
"password": "pwd", "tenant_name": "tenant", "password": "pwd", "tenant_name": "tenant",
"region_name": None, "permission": "admin", "region_name": None, "permission": "admin",
"domain_name": None, "domain_name": None,
"endpoint_type": consts.EndpointType.INTERNAL, "endpoint_type": consts.EndpointType.PUBLIC,
"project_domain_name": "Default", "project_domain_name": "Default",
"user_domain_name": "Default", "user_domain_name": "Default",
'admin_port': 35357}) 'admin_port': 35357})

View File

@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import urlparse
from keystoneclient import exceptions as keystone_exceptions from keystoneclient import exceptions as keystone_exceptions
import mock import mock
from oslo.config import cfg from oslo.config import cfg
@ -50,8 +52,14 @@ class OSClientsTestCase(test.TestCase):
self.assertTrue("keystone" not in self.clients.cache) self.assertTrue("keystone" not in self.clients.cache)
client = self.clients.keystone() client = self.clients.keystone()
self.assertEqual(client, self.fake_keystone) self.assertEqual(client, self.fake_keystone)
mgmt_url = urlparse.urlparse(self.endpoint.auth_url)
auth_url = "{0}://{1}:{2}{3}".format(mgmt_url.scheme,
mgmt_url.hostname,
self.endpoint.admin_port,
mgmt_url.path)
endpoint = {"timeout": cfg.CONF.openstack_client_http_timeout, endpoint = {"timeout": cfg.CONF.openstack_client_http_timeout,
"insecure": False, "cacert": None} "insecure": False, "cacert": None,
"endpoint": auth_url}
kwargs = dict(self.endpoint.to_dict().items() + endpoint.items()) kwargs = dict(self.endpoint.to_dict().items() + endpoint.items())
self.mock_create_keystone_client.assert_called_once_with(kwargs) self.mock_create_keystone_client.assert_called_once_with(kwargs)
self.assertEqual(self.clients.cache["keystone"], self.fake_keystone) self.assertEqual(self.clients.cache["keystone"], self.fake_keystone)
@ -86,7 +94,7 @@ class OSClientsTestCase(test.TestCase):
self.assertEqual(client, fake_nova) self.assertEqual(client, fake_nova)
self.service_catalog.url_for.assert_called_once_with( self.service_catalog.url_for.assert_called_once_with(
service_type='compute', service_type='compute',
endpoint_type=consts.EndpointType.INTERNAL, endpoint_type=consts.EndpointType.PUBLIC,
region_name=self.endpoint.region_name) region_name=self.endpoint.region_name)
mock_nova.Client.assert_called_once_with( mock_nova.Client.assert_called_once_with(
"2", "2",
@ -113,7 +121,7 @@ class OSClientsTestCase(test.TestCase):
"ca_cert": cfg.CONF.https_cacert "ca_cert": cfg.CONF.https_cacert
} }
self.service_catalog.url_for.assert_called_once_with( self.service_catalog.url_for.assert_called_once_with(
service_type='network', endpoint_type=consts.EndpointType.INTERNAL, service_type='network', endpoint_type=consts.EndpointType.PUBLIC,
region_name=self.endpoint.region_name) region_name=self.endpoint.region_name)
mock_neutron.Client.assert_called_once_with("2.0", **kw) mock_neutron.Client.assert_called_once_with("2.0", **kw)
self.assertEqual(self.clients.cache["neutron"], fake_neutron) self.assertEqual(self.clients.cache["neutron"], fake_neutron)
@ -131,7 +139,7 @@ class OSClientsTestCase(test.TestCase):
"insecure": False, "cacert": None} "insecure": False, "cacert": None}
self.service_catalog.url_for.assert_called_once_with( self.service_catalog.url_for.assert_called_once_with(
service_type='image', service_type='image',
endpoint_type=consts.EndpointType.INTERNAL, endpoint_type=consts.EndpointType.PUBLIC,
region_name=self.endpoint.region_name) region_name=self.endpoint.region_name)
mock_glance.Client.assert_called_once_with("1", **kw) mock_glance.Client.assert_called_once_with("1", **kw)
self.assertEqual(self.clients.cache["glance"], fake_glance) self.assertEqual(self.clients.cache["glance"], fake_glance)
@ -146,7 +154,7 @@ class OSClientsTestCase(test.TestCase):
self.assertEqual(client, fake_cinder) self.assertEqual(client, fake_cinder)
self.service_catalog.url_for.assert_called_once_with( self.service_catalog.url_for.assert_called_once_with(
service_type='volume', service_type='volume',
endpoint_type=consts.EndpointType.INTERNAL, endpoint_type=consts.EndpointType.PUBLIC,
region_name=self.endpoint.region_name) region_name=self.endpoint.region_name)
mock_cinder.Client.assert_called_once_with( mock_cinder.Client.assert_called_once_with(
"1", None, None, http_log_debug=False, "1", None, None, http_log_debug=False,
@ -168,7 +176,7 @@ class OSClientsTestCase(test.TestCase):
self.assertEqual(client, fake_ceilometer) self.assertEqual(client, fake_ceilometer)
self.service_catalog.url_for.assert_called_once_with( self.service_catalog.url_for.assert_called_once_with(
service_type='metering', service_type='metering',
endpoint_type=consts.EndpointType.INTERNAL, endpoint_type=consts.EndpointType.PUBLIC,
region_name=self.endpoint.region_name) region_name=self.endpoint.region_name)
kw = {"endpoint": self.service_catalog.url_for.return_value, kw = {"endpoint": self.service_catalog.url_for.return_value,
"token": self.fake_keystone.auth_token, "token": self.fake_keystone.auth_token,
@ -187,7 +195,7 @@ class OSClientsTestCase(test.TestCase):
self.assertEqual(client, fake_ironic) self.assertEqual(client, fake_ironic)
self.service_catalog.url_for.assert_called_once_with( self.service_catalog.url_for.assert_called_once_with(
service_type='baremetal', service_type='baremetal',
endpoint_type=consts.EndpointType.INTERNAL, endpoint_type=consts.EndpointType.PUBLIC,
region_name=self.endpoint.region_name) region_name=self.endpoint.region_name)
kw = { kw = {
"os_auth_token": self.fake_keystone.auth_token, "os_auth_token": self.fake_keystone.auth_token,
@ -224,7 +232,7 @@ class OSClientsTestCase(test.TestCase):
self.assertEqual(client, fake_zaqar) self.assertEqual(client, fake_zaqar)
self.service_catalog.url_for.assert_called_once_with( self.service_catalog.url_for.assert_called_once_with(
service_type='messaging', service_type='messaging',
endpoint_type=consts.EndpointType.INTERNAL, endpoint_type=consts.EndpointType.PUBLIC,
region_name=self.endpoint.region_name) region_name=self.endpoint.region_name)
fake_zaqar_url = self.service_catalog.url_for.return_value fake_zaqar_url = self.service_catalog.url_for.return_value
conf = {'auth_opts': {'backend': 'keystone', 'options': { conf = {'auth_opts': {'backend': 'keystone', 'options': {