From 43ad2cfc1a4861a7020ffa6537fa693309ec164e Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Thu, 23 Feb 2017 00:57:36 +0100 Subject: WIP: Cirros TestVM: Allow config of username/password 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 --- functest/ci/config_functest.yaml | 2 ++ functest/opnfv_tests/openstack/vping/vping_base.py | 2 ++ functest/opnfv_tests/openstack/vping/vping_ssh.py | 6 ++---- functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py | 12 ++++++------ 4 files changed, 12 insertions(+), 10 deletions(-) (limited to 'functest') diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml index 3bad1b8f..7b3d61eb 100755 --- a/functest/ci/config_functest.yaml +++ b/functest/ci/config_functest.yaml @@ -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 diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py index a5309bd4..9d57cfae 100644 --- a/functest/opnfv_tests/openstack/vping/vping_base.py +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -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) diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py index b032c308..7a58a41f 100755 --- a/functest/opnfv_tests/openstack/vping/vping_ssh.py +++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py @@ -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 diff --git a/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py b/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py index 090502ba..fadaa478 100644 --- a/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py +++ b/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py @@ -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 -- cgit 1.2.3-korg ef='#n57'>57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301