update test and examples for OMF6 in OMF section
authorJulien Tribino <julien.tribino@inria.fr>
Thu, 5 Jun 2014 07:51:06 +0000 (09:51 +0200)
committerJulien Tribino <julien.tribino@inria.fr>
Thu, 5 Jun 2014 07:51:06 +0000 (09:51 +0200)
30 files changed:
examples/omf/nepi_omf5_iminds_stdin.py [moved from examples/omf/nepi_omf_stdin_iminds.py with 87% similarity]
examples/omf/nepi_omf5_nitos_ccncat.py [moved from examples/omf/nepi_omf_ccncat_nitos.py with 82% similarity]
examples/omf/nepi_omf5_nitos_ccnring.py [moved from examples/omf/nepi_omf_ccnring_nitos.py with 84% similarity]
examples/omf/nepi_omf5_nitos_vlc.py [moved from examples/omf/nepi_omf_vlc_nitos.py with 79% similarity]
examples/omf/nepi_omf5_nitos_vlc_tribino.py [new file with mode: 0644]
examples/omf/nepi_omf5_nitos_xeyes.py [moved from examples/omf/nepi_omf_xeyes_nitos.py with 85% similarity]
examples/omf/nepi_omf5_plexus_ccncat_linear.py [new file with mode: 0644]
examples/omf/nepi_omf5_plexus_stdin.py [moved from examples/omf/nepi_omf_stdin_exp.py with 91% similarity]
examples/omf/nepi_omf5_plexus_vlc.py [moved from examples/omf/nepi_omf_vlc_experiment.py with 69% similarity]
examples/omf/nepi_omf6_iminds_vlc.py [new file with mode: 0644]
examples/omf/nepi_omf6_nitos_vlc.py [new file with mode: 0644]
examples/omf/nepi_omf6_plexus_hostname.py [new file with mode: 0644]
examples/omf/nepi_omf6_plexus_ping.py [new file with mode: 0644]
src/nepi/resources/omf/application.py
src/nepi/resources/omf/channel.py
src/nepi/resources/omf/interface.py
src/nepi/resources/omf/messages_6.py
src/nepi/resources/omf/node.py
src/nepi/resources/omf/omf5_api.py
src/nepi/resources/omf/omf6_api.py
src/nepi/resources/omf/omf6_parser.py
src/nepi/resources/omf/omf6_resource.py [deleted file]
src/nepi/resources/omf/omf_api_factory.py
src/nepi/resources/omf/omf_client.py
test/resources/omf/omf5_vlc_normal_case.py [new file with mode: 0755]
test/resources/omf/omf5_vlc_wrong_critical.py [new file with mode: 0755]
test/resources/omf/omf5_vlc_wrong_non_critical.py [moved from test/resources/omf/vlc_wrong_non_critical.py with 81% similarity]
test/resources/omf/omf6_vlc_normal_case.py [moved from test/resources/omf/vlc_normal_case.py with 81% similarity]
test/resources/omf/omf6_vlc_wrong_critical.py [moved from test/resources/omf/vlc_wrong_critical.py with 74% similarity, mode: 0644]
test/resources/omf/omf6_vlc_wrong_non_critical.py [new file with mode: 0644]

similarity index 87%
rename from examples/omf/nepi_omf_stdin_iminds.py
rename to examples/omf/nepi_omf5_iminds_stdin.py
index df95a24..e597360 100644 (file)
@@ -52,16 +52,18 @@ node1 = ec.register_resource("OMFNode")
     # If the hostname is not declared, Nepi will take SFA to provision one.
 ec.set(node1, 'hostname', 'node0.nepi-robot.nepi.wilab2.ilabt.iminds.be')
     # XMPP credentials
-ec.set(node1, 'xmppSlice', "default_slice_iminds")
-ec.set(node1, 'xmppHost', "am.wilab2.ilabt.iminds.be")
+ec.set(node1, 'xmppServer', "default_slice_iminds")
+ec.set(node1, 'xmppUser', "am.wilab2.ilabt.iminds.be")
 ec.set(node1, 'xmppPort', "5222")
 ec.set(node1, 'xmppPassword', "1234")
+ec.set(node1, 'version', "5")
 
 # Create and Configure the Application
 app1 = ec.register_resource("OMFRobotApplication")
 ec.set(app1, 'appid', "robot")
-ec.set(app1, 'path', "/users/jtribino/RobotCTRLComm.rb") # /users/username/RobotCTRLComm.rb
-ec.set(app1, 'args', "/users/jtribino/coordinate.csv")   #/users/username/coordinate.csv
+ec.set(app1, 'version', "5")
+ec.set(app1, 'command', "/users/jtribino/RobotCTRLComm.rb /users/jtribino/coordinate.csv") 
+                    # /users/username/RobotCTRLComm.rb /users/username/coordinate.csv
 ec.set(app1, 'env', " ")
 ec.set(app1, 'sources', "/home/wlab18/Desktop/coordinate.csv")  # local path
 ec.set(app1, 'sshUser', "jtribino")  # username
similarity index 82%
rename from examples/omf/nepi_omf_ccncat_nitos.py
rename to examples/omf/nepi_omf5_nitos_ccncat.py
index 3b883cb..9165287 100644 (file)
@@ -40,46 +40,49 @@ from nepi.execution.ec import ExperimentController
 from optparse import OptionParser, SUPPRESS_HELP
 
 ###  Define OMF Method to simplify definition of resources ###
-def add_node(ec, hostname, xmppSlice, xmppHost, xmppPort = "5222", xmppPassword = "1234"):
+def add_node(ec, hostname, xmppServer, xmppUser, xmppPort = "5222", xmppPassword = "1234"):
     node = ec.register_resource("OMFNode")
     ec.set(node, 'hostname', hostname)
-    ec.set(node, 'xmppSlice', xmppSlice)
-    ec.set(node, 'xmppHost', xmppHost)
+    ec.set(node, 'xmppServer', xmppServer)
+    ec.set(node, 'xmppUser', xmppUser)
     ec.set(node, 'xmppPort', xmppPort)
     ec.set(node, 'xmppPassword', xmppPassword)
+    ec.set(node, 'version', "5")
     return node
 
