Replace execute_throw_host by devops implementation
SSHClient instance is already has this method Blueprint: sshmanager-integration Change-Id: I90ca8bc7675bfc6b70126f83fd4e6ec0e3e04d3a
This commit is contained in:
parent
6123303127
commit
3ce8925e1c
|
@ -12,16 +12,19 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
from paramiko import ChannelException
|
||||
|
||||
from devops.helpers.ssh_client import SSHAuth
|
||||
from devops.helpers.helpers import wait
|
||||
from devops.error import TimeoutError
|
||||
|
||||
from fuelweb_test import logger
|
||||
from fuelweb_test import settings
|
||||
from fuelweb_test.helpers import os_actions
|
||||
|
||||
cirros_auth = SSHAuth(**settings.SSH_IMAGE_CREDENTIALS)
|
||||
|
||||
# pylint: disable=no-member
|
||||
|
||||
|
||||
|
@ -196,11 +199,10 @@ class TestNeutronIPv6(object):
|
|||
with fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
def ssh_ready(vm_host):
|
||||
try:
|
||||
os_conn.execute_through_host(
|
||||
ssh=remote,
|
||||
vm_host=vm_host,
|
||||
remote.execute_through_host(
|
||||
hostname=vm_host,
|
||||
cmd="ls -la",
|
||||
creds=("cirros", "cubswin:)")
|
||||
auth=cirros_auth
|
||||
)
|
||||
return True
|
||||
except ChannelException:
|
||||
|
@ -210,18 +212,13 @@ class TestNeutronIPv6(object):
|
|||
(floating_ip.ip, instance1),
|
||||
(floating_ip2.ip, instance2)
|
||||
):
|
||||
try:
|
||||
wait(lambda: ssh_ready(vm_host), timeout=120)
|
||||
except TimeoutError:
|
||||
raise TimeoutError(
|
||||
'ssh is not ready on host '
|
||||
'{hostname:s} ({ip:s}) '
|
||||
'at timeout 120s'.format(
|
||||
hostname=hostname, ip=vm_host))
|
||||
wait(lambda: ssh_ready(vm_host), timeout=120,
|
||||
timeout_msg='ssh is not ready on host '
|
||||
'{hostname:s} ({ip:s}) at timeout 120s'
|
||||
''.format(hostname=hostname, ip=vm_host))
|
||||
|
||||
res = os_conn.execute_through_host(
|
||||
ssh=remote,
|
||||
vm_host=floating_ip.ip,
|
||||
res = remote.execute_through_host(
|
||||
hostname=floating_ip.ip,
|
||||
cmd="{ping:s} -q "
|
||||
"-c{count:d} "
|
||||
"-w{deadline:d} "
|
||||
|
@ -232,16 +229,18 @@ class TestNeutronIPv6(object):
|
|||
deadline=20,
|
||||
packetsize=1452,
|
||||
dst_address=instance2_ipv6),
|
||||
creds=("cirros", "cubswin:)")
|
||||
auth=cirros_auth
|
||||
)
|
||||
logger.info('Ping results: \n\t{res:s}'.format(res=res['stdout']))
|
||||
|
||||
logger.info(
|
||||
'Ping results: \n\t{res:s}'.format(res=res['stdout_str']))
|
||||
|
||||
assert res['exit_code'] == 0, (
|
||||
'Ping failed with error code: {code:d}\n'
|
||||
'\tSTDOUT: {stdout:s}\n'
|
||||
'\tSTDERR: {stderr:s}'.format(
|
||||
code=res['exit_code'],
|
||||
stdout=res['stdout'],
|
||||
stderr=res['stderr']))
|
||||
stdout=res['stdout_str'],
|
||||
stderr=res['stderr_str']))
|
||||
|
||||
self.env.make_snapshot('deploy_neutron_ip_v6')
|
||||
|
|
|
@ -294,7 +294,7 @@ def parse_md5sum_output(string):
|
|||
|
||||
|
||||
def diff_md5(before, after, no_dir_change=True):
|
||||
"""Doff md5sum output
|
||||
"""Diff md5sum output
|
||||
|
||||
:type before: str
|
||||
:type after: str
|
||||
|
@ -1446,7 +1446,7 @@ def check_free_space_admin(env, min_disk_admin=50, disk_id=0):
|
|||
"""
|
||||
disk_size_admin = env.d_env.nodes().admin.disk_devices[
|
||||
disk_id].volume.get_capacity()
|
||||
min_disk_admin = min_disk_admin * 1024 ** 3
|
||||
min_disk_admin *= 1024 ** 3
|
||||
if disk_size_admin < min_disk_admin:
|
||||
raise ValueError(
|
||||
"The minimal disk size should be {0}, current {1}".format(
|
||||
|
@ -1493,7 +1493,7 @@ def check_free_space_slave(env, min_disk_slave=150):
|
|||
:param env: environment model object
|
||||
:param min_disk_slave: minimal disk size of slave node
|
||||
"""
|
||||
min_disk_slave = min_disk_slave * 1024 ** 3
|
||||
min_disk_slave *= 1024 ** 3
|
||||
disk_size_slave = 0
|
||||
active_nodes = []
|
||||
for node in env.d_env.nodes().slaves:
|
||||
|
|
|
@ -13,15 +13,17 @@
|
|||
# under the License.
|
||||
|
||||
import random
|
||||
import traceback
|
||||
from warnings import warn
|
||||
|
||||
from devops.error import TimeoutError
|
||||
from devops.helpers import helpers
|
||||
import paramiko
|
||||
from devops.helpers.ssh_client import SSHAuth
|
||||
from proboscis import asserts
|
||||
|
||||
from fuelweb_test import logger
|
||||
from fuelweb_test.helpers import common
|
||||
from fuelweb_test.settings import SSH_IMAGE_CREDENTIALS
|
||||
|
||||
|
||||
class OpenStackActions(common.Common):
|
||||
|
@ -359,6 +361,9 @@ class OpenStackActions(common.Common):
|
|||
host._info['service'] == 'compute']
|
||||
|
||||
def get_md5sum(self, file_path, controller_ssh, vm_ip, creds=()):
|
||||
warn(
|
||||
'get_md5sum is deprecated due to legacy API usage',
|
||||
DeprecationWarning)
|
||||
logger.info("Get file md5sum and compare it with previous one")
|
||||
out = self.execute_through_host(
|
||||
controller_ssh, vm_ip, "md5sum {:s}".format(file_path), creds)
|
||||
|
@ -366,49 +371,23 @@ class OpenStackActions(common.Common):
|
|||
|
||||
@staticmethod
|
||||
def execute_through_host(ssh, vm_host, cmd, creds=()):
|
||||
warn(
|
||||
msg = (
|
||||
'execute_throw_host(ssh=SSHClient(), ...) is deprecated '
|
||||
'in favor of '
|
||||
'SSHClient().execute_through_host(hostname, cmd, auth, ...)',
|
||||
DeprecationWarning
|
||||
)
|
||||
logger.debug("Making intermediate transport")
|
||||
intermediate_transport = ssh._ssh.get_transport()
|
||||
|
||||
logger.debug("Opening channel to VM")
|
||||
intermediate_channel = intermediate_transport.open_channel(
|
||||
'direct-tcpip', (vm_host, 22), (ssh.host, 0))
|
||||
logger.debug("Opening paramiko transport")
|
||||
transport = paramiko.Transport(intermediate_channel)
|
||||
logger.debug("Starting client")
|
||||
transport.start_client()
|
||||
logger.info("Passing authentication to VM: {}".format(creds))
|
||||
'SSHClient().execute_through_host(hostname, cmd, auth, ...).\n'
|
||||
'{}'.format("".join(traceback.format_stack())))
|
||||
warn(msg, DeprecationWarning)
|
||||
logger.warning(msg)
|
||||
if not creds:
|
||||
creds = ('cirros', 'cubswin:)')
|
||||
transport.auth_password(creds[0], creds[1])
|
||||
|
||||
logger.debug("Opening session")
|
||||
channel = transport.open_session()
|
||||
logger.info("Executing command: {}".format(cmd))
|
||||
channel.exec_command(cmd)
|
||||
|
||||
result = {
|
||||
'stdout': [],
|
||||
'stderr': [],
|
||||
'exit_code': 0
|
||||
}
|
||||
|
||||
logger.debug("Receiving exit_code")
|
||||
result['exit_code'] = channel.recv_exit_status()
|
||||
logger.debug("Receiving stdout")
|
||||
result['stdout'] = channel.recv(1024)
|
||||
logger.debug("Receiving stderr")
|
||||
result['stderr'] = channel.recv_stderr(1024)
|
||||
|
||||
logger.debug("Closing channel")
|
||||
channel.close()
|
||||
|
||||
return result
|
||||
creds = (
|
||||
SSH_IMAGE_CREDENTIALS['username'],
|
||||
SSH_IMAGE_CREDENTIALS['password']
|
||||
)
|
||||
return ssh.execute_through_host(
|
||||
hostname=vm_host,
|
||||
cmd=cmd,
|
||||
auth=SSHAuth(*creds)
|
||||
)
|
||||
|
||||
def get_tenant(self, tenant_name):
|
||||
tenant_list = self.keystone.tenants.list()
|
||||
|
|
|
@ -625,6 +625,11 @@ SSH_SLAVE_CREDENTIALS = {
|
|||
'login': os.environ.get('ENV_SLAVE_LOGIN', 'fuel'),
|
||||
'password': os.environ.get('ENV_SLAVE_PASSWORD', 'fuel')}
|
||||
|
||||
SSH_IMAGE_CREDENTIALS = {
|
||||
'username': os.environ.get('SSH_IMAGE_CREDENTIALS_LOGIN', "cirros"),
|
||||
'password': os.environ.get('SSH_IMAGE_CREDENTIALS_PASSWORD', "cubswin:)")
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
||||
PATCHING_WEB_DIR = os.environ.get("PATCHING_WEB_DIR", "/var/www/nailgun/")
|
||||
|
|
|
@ -12,9 +12,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import time
|
||||
from ConfigParser import ConfigParser
|
||||
from cStringIO import StringIO
|
||||
|
||||
import paramiko
|
||||
from pkg_resources import parse_version
|
||||
|
@ -23,7 +22,14 @@ from proboscis import SkipTest
|
|||
from proboscis import test
|
||||
from devops.helpers.helpers import tcp_ping
|
||||
from devops.helpers.helpers import wait
|
||||
from devops.helpers.ssh_client import SSHAuth
|
||||
from six import BytesIO
|
||||
# pylint: disable=import-error
|
||||
# noinspection PyUnresolvedReferences
|
||||
from six.moves import configparser
|
||||
# noinspection PyUnresolvedReferences
|
||||
from six.moves import cStringIO
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.helpers import os_actions
|
||||
from fuelweb_test.helpers import ceph
|
||||
|
@ -591,7 +597,7 @@ class VmBackedWithCephMigrationBasic(TestBasic):
|
|||
'slave-03': ['compute', 'ceph-osd']
|
||||
}
|
||||
)
|
||||
creds = ("cirros", "test")
|
||||
creds = SSHAuth(username="cirros", password="test")
|
||||
|
||||
self.show_step(4)
|
||||
|
||||
|
@ -657,11 +663,16 @@ class VmBackedWithCephMigrationBasic(TestBasic):
|
|||
logger.info("Server is on host {:s}".format(srv_host))
|
||||
|
||||
wait(lambda: tcp_ping(floating_ip.ip, 22), timeout=120,
|
||||
timeout_msg='new WM ssh port ping timeout')
|
||||
timeout_msg='new VM ssh port ping timeout')
|
||||
|
||||
def ssh_ready(remote, ip, creds):
|
||||
"""SSH Ready status
|
||||
|
||||
:type ip: str
|
||||
:type creds: SSHAuth
|
||||
"""
|
||||
try:
|
||||
os.execute_through_host(remote, ip, '/bin/true', creds)
|
||||
remote.execute_through_host(ip, '/bin/true', creds)
|
||||
return True
|
||||
except paramiko.AuthenticationException:
|
||||
logger.info("Authentication failed. Trying again in a minute.")
|
||||
|
@ -670,8 +681,10 @@ class VmBackedWithCephMigrationBasic(TestBasic):
|
|||
|
||||
with self.fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
wait(lambda: ssh_ready(remote, floating_ip.ip, creds), timeout=300)
|
||||
md5before = os.get_md5sum(
|
||||
"/home/test_file", remote, floating_ip.ip, creds)
|
||||
md5before = remote.execute_through_host(
|
||||
floating_ip.ip,
|
||||
"md5sum {:s}".format("/home/test_file"),
|
||||
auth=creds).stdout_str
|
||||
|
||||
self.show_step(8)
|
||||
|
||||
|
@ -683,26 +696,25 @@ class VmBackedWithCephMigrationBasic(TestBasic):
|
|||
logger.info("Check cluster and server state after migration")
|
||||
|
||||
wait(lambda: tcp_ping(floating_ip.ip, 22), timeout=120,
|
||||
timeout_msg='WM ssh port ping timeout after migration')
|
||||
timeout_msg='VM ssh port ping timeout after migration')
|
||||
|
||||
with self.fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
md5after = os.get_md5sum(
|
||||
"/home/test_file", remote, floating_ip.ip, creds)
|
||||
md5after = remote.execute_through_host(
|
||||
floating_ip.ip,
|
||||
"md5sum {:s}".format("/home/test_file"),
|
||||
auth=creds).stdout_str
|
||||
|
||||
assert_true(
|
||||
md5after in md5before,
|
||||
"Md5 checksums don`t match."
|
||||
"Before migration md5 was equal to: {bef}"
|
||||
"Now it equals: {aft}".format(bef=md5before, aft=md5after))
|
||||
checkers.diff_md5(md5before, md5after)
|
||||
|
||||
self.show_step(9)
|
||||
|
||||
with self.fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
res = os.execute_through_host(
|
||||
remote, floating_ip.ip,
|
||||
res = remote.execute_through_host(
|
||||
floating_ip.ip,
|
||||
"ping -q -c3 -w10 {0} | grep 'received' |"
|
||||
" grep -v '0 packets received'"
|
||||
.format(settings.PUBLIC_TEST_IP), creds)
|
||||
.format(settings.PUBLIC_TEST_IP),
|
||||
auth=creds)
|
||||
logger.info("Ping {0} result on vm is: {1}"
|
||||
.format(settings.PUBLIC_TEST_IP, res['stdout']))
|
||||
|
||||
|
@ -755,19 +767,21 @@ class VmBackedWithCephMigrationBasic(TestBasic):
|
|||
|
||||
self.show_step(14)
|
||||
wait(lambda: tcp_ping(floating_ip.ip, 22), timeout=120,
|
||||
timeout_msg='new WM ssh port ping timeout')
|
||||
timeout_msg='new VM ssh port ping timeout')
|
||||
logger.info("Create filesystem and mount volume")
|
||||
|
||||
with self.fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
wait(lambda: ssh_ready(remote, floating_ip.ip, creds), timeout=300)
|
||||
|
||||
os.execute_through_host(
|
||||
remote,
|
||||
floating_ip.ip, 'sudo sh /home/mount_volume.sh', creds)
|
||||
remote.execute_through_host(
|
||||
floating_ip.ip,
|
||||
'sudo sh /home/mount_volume.sh',
|
||||
auth=creds)
|
||||
|
||||
os.execute_through_host(
|
||||
remote,
|
||||
floating_ip.ip, 'sudo touch /mnt/file-on-volume', creds)
|
||||
remote.execute_through_host(
|
||||
floating_ip.ip,
|
||||
'sudo touch /mnt/file-on-volume',
|
||||
auth=creds)
|
||||
|
||||
self.show_step(15)
|
||||
logger.info("Get available computes")
|
||||
|
@ -778,21 +792,23 @@ class VmBackedWithCephMigrationBasic(TestBasic):
|
|||
|
||||
logger.info("Check cluster and server state after migration")
|
||||
wait(lambda: tcp_ping(floating_ip.ip, 22), timeout=120,
|
||||
timeout_msg='WM ssh port ping timeout after migration')
|
||||
timeout_msg='VM ssh port ping timeout after migration')
|
||||
|
||||
self.show_step(16)
|
||||
logger.info("Mount volume after migration")
|
||||
with self.fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
out = os.execute_through_host(
|
||||
remote,
|
||||
floating_ip.ip, 'sudo mount /dev/vdb /mnt', creds)
|
||||
out = remote.execute_through_host(
|
||||
floating_ip.ip,
|
||||
'sudo mount /dev/vdb /mnt',
|
||||
auth=creds)
|
||||
|
||||
logger.info("out of mounting volume is: {:s}".format(out['stdout']))
|
||||
|
||||
with self.fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
out = os.execute_through_host(
|
||||
remote,
|
||||
floating_ip.ip, "sudo ls /mnt", creds)
|
||||
out = remote.execute_through_host(
|
||||
floating_ip.ip,
|
||||
"sudo ls /mnt",
|
||||
auth=creds)
|
||||
assert_true("file-on-volume" in out['stdout'],
|
||||
"File is absent in /mnt")
|
||||
|
||||
|
@ -1038,8 +1054,8 @@ class RadosGW(TestBasic):
|
|||
ip=node['ip'],
|
||||
cmd="cat {0} | egrep -v '^#'".format(
|
||||
settings_source))['stdout_str']
|
||||
glance_config_file = StringIO(glance_config)
|
||||
parser = ConfigParser()
|
||||
glance_config_file = cStringIO(glance_config)
|
||||
parser = configparser.ConfigParser()
|
||||
parser.readfp(glance_config_file)
|
||||
settings_value = [
|
||||
parser.get('keystone_authtoken', value) for value in settings_list]
|
||||
|
|
|
@ -16,6 +16,7 @@ from copy import deepcopy
|
|||
import subprocess
|
||||
|
||||
from devops.helpers import helpers as devops_helpers
|
||||
from devops.helpers.ssh_client import SSHAuth
|
||||
from proboscis import asserts
|
||||
from proboscis import test
|
||||
|
||||
|
@ -27,6 +28,9 @@ from fuelweb_test.settings import iface_alias
|
|||
from fuelweb_test.tests import base_test_case
|
||||
|
||||
|
||||
cirros_auth = SSHAuth(**settings.SSH_IMAGE_CREDENTIALS)
|
||||
|
||||
|
||||
@test(groups=["jumbo_frames"])
|
||||
class TestJumboFrames(base_test_case.TestBasic):
|
||||
def __init__(self):
|
||||
|
@ -119,7 +123,6 @@ class TestJumboFrames(base_test_case.TestBasic):
|
|||
def ping_instance_from_instance(self, source_instance,
|
||||
destination_instance,
|
||||
net_from, net_to, size, count=1):
|
||||
creds = ("cirros", "cubswin:)")
|
||||
destination_ip = self.os_conn.get_nova_instance_ip(
|
||||
destination_instance, net_name=net_to, addrtype='fixed')
|
||||
source_ip = self.os_conn.get_nova_instance_ip(
|
||||
|
@ -133,13 +136,19 @@ class TestJumboFrames(base_test_case.TestBasic):
|
|||
"Try to ping private address {0} from {1} with {2} {3} bytes "
|
||||
"packet(s): {4}".format(destination_ip, source_ip, count, size,
|
||||
command))
|
||||
ping = self.os_conn.execute_through_host(ssh, source_ip, command,
|
||||
creds)
|
||||
logger.info("Ping result: \n"
|
||||
"{0}\n"
|
||||
"{1}\n"
|
||||
"exit_code={2}".format(ping['stdout'], ping['stderr'],
|
||||
ping['exit_code']))
|
||||
|
||||
ping = ssh.execute_through_host(
|
||||
hostname=source_ip,
|
||||
cmd=command,
|
||||
auth=cirros_auth
|
||||
)
|
||||
|
||||
logger.info(
|
||||
"Ping result: \n"
|
||||
"{0}\n"
|
||||
"{1}\n"
|
||||
"exit_code={2}".format(
|
||||
ping['stdout_str'], ping['stderr_str'], ping['exit_code']))
|
||||
|
||||
return 0 == ping['exit_code']
|
||||
|
||||
|
|
|
@ -11,20 +11,26 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from warnings import warn
|
||||
|
||||
from devops.helpers.ssh_client import SSHAuth
|
||||
from devops.helpers.helpers import wait
|
||||
from proboscis.asserts import assert_equal
|
||||
from proboscis import test
|
||||
from proboscis import SkipTest
|
||||
from paramiko import ChannelException
|
||||
|
||||
from devops.helpers.helpers import wait
|
||||
|
||||
from fuelweb_test.helpers import os_actions
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.settings import SSH_IMAGE_CREDENTIALS
|
||||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
from fuelweb_test import logger
|
||||
|
||||
cirros_auth = SSHAuth(**SSH_IMAGE_CREDENTIALS)
|
||||
|
||||
|
||||
@test(enabled=False, groups=["thread_1", "neutron"])
|
||||
class TestNeutronIPv6(TestBasic):
|
||||
|
@ -189,11 +195,10 @@ class TestNeutronIPv6(TestBasic):
|
|||
with self.fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
def ssh_ready(vm_host):
|
||||
try:
|
||||
os_conn.execute_through_host(
|
||||
ssh=remote,
|
||||
vm_host=vm_host,
|
||||
remote.execute_through_host(
|
||||
hostname=vm_host,
|
||||
cmd="ls -la",
|
||||
creds=("cirros", "cubswin:)")
|
||||
auth=cirros_auth
|
||||
)
|
||||
return True
|
||||
except ChannelException:
|
||||
|
@ -205,13 +210,11 @@ class TestNeutronIPv6(TestBasic):
|
|||
):
|
||||
wait(lambda: ssh_ready(vm_host), timeout=120,
|
||||
timeout_msg='ssh is not ready on host '
|
||||
'{hostname:s} ({ip:s}) '
|
||||
'at timeout 120s'.format(hostname=hostname,
|
||||
ip=vm_host))
|
||||
'{hostname:s} ({ip:s}) at timeout 120s'
|
||||
''.format(hostname=hostname, ip=vm_host))
|
||||
|
||||
res = os_conn.execute_through_host(
|
||||
ssh=remote,
|
||||
vm_host=floating_ip.ip,
|
||||
res = remote.execute_through_host(
|
||||
hostname=floating_ip.ip,
|
||||
cmd="{ping:s} -q "
|
||||
"-c{count:d} "
|
||||
"-w{deadline:d} "
|
||||
|
@ -222,9 +225,11 @@ class TestNeutronIPv6(TestBasic):
|
|||
deadline=20,
|
||||
packetsize=1452,
|
||||
dst_address=instance2_ipv6),
|
||||
creds=("cirros", "cubswin:)")
|
||||
auth=cirros_auth
|
||||
)
|
||||
logger.info('Ping results: \n\t{res:s}'.format(res=res['stdout']))
|
||||
|
||||
logger.info(
|
||||
'Ping results: \n\t{res:s}'.format(res=res['stdout_str']))
|
||||
|
||||
assert_equal(
|
||||
res['exit_code'],
|
||||
|
@ -233,8 +238,7 @@ class TestNeutronIPv6(TestBasic):
|
|||
'\tSTDOUT: {stdout:s}\n'
|
||||
'\tSTDERR: {stderr:s}'.format(
|
||||
code=res['exit_code'],
|
||||
stdout=res['stdout'],
|
||||
stderr=res['stderr'],
|
||||
))
|
||||
stdout=res['stdout_str'],
|
||||
stderr=res['stderr_str']))
|
||||
|
||||
self.env.make_snapshot('deploy_neutron_ip_v6')
|
||||
|
|
|
@ -16,6 +16,7 @@ import random
|
|||
import time
|
||||
import traceback
|
||||
|
||||
from devops.helpers.ssh_client import SSHAuth
|
||||
from devops.helpers import helpers
|
||||
from keystoneauth1.exceptions import HttpError
|
||||
from keystoneauth1.exceptions import NotFound
|
||||
|
@ -31,6 +32,8 @@ from fuelweb_test import settings
|
|||
from fuelweb_test.tests.base_test_case import SetupEnvironment
|
||||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
|
||||
cirros_auth = SSHAuth(**settings.SSH_IMAGE_CREDENTIALS)
|
||||
|
||||
|
||||
def get_structured_config_dict(config):
|
||||
structured_conf = {}
|
||||
|
@ -231,12 +234,14 @@ class ServicesReconfiguration(TestBasic):
|
|||
timeout_msg="Can not ping instance by floating "
|
||||
"ip {0}".format(floating_ip.ip))
|
||||
|
||||
creds = ("cirros", "cubswin:)")
|
||||
controller = self.fuel_web.get_nailgun_cluster_nodes_by_roles(
|
||||
cluster_id, ['controller'])[0]['ip']
|
||||
with self.env.d_env.get_ssh_to_remote(controller) as remote:
|
||||
res = os_conn.execute_through_host(
|
||||
remote, floating_ip.ip, "mount", creds)
|
||||
res = remote.execute_through_host(
|
||||
hostname=floating_ip.ip,
|
||||
cmd="mount",
|
||||
auth=cirros_auth
|
||||
)
|
||||
asserts.assert_true('/mnt type {0}'.format(fs_type)
|
||||
in res['stdout'],
|
||||
"Ephemeral disk format was not "
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
from proboscis import test
|
||||
from proboscis.asserts import assert_true
|
||||
from devops.helpers.ssh_client import SSHAuth
|
||||
from devops.helpers.helpers import wait
|
||||
from devops.error import TimeoutError
|
||||
|
||||
|
@ -23,11 +24,14 @@ from fuelweb_test.settings import DEPLOYMENT_MODE
|
|||
from fuelweb_test.settings import SERVTEST_USERNAME
|
||||
from fuelweb_test.settings import SERVTEST_PASSWORD
|
||||
from fuelweb_test.settings import SERVTEST_TENANT
|
||||
from fuelweb_test.settings import SSH_IMAGE_CREDENTIALS
|
||||
from fuelweb_test.settings import iface_alias
|
||||
from fuelweb_test.tests.base_test_case import SetupEnvironment
|
||||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
from fuelweb_test.helpers import os_actions
|
||||
|
||||
cirros_auth = SSHAuth(**SSH_IMAGE_CREDENTIALS)
|
||||
|
||||
|
||||
@test(groups=["vcenter"])
|
||||
class VcenterDeploy(TestBasic):
|
||||
|
@ -1287,15 +1291,15 @@ class VcenterDeploy(TestBasic):
|
|||
for ip_2 in srv_ip:
|
||||
if ip_1 != ip_2:
|
||||
# Check server's connectivity
|
||||
res = int(
|
||||
os_conn.execute_through_host(
|
||||
ssh, ip_1, "ping -q -c3 " + ip_2 +
|
||||
"| grep -o '[0-9] packets received'"
|
||||
"| cut -f1 -d ' '")['stdout'])
|
||||
res = ssh.execute_through_host(
|
||||
hostname=ip_1,
|
||||
cmd="ping -q -c3 {}".format(ip_2),
|
||||
auth=cirros_auth
|
||||
)
|
||||
assert_true(
|
||||
res == 3,
|
||||
res['exit_code'] == 0,
|
||||
"VM{0} not ping from Vm {1}, received {2} icmp".format(
|
||||
ip_1, ip_2, res))
|
||||
ip_1, ip_2, res['stdout_str']))
|
||||
|
||||
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
|
||||
groups=["vcenter_ha_nova_vlan_multiple_clusters"])
|
||||
|
@ -1406,15 +1410,15 @@ class VcenterDeploy(TestBasic):
|
|||
for ip_2 in srv_ip:
|
||||
if ip_1 != ip_2:
|
||||
# Check server's connectivity
|
||||
res = int(
|
||||
os_conn.execute_through_host(
|
||||
ssh, ip_1, "ping -q -c3 " + ip_2 +
|
||||
"| grep -o '[0-9] packets received'"
|
||||
"| cut -f1 -d ' '")['stdout'])
|
||||
res = ssh.execute_through_host(
|
||||
hostname=ip_1,
|
||||
cmd="ping -q -c3 {}".format(ip_2),
|
||||
auth=cirros_auth
|
||||
)
|
||||
assert_true(
|
||||
res == 3,
|
||||
res['exit_code'] == 0,
|
||||
"VM{0} not ping from Vm {1}, received {2} icmp".format(
|
||||
ip_1, ip_2, res))
|
||||
ip_1, ip_2, res['stdout_str']))
|
||||
|
||||
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
|
||||
groups=["vcenter_ha_glance_backend_multiple_cluster"])
|
||||
|
|
|
@ -16,6 +16,7 @@ from __future__ import division
|
|||
import time
|
||||
|
||||
from devops.error import TimeoutError
|
||||
from devops.helpers.ssh_client import SSHAuth
|
||||
from proboscis import test
|
||||
from proboscis.asserts import assert_equal
|
||||
|
||||
|
@ -27,6 +28,9 @@ from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
|||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
|
||||
|
||||
cirros_auth = SSHAuth(**settings.SSH_IMAGE_CREDENTIALS)
|
||||
|
||||
|
||||
@test(groups=['failover_group_3'])
|
||||
class FailoverGroup3(TestBasic):
|
||||
"""FailoverGroup3""" # TODO documentation
|
||||
|
@ -181,7 +185,10 @@ class FailoverGroup3(TestBasic):
|
|||
with self.fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
for ip in [floating_ip_1.ip, floating_ip_2.ip]:
|
||||
for cmd in cmds:
|
||||
res = os.execute_through_host(remote, ip, cmd)
|
||||
res = remote.execute_through_host(
|
||||
hostname=ip,
|
||||
cmd=cmd,
|
||||
auth=cirros_auth)
|
||||
logger.info('RESULT for {}: {}'.format(
|
||||
cmd,
|
||||
utils.pretty_log(res))
|
||||
|
@ -189,7 +196,10 @@ class FailoverGroup3(TestBasic):
|
|||
logger.info('Wait 7200 untill "dd" ends')
|
||||
for _ in range(720):
|
||||
cmd = 'ps -ef |grep -v grep| grep "dd if" '
|
||||
res = os.execute_through_host(remote, ip, cmd)
|
||||
res = remote.execute_through_host(
|
||||
hostname=ip,
|
||||
cmd=cmd,
|
||||
auth=cirros_auth)
|
||||
if res['exit_code'] != 0:
|
||||
break
|
||||
time.sleep(10)
|
||||
|
@ -199,8 +209,10 @@ class FailoverGroup3(TestBasic):
|
|||
raise TimeoutError('BigFile has not been'
|
||||
' created yet, after 7200 sec')
|
||||
cmd = 'md5sum /mnt/bigfile'
|
||||
md5s[ip] = os.execute_through_host(remote,
|
||||
ip, cmd)['stdout']
|
||||
md5s[ip] = remote.execute_through_host(
|
||||
hostname=ip,
|
||||
cmd=cmd,
|
||||
auth=cirros_auth)['stdout']
|
||||
|
||||
self.show_step(9)
|
||||
nodes = {'compute': [], 'controller': [], 'ceph-osd': []}
|
||||
|
@ -233,7 +245,10 @@ class FailoverGroup3(TestBasic):
|
|||
with self.fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
for ip in [floating_ip_1.ip, floating_ip_2.ip]:
|
||||
cmd = 'md5sum /mnt/bigfile'
|
||||
md5 = os.execute_through_host(remote, ip, cmd)['stdout']
|
||||
md5 = remote.execute_through_host(
|
||||
hostname=ip,
|
||||
cmd=cmd,
|
||||
auth=cirros_auth)['stdout']
|
||||
assert_equal(md5, md5s[ip],
|
||||
"Actual md5sum {0} doesnt match"
|
||||
" with old one {1} on {2}".format(
|
||||
|
@ -381,7 +396,10 @@ class FailoverGroup3(TestBasic):
|
|||
with self.fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
for ip in [floating_ip_1.ip, floating_ip_2.ip]:
|
||||
for cmd in cmds:
|
||||
res = os.execute_through_host(remote, ip, cmd)
|
||||
res = remote.execute_through_host(
|
||||
hostname=ip,
|
||||
cmd=cmd,
|
||||
auth=cirros_auth)
|
||||
logger.info('RESULT for {}: {}'.format(
|
||||
cmd,
|
||||
utils.pretty_log(res))
|
||||
|
@ -389,7 +407,10 @@ class FailoverGroup3(TestBasic):
|
|||
logger.info('Wait 7200 untill "dd" ends')
|
||||
for _ in range(720):
|
||||
cmd = 'ps -ef |grep -v grep| grep "dd if" '
|
||||
res = os.execute_through_host(remote, ip, cmd)
|
||||
res = remote.execute_through_host(
|
||||
hostname=ip,
|
||||
cmd=cmd,
|
||||
auth=cirros_auth)
|
||||
if res['exit_code'] != 0:
|
||||
break
|
||||
time.sleep(15)
|
||||
|
@ -399,8 +420,10 @@ class FailoverGroup3(TestBasic):
|
|||
raise TimeoutError('BigFile has not been'
|
||||
' created yet, after 7200 sec')
|
||||
cmd = 'md5sum /mnt/bigfile'
|
||||
md5s[ip] = os.execute_through_host(remote,
|
||||
ip, cmd)['stdout']
|
||||
md5s[ip] = remote.execute_through_host(
|
||||
hostname=ip,
|
||||
cmd=cmd,
|
||||
auth=cirros_auth)['stdout']
|
||||
self.show_step(9)
|
||||
nodes = {'compute': [], 'controller': [], 'cinder': []}
|
||||
|
||||
|
@ -433,7 +456,10 @@ class FailoverGroup3(TestBasic):
|
|||
with self.fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
for ip in [floating_ip_1.ip, floating_ip_2.ip]:
|
||||
cmd = 'md5sum /mnt/bigfile'
|
||||
md5 = os.execute_through_host(remote, ip, cmd)['stdout']
|
||||
md5 = remote.execute_through_host(
|
||||
hostname=ip,
|
||||
cmd=cmd,
|
||||
auth=cirros_auth)['stdout']
|
||||
assert_equal(md5, md5s[ip],
|
||||
"Actual md5sum {0} doesnt match"
|
||||
" with old one {1} on {2}".format(
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
import time
|
||||
|
||||
from devops.error import TimeoutError
|
||||
from devops.helpers.ssh_client import SSHAuth
|
||||
from proboscis import test
|
||||
from proboscis.asserts import assert_true
|
||||
|
||||
|
@ -27,6 +28,9 @@ from fuelweb_test.helpers.rally import RallyBenchmarkTest
|
|||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
|
||||
|
||||
cirros_auth = SSHAuth(**settings.SSH_IMAGE_CREDENTIALS)
|
||||
|
||||
|
||||
@test(groups=['network_outage'])
|
||||
class NetworkOutage(TestBasic):
|
||||
"""NetworkOutage""" # TODO documentation
|
||||
|
@ -133,7 +137,10 @@ class NetworkOutage(TestBasic):
|
|||
with self.fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
for ip in [floating_ip_1.ip, floating_ip_2.ip]:
|
||||
for cmd in cmds:
|
||||
res = os.execute_through_host(remote, ip, cmd)
|
||||
res = remote.execute_through_host(
|
||||
hostname=ip,
|
||||
cmd=cmd,
|
||||
auth=cirros_auth)
|
||||
logger.info('RESULT for {}: {}'.format(
|
||||
cmd,
|
||||
utils.pretty_log(res))
|
||||
|
@ -141,7 +148,10 @@ class NetworkOutage(TestBasic):
|
|||
logger.info('Wait 7200 untill "dd" ends')
|
||||
for _ in range(720):
|
||||
cmd = 'ps -ef |grep -v grep| grep "dd if" '
|
||||
res = os.execute_through_host(remote, ip, cmd)
|
||||
res = remote.execute_through_host(
|
||||
hostname=ip,
|
||||
cmd=cmd,
|
||||
auth=cirros_auth)
|
||||
if res['exit_code'] != 0:
|
||||
break
|
||||
time.sleep(15)
|
||||
|
@ -151,8 +161,10 @@ class NetworkOutage(TestBasic):
|
|||
raise TimeoutError('BigFile has not been'
|
||||
' created yet, after 7200 sec')
|
||||
cmd = 'md5sum /mnt/bigfile'
|
||||
md5s[ip] = os.execute_through_host(remote,
|
||||
ip, cmd)['stdout']
|
||||
md5s[ip] = remote.execute_through_host(
|
||||
hostname=ip,
|
||||
cmd=cmd,
|
||||
auth=cirros_auth)['stdout']
|
||||
self.show_step(4)
|
||||
assert_true(settings.PATCHING_RUN_RALLY,
|
||||
'PATCHING_RUN_RALLY was not set in true')
|
||||
|
@ -307,7 +319,10 @@ class NetworkOutage(TestBasic):
|
|||
with self.fuel_web.get_ssh_for_node("slave-01") as remote:
|
||||
for ip in [floating_ip_1.ip, floating_ip_2.ip]:
|
||||
for cmd in cmds:
|
||||
res = os.execute_through_host(remote, ip, cmd)
|
||||
res = remote.execute_through_host(
|
||||
hostname=ip,
|
||||
cmd=cmd,
|
||||
auth=cirros_auth)
|
||||
logger.info('RESULT for {}: {}'.format(
|
||||
cmd,
|
||||
utils.pretty_log(res))
|
||||
|
@ -315,7 +330,10 @@ class NetworkOutage(TestBasic):
|
|||
logger.info('Wait 7200 untill "dd" ends')
|
||||
for _ in range(720):
|
||||
cmd = 'ps -ef |grep -v grep| grep "dd if" '
|
||||
res = os.execute_through_host(remote, ip, cmd)
|
||||
res = remote.execute_through_host(
|
||||
hostname=ip,
|
||||
cmd=cmd,
|
||||
auth=cirros_auth)
|
||||
if res['exit_code'] != 0:
|
||||
break
|
||||
time.sleep(10)
|
||||
|
@ -325,8 +343,10 @@ class NetworkOutage(TestBasic):
|
|||
raise TimeoutError('BigFile has not been'
|
||||
' created yet, after 7200 sec')
|
||||
cmd = 'md5sum /mnt/bigfile'
|
||||
md5s[ip] = os.execute_through_host(remote,
|
||||
ip, cmd)['stdout']
|
||||
md5s[ip] = remote.execute_through_host(
|
||||
hostname=ip,
|
||||
cmd=cmd,
|
||||
auth=cirros_auth)['stdout']
|
||||
self.show_step(4)
|
||||
assert_true(settings.PATCHING_RUN_RALLY,
|
||||
'PATCHING_RUN_RALLY was not set in true')
|
||||
|
|
|
@ -17,7 +17,7 @@ from random import randrange
|
|||
from time import sleep
|
||||
|
||||
from devops.helpers import helpers
|
||||
|
||||
from devops.helpers.ssh_client import SSHAuth
|
||||
from proboscis import SkipTest
|
||||
from proboscis.asserts import assert_equal
|
||||
from proboscis.asserts import assert_not_equal
|
||||
|
@ -29,12 +29,16 @@ from fuelweb_test.settings import NEUTRON
|
|||
from fuelweb_test.settings import SERVTEST_PASSWORD
|
||||
from fuelweb_test.settings import SERVTEST_TENANT
|
||||
from fuelweb_test.settings import SERVTEST_USERNAME
|
||||
from fuelweb_test.settings import SSH_IMAGE_CREDENTIALS
|
||||
from system_test import action
|
||||
from system_test import deferred_decorator
|
||||
from system_test import logger
|
||||
from system_test.helpers.decorators import make_snapshot_if_step_fail
|
||||
|
||||
|
||||
cirros_auth = SSHAuth(**SSH_IMAGE_CREDENTIALS)
|
||||
|
||||
|
||||
# pylint: disable=no-member
|
||||
# noinspection PyUnresolvedReferences
|
||||
class VMwareActions(object):
|
||||
|
@ -319,8 +323,12 @@ class VMwareActions(object):
|
|||
self.cluster_id, ["controller"])[0]
|
||||
with self.fuel_web.get_ssh_for_nailgun_node(controller) as remote:
|
||||
cmd = 'sudo /sbin/fdisk -l | grep {}'.format(mount_point)
|
||||
res = os_conn.execute_through_host(remote, floating_ip.ip, cmd)
|
||||
logger.debug('OUTPUT: {}'.format(res))
|
||||
res = remote.execute_through_host(
|
||||
hostname=floating_ip.ip,
|
||||
cmd=cmd,
|
||||
auth=cirros_auth
|
||||
)
|
||||
logger.debug('OUTPUT: {}'.format(res['stdout_str']))
|
||||
assert_equal(res['exit_code'], 0, "Attached volume is not found")
|
||||
|
||||
os_conn.delete_instance(vm)
|
||||
|
@ -457,9 +465,12 @@ class VMwareActions(object):
|
|||
self.cluster_id, ["controller"])[0]
|
||||
with self.fuel_web.get_ssh_for_nailgun_node(controller) as remote:
|
||||
cmd = '/usr/bin/lshw -class network | grep vmxnet3'
|
||||
res = os_conn.execute_through_host(remote, floating_ip.ip, cmd,
|
||||
creds=self.image_creds)
|
||||
logger.debug('OUTPUT: {}'.format(res))
|
||||
res = remote.execute_through_host(
|
||||
hostname=floating_ip.ip,
|
||||
cmd=cmd,
|
||||
auth=self.image_creds
|
||||
)
|
||||
logger.debug('OUTPUT: {}'.format(res['stdout_str']))
|
||||
assert_equal(res['exit_code'], 0, "VMxnet3 driver is not found")
|
||||
|
||||
os_conn.delete_instance(vm)
|
||||
|
@ -799,14 +810,17 @@ class VMwareActions(object):
|
|||
:param size: number of data bytes to be sent
|
||||
:param count: number of packets to be sent
|
||||
"""
|
||||
creds = ("cirros", "cubswin:)")
|
||||
|
||||
with self.fuel_web.get_ssh_for_node(primary) as ssh:
|
||||
command = "ping -s {0} -c {1} {2}".format(size, count,
|
||||
dst_ip)
|
||||
ping = self.os_conn.execute_through_host(ssh, src_floating_ip,
|
||||
command, creds)
|
||||
logger.info("Ping result is {}".format(ping['exit_code']))
|
||||
ping = ssh.execute_through_host(
|
||||
hostname=src_floating_ip,
|
||||
cmd=command,
|
||||
auth=cirros_auth
|
||||
)
|
||||
|
||||
logger.info("Ping result is {}".format(ping['stdout_str']))
|
||||
return 0 == ping['exit_code']
|
||||
|
||||
@deferred_decorator([make_snapshot_if_step_fail])
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from devops.helpers.ssh_client import SSHAuth
|
||||
|
||||
from fuelweb_test.settings import DVS_PLUGIN_PATH
|
||||
from fuelweb_test.settings import DVS_PLUGIN_VERSION
|
||||
from fuelweb_test.settings import VMWARE_IMG_LOGIN
|
||||
|
@ -418,7 +420,7 @@ class UploadImage(ActionTest, BaseActions, VMwareActions):
|
|||
plugin_version = DVS_PLUGIN_VERSION
|
||||
image_name = VMWARE_IMG_NAME
|
||||
image_url = VMWARE_IMG_URL
|
||||
image_creds = (VMWARE_IMG_LOGIN, VMWARE_IMG_PASSWORD)
|
||||
image_creds = SSHAuth(VMWARE_IMG_LOGIN, VMWARE_IMG_PASSWORD)
|
||||
|
||||
actions_order = [
|
||||
'prepare_env_with_plugin',
|
||||
|
@ -458,7 +460,7 @@ class Vmxnet3(ActionTest, BaseActions, VMwareActions):
|
|||
plugin_version = DVS_PLUGIN_VERSION
|
||||
image_name = VMWARE_IMG_NAME
|
||||
image_url = VMWARE_IMG_URL
|
||||
image_creds = (VMWARE_IMG_LOGIN, VMWARE_IMG_PASSWORD)
|
||||
image_creds = SSHAuth(VMWARE_IMG_LOGIN, VMWARE_IMG_PASSWORD)
|
||||
|
||||
actions_order = [
|
||||
'prepare_env_with_plugin',
|
||||
|
|
Loading…
Reference in New Issue