Пример #1
0
 def __init__(self, config):
     super(LocalNodeManager, self).__init__("local")
     self.agent = wishful_agent.Agent(local=True)
     self.control_engine = self.agent.get_local_controller()
     self.agent.load_config(config)
     self.agent.run()
     t = threading.Timer(5, self.__update_mac_address_list)
     t.start()
Пример #2
0
   -v, --verbose       print more text
   --version           show version and exit
"""

import logging
import signal
import sys, os
import yaml
import wishful_agent

__author__ = "Peter Ruckebusch"
__copyright__ = "Copyright (c) 2016, Ghent University, iMinds"
__version__ = "0.1.0"

log = logging.getLogger('contiki_control_agent.main')
control_agent = wishful_agent.Agent()


def main(args):
    log.debug(args)

    config_file_path = args['--config']

    config = None
    with open(config_file_path, 'r') as f:
        config = yaml.load(f)

    control_agent.load_config(config)
    control_agent.run()

Пример #3
0
"""
Setting of agent node
"""
agent_PC_interface = "eth0"
"""
END setting of agent node
"""
""" START WiSHFUL agent setting """
"""
The WiSHFUL controller module is the core module of the WiSHFUL framework and allow all the basics functions
such as the node discovery, the UPI functions execution on local and remote node, perform the messages exchange between
global control program and local control program, and all the other management functions of the framework. The different
works of the controller are  performed by different module can be added on demand in the controller
"""
#Create agent
agent = wishful_agent.Agent()
name = ip_to_name[get_ip_address(agent_PC_interface)]

#Configure agent, we specify in the parameters the controller name and a string information related to the
#controller
agent.set_agent_info(name=name,
                     info="Example tutorial Agent",
                     iface=agent_PC_interface)

#the following rows add all the needed modules to the controller

#add the discovery module, responsable for the nodes discovery procedure
#we specify interface and the name of the nodes group

agent.add_module(moduleName="discovery",
                 pyModule="wishful_module_discovery_pyre",
Пример #4
0
import wishful_agent
import wishful_upis as upis

import sys
import datetime
import logging
import time
import yaml

__author__ = "Peter Ruckebusch"
__copyright__ = "Copyright (c) 2016, Ghent University, iMinds"
__version__ = "0.1.0"
__email__ = "*****@*****.**"

log = logging.getLogger('wishful_agent.main')
agent = wishful_agent.Agent(local=True)
control_engine = agent.get_local_controller()


@control_engine.add_callback(upis.radio.set_rxchannel)
def set_rxchannel_reponse(data):
    print("{} set_channel_reponse : {}".format(datetime.datetime.now(), data))


@control_engine.set_default_callback()
def default_callback(cmd, data):
    print("{} DEFAULT CALLBACK : Cmd: {}, Returns: {}".format(
        datetime.datetime.now(), cmd, data))


def print_response(data):