-def add_interface(ec, ip, xmppSlice, xmppHost, essid = "ccn", alias = "w0", mode = "adhoc",
+def add_interface(ec, ip, xmppServer, xmppUser, essid = "ccn", name = "wlan0", mode = "adhoc",
                  typ = "g", xmppPort = "5222", xmppPassword = "1234"):
     iface = ec.register_resource("OMFWifiInterface")
-    ec.set(iface, 'alias', alias)
+    ec.set(iface, 'name', name)
     ec.set(iface, 'mode', mode)
-    ec.set(iface, 'type', typ)
+    ec.set(iface, 'hw_mode', typ)
     ec.set(iface, 'essid', essid)
     ec.set(iface, 'ip', ip)
+    ec.set(iface, 'version', "5")
     return iface
 
-def add_channel(ec, channel, xmppSlice, xmppHost, xmppPort = "5222", xmppPassword = "1234"):
+def add_channel(ec, channel, xmppServer, xmppUser, xmppPort = "5222", xmppPassword = "1234"):
     chan = ec.register_resource("OMFChannel")
     ec.set(chan, 'channel', channel)
-    ec.set(chan, 'xmppSlice', xmppSlice)
-    ec.set(chan, 'xmppHost', xmppHost)
+    ec.set(chan, 'xmppServer', xmppServer)
+    ec.set(chan, 'xmppUser', xmppUser)
     ec.set(chan, 'xmppPort', xmppPort)
     ec.set(chan, 'xmppPassword', xmppPassword)
+    ec.set(chan, 'version', "5")
     return chan
 
-def add_app(ec, appid, command, args, env, xmppSlice, xmppHost
+def add_app(ec, appid, command, env, xmppServer, xmppUser
                 xmppPort = "5222", xmppPassword = "1234"):
     app = ec.register_resource("OMFApplication")
     ec.set(app, 'appid', appid)
-    ec.set(app, 'path', command)
-    ec.set(app, 'args', args)
+    ec.set(app, 'command', command)
     ec.set(app, 'env', env)
+    ec.set(app, 'version', "5")
     return app
 
 
 ###  Define a CCND application  ###
-def add_ccnd(ec, peers, xmppSlice, xmppHost, xmppPort = "5222", xmppPassword = "1234"):
+def add_ccnd(ec, peers, xmppServer, xmppUser, xmppPort = "5222", xmppPassword = "1234"):
     env = 'PATH=$PATH:/root/ccnx-0.7.2/bin HOME=/root \
 CCNR_DIRECTORY="/root" CCNR_STATUS_PORT="8080"'
 
@@ -88,28 +91,28 @@ CCNR_DIRECTORY="/root" CCNR_STATUS_PORT="8080"'
     #command += " ; ".join(peers) + " && "
     command = peers[0]
 
-    app = add_app(ec, "#ccnd", command, "", env, xmppSlice, xmppHost,
+    app = add_app(ec, "#ccnd", command, env, xmppServer, xmppUser,
                      xmppPort = xmppPort, xmppPassword = xmppPassword)
     return app
 
 ###  Define a CCN SeqWriter application ###
-def add_publish(ec, movie, xmppSlice, xmppHost, xmppPort = "5222", xmppPassword = "1234"):
+def add_publish(ec, movie, xmppServer, xmppUser, xmppPort = "5222", xmppPassword = "1234"):
     env = 'PATH=$PATH:/root/ccnx-0.7.2/bin HOME=/root CCNR_DIRECTORY="/root" CCNR_STATUS_PORT="8080"'
 
     # BASH command -> 'ccnseqwriter -r ccnx:/VIDEO < movie'
     command = "ccnseqwriter -r ccnx:/VIDEO"
     command += " < " + movie
 
-    app = add_app(ec, "#ccn_write", command, "", env, xmppSlice, xmppHost,
+    app = add_app(ec, "#ccn_write", command, env, xmppServer, xmppUser,
                   xmppPort = xmppPort, xmppPassword = xmppPassword)
     return app
 
 ###  Define a streaming application ###
-def add_stream(ec, xmppSlice, xmppHost, xmppPort = "5222", xmppPassword = "1234"):
+def add_stream(ec, xmppServer, xmppUser, xmppPort = "5222", xmppPassword = "1234"):
     env = 'PATH=$PATH:/root/ccnx-0.7.2/bin HOME=/root CCNR_DIRECTORY="/root" CCNR_STATUS_PORT="8080"'
     command = " ddbus-uuidgen --ensure ; ( /root/ccnx-0.7.2/bin/ccncat ccnx:/VIDEO | /root/vlc-1.1.13/cvlc - )  "
     #command = "ccncat ccnx:/VIDEO | /root/vlc-1.1.13/cvlc - "
-    app = add_app(ec, "#ccn_stream", command, "", env, xmppSlice, xmppHost,
+    app = add_app(ec, "#ccn_stream", command, env, xmppServer, xmppUser,
                   xmppPort = xmppPort, xmppPassword = xmppPassword)
     return app
 
@@ -166,14 +169,14 @@ if __name__ == '__main__':
     ec.register_connection(iface2, chann)
 
 # CCN setup for the sender
-    ccndstart1 = add_app(ec, "#ccndstart", "ccndstart &", "", env,xmpp_slice, xmpp_host)
+    ccndstart1 = add_app(ec, "#ccndstart", "ccndstart &", env,xmpp_slice, xmpp_host)
     ec.register_connection(ccndstart1, node1)
 
     peers = [receiver_ip]
     ccnd1 = add_ccnd(ec, peers, xmpp_slice, xmpp_host)
     ec.register_connection(ccnd1, node1)
 
-    ccnr1 = add_app(ec, "#ccnr", "ccnr &", "", env, xmpp_slice, xmpp_host)
+    ccnr1 = add_app(ec, "#ccnr", "ccnr &", env, xmpp_slice, xmpp_host)
     ec.register_connection(ccnr1, node1)
 
     # Register content producer application (ccnseqwriter)
@@ -186,14 +189,14 @@ if __name__ == '__main__':
     ec.register_condition(pub, ResourceAction.START, ccnr1, ResourceState.STARTED, "2s")
    
 # CCN setup for the receiver
-    ccndstart2 = add_app(ec, "#ccndstart", "ccndstart &", "", env,xmpp_slice, xmpp_host)
+    ccndstart2 = add_app(ec, "#ccndstart", "ccndstart &", env,xmpp_slice, xmpp_host)
     ec.register_connection(ccndstart2, node2)
 
     peers = [sender_ip]
     ccnd2 = add_ccnd(ec, peers, xmpp_slice, xmpp_host)
     ec.register_connection(ccnd2, node2)
 
-    ccnr2 = add_app(ec, "#ccnr", "ccnr &", "", env,xmpp_slice, xmpp_host)
+    ccnr2 = add_app(ec, "#ccnr", "ccnr &", env,xmpp_slice, xmpp_host)
     ec.register_connection(ccnr2, node2)
      
     # Register consumer application (ccncat)
@@ -210,13 +213,13 @@ if __name__ == '__main__':
 
 
 # Cleaning when the experiment stop
-    ccndstop1 = add_app(ec, "#ccndstop", "ccndstop", "", env, xmpp_slice, xmpp_host)
+    ccndstop1 = add_app(ec, "#ccndstop", "ccndstop", env, xmpp_slice, xmpp_host)
     ec.register_connection(ccndstop1, node1)
-    ccndstop2 = add_app(ec, "#ccndstop", "ccndstop", "", env, xmpp_slice, xmpp_host)
+    ccndstop2 = add_app(ec, "#ccndstop", "ccndstop", env, xmpp_slice, xmpp_host)
     ec.register_connection(ccndstop2, node2)
     ccndstops = [ccndstop1,ccndstop2]
 
-    killall = add_app(ec, "#kill", "killall sh", "", "", xmpp_slice, xmpp_host)
+    killall = add_app(ec, "#kill", "killall sh", "", xmpp_slice, xmpp_host)
     ec.register_connection(killall, node2)
 
     apps = [ccndstart1, ccnd1, ccnr1, pub, ccndstart2, ccnd2, ccnr2, stream]
similarity index 84%
rename from examples/omf/nepi_omf_ccnring_nitos.py
rename to examples/omf/nepi_omf5_nitos_ccnring.py
index 5901f53..86370d4 100644 (file)
@@ -47,73 +47,76 @@ from nepi.execution.ec import ExperimentController
 from optparse import OptionParser, SUPPRESS_HELP
 
 ###  Define OMF Method to simplify definition of resources ###
-def add_node(ec, hostname, xmppSlice, xmppHost, xmppPort = "5222", xmppPassword = "1234"):
+def add_node(ec, hostname, xmppServer, xmppUser, xmppPort = "5222", xmppPassword = "1234"):
     node = ec.register_resource("OMFNode")
     ec.set(node, 'hostname', hostname)
-    ec.set(node, 'xmppSlice', xmppSlice)
-    ec.set(node, 'xmppHost', xmppHost)
+    ec.set(node, 'xmppServer', xmppServer)
+    ec.set(node, 'xmppUser', xmppUser)
     ec.set(node, 'xmppPort', xmppPort)
     ec.set(node, 'xmppPassword', xmppPassword)
+    ec.set(node, 'version', "5")
     return node
 
-def add_interface(ec, ip, xmppSlice, xmppHost, essid = "ccn", alias = "w0", mode = "adhoc",
+def add_interface(ec, ip, xmppServer, xmppUser, essid = "ccn", name = "wlan0", mode = "adhoc",
                  typ = "g", xmppPort = "5222", xmppPassword = "1234"):
     iface = ec.register_resource("OMFWifiInterface")
-    ec.set(iface, 'alias', alias)
+    ec.set(iface, 'name', name)
     ec.set(iface, 'mode', mode)
-    ec.set(iface, 'type', typ)
+    ec.set(iface, 'hw_mode', typ)
     ec.set(iface, 'essid', essid)
     ec.set(iface, 'ip', ip)
+    ec.set(iface, 'version', "5")
     return iface
 
-def add_channel(ec, channel, xmppSlice, xmppHost, xmppPort = "5222", xmppPassword = "1234"):
+def add_channel(ec, channel, xmppServer, xmppUser, xmppPort = "5222", xmppPassword = "1234"):
     chan = ec.register_resource("OMFChannel")
     ec.set(chan, 'channel', channel)
-    ec.set(chan, 'xmppSlice', xmppSlice)
-    ec.set(chan, 'xmppHost', xmppHost)
+    ec.set(chan, 'xmppServer', xmppServer)
+    ec.set(chan, 'xmppUser', xmppUser)
     ec.set(chan, 'xmppPort', xmppPort)
     ec.set(chan, 'xmppPassword', xmppPassword)
+    ec.set(chan, 'version', "5")
     return chan
 
-def add_app(ec, host,  appid, command, args, env, xmppSlice, xmppHost
+def add_app(ec, host,  appid, command, env, xmppServer, xmppUser
                 xmppPort = "5222", xmppPassword = "1234"):
     app = ec.register_resource("OMFApplication")
     ec.set(app, 'appid', appid)
-    ec.set(app, 'path', command)
-    ec.set(app, 'args', args)
+    ec.set(app, 'command', command)
     ec.set(app, 'env', env)
+    ec.set(app, 'version', "5")
     ec.register_connection(app, host)
     return app
 
 
 ###  Define a CCND application  ###
-def add_ccnd(ec, host, peers, xmppSlice, xmppHost, xmppPort = "5222", xmppPassword = "1234"):
+def add_ccnd(ec, host, peers, xmppServer, xmppUser, xmppPort = "5222", xmppPassword = "1234"):
     env = 'PATH=$PATH:/root/ccnx-0.7.2/bin HOME=/root \
 CCNR_DIRECTORY="/root" CCNR_STATUS_PORT="8080"'
 
     # BASH command -> ' ccndstart ; ccndc add ccnx:/ udp host ; ccnr '
     command = "ccndc add ccnx:/ udp " + peers
-    app = add_app(ec, host, "#ccnd", command, "", env, xmppSlice, xmppHost,
+    app = add_app(ec, host, "#ccnd", command, env, xmppServer, xmppUser,
                     xmppPort = xmppPort, xmppPassword = xmppPassword)
     return app
 
 ###  Define a CCN SeqWriter application ###
-def add_publish(ec, host,  movie, xmppSlice, xmppHost, xmppPort = "5222", xmppPassword = "1234"):
+def add_publish(ec, host,  movie, xmppServer, xmppUser, xmppPort = "5222", xmppPassword = "1234"):
     env = 'PATH=$PATH:/root/ccnx-0.7.2/bin HOME=/root CCNR_DIRECTORY="/root" CCNR_STATUS_PORT="8080"'
 
     # BASH command -> 'ccnseqwriter -r ccnx:/VIDEO < movie'
     command = "ccnseqwriter -r ccnx:/VIDEO"
     command += " < " + movie
 
-    app = add_app(ec, host, "#ccn_write", command, "", env, xmppSlice, xmppHost,
+    app = add_app(ec, host, "#ccn_write", command, env, xmppServer, xmppUser,
                   xmppPort = xmppPort, xmppPassword = xmppPassword)
     return app
 
 ###  Define a streaming application ###
-def add_stream(ec, host, xmppSlice, xmppHost, xmppPort = "5222", xmppPassword = "1234"):
+def add_stream(ec, host, xmppServer, xmppUser, xmppPort = "5222", xmppPassword = "1234"):
     env = 'PATH=$PATH:/root/ccnx-0.7.2/bin HOME=/root CCNR_DIRECTORY="/root" CCNR_STATUS_PORT="8080"'
     command = " ddbus-uuidgen --ensure ; ( /root/ccnx-0.7.2/bin/ccncat ccnx:/VIDEO | /root/vlc-1.1.13/cvlc - )  "
-    app = add_app(ec, host, "#ccn_stream", command, "", env, xmppSlice, xmppHost,
+    app = add_app(ec, host, "#ccn_stream", command, env, xmppServer, xmppUser,
                   xmppPort = xmppPort, xmppPassword = xmppPassword)
     return app
 
@@ -158,12 +161,12 @@ if __name__ == '__main__':
     host5 = "omf.nitos.node026"  # b1
     host6 = "omf.nitos.node027"  # b2
 
-    ip1 = "192.168.0.22"
-    ip2 = "192.168.0.28"
-    ip3 = "192.168.0.24"
-    ip4 = "192.168.0.25"
-    ip5 = "192.168.0.26"
-    ip6 = "192.168.0.27"
+    ip1 = "192.168.0.22/24"
+    ip2 = "192.168.0.28/24"
+    ip3 = "192.168.0.24/24"
+    ip4 = "192.168.0.25/24"
+    ip5 = "192.168.0.26/24"
+    ip6 = "192.168.0.27/24"
 
     all_hosts = [host1, host2, host3, host4, host5, host6]
     all_ip = [ip1, ip2, ip3, ip4, ip5, ip6]
@@ -184,9 +187,9 @@ if __name__ == '__main__':
     ccnrs = dict()
     for i in xrange(len(all_hosts)):
         ccndstart = add_app(ec, nodes[all_hosts[i]],  "#ccndstart", "ccndstart &", 
-                              "", env, xmpp_slice, xmpp_host)
+                              env, xmpp_slice, xmpp_host)
         ccnr = add_app(ec, nodes[all_hosts[i]],  "#ccnr", "ccnr &", 
-                            "", env, xmpp_slice, xmpp_host)
+                             env, xmpp_slice, xmpp_host)
         ccnds[all_hosts[i]] = ccndstart
         ccnrs[all_hosts[i]] = ccnr
         ec.register_condition(ccnr, ResourceAction.START, ccndstart, ResourceState.STARTED, "1s")
@@ -238,8 +241,8 @@ if __name__ == '__main__':
     ec.register_condition(stream, ResourceAction.START, pub, ResourceState.STARTED, "2s")
 
 # break the lin
-    ccndcstop1 = add_app(ec,nodes[host1], "#ccndc", "ccndc del ccnx:/ udp " + ip3, "", env, xmpp_slice, xmpp_host)
-    ccndcstop2 = add_app(ec,nodes[host3], "#ccndc", "ccndc del ccnx:/ udp " + ip1, "", env, xmpp_slice, xmpp_host)
+    ccndcstop1 = add_app(ec,nodes[host1], "#ccndc", "ccndc del ccnx:/ udp " + ip3, env, xmpp_slice, xmpp_host)
+    ccndcstop2 = add_app(ec,nodes[host3], "#ccndc", "ccndc del ccnx:/ udp " + ip1, env, xmpp_slice, xmpp_host)
 
 
 # Change the behaviour
@@ -252,10 +255,10 @@ if __name__ == '__main__':
 # Cleaning when the experiment stop
     ccndstops = []
     for i in xrange(len(all_hosts)):
-        ccndstop = add_app(ec, nodes[all_hosts[i]], "#ccndstop", "ccndstop", "", env, xmpp_slice, xmpp_host)
+        ccndstop = add_app(ec, nodes[all_hosts[i]], "#ccndstop", "ccndstop", env, xmpp_slice, xmpp_host)
         ccndstops.append(ccndstop)
 
-    killall = add_app(ec, nodes[host6], "#kill", "killall sh", "", "", xmpp_slice, xmpp_host)
+    killall = add_app(ec, nodes[host6], "#kill", "killall sh", "", xmpp_slice, xmpp_host)
 
 # Condition to stop and clean the experiment
     apps = []
similarity index 79%
rename from examples/omf/nepi_omf_vlc_nitos.py
rename to examples/omf/nepi_omf5_nitos_vlc.py
index 9f1b688..d0d590a 100644 (file)
@@ -51,65 +51,70 @@ ec = ExperimentController()
 # Create and Configure the Nodes
 node1 = ec.register_resource("OMFNode")
 ec.set(node1, 'hostname', 'omf.nitos.node0XX')
-ec.set(node1, 'xmppSlice', "ZZZ")
-ec.set(node1, 'xmppHost', "nitlab.inf.uth.gr")
+ec.set(node1, 'xmppServer', "ZZZ")
+ec.set(node1, 'xmppUser', "nitlab.inf.uth.gr")
 ec.set(node1, 'xmppPort', "5222")
 ec.set(node1, 'xmppPassword', "1234")
+ec.set(node1, 'version', "5")
 
 node2 = ec.register_resource("OMFNode")
 ec.set(node2, 'hostname', "omf.nitos.node0YY")
-ec.set(node2, 'xmppSlice', "ZZZ")
-ec.set(node2, 'xmppHost', "nitlab.inf.uth.gr")
+ec.set(node2, 'xmppServer', "ZZZ")
+ec.set(node2, 'xmppUser', "nitlab.inf.uth.gr")
 ec.set(node2, 'xmppPort', "5222")
 ec.set(node2, 'xmppPassword', "1234")
+ec.set(node2, 'version', "5")
 
 # Create and Configure the Interfaces
 iface1 = ec.register_resource("OMFWifiInterface")
-ec.set(iface1, 'alias', "w0")
+ec.set(iface1, 'name', "wlan0")
 ec.set(iface1, 'mode', "adhoc")
-ec.set(iface1, 'type', "g")
+ec.set(iface1, 'hw_mode', "g")
 ec.set(iface1, 'essid', "vlcexp")
-ec.set(iface1, 'ip', "192.168.0.XX")
+ec.set(iface1, 'ip', "192.168.0.XX/24")
+ec.set(iface1, 'version', "5")
 
 iface2 = ec.register_resource("OMFWifiInterface")
-ec.set(iface2, 'alias', "w0")
+ec.set(iface2, 'name', "wlan0")
 ec.set(iface2, 'mode', "adhoc")
-ec.set(iface2, 'type', 'g')
+ec.set(iface2, 'hw_mode', 'g')
 ec.set(iface2, 'essid', "vlcexp")
-ec.set(iface2, 'ip', "192.168.0.YY")
+ec.set(iface2, 'ip', "192.168.0.YY/24")
+ec.set(iface2, 'version', "5")
 
 # Create and Configure the Channel
 channel = ec.register_resource("OMFChannel")
 ec.set(channel, 'channel', "6")
-ec.set(channel, 'xmppSlice', "ZZZ")
-ec.set(channel, 'xmppHost', "nitlab.inf.uth.gr")
+ec.set(channel, 'xmppServer', "ZZZ")
+ec.set(channel, 'xmppUser', "nitlab.inf.uth.gr")
 ec.set(channel, 'xmppPort', "5222")
 ec.set(channel, 'xmppPassword', "1234")
+ec.set(channel, 'version', "5")
 
 # Create and Configure the Application
 app1 = ec.register_resource("OMFApplication")
 ec.set(app1, 'appid', 'Vlc#1')
-ec.set(app1, 'path', "/root/vlc-1.1.13/cvlc")
-ec.set(app1, 'args', "/root/10-by-p0d.avi --sout '#rtp{dst=192.168.0.YY,port=1234,mux=ts}'")
+ec.set(app1, 'command', "/root/vlc/vlc-1.1.13/cvlc /root/10-by-p0d.avi --sout '#rtp{dst=192.168.0.YY,port=1234,mux=ts}'")
 ec.set(app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+ec.set(app1, 'version', "5")
 
 app2 = ec.register_resource("OMFApplication")
 ec.set(app2, 'appid', 'Vlc#2')
-ec.set(app2, 'path', "/root/vlc-1.1.13/cvlc")
-ec.set(app2, 'args', "rtp://192.168.0.YY:1234")
+ec.set(app2, 'command', "/root/vlc/vlc-1.1.13/cvlc rtp://192.168.0.YY:1234")
 ec.set(app2, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+ec.set(app2, 'version', "5")
 
 app3 = ec.register_resource("OMFApplication")
 ec.set(app3, 'appid', 'Kill#2')
-ec.set(app3, 'path', "/usr/bin/killall")
-ec.set(app3, 'args', "vlc_app")
+ec.set(app3, 'command', "/usr/bin/killall vlc_app")
 ec.set(app3, 'env', " ")
+ec.set(app3, 'version', "5")
 
 app4 = ec.register_resource("OMFApplication")
 ec.set(app4, 'appid', 'Kill#1')
-ec.set(app4, 'path', "/usr/bin/killall")
-ec.set(app4, 'args', "vlc_app")
+ec.set(app4, 'command', "/usr/bin/killall vlc_app")
 ec.set(app4, 'env', " ")
+ec.set(app4, 'version', "5")
 
 # Connection
 ec.register_connection(app3, node1)
diff --git a/examples/omf/nepi_omf5_nitos_vlc_tribino.py b/examples/omf/nepi_omf5_nitos_vlc_tribino.py
new file mode 100644 (file)
index 0000000..e1eabf5
--- /dev/null
@@ -0,0 +1,141 @@
+"""
+    NEPI, a framework to manage network experiments
+    Copyright (C) 2013 INRIA
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+    Author: Alina Quereilhac <alina.quereilhac@inria.fr>
+            Julien Tribino <julien.tribino@inria.fr>
+
+    Example :
+      - Testbed : Nitos
+      - Explanation :
+
+       VLC Streaming on VLC
+                   
+     Node                                               Node   
+     omf.nitos.node0xx                                  omf.nitos.node0xx
+     0--------------------------------------------------0
+     |                                                  |
+     |                                                  |
+     0                                                  0
+     VLC Server                                         VLC Client
+   
+      - Experiment:
+        - t0 : Deployment
+        - t1 : VLC Server start
+        - t2 (t1 + 4s) : VLC Client start
+        - t3 (t2 + 22s) : Client and Server Stop
+        - t4 (t3 + 3s): Kill all the applications
+
+"""
+
+#!/usr/bin/env python
+from nepi.execution.resource import ResourceFactory, ResourceAction, ResourceState
+from nepi.execution.ec import ExperimentController
+
+# Create the EC
+ec = ExperimentController()
+
+# Create and Configure the Nodes
+node1 = ec.register_resource("OMFNode")
+ec.set(node1, 'hostname', 'omf.nitos.node025')
+ec.set(node1, 'xmppServer', "tribino")
+ec.set(node1, 'xmppUser', "nitlab.inf.uth.gr")
+ec.set(node1, 'xmppPort', "5222")
+ec.set(node1, 'xmppPassword', "1234")
+ec.set(node1, 'version', "5")
+
+node2 = ec.register_resource("OMFNode")
+ec.set(node2, 'hostname', "omf.nitos.node028")
+ec.set(node2, 'xmppServer', "tribino")
+ec.set(node2, 'xmppUser', "nitlab.inf.uth.gr")
+ec.set(node2, 'xmppPort', "5222")
+ec.set(node2, 'xmppPassword', "1234")
+ec.set(node2, 'version', "5")
+
+# Create and Configure the Interfaces
+iface1 = ec.register_resource("OMFWifiInterface")
+ec.set(iface1, 'name', "wlan0")
+ec.set(iface1, 'mode', "adhoc")
+ec.set(iface1, 'hw_mode', "g")
+ec.set(iface1, 'essid', "vlcexp")
+ec.set(iface1, 'ip', "192.168.0.25/24")
+ec.set(iface1, 'version', "5")
+
+iface2 = ec.register_resource("OMFWifiInterface")
+ec.set(iface2, 'name', "wlan0")
+ec.set(iface2, 'mode', "adhoc")
+ec.set(iface2, 'hw_mode', 'g')
+ec.set(iface2, 'essid', "vlcexp")
+ec.set(iface2, 'ip', "192.168.0.28/24")
+ec.set(iface2, 'version', "5")
+
+# Create and Configure the Channel
+channel = ec.register_resource("OMFChannel")
+ec.set(channel, 'channel', "6")
+ec.set(channel, 'xmppServer', "tribino")
+ec.set(channel, 'xmppUser', "nitlab.inf.uth.gr")
+ec.set(channel, 'xmppPort', "5222")
+ec.set(channel, 'xmppPassword', "1234")
+ec.set(channel, 'version', "5")
+
+# Create and Configure the Application
+app1 = ec.register_resource("OMFApplication")
+ec.set(app1, 'appid', 'Vlc#1')
+ec.set(app1, 'command', "/root/vlc/vlc-1.1.13/cvlc /root/10-by-p0d.avi --sout '#rtp{dst=192.168.0.28,port=1234,mux=ts}'")
+ec.set(app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+ec.set(app1, 'version', "5")
+
+app2 = ec.register_resource("OMFApplication")
+ec.set(app2, 'appid', 'Vlc#2')
+ec.set(app2, 'command', "/root/vlc/vlc-1.1.13/cvlc rtp://192.168.0.28:1234")
+ec.set(app2, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+ec.set(app2, 'version', "5")
+
+app3 = ec.register_resource("OMFApplication")
+ec.set(app3, 'appid', 'Kill#2')
+ec.set(app3, 'command', "/usr/bin/killall vlc_app")
+ec.set(app3, 'env', " ")
+ec.set(app3, 'version', "5")
+
+app4 = ec.register_resource("OMFApplication")
+ec.set(app4, 'appid', 'Kill#1')
+ec.set(app4, 'command', "/usr/bin/killall vlc_app")
+ec.set(app4, 'env', " ")
+ec.set(app4, 'version', "5")
+
+# Connection
+ec.register_connection(app3, node1)
+ec.register_connection(app1, node1)
+ec.register_connection(node1, iface1)
+ec.register_connection(iface1, channel)
+ec.register_connection(iface2, channel)
+ec.register_connection(node2, iface2)
+ec.register_connection(app2, node2)
+ec.register_connection(app4, node2)
+
+# User Behaviour
+ec.register_condition(app2, ResourceAction.START, app1, ResourceState.STARTED , "4s")
+ec.register_condition([app1, app2], ResourceAction.STOP, app2, ResourceState.STARTED , "22s")
+ec.register_condition([app3, app4], ResourceAction.START, app2, ResourceState.STARTED , "25s")
+ec.register_condition([app3, app4], ResourceAction.STOP, app3, ResourceState.STARTED , "1s")
+
+# Deploy
+ec.deploy()
+
+ec.wait_finished([app1, app2, app3, app4])
+
+# Stop Experiment
+ec.shutdown()
similarity index 85%
rename from examples/omf/nepi_omf_xeyes_nitos.py
rename to examples/omf/nepi_omf5_nitos_xeyes.py
index bfa5bfe..8fd81fe 100644 (file)
@@ -49,43 +49,43 @@ ec = ExperimentController()
 # Create and Configure the Nodes
 node1 = ec.register_resource("OMFNode")
 ec.set(node1, 'hostname', 'omf.nitos.node0XX')
-ec.set(node1, 'xmppSlice', "ZZZ")
-ec.set(node1, 'xmppHost', "nitlab.inf.uth.gr")
+ec.set(node1, 'xmppServer', "ZZZ")
+ec.set(node1, 'xmppUser', "nitlab.inf.uth.gr")
 ec.set(node1, 'xmppPort', "5222")
 ec.set(node1, 'xmppPassword', "1234")
+ec.set(node1, 'version', "5")
 
 # Create and Configure the Interfaces
 iface1 = ec.register_resource("OMFWifiInterface")
-ec.set(iface1, 'alias', "w0")
+ec.set(iface1, 'name', "wlan0")
 ec.set(iface1, 'mode', "adhoc")
-ec.set(iface1, 'type', "g")
+ec.set(iface1, 'hw_mode', "g")
 ec.set(iface1, 'essid', "xeyes")
-ec.set(iface1, 'ip', "192.168.0.XX")
-ec.set(iface1, 'xmppSlice', "ZZZ")
-ec.set(iface1, 'xmppHost', "nitlab.inf.uth.gr")
-ec.set(iface1, 'xmppPort', "5222")
-ec.set(iface1, 'xmppPassword', "1234")
+ec.set(iface1, 'ip', "192.168.0.XX/24")
+ec.set(iface1, 'version', "5")
 
 # Create and Configure the Channel
 channel = ec.register_resource("OMFChannel")
 ec.set(channel, 'channel', "6")
-ec.set(channel, 'xmppSlice', "ZZZ")
-ec.set(channel, 'xmppHost', "nitlab.inf.uth.gr")
+ec.set(channel, 'xmppServer', "ZZZ")
+ec.set(channel, 'xmppUser', "nitlab.inf.uth.gr")
 ec.set(channel, 'xmppPort', "5222")
 ec.set(channel, 'xmppPassword', "1234")
+ec.set(channel, 'version', "5")
 
 # Create and Configure the Application
 app1 = ec.register_resource("OMFApplication")
 ec.set(app1, 'appid', 'XEyes#1')
-ec.set(app1, 'path', "/usr/bin/xeyes")
-ec.set(app1, 'args', " ")
+ec.set(app1, 'command', "/usr/bin/xeyes")
 ec.set(app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+ec.set(app1, 'version', "5")
 
 app2 = ec.register_resource("OMFApplication")
 ec.set(app2, 'appid', 'Kill#1')
 ec.set(app2, 'path', "/usr/bin/kill")
 ec.set(app2, 'args', "xeyes")
 ec.set(app2, 'env', " ")
+ec.set(app2, 'version', "5")
 
 # Connection
 ec.register_connection(app2, node1)
diff --git a/examples/omf/nepi_omf5_plexus_ccncat_linear.py b/examples/omf/nepi_omf5_plexus_ccncat_linear.py
new file mode 100644 (file)
index 0000000..2280be5
--- /dev/null
@@ -0,0 +1,298 @@
+"""
+    NEPI, a framework to manage network experiments
+    Copyright (C) 2013 INRIA
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+    Author: Alina Quereilhac <alina.quereilhac@inria.fr>
+            Julien Tribino <julien.tribino@inria.fr>
+
+    Example :
+      - Testbed : Nitos
+      - Explanation :
+
+      CCN topology:
+    
+                 
+                   
+     content                ccncat        ccncat
+     h1      h2      h3      h4            h5
+     0 ----- 0 ----- 0 ------ 0 ------------0
+               
+
+      - Experiment:
+        * t0 : h4 retrieves the content and we measure the time
+        * t1 : h5 retrieve the content and should go faster than h4
+
+"""
+
+#!/usr/bin/env python
+from nepi.execution.resource import ResourceFactory, ResourceAction, ResourceState
+from nepi.execution.ec import ExperimentController
+
+from optparse import OptionParser, SUPPRESS_HELP
+
+###  Define OMF Method to simplify definition of resources ###
+def add_node(ec, hostname, xmppServer, xmppUser, xmppPort = "5222", xmppPassword = "1234"):
+    node = ec.register_resource("OMFNode")
+    ec.set(node, 'hostname', hostname)
+    ec.set(node, 'xmppServer', xmppServer)
+    ec.set(node, 'xmppUser', xmppUser)
+    ec.set(node, 'xmppPort', xmppPort)
+    ec.set(node, 'xmppPassword', xmppPassword)
+    ec.set(node, 'version', "5")
+    return node
+
+def add_interface(ec, ip, xmppServer, xmppUser, essid = "ccn", name = "wlan0", mode = "adhoc",
+                 typ = "g", xmppPort = "5222", xmppPassword = "1234"):
+    iface = ec.register_resource("OMFWifiInterface")
+    ec.set(iface, 'name', name)
+    ec.set(iface, 'mode', mode)
+    ec.set(iface, 'hw_mode', typ)
+    ec.set(iface, 'essid', essid)
+    ec.set(iface, 'ip', ip)
+    ec.set(iface, 'version', "5")
+    return iface
+
+def add_channel(ec, channel, xmppServer, xmppUser, xmppPort = "5222", xmppPassword = "1234"):
+    chan = ec.register_resource("OMFChannel")
+    ec.set(chan, 'channel', channel)
+    ec.set(chan, 'xmppServer', xmppServer)
+    ec.set(chan, 'xmppUser', xmppUser)
+    ec.set(chan, 'xmppPort', xmppPort)
+    ec.set(chan, 'xmppPassword', xmppPassword)
+    ec.set(chan, 'version', "5")
+    return chan
+
+def add_app(ec, host,  appid, command, env, xmppServer, xmppUser, 
+                xmppPort = "5222", xmppPassword = "1234"):
+    app = ec.register_resource("OMFApplication")
+    ec.set(app, 'appid', appid)
+    ec.set(app, 'command', command)
+    ec.set(app, 'env', env)
+    ec.set(app, 'version', "5")
+    ec.register_connection(app, host)
+    return app
+
+
+###  Define a CCND application  ###
+def add_ccnd(ec, host, peers, xmppServer, xmppUser, xmppPort = "5222", xmppPassword = "1234"):
+    env = 'PATH=$PATH:/root/ccnx-0.7.2/bin HOME=/root \
+CCNR_DIRECTORY="/root" CCNR_STATUS_PORT="8080"'
+
+    # BASH command -> ' ccndstart ; ccndc add ccnx:/ udp host ; ccnr '
+    command = "ccndc add ccnx:/ udp " + peers
+    app = add_app(ec, host, "#ccnd", command, env, xmppServer, xmppUser,
+                    xmppPort = xmppPort, xmppPassword = xmppPassword)
+    return app
+
+###  Define a CCN SeqWriter application ###
+def add_publish(ec, host,  movie, xmppServer, xmppUser, xmppPort = "5222", xmppPassword = "1234"):
+    env = 'PATH=$PATH:/root/ccnx-0.7.2/bin HOME=/root CCNR_DIRECTORY="/root" CCNR_STATUS_PORT="8080"'
+
+    # BASH command -> 'ccnseqwriter -r ccnx:/VIDEO < movie'
+    command = "ccnseqwriter -r ccnx:/VIDEO"
+    command += " < " + movie
+
+    app = add_app(ec, host, "#ccn_write", command, env, xmppServer, xmppUser,
+                  xmppPort = xmppPort, xmppPassword = xmppPassword)
+    return app
+
+###  Define a streaming application ###
+def add_stream(ec, host, xmppServer, xmppUser, xmppPort = "5222", xmppPassword = "1234"):
+    env = 'PATH=$PATH:/root/ccnx-0.7.2/bin HOME=/root CCNR_DIRECTORY="/root" CCNR_STATUS_PORT="8080"'
+    command = " ddbus-uuidgen --ensure ; ( /root/ccnx-0.7.2/bin/ccncat ccnx:/VIDEO | /root/vlc-1.1.13/cvlc - )  "
+    app = add_app(ec, host, "#ccn_stream", command, env, xmppServer, xmppUser,
+                  xmppPort = xmppPort, xmppPassword = xmppPassword)
+    return app
+
+###  Many options to easily addapt the script ####
+def get_options():
+    usage = "usage: %prog -c <channel> -s <xmpp_slice> -x <xmpp_host> -m <movie>"
+
+    parser = OptionParser(usage=usage)
+    parser.add_option("-c", "--channel", dest="channel", 
+            help="Channel of the communication", type="str")
+    parser.add_option("-s", "--xmpp-slice", dest="xmpp_slice", 
+            help="Name of the slice XMPP", type="str")
+    parser.add_option("-x", "--xmpp-host", dest="xmpp_host",
+            help="Name of the host XMPP", type="str")
+    #parser.add_option("-e", "--exp-id", dest="exp_id", 
+    #        help="Label to identify experiment", type="str")
+
+    (options, args) = parser.parse_args()
+
+    return (options.channel, options.xmpp_slice, 
+            options.xmpp_host)
+
+### Script itself ###
+if __name__ == '__main__':
+    (channel, xmpp_slice, xmpp_host) = get_options()
+
+    env = 'PATH=$PATH:/root/ccnx-0.7.2/bin HOME=/root CCNR_DIRECTORY="/root" CCNR_STATUS_PORT="8080"'
+
+# Create the EC
+    ec = ExperimentController()
+
+# Create the topology
+    host1 = "omf.plexus.wlab5"
+    host2 = "omf.plexus.wlab9"
+    host3 = "omf.plexus.wlab10"
+    host4 = "omf.plexus.wlab24"
+    host5 = "omf.plexus.wlab29"  # b1
+
+    ip1 = "10.0.0.5/24"
+    ip2 = "10.0.0.9/24"
+    ip3 = "10.0.0.10/24"
+    ip4 = "10.0.0.24/24"
+    ip5 = "10.0.0.29/24"
+
+    all_hosts = [host1, host2, host3, host4, host5]
+    all_ip = [ip1, ip2, ip3, ip4, ip5]
+
+    ring_hosts = [host1, host2, host3, host4]
+    nodes = dict()
+
+    chann = add_channel(ec, channel, xmpp_slice, xmpp_host)
+    for i in xrange(len(all_hosts)):
+        node = add_node(ec,all_hosts[i], xmpp_slice, xmpp_host)
+        iface = add_interface(ec, all_ip[i], xmpp_slice, xmpp_host)
+        ec.register_connection(node, iface)
+        ec.register_connection(iface, chann)
+        nodes[all_hosts[i]] = node
+
+#### CCN setup for the node
+###    ccnds = dict()
+###    ccnrs = dict()
+###    for i in xrange(len(all_hosts)):
+###        ccndstart = add_app(ec, nodes[all_hosts[i]],  "#ccndstart", "ccndstart &", 
+###                              env, xmpp_slice, xmpp_host)
+###        ccnr = add_app(ec, nodes[all_hosts[i]],  "#ccnr", "ccnr &", 
+###                            env, xmpp_slice, xmpp_host)
+###        ccnds[all_hosts[i]] = ccndstart
+###        ccnrs[all_hosts[i]] = ccnr
+###        ec.register_condition(ccnr, ResourceAction.START, ccndstart, ResourceState.STARTED, "1s")
+
+#### CCNDC setup 
+###    # l1 : h1 - h2 , h2 - h1
+###    l1u = add_ccnd(ec, nodes[host1], ip2, xmpp_slice, xmpp_host)
+###    l1d = add_ccnd(ec, nodes[host2], ip1, xmpp_slice, xmpp_host)
+
+###    # l2 : h2 - h3 , h3 - h2
+###    l2u = add_ccnd(ec, nodes[host2], ip3, xmpp_slice, xmpp_host)
+###    l2d = add_ccnd(ec, nodes[host3], ip2, xmpp_slice, xmpp_host)
+
+###    # l3 : h3 - h4 , h4 - h3
+###    l3u = add_ccnd(ec, nodes[host3], ip4, xmpp_slice, xmpp_host)
+###    l3d = add_ccnd(ec, nodes[host4], ip3, xmpp_slice, xmpp_host)
+
+###    # l4 : h4 - h5 , h5 - h4
+###    l4u = add_ccnd(ec, nodes[host4], ip5, xmpp_slice, xmpp_host)
+###    l4d = add_ccnd(ec, nodes[host5], ip4, xmpp_slice, xmpp_host)
+
+###    link = [l1u, l1d, l2u, l2d, l3u, l3d, l4u, l4d]
+
+#### List of condition
+###    for i in xrange(len(all_hosts)):
+###         ec.register_condition(ccnrs[all_hosts[i]], ResourceAction.START, ccnds[all_hosts[i]], ResourceState.STARTED, "1s")
+###         ec.register_condition(link, ResourceAction.START, ccnrs[all_hosts[i]], ResourceState.STARTED, "1s")
+
+
+# Do the iperf
+    iperfserv = dict()
+    iperfclient = dict()
+    for i in xrange(len(all_hosts)):
+        perfserv = add_app(ec, nodes[all_hosts[i]],  "#perfserv", "iperf -s > /opt/iperfserv.txt", 
+                              env, xmpp_slice, xmpp_host)
+        iperfclient[all_hosts[i]] = []
+        if i > 0:
+            cmd = "iperf -c " + all_ip[i-1] + " > /opt/iperclient1.txt"
+            perfclient1 = add_app(ec, nodes[all_hosts[i]],  "#perfclient1", cmd, 
+                            env, xmpp_slice, xmpp_host)
+            iperfclient[all_hosts[i]].append(perfclient1)
+
+        if i < (len(all_hosts)-1):
+            cmd = "iperf -c " + all_ip[i+1] + " > /opt/iperclient2.txt"
+            perfclient2 = add_app(ec, nodes[all_hosts[i]],  "#perfclient2", cmd, 
+                            env, xmpp_slice, xmpp_host)
+            iperfclient[all_hosts[i]].append(perfclient2)
+
+        iperfserv[all_hosts[i]] = perfserv
+
+    for i in xrange(len(all_hosts)):
+         #ec.register_condition(iperfserv[all_hosts[i]], ResourceAction.START, link, ResourceState.STARTED, "2s")
+         for elt in iperfclient[all_hosts[i]]:
+             ec.register_condition(elt, ResourceAction.START, iperfserv[all_hosts[i]], ResourceState.STARTED, "3s")
+
+
+## Streaming Server
+#    pub = add_publish(ec, nodes[host5], movie, xmpp_slice, xmpp_host)
+
+## Streaming client
+#    stream = add_stream(ec, nodes[host6], xmpp_slice, xmpp_host)
+
+## Streaming conditions
+#    ec.register_condition(pub, ResourceAction.START, link, ResourceState.STARTED, "2s")
+#    ec.register_condition(stream, ResourceAction.START, link, ResourceState.STARTED, "2s")
+#    ec.register_condition(stream, ResourceAction.START, pub, ResourceState.STARTED, "2s")
+
+
+
+### Cleanning ###
+# Cleaning when the experiment stop
+##    ccndstops = []
+##    for i in xrange(len(all_hosts)):
+##        ccndstop = add_app(ec, nodes[all_hosts[i]], "#ccndstop", "ccndstop", env, xmpp_slice, xmpp_host)
+##        ccndstops.append(ccndstop)
+    perfkill = dict()
+    for i in xrange(len(all_hosts)):
+        kill = add_app(ec, nodes[all_hosts[i]], "#kill", "killall iperf", "", xmpp_slice, xmpp_host)
+        perfkill[all_hosts[i]] = kill
+
+
+# Condition to stop and clean the experiment
+    apps = []
+    for i in xrange(len(all_hosts)):
+#        apps.append(ccnds[all_hosts[i]])
+#        apps.append(ccnrs[all_hosts[i]])
+        apps.append(iperfserv[all_hosts[i]])
+        for elt in iperfclient[all_hosts[i]]:
+            apps.append(elt)
+#    apps += link
+    #apps.append(pub)
+    #apps.append(stream)
+
+    ec.register_condition(apps, ResourceAction.STOP, apps, ResourceState.STARTED, "20s")
+
+#    ec.register_condition(ccndstops + [killall], ResourceAction.START, apps, ResourceState.STOPPED, "1s")
+#    ec.register_condition(ccndstops + [killall], ResourceAction.STOP, ccndstops, ResourceState.STARTED, "1s")
+
+    killall = []
+    for i in xrange(len(all_hosts)):
+        killall.append(perfkill[all_hosts[i]])
+
+    ec.register_condition(killall, ResourceAction.START, apps, ResourceState.STOPPED, "1s")
+    ec.register_condition(killall, ResourceAction.STOP, killall, ResourceState.STARTED, "1s")
+
+### Deploy and Wait ###
+# Deploy all ResourceManagers
+    ec.deploy()
+
+# Wait until the applications are finished
+    ec.wait_finished(killall)
+
+# Shutdown the experiment controller
+    ec.shutdown()
+
+
similarity index 91%
rename from examples/omf/nepi_omf_stdin_exp.py
rename to examples/omf/nepi_omf5_plexus_stdin.py
index b19a401..f856c1b 100644 (file)
@@ -50,17 +50,18 @@ ec = ExperimentController()
 # Create and Configure the Nodes
 node1 = ec.register_resource("OMFNode")
 ec.set(node1, 'hostname', 'omf.plexus.wlab17')
-ec.set(node1, 'xmppSlice', "nepi")
-ec.set(node1, 'xmppHost', "xmpp-plexus.onelab.eu")
+ec.set(node1, 'xmppServer', "nepi")
+ec.set(node1, 'xmppUser', "xmpp-plexus.onelab.eu")
 ec.set(node1, 'xmppPort', "5222")
 ec.set(node1, 'xmppPassword', "1234")
+ec.set(node1, 'version', "5")
 
 # Create and Configure the Application
 app1 = ec.register_resource("OMFApplication")
 ec.set(app1, 'appid', "robot")
-ec.set(app1, 'path', "/root/CTRL_test.rb")
-ec.set(app1, 'args', "coord.csv")
+ec.set(app1, 'command', "/root/CTRL_test.rb coord.csv")
 ec.set(app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+ec.set(app1, 'version', "5")
 
 # Connection
 ec.register_connection(app1, node1)
similarity index 69%
rename from examples/omf/nepi_omf_vlc_experiment.py
rename to examples/omf/nepi_omf5_plexus_vlc.py
index 1cfd242..1293013 100644 (file)
@@ -51,61 +51,72 @@ ec = ExperimentController()
 # Create and Configure the Nodes
 node1 = ec.register_resource("OMFNode")
 ec.set(node1, 'hostname', 'omf.plexus.wlab17')
-ec.set(node1, 'xmppSlice', "nepi")
-ec.set(node1, 'xmppHost', "xmpp-plexus.onelab.eu")
+ec.set(node1, 'xmppUser', "nepi")
+ec.set(node1, 'xmppServer', "xmpp-plexus.onelab.eu")
 ec.set(node1, 'xmppPort', "5222")
 ec.set(node1, 'xmppPassword', "1234")
+ec.set(node1, 'version', "5")
 
 node2 = ec.register_resource("OMFNode")
 ec.set(node2, 'hostname', "omf.plexus.wlab37")
-ec.set(node2, 'xmppSlice', "nepi")
-ec.set(node2, 'xmppHost', "xmpp-plexus.onelab.eu")
+ec.set(node2, 'xmppUser', "nepi")
+ec.set(node2, 'xmppServer', "xmpp-plexus.onelab.eu")
 ec.set(node2, 'xmppPort', "5222")
 ec.set(node2, 'xmppPassword', "1234")
+ec.set(node2, 'version', "5")
 
 # Create and Configure the Interfaces
 iface1 = ec.register_resource("OMFWifiInterface")
-ec.set(iface1, 'alias', "w0")
+ec.set(iface1, 'name', "wlan0")
 ec.set(iface1, 'mode', "adhoc")
-ec.set(iface1, 'type', "g")
+ec.set(iface1, 'hw_mode', "g")
 ec.set(iface1, 'essid', "vlcexp")
 ec.set(iface1, 'ip', "10.0.0.17")
+ec.set(iface1, 'version', "5")
 
 iface2 = ec.register_resource("OMFWifiInterface")
-ec.set(iface2, 'alias', "w0")
+ec.set(iface2, 'name', "wlan0")
 ec.set(iface2, 'mode', "adhoc")
-ec.set(iface2, 'type', 'g')
+ec.set(iface2, 'hw_mode', 'g')
 ec.set(iface2, 'essid', "vlcexp")
-ec.set(iface2, 'ip', "10.0.0.37")
+ec.set(iface2, 'ip', "10.0.0.37/24")
+ec.set(iface2, 'version', "5")
 
 # Create and Configure the Channel
 channel = ec.register_resource("OMFChannel")
 ec.set(channel, 'channel', "6")
-ec.set(channel, 'xmppSlice', "nepi")
-ec.set(channel, 'xmppHost', "xmpp-plexus.onelab.eu")
+ec.set(channel, 'xmppUser', "nepi")
+ec.set(channel, 'xmppServer', "xmpp-plexus.onelab.eu")
 ec.set(channel, 'xmppPort', "5222")
 ec.set(channel, 'xmppPassword', "1234")
+ec.set(channel, 'version', "5")
 
 # Create and Configure the Application
 app1 = ec.register_resource("OMFApplication")
 ec.set(app1, 'appid', 'Vlc#1')
-ec.set(app1, 'path', "/opt/vlc-1.1.13/cvlc")
-ec.set(app1, 'args', "--quiet /opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
-#ec.set(app1, 'args', "--quiet /opt/big_buck_bunny_240p_mpeg4.ts --sout '#rtp{dst=10.0.0.XX,port=1234,mux=ts} '")
-#ec.set(app1, 'args', "--quiet /opt/big_buck_bunny_240p_mpeg4_lq.ts --sout '#rtp{dst=10.0.0.XX,port=1234,mux=ts} '")
+ec.set(app1, 'command', "/opt/vlc-1.1.13/cvlc --quiet /opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
+#ec.set(app1, 'command', "/opt/vlc-1.1.13/cvlc --quiet /opt/big_buck_bunny_240p_mpeg4.ts --sout '#rtp{dst=10.0.0.XX,port=1234,mux=ts} '")
+#ec.set(app1, 'command', "/opt/vlc-1.1.13/cvlc --quiet /opt/big_buck_bunny_240p_mpeg4_lq.ts --sout '#rtp{dst=10.0.0.XX,port=1234,mux=ts} '")
 ec.set(app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+ec.set(app1, 'version', "5")
 
 app2 = ec.register_resource("OMFApplication")
 ec.set(app2, 'appid', 'Vlc#2')
-ec.set(app2, 'path', "/opt/vlc-1.1.13/cvlc")
-ec.set(app2, 'args', "--quiet rtp://10.0.0.37:1234")
+ec.set(app2, 'command', "/opt/vlc-1.1.13/cvlc --quiet rtp://10.0.0.37:1234")
 ec.set(app2, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+ec.set(app2, 'version', "5")
 
 app3 = ec.register_resource("OMFApplication")
-ec.set(app3, 'appid', 'Kill#2')
-ec.set(app3, 'path', "/usr/bin/killall")
-ec.set(app3, 'args', "vlc")
+ec.set(app3, 'appid', 'Kill#1')
+ec.set(app3, 'command', "/usr/bin/killall vlc")
 ec.set(app3, 'env', " ")
+ec.set(app3, 'version', "5")
+
+app4 = ec.register_resource("OMFApplication")
+ec.set(app4, 'appid', 'Kill#2')
+ec.set(app4, 'command', "/usr/bin/killall vlc")
+ec.set(app4, 'env', " ")
+ec.set(app4, 'version', "5")
 
 # Connection
 ec.register_connection(app3, node1)
@@ -115,12 +126,13 @@ ec.register_connection(iface1, channel)
 ec.register_connection(iface2, channel)
 ec.register_connection(node2, iface2)
 ec.register_connection(app2, node2)
+ec.register_connection(app4, node2)
 
 # User Behaviour
 ec.register_condition(app2, ResourceAction.START, app1, ResourceState.STARTED , "4s")
 ec.register_condition([app1, app2], ResourceAction.STOP, app2, ResourceState.STARTED , "22s")
-ec.register_condition(app3, ResourceAction.START, app2, ResourceState.STARTED , "25s")
-ec.register_condition(app3, ResourceAction.STOP, app3, ResourceState.STARTED , "1s")
+ec.register_condition([app3, app4], ResourceAction.START, app2, ResourceState.STOPPED , "1s")
+ec.register_condition([app3, app4], ResourceAction.STOP, app3, ResourceState.STARTED , "1s")
 
 # Deploy
 ec.deploy()
diff --git a/examples/omf/nepi_omf6_iminds_vlc.py b/examples/omf/nepi_omf6_iminds_vlc.py
new file mode 100644 (file)
index 0000000..fd9737d
--- /dev/null
@@ -0,0 +1,91 @@
+"""
+    NEPI, a framework to manage network experiments
+    Copyright (C) 2013 INRIA
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+    Author: Alina Quereilhac <alina.quereilhac@inria.fr>
+            Julien Tribino <julien.tribino@inria.fr>
+
+
+"""
+
+#!/usr/bin/env python
+from nepi.execution.resource import ResourceFactory, ResourceAction, ResourceState
+from nepi.execution.ec import ExperimentController
+
+# Create the EC
+ec = ExperimentController()
+
+# Create and Configure the Nodes
+
+node1 = ec.register_resource("OMFNode")
+ec.set(node1, 'hostname', 'servernode.vlc.nepi.wilab2.ilabt.iminds.be')
+ec.set(node1, 'xmppServer', "xmpp.ilabt.iminds.be")
+ec.set(node1, 'xmppUser', "nepi")
+ec.set(node1, 'xmppPort', "5222")
+ec.set(node1, 'xmppPassword', "1234")
+
+iface1 = ec.register_resource("OMFWifiInterface")
+ec.set(iface1, 'name', 'wlan0')
+ec.set(iface1, 'mode', "adhoc")
+ec.set(iface1, 'hw_mode', "g")
+ec.set(iface1, 'essid', "vlc")
+ec.set(iface1, 'ip', "192.168.0.1/24")
+
+node2 = ec.register_resource("OMFNode")
+ec.set(node2, 'hostname', 'clientnode.vlc.nepi.wilab2.ilabt.iminds.be')
+ec.set(node2, 'xmppServer', "xmpp.ilabt.iminds.be")
+ec.set(node2, 'xmppUser', "nepi")
+ec.set(node2, 'xmppPort', "5222")
+ec.set(node2, 'xmppPassword', "1234")
+
+iface2 = ec.register_resource("OMFWifiInterface")
+ec.set(iface2, 'name', 'wlan0')
+ec.set(iface2, 'mode', "adhoc")
+ec.set(iface2, 'hw_mode', "g")
+ec.set(iface2, 'essid', "vlc")
+ec.set(iface2, 'ip', "192.168.0.2/24")
+
+chan = ec.register_resource("OMFChannel")
+ec.set(chan, 'channel', "6")
+
+# Create and Configure the Application
+app1 = ec.register_resource("OMFApplication")
+ec.set(app1, 'command', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority /root/vlc/vlc-1.1.13/cvlc /root/10-by-p0d.avi --sout '#rtp{dst=192.168.0.2,port=1234,mux=ts}'")
+
+app2 = ec.register_resource("OMFApplication")
+ec.set(app2, 'command', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority /root/vlc/vlc-1.1.13/cvlc rtp://192.168.0.2:1234")
+
+
+# Connection
+ec.register_connection(iface1, node1)
+ec.register_connection(iface2, node2)
+ec.register_connection(iface1, chan)
+ec.register_connection(iface2, chan)
+ec.register_connection(app1, node1)
+ec.register_connection(app2, node2)
+
+ec.register_condition([app2], ResourceAction.START, app1, ResourceState.STARTED , "4s")
+ec.register_condition([app1,app2], ResourceAction.STOP, app2, ResourceState.STARTED , "30s")
+
+
+# Deploy
+ec.deploy()
+
+ec.wait_finished([app1,app2])
+
+# Stop Experiment
+ec.shutdown()
+
diff --git a/examples/omf/nepi_omf6_nitos_vlc.py b/examples/omf/nepi_omf6_nitos_vlc.py
new file mode 100644 (file)
index 0000000..fb04f04
--- /dev/null
@@ -0,0 +1,91 @@
+"""
+    NEPI, a framework to manage network experiments
+    Copyright (C) 2013 INRIA
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+    Author: Alina Quereilhac <alina.quereilhac@inria.fr>
+            Julien Tribino <julien.tribino@inria.fr>
+
+
+"""
+
+#!/usr/bin/env python
+from nepi.execution.resource import ResourceFactory, ResourceAction, ResourceState
+from nepi.execution.ec import ExperimentController
+
+# Create the EC
+ec = ExperimentController()
+
+# Create and Configure the Nodes
+
+node1 = ec.register_resource("OMFNode")
+ec.set(node1, 'hostname', 'node025')
+ec.set(node1, 'xmppServer', "nitlab.inf.uth.gr")
+ec.set(node1, 'xmppUser', "nepi")
+ec.set(node1, 'xmppPort', "5222")
+ec.set(node1, 'xmppPassword', "1234")
+
+iface1 = ec.register_resource("OMFWifiInterface")
+ec.set(iface1, 'name', 'wlan0')
+ec.set(iface1, 'mode', "adhoc")
+ec.set(iface1, 'hw_mode', "g")
+ec.set(iface1, 'essid', "vlc")
+ec.set(iface1, 'ip', "192.168.0.25/24")
+
+node2 = ec.register_resource("OMFNode")
+ec.set(node2, 'hostname', 'node027')
+ec.set(node2, 'xmppServer', "nitlab.inf.uth.gr")
+ec.set(node2, 'xmppUser', "nepi")
+ec.set(node2, 'xmppPort', "5222")
+ec.set(node2, 'xmppPassword', "1234")
+
+iface2 = ec.register_resource("OMFWifiInterface")
+ec.set(iface2, 'name', 'wlan0')
+ec.set(iface2, 'mode', "adhoc")
+ec.set(iface2, 'hw_mode', "g")
+ec.set(iface2, 'essid', "vlc")
+ec.set(iface2, 'ip', "192.168.0.27/24")
+
+chan = ec.register_resource("OMFChannel")
+ec.set(chan, 'channel', "6")
+
+# Create and Configure the Application
+app1 = ec.register_resource("OMFApplication")
+ec.set(app1, 'command', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority /root/vlc/vlc-1.1.13/cvlc /root/10-by-p0d.avi --sout '#rtp{dst=192.168.0.27,port=1234,mux=ts}'")
+
+app2 = ec.register_resource("OMFApplication")
+ec.set(app2, 'command', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority /root/vlc/vlc-1.1.13/cvlc rtp://192.168.0.27:1234")
+
+
+# Connection
+ec.register_connection(iface1, node1)
+ec.register_connection(iface2, node2)
+ec.register_connection(iface1, chan)
+ec.register_connection(iface2, chan)
+ec.register_connection(app1, node1)
+ec.register_connection(app2, node2)
+
+ec.register_condition([app2], ResourceAction.START, app1, ResourceState.STARTED , "4s")
+ec.register_condition([app1,app2], ResourceAction.STOP, app2, ResourceState.STARTED , "30s")
+
+
+# Deploy
+ec.deploy()
+
+ec.wait_finished([app1,app2])
+
+# Stop Experiment
+ec.shutdown()
+
diff --git a/examples/omf/nepi_omf6_plexus_hostname.py b/examples/omf/nepi_omf6_plexus_hostname.py
new file mode 100644 (file)
index 0000000..5f58e95
--- /dev/null
@@ -0,0 +1,69 @@
+"""
+    NEPI, a framework to manage network experiments
+    Copyright (C) 2013 INRIA
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+    Author: Alina Quereilhac <alina.quereilhac@inria.fr>
+            Julien Tribino <julien.tribino@inria.fr>
+
+
+"""
+
+#!/usr/bin/env python
+from nepi.execution.resource import ResourceFactory, ResourceAction, ResourceState
+from nepi.execution.ec import ExperimentController
+
+# Create the EC
+ec = ExperimentController()
+
+# Create and Configure the Nodes
+
+node1 = ec.register_resource("OMFNode")
+ec.set(node1, 'hostname', 'wlab12')
+ec.set(node1, 'xmppServer', "xmpp-plexus.onelab.eu")
+ec.set(node1, 'xmppUser', "nepi")
+ec.set(node1, 'xmppPort', "5222")
+ec.set(node1, 'xmppPassword', "1234")
+
+# Create and Configure the Application
+app1 = ec.register_resource("OMFApplication")
+ec.set(app1, 'command', '/bin/hostname -f')
+ec.set(app1, 'env', "")
+
+app2 = ec.register_resource("OMFApplication")
+ec.set(app2, 'command', '/bin/date')
+ec.set(app2, 'env', "")
+
+app3 = ec.register_resource("OMFApplication")
+ec.set(app3, 'command', '/bin/hostname -f')
+ec.set(app3, 'env', "")
+
+# Connection
+ec.register_connection(app1, node1)
+ec.register_connection(app2, node1)
+ec.register_connection(app3, node1)
+
+ec.register_condition([app2,app3], ResourceAction.START, app1, ResourceState.STARTED , "3s")
+ec.register_condition([app1,app2,app3], ResourceAction.STOP, app2, ResourceState.STARTED , "5s")
+
+
+# Deploy
+ec.deploy()
+
+ec.wait_finished([app1,app2,app3])
+
+# Stop Experiment
+ec.shutdown()
+
diff --git a/examples/omf/nepi_omf6_plexus_ping.py b/examples/omf/nepi_omf6_plexus_ping.py
new file mode 100644 (file)
index 0000000..6674c21
--- /dev/null
@@ -0,0 +1,93 @@
+"""
+    NEPI, a framework to manage network experiments
+    Copyright (C) 2013 INRIA
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+    Author: Alina Quereilhac <alina.quereilhac@inria.fr>
+            Julien Tribino <julien.tribino@inria.fr>
+
+
+"""
+
+#!/usr/bin/env python
+from nepi.execution.resource import ResourceFactory, ResourceAction, ResourceState
+from nepi.execution.ec import ExperimentController
+
+# Create the EC
+ec = ExperimentController()
+
+# Create and Configure the Nodes
+
+node1 = ec.register_resource("OMFNode")
+ec.set(node1, 'hostname', 'wlab12')
+ec.set(node1, 'xmppServer', "xmpp-plexus.onelab.eu")
+ec.set(node1, 'xmppUser', "nepi")
+ec.set(node1, 'xmppPort', "5222")
+ec.set(node1, 'xmppPassword', "1234")
+
+iface1 = ec.register_resource("OMFWifiInterface")
+ec.set(iface1, 'name', 'wlan0')
+ec.set(iface1, 'mode', "adhoc")
+ec.set(iface1, 'hw_mode', "g")
+ec.set(iface1, 'essid', "ping")
+ec.set(iface1, 'ip', "192.168.0.12/24")
+
+node2 = ec.register_resource("OMFNode")
+ec.set(node2, 'hostname', 'wlab49')
+ec.set(node2, 'xmppServer', "xmpp-plexus.onelab.eu")
+ec.set(node2, 'xmppUser', "nepi")
+ec.set(node2, 'xmppPort', "5222")
+ec.set(node2, 'xmppPassword', "1234")
+
+iface2 = ec.register_resource("OMFWifiInterface")
+ec.set(iface2, 'name', 'wlan0')
+ec.set(iface2, 'mode', "adhoc")
+ec.set(iface2, 'hw_mode', "g")
+ec.set(iface2, 'essid', "ping")
+ec.set(iface2, 'ip', "192.168.0.49/24")
+
+chan = ec.register_resource("OMFChannel")
+ec.set(chan, 'channel', "6")
+
+# Create and Configure the Application
+app1 = ec.register_resource("OMFApplication")
+ec.set(app1, 'command', '/bin/ping 192.168.0.49')
+ec.set(app1, 'env', "")
+
+app2 = ec.register_resource("OMFApplication")
+ec.set(app2, 'command', '/bin/ping 192.168.0.12')
+ec.set(app2, 'env', "")
+
+
+# Connection
+ec.register_connection(iface1, node1)
+ec.register_connection(iface2, node2)
+ec.register_connection(iface1, chan)
+ec.register_connection(iface2, chan)
+ec.register_connection(app1, node1)
+ec.register_connection(app2, node2)
+
+ec.register_condition([app2], ResourceAction.START, app1, ResourceState.STARTED , "2s")
+ec.register_condition([app1,app2], ResourceAction.STOP, app2, ResourceState.STARTED , "10s")
+
+
+# Deploy
+ec.deploy()
+
+ec.wait_finished([app1,app2])
+
+# Stop Experiment
+ec.shutdown()
+
index b66d2a5..a7f131b 100644 (file)
@@ -24,7 +24,7 @@ from nepi.execution.resource import ResourceManager, clsinit_copy, \
         ResourceState, reschedule_delay
 from nepi.execution.attribute import Attribute, Flags 
 from nepi.resources.omf.omf_resource import ResourceGateway, OMFResource
-from nepi.resources.omf.node import OMFNode, confirmation_counter
+from nepi.resources.omf.node import OMFNode, confirmation_counter, reschedule_check
 from nepi.resources.omf.omf_api_factory import OMFAPIFactory
 
 from nepi.util import sshfuncs
@@ -83,8 +83,8 @@ class OMFApplication(OMFResource):
 
         self.set('command', "")
         self.set('appid', "")
-        self.path= ""
-        self.args = ""
+        self._path= ""
+        self._args = ""
         self.set('env', "")
 
         self._node = None
@@ -101,9 +101,9 @@ class OMFApplication(OMFResource):
 
     def _init_command(self):
         comm = self.get('command').split(' ')
-        self.path= comm[0]
+        self._path= comm[0]
         if len(comm)>1:
-            self.args = ' '.join(comm[1:])
+            self._args = ' '.join(comm[1:])
 
     @property
     def exp_id(self):
@@ -117,14 +117,14 @@ class OMFApplication(OMFResource):
 
     def stdin_hook(self, old_value, new_value):
         """ Set a hook to the stdin attribute in order to send a message at each time
-        the value of this parameter is changed
+        the value of this parameter is changed. Used ofr OMF 5.4 only
 
         """
         self._omf_api.send_stdin(self.node.get('hostname'), new_value, self.get('appid'))
         return new_value
 
     def add_set_hook(self):
-        """ Initialize the hooks
+        """ Initialize the hooks for OMF 5.4 only
 
         """
         attr = self._attrs["stdin"]
@@ -166,7 +166,7 @@ class OMFApplication(OMFResource):
     def do_deploy(self):
         """ Deploy the RM. It means nothing special for an application 
         for now (later it will be upload sources, ...)
-        It becomes DEPLOYED after getting the xmpp client.
+        It becomes DEPLOYED after the topic for the application has been created
 
         """
         if not self.node or self.node.state < ResourceState.READY:
@@ -193,6 +193,11 @@ class OMFApplication(OMFResource):
             msg = "Credentials are not all initialzed. Default values will be used"
             self.warn(msg)
 
+        if not self.get('command') :
+            msg = "Application's Command is not initialized"
+            self.error(msg)
+            raise RuntimeError, msg
+
         if not self._omf_api :
             self._omf_api = OMFAPIFactory.get_api(self.get('version'), 
               self.get('xmppServer'), self.get('xmppUser'), self.get('xmppPort'),
@@ -225,7 +230,7 @@ class OMFApplication(OMFResource):
             uid = self.check_deploy(self.create_id)
             if not uid:
                 self._create_cnt +=1
-                self.ec.schedule(reschedule_delay, self.deploy)
+                self.ec.schedule(reschedule_check, self.deploy)
                 return
 
             self._topic_app = uid
@@ -234,6 +239,13 @@ class OMFApplication(OMFResource):
         super(OMFApplication, self).do_deploy()
 
     def check_deploy(self, cid):
+        """ Check, through the mail box in the parser, 
+        if the confirmation of the creation has been received
+
+        :param cid: the id of the original message
+        :type guid: string
+
+        """
         uid = self._omf_api.check_mailbox("create", cid)
         if uid : 
             return uid
@@ -242,13 +254,8 @@ class OMFApplication(OMFResource):
     def do_start(self):
         """ Start the RM. It means : Send Xmpp Message Using OMF protocol 
          to execute the application. 
-         It becomes STARTED before the messages are sent (for coordination)
 
         """
-        if not self.get('command') :
-            msg = "Application's Command is not initialized"
-            self.error(msg)
-            raise RuntimeError, msg
 
         if not self.get('env'):
             self.set('env', " ")
@@ -256,12 +263,12 @@ class OMFApplication(OMFResource):
         if self.get('version') == "5":
             # Some information to check the command for OMF5
             msg = " " + self.get_rtype() + " ( Guid : " + str(self._guid) +") : " + \
-                self.get('appid') + " : " + self.path + " : " + \
-                self.args + " : " + self.get('env')
+                self.get('appid') + " : " + self._path + " : " + \
+                self._args + " : " + self.get('env')
             self.debug(msg)
 
             self._omf_api.execute(self.node.get('hostname'),self.get('appid'), \
-                self.get('args'), self.get('path'), self.get('env'))
+                self._args, self._path, self.get('env'))
         else:
             #For OMF 6
             if self._start_cnt == 0:
@@ -282,12 +289,19 @@ class OMFApplication(OMFResource):
             res = self.check_start(self._topic_app)
             if not res:
                 self._start_cnt +=1
-                self.ec.schedule(reschedule_delay, self.start)
+                self.ec.schedule(reschedule_check, self.start)
                 return
 
         super(OMFApplication, self).do_start()
 
     def check_start(self, uid):
+        """ Check, through the mail box in the parser, 
+        if the confirmation of the start has been received
+
+        :param uid: the id of the original message
+        :type guid: string
+
+        """
         res = self._omf_api.check_mailbox("started", uid)
         if res : 
             return True
@@ -304,6 +318,13 @@ class OMFApplication(OMFResource):
         super(OMFApplication, self).do_stop()
 
     def check_release(self, cid):
+        """ Check, through the mail box in the parser, 
+        if the confirmation of the release has been received
+
+        :param cid: the id of the original message
+        :type guid: string
+
+        """
         res = self._omf_api.check_mailbox("release", cid)
         if res : 
             return res
@@ -313,22 +334,23 @@ class OMFApplication(OMFResource):
         """ Clean the RM at the end of the experiment and release the API.
 
         """
-        if self.get('version') == "6":
-            if not self.release_id:
-                self.release_id = os.urandom(16).encode('hex')
-                self._omf_api.frcp_release( self.release_id, self.node.get('hostname'),self._topic_app, res_id=self._topic_app)
+        if self._omf_api:
+            if self.get('version') == "6":
+                if not self.release_id:
+                    self.release_id = os.urandom(16).encode('hex')
+                    self._omf_api.frcp_release( self.release_id, self.node.get('hostname'),self._topic_app, res_id=self._topic_app)
     
-            if self._release_cnt < confirmation_counter:
-                cid = self.check_release(self.release_id)
-                if not cid:
-                    self._release_cnt +=1
-                    self.ec.schedule(reschedule_delay, self.release)
-                    return
-            else:
-                msg = "Couldn't retrieve the confirmation of the release"
-                self.error(msg)
+                if self._release_cnt < confirmation_counter:
+                    cid = self.check_release(self.release_id)
+                    if not cid:
+                        self._release_cnt +=1
+                        self.ec.schedule(reschedule_check, self.release)
+                        return
+                else:
+                    msg = "Couldn't retrieve the confirmation of the release"
+                    self.error(msg)
+
 
-        if self._omf_api:
             OMFAPIFactory.release_api(self.get('version'), 
               self.get('xmppServer'), self.get('xmppUser'), self.get('xmppPort'),
                self.get('xmppPassword'), exp_id = self.exp_id)
index fd083a7..3abbc14 100644 (file)
@@ -124,20 +124,26 @@ class OMFChannel(OMFResource):
                     if rm_iface.state < ResourceState.PROVISIONED or \
                             rm_node.state < ResourceState.READY:
                         return "reschedule"
-                    couple = [rm_node.get('hostname'), rm_iface.get('alias')]
-                    #print couple
+                    couple = [rm_node.get('hostname'), rm_iface.alias]
                     res.append(couple)
         return res
 
     def get_frequency(self, channel):
+        """ Returns the frequency of a specific channel number
+
+        """           
         return OMFChannel.ChannelToFreq[channel]
 
     def do_deploy(self):
         """ Deploy the RM. It means : Get the xmpp client and send messages 
-        using OMF 5.4 protocol to configure the channel.
-        It becomes DEPLOYED after sending messages to configure the channel
+        using OMF 5.4 or 6 protocol to configure the channel.
 
         """   
+        if not self.get('channel'):
+            msg = "Channel's value is not initialized"
+            self.error(msg)
+            raise RuntimeError, msg
+
         if self.get('version') == "6":
             self.frequency = self.get_frequency(self.get('channel'))
             super(OMFChannel, self).do_deploy()
@@ -155,21 +161,16 @@ class OMFChannel(OMFResource):
             self.warn(msg)
 
         if not self._omf_api :
-            self._omf_api = OMFAPIFactory.get_api(self.get('xmppSlice'), 
-                self.get('xmppHost'), self.get('xmppPort'), 
-                self.get('xmppPassword'), exp_id = self.exp_id)
-
-        if not self.get('channel'):
-            msg = "Channel's value is not initialized"
-            self.error(msg)
-            raise RuntimeError, msg
+            self._omf_api = OMFAPIFactory.get_api(self.get('version'), 
+              self.get('xmppServer'), self.get('xmppUser'), self.get('xmppPort'),
+               self.get('xmppPassword'), exp_id = self.exp_id)
 
         self._nodes_guid = self._get_target(self._connections)
 
 
 
         if self._nodes_guid == "reschedule" :
-            self.ec.schedule("2s", self.deploy)
+            self.ec.schedule("1s", self.deploy)
         else:
             for couple in self._nodes_guid:
                 attrval = self.get('channel')
index c487327..4a7b7a7 100644 (file)
@@ -23,7 +23,7 @@ from nepi.execution.resource import ResourceManager, clsinit_copy, \
         ResourceState, reschedule_delay
 from nepi.execution.attribute import Attribute, Flags 
 
-from nepi.resources.omf.node import OMFNode, confirmation_counter
+from nepi.resources.omf.node import OMFNode, confirmation_counter, reschedule_check
 from nepi.resources.omf.omf_resource import ResourceGateway, OMFResource
 from nepi.resources.omf.channel import OMFChannel
 from nepi.resources.omf.omf_api_factory import OMFAPIFactory
@@ -42,22 +42,16 @@ class OMFWifiInterface(OMFResource):
     _rtype = "OMFWifiInterface"
     _authorized_connections = ["OMFNode" , "OMFChannel"]
 
-    #alias2name = dict({'w0':'wlan0', 'w1':'wlan1'})
-
     @classmethod
     def _register_attributes(cls):
         """Register the attributes of an OMF interface 
 
         """
-        alias = Attribute("alias","Alias of the interface", default = "w0")
-        type = Attribute("type","Choose between : a, b, g, n")
-        name = Attribute("name","Alias of the interface", default = "wlan0")
+        name = Attribute("name","Alias of the interface : wlan0, wlan1, ..", default = "wlan0")
         mode = Attribute("mode","Mode of the interface")
         hw_mode = Attribute("hw_mode","Choose between : a, b, g, n")
         essid = Attribute("essid","Essid of the interface")
         ip = Attribute("ip","IP of the interface")
-        cls._register_attribute(alias)
-        cls._register_attribute(type)
         cls._register_attribute(name)
         cls._register_attribute(mode)
         cls._register_attribute(hw_mode)
@@ -77,8 +71,8 @@ class OMFWifiInterface(OMFResource):
         super(OMFWifiInterface, self).__init__(ec, guid)
 
         self._conf = False
-
-        self._alias = self.get('alias')
+        self.alias = None
+        self._type = None
 
         self.create_id = None
         self._create_cnt = 0
@@ -135,8 +129,11 @@ class OMFWifiInterface(OMFResource):
             return False
 
         for attrname in ["mode", "type", "essid"]:
-            attrval = self.get(attrname)
-            attrname = "net/%s/%s" % (self._alias, attrname)
+            if attrname == "type" :
+                attrval = self._type
+            else :
+                attrval = self.get(attrname)
+            attrname = "net/%s/%s" % (self.alias, attrname)
             self._omf_api.configure(self.node.get('hostname'), attrname, 
                         attrval)
         
@@ -146,32 +143,52 @@ class OMFWifiInterface(OMFResource):
     def configure_ip(self):
         """ Configure the ip of the interface
 
+        .. note : The ip is separated from the others parameters to avoid 
+        CELL ID shraing problem. By putting th ip at the end of the configuration, 
+        each node use the same channel and can then share the same CELL ID.
+        In the second case, the channel is defined at the end and the node don't
+        share a common CELL ID and can not communicate.
+
         """
         if self.channel.state < ResourceState.READY:
             self.ec.schedule(reschedule_delay, self.deploy)
             return False
 
         attrval = self.get("ip")
-        attrname = "net/%s/%s" % (self._alias, "ip")
+        if '/' in attrval:
+           attrval,mask = attrval.split('/')
+        attrname = "net/%s/%s" % (self.alias, "ip")
         self._omf_api.configure(self.node.get('hostname'), attrname, 
                     attrval)
         return True
 
 
     def configure_on_omf5(self):
-        # Just for information
-#        self.debug(" " + self.get_rtype() + " ( Guid : " + str(self._guid) +") : " + \
-#            self.get('mode') + " : " + self.get('type') + " : " + \
-#            self.get('essid') + " : " + self.get('ip'))
+        """ Method to configure the wifi interface when OMF 5.4 is used.
+
+        """    
+
+        self._type = self.get('hw_mode')
+        if self.get('name') == "wlan0" or "eth0":
+            self.alias = "w0"
+        else:    
+            self.alias = "w1"
+        res = False
         if self.state < ResourceState.PROVISIONED:
             if self._conf == False:
                 self._conf = self.configure_iface()
-                res = self._conf
         if self._conf == True:
             res = self.configure_ip()
         return res
 
     def check_deploy(self, cid):
+        """ Check, through the mail box in the parser, 
+        if the confirmation of the creation has been received
+
+        :param cid: the id of the original message
+        :type guid: string
+
+        """
         uid = self._omf_api.check_mailbox("create", cid)
         if uid : 
             return uid
@@ -179,8 +196,8 @@ class OMFWifiInterface(OMFResource):
 
     def do_deploy(self):
         """ Deploy the RM. It means : Get the xmpp client and send messages 
-        using OMF 5.4 protocol to configure the interface.
-        It becomes DEPLOYED after sending messages to configure the interface
+        using OMF 5.4 or 6 protocol to configure the interface.
+
         """
         if not self.node or self.node.state < ResourceState.READY:
             self.debug("---- RESCHEDULING DEPLOY ---- node state %s "
@@ -215,16 +232,20 @@ class OMFWifiInterface(OMFResource):
               self.get('xmppServer'), self.get('xmppUser'), self.get('xmppPort'),
                self.get('xmppPassword'), exp_id = self.exp_id)
 
-        if not (self.get('name') and self.get('mode') and self.get('essid') \
+        if not (self.get('name')):
+            msg = "Interface's name is not initialized"
+            self.error(msg)
+            raise RuntimeError, msg
+
+        if not (self.get('mode') and self.get('essid') \
                  and self.get('hw_mode') and self.get('ip')):
             msg = "Interface's variable are not initialized"
             self.error(msg)
             raise RuntimeError, msg
 
-        self.set('type',self.get('hw_mode'))
-
         if self.get('version') == "5":
-            res = self.configure_on_omf5()
+            res = self.configure_on_omf5()        
+
         else :
             res = self.configure_on_omf6()
 
@@ -232,6 +253,9 @@ class OMFWifiInterface(OMFResource):
             super(OMFWifiInterface, self).do_deploy()
 
     def configure_on_omf6(self):
+        """ Method to configure the wifi interface when OMF 6 is used.
+
+        """   
         if not self.create_id :
             props = {}
             props['wlan:if_name'] = self.get('name')
@@ -258,7 +282,7 @@ class OMFWifiInterface(OMFResource):
         uid = self.check_deploy(self.create_id)
         if not uid:
             self._create_cnt +=1
-            self.ec.schedule(reschedule_delay, self.deploy)
+            self.ec.schedule(reschedule_check, self.deploy)
             return False
 
         self._topic_iface = uid
@@ -266,6 +290,13 @@ class OMFWifiInterface(OMFResource):
         return True
 
     def check_release(self, cid):
+        """ Check, through the mail box in the parser, 
+        if the confirmation of the release has been received
+
+        :param cid: the id of the original message
+        :type guid: string
+
+        """
         res = self._omf_api.check_mailbox("release", cid)
         if res : 
             return res
@@ -275,22 +306,23 @@ class OMFWifiInterface(OMFResource):
         """ Clean the RM at the end of the experiment and release the API
 
         """
-        if self.get('version') == "6":
-            if not self.release_id:
-                self.release_id = os.urandom(16).encode('hex')
-                self._omf_api.frcp_release( self.release_id, self.node.get('hostname'),self._topic_iface, res_id=self._topic_iface)
+        if self._omf_api:
+            if self.get('version') == "6":
+                if not self.release_id:
+                    self.release_id = os.urandom(16).encode('hex')
+                    self._omf_api.frcp_release( self.release_id, self.node.get('hostname'),self._topic_iface, res_id=self._topic_iface)
     
-            if self._release_cnt < confirmation_counter:
-                cid = self.check_release(self.release_id)
-                if not cid:
-                    self._release_cnt +=1
-                    self.ec.schedule(reschedule_delay, self.release)
-                    return
-            else:
-                msg = "Couldn't retrieve the confirmation of the release"
-                self.error(msg)
+                if self._release_cnt < confirmation_counter:
+                    cid = self.check_release(self.release_id)
+                    if not cid:
+                        self._release_cnt +=1
+                        self.ec.schedule(reschedule_check, self.release)
+                        return
+                else:
+                    msg = "Couldn't retrieve the confirmation of the release"
+                    self.error(msg)
+
 
-        if self._omf_api:
             OMFAPIFactory.release_api(self.get('version'), 
               self.get('xmppServer'), self.get('xmppUser'), self.get('xmppPort'),
                self.get('xmppPassword'), exp_id = self.exp_id)
index 282e03e..d1af7df 100644 (file)
@@ -86,6 +86,19 @@ class MessageHandler():
 
     def create_function(self, msg_id, src, rtype, timestamp, props = None, guards = None):
         """ Build a create message
+
+        :param msg_id: Id of the message
+        :type msg_id: str
+        :param src: Src node that send the message (jabber source)
+        :type src: str
+        :param rtype: Type of the object
+        :type rtype: str
+        :param timestamp: Unix Timestamp
+        :type timestamp: str
+        :param props: List of properties
+        :type props: list
+        :param guards: list of guards (assertions for properties)
+        :type guards: list
         """
         payload = self._type_element("create", "http://schema.mytestbed.net/omf/6.0/protocol", msg_id )
         self._attr_element(payload,"src",src)
@@ -119,6 +132,17 @@ class MessageHandler():
 
     def configure_function(self, msg_id, src, timestamp, props = None, guards = None):
         """ Build a configure message
+
+        :param msg_id: Id of the message
+        :type msg_id: str
+        :param src: Src node that send the message (jabber source)
+        :type src: str
+        :param timestamp: Unix Timestamp
+        :type timestamp: str
+        :param props: List of properties
+        :type props: list
+        :param guards: list of guards (assertions for properties)
+        :type guards: list
         """
         payload = self._type_element("configure", "http://schema.mytestbed.net/omf/6.0/protocol", msg_id )
         self._attr_element(payload,"src",src)
@@ -139,6 +163,16 @@ class MessageHandler():
     def request_function(self, msg_id, src, timestamp,  props = None, guards = None):
         """ Build a request message
 
+        :param msg_id: Id of the message
+        :type msg_id: str
+        :param src: Src node that send the message (jabber source)
+        :type src: str
+        :param timestamp: Unix Timestamp
+        :type timestamp: str
+        :param props: List of properties
+        :type props: list
+        :param guards: list of guards (assertions for properties)
+        :type guards: list
         """
         payload = self._type_element("request", "http://schema.mytestbed.net/omf/6.0/protocol", msg_id )
         self._attr_element(payload,"src",src)
@@ -155,21 +189,48 @@ class MessageHandler():
                 self._attr_element(guardians,guard,guards[guard])
         return payload
 
-    def inform_function(self, msg_id, src, timestamp, cid, itype):
-        """ Build an inform message
-
-        """
-        payload = self._type_element("inform", "http://schema.mytestbed.net/omf/6.0/protocol", msg_id )
-        sliceid = self._attr_element(payload,"src",src)
-        expid = self._attr_element(config,"ts",timestamp)
-        target = self._attr_element(config,"cid",cid)
-        value = self._attr_element(config,"itype",value)
-        path = self._attr_element(config,"properties",path)
-        return payload
+#  For now, we don't need the inform message since it is ht RC that send them.
+
+#    def inform_function(self, msg_id, src, timestamp, cid, itype):
+#        """ Build an inform message
+
+#        :param msg_id: Id of the message
+#        :type msg_id: str
+#        :param src: Src node that send the message (jabber source)
+#        :type src: str
+#        :param rtype: Type of the object
+#        :type rtype: str
+#        :param timestamp: Unix Timestamp
+#        :type timestamp: str
+#        :param cid: Id of the orignial message
+#        :type cid: str
+#        :param itype: type of the object created
+#        :type itype: str
+#        """
+
+#        payload = self._type_element("inform", "http://schema.mytestbed.net/omf/6.0/protocol", msg_id )
+#        sliceid = self._attr_element(payload,"src",src)
+#        expid = self._attr_element(config,"ts",timestamp)
+#        target = self._attr_element(config,"cid",cid)
+#        value = self._attr_element(config,"itype",value)
+#        path = self._attr_element(config,"properties",path)
+#        return payload
 
     def release_function(self, msg_id, src, timestamp, res_id = None, props = None, guards = None):
         """ Build a release message
 
+        :param msg_id: Id of the message
+        :type msg_id: str
+        :param src: Src node that send the message (jabber source)
+        :type src: str
+        :param timestamp: Unix Timestamp
+        :type timestamp: str
+        :param res_id: Id of the release resource
+        :type res_id: str
+        :param props: List of properties
+        :type props: list
+        :param guards: list of guards (assertions for properties)
+        :type guards: list
         """
         payload = self._type_element("release", "http://schema.mytestbed.net/omf/6.0/protocol", msg_id )
         self._attr_element(payload,"src",src)
index 166249b..c0e10f9 100644 (file)
@@ -26,7 +26,8 @@ from nepi.resources.omf.omf_api_factory import OMFAPIFactory
 
 import time
 
-confirmation_counter = 600
+reschedule_check = "0.3s"
+confirmation_counter = 300
 
 @clsinit_copy
 class OMFNode(OMFResource):
@@ -96,7 +97,6 @@ class OMFNode(OMFResource):
     def do_deploy(self):
         """ Deploy the RM. It means : Send Xmpp Message Using OMF protocol 
             to enroll the node into the experiment.
-            It becomes DEPLOYED after sending messages to enroll the node
 
         """ 
         if not self.get('xmppServer'):
@@ -132,7 +132,8 @@ class OMFNode(OMFResource):
         super(OMFNode, self).do_deploy()
 
     def do_release(self):
-        """ Clean the RM at the end of the experiment
+        """ Clean the RM at the end of the experiment by unenrolling
+        the node from the topic
 
         """
         from nepi.resources.omf.application import OMFApplication
index e01a754..517a95c 100644 (file)
@@ -31,10 +31,10 @@ class OMF5API(Logger):
     """
     .. class:: Class Args :
       
-        :param slice: Xmpp Slice
-        :type slice: str
         :param host: Xmpp Server
         :type host: str
+        :param slice: Xmpp Slice
+        :type slice: str
         :param port: Xmpp Port
         :type port: str
         :param password: Xmpp password
@@ -49,14 +49,13 @@ class OMF5API(Logger):
        instead of OMF used for OMF5.3
 
     """
-    def __init__(self, slice, host, port, password, xmpp_root = None, 
+    def __init__(self, host, slice, port, password, xmpp_root = None, 
             exp_id = None):
         """
-    
-        :param slice: Xmpp Slice
-        :type slice: str
         :param host: Xmpp Server
         :type host: str
+        :param slice: Xmpp Slice
+        :type slice: str
         :param port: Xmpp Port
         :type port: str
         :param password: Xmpp password
@@ -65,7 +64,7 @@ class OMF5API(Logger):
         :type xmpp_root: str
 
         """
-        super(OMFAPI, self).__init__("OMFAPI")
+        super(OMF5API, self).__init__("OMF5API")
         self._exp_id = exp_id 
         self._user = "%s-%s" % (slice, self._exp_id)
         self._slice = slice
index c2ecb49..048117d 100644 (file)
@@ -34,10 +34,10 @@ class OMF6API(Logger):
     """
     .. class:: Class Args :
       
-        :param slice: Xmpp Slice
-        :type slice: str
         :param server: Xmpp Server
         :type server: str
+        :param user: Xmpp User
+        :type user: str
         :param port: Xmpp Port
         :type port: str
         :param password: Xmpp password
@@ -55,11 +55,10 @@ class OMF6API(Logger):
     def __init__(self, server, user = "nepi", port="5222", password="1234",
             exp_id = None):
         """
-    
-        :param slice: Xmpp Slice
-        :type slice: str
         :param server: Xmpp Server
         :type server: str
+        :param user: Xmpp User
+        :type user: str
         :param port: Xmpp Port
         :type port: str
         :param password: Xmpp password
@@ -129,12 +128,15 @@ class OMF6API(Logger):
 
     @property
     def _nepi_topic(self):
+        """ Return the name of the session topic
+
+        """
         msg = "nepi-" + self._exp_id
         self.debug(msg)
         return msg
 
     def _enroll_nepi(self):
-        """ Create and Subscribe to the Session Topic
+        """ Create and Subscribe to the session Topic
 
         """
         nepi_topic = self._nepi_topic
@@ -172,7 +174,7 @@ class OMF6API(Logger):
 
 
     def frcp_inform(self, topic, cid, itype):
-        """ Configure attribute on the node
+        """ Publish an inform message
 
         """
         msg_id = os.urandom(16).encode('hex')
@@ -182,7 +184,7 @@ class OMF6API(Logger):
         self._client.publish(payload, xmpp_node)
 
     def frcp_configure(self, topic, props = None, guards = None ):
-        """ Configure attribute on the node
+        """ Publish a configure message
 
         """
         msg_id = os.urandom(16).encode('hex')
@@ -192,7 +194,7 @@ class OMF6API(Logger):
 
     
     def frcp_create(self, msg_id, topic, rtype, props = None, guards = None ):
-        """ Send to the stdin of the application the value
+        """ Publish a create message
 
         """
         timestamp = tsformat()
@@ -210,7 +212,7 @@ class OMF6API(Logger):
         self._client.publish(payload, xmpp_node)
 
     def frcp_release(self, msg_id, parent, child, res_id = None, props = None, guards = None ):
-        """ Delete the session and logger topics. Then disconnect 
+        """ Publish a release message
 
         """
         timestamp = tsformat()
@@ -224,6 +226,14 @@ class OMF6API(Logger):
         #self._client.delete(child)
 
     def check_mailbox(self, itype, attr):
+        """ Check the mail box
+
+        :param itype: type of mail
+        :type itype: str
+        :param attr: value wanted
+        :type attr: str
+
+        """
         return self._client.check_mailbox(itype, attr)
 
     def unenroll_topic(self, topic):
index 6039e63..4ea5717 100644 (file)
@@ -131,6 +131,9 @@ class OMF6Parser(Logger):
 
 
     def _inform_creation_ok(self, root, namespaces):
+        """ Parse and Display CREATION OK message
+
+        """
         #ET.dump(root)
         uid = self._check_for_tag(root, namespaces, "uid")
         cid = self._check_for_tag(root, namespaces, "cid")
@@ -139,6 +142,8 @@ class OMF6Parser(Logger):
         msg = "CREATION OK -- "
         if binary_path :
             msg = msg + "The resource : '"+binary_path
+        else :
+            msg = msg + "The interface"
         if uid :
             msg = msg + "' is listening to the topics : '"+ uid
         if member :
@@ -148,6 +153,9 @@ class OMF6Parser(Logger):
             self.mailbox['create'].append([cid, uid ])
 
     def _inform_creation_failed(self, root, namespaces):
+        """ Parse and Display CREATION FAILED message
+
+        """
         reason = self._check_for_tag(root, namespaces, "reason")
         cid = self._check_for_tag(root, namespaces, "cid")
         msg = "CREATION FAILED - The reason : "+reason
@@ -156,6 +164,9 @@ class OMF6Parser(Logger):
             self.mailbox['create'].append([cid, uid ])
 
     def _inform_status(self, root, namespaces):
+        """ Parse and Display STATUS message
+
+        """
         props = self._check_for_props(root, namespaces)
         uid = self._check_for_tag(root, namespaces, "uid")
         msg = "STATUS -- "
@@ -172,6 +183,9 @@ class OMF6Parser(Logger):
         self.info(msg)
 
     def _inform_released(self, root, namespaces):
+        """ Parse and Display RELEASED message
+
+        """
         #ET.dump(root)
         parent_id = self._check_for_tag(root, namespaces, "src")
         child_id = self._check_for_tag(root, namespaces, "res_id")
@@ -183,17 +197,24 @@ class OMF6Parser(Logger):
             self.mailbox['release'].append(cid)
 
     def _inform_error(self, root, namespaces):
+        """ Parse and Display ERROR message
+
+        """
         reason = self._check_for_tag(root, namespaces, "reason")
         msg = "The reason : "+reason
         self.error(msg)
 
     def _inform_warn(self, root, namespaces):
+        """ Parse and Display WARN message
+
+        """
         reason = self._check_for_tag(root, namespaces, "reason")
         msg = "The reason : "+reason
         self.warn(msg)
 
     def _parse_inform(self, root, namespaces):
-        """ Check the significative element in the answer and display it
+        """ Check the significative element in the answer
+            Then Parse it and display using specific method
 
         :param root: Root of the tree
         :type root: ElementTree Element
@@ -214,6 +235,14 @@ class OMF6Parser(Logger):
         
 
     def check_mailbox(self, itype, attr):
+        """ Check the mail box
+
+        :param itype: type of mail
+        :type itype: str
+        :param attr: value wanted
+        :type attr: str
+
+        """
         if itype == "create":
             for res in self.mailbox[itype]:
                 binary, uid = res
@@ -228,6 +257,11 @@ class OMF6Parser(Logger):
                
 
     def handle(self, iq):
+        """ Check the mail box
+
+        :param iq: message received
+        :type itype: iq
+        """
         namespaces = "{http://schema.mytestbed.net/omf/6.0/protocol}"
         for i in iq['pubsub_event']['items']:
             root = ET.fromstring(str(i))
diff --git a/src/nepi/resources/omf/omf6_resource.py b/src/nepi/resources/omf/omf6_resource.py
deleted file mode 100644 (file)
index c88d049..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-#    NEPI, a framework to manage network experiments
-#    Copyright (C) 2013 INRIA
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation, either version 3 of the License, or
-#    (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Julien Tribino <julien.tribino@inria.fr>
-#         Lucia Guevgeozian <lucia.guevgeozian_odizzio@inria.fr>
-
-from nepi.execution.attribute import Attribute, Flags, Types
-from nepi.execution.resource import ResourceManager, clsinit_copy, \
-        ResourceState, reschedule_delay
-
-
-@clsinit_copy
-class OMF6Resource(ResourceManager):
-    """
-    Generic resource gathering XMPP credential information and common methods
-    for OMF nodes, channels, applications, etc.
-    """
-    _rtype = "OMFResource"
-
-    @classmethod
-    def _register_attributes(cls):
-
-        xmppHost = Attribute("xmppServer", "Xmpp Server",
-            flags = Flags.Credential)
-        xmppUser = Attribute("xmppUser", "Xmpp User")
-        xmppPort = Attribute("xmppPort", "Xmpp Port",
-            flags = Flags.Credential)
-        xmppPassword = Attribute("xmppPassword", "Xmpp Password",
-                flags = Flags.Credential)
-        version = Attribute("xmppPassword", "Xmpp Password",
-                flags = Flags.Credential)
-
-        cls._register_attribute(xmppHost)
-        cls._register_attribute(xmppUser)
-        cls._register_attribute(xmppPort)
-        cls._register_attribute(xmppPassword)
-        cls._register_attribute(version)
-
-    def __init__(self, ec, guid):
-        super(OMF6Resource, self).__init__(ec, guid)
-        pass
-
index 00a20f9..a8fbaac 100644 (file)
@@ -43,14 +43,18 @@ class OMFAPIFactory(object):
     def get_api(cls, version, server, user, port, password, exp_id = None):
         """ Get an OMF Api
 
-        :param slice: Xmpp Slice Name
-        :type slice: str
+        :param version: OMF Version. Either 5 or 6
+        :type version: str
         :param server: Xmpp Server Adress
         :type server: str
+        :param user: Xmpp User
+        :type user: str
         :param port: Xmpp Port (Default : 5222)
         :type port: str
         :param password: Xmpp Password
         :type password: str
+        :param exp_id: Id of the experiment
+        :type exp_id: str
 
         """
         if version and user and server and port and password:
@@ -71,14 +75,18 @@ class OMFAPIFactory(object):
     def create_api(cls, version, server, user, port, password, exp_id):
         """ Create an OMF API if this one doesn't exist yet with this credentials
 
-        :param slice: Xmpp Slice Name
-        :type slice: str
+        :param version: OMF Version. Either 5 or 6
+        :type version: str
         :param server: Xmpp Server Adress
         :type server: str
+        :param user: Xmpp User
+        :type user: str
         :param port: Xmpp Port (Default : 5222)
         :type port: str
         :param password: Xmpp Password
         :type password: str
+        :param exp_id: Id of the experiment
+        :type exp_id: str
 
         """
         key = cls._make_key(version, server, user, port, password, exp_id)
@@ -95,14 +103,18 @@ class OMFAPIFactory(object):
     def release_api(cls, version, server, user, port, password, exp_id = None):
         """ Release an OMF API with this credentials
 
-        :param slice: Xmpp Slice Name
-        :type slice: str
+        :param version: OMF Version. Either 5 or 6
+        :type version: str
         :param server: Xmpp Server Adress
         :type server: str
+        :param user: Xmpp User
+        :type user: str
         :param port: Xmpp Port (Default : 5222)
         :type port: str
         :param password: Xmpp Password
         :type password: str
+        :param exp_id: Id of the experiment
+        :type exp_id: str
 
         """
         if version and user and server and port and password:
@@ -120,7 +132,7 @@ class OMFAPIFactory(object):
         """ Hash the credentials in order to create a key
 
         :param args: list of arguments used to create the hash (server, user, port, ...)
-        :type args: list of args
+        :type args: list
 
         """
         skey = "".join(map(str, args))
index 87635e5..113bd1e 100644 (file)
@@ -334,6 +334,14 @@ class OMFClient(sleekxmpp.ClientXMPP, Logger):
             self.error(msg)
 
     def check_mailbox(self, itype, attr):
+        """ Check the mail box
+
+        :param itype: type of mail
+        :type itype: str
+        :param attr: value wanted
+        :type attr: str
+
+        """
         return self._parser.check_mailbox(itype, attr)
 
 
diff --git a/test/resources/omf/omf5_vlc_normal_case.py b/test/resources/omf/omf5_vlc_normal_case.py
new file mode 100755 (executable)
index 0000000..14a2ad0
--- /dev/null
@@ -0,0 +1,271 @@
+#!/usr/bin/env python
+#
+#    NEPI, a framework to manage network experiments
+#    Copyright (C) 2013 INRIA
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Julien Tribino <julien.tribino@inria.fr>
+
+
+from nepi.execution.resource import ResourceFactory, ResourceManager, ResourceAction, ResourceState
+from nepi.execution.ec import ExperimentController
+
+from nepi.resources.omf.node import OMFNode
+from nepi.resources.omf.application import OMFApplication
+from nepi.resources.omf.interface import OMFWifiInterface
+from nepi.resources.omf.channel import OMFChannel
+from nepi.resources.omf.omf_api_factory import OMFAPIFactory
+
+from nepi.util.timefuncs import *
+
+import time
+import unittest
+
+class OMFResourceFactoryTestCase(unittest.TestCase):
+    def test_creation_phase(self):
+
+        self.assertEquals(OMFNode.get_rtype(), "OMFNode")
+        self.assertEquals(len(OMFNode._attributes), 7)
+
+        self.assertEquals(OMFWifiInterface.get_rtype(), "OMFWifiInterface")
+        self.assertEquals(len(OMFWifiInterface._attributes), 11)
+
+        self.assertEquals(OMFChannel.get_rtype(), "OMFChannel")
+        self.assertEquals(len(OMFChannel._attributes), 7)
+
+        self.assertEquals(OMFApplication.get_rtype(), "OMFApplication")
+        self.assertEquals(len(OMFApplication._attributes), 13)
+
+class OMFEachTestCase(unittest.TestCase):
+    def setUp(self):
+        self.ec = ExperimentController(exp_id = "99999")
+
+        self.node1 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node1, 'hostname', 'omf.plexus.wlab17')
+        self.ec.set(self.node1, 'xmppUser', "nepi")
+        self.ec.set(self.node1, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node1, 'xmppPort', "5222")
+        self.ec.set(self.node1, 'xmppPassword', "1234")
+        self.ec.set(self.node1, 'version', "5")
+        
+        self.iface1 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface1, 'name', "wlan0")
+        self.ec.set(self.iface1, 'mode', "adhoc")
+        self.ec.set(self.iface1, 'hw_mode', "g")
+        self.ec.set(self.iface1, 'essid', "vlcexp")
+        self.ec.set(self.iface1, 'ip', "10.0.0.17/24")
+        self.ec.set(self.iface1, 'version', "5")
+        
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, 'channel', "6")
+        self.ec.set(self.channel, 'xmppUser', "nepi")
+        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.channel, 'xmppPort', "5222")
+        self.ec.set(self.channel, 'xmppPassword', "1234")
+        self.ec.set(self.channel, 'version', "5")
+        
+        self.app1 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app1, 'appid', 'Vlc#1')
+        self.ec.set(self.app1, 'command', "/opt/vlc-1.1.13/cvlc /opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
+        self.ec.set(self.app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+        self.ec.set(self.app1, 'version', "5")
+
+        self.app2 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app2, 'version', "5")
+
+        self.app3 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app3, 'version', "5")
+
+        self.app4 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app4, 'version', "5")
+
+        self.app5 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app5, 'version', "5")
+
+        self.ec.register_connection(self.app1, self.node1)
+        self.ec.register_connection(self.app2, self.node1)
+        self.ec.register_connection(self.app3, self.node1)
+        self.ec.register_connection(self.app4, self.node1)
+        self.ec.register_connection(self.app5, self.node1)
+        self.ec.register_connection(self.node1, self.iface1)
+        self.ec.register_connection(self.iface1, self.channel)
+
+        self.ec.register_condition(self.app2, ResourceAction.START, self.app1, ResourceState.STARTED , "3s")
+        self.ec.register_condition(self.app3, ResourceAction.START, self.app2, ResourceState.STARTED , "2s")
+        self.ec.register_condition(self.app4, ResourceAction.START, self.app3, ResourceState.STARTED , "3s")
+        self.ec.register_condition(self.app5, ResourceAction.START, [self.app3, self.app2], ResourceState.STARTED , "2s")
+        self.ec.register_condition(self.app5, ResourceAction.START, self.app1, ResourceState.STARTED , "25s")
+
+        self.ec.register_condition([self.app1, self.app2, self.app3,self.app4, self.app5], ResourceAction.STOP, self.app5, ResourceState.STARTED , "1s")
+
+    def tearDown(self):
+        self.ec.shutdown()
+
+    def test_creation_and_configuration_node(self):
+        self.assertEquals(self.ec.get(self.node1, 'hostname'), 'omf.plexus.wlab17')
+        self.assertEquals(self.ec.get(self.node1, 'xmppUser'), 'nepi')
+        self.assertEquals(self.ec.get(self.node1, 'xmppServer'), 'xmpp-plexus.onelab.eu')
+        self.assertEquals(self.ec.get(self.node1, 'xmppPort'), '5222')
+        self.assertEquals(self.ec.get(self.node1, 'xmppPassword'), '1234')
+        self.assertEquals(self.ec.get(self.node1, 'version'), '5')
+
+
+    def test_creation_and_configuration_interface(self):
+        self.assertEquals(self.ec.get(self.iface1, 'name'), 'wlan0')
+        self.assertEquals(self.ec.get(self.iface1, 'mode'), 'adhoc')
+        self.assertEquals(self.ec.get(self.iface1, 'hw_mode'), 'g')
+        self.assertEquals(self.ec.get(self.iface1, 'essid'), 'vlcexp')
+        self.assertEquals(self.ec.get(self.iface1, 'ip'), '10.0.0.17/24')
+        self.assertEquals(self.ec.get(self.iface1, 'version'), '5')
+
+    def test_creation_and_configuration_channel(self):
+        self.assertEquals(self.ec.get(self.channel, 'channel'), '6')
+        self.assertEquals(self.ec.get(self.channel, 'xmppUser'), 'nepi')
+        self.assertEquals(self.ec.get(self.channel, 'xmppServer'), 'xmpp-plexus.onelab.eu')
+        self.assertEquals(self.ec.get(self.channel, 'xmppPort'), '5222')
+        self.assertEquals(self.ec.get(self.channel, 'xmppPassword'), '1234')
+        self.assertEquals(self.ec.get(self.channel, 'version'), '5')
+
+
+    def test_creation_and_configuration_application(self):
+        self.assertEquals(self.ec.get(self.app1, 'appid'), 'Vlc#1')
+        self.assertEquals(self.ec.get(self.app1, 'command'), "/opt/vlc-1.1.13/cvlc /opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
+        self.assertEquals(self.ec.get(self.app1, 'env'), 'DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority')
+        self.assertEquals(self.ec.get(self.app1, 'version'), '5')
+
+    def test_connection(self):
+        self.assertEquals(len(self.ec.get_resource(self.node1).connections), 6)
+        self.assertEquals(len(self.ec.get_resource(self.iface1).connections), 2)
+        self.assertEquals(len(self.ec.get_resource(self.channel).connections), 1)
+        self.assertEquals(len(self.ec.get_resource(self.app1).connections), 1)
+        self.assertEquals(len(self.ec.get_resource(self.app2).connections), 1)
+
+    def test_condition(self):
+        self.assertEquals(len(self.ec.get_resource(self.app1).conditions[ResourceAction.STOP]), 1)
+        self.assertEquals(len(self.ec.get_resource(self.app2).conditions[ResourceAction.START]), 1)
+        self.assertEquals(len(self.ec.get_resource(self.app3).conditions[ResourceAction.START]), 1)
+        self.assertEquals(len(self.ec.get_resource(self.app4).conditions[ResourceAction.STOP]), 1)
+        self.assertEquals(len(self.ec.get_resource(self.app5).conditions[ResourceAction.START]), 2)
+
+class OMFVLCNormalCase(unittest.TestCase):
+    def test_deploy(self):
+        ec = ExperimentController(exp_id = "5421" )
+
+        self.node1 = ec.register_resource("OMFNode")
+        ec.set(self.node1, 'hostname', 'omf.plexus.wlab17')
+        ec.set(self.node1, 'xmppUser', "nepi")
+        ec.set(self.node1, 'xmppServer', "xmpp-plexus.onelab.eu")
+        ec.set(self.node1, 'xmppPort', "5222")
+        ec.set(self.node1, 'xmppPassword', "1234")
+        ec.set(self.node1, 'version', "5")
+        
+        self.iface1 = ec.register_resource("OMFWifiInterface")
+        ec.set(self.iface1, 'name', "wlan0")
+        ec.set(self.iface1, 'mode', "adhoc")
+        ec.set(self.iface1, 'hw_mode', "g")
+        ec.set(self.iface1, 'essid', "vlcexp")
+        ec.set(self.iface1, 'ip', "10.0.0.17/24")
+        ec.set(self.iface1, 'version', "5")
+        
+        self.channel = ec.register_resource("OMFChannel")
+        ec.set(self.channel, 'channel', "6")
+        ec.set(self.channel, 'xmppUser', "nepi")
+        ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
+        ec.set(self.channel, 'xmppPort', "5222")
+        ec.set(self.channel, 'xmppPassword', "1234")
+        ec.set(self.channel, 'version', "5")
+        
+        self.app1 = ec.register_resource("OMFApplication")
+        ec.set(self.app1, 'appid', 'Vlc#1')
+        ec.set(self.app1, 'command', "/opt/vlc-1.1.13/cvlc /opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
+        ec.set(self.app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+        ec.set(self.app1, 'version', "5")
+
+        self.app2 = ec.register_resource("OMFApplication")
+        ec.set(self.app2, 'appid', 'Test#1')
+        ec.set(self.app2, 'command', "/usr/bin/test -1")
+        ec.set(self.app2, 'env', " ")
+        ec.set(self.app2, 'version', "5")
+
+        self.app3 = ec.register_resource("OMFApplication")
+        ec.set(self.app3, 'appid', 'Test#2')
+        ec.set(self.app3, 'command', "/usr/bin/test -2")
+        ec.set(self.app3, 'env', " ")
+        ec.set(self.app3, 'version', "5")
+
+        self.app4 = ec.register_resource("OMFApplication")
+        ec.set(self.app4, 'appid', 'Test#3')
+        ec.set(self.app4, 'command', "/usr/bin/test -3")
+        ec.set(self.app4, 'env', " ")
+        ec.set(self.app4, 'version', "5")
+
+        self.app5 = ec.register_resource("OMFApplication")
+        ec.set(self.app5, 'appid', 'Kill#2')
+        ec.set(self.app5, 'command', "/usr/bin/killall vlc")
+        ec.set(self.app5, 'env', " ")
+        ec.set(self.app5, 'version', "5")
+
+        ec.register_connection(self.app1, self.node1)
+        ec.register_connection(self.app2, self.node1)
+        ec.register_connection(self.app3, self.node1)
+        ec.register_connection(self.app4, self.node1)
+        ec.register_connection(self.app5, self.node1)
+        ec.register_connection(self.node1, self.iface1)
+        ec.register_connection(self.iface1, self.channel)
+
+        ec.register_condition(self.app2, ResourceAction.START, self.app1, ResourceState.STARTED , "3s")
+        ec.register_condition(self.app3, ResourceAction.START, self.app2, ResourceState.STARTED , "2s")
+        ec.register_condition(self.app4, ResourceAction.START, self.app3, ResourceState.STARTED , "3s")
+        ec.register_condition(self.app5, ResourceAction.START, [self.app3, self.app2], ResourceState.STARTED , "2s")
+        ec.register_condition(self.app5, ResourceAction.START, self.app1, ResourceState.STARTED , "25s")
+
+        ec.register_condition([self.app1, self.app2, self.app3,self.app4, self.app5], ResourceAction.STOP, self.app5, ResourceState.STARTED , "1s")
+
+        ec.deploy()
+
+        ec.wait_finished([self.app1, self.app2, self.app3,self.app4, self.app5])
+
+        self.assertEquals(round(tdiffsec(ec.get_resource(self.app2).start_time, ec.get_resource(self.app1).start_time),0), 3.0)
+        self.assertEquals(round(tdiffsec(ec.get_resource(self.app3).start_time, ec.get_resource(self.app2).start_time),0), 2.0)
+        self.assertEquals(round(tdiffsec(ec.get_resource(self.app4).start_time, ec.get_resource(self.app3).start_time),0), 3.0)
+        self.assertEquals(round(tdiffsec(ec.get_resource(self.app5).start_time, ec.get_resource(self.app3).start_time),0), 20.0)
+        self.assertEquals(round(tdiffsec(ec.get_resource(self.app5).start_time, ec.get_resource(self.app1).start_time),0), 25.0)
+
+        self.assertEquals(ec.get_resource(self.node1).state, ResourceState.STARTED)
+        self.assertEquals(ec.get_resource(self.iface1).state, ResourceState.STARTED)
+        self.assertEquals(ec.get_resource(self.channel).state, ResourceState.STARTED)
+        self.assertEquals(ec.get_resource(self.app1).state, ResourceState.STOPPED)
+        self.assertEquals(ec.get_resource(self.app2).state, ResourceState.STOPPED)
+        self.assertEquals(ec.get_resource(self.app3).state, ResourceState.STOPPED)
+        self.assertEquals(ec.get_resource(self.app4).state, ResourceState.STOPPED)
+        self.assertEquals(ec.get_resource(self.app5).state, ResourceState.STOPPED)
+
+        ec.shutdown()
+
+        self.assertEquals(ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(ec.get_resource(self.app1).state, ResourceState.RELEASED)
+        self.assertEquals(ec.get_resource(self.app2).state, ResourceState.RELEASED)
+        self.assertEquals(ec.get_resource(self.app3).state, ResourceState.RELEASED)
+        self.assertEquals(ec.get_resource(self.app4).state, ResourceState.RELEASED)
+        self.assertEquals(ec.get_resource(self.app5).state, ResourceState.RELEASED)
+
+
+if __name__ == '__main__':
+    unittest.main()
+
+
+
diff --git a/test/resources/omf/omf5_vlc_wrong_critical.py b/test/resources/omf/omf5_vlc_wrong_critical.py
new file mode 100755 (executable)
index 0000000..96230b4
--- /dev/null
@@ -0,0 +1,392 @@
+#!/usr/bin/env python
+#
+#    NEPI, a framework to manage network experiments
+#    Copyright (C) 2013 INRIA
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Julien Tribino <julien.tribino@inria.fr>
+
+
+from nepi.execution.resource import ResourceFactory, ResourceManager, ResourceAction, ResourceState
+from nepi.execution.ec import ExperimentController
+
+from nepi.resources.omf.node import OMFNode
+from nepi.resources.omf.application import OMFApplication
+from nepi.resources.omf.interface import OMFWifiInterface
+from nepi.resources.omf.channel import OMFChannel
+from nepi.resources.omf.omf_api_factory import OMFAPIFactory
+
+from nepi.util.timefuncs import *
+
+import time
+import unittest
+
+class OMFVLCWrongCaseAllCritical(unittest.TestCase):
+
+    id = 1000
+
+    def setUp(self):
+        self.ec = ExperimentController(exp_id = str(OMFVLCWrongCaseAllCritical.id))
+        OMFVLCWrongCaseAllCritical.id += 1
+
+        self.node1 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node1, 'hostname', 'omf.plexus.wlab17')
+        self.ec.set(self.node1, 'xmppUser', "nepi")
+        self.ec.set(self.node1, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node1, 'xmppPort', "5222")
+        self.ec.set(self.node1, 'xmppPassword', "1234")
+        self.ec.set(self.node1, 'version', "5")
+        
+        self.iface1 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface1, 'name', "wlan0")
+        self.ec.set(self.iface1, 'mode', "adhoc")
+        self.ec.set(self.iface1, 'hw_mode', "g")
+        self.ec.set(self.iface1, 'essid', "vlcexp")
+        self.ec.set(self.iface1, 'ip', "10.0.0.17/24")
+        self.ec.set(self.iface1, 'version', "5")
+
+        self.app1 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app1, 'appid', 'Vlc#1')
+        self.ec.set(self.app1, 'command', "/opt/vlc-1.1.13/cvlc /opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
+        self.ec.set(self.app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+        self.ec.set(self.app1, 'version', "5")
+
+        self.ec.register_connection(self.app1, self.node1)
+        self.ec.register_connection(self.node1, self.iface1)
+
+    def test_deploy_wo_node(self):
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, 'version', "5")
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface2, 'name', "wlan0")
+        self.ec.set(self.iface2, 'mode', "adhoc")
+        self.ec.set(self.iface2, 'hw_mode', "g")
+        self.ec.set(self.iface2, 'essid', "vlcexp")
+        self.ec.set(self.iface2, 'ip', "10.0.0.37/24")
+        self.ec.set(self.iface2, 'version', "5")
+        
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, 'channel', "6")
+        self.ec.set(self.channel, 'xmppUser', "nepi")
+        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.channel, 'xmppPort', "5222")
+        self.ec.set(self.channel, 'xmppPassword', "1234")
+        self.ec.set(self.channel, 'version', "5")
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
+
+        self.ec.register_condition([self.app1], ResourceAction.STOP, self.app1, ResourceState.STARTED , "2s")
+
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1])
+
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.FAILED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+
+    def test_deploy_wo_hostname(self):
+
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppPort', "5222")
+        self.ec.set(self.node2, 'xmppPassword', "1234")
+        self.ec.set(self.node2, 'version', "5")
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface2, 'name', "wlan0")
+        self.ec.set(self.iface2, 'mode', "adhoc")
+        self.ec.set(self.iface2, 'hw_mode', "g")
+        self.ec.set(self.iface2, 'essid', "vlcexp")
+        self.ec.set(self.iface2, 'ip', "10.0.0.37/24")
+        self.ec.set(self.iface2, 'version', "5")
+        
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, 'channel', "6")
+        self.ec.set(self.channel, 'xmppUser', "nepi")
+        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.channel, 'xmppPort', "5222")
+        self.ec.set(self.channel, 'xmppPassword', "1234")
+        self.ec.set(self.channel, 'version', "5")
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
+
+        self.ec.register_condition([self.app1], ResourceAction.STOP, self.app1, ResourceState.STARTED , "2s")
+
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1])
+
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.FAILED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+
+    def test_deploy_wo_iface(self):
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, 'hostname', 'omf.plexus.wlab17')
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppPort', "5222")
+        self.ec.set(self.node2, 'xmppPassword', "1234")
+        self.ec.set(self.node2, 'version', "5")
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface2, 'version', "5")
+        
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, 'channel', "6")
+        self.ec.set(self.channel, 'xmppUser', "nepi")
+        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.channel, 'xmppPort', "5222")
+        self.ec.set(self.channel, 'xmppPassword', "1234")
+        self.ec.set(self.channel, 'version', "5")
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
+
+        self.ec.register_condition([self.app1], ResourceAction.STOP, self.app1, ResourceState.STARTED , "2s")
+
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1])
+
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.FAILED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+
+    def test_deploy_wo_ip(self):
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, 'hostname', 'omf.plexus.wlab17')
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppPort', "5222")
+        self.ec.set(self.node2, 'xmppPassword', "1234")
+        self.ec.set(self.node2, 'version', "5")
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface2, 'name', "wlan0")
+        self.ec.set(self.iface2, 'mode', "adhoc")
+        self.ec.set(self.iface2, 'hw_mode', "g")
+        self.ec.set(self.iface2, 'essid', "vlcexp")
+        self.ec.set(self.iface2, 'version', "5")
+
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, 'channel', "6")
+        self.ec.set(self.channel, 'xmppUser', "nepi")
+        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.channel, 'xmppPort', "5222")
+        self.ec.set(self.channel, 'xmppPassword', "1234")
+        self.ec.set(self.channel, 'version', "5")
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
+
+        self.ec.register_condition([self.app1], ResourceAction.STOP, self.app1, ResourceState.STARTED , "2s")
+
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1])
+
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.FAILED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+
+    def test_deploy_wo_channel(self):
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, 'hostname', 'omf.plexus.wlab17')
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppPort', "5222")
+        self.ec.set(self.node2, 'xmppPassword', "1234")
+        self.ec.set(self.node2, 'version', "5")
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface2, 'name', "wlan0")
+        self.ec.set(self.iface2, 'mode', "adhoc")
+        self.ec.set(self.iface2, 'hw_mode', "g")
+        self.ec.set(self.iface2, 'essid', "vlcexp")
+        self.ec.set(self.iface2, 'version', "5")
+
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, 'version', "5")
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
+
+        self.ec.register_condition([self.app1], ResourceAction.STOP, self.app1, ResourceState.STARTED , "2s")
+
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1])
+
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.FAILED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+
+    def test_deploy_wo_app(self):
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, 'hostname', 'omf.plexus.wlab17')
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppPort', "5222")
+        self.ec.set(self.node2, 'xmppPassword', "1234")
+        self.ec.set(self.node2, 'version', "5")
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface2, 'name', "wlan0")
+        self.ec.set(self.iface2, 'mode', "adhoc")
+        self.ec.set(self.iface2, 'hw_mode', "g")
+        self.ec.set(self.iface2, 'essid', "vlcexp")   
+        self.ec.set(self.iface2, 'ip', "10.0.0.37/24")
+        self.ec.set(self.iface2, 'version', "5")
+
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, 'channel', "6")
+        self.ec.set(self.channel, 'xmppUser', "nepi")
+        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.channel, 'xmppPort', "5222")
+        self.ec.set(self.channel, 'xmppPassword', "1234")
+        self.ec.set(self.channel, 'version', "5")
+
+        self.app2 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app2, 'version', "5")
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.iface2, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.app2, self.node2)
+
+        self.ec.register_condition(self.app2, ResourceAction.START, self.app1, ResourceState.STARTED , "2s")
+        self.ec.register_condition([self.app1, self.app2], ResourceAction.STOP, self.app1, ResourceState.STARTED , "4s")
+
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1, self.app2])
+
+        self.assertEquals(self.ec.get_resource(self.app2).state, ResourceState.FAILED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app2).state, ResourceState.RELEASED)
+
+    def test_deploy_wo_app_path(self):
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, 'hostname', 'omf.plexus.wlab17')
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppPort', "5222")
+        self.ec.set(self.node2, 'xmppPassword', "1234")
+        self.ec.set(self.node2, 'version', "5")
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface2, 'name', "wlan0")
+        self.ec.set(self.iface2, 'mode', "adhoc")
+        self.ec.set(self.iface2, 'hw_mode', "g")
+        self.ec.set(self.iface2, 'essid', "vlcexp")   
+        self.ec.set(self.iface2, 'ip', "10.0.0.37/24")
+        self.ec.set(self.iface2, 'version', "5")
+
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, 'channel', "6")
+        self.ec.set(self.channel, 'xmppUser', "nepi")
+        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.channel, 'xmppPort', "5222")
+        self.ec.set(self.channel, 'xmppPassword', "1234")
+        self.ec.set(self.channel, 'version', "5")
+
+        self.app2 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app2, 'appid', 'Vlc#2')
+        self.ec.set(self.app2, 'version', "5")
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.iface2, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.app2, self.node2)
+
+        self.ec.register_condition(self.app2, ResourceAction.START, self.app1, ResourceState.STARTED , "2s")
+        self.ec.register_condition([self.app1, self.app2], ResourceAction.STOP, self.app1, ResourceState.STARTED , "4s")
+
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1, self.app2])
+
+        self.assertEquals(self.ec.get_resource(self.app2).state, ResourceState.FAILED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app2).state, ResourceState.RELEASED)
+
+
+if __name__ == '__main__':
+    unittest.main()
+
+
+
similarity index 81%
rename from test/resources/omf/vlc_wrong_non_critical.py
rename to test/resources/omf/omf5_vlc_wrong_non_critical.py
index 4293264..d693685 100755 (executable)
@@ -26,7 +26,7 @@ from nepi.resources.omf.node import OMFNode
 from nepi.resources.omf.application import OMFApplication
 from nepi.resources.omf.interface import OMFWifiInterface
 from nepi.resources.omf.channel import OMFChannel
