Add case_name as constructor arg
[functest.git] / functest / opnfv_tests / vnf / ims / orchestra_ims.py
old mode 100644 (file)
new mode 100755 (executable)
index 42b218e..213d690
@@ -78,9 +78,9 @@ def servertest(host, port):
 
 class ImsVnf(vnf_base.VnfOnBoardingBase):
 
-    def __init__(self, project='functest', case='orchestra_ims',
+    def __init__(self, project='functest', case_name='orchestra_ims',
                  repo='', cmd=''):
-        super(ImsVnf, self).__init__(project, case, repo, cmd)
+        super(ImsVnf, self).__init__(project, case_name, repo, cmd)
         self.ob_password = "openbaton"
         self.ob_username = "admin"
         self.ob_https = False
@@ -245,7 +245,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
                          % (self.imagename, network_id, userdata))
 
         instance = os_utils.create_instance_and_wait_for_active(
-            "m1.medium",
+            "orchestra",
             os_utils.get_image_id(glance_client, self.imagename),
             network_id,
             "orchestra-openbaton",
@@ -308,12 +308,21 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
         if self.ob_projectid == "":
             self.step_failure("Default project id was not found!")
 
+        creds = os_utils.get_credentials()
+        self.logger.info("PoP creds: %s" % creds)
+
+        project_id = os_utils.get_tenant_id(
+            os_utils.get_keystone_client(),
+            creds.get("project_name"))
+
+        self.logger.debug("project id: %s" % project_id)
+
         vim_json = {
             "name": "vim-instance",
-            "authUrl": os_utils.get_credentials().get("auth_url"),
-            "tenant": os_utils.get_credentials().get("tenant_name"),
-            "username": os_utils.get_credentials().get("username"),
-            "password": os_utils.get_credentials().get("password"),
+            "authUrl": creds.get("auth_url"),
+            "tenant": project_id,
+            "username": creds.get("username"),
+            "password": creds.get("password"),
             "securityGroups": [
                 "default",
                 "orchestra-sec-group"