Update to Python3
[functest.git] / functest / opnfv_tests / vnf / router / cloudify_vrouter.py
index a0145b8..ee29210 100644 (file)
@@ -16,7 +16,6 @@ import os
 import time
 
 import pkg_resources
-import scp
 
 from functest.core import cloudify
 from functest.opnfv_tests.vnf.router import vrouter_base
@@ -34,11 +33,17 @@ class CloudifyVrouter(cloudify.Cloudify):
 
     __logger = logging.getLogger(__name__)
 
-    filename_alt = '/home/opnfv/functest/images/vyos-1.1.7.img'
+    filename_alt = '/home/opnfv/functest/images/vyos-1.1.8-amd64.qcow2'
 
-    flavor_alt_ram = 2048
+    flavor_alt_ram = 1024
     flavor_alt_vcpus = 1
-    flavor_alt_disk = 50
+    flavor_alt_disk = 3
+
+    cop_yaml = ("https://github.com/cloudify-cosmo/cloudify-openstack-plugin/"
+                "releases/download/2.14.7/plugin.yaml")
+    cop_wgn = ("https://github.com/cloudify-cosmo/cloudify-openstack-plugin/"
+               "releases/download/2.14.7/cloudify_openstack_plugin-2.14.7-py27"
+               "-none-linux_x86_64-centos-Core.wgn")
 
     def __init__(self, **kwargs):
         if "case_name" not in kwargs:
@@ -114,16 +119,8 @@ class CloudifyVrouter(cloudify.Cloudify):
         # network creation
         super(CloudifyVrouter, self).execute()
         start_time = time.time()
-        self.__logger.info("Put private keypair in manager")
-        scpc = scp.SCPClient(self.ssh.get_transport())
-        scpc.put(self.key_filename, remote_path='~/cloudify_ims.pem')
-        (_, stdout, stderr) = self.ssh.exec_command(
-            "sudo cp ~/cloudify_ims.pem /etc/cloudify/ && "
-            "sudo chmod 444 /etc/cloudify/cloudify_ims.pem && "
-            "sudo yum install -y gcc python-devel python-cmd2 && "
-            "cfy status")
-        self.__logger.info("output:\n%s", stdout.read())
-        self.__logger.info("error:\n%s", stderr.read())
+        self.put_private_key()
+        self.upload_cfy_plugins(self.cop_yaml, self.cop_wgn)
 
         self.image_alt = self.publish_image_alt()
         self.flavor_alt = self.create_flavor_alt()
@@ -205,8 +202,7 @@ class CloudifyVrouter(cloudify.Cloudify):
 
     def test_vnf(self):
         start_time = time.time()
-        testing = vrouter_base.VrouterOnBoardingBase(
-            self.case_name, self.util, self.util_info)
+        testing = vrouter_base.VrouterOnBoardingBase(self.util, self.util_info)
         result, test_result_data = testing.test_vnf()
         duration = time.time() - start_time
         if result:
@@ -220,30 +216,7 @@ class CloudifyVrouter(cloudify.Cloudify):
         return True
 
     def clean(self):
-        try:
-            dep_name = self.vnf['descriptor'].get('name')
-            # kill existing execution
-            self.__logger.info('Deleting the current deployment')
-            exec_list = self.cfy_client.executions.list()
-            for execution in exec_list:
-                if execution['status'] == "started":
-                    try:
-                        self.cfy_client.executions.cancel(
-                            execution['id'], force=True)
-                    except Exception:  # pylint: disable=broad-except
-                        self.__logger.warn("Can't cancel the current exec")
-
-            execution = self.cfy_client.executions.start(
-                dep_name, 'uninstall', parameters=dict(ignore_failure=True))
-
-            cloudify.wait_for_execution(
-                self.cfy_client, execution, self.__logger)
-            self.cfy_client.deployments.delete(
-                self.vnf['descriptor'].get('name'))
-            self.cfy_client.blueprints.delete(
-                self.vnf['descriptor'].get('name'))
-        except Exception:  # pylint: disable=broad-except
-            self.__logger.exception("Some issue during the undeployment ..")
+        self.kill_existing_execution(self.vnf['descriptor'].get('name'))
         if self.image_alt:
             self.cloud.delete_image(self.image_alt)
         if self.flavor_alt: