aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/DockerContainerManager.py
diff options
context:
space:
mode:
authorMarcin Przybysz <marcin.przybysz@nokia.com>2021-03-02 07:25:10 +0000
committerGerrit Code Review <gerrit@onap.org>2021-03-02 07:25:10 +0000
commitf767caa1d32370f28917f243227f2292105c071e (patch)
tree4f56a7bab9e9cedd8442334f0389c75640d909dc /tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/DockerContainerManager.py
parent527b6f87106cef6651cd6800709c1f2368926a84 (diff)
parent59bad158d7dd96c157fb9387db2de8ecb9214914 (diff)
Merge "Add CSITs for Pm-mapper files processing performance"
Diffstat (limited to 'tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/DockerContainerManager.py')
-rw-r--r--tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/DockerContainerManager.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/DockerContainerManager.py b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/DockerContainerManager.py
new file mode 100644
index 00000000..3e3ae58e
--- /dev/null
+++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/DockerContainerManager.py
@@ -0,0 +1,29 @@
+import docker
+from EnvsReader import EnvsReader
+from docker.types import Mount
+
+class DockerContainerManager:
+
+ def run_pmmapper_container(self, client_image, container_name, path_to_env, dr_node_ip, mr_ip):
+ client = docker.from_env()
+ environment = EnvsReader().read_env_list_from_file(path_to_env)
+ environment.append("CONFIG_BINDING_SERVICE_SERVICE_HOST=172.18.0.5")
+ environment.append("CONFIG_BINDING_SERVICE_SERVICE_PORT=10000")
+ environment.append("HOSTNAME=pmmapper")
+ client.containers.run(
+ image=client_image,
+ name=container_name,
+ environment=environment,
+ ports={'8081': 8081},
+ network='filesprocessingconfigpmmapper_pmmapper-network',
+ extra_hosts={'dmaap-dr-node': dr_node_ip, 'message-router': mr_ip},
+ user='root',
+ mounts=[Mount(target='/opt/app/pm-mapper/etc/certs/', source='/var/tmp/', type='bind')],
+ detach=True
+ )
+
+ def remove_container(self, container_name):
+ client = docker.from_env()
+ container = client.containers.get(container_name)
+ container.stop()
+ container.remove()