
Include: - util modules. such as table_parser, ssh/localhost clients, cli module, exception, logger, etc. Util modules are mostly used by keywords. - keywords modules. These are helper functions that are used directly by test functions. - platform (with platform or platform_sanity marker) and stx-openstack (with sanity, sx_sanity, cpe_sanity, or storage_sanity marker) sanity testcases - pytest config conftest, and test fixture modules - test config file template/example Required packages: - python3.4 or python3.5 - pytest >=3.10,<4.0 - pexpect - requests - pyyaml - selenium (firefox, ffmpeg, pyvirtualdisplay, Xvfb or Xephyr or Xvnc) Limitations: - Anything that requires copying from Test File Server will not work until a public share is configured to shared test files. Tests skipped for now. Co-Authored-By: Maria Yousaf <maria.yousaf@windriver.com> Co-Authored-By: Marvin Huang <marvin.huang@windriver.com> Co-Authored-By: Yosief Gebremariam <yosief.gebremariam@windriver.com> Co-Authored-By: Paul Warner <paul.warner@windriver.com> Co-Authored-By: Xueguang Ma <Xueguang.Ma@windriver.com> Co-Authored-By: Charles Chen <charles.chen@windriver.com> Co-Authored-By: Daniel Graziano <Daniel.Graziano@windriver.com> Co-Authored-By: Jordan Li <jordan.li@windriver.com> Co-Authored-By: Nimalini Rasa <nimalini.rasa@windriver.com> Co-Authored-By: Senthil Mukundakumar <senthil.mukundakumar@windriver.com> Co-Authored-By: Anuejyan Manokeran <anujeyan.manokeran@windriver.com> Co-Authored-By: Peng Peng <peng.peng@windriver.com> Co-Authored-By: Chris Winnicki <chris.winnicki@windriver.com> Co-Authored-By: Joe Vimar <Joe.Vimar@windriver.com> Co-Authored-By: Alex Kozyrev <alex.kozyrev@windriver.com> Co-Authored-By: Jack Ding <jack.ding@windriver.com> Co-Authored-By: Ming Lei <ming.lei@windriver.com> Co-Authored-By: Ankit Jain <ankit.jain@windriver.com> Co-Authored-By: Eric Barrett <eric.barrett@windriver.com> Co-Authored-By: William Jia <william.jia@windriver.com> Co-Authored-By: Joseph Richard <Joseph.Richard@windriver.com> Co-Authored-By: Aldo Mcfarlane <aldo.mcfarlane@windriver.com> Story: 2005892 Task: 33750 Signed-off-by: Yang Liu <yang.liu@windriver.com> Change-Id: I7a88a47e09733d39f024144530f5abb9aee8cad2
67 lines
2.3 KiB
Python
Executable File
67 lines
2.3 KiB
Python
Executable File
#
|
|
# Copyright (c) 2019 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
|
|
from pytest import mark
|
|
|
|
from consts.stx import HostAvailState
|
|
from keywords import system_helper, network_helper, host_helper
|
|
from utils.clients.ssh import ControllerClient
|
|
from utils.tis_log import LOG
|
|
|
|
|
|
@mark.p3
|
|
def test_ping_hosts():
|
|
con_ssh = ControllerClient.get_active_controller()
|
|
|
|
ping_failed_list = []
|
|
for hostname in system_helper.get_hosts():
|
|
LOG.tc_step(
|
|
"Send 100 pings to {} from Active Controller".format(hostname))
|
|
ploss_rate, untran_p = network_helper.ping_server(hostname, con_ssh,
|
|
num_pings=100,
|
|
timeout=300,
|
|
fail_ok=True)
|
|
if ploss_rate > 0:
|
|
if ploss_rate == 100:
|
|
ping_failed_list.append(
|
|
"{}: Packet loss rate: {}/100\n".format(hostname,
|
|
ploss_rate))
|
|
else:
|
|
ping_failed_list.append(
|
|
"{}: All packets dropped.\n".format(hostname))
|
|
if untran_p > 0:
|
|
ping_failed_list.append(
|
|
"{}: {}/100 pings are untransmitted within 300 seconds".format(
|
|
hostname, untran_p))
|
|
|
|
LOG.tc_step("Ensure all packets are received.")
|
|
assert not ping_failed_list, "Dropped/Un-transmitted packets detected " \
|
|
"when ping hosts. " \
|
|
"Details:\n{}".format(ping_failed_list)
|
|
|
|
|
|
@mark.sanity
|
|
@mark.cpe_sanity
|
|
@mark.sx_sanity
|
|
def test_ssh_to_hosts():
|
|
"""
|
|
Test ssh to every host on system from active controller
|
|
|
|
"""
|
|
hosts_to_ssh = system_helper.get_hosts(
|
|
availability=[HostAvailState.AVAILABLE, HostAvailState.ONLINE])
|
|
failed_list = []
|
|
for hostname in hosts_to_ssh:
|
|
LOG.tc_step("Attempt SSH to {}".format(hostname))
|
|
try:
|
|
with host_helper.ssh_to_host(hostname):
|
|
pass
|
|
except Exception as e:
|
|
failed_list.append("\n{}: {}".format(hostname, e.__str__()))
|
|
|
|
assert not failed_list, "SSH to host(s) failed: {}".format(failed_list)
|