WIP: Cirros TestVM: Allow config of username/password 57/29257/1
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Wed, 22 Feb 2017 23:57:36 +0000 (00:57 +0100)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Wed, 22 Feb 2017 23:59:46 +0000 (00:59 +0100)
With the recent changes in Cirros image default password, we
need to support configuring these credentials.

JIRA: ARMBAND-218

Change-Id: I5962ec2aeee4ffecefdd8b7e70bdb7ed88457553
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
functest/ci/config_functest.yaml
functest/opnfv_tests/openstack/vping/vping_base.py
functest/opnfv_tests/openstack/vping/vping_ssh.py
functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py

index 3bad1b8..7b3d61e 100755 (executable)
@@ -45,6 +45,8 @@ general:
         image_name: Cirros-0.3.4
         image_file_name:  cirros-0.3.4-x86_64-disk.img
         image_disk_format:  qcow2
+        image_username:  cirros
+        image_password:  cubswin:)
 
         flavor_name: opnfv_flavor
         flavor_ram: 512
index a5309bd..9d57cfa 100644 (file)
@@ -32,6 +32,8 @@ class VPingBase(testcase_base.TestcaseBase):
         self.image_name = CONST.vping_image_name
         self.image_filename = CONST.openstack_image_file_name
         self.image_format = CONST.openstack_image_disk_format
+        self.image_username = CONST.openstack_image_username
+        self.image_password = CONST.openstack_image_password
         self.image_path = os.path.join(CONST.dir_functest_data,
                                        self.image_filename)
 
index b032c30..7a58a41 100755 (executable)
@@ -61,8 +61,6 @@ class VPingSSH(vping_base.VPingBase):
     def establish_ssh(self, vm, floatip):
         self.logger.info("Trying to establish SSH connection to %s..."
                          % floatip)
-        username = 'cirros'
-        password = 'cubswin:)'
         ssh = paramiko.SSHClient()
         ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
 
@@ -73,8 +71,8 @@ class VPingSSH(vping_base.VPingBase):
         cidr_first_octet = self.private_subnet_cidr.split('.')[0]
         while timeout > 0:
             try:
-                ssh.connect(floatip, username=username,
-                            password=password, timeout=2)
+                ssh.connect(floatip, username=self.image_username,
+                            password=self.image_password, timeout=2)
                 self.logger.debug("SSH connection established to %s."
                                   % floatip)
                 break
index 090502b..fadaa47 100644 (file)
@@ -10,6 +10,8 @@ from pexpect import pxssh
 
 import functest.utils.functest_logger as ft_logger
 
+from functest.utils.constants import CONST
+
 OK = 200
 CREATED = 201
 ACCEPTED = 202
@@ -99,6 +101,8 @@ class SfcOnos:
         self.ip_pool = 0
         self.vm_public_ip = []
         self.vm_public_id = []
+        self.cirros_username = CONST.openstack_image_username
+        self.cirros_password = CONST.openstack_image_password
         self.net_id1 = 0
         self.vm = []
         self.address = 0
@@ -628,9 +632,7 @@ class SfcOnos:
 
             s = pxssh.pxssh()
             hostname = self.vm_public_ip[0]
-            username = "cirros"
-            password = "cubswin:)"
-            s.login(hostname,  username,  password)
+            s.login(hostname,  self.cirros_username,  self.cirros_password)
             s.sendline("ping -c 5 " + str(self.port_ip[2]))
             s.prompt()             # match the prompt
 
@@ -644,9 +646,7 @@ class SfcOnos:
         def vm1(queue1):
             s = pxssh.pxssh()
             hostname = self.vm_public_ip[1]
-            username = "cirros"
-            password = "cubswin:)"
-            s.login(hostname,  username,  password)
+            s.login(hostname,  self.cirros_username,  self.cirros_password)
             s.sendline('sudo ./firewall')
             s.prompt()
             output_pack = s.before