aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py')
-rw-r--r--tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py
new file mode 100644
index 00000000..52d7e0ea
--- /dev/null
+++ b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py
@@ -0,0 +1,16 @@
+from robot.api import logger
+import HttpRequests
+
+CONSUL_NAME = "Consul"
+
+class ConsulLibrary:
+
+ def publish_hv_ves_configuration_in_consul(self, consul_url, consul_configuration_filepath):
+ logger.info("Reading consul configuration file from: " + consul_configuration_filepath)
+ file = open(consul_configuration_filepath, "rb")
+ data = file.read()
+ file.close()
+
+ logger.info("PUT at: " + consul_url)
+ resp = HttpRequests.session_without_env().put(consul_url, data=data, timeout=5)
+ HttpRequests.checkStatusCode(resp.status_code, CONSUL_NAME) \ No newline at end of file