-from nepi.resources.omf.omf_api import OMFAPIFactory
+from nepi.resources.omf.omf_api_factory import OMFAPIFactory
 
 from nepi.util.timefuncs import *
 
@@ -43,23 +43,25 @@ class OMFVLCWrongCaseWithNonCritical(unittest.TestCase):
 
         self.node1 = self.ec.register_resource("OMFNode")
         self.ec.set(self.node1, 'hostname', 'omf.plexus.wlab17')
-        self.ec.set(self.node1, 'xmppSlice', "nepi")
-        self.ec.set(self.node1, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node1, 'xmppUser', "nepi")
+        self.ec.set(self.node1, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.node1, 'xmppPort', "5222")
         self.ec.set(self.node1, 'xmppPassword', "1234")
+        self.ec.set(self.node1, 'version', "5")
         
         self.iface1 = self.ec.register_resource("OMFWifiInterface")
-        self.ec.set(self.iface1, 'alias', "w0")
+        self.ec.set(self.iface1, 'name', "wlan0")
         self.ec.set(self.iface1, 'mode', "adhoc")
-        self.ec.set(self.iface1, 'type', "g")
+        self.ec.set(self.iface1, 'hw_mode', "g")
         self.ec.set(self.iface1, 'essid', "vlcexp")
-        self.ec.set(self.iface1, 'ip', "10.0.0.17")
+        self.ec.set(self.iface1, 'ip', "10.0.0.17/24")
+        self.ec.set(self.iface1, 'version', "5")
 
         self.app1 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app1, 'appid', 'Kill#1')
