From d3ba7792f4a98f9fa1c9462bbeace9875a631ee4 Mon Sep 17 00:00:00 2001 From: Rohan Kanade Date: Mon, 6 Oct 2014 14:20:24 +0200 Subject: [PATCH] Change default endpoint_type to "public" Change-Id: Ic8935d3069225d95ef800e98c1d9c842f17b4639 --- .../deployments/existing-keystone-v3.json | 2 +- doc/samples/deployments/existing.json | 2 +- doc/source/deploy_engines.rst | 28 +++++++++---------- rally/deploy/engines/existing.py | 6 ++-- rally/objects/endpoint.py | 2 +- tests/objects/test_endpoint.py | 2 +- tests/test_osclients.py | 24 ++++++++++------ 7 files changed, 37 insertions(+), 29 deletions(-) diff --git a/doc/samples/deployments/existing-keystone-v3.json b/doc/samples/deployments/existing-keystone-v3.json index b15c770744..a91ff91c36 100644 --- a/doc/samples/deployments/existing-keystone-v3.json +++ b/doc/samples/deployments/existing-keystone-v3.json @@ -2,7 +2,7 @@ "type": "ExistingCloud", "auth_url": "http://example.net:5000/v3/", "region_name": "RegionOne", - "endpoint_type": "internal", + "endpoint_type": "public", "admin_port": 35357, "admin": { "username": "admin", diff --git a/doc/samples/deployments/existing.json b/doc/samples/deployments/existing.json index 797de29b99..2538d74dd8 100644 --- a/doc/samples/deployments/existing.json +++ b/doc/samples/deployments/existing.json @@ -2,7 +2,7 @@ "type": "ExistingCloud", "auth_url": "http://example.net:5000/v2.0/", "region_name": "RegionOne", - "endpoint_type": "internal", + "endpoint_type": "public", "admin_port": 35357, "admin": { "username": "admin", diff --git a/doc/source/deploy_engines.rst b/doc/source/deploy_engines.rst index f7ff86c202..fa98141415 100644 --- a/doc/source/deploy_engines.rst +++ b/doc/source/deploy_engines.rst @@ -57,12 +57,12 @@ This engine in fact does not deploy anything, but uses an existing OpenStack ins { "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", "password": "password", "tenant_name": "admin", - "endpoint_type": "internal" } } @@ -71,17 +71,17 @@ Or using keystone v3 API endpoint: .. code-block:: none { - "type": "ExistingCloud, - "endpoint": { - "auth_url": "http://localhost:5000/v3/, - "username": "engineer1, - "user_domain_name": "qa, - "project_name": "qa_admin_project, - "project_domain_name": "qa, - "password": "password, - "region_name": "RegionOne, - "endpoint_type": "internal", - "admin_port": 35357 + "type": "ExistingCloud", + "auth_url": "http://localhost:5000/v3/", + "endpoint_type": "public", + "admin_port": 35357, + "admin": { + "username": "engineer1", + "user_domain_name": "qa", + "project_name": "qa_admin_project", + "project_domain_name": "qa", + "password": "password", + "region_name": "RegionOne", } } .. diff --git a/rally/deploy/engines/existing.py b/rally/deploy/engines/existing.py index e53fc81657..85443b26fa 100644 --- a/rally/deploy/engines/existing.py +++ b/rally/deploy/engines/existing.py @@ -27,7 +27,7 @@ class ExistingCloud(engine.EngineFactory): "type": "ExistingCloud", "auth_url": "http://localhost:5000/v2.0/", "region_name": "RegionOne", - "endpoint_type": "admin", + "endpoint_type": "public", "admin_port": 35357, "admin": { "username": "admin", @@ -42,7 +42,7 @@ class ExistingCloud(engine.EngineFactory): "type": "ExistingCloud", "auth_url": "http://localhost:5000/v3/", "region_name": "RegionOne", - "endpoint_type": "admin", + "endpoint_type": "public", "admin_port": 35357, "admin": { "username": "admin", @@ -123,7 +123,7 @@ class ExistingCloud(engine.EngineFactory): permission=permission, region_name=common.get("region_name"), endpoint_type=common.get("endpoint_type", - consts.EndpointType.INTERNAL), + consts.EndpointType.PUBLIC), admin_port=common.get("admin_port", 35357), domain_name=user.get("domain_name"), user_domain_name=user.get("user_domain_name", "Default"), diff --git a/rally/objects/endpoint.py b/rally/objects/endpoint.py index 92dae9d46d..153002b95a 100644 --- a/rally/objects/endpoint.py +++ b/rally/objects/endpoint.py @@ -20,7 +20,7 @@ class Endpoint(object): def __init__(self, auth_url, username, password, tenant_name=None, 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, user_domain_name='Default', project_domain_name='Default'): diff --git a/tests/objects/test_endpoint.py b/tests/objects/test_endpoint.py index a9c6e6b5e7..1927036371 100644 --- a/tests/objects/test_endpoint.py +++ b/tests/objects/test_endpoint.py @@ -27,7 +27,7 @@ class EndpointTestCase(test.TestCase): "password": "pwd", "tenant_name": "tenant", "region_name": None, "permission": "admin", "domain_name": None, - "endpoint_type": consts.EndpointType.INTERNAL, + "endpoint_type": consts.EndpointType.PUBLIC, "project_domain_name": "Default", "user_domain_name": "Default", 'admin_port': 35357}) diff --git a/tests/test_osclients.py b/tests/test_osclients.py index aca5441662..732bf1d800 100644 --- a/tests/test_osclients.py +++ b/tests/test_osclients.py @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. +import urlparse + from keystoneclient import exceptions as keystone_exceptions import mock from oslo.config import cfg @@ -50,8 +52,14 @@ class OSClientsTestCase(test.TestCase): self.assertTrue("keystone" not in self.clients.cache) client = self.clients.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, - "insecure": False, "cacert": None} + "insecure": False, "cacert": None, + "endpoint": auth_url} kwargs = dict(self.endpoint.to_dict().items() + endpoint.items()) self.mock_create_keystone_client.assert_called_once_with(kwargs) self.assertEqual(self.clients.cache["keystone"], self.fake_keystone) @@ -86,7 +94,7 @@ class OSClientsTestCase(test.TestCase): self.assertEqual(client, fake_nova) self.service_catalog.url_for.assert_called_once_with( service_type='compute', - endpoint_type=consts.EndpointType.INTERNAL, + endpoint_type=consts.EndpointType.PUBLIC, region_name=self.endpoint.region_name) mock_nova.Client.assert_called_once_with( "2", @@ -113,7 +121,7 @@ class OSClientsTestCase(test.TestCase): "ca_cert": cfg.CONF.https_cacert } 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) mock_neutron.Client.assert_called_once_with("2.0", **kw) self.assertEqual(self.clients.cache["neutron"], fake_neutron) @@ -131,7 +139,7 @@ class OSClientsTestCase(test.TestCase): "insecure": False, "cacert": None} self.service_catalog.url_for.assert_called_once_with( service_type='image', - endpoint_type=consts.EndpointType.INTERNAL, + endpoint_type=consts.EndpointType.PUBLIC, region_name=self.endpoint.region_name) mock_glance.Client.assert_called_once_with("1", **kw) self.assertEqual(self.clients.cache["glance"], fake_glance) @@ -146,7 +154,7 @@ class OSClientsTestCase(test.TestCase): self.assertEqual(client, fake_cinder) self.service_catalog.url_for.assert_called_once_with( service_type='volume', - endpoint_type=consts.EndpointType.INTERNAL, + endpoint_type=consts.EndpointType.PUBLIC, region_name=self.endpoint.region_name) mock_cinder.Client.assert_called_once_with( "1", None, None, http_log_debug=False, @@ -168,7 +176,7 @@ class OSClientsTestCase(test.TestCase): self.assertEqual(client, fake_ceilometer) self.service_catalog.url_for.assert_called_once_with( service_type='metering', - endpoint_type=consts.EndpointType.INTERNAL, + endpoint_type=consts.EndpointType.PUBLIC, region_name=self.endpoint.region_name) kw = {"endpoint": self.service_catalog.url_for.return_value, "token": self.fake_keystone.auth_token, @@ -187,7 +195,7 @@ class OSClientsTestCase(test.TestCase): self.assertEqual(client, fake_ironic) self.service_catalog.url_for.assert_called_once_with( service_type='baremetal', - endpoint_type=consts.EndpointType.INTERNAL, + endpoint_type=consts.EndpointType.PUBLIC, region_name=self.endpoint.region_name) kw = { "os_auth_token": self.fake_keystone.auth_token, @@ -224,7 +232,7 @@ class OSClientsTestCase(test.TestCase): self.assertEqual(client, fake_zaqar) self.service_catalog.url_for.assert_called_once_with( service_type='messaging', - endpoint_type=consts.EndpointType.INTERNAL, + endpoint_type=consts.EndpointType.PUBLIC, region_name=self.endpoint.region_name) fake_zaqar_url = self.service_catalog.url_for.return_value conf = {'auth_opts': {'backend': 'keystone', 'options': {