Bug fix 81/21781/1
authorThomas Duval <thomas.duval@orange.com>
Wed, 14 Sep 2016 09:29:03 +0000 (11:29 +0200)
committerThomas Duval <thomas.duval@orange.com>
Tue, 20 Sep 2016 08:38:38 +0000 (10:38 +0200)
Change-Id: If164c726141f36e46e0dba75be17c499f9b15ccc
(cherry picked from commit f102f1d6a94516422191a9d70c88afc603c380af)

tests/run_tests.py

index e28f761..6d52412 100755 (executable)
@@ -75,6 +75,14 @@ def test_federation():
     proc = subprocess.Popen(["openstack", "role", "add ", "--project", "admin", "--user", username, "admin", "-f", "yaml"], stdout=subprocess.PIPE)
     logger.info("Add the role admin to our new user ({})".format(proc.stdout.read()))
 
+    # Add the sdn tenant
+    proc = subprocess.Popen(["openstack", "project", "add ", "sdn", "-f", "yaml"], stdout=subprocess.PIPE)
+    logger.info("Add the tenant sdn ({})".format(proc.stdout.read()))
+
+    # Add the role admin to test_fede in tenant sdn
+    proc = subprocess.Popen(["openstack", "role", "add ", "--project", "sdn", "--user", username, "admin", "-f", "yaml"], stdout=subprocess.PIPE)
+    logger.info("Add the role admin for the user test_fede in the tenant sdn ({})".format(proc.stdout.read()))
+
     # Retrieve Moon token
     nhost, nport = __get_endpoint_url()
     auth_data = {'username': username, 'password': password}
@@ -91,11 +99,11 @@ def test_federation():
     nport = "8181"
 
     # Test with basic login/pass
-    auth = HTTPBasicAuth("admin", "console")
-    req = requests.get(url='http://{host}:{port}/auth/v1/domains'.format(host=nhost, port=nport), auth=auth)
-    code = req.status_code
-    if code not in (200, 201, 202, 204):
-        return False, "Not able to authenticate to ODL with admin (error code: {}).".format(code)
+    #auth = HTTPBasicAuth("admin", "console")
+    #req = requests.get(url='http://{host}:{port}/auth/v1/domains'.format(host=nhost, port=nport), auth=auth)
+    #code = req.status_code
+    #if code not in (200, 201, 202, 204):
+    #    return False, "Not able to authenticate to ODL with admin (error code: {}).".format(code)
 
     auth = HTTPBasicAuth(username, password)
     req = requests.get(url='http://{host}:{port}/auth/v1/domains'.format(host=nhost, port=nport), auth=auth)