-        self.ec.set(self.app1, 'path', "/usr/bin/test")
-        self.ec.set(self.app1, 'args', "-1")
+        self.ec.set(self.app1, 'command', "/usr/bin/test -1")
         self.ec.set(self.app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+        self.ec.set(self.app1, 'version', "5")
 
         self.ec.register_connection(self.app1, self.node1)
         self.ec.register_connection(self.node1, self.iface1)
@@ -67,20 +69,23 @@ class OMFVLCWrongCaseWithNonCritical(unittest.TestCase):
     def test_deploy_with_node_nc(self):
         self.node2 = self.ec.register_resource("OMFNode")
         self.ec.set(self.node2, "critical", False)
+        self.ec.set(self.node2, 'version', "5")
 
         self.iface2 = self.ec.register_resource("OMFWifiInterface")
-        self.ec.set(self.iface2, 'alias', "w0")
+        self.ec.set(self.iface2, 'name', "wlan0")
         self.ec.set(self.iface2, 'mode', "adhoc")
-        self.ec.set(self.iface2, 'type', "g")
+        self.ec.set(self.iface2, 'hw_mode', "g")
         self.ec.set(self.iface2, 'essid', "vlcexp")
-        self.ec.set(self.iface2, 'ip', "10.0.0.37")
+        self.ec.set(self.iface2, 'ip', "10.0.0.37/24")
+        self.ec.set(self.iface2, 'version', "5")
         
         self.channel = self.ec.register_resource("OMFChannel")
         self.ec.set(self.channel, 'channel', "6")
-        self.ec.set(self.channel, 'xmppSlice', "nepi")
-        self.ec.set(self.channel, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.channel, 'xmppUser', "nepi")
+        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.channel, 'xmppPort', "5222")
         self.ec.set(self.channel, 'xmppPassword', "1234")
