-"""
- 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
+#
+# 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 version 2 as
+# published by the Free Software Foundation;
+#
+# 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>
+
from nepi.execution.resource import ResourceFactory, ResourceAction, ResourceState
from nepi.execution.ec import ExperimentController
# Create and Configure the Nodes
-node1 = ec.register_resource("OMFNode")
+node1 = ec.register_resource("omf::Node")
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")
+iface1 = ec.register_resource("omf::WifiInterface")
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")
+node2 = ec.register_resource("omf::Node")
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")
+iface2 = ec.register_resource("omf::WifiInterface")
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")
+chan = ec.register_resource("omf::Channel")
ec.set(chan, 'channel', "6")
# Create and Configure the Application
-app1 = ec.register_resource("OMFApplication")
+app1 = ec.register_resource("omf::Application")
ec.set(app1, 'command', '/bin/ping -c5 192.168.0.49')
ec.set(app1, 'env', "")
-app2 = ec.register_resource("OMFApplication")
+app2 = ec.register_resource("omf::Application")
ec.set(app2, 'command', '/bin/ping -c5 192.168.0.12')
ec.set(app2, 'env', "")
# Choose a directory to store the traces, by default
# It it the folder ehere you run Nepi.
-f = open("app1.txt", "w")
-f.write(stdout_1)
-f.close()
+with open("app1.txt", "w") as f:
+ f.write(stdout_1)
-g = open("app2.txt", "w")
-g.write(stdout_2)
-g.close()
+with open("app2.txt", "w") as g:
+ g.write(stdout_2)
# Stop Experiment
ec.shutdown()