aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Duval <thomas.duval@orange.com>2016-09-07 10:56:59 +0200
committerThomas Duval <thomas.duval@orange.com>2016-09-20 10:38:37 +0200
commite2e0f874b274c818776f79fb8df60778c47967cb (patch)
tree15a7c060cc6bc017724e8470affb6880816a17fa
parent9c8d7a4d8e5ff6b0973fa27ce5a70d2419f2f271 (diff)
Re-Add ODL federation test.
Change-Id: I66995d2ff37eb36e7aac754d712742efbd0222be (cherry picked from commit 64ee6a784251c6d977794125f176aed3c5e104ce)
-rwxr-xr-xtests/run_tests.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/run_tests.py b/tests/run_tests.py
index 4b702198..7c48e268 100755
--- a/tests/run_tests.py
+++ b/tests/run_tests.py
@@ -48,8 +48,8 @@ except ImportError:
from urllib2 import HTTPBasicAuthHandler, build_opener, install_opener
-def __get_keystone_url():
- with subprocess.Popen(["openstack", "endpoint", "show", "keystone", "-f", "yaml"], stdout=subprocess.PIPE) as proc:
+def __get_endpoint_url(name="keystone"):
+ with subprocess.Popen(["openstack", "endpoint", "show", name, "-f", "yaml"], stdout=subprocess.PIPE) as proc:
y = yaml.load(proc.stdout.read())
url = y['publicurl']
url = url.replace("http://", "")
@@ -61,18 +61,25 @@ def __get_keystone_url():
def test_federation():
# Retrieve Moon token
- khost, kport = __get_keystone_url()
+ nhost, nport = __get_endpoint_url()
auth_data = {'username': 'admin', 'password': 'console'}
- conn = client.HTTPConnection(khost, kport)
+ conn = client.HTTPConnection(nhost, nport)
headers = {"Content-type": "application/json"}
conn.request("POST", "/moon/auth/tokens", json.dumps(auth_data).encode('utf-8'), headers=headers)
resp = conn.getresponse()
if resp.status not in (200, 201, 202, 204):
- return False, "Not able to retrieve Moon token on {}:{} (error code: {}).".format(khost, kport, resp.status)
+ return False, "Not able to retrieve Moon token on {}:{} (error code: {}).".format(nhost, nport, resp.status)
# Retrieve ODL token
- # TODO (asteroide): must found how to get ODL host and port
+ nhost, nport = __get_endpoint_url(name="neutron")
+ auth_data = {'username': 'admin', 'password': 'console'}
+ conn = client.HTTPConnection(nhost, nport)
+ headers = {"Content-type": "application/json"}
+ conn.request("POST", "/auth/v1/domains", json.dumps(auth_data).encode('utf-8'), headers=headers)
+ resp = conn.getresponse()
+ if resp.status not in (200, 201, 202, 204):
+ return False, "Not able to retrieve ODL token on {}:{} (error code: {}).".format(nhost, nport, resp.status)
# auth_handler = HTTPBasicAuthHandler()
# auth_handler.add_password(realm='Moon',
# uri='http://{host}:{port}/auth/v1/domains'.format(host=HOST_ODL, port=PORT_ODL),