Esempio n. 1
0
def setup_platform():
    """
    Creates a single instance of VOLTTRON with a VOLTTRON Central Platform,
    a listener agent, and a sqlite historian that is a platform.historian.

    The VOLTTRON Central Platform agent is not registered with a VOLTTRON
    Central Platform.
    """
    vcp = PlatformWrapper()

    start_wrapper_platform(vcp, with_http=True)

    assert vcp
    assert vcp.is_running()
    vcp_uuid = add_volttron_central_platform(vcp)
    historian_config = SQLITE_HISTORIAN_CONFIG.copy()
    historian_config['connection']['params']['database'] = \
        vcp.volttron_home + "/data/platform.historian.sqlite"

    historian_uuid = add_sqlhistorian(vcp,
                                      config=historian_config,
                                      vip_identity='platform.historian')
    listeneer_uuid = add_listener(vcp, vip_identity="platform.listener")

    assert vcp_uuid, "Invalid vcp uuid returned"
    assert vcp.is_agent_running(vcp_uuid), "vcp wasn't running!"

    assert historian_uuid, "Invalid historian uuid returned"
    assert vcp.is_agent_running(historian_uuid), "historian wasn't running!"

    assert listeneer_uuid, "Invalid listener uuid returned"
    assert vcp.is_agent_running(listeneer_uuid), "listener wasn't running!"

    yield vcp

    vcp.shutdown_platform()
    vcp = None
def setup_platform():
    """
    Creates a single instance of VOLTTRON with a VOLTTRON Central Platform,
    a listener agent, and a sqlite historian that is a platform.historian.

    The VOLTTRON Central Platform agent is not registered with a VOLTTRON
    Central Platform.
    """
    vcp = PlatformWrapper()

    start_wrapper_platform(vcp, with_http=True)

    assert vcp
    assert vcp.is_running()
    vcp_uuid = add_volttron_central_platform(vcp)
    historian_config = SQLITE_HISTORIAN_CONFIG.copy()
    historian_config['connection']['params']['database'] = \
        vcp.volttron_home + "/data/platform.historian.sqlite"

    historian_uuid = add_sqlhistorian(vcp, config=historian_config,
                                      vip_identity='platform.historian')
    listeneer_uuid = add_listener(vcp, vip_identity="platform.listener")

    assert vcp_uuid, "Invalid vcp uuid returned"
    assert vcp.is_agent_running(vcp_uuid), "vcp wasn't running!"

    assert historian_uuid, "Invalid historian uuid returned"
    assert vcp.is_agent_running(historian_uuid), "historian wasn't running!"

    assert listeneer_uuid, "Invalid listener uuid returned"
    assert vcp.is_agent_running(listeneer_uuid), "listener wasn't running!"

    yield vcp

    vcp.shutdown_platform()
    vcp = None
Esempio n. 3
0
def setup_platform(request):
    """
    Creates a single instance of VOLTTRON with a VOLTTRON Central Platform,
    a listener agent, and a sqlite historian that is a platform.historian.

    The VOLTTRON Central Platform agent is not registered with a VOLTTRON
    Central Platform.
    """
    vcp = PlatformWrapper(messagebus=request.param[0],
                          ssl_auth=request.param[1])

    start_wrapper_platform(vcp, with_http=True, add_local_vc_address=True)

    assert vcp
    assert vcp.is_running()
    vcp_uuid = add_volttron_central_platform(vcp)
    print("VCP uuid: {}".format(vcp_uuid))
    # historian_config = SQLITE_HISTORIAN_CONFIG.copy()
    # historian_config['connection']['params']['database'] = \
    #     vcp.volttron_home + "/data/platform.historian.sqlite"
    #
    # historian_uuid = add_sqlhistorian(vcp, config=historian_config,
    #                                   vip_identity='platform.historian')
    # listeneer_uuid = add_listener(vcp, vip_identity="platform.listener")

    assert vcp_uuid, "Invalid vcp uuid returned"
    assert vcp.is_agent_running(vcp_uuid), "vcp wasn't running!"

    # assert historian_uuid, "Invalid historian uuid returned"
    # assert vcp.is_agent_running(historian_uuid), "historian wasn't running!"
    #
    # assert listeneer_uuid, "Invalid listener uuid returned"
    # assert vcp.is_agent_running(listeneer_uuid), "listener wasn't running!"

    yield vcp

    print('Shutting down instance: {}'.format(vcp.volttron_home))
    if vcp.is_running():
        vcp.remove_all_agents()
        # Shutdown handles case where the platform hasn't started.
        vcp.shutdown_platform()