+        self.ec.set(self.channel, 'version', "5")
 
         self.ec.register_connection(self.iface1, self.channel)
         self.ec.register_connection(self.node2, self.iface2)
@@ -107,21 +112,24 @@ class OMFVLCWrongCaseWithNonCritical(unittest.TestCase):
     def test_deploy_with_node_and_iface_nc(self):
         self.node2 = self.ec.register_resource("OMFNode")
         self.ec.set(self.node2, "critical", False)
+        self.ec.set(self.node2, 'version', "5")
 
         self.iface2 = self.ec.register_resource("OMFWifiInterface")
         self.ec.set(self.node2, "critical", False)
-        self.ec.set(self.iface2, 'alias', "w0")
+        self.ec.set(self.iface2, 'name', "wlan0")
         self.ec.set(self.iface2, 'mode', "adhoc")
-        self.ec.set(self.iface2, 'type', "g")
+        self.ec.set(self.iface2, 'hw_mode', "g")
         self.ec.set(self.iface2, 'essid', "vlcexp")
-        self.ec.set(self.iface2, 'ip', "10.0.0.37")
+        self.ec.set(self.iface2, 'ip', "10.0.0.37/24")
+        self.ec.set(self.iface2, 'version', "5")
         
         self.channel = self.ec.register_resource("OMFChannel")
         self.ec.set(self.channel, 'channel', "6")
