예제 #1
0
def start_runtime0(runtimes, hostname, request_handler, tls=False, enroll_passwords=False):
    from calvin.Tools.csruntime import csruntime
    from conftest import _config_pytest
    #Start runtime 0 as it takes alot of time to start, and needs to be up before the others start
    _log.info("Starting runtime 0")
    try:
        logfile = _config_pytest.getoption("logfile")+"5000"
        outfile = os.path.join(os.path.dirname(logfile), os.path.basename(logfile).replace("log", "out"))
        if outfile == logfile:
            outfile = None
    except:
        logfile = None
        outfile = None
    try:
        # Dump attribute file to allow manual check of starting runtimes later
        json.dump(runtimes[0]["attributes"], open("/tmp/calvin5000.attr", "w"))
    except:
        pass
    csruntime(hostname, port=5000, controlport=5020, attr=runtimes[0]["attributes"],
               loglevel=_config_pytest.getoption("loglevel"), logfile=logfile, outfile=outfile,
               configfile="/tmp/calvin5000.conf")
    uri = "calvinip://{}:5000".format(hostname)
    curi = "https://{}:5020".format(hostname) if tls==True else "http://{}:5020".format(hostname)
    runtimes[0]['RT'] = RT(curi)
    runtimes[0]['RT'].uris=[uri]
    runtimes[0]['RT'].attributes=runtimes[0]["attributes"]

    #Wait for runtime 0 to be up and running
    wait_for_runtime(request_handler, runtimes[0]["RT"])
예제 #2
0
def start_other_runtimes(runtimes, hostname, request_handler, tls=False):
    from calvin.Tools.csruntime import csruntime
    from conftest import _config_pytest
    #Start the other runtimes
    for i in range(1, len(runtimes)):
        _log.info("Starting runtime {}".format(i))
        try:
            logfile = _config_pytest.getoption("logfile") + "500{}".format(i)
            outfile = os.path.join(
                os.path.dirname(logfile),
                os.path.basename(logfile).replace("log", "out"))
            if outfile == logfile:
                outfile = None
        except:
            logfile = None
            outfile = None
        try:
            # Dump attribute file to allow manual check of starting runtimes later
            json.dump(runtimes[0]["attributes"],
                      open("/tmp/calvin500{}.attr".format(i), "w"))
        except:
            pass
        csruntime(hostname,
                  port=5000 + i,
                  controlport=5020 + i,
                  attr=runtimes[i]["attributes"],
                  loglevel=_config_pytest.getoption("loglevel"),
                  logfile=logfile,
                  outfile=outfile,
                  configfile="/tmp/calvin500{}.conf".format(i))
        uri = "calvinip://{}:500{}".format(hostname, i)
        curi = "https://{}:502{}".format(
            hostname, i) if tls == True else "http://{}:502{}".format(
                hostname, i)
        requests_rt = RT(curi)
        runtimes[i]['RT'] = RT(curi)
        runtimes[i]['RT'].uris = [uri]
        runtimes[i]['RT'].attributes = runtimes[i]["attributes"]
        time.sleep(0.1)
    time.sleep(1)
    try:
        security_verify_storage(runtimes, request_handler)
    except Exception as err:
        _log.error("Failed storage verification, err={}".format(err))
        raise
예제 #3
0
def start_other_runtimes(runtimes, hostname, request_handler, tls=False):
    from calvin.Tools.csruntime import csruntime
    from conftest import _config_pytest
    #Start the other runtimes
    for i in range(1, len(runtimes)):
        _log.info("Starting runtime {}".format(i))
        try:
            logfile = _config_pytest.getoption("logfile")+"500{}".format(i)
            outfile = os.path.join(os.path.dirname(logfile), os.path.basename(logfile).replace("log", "out"))
            if outfile == logfile:
                outfile = None
        except:
            logfile = None
            outfile = None
        try:
            # Dump attribute file to allow manual check of starting runtimes later
            json.dump(runtimes[0]["attributes"], open("/tmp/calvin500{}.attr".format(i), "w"))
        except:
            pass
        csruntime(hostname,
                  port=5000+i,
                  controlport=5020+i,
                  attr=runtimes[i]["attributes"],
                  loglevel=_config_pytest.getoption("loglevel"),
                  logfile=logfile,
                  outfile=outfile,
                  configfile="/tmp/calvin500{}.conf".format(i))
        uri = "calvinip://{}:500{}".format(hostname, i)
        curi = "https://{}:502{}".format(hostname, i) if tls==True else "http://{}:502{}".format(hostname, i)
        requests_rt = RT(curi)
        runtimes[i]['RT'] = RT(curi)
        runtimes[i]['RT'].uris = [uri]
        runtimes[i]['RT'].attributes=runtimes[i]["attributes"]
        time.sleep(0.1)
    time.sleep(1)
    try:
        security_verify_storage(runtimes, request_handler)
    except Exception as err:
        _log.error("Failed storage verification, err={}".format(err))
        raise
예제 #4
0
def start_runtime0(runtimes,
                   hostname,
                   request_handler,
                   tls=False,
                   enroll_passwords=False):
    from calvin.Tools.csruntime import csruntime
    from conftest import _config_pytest
    #Start runtime 0 as it takes alot of time to start, and needs to be up before the others start
    _log.info("Starting runtime 0")
    try:
        logfile = _config_pytest.getoption("logfile") + "5000"
        outfile = os.path.join(os.path.dirname(logfile),
                               os.path.basename(logfile).replace("log", "out"))
        if outfile == logfile:
            outfile = None
    except:
        logfile = None
        outfile = None
    try:
        # Dump attribute file to allow manual check of starting runtimes later
        json.dump(runtimes[0]["attributes"], open("/tmp/calvin5000.attr", "w"))
    except:
        pass
    csruntime(hostname,
              port=5000,
              controlport=5020,
              attr=runtimes[0]["attributes"],
              loglevel=_config_pytest.getoption("loglevel"),
              logfile=logfile,
              outfile=outfile,
              configfile="/tmp/calvin5000.conf")
    uri = "calvinip://{}:5000".format(hostname)
    curi = "https://{}:5020".format(
        hostname) if tls == True else "http://{}:5020".format(hostname)
    runtimes[0]['RT'] = RT(curi)
    runtimes[0]['RT'].uris = [uri]
    runtimes[0]['RT'].attributes = runtimes[0]["attributes"]

    #Wait for runtime 0 to be up and running
    wait_for_runtime(request_handler, runtimes[0]["RT"])