X-Git-Url: https://gerrit.akraino.org/r/gitweb?p=ta%2Fcloudtaf.git;a=blobdiff_plain;f=testcases%2Fbasic_func_tests%2Ftc_004_ssh_file_check.py;fp=testcases%2Fbasic_func_tests%2Ftc_004_ssh_file_check.py;h=57d18716462c0339b3b237310adc8a5e7f37f65b;hp=0000000000000000000000000000000000000000;hb=af5eb3ff36b92ab1d9c156ffa0391eadc73eb6ba;hpb=025a45508d009db84c34076fb4a668f712628d6d diff --git a/testcases/basic_func_tests/tc_004_ssh_file_check.py b/testcases/basic_func_tests/tc_004_ssh_file_check.py new file mode 100644 index 0000000..57d1871 --- /dev/null +++ b/testcases/basic_func_tests/tc_004_ssh_file_check.py @@ -0,0 +1,36 @@ +import sys +import os +from robot.libraries.BuiltIn import BuiltIn +from robot.api import logger +import common_utils +from test_constants import * + +sys.path.append(os.path.join(os.path.dirname(__file__), '..', '../libraries/common')) + +ex = BuiltIn().get_library_instance('execute_command') +stack_infos = BuiltIn().get_library_instance('stack_infos') + + +def tc_004_ssh_file_check(): + steps = ['step1_openstack_file_check_on_crf_nodes'] + common_utils.keyword_runner(steps) + + +def step1_openstack_file_check_on_crf_nodes(): + check_file(stack_infos.get_crf_nodes(), '/etc/userconfig/', crf_node_openstack_file_types) + + +def check_file(nodes, folder, files): + if not nodes: + logger.info("Nodes dictionary is empty, nothing to check.") + return + for key in nodes: + logger.console("\n" + key + " " + nodes[key]) + for f in files: + full_file_path = folder + f + command = 'ls ' + full_file_path + ' | wc -l' + stdout = ex.execute_unix_command_on_remote_as_user(command, nodes[key]) + if stdout == "1": + logger.console(full_file_path + " exists.") + else: + raise Exception(full_file_path + " not exists !")