-        self.ec.set(self.channel, 'xmppSlice', "nepi")
-        self.ec.set(self.channel, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.channel, 'xmppUser', "nepi")
+        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.channel, 'xmppPort', "5222")
         self.ec.set(self.channel, 'xmppPassword', "1234")
+        self.ec.set(self.channel, 'version', "5")
 
         self.ec.register_connection(self.iface1, self.channel)
         self.ec.register_connection(self.node2, self.iface2)
@@ -149,18 +157,21 @@ class OMFVLCWrongCaseWithNonCritical(unittest.TestCase):
         self.node2 = self.ec.register_resource("OMFNode")
         self.ec.set(self.node2, "critical", False)
         self.ec.set(self.node2, 'hostname', 'omf.plexus.wlab37')
+        self.ec.set(self.node2, 'version', "5")
 
         self.iface2 = self.ec.register_resource("OMFWifiInterface")
         self.ec.set(self.node2, "critical", False)
-        self.ec.set(self.iface2, 'alias', "w0")
+        self.ec.set(self.iface2, 'name', "wlan0")
         self.ec.set(self.iface2, 'mode', "adhoc")
-        self.ec.set(self.iface2, 'type', "g")
+        self.ec.set(self.iface2, 'hw_mode', "g")
         self.ec.set(self.iface2, 'essid', "vlcexp")
-        self.ec.set(self.iface2, 'ip', "10.0.0.37")
+        self.ec.set(self.iface2, 'ip', "10.0.0.37/24")
+        self.ec.set(self.iface2, 'version', "5")
         
         self.channel = self.ec.register_resource("OMFChannel")
         self.ec.set(self.channel, 'channel', "6")
         self.ec.set(self.channel, "critical", False)
+        self.ec.set(self.channel, 'version', "5")
 
         self.ec.register_connection(self.iface1, self.channel)
         self.ec.register_connection(self.node2, self.iface2)
@@ -188,28 +199,32 @@ class OMFVLCWrongCaseWithNonCritical(unittest.TestCase):
     def test_deploy_with_app_nc(self):
         self.node2 = self.ec.register_resource("OMFNode")
         self.ec.set(self.node2, 'hostname', 'omf.plexus.wlab37')
-        self.ec.set(self.node2, 'xmppSlice', "nepi")
-        self.ec.set(self.node2, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.node2, 'xmppPort', "5222")
         self.ec.set(self.node2, 'xmppPassword', "1234")
+        self.ec.set(self.node2, 'version', "5")
 
         self.iface2 = self.ec.register_resource("OMFWifiInterface")
-        self.ec.set(self.iface2, 'alias', "w0")
+        self.ec.set(self.iface2, 'name', "wlan0")
         self.ec.set(self.iface2, 'mode', "adhoc")
-        self.ec.set(self.iface2, 'type', "g")
+        self.ec.set(self.iface2, 'hw_mode', "g")
         self.ec.set(self.iface2, 'essid', "vlcexp")
-        self.ec.set(self.iface2, 'ip', "10.0.0.37")
+        self.ec.set(self.iface2, 'ip', "10.0.0.37/24")
+        self.ec.set(self.iface2, 'version', "5")
         
         self.channel = self.ec.register_resource("OMFChannel")
         self.ec.set(self.channel, 'channel', "6")
-        self.ec.set(self.channel, 'xmppSlice', "nepi")
-        self.ec.set(self.channel, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.channel, 'xmppUser', "nepi")
+        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.channel, 'xmppPort', "5222")
         self.ec.set(self.channel, 'xmppPassword', "1234")
+        self.ec.set(self.channel, 'version', "5")
 
         self.app2 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app2, "critical", False)
         self.ec.set(self.app2, 'appid', 'Kill#22')
+        self.ec.set(self.app2, 'version', "5")
 
         self.ec.register_connection(self.iface1, self.channel)
         self.ec.register_connection(self.node2, self.iface2)
@@ -240,16 +255,20 @@ class OMFVLCWrongCaseWithNonCritical(unittest.TestCase):
         self.node2 = self.ec.register_resource("OMFNode")
         self.ec.set(self.node2, "critical", False)
         self.ec.set(self.node2, 'hostname', 'omf.plexus.wlab37')
+        self.ec.set(self.node2, 'version', "5")
 
         self.iface2 = self.ec.register_resource("OMFWifiInterface")
         self.ec.set(self.iface2, "critical", False)
+        self.ec.set(self.iface2, 'version', "5")
         
         self.channel = self.ec.register_resource("OMFChannel")
         self.ec.set(self.channel, "critical", False)
         self.ec.set(self.channel, 'channel', "6")
+        self.ec.set(self.channel, 'version', "5")
 
         self.app2 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app2, 'appid', 'Kill#22')
+        self.ec.set(self.app2, 'version', "5")
 
         self.ec.register_connection(self.iface1, self.channel)
         self.ec.register_connection(self.node2, self.iface2)
@@ -286,23 +305,25 @@ class OMFVLCWrongCaseWithNonCriticalDep(unittest.TestCase):
 
         self.node1 = self.ec.register_resource("OMFNode")
         self.ec.set(self.node1, 'hostname', 'omf.plexus.wlab17')
-        self.ec.set(self.node1, 'xmppSlice', "nepi")
-        self.ec.set(self.node1, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node1, 'xmppUser', "nepi")
+        self.ec.set(self.node1, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.node1, 'xmppPort', "5222")
         self.ec.set(self.node1, 'xmppPassword', "1234")
+        self.ec.set(self.node1, 'version', "5")
         
         self.iface1 = self.ec.register_resource("OMFWifiInterface")
-        self.ec.set(self.iface1, 'alias', "w0")
+        self.ec.set(self.iface1, 'name', "wlan0")
         self.ec.set(self.iface1, 'mode', "adhoc")
