Exemplo n.º 1
0
def start_wrapper_platform(wrapper, with_http=False, with_tcp=True,
                           volttron_central_address=None,
                           volttron_central_serverkey=None,
                           add_local_vc_address=False):
    """ Customize easily customize the platform wrapper before starting it.
    """
    assert not wrapper.is_running()

    vc_http = get_rand_http_address() if with_http else None
    vc_tcp = get_rand_tcp_address() if with_tcp else None

    if add_local_vc_address:
        ks = KeyStore(os.path.join(wrapper.volttron_home, 'keystore'))
        ks.generate()
        volttron_central_address = vc_tcp
        volttron_central_serverkey = ks.public

    wrapper.startup_platform(vip_address=vc_tcp,
                             bind_web_address=vc_http,
                             volttron_central_address=volttron_central_address,
                             volttron_central_serverkey=volttron_central_serverkey)
    if with_http:
        discovery = "{}/discovery/".format(vc_http)
        response = requests.get(discovery)
        assert response.ok

    assert wrapper.is_running()
Exemplo n.º 2
0
def start_wrapper_platform(wrapper,
                           with_http=False,
                           with_tcp=True,
                           volttron_central_address=None,
                           volttron_central_serverkey=None,
                           add_local_vc_address=False):
    """ Customize easily customize the platform wrapper before starting it.
    """
    assert not wrapper.is_running()

    vc_http = get_rand_http_address() if with_http else None
    vc_tcp = get_rand_tcp_address() if with_tcp else None

    if add_local_vc_address:
        ks = KeyStore(os.path.join(wrapper.volttron_home, 'keystore'))
        ks.generate()
        volttron_central_address = vc_tcp
        volttron_central_serverkey = ks.public

    wrapper.startup_platform(
        vip_address=vc_tcp,
        bind_web_address=vc_http,
        volttron_central_address=volttron_central_address,
        volttron_central_serverkey=volttron_central_serverkey)
    if with_http:
        discovery = "{}/discovery/".format(vc_http)
        response = requests.get(discovery)
        assert response.ok

    assert wrapper.is_running()
Exemplo n.º 3
0
def test_can_create(messagebus, ssl_auth):

    p = PlatformWrapper(messagebus=messagebus, ssl_auth=ssl_auth)
    try:
        assert not p.is_running()
        assert p.volttron_home.startswith("/tmp/tmp")

        p.startup_platform(vip_address=get_rand_tcp_address())
        assert p.is_running()
    finally:
        if p:
            p.shutdown_platform()

    assert not p.is_running()
Exemplo n.º 4
0
def test_can_create_web_enabled(messagebus: str, https_enabled: bool):
    p = PlatformWrapper(messagebus=messagebus)
    try:
        assert not p.is_running()
        assert p.volttron_home.startswith("/tmp/tmp")
        http_address = get_rand_http_address(https=https_enabled)
        p.startup_platform(vip_address=get_rand_tcp_address(),
                           bind_web_address=http_address)
        assert p.is_running()
        response = requests.get(http_address, verify=False)
        assert response.ok
    finally:
        if p:
            p.shutdown_platform()

    assert not p.is_running()
Exemplo n.º 5
0
def start_wrapper_platform(wrapper,
                           with_http=False,
                           with_tcp=True,
                           volttron_central_address=None):
    """ Customize easily customize the platform wrapper before starting it.
    """
    assert not wrapper.is_running()

    vc_http = get_rand_http_address() if with_http else None
    vc_tcp = get_rand_tcp_address() if with_tcp else None
    if vc_tcp:
        encrypt = True
    else:
        encrypt = False
    wrapper.startup_platform(encrypt=encrypt,
                             vip_address=vc_tcp,
                             bind_web_address=vc_http,
                             volttron_central_address=volttron_central_address)
    if with_http:
        discovery = "{}/discovery/".format(vc_http)
        response = requests.get(discovery)
        assert response.ok

    assert wrapper.is_running()