[[TOC(Tutorials/a0Basic*)]] == !WiSHFUL Tutorial: Basic Controller-Agent Interaction == === Prerequisites === This tutorial series assumes you have an [http://www.orbit-lab.org/userManagement/register ORBIT account], have [https://www.orbit-lab.org/schedule/ scheduled a session] on the ORBIT testbed, are familiar with [http://en.wikipedia.org/wiki/Secure_Shell SSH]'ing [http://www.orbit-lab.org/wiki/Tutorial/HelloWorld#a4.RunningtheHelloWorldexperiment into the testbed itself, and are familiar with the basics of running ORBIT experiments]. If you have not done these things yet, you may wish to do so before taking a look at this slightly more advanced experiment. If you are unfamiliar with or are entirely new to ORBIT, you may wish to start [http://www.orbit-lab.org/ here]. === About This Experiment === This tutorial illustartes use of WiSHFUL framework for experiment orchestration. In this experiment script, we'll use a WiSHFUL Controller and Agent. This experiment assumes usinge reference WiSHFUL image that is available as '''wishful.ndz''' and is design for use in SB4. === Experiment Script === The experiment script. * [attachment:wishful_simple.rb Experiment Script] Relevant sections of the script code are: '''1. Define the set of nodes and path for the WiSHFUL directory: ''' '''2. Define WiSSHFUL Controller and Agent application that will run on nodes:''' We use ''defApplication'' to create two reference application names: ''controller'' and ''agent'' that are used later in the script to actually execute corresponding WiSHFUL components. {{{ defApplication('iperf', 'iperf-oml2') do |app| }}} The actual path to the applications in the node is defined as follows. {{{ app.path = }}} The actual experiment has the 10 second delay before the call to ''startApplications'' (to "warm up" nodes) that is followed by 60 seconds of run-time during which WiSHFUL controller manages corresponding agerm. Finally all applications are stopped and the experiment exits out. === Executing the Experiment Script === An overview on running experiment scripts on the ORBIT testbed can be found on the [wiki:Documentation/CGettingStarted Getting Started Page]. In order to run this experiment script, connect to the console of the SB4 for which you have an active and approved reservation for and load the ''wishfull.ndz'' image onto experiment nodes. {{{ user@console:~$ omf load -i wishful.ndz -t node1-1,node2-1 }}} After the nodes have finished imaging, turn the nodes on. The topology used here is ''system:topo:imaged'' which selects the prior set of nodes that were successfully imaged. {{{ user@console:~$ omf tell -a on -t system:topo:imaged }}} Wait about 1 minute before proceeding to allow the nodes time to boot up. Run the experiment:{{{ user@console:~$ omf exec wishful_simple.rb --duration 60 }}} The output of this script should be similar to the following: {{{ user@console.sb4:~# omf exec wishful_simple.rb INFO NodeHandler: OMF Experiment Controller 5.4 (git 861d645) INFO NodeHandler: Reading configuration file /etc/omf-expctl-5.4/services.yaml INFO NodeHandler: Add domain http - http://internal1.orbit-lab.org:5054/ INFO NodeHandler: Add domain http - http://repository1.orbit-lab.org:5054/ INFO NodeHandler: Add domain http - http://internal2dmz.orbit-lab.org:5054/ INFO NodeHandler: Add domain http - http://external1.orbit-lab.org:5054/ INFO NodeHandler: Slice ID: default_slice (default) INFO NodeHandler: Experiment ID: default_slice-2016-06-10t04.50.48.026-04.00 INFO NodeHandler: Message authentication is disabled INFO Experiment: load system:exp:stdlib INFO property.resetDelay: resetDelay = 230 (Fixnum) INFO property.resetTries: resetTries = 1 (Fixnum) INFO Experiment: load system:exp:eventlib INFO Experiment: load system:exp:winlib INFO Experiment: load wishful_simple.rb INFO property.contr: contr = "node2-1" (String) INFO property.agent: agent = "node1-1" (String) INFO ALL_UP_AND_INSTALLED: Event triggered. Starting the associated tasks. INFO exp: Wait for all nodes to come up INFO exp: Request from Experiment Script: Wait for 10s.... INFO BRING_UP: Event triggered. Starting the associated tasks. INFO Experiment: Bringing up resources INFO exp: Both controller and agent are started... INFO exp: Request from Experiment Script: Wait for 60s.... INFO exp: Both controller and agent are stopped... INFO EXPERIMENT_DONE: Event triggered. Starting the associated tasks. INFO NodeHandler: INFO NodeHandler: Shutting down experiment, please wait... INFO NodeHandler: INFO run: Experiment default_slice-2016-06-10t04.50.48.026-04.00 finished after 1:20 }}} === Retrieving Results === This particular experiment does not generate any data but rather illustrates how to run WiSHFUL based experiment. The primary observable output from both experiment script execution as well as output of the controller/agent interraction are aggregated on the console in a log file: /tmp/''''.log For this example, this log file is: /tmp/default_slice-2016-06-10t04.50.48.026-04.00.log Partial contents of this file is: {{{ 2016-06-10 04:51:13 DEBUG nodeHandler::AppContext: Starting application 'controller#1' 2016-06-10 04:51:13 DEBUG nodeHandler::set::Controllers: Send ('Controllers') - 'Controllerscontroller#1< /APPID>/root/wishful/examples/simple/wishful_simple_controller--config /root/wishful/examples/simple/ controller_config.yaml' 2016-06-10 04:51:13 DEBUG nodeHandler::set::Agents: Start all applications 2016-06-10 04:51:13 DEBUG nodeHandler::AppContext: Starting application 'agent#1' 2016-06-10 04:51:13 DEBUG nodeHandler::set::Agents: Send ('Agents') - 'Agentsagent#1/root/w ishful/examples/simple/wishful_simple_agent--config /root/wishful/examples/simple/agent_config.yaml' 2016-06-10 04:51:13 DEBUG nodeHandler::AgentCommands: APP_EVENT STARTED from: 'controller#1' (node2-1.sb4.orbit-lab.org) - msg: '' 2016-06-10 04:51:13 INFO nodeHandler::exp: Both controller and agent are started... 2016-06-10 04:51:13 INFO nodeHandler::exp: Request from Experiment Script: Wait for 50s.... 2016-06-10 04:51:13 DEBUG nodeHandler::AgentCommands: APP_EVENT STARTED from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '' 2016-06-10 04:51:14 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:5 1:14,022 - SimpleModule2.myFunc_1() - INFO - This function is executed on agent start' 2016-06-10 04:51:15 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:5 1:15,711 - pyre_discovery_module.main.discovery_task() - INFO - Discovered Controller DL-tcp://10.14.2.1:8990, UL-tcp://10.14.2.1:8989' 2016-06-10 04:51:17 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:5 1:17,724 - pyre_discovery_module.main.discovery_task() - INFO - Discovered Controller DL-tcp://10.14.2.1:8990, UL-tcp://10.14.2.1:8989' 2016-06-10 04:51:18 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:5 1:18,052 - SimpleModule2.myFunc_3() - INFO - This function is executed on connection to global controller' 2016-06-10 04:51:23 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:5 1:23,712 - SimpleModule2.myFunc_5() - INFO - This function is executed before first UPI call to module' 2016-06-10 04:51:23 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:5 1:23,719 - SimpleModule2.send_to_module() - WARNING - Exception: function radio.clean_per_flow_tx_power_table was not correctly executed; error msg: wrong' 2016-06-10 04:51:26 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:5 1:26,471 - SimpleModule2.before_set_channel() - INFO - This function is executed before set_channel' 2016-06-10 04:51:26 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:5 1:26,471 - SimpleModule2.set_channel() - INFO - Simple Module sets channel: 4 on interface: wlan1' 2016-06-10 04:51:26 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:5 1:26,471 - SimpleModule2.after_set_channel() - INFO - This function is executed after set_channel' 2016-06-10 04:51:33 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:5 1:33,735 - SimpleModule2.send_to_module() - WARNING - Exception: function radio.clean_per_flow_tx_power_table was not correctly executed; error msg: wrong' 2016-06-10 04:51:36 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:5 1:36,487 - SimpleModule2.before_set_channel() - INFO - This function is executed before set_channel' 2016-06-10 04:51:36 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:51:36,487 - SimpleMod ule2.set_channel() - INFO - Simple Module sets channel: 4 on interface: wlan1' 2016-06-10 04:51:36 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:51:36,487 - SimpleMod ule2.after_set_channel() - INFO - This function is executed after set_channel' 2016-06-10 04:51:43 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:51:43,743 - SimpleMod ule2.send_to_module() - WARNING - Exception: function radio.clean_per_flow_tx_power_table was not correctly executed; error msg: wrong' 2016-06-10 04:51:46 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:51:46,495 - SimpleMod ule2.before_set_channel() - INFO - This function is executed before set_channel' 2016-06-10 04:51:46 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:51:46,496 - SimpleMod ule2.set_channel() - INFO - Simple Module sets channel: 4 on interface: wlan1' 2016-06-10 04:51:46 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:51:46,496 - SimpleMod ule2.after_set_channel() - INFO - This function is executed after set_channel' 2016-06-10 04:51:53 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:51:53,756 - SimpleMod ule2.send_to_module() - WARNING - Exception: function radio.clean_per_flow_tx_power_table was not correctly executed; error msg: wrong' 2016-06-10 04:51:56 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:51:56,508 - SimpleMod ule2.before_set_channel() - INFO - This function is executed before set_channel' 2016-06-10 04:51:56 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:51:56,508 - SimpleMod ule2.set_channel() - INFO - Simple Module sets channel: 4 on interface: wlan1' 2016-06-10 04:51:56 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'agent#1' (node1-1.sb4.orbit-lab.org) - msg: '2016-06-10 04:51:56,508 - SimpleMod ule2.after_set_channel() - INFO - This function is executed after set_channel' }}}