diff options
author | Marcin Przybysz <marcin.przybysz@nokia.com> | 2020-03-10 13:23:09 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-03-10 13:23:09 +0000 |
commit | 4b938ffd66e2c32b17807783a85d19052838a36b (patch) | |
tree | 534f699f6a41b90cda96c594159d9c2c4e819649 /tests/aaf/certservice/libraries/CertClientManager.py | |
parent | 93cf4f5a63d58770ee9c4c21a91869b3f9baf755 (diff) | |
parent | 75573b0409eeabbd08f3a2801fd11c47078a249f (diff) |
Merge "Add CSIT for Cert Service Client"
Diffstat (limited to 'tests/aaf/certservice/libraries/CertClientManager.py')
-rw-r--r-- | tests/aaf/certservice/libraries/CertClientManager.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/aaf/certservice/libraries/CertClientManager.py b/tests/aaf/certservice/libraries/CertClientManager.py new file mode 100644 index 00000000..30501c8b --- /dev/null +++ b/tests/aaf/certservice/libraries/CertClientManager.py @@ -0,0 +1,27 @@ +import docker + + +class CertClientManager: + + def run_client_container(self, client_image, container_name, path_to_env, request_url, network): + client = docker.from_env() + environment = self.read_list_env_from_file(path_to_env) + environment.append("REQUEST_URL=" + request_url) + container = client.containers.run(image=client_image, name=container_name, detach=True, environment=environment, + network=network) + exitcode = container.wait() + return exitcode + + def remove_client_container(self, container_name): + client = docker.from_env() + container = client.containers.get(container_name) + container.remove() + + def read_list_env_from_file(self, path): + f = open(path, "r") + r_list = [] + for line in f: + line = line.strip() + if line[0] != "#": + r_list.append(line) + return r_list |