aboutsummaryrefslogtreecommitdiffstats
path: root/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py
blob: 52d7e0eabaaa4bf6cb531c728cac156e95bc14e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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)