-        self.ec.set(self.iface1, 'type', "g")
+        self.ec.set(self.iface1, 'hw_mode', "g")
         self.ec.set(self.iface1, 'essid', "vlcexp")
-        self.ec.set(self.iface1, 'ip', "10.0.0.17")
+        self.ec.set(self.iface1, 'ip', "10.0.0.17/24")
+        self.ec.set(self.iface1, 'version', "5")
 
         self.app1 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app1, 'appid', 'Kill#1')
-        self.ec.set(self.app1, 'path', "/usr/bin/test")
-        self.ec.set(self.app1, 'args', "-1")
+        self.ec.set(self.app1, 'command', "/usr/bin/test -1")
         self.ec.set(self.app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+        self.ec.set(self.app1, 'version', "5")
 
         self.ec.register_connection(self.app1, self.node1)
         self.ec.register_connection(self.node1, self.iface1)
@@ -310,31 +331,36 @@ class OMFVLCWrongCaseWithNonCriticalDep(unittest.TestCase):
     def test_deploy_with_app_nc_and_critical_wrong(self):
         self.node2 = self.ec.register_resource("OMFNode")
         self.ec.set(self.node2, 'hostname', 'omf.plexus.wlab37')
-        self.ec.set(self.node2, 'xmppSlice', "nepi")
-        self.ec.set(self.node2, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.node2, 'xmppPort', "5222")
         self.ec.set(self.node2, 'xmppPassword', "1234")
+        self.ec.set(self.node2, 'version', "5")
 
         self.iface2 = self.ec.register_resource("OMFWifiInterface")
-        self.ec.set(self.iface2, 'alias', "w0")
+        self.ec.set(self.iface2, 'name', "wlan0")
         self.ec.set(self.iface2, 'mode', "adhoc")
-        self.ec.set(self.iface2, 'type', "g")
+        self.ec.set(self.iface2, 'hw_mode', "g")
         self.ec.set(self.iface2, 'essid', "vlcexp")
-        self.ec.set(self.iface2, 'ip', "10.0.0.37")
+        self.ec.set(self.iface2, 'ip', "10.0.0.37/24")
+        self.ec.set(self.iface2, 'version', "5")
         
         self.channel = self.ec.register_resource("OMFChannel")
         self.ec.set(self.channel, 'channel', "6")
-        self.ec.set(self.channel, 'xmppSlice', "nepi")
-        self.ec.set(self.channel, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.channel, 'xmppUser', "nepi")
+        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.channel, 'xmppPort', "5222")
         self.ec.set(self.channel, 'xmppPassword', "1234")
+        self.ec.set(self.channel, 'version', "5")
 
         self.app2 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app2, "critical", False)
         self.ec.set(self.app2, 'appid', 'Kill#32')
+        self.ec.set(self.app2, 'version', "5")
 
         self.app3 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app3, 'appid', 'Kill#33')
+        self.ec.set(self.app3, 'version', "5")
 
         self.ec.register_connection(self.iface1, self.channel)
         self.ec.register_connection(self.node2, self.iface2)
@@ -367,34 +393,38 @@ class OMFVLCWrongCaseWithNonCriticalDep(unittest.TestCase):
     def test_deploy_with_app_nc_and_critical_right(self):
         self.node2 = self.ec.register_resource("OMFNode")
         self.ec.set(self.node2, 'hostname', 'omf.plexus.wlab37')
-        self.ec.set(self.node2, 'xmppSlice', "nepi")
-        self.ec.set(self.node2, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.node2, 'xmppPort', "5222")
         self.ec.set(self.node2, 'xmppPassword', "1234")
+        self.ec.set(self.node2, 'version', "5")
 
         self.iface2 = self.ec.register_resource("OMFWifiInterface")
-        self.ec.set(self.iface2, 'alias', "w0")
+        self.ec.set(self.iface2, 'name', "wlan0")
         self.ec.set(self.iface2, 'mode', "adhoc")
-        self.ec.set(self.iface2, 'type', "g")
+        self.ec.set(self.iface2, 'hw_mode', "g")
         self.ec.set(self.iface2, 'essid', "vlcexp")
-        self.ec.set(self.iface2, 'ip', "10.0.0.37")
+        self.ec.set(self.iface2, 'ip', "10.0.0.37/24")
+        self.ec.set(self.iface2, 'version', "5")
         
         self.channel = self.ec.register_resource("OMFChannel")
         self.ec.set(self.channel, 'channel', "6")
-        self.ec.set(self.channel, 'xmppSlice', "nepi")
-        self.ec.set(self.channel, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.channel, 'xmppUser', "nepi")
+        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.channel, 'xmppPort', "5222")
         self.ec.set(self.channel, 'xmppPassword', "1234")
+        self.ec.set(self.channel, 'version', "5")
 
         self.app2 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app2, "critical", False)
         self.ec.set(self.app2, 'appid', 'Kill#32')
+        self.ec.set(self.app2, 'version', "5")
 
         self.app3 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app3, 'appid', 'Kill#3')
-        self.ec.set(self.app3, 'path', "/usr/bin/test")
-        self.ec.set(self.app3, 'args', "-1")
+        self.ec.set(self.app3, 'command', "/usr/bin/test -1")
         self.ec.set(self.app3, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+        self.ec.set(self.app3, 'version', "5")
 
         self.ec.register_connection(self.iface1, self.channel)
         self.ec.register_connection(self.node2, self.iface2)
@@ -429,51 +459,56 @@ class OMFVLCWrongCaseWithNonCriticalDep(unittest.TestCase):
     def test_deploy_with_many_app_nc_and_critical(self):
         self.node2 = self.ec.register_resource("OMFNode")
         self.ec.set(self.node2, 'hostname', 'omf.plexus.wlab37')
-        self.ec.set(self.node2, 'xmppSlice', "nepi")
-        self.ec.set(self.node2, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.node2, 'xmppPort', "5222")
         self.ec.set(self.node2, 'xmppPassword', "1234")
+        self.ec.set(self.node2, 'version', "5")
 
         self.iface2 = self.ec.register_resource("OMFWifiInterface")
-        self.ec.set(self.iface2, 'alias', "w0")
+        self.ec.set(self.iface2, 'name', "wlan0")
         self.ec.set(self.iface2, 'mode', "adhoc")
-        self.ec.set(self.iface2, 'type', "g")
+        self.ec.set(self.iface2, 'hw_mode', "g")
         self.ec.set(self.iface2, 'essid', "vlcexp")
-        self.ec.set(self.iface2, 'ip', "10.0.0.37")
+        self.ec.set(self.iface2, 'ip', "10.0.0.37/24")
+        self.ec.set(self.iface2, 'version', "5")
         
         self.channel = self.ec.register_resource("OMFChannel")
         self.ec.set(self.channel, 'channel', "6")
-        self.ec.set(self.channel, 'xmppSlice', "nepi")
-        self.ec.set(self.channel, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.channel, 'xmppUser', "nepi")
+        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.channel, 'xmppPort', "5222")
         self.ec.set(self.channel, 'xmppPassword', "1234")
+        self.ec.set(self.channel, 'version', "5")
 
         self.app2 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app2, "critical", False)
         self.ec.set(self.app2, 'appid', 'Kill#32')
+        self.ec.set(self.app2, 'version', "5")
 
         self.app3 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app3, "critical", False)
         self.ec.set(self.app3, 'appid', 'Kill#3')
-        self.ec.set(self.app3, 'path', "/usr/bin/test")
-        self.ec.set(self.app3, 'args', "-1")
+        self.ec.set(self.app3, 'command', "/usr/bin/test -1")
         self.ec.set(self.app3, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+        self.ec.set(self.app3, 'version', "5")
 
         self.app4 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app4, 'appid', 'Kill#4')
-        self.ec.set(self.app4, 'path', "/usr/bin/test")
-        self.ec.set(self.app4, 'args', "-1")
+        self.ec.set(self.app4, 'command', "/usr/bin/test -1")
         self.ec.set(self.app4, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+        self.ec.set(self.app4, 'version', "5")
 
         self.app5 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app5, "critical", False)
         self.ec.set(self.app5, 'appid', 'Kill#32')
+        self.ec.set(self.app5, 'version', "5")
 
         self.app6 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app6, 'appid', 'Kill#6')
-        self.ec.set(self.app6, 'path', "/usr/bin/test")
-        self.ec.set(self.app6, 'args', "-1")
+        self.ec.set(self.app6, 'command', "/usr/bin/test -1")
         self.ec.set(self.app6, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+        self.ec.set(self.app6, 'version', "5")
 
         self.ec.register_connection(self.iface1, self.channel)
         self.ec.register_connection(self.node2, self.iface2)
similarity index 81%
rename from test/resources/omf/vlc_normal_case.py
rename to test/resources/omf/omf6_vlc_normal_case.py
index 184a79d..4f7b64a 100755 (executable)
@@ -26,7 +26,7 @@ from nepi.resources.omf.node import OMFNode
 from nepi.resources.omf.application import OMFApplication
 from nepi.resources.omf.interface import OMFWifiInterface
 from nepi.resources.omf.channel import OMFChannel
-from nepi.resources.omf.omf_api import OMFAPIFactory
+from nepi.resources.omf.omf_api_factory import OMFAPIFactory
 
 from nepi.util.timefuncs import *
 
@@ -37,13 +37,13 @@ class OMFResourceFactoryTestCase(unittest.TestCase):
     def test_creation_phase(self):
 
         self.assertEquals(OMFNode.get_rtype(), "OMFNode")
-        self.assertEquals(len(OMFNode._attributes), 6)
+        self.assertEquals(len(OMFNode._attributes), 7)
 
         self.assertEquals(OMFWifiInterface.get_rtype(), "OMFWifiInterface")
-        self.assertEquals(len(OMFWifiInterface._attributes), 10)
+        self.assertEquals(len(OMFWifiInterface._attributes), 11)
 
         self.assertEquals(OMFChannel.get_rtype(), "OMFChannel")
-        self.assertEquals(len(OMFChannel._attributes), 6)
+        self.assertEquals(len(OMFChannel._attributes), 7)
 
         self.assertEquals(OMFApplication.get_rtype(), "OMFApplication")
         self.assertEquals(len(OMFApplication._attributes), 13)
@@ -53,36 +53,37 @@ class OMFEachTestCase(unittest.TestCase):
         self.ec = ExperimentController(exp_id = "99999")
 
         self.node1 = self.ec.register_resource("OMFNode")
-        self.ec.set(self.node1, 'hostname', 'omf.plexus.wlab17')
-        self.ec.set(self.node1, 'xmppSlice', "nepi")
-        self.ec.set(self.node1, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node1, 'hostname', 'wlab12')
+        self.ec.set(self.node1, 'xmppUser', "nepi")
+        self.ec.set(self.node1, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.node1, 'xmppPort', "5222")
         self.ec.set(self.node1, 'xmppPassword', "1234")
         
         self.iface1 = self.ec.register_resource("OMFWifiInterface")
-        self.ec.set(self.iface1, 'alias', "w0")
+        self.ec.set(self.iface1, 'name', "wlan0")
         self.ec.set(self.iface1, 'mode', "adhoc")
-        self.ec.set(self.iface1, 'type', "g")
+        self.ec.set(self.iface1, 'hw_mode', "g")
         self.ec.set(self.iface1, 'essid', "vlcexp")
-        self.ec.set(self.iface1, 'ip', "10.0.0.17")
+        self.ec.set(self.iface1, 'ip', "10.0.0.17/24")
         
         self.channel = self.ec.register_resource("OMFChannel")
         self.ec.set(self.channel, 'channel', "6")
-        self.ec.set(self.channel, 'xmppSlice', "nepi")
-        self.ec.set(self.channel, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.channel, 'xmppUser', "nepi")
+        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.channel, 'xmppPort', "5222")
         self.ec.set(self.channel, 'xmppPassword', "1234")
         
         self.app1 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app1, 'appid', 'Vlc#1')
