예제 #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()
예제 #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()
예제 #3
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()
예제 #4
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()
예제 #5
0
# United States Government or any agency thereof.
#
# PACIFIC NORTHWEST NATIONAL LABORATORY
# operated by BATTELLE for the UNITED STATES DEPARTMENT OF ENERGY
# under Contract DE-AC05-76RL01830
# }}}

import json
import pytest
import gevent
from gevent import pywsgi

from volttrontesting.utils.utils import get_rand_http_address
from volttron.platform.agent.known_identities import CONFIGURATION_STORE, PLATFORM_DRIVER

server_addr = get_rand_http_address()
no_scheme = server_addr[7:]
ip, port = no_scheme.split(':')

TEST_MAC_ID = '0xffffffffffffffff'
driver_config_string = json.dumps({
    "driver_config": {
        "username": "",
        "password": "",
        "macid": TEST_MAC_ID,
        "address": server_addr + "/cgi-bin/post_manager"
    },
    "campus": "campus",
    "building": "building",
    "unit": "eagle",
    "driver_type": "rainforesteagle",
예제 #6
0
#
# PACIFIC NORTHWEST NATIONAL LABORATORY operated by
# BATTELLE for the UNITED STATES DEPARTMENT OF ENERGY
# under Contract DE-AC05-76RL01830
# }}}

import json
import pytest
import gevent
from gevent import pywsgi

from volttron.platform import get_services_core
from volttrontesting.utils.utils import get_rand_http_address
from volttron.platform.agent.known_identities import CONFIGURATION_STORE, PLATFORM_DRIVER

server_addr = get_rand_http_address()
no_scheme = server_addr[7:]
ip, port = no_scheme.split(':')

TEST_MAC_ID = '0xffffffffffffffff'
driver_config_string = json.dumps({
    "driver_config": {
        "username": "",
        "password": "",
        "macid": TEST_MAC_ID,
        "address": server_addr + "/cgi-bin/post_manager"
    },
    "campus": "campus",
    "building": "building",
    "unit": "eagle",
    "driver_type": "rainforesteagle",