robot tcs, test charts, robot container added
[ta/cloudtaf.git] / testcases / basic_func_tests / tc_003_test_registry.py
1 import sys
2 import os
3 from robot.libraries.BuiltIn import BuiltIn
4 from robot.api import logger
5 from test_constants import *
6
7 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '../libraries/common'))
8 import common_utils  # noqa
9
10
11 ex = BuiltIn().get_library_instance('execute_command')
12 stack_infos = BuiltIn().get_library_instance('stack_infos')
13 crf_nodes = stack_infos.get_crf_nodes()
14 all_nodes = stack_infos.get_all_nodes()
15 temp_image_tag = 'test'
16
17
18 def tc_003_test_registry():
19     steps = ['step_1_test_registry']
20     common_utils.keyword_runner(steps)
21
22
23 def step_1_test_registry():
24     docker_img_tag_command = "docker images | grep {0} | awk '{{ print $2 }}' | head -n1".format(test_image)
25     image_tag = ex.execute_unix_command(docker_img_tag_command).strip()
26     image = reg + ':' + reg_port + '/' + reg_path + '/' + test_image + ':' + image_tag
27     command = 'docker rmi ' + image + '; docker pull ' + image + '; docker push ' + image
28     logger.console("")
29     for key in all_nodes:
30         ex.execute_unix_command_on_remote_as_root(command, all_nodes[key], delay="30s",)
31         logger.console(key + ": registry reachable.")