-        self.ec.set(self.app1, 'path', "/opt/vlc-1.1.13/cvlc")
-        self.ec.set(self.app1, 'args', "/opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
+        self.ec.set(self.app1, 'command', "/opt/vlc-1.1.13/cvlc /opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
         self.ec.set(self.app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
 
         self.app2 = self.ec.register_resource("OMFApplication")
 
         self.app3 = self.ec.register_resource("OMFApplication")
+
         self.app4 = self.ec.register_resource("OMFApplication")
+
         self.app5 = self.ec.register_resource("OMFApplication")
 
         self.ec.register_connection(self.app1, self.node1)
@@ -105,31 +106,36 @@ class OMFEachTestCase(unittest.TestCase):
         self.ec.shutdown()
 
     def test_creation_and_configuration_node(self):
-        self.assertEquals(self.ec.get(self.node1, 'hostname'), 'omf.plexus.wlab17')
-        self.assertEquals(self.ec.get(self.node1, 'xmppSlice'), 'nepi')
-        self.assertEquals(self.ec.get(self.node1, 'xmppHost'), 'xmpp-plexus.onelab.eu')
+        self.assertEquals(self.ec.get(self.node1, 'hostname'), 'wlab12')
+        self.assertEquals(self.ec.get(self.node1, 'xmppUser'), 'nepi')
+        self.assertEquals(self.ec.get(self.node1, 'xmppServer'), 'xmpp-plexus.onelab.eu')
         self.assertEquals(self.ec.get(self.node1, 'xmppPort'), '5222')
         self.assertEquals(self.ec.get(self.node1, 'xmppPassword'), '1234')
+        self.assertEquals(self.ec.get(self.node1, 'version'), '6')
+
 
     def test_creation_and_configuration_interface(self):
-        self.assertEquals(self.ec.get(self.iface1, 'alias'), 'w0')
+        self.assertEquals(self.ec.get(self.iface1, 'name'), 'wlan0')
         self.assertEquals(self.ec.get(self.iface1, 'mode'), 'adhoc')
-        self.assertEquals(self.ec.get(self.iface1, 'type'), 'g')
+        self.assertEquals(self.ec.get(self.iface1, 'hw_mode'), 'g')
         self.assertEquals(self.ec.get(self.iface1, 'essid'), 'vlcexp')
-        self.assertEquals(self.ec.get(self.iface1, 'ip'), '10.0.0.17')
+        self.assertEquals(self.ec.get(self.iface1, 'ip'), '10.0.0.17/24')
+        self.assertEquals(self.ec.get(self.iface1, 'version'), '6')
 
     def test_creation_and_configuration_channel(self):
         self.assertEquals(self.ec.get(self.channel, 'channel'), '6')
-        self.assertEquals(self.ec.get(self.channel, 'xmppSlice'), 'nepi')
-        self.assertEquals(self.ec.get(self.channel, 'xmppHost'), 'xmpp-plexus.onelab.eu')
+        self.assertEquals(self.ec.get(self.channel, 'xmppUser'), 'nepi')
+        self.assertEquals(self.ec.get(self.channel, 'xmppServer'), 'xmpp-plexus.onelab.eu')
         self.assertEquals(self.ec.get(self.channel, 'xmppPort'), '5222')
         self.assertEquals(self.ec.get(self.channel, 'xmppPassword'), '1234')
+        self.assertEquals(self.ec.get(self.channel, 'version'), '6')
+
 
     def test_creation_and_configuration_application(self):
         self.assertEquals(self.ec.get(self.app1, 'appid'), 'Vlc#1')
-        self.assertEquals(self.ec.get(self.app1, 'path'), '/opt/vlc-1.1.13/cvlc')
-        self.assertEquals(self.ec.get(self.app1, 'args'), "/opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
+        self.assertEquals(self.ec.get(self.app1, 'command'), "/opt/vlc-1.1.13/cvlc /opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
         self.assertEquals(self.ec.get(self.app1, 'env'), 'DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority')
+        self.assertEquals(self.ec.get(self.app1, 'version'), '6')
 
     def test_connection(self):
         self.assertEquals(len(self.ec.get_resource(self.node1).connections), 6)
@@ -150,54 +156,49 @@ class OMFVLCNormalCase(unittest.TestCase):
         ec = ExperimentController(exp_id = "5421" )
 
         self.node1 = ec.register_resource("OMFNode")
-        ec.set(self.node1, 'hostname', 'omf.plexus.wlab17')
-        ec.set(self.node1, 'xmppSlice', "nepi")
-        ec.set(self.node1, 'xmppHost', "xmpp-plexus.onelab.eu")
+        ec.set(self.node1, 'hostname', 'wlab12')
+        ec.set(self.node1, 'xmppUser', "nepi")
+        ec.set(self.node1, 'xmppServer', "xmpp-plexus.onelab.eu")
         ec.set(self.node1, 'xmppPort', "5222")
         ec.set(self.node1, 'xmppPassword', "1234")
         
         self.iface1 = ec.register_resource("OMFWifiInterface")
-        ec.set(self.iface1, 'alias', "w0")
+        ec.set(self.iface1, 'name', "wlan0")
         ec.set(self.iface1, 'mode', "adhoc")
-        ec.set(self.iface1, 'type', "g")
+        ec.set(self.iface1, 'hw_mode', "g")
         ec.set(self.iface1, 'essid', "vlcexp")
-        ec.set(self.iface1, 'ip', "10.0.0.17")
+        ec.set(self.iface1, 'ip', "10.0.0.17/24")
         
         self.channel = ec.register_resource("OMFChannel")
         ec.set(self.channel, 'channel', "6")
-        ec.set(self.channel, 'xmppSlice', "nepi")
-        ec.set(self.channel, 'xmppHost', "xmpp-plexus.onelab.eu")
+        ec.set(self.channel, 'xmppUser', "nepi")
+        ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
         ec.set(self.channel, 'xmppPort', "5222")
         ec.set(self.channel, 'xmppPassword', "1234")
         
         self.app1 = ec.register_resource("OMFApplication")
         ec.set(self.app1, 'appid', 'Vlc#1')
-        ec.set(self.app1, 'path', "/opt/vlc-1.1.13/cvlc")
-        ec.set(self.app1, 'args', "/opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
+        ec.set(self.app1, 'command', "/opt/vlc-1.1.13/cvlc /opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
         ec.set(self.app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
 
         self.app2 = ec.register_resource("OMFApplication")
         ec.set(self.app2, 'appid', 'Test#1')
-        ec.set(self.app2, 'path', "/usr/bin/test")
-        ec.set(self.app2, 'args', "-1")
+        ec.set(self.app2, 'command', "/usr/bin/test -1")
         ec.set(self.app2, 'env', " ")
 
         self.app3 = ec.register_resource("OMFApplication")
         ec.set(self.app3, 'appid', 'Test#2')
-        ec.set(self.app3, 'path', "/usr/bin/test")
-        ec.set(self.app3, 'args', "-2")
+        ec.set(self.app3, 'command', "/usr/bin/test -2")
         ec.set(self.app3, 'env', " ")
 
         self.app4 = ec.register_resource("OMFApplication")
         ec.set(self.app4, 'appid', 'Test#3')
-        ec.set(self.app4, 'path', "/usr/bin/test")
-        ec.set(self.app4, 'args', "-3")
+        ec.set(self.app4, 'command', "/usr/bin/test -3")
         ec.set(self.app4, 'env', " ")
 
         self.app5 = ec.register_resource("OMFApplication")
         ec.set(self.app5, 'appid', 'Kill#2')
-        ec.set(self.app5, 'path', "/usr/bin/killall")
-        ec.set(self.app5, 'args', "vlc")
+        ec.set(self.app5, 'command', "/usr/bin/killall vlc")
         ec.set(self.app5, 'env', " ")
 
         ec.register_connection(self.app1, self.node1)
old mode 100755 (executable)
new mode 100644 (file)
similarity index 74%
rename from test/resources/omf/vlc_wrong_critical.py
rename to test/resources/omf/omf6_vlc_wrong_critical.py
index 4a9dd19..f49cb56
@@ -26,7 +26,7 @@ from nepi.resources.omf.node import OMFNode
 from nepi.resources.omf.application import OMFApplication
 from nepi.resources.omf.interface import OMFWifiInterface
 from nepi.resources.omf.channel import OMFChannel
-from nepi.resources.omf.omf_api import OMFAPIFactory
+from nepi.resources.omf.omf_api_factory import OMFAPIFactory
 
 from nepi.util.timefuncs import *
 
@@ -42,25 +42,25 @@ class OMFVLCWrongCaseAllCritical(unittest.TestCase):
         OMFVLCWrongCaseAllCritical.id += 1
 
         self.node1 = self.ec.register_resource("OMFNode")
-        self.ec.set(self.node1, 'hostname', 'omf.plexus.wlab17')
-        self.ec.set(self.node1, 'xmppSlice', "nepi")
-        self.ec.set(self.node1, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node1, 'hostname', 'wlab12')
+        self.ec.set(self.node1, 'xmppUser', "nepi")
+        self.ec.set(self.node1, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.node1, 'xmppPort', "5222")
         self.ec.set(self.node1, 'xmppPassword', "1234")
         
         self.iface1 = self.ec.register_resource("OMFWifiInterface")
-        self.ec.set(self.iface1, 'alias', "w0")
+        self.ec.set(self.iface1, 'name', "wlan0")
         self.ec.set(self.iface1, 'mode', "adhoc")
-        self.ec.set(self.iface1, 'type', "g")
+        self.ec.set(self.iface1, 'hw_mode', "g")
         self.ec.set(self.iface1, 'essid', "vlcexp")
-        self.ec.set(self.iface1, 'ip', "10.0.0.17")
+        self.ec.set(self.iface1, 'ip', "10.0.0.12/24")
 
         self.app1 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app1, 'appid', 'Vlc#1')
-        self.ec.set(self.app1, 'path', "/opt/vlc-1.1.13/cvlc")
-        self.ec.set(self.app1, 'args', "/opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
+        self.ec.set(self.app1, 'command', "/opt/vlc-1.1.13/cvlc /opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.49,port=1234,mux=ts}'")
         self.ec.set(self.app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
 
+
         self.ec.register_connection(self.app1, self.node1)
         self.ec.register_connection(self.node1, self.iface1)
 
@@ -68,18 +68,14 @@ class OMFVLCWrongCaseAllCritical(unittest.TestCase):
         self.node2 = self.ec.register_resource("OMFNode")
 
         self.iface2 = self.ec.register_resource("OMFWifiInterface")
-        self.ec.set(self.iface2, 'alias', "w0")
+        self.ec.set(self.iface2, 'name', "wlan0")
         self.ec.set(self.iface2, 'mode', "adhoc")
-        self.ec.set(self.iface2, 'type', "g")
+        self.ec.set(self.iface2, 'hw_mode', "g")
         self.ec.set(self.iface2, 'essid', "vlcexp")
-        self.ec.set(self.iface2, 'ip', "10.0.0.37")
+        self.ec.set(self.iface2, 'ip', "10.0.0.49/24")
         
         self.channel = self.ec.register_resource("OMFChannel")
         self.ec.set(self.channel, 'channel', "6")
-        self.ec.set(self.channel, 'xmppSlice', "nepi")
-        self.ec.set(self.channel, 'xmppHost', "xmpp-plexus.onelab.eu")
-        self.ec.set(self.channel, 'xmppPort', "5222")
-        self.ec.set(self.channel, 'xmppPassword', "1234")
 
         self.ec.register_connection(self.iface1, self.channel)
         self.ec.register_connection(self.node2, self.iface2)
@@ -105,27 +101,24 @@ class OMFVLCWrongCaseAllCritical(unittest.TestCase):
     def test_deploy_wo_hostname(self):
 
         self.node2 = self.ec.register_resource("OMFNode")
-        self.ec.set(self.node2, 'xmppSlice', "nepi")
-        self.ec.set(self.node2, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.node2, 'xmppPort', "5222")
         self.ec.set(self.node2, 'xmppPassword', "1234")
 
         self.iface2 = self.ec.register_resource("OMFWifiInterface")
-        self.ec.set(self.iface2, 'alias', "w0")
+        self.ec.set(self.iface2, 'name', "wlan0")
         self.ec.set(self.iface2, 'mode', "adhoc")
-        self.ec.set(self.iface2, 'type', "g")
+        self.ec.set(self.iface2, 'hw_mode', "g")
         self.ec.set(self.iface2, 'essid', "vlcexp")
-        self.ec.set(self.iface2, 'ip', "10.0.0.37")
+        self.ec.set(self.iface2, 'ip', "10.0.0.49/24")
         
         self.channel = self.ec.register_resource("OMFChannel")
         self.ec.set(self.channel, 'channel', "6")
-        self.ec.set(self.channel, 'xmppSlice', "nepi")
-        self.ec.set(self.channel, 'xmppHost', "xmpp-plexus.onelab.eu")
-        self.ec.set(self.channel, 'xmppPort', "5222")
-        self.ec.set(self.channel, 'xmppPassword', "1234")
 
         self.ec.register_connection(self.iface1, self.channel)
         self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
 
         self.ec.register_condition([self.app1], ResourceAction.STOP, self.app1, ResourceState.STARTED , "2s")
 
@@ -146,9 +139,9 @@ class OMFVLCWrongCaseAllCritical(unittest.TestCase):
 
     def test_deploy_wo_iface(self):
         self.node2 = self.ec.register_resource("OMFNode")
-        self.ec.set(self.node2, 'hostname', 'omf.plexus.wlab17')
-        self.ec.set(self.node2, 'xmppSlice', "nepi")
-        self.ec.set(self.node2, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'hostname', 'wlab49')
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.node2, 'xmppPort', "5222")
         self.ec.set(self.node2, 'xmppPassword', "1234")
 
@@ -156,13 +149,10 @@ class OMFVLCWrongCaseAllCritical(unittest.TestCase):
         
         self.channel = self.ec.register_resource("OMFChannel")
         self.ec.set(self.channel, 'channel', "6")
-        self.ec.set(self.channel, 'xmppSlice', "nepi")
-        self.ec.set(self.channel, 'xmppHost', "xmpp-plexus.onelab.eu")
-        self.ec.set(self.channel, 'xmppPort', "5222")
-        self.ec.set(self.channel, 'xmppPassword', "1234")
 
         self.ec.register_connection(self.iface1, self.channel)
         self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
 
         self.ec.register_condition([self.app1], ResourceAction.STOP, self.app1, ResourceState.STARTED , "2s")
 
@@ -181,29 +171,63 @@ class OMFVLCWrongCaseAllCritical(unittest.TestCase):
         self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
         self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
 
+    def test_deploy_wo_channel(self):
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, 'hostname', 'wlab49')
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppPort', "5222")
+        self.ec.set(self.node2, 'xmppPassword', "1234")
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface2, 'name', "wlan0")
+        self.ec.set(self.iface2, 'mode', "adhoc")
+        self.ec.set(self.iface2, 'hw_mode', "g")
+        self.ec.set(self.iface2, 'essid', "vlcexp")
+        self.ec.set(self.iface2, 'ip', "10.0.0.49/24")
+
+        self.channel = self.ec.register_resource("OMFChannel")
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
+
+        self.ec.register_condition([self.app1], ResourceAction.STOP, self.app1, ResourceState.STARTED , "2s")
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1])
+
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.FAILED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+
     def test_deploy_wo_ip(self):
         self.node2 = self.ec.register_resource("OMFNode")
-        self.ec.set(self.node2, 'hostname', 'omf.plexus.wlab17')
-        self.ec.set(self.node2, 'xmppSlice', "nepi")
-        self.ec.set(self.node2, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'hostname', 'wlab49')
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.node2, 'xmppPort', "5222")
         self.ec.set(self.node2, 'xmppPassword', "1234")
 
         self.iface2 = self.ec.register_resource("OMFWifiInterface")
-        self.ec.set(self.iface2, 'alias', "w0")
+        self.ec.set(self.iface2, 'name', "wlan0")
         self.ec.set(self.iface2, 'mode', "adhoc")
-        self.ec.set(self.iface2, 'type', "g")
-        self.ec.set(self.iface2, 'essid', "vlcexp")     
+        self.ec.set(self.iface2, 'hw_mode', "g")
+        self.ec.set(self.iface2, 'essid', "vlcexp")
 
         self.channel = self.ec.register_resource("OMFChannel")
         self.ec.set(self.channel, 'channel', "6")
-        self.ec.set(self.channel, 'xmppSlice', "nepi")
-        self.ec.set(self.channel, 'xmppHost', "xmpp-plexus.onelab.eu")
-        self.ec.set(self.channel, 'xmppPort', "5222")
-        self.ec.set(self.channel, 'xmppPassword', "1234")
 
         self.ec.register_connection(self.iface1, self.channel)
         self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
 
         self.ec.register_condition([self.app1], ResourceAction.STOP, self.app1, ResourceState.STARTED , "2s")
 
@@ -224,25 +248,21 @@ class OMFVLCWrongCaseAllCritical(unittest.TestCase):
 
     def test_deploy_wo_app(self):
         self.node2 = self.ec.register_resource("OMFNode")
-        self.ec.set(self.node2, 'hostname', 'omf.plexus.wlab17')
-        self.ec.set(self.node2, 'xmppSlice', "nepi")
-        self.ec.set(self.node2, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'hostname', 'wlab49')
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.node2, 'xmppPort', "5222")
         self.ec.set(self.node2, 'xmppPassword', "1234")
 
         self.iface2 = self.ec.register_resource("OMFWifiInterface")
-        self.ec.set(self.iface2, 'alias', "w0")
+        self.ec.set(self.iface2, 'name', "wlan0")
         self.ec.set(self.iface2, 'mode', "adhoc")
-        self.ec.set(self.iface2, 'type', "g")
+        self.ec.set(self.iface2, 'hw_mode', "g")
         self.ec.set(self.iface2, 'essid', "vlcexp")   
-        self.ec.set(self.iface2, 'ip', "10.0.0.37")  
+        self.ec.set(self.iface2, 'ip', "10.0.0.49/24")
 
         self.channel = self.ec.register_resource("OMFChannel")
         self.ec.set(self.channel, 'channel', "6")
-        self.ec.set(self.channel, 'xmppSlice', "nepi")
-        self.ec.set(self.channel, 'xmppHost', "xmpp-plexus.onelab.eu")
-        self.ec.set(self.channel, 'xmppPort', "5222")
-        self.ec.set(self.channel, 'xmppPassword', "1234")
 
         self.app2 = self.ec.register_resource("OMFApplication")
 
@@ -272,25 +292,21 @@ class OMFVLCWrongCaseAllCritical(unittest.TestCase):
 
     def test_deploy_wo_app_path(self):
         self.node2 = self.ec.register_resource("OMFNode")
-        self.ec.set(self.node2, 'hostname', 'omf.plexus.wlab17')
-        self.ec.set(self.node2, 'xmppSlice', "nepi")
-        self.ec.set(self.node2, 'xmppHost', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'hostname', 'wlab49')
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
         self.ec.set(self.node2, 'xmppPort', "5222")
         self.ec.set(self.node2, 'xmppPassword', "1234")
 
         self.iface2 = self.ec.register_resource("OMFWifiInterface")
-        self.ec.set(self.iface2, 'alias', "w0")
+        self.ec.set(self.iface2, 'name', "wlan0")
         self.ec.set(self.iface2, 'mode', "adhoc")
-        self.ec.set(self.iface2, 'type', "g")
+        self.ec.set(self.iface2, 'hw_mode', "g")
         self.ec.set(self.iface2, 'essid', "vlcexp")   
-        self.ec.set(self.iface2, 'ip', "10.0.0.37")  
+        self.ec.set(self.iface2, 'ip', "10.0.0.49/24")
 
         self.channel = self.ec.register_resource("OMFChannel")
         self.ec.set(self.channel, 'channel', "6")
-        self.ec.set(self.channel, 'xmppSlice', "nepi")
-        self.ec.set(self.channel, 'xmppHost', "xmpp-plexus.onelab.eu")
-        self.ec.set(self.channel, 'xmppPort', "5222")
-        self.ec.set(self.channel, 'xmppPassword', "1234")
 
         self.app2 = self.ec.register_resource("OMFApplication")
         self.ec.set(self.app2, 'appid', 'Vlc#2')
diff --git a/test/resources/omf/omf6_vlc_wrong_non_critical.py b/test/resources/omf/omf6_vlc_wrong_non_critical.py
new file mode 100644 (file)
index 0000000..9b29bba
--- /dev/null
@@ -0,0 +1,491 @@
+#!/usr/bin/env python
+#
+#    NEPI, a framework to manage network experiments
+#    Copyright (C) 2013 INRIA
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Julien Tribino <julien.tribino@inria.fr>
+
+
+from nepi.execution.resource import ResourceFactory, ResourceManager, ResourceAction, ResourceState
+from nepi.execution.ec import ExperimentController
+
+from nepi.resources.omf.node import OMFNode
+from nepi.resources.omf.application import OMFApplication
+from nepi.resources.omf.interface import OMFWifiInterface
+from nepi.resources.omf.channel import OMFChannel
+from nepi.resources.omf.omf_api_factory import OMFAPIFactory
+
+from nepi.util.timefuncs import *
+
+import time
+import unittest
+
+class OMFVLCWrongCaseWithNonCritical(unittest.TestCase):
+
+    id = 2000
+
+    def setUp(self):
+        self.ec = ExperimentController(exp_id = str(OMFVLCWrongCaseWithNonCritical.id))
+        OMFVLCWrongCaseWithNonCritical.id += 1
+
+        self.node1 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node1, 'hostname', 'wlab12')
+        self.ec.set(self.node1, 'xmppUser', "nepi")
+        self.ec.set(self.node1, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node1, 'xmppPort', "5222")
+        self.ec.set(self.node1, 'xmppPassword', "1234")
+        
+        self.iface1 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface1, 'name', "wlan0")
+        self.ec.set(self.iface1, 'mode', "adhoc")
+        self.ec.set(self.iface1, 'hw_mode', "g")
+        self.ec.set(self.iface1, 'essid', "vlcexp")
+        self.ec.set(self.iface1, 'ip', "10.0.0.12/24")
+
+        self.app1 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app1, 'appid', 'Kill#1')
+        self.ec.set(self.app1, 'command', "/usr/bin/test -1")
+        self.ec.set(self.app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+
+        self.ec.register_connection(self.app1, self.node1)
+        self.ec.register_connection(self.node1, self.iface1)
+
+    def test_deploy_with_node_nc(self):
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, "critical", False)
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface2, 'name', "wlan0")
+        self.ec.set(self.iface2, 'mode', "adhoc")
+        self.ec.set(self.iface2, 'hw_mode', "g")
+        self.ec.set(self.iface2, 'essid', "vlcexp")
+        self.ec.set(self.iface2, 'ip', "10.0.0.49/24")
+        
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, 'channel', "6")
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
+
+        self.ec.register_condition([self.app1], ResourceAction.STOP, self.app1, ResourceState.STARTED , "5s")
+
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1])
+
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.FAILED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.FAILED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+
+    def test_deploy_with_node_and_iface_nc(self):
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, "critical", False)
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.node2, "critical", False)
+        self.ec.set(self.iface2, 'name', "wlan0")
+        self.ec.set(self.iface2, 'mode', "adhoc")
+        self.ec.set(self.iface2, 'hw_mode', "g")
+        self.ec.set(self.iface2, 'essid', "vlcexp")
+        self.ec.set(self.iface2, 'ip', "10.0.0.49/24")
+        
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, 'channel', "6")
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
+
+        self.ec.register_condition([self.app1], ResourceAction.STOP, self.app1, ResourceState.STARTED , "5s")
+
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1])
+
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.FAILED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.FAILED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+
+    def test_deploy_with_node_iface_channel_nc(self):
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, "critical", False)
+        self.ec.set(self.node2, 'hostname', 'wlab49')
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.node2, "critical", False)
+        self.ec.set(self.iface2, 'name', "wlan0")
+        self.ec.set(self.iface2, 'mode', "adhoc")
+        self.ec.set(self.iface2, 'hw_mode', "g")
+        self.ec.set(self.iface2, 'essid', "vlcexp")
+        self.ec.set(self.iface2, 'ip', "10.0.0.49/24")
+        
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, 'channel', "6")
+        self.ec.set(self.channel, "critical", False)
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
+
+        self.ec.register_condition([self.app1], ResourceAction.STOP, self.app1, ResourceState.STARTED , "10s")
+
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1])
+
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.FAILED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.FAILED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+
+    def test_deploy_with_app_nc(self):
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, 'hostname', 'wlab49')
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppPort', "5222")
+        self.ec.set(self.node2, 'xmppPassword', "1234")
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface2, 'name', "wlan0")
+        self.ec.set(self.iface2, 'mode', "adhoc")
+        self.ec.set(self.iface2, 'hw_mode', "g")
+        self.ec.set(self.iface2, 'essid', "vlcexp")
+        self.ec.set(self.iface2, 'ip', "10.0.0.49/24")
+        
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, 'channel', "6")
+
+        self.app2 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app2, "critical", False)
+        self.ec.set(self.app2, 'appid', 'Kill#22')
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
+        self.ec.register_connection(self.app2, self.node2)
+
+        self.ec.register_condition(self.app2, ResourceAction.START, self.app1, ResourceState.STARTED , "6s")
+        self.ec.register_condition([self.app1, self.app2], ResourceAction.STOP, self.app1, ResourceState.STARTED , "10s")
+
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1, self.app2])
+
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.STOPPED)
+        self.assertEquals(self.ec.get_resource(self.app2).state, ResourceState.FAILED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app2).state, ResourceState.RELEASED)
+
+    def test_deploy_with_all_nc_and_app_critical(self):
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, "critical", False)
+        self.ec.set(self.node2, 'hostname', 'wlab49')
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface2, "critical", False)
+        
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, "critical", False)
+        self.ec.set(self.channel, 'channel', "6")
+
+        self.app2 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app2, 'appid', 'Kill#22')
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
+        self.ec.register_connection(self.app2, self.node2)
+
+        self.ec.register_condition(self.app2, ResourceAction.START, self.app1, ResourceState.STARTED , "6s")
+        self.ec.register_condition([self.app1, self.app2], ResourceAction.STOP, self.app1, ResourceState.STARTED , "10s")
+
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1, self.app2])
+
+        self.assertEquals(self.ec.get_resource(self.app2).state, ResourceState.FAILED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app2).state, ResourceState.RELEASED)
+
+
+class OMFVLCWrongCaseWithNonCriticalDep(unittest.TestCase):
+
+    id = 3000
+
+    def setUp(self):
+        self.ec = ExperimentController(exp_id = str(OMFVLCWrongCaseWithNonCriticalDep.id))
+        OMFVLCWrongCaseWithNonCriticalDep.id += 1
+
+        self.node1 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node1, 'hostname', 'wlab12')
+        self.ec.set(self.node1, 'xmppUser', "nepi")
+        self.ec.set(self.node1, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node1, 'xmppPort', "5222")
+        self.ec.set(self.node1, 'xmppPassword', "1234")
+        
+        self.iface1 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface1, 'name', "wlan0")
+        self.ec.set(self.iface1, 'mode', "adhoc")
+        self.ec.set(self.iface1, 'hw_mode', "g")
+        self.ec.set(self.iface1, 'essid', "vlcexp")
+        self.ec.set(self.iface1, 'ip', "10.0.0.12/24")
+
+        self.app1 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app1, 'appid', 'Kill#1')
+        self.ec.set(self.app1, 'command', "/usr/bin/test -1")
+        self.ec.set(self.app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+
+        self.ec.register_connection(self.app1, self.node1)
+        self.ec.register_connection(self.node1, self.iface1)
+
+    def test_deploy_with_app_nc_and_critical_wrong(self):
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, 'hostname', 'wlab49')
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppPort', "5222")
+        self.ec.set(self.node2, 'xmppPassword', "1234")
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface2, 'name', "wlan0")
+        self.ec.set(self.iface2, 'mode', "adhoc")
+        self.ec.set(self.iface2, 'hw_mode', "g")
+        self.ec.set(self.iface2, 'essid', "vlcexp")
+        self.ec.set(self.iface2, 'ip', "10.0.0.49/24")
+        
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, 'channel', "6")
+
+        self.app2 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app2, "critical", False)
+        self.ec.set(self.app2, 'appid', 'Kill#32')
+
+        self.app3 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app3, 'appid', 'Kill#33')
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
+        self.ec.register_connection(self.app2, self.node2)
+        self.ec.register_connection(self.app3, self.node2)
+
+        self.ec.register_condition(self.app2, ResourceAction.START, self.app1, ResourceState.STARTED , "5s")
+        self.ec.register_condition(self.app3, ResourceAction.START, self.app2, ResourceState.STARTED , "5s")
+        self.ec.register_condition([self.app1, self.app2, self.app3], ResourceAction.STOP, self.app1, ResourceState.STARTED , "15s")
+
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1, self.app2, self.app3])
+
+        self.assertEquals(self.ec.get_resource(self.app2).state, ResourceState.FAILED)
+        self.assertEquals(self.ec.get_resource(self.app3).state, ResourceState.FAILED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app3).state, ResourceState.RELEASED)
+
+    def test_deploy_with_app_nc_and_critical_right(self):
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, 'hostname', 'wlab49')
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppPort', "5222")
+        self.ec.set(self.node2, 'xmppPassword', "1234")
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface2, 'name', "wlan0")
+        self.ec.set(self.iface2, 'mode', "adhoc")
+        self.ec.set(self.iface2, 'hw_mode', "g")
+        self.ec.set(self.iface2, 'essid', "vlcexp")
+        self.ec.set(self.iface2, 'ip', "10.0.0.49/24")
+        
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, 'channel', "6")
+
+        self.app2 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app2, "critical", False)
+        self.ec.set(self.app2, 'appid', 'Kill#32')
+
+        self.app3 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app3, 'appid', 'Kill#3')
+        self.ec.set(self.app3, 'command', "/usr/bin/test -3")
+        self.ec.set(self.app3, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
+        self.ec.register_connection(self.app2, self.node2)
+        self.ec.register_connection(self.app3, self.node2)
+
+        self.ec.register_condition(self.app2, ResourceAction.START, self.app1, ResourceState.STARTED , "5s")
+        self.ec.register_condition(self.app3, ResourceAction.START, self.app2, ResourceState.STARTED , "5s")
+        self.ec.register_condition([self.app1, self.app2, self.app3], ResourceAction.STOP, self.app1, ResourceState.STARTED , "15s")
+
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1, self.app2, self.app3])
+
+        self.assertEquals(self.ec.get_resource(self.app2).state, ResourceState.FAILED)
+        self.assertEquals(self.ec.get_resource(self.app3).state, ResourceState.STOPPED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app3).state, ResourceState.RELEASED)
+
+
+    def test_deploy_with_many_app_nc_and_critical(self):
+        self.node2 = self.ec.register_resource("OMFNode")
+        self.ec.set(self.node2, 'hostname', 'wlab49')
+        self.ec.set(self.node2, 'xmppUser', "nepi")
+        self.ec.set(self.node2, 'xmppServer', "xmpp-plexus.onelab.eu")
+        self.ec.set(self.node2, 'xmppPort', "5222")
+        self.ec.set(self.node2, 'xmppPassword', "1234")
+
+        self.iface2 = self.ec.register_resource("OMFWifiInterface")
+        self.ec.set(self.iface2, 'name', "wlan0")
+        self.ec.set(self.iface2, 'mode', "adhoc")
+        self.ec.set(self.iface2, 'hw_mode', "g")
+        self.ec.set(self.iface2, 'essid', "vlcexp")
+        self.ec.set(self.iface2, 'ip', "10.0.0.49/24")
+        
+        self.channel = self.ec.register_resource("OMFChannel")
+        self.ec.set(self.channel, 'channel', "6")
+
+        self.app2 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app2, "critical", False)
+        self.ec.set(self.app2, 'appid', 'Kill#32')
+
+        self.app3 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app3, "critical", False)
+        self.ec.set(self.app3, 'appid', 'Kill#3')
+        self.ec.set(self.app3, 'command', "/usr/bin/test -3")
+        self.ec.set(self.app3, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+
+        self.app4 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app4, 'appid', 'Kill#4')
+        self.ec.set(self.app4, 'command', "/usr/bin/test -4")
+        self.ec.set(self.app4, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+
+        self.app5 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app5, "critical", False)
+        self.ec.set(self.app5, 'appid', 'Kill#32')
+
+        self.app6 = self.ec.register_resource("OMFApplication")
+        self.ec.set(self.app6, 'appid', 'Kill#6')
+        self.ec.set(self.app6, 'command', "/usr/bin/test -6")
+        self.ec.set(self.app6, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
+
+        self.ec.register_connection(self.iface1, self.channel)
+        self.ec.register_connection(self.node2, self.iface2)
+        self.ec.register_connection(self.iface2, self.channel)
+        self.ec.register_connection(self.app2, self.node1)
+        self.ec.register_connection(self.app3, self.node1)
+        self.ec.register_connection(self.app4, self.node2)
+        self.ec.register_connection(self.app5, self.node2)
+        self.ec.register_connection(self.app6, self.node2)
+
+        self.ec.register_condition(self.app2, ResourceAction.START, self.app1, ResourceState.STARTED , "4s")
+        self.ec.register_condition(self.app3, ResourceAction.START, self.app2, ResourceState.STARTED , "4s")
+        self.ec.register_condition(self.app4, ResourceAction.START, self.app1, ResourceState.STARTED , "4s")
+        self.ec.register_condition(self.app5, ResourceAction.START, self.app4, ResourceState.STARTED , "4s")
+        self.ec.register_condition(self.app6, ResourceAction.START, self.app5, ResourceState.STARTED , "4s")
+        self.ec.register_condition([self.app1, self.app2, self.app3, self.app4, self.app5, self.app6 ], ResourceAction.STOP, [self.app1, self.app2, self.app3, self.app4, self.app5, self.app6 ], ResourceState.STARTED , "5s")
+
+        self.ec.deploy()
+
+        self.ec.wait_finished([self.app1, self.app2, self.app3, self.app4, self.app5, self.app6])
+
+        self.assertEquals(self.ec.get_resource(self.app3).state, ResourceState.STOPPED)
+        self.assertEquals(self.ec.get_resource(self.app2).state, ResourceState.FAILED)
+        self.assertEquals(self.ec.get_resource(self.app4).state, ResourceState.STOPPED)
+        self.assertEquals(self.ec.get_resource(self.app5).state, ResourceState.FAILED)
+        self.assertEquals(self.ec.get_resource(self.app6).state, ResourceState.STOPPED)
+
+        self.ec.shutdown()
+
+        self.assertEquals(self.ec.get_resource(self.node1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.node2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.iface2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.channel).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app1).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app2).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app3).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app4).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app5).state, ResourceState.RELEASED)
+        self.assertEquals(self.ec.get_resource(self.app6).state, ResourceState.RELEASED)
+
+
+if __name__ == '__main__':
+    unittest.main()
+
+
+