Example #1
0
def service_and_service_path(context):
    """
    configuration of service an service path in headers
    :param context:
    """
    global cb
    properties_class = Properties()
    props = properties_class.read_properties()[CONTEXT_BROKER_ENV]
    cb = CB(protocol=props["CB_PROTOCOL"], host=props["CB_HOST"], port=props["CB_PORT"])
    cb.definition_headers(context)
Example #2
0
def send_a_statistics_request(context):
    """
    send a statistics request
    :param context:
    """
    global cb, resp, props_cb_env
    __logger__.debug("Sending a statistics request...")
    properties_class = Properties()
    props_cb_env = properties_class.read_properties()[CONTEXT_BROKER_ENV]
    cb = CB(protocol=props_cb_env["CB_PROTOCOL"], host=props_cb_env["CB_HOST"], port=props_cb_env["CB_PORT"])
    resp = cb.get_statistics_request()
    __logger__.info("..Sent a statistics request correctly")
Example #3
0
def send_a_base_request(context):
    """
    send a API entry point request
    :param context:
    """
    global cb, resp
    __logger__.debug("Sending a API entry point request: /v2 ...")
    properties_class = Properties()
    props = properties_class.read_properties()[CONTEXT_BROKER_ENV]
    cb = CB(protocol=props["CB_PROTOCOL"], host=props["CB_HOST"], port=props["CB_PORT"])
    resp = cb.get_base_request()
    __logger__.info("...Sent a API entry point request: /v2 correctly")
Example #4
0
def service_and_service_path(context):
    """
    configuration of service an service path in headers
    :param context:
    """
    global cb
    properties_class = Properties()
    props = properties_class.read_properties()[CONTEXT_BROKER_ENV]
    cb = CB(protocol=props["CB_PROTOCOL"],
            host=props["CB_HOST"],
            port=props["CB_PORT"])
    cb.definition_headers(context)
Example #5
0
def send_a_statistics_request(context):
    """
    send a statistics request
    :param context:
    """
    global cb, resp, props_cb_env
    __logger__.debug("Sending a statistics request...")
    properties_class = Properties()
    props_cb_env = properties_class.read_properties()[CONTEXT_BROKER_ENV]
    cb = CB(protocol=props_cb_env["CB_PROTOCOL"],
            host=props_cb_env["CB_HOST"],
            port=props_cb_env["CB_PORT"])
    resp = cb.get_statistics_request()
    __logger__.info("..Sent a statistics request correctly")
Example #6
0
def send_a_base_request(context):
    """
    send a API entry point request
    :param context:
    """
    global cb, resp
    __logger__.debug("Sending a API entry point request: /v2 ...")
    properties_class = Properties()
    props = properties_class.read_properties()[CONTEXT_BROKER_ENV]
    cb = CB(protocol=props["CB_PROTOCOL"],
            host=props["CB_HOST"],
            port=props["CB_PORT"])
    resp = cb.get_base_request()
    __logger__.info("...Sent a API entry point request: /v2 correctly")
Example #7
0
def verify_context_broker_is_installed_successfully(context):
    """
    verify contextBroker is installed successfully
    :param context:
    """
    global props_cb
    __logger__.debug(" >> verify if contextBroker is installed successfully")
    __logger__.debug("Sending a version request...")

    cb = CB(protocol=props_cb["CB_PROTOCOL"], host=props_cb["CB_HOST"], port=props_cb["CB_PORT"])
    resp = cb.get_version_request()
    if props_cb["CB_VERIFY_VERSION"].lower() == "true":
        resp_dict = convert_str_to_dict(str(resp.text), "JSON")
        assert resp_dict["orion"]["version"].find(
            props_cb["CB_VERSION"]) >= 0, " ERROR in context broker version  value, \n " \
                                          " expected: %s \n" \
                                          " installed: %s" % (props_cb["CB_VERSION"], resp_dict["orion"]["version"])
        __logger__.debug("-- version %s is correct in base request v2" % props_cb["CB_VERSION"])
    __logger__.info(" >> verified that contextBroker is installed successfully")