POPI experiment moved into nepi
authorClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Wed, 5 Oct 2011 17:06:46 +0000 (14:06 -0300)
committerClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Wed, 5 Oct 2011 17:06:46 +0000 (14:06 -0300)
examples/POPI/popi-0.9-rpy2.patch [new file with mode: 0644]
examples/POPI/popi-0.9.tar.gz [new file with mode: 0644]
examples/POPI/popi-tun-classfilter-2MB-q500-pl-hibw.xml [new file with mode: 0644]
examples/POPI/popi-tun-classfilter-2MB-q500-pl.xml [new file with mode: 0644]
examples/POPI/run_one_experiment.py [new file with mode: 0644]
examples/POPI/run_popi_experiments.py [new file with mode: 0644]
examples/POPI/run_popi_experiments.sh [new file with mode: 0755]

diff --git a/examples/POPI/popi-0.9-rpy2.patch b/examples/POPI/popi-0.9-rpy2.patch
new file mode 100644 (file)
index 0000000..269e1d2
--- /dev/null
@@ -0,0 +1,37 @@
+diff -ur popi-0.9/rlranklib.py popi-0.9-rpy2/rlranklib.py
+--- popi-0.9/rlranklib.py      2011-08-17 15:30:31.000000000 +0200
++++ popi-0.9-rpy2/rlranklib.py 2011-09-16 05:28:16.547000068 +0200
+@@ -5,10 +5,13 @@
+ # $Header: /data/cvsroot/plportest/anadata/rlranklib.py,v 1.11.2.1 2007/11/26 08:46:29 lgh Exp $
+ import random
+-from rpy import *
++import rpy2.rpy_classic
++from rpy2.rpy_classic import *
+ from math import sqrt, log
+ from sets import Set
++rpy2.rpy_classic.set_default_mode(rpy2.rpy_classic.BASIC_CONVERSION)
++
+ safe_eff = [None,1.365,1.208,1.116,1.110,1.104,1.064,1.064]
+ def calc_rlrank(lrs, opt_ranktype):
+@@ -66,7 +69,7 @@
+         riag = [ rlranks[i] for i in range(0, len(rlranks)) if partition[i] == igrp ]    # rlranks in a group
+         if len(riag) == 1:
+             continue
+-        threshold = r.qtukey(alpha, len(riag), 1000)*sqrt(1.0/12/nb)*len(riag)/len(rlranks)
++        threshold = r.qtukey(alpha, len(riag), 1000)[0]*sqrt(1.0/12/nb)*len(riag)/len(rlranks)
+         range_    = max(riag) - min(riag)
+         if verbose:
+             print "   ", igrp, len(riag), min(riag), max(riag), range_, "%.3f" % threshold,
+@@ -99,7 +102,7 @@
+         return True
+     
+     # t = r.qtukey(alpha, len(arrs), 1000)*sqrt(1.0/12/nb)*(len(arrs)+1)/ksum
+-    t = r.qtukey(alpha, km, 1000) * sqrt((km*km-1)/12.0/nb) / ksum
++    t = r.qtukey(alpha, km, 1000)[0] * sqrt((km*km-1)/12.0/nb) / ksum
+     if km <= len(safe_eff):
+         t = t * safe_eff[km-1]
+     if max(arrs) - min(arrs) > t:
+Binary files popi-0.9/rlranklib.pyc and popi-0.9-rpy2/rlranklib.pyc differ
diff --git a/examples/POPI/popi-0.9.tar.gz b/examples/POPI/popi-0.9.tar.gz
new file mode 100644 (file)
index 0000000..9f11707
Binary files /dev/null and b/examples/POPI/popi-0.9.tar.gz differ
diff --git a/examples/POPI/popi-tun-classfilter-2MB-q500-pl-hibw.xml b/examples/POPI/popi-tun-classfilter-2MB-q500-pl-hibw.xml
new file mode 100644 (file)
index 0000000..976fb55
--- /dev/null
@@ -0,0 +1,259 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<experiment>
+    <testbeds>
+        <testbed guid="1" testbed_id="planetlab" testbed_version="0.1">
+            <graphical_info height="580.0" width="872.882843778" x="-317.0" y="-124.0"/>
+            <attributes>
+                <attribute name="slice" type="STRING" value="##plslice##"/>
+                <attribute name="plLogLevel" type="STRING" value="INFO"/>
+                <attribute name="logLevel" type="STRING" value="Debug"/>
+                <attribute name="dedicatedSlice" type="BOOL" value="True"/>
+                <attribute name="plcUrl" type="STRING" value="https://%(hostname)s:443/PLCAPI/"/>
+                <attribute name="recoveryPolicy" type="STRING" value="Recover"/>
+                <attribute name="p2pDeployment" type="BOOL" value="False"/>
+                <attribute name="label" type="STRING" value=""/>
+                <attribute name="tapPortBase" type="INTEGER" value="16000"/>
+                <attribute name="authUser" type="STRING" value="##pluser##"/>
+                <attribute name="sliceSSHKey" type="STRING" value="##plkey##"/>
+                <attribute name="authPass" type="STRING" value="##plpass##"/>
+                <attribute name="plcHost" type="STRING" value="www.planet-lab.eu"/>
+            </attributes>
+            <elements>
+                <element factory_id="Node" guid="2">
+                    <graphical_info height="100.0" width="100.0" x="-256.0" y="-223.0"/>
+                    <attributes>
+                        <attribute name="maxBandwidth" type="DOUBLE" value="1024.0"/>
+                        <attribute name="minCpu" type="DOUBLE" value="30.0"/>
+                        <attribute name="operatingSystem" type="STRING" value="f12"/>
+                    </attributes>
+                    <routes>
+                        <route Destination="192.168.2.32" Metric="0" NetPrefix="27" NextHop="192.168.2.3"/>
+                    </routes>
+                    <connections>
+                        <connection connector="devs" other_connector="node" other_guid="11"/>
+                        <connection connector="devs" other_connector="node" other_guid="21"/>
+                        <connection connector="apps" other_connector="node" other_guid="8"/>
+                    </connections>
+                </element>
+                <element factory_id="Node" guid="3">
+                    <graphical_info height="100.0" width="100.0" x="263.0" y="-222.0"/>
+                    <attributes>
+                        <attribute name="maxBandwidth" type="DOUBLE" value="1024.0"/>
+                        <attribute name="forward_X11" type="BOOL" value="False"/>
+                        <attribute name="minCpu" type="DOUBLE" value="30.0"/>
+                        <attribute name="operatingSystem" type="STRING" value="f12"/>
+                    </attributes>
+                    <routes>
+                        <route Destination="192.168.2.0" Metric="0" NetPrefix="27" NextHop="192.168.2.34"/>
+                    </routes>
+                    <connections>
+                        <connection connector="devs" other_connector="node" other_guid="24"/>
+                        <connection connector="devs" other_connector="node" other_guid="12"/>
+                        <connection connector="apps" other_connector="node" other_guid="10"/>
+                    </connections>
+                </element>
+                <element factory_id="Application" guid="8">
+                    <graphical_info height="100.0" width="100.0" x="-365.684303842" y="-223.842151921"/>
+                    <attributes>
+                        <attribute name="buildDepends" type="STRING" value="libpcap-devel make gcc "/>
+                        <attribute name="sudo" type="BOOL" value="True"/>
+                        <attribute name="label" type="STRING" value="popi-cli"/>
+                        <attribute name="sources" type="STRING" value="popi-0.9.tar.gz"/>
+                        <attribute name="depends" type="STRING" value="libpcap"/>
+                        <attribute name="command" type="STRING" value="sleep 2; ./popi -et 136/2004/30002,6/2000/30002,17/2002/30002,1/30002/8 -b 32 -r 2000  -o {#[popi-cli].trace[output].[name]#} -i {#[tap-cli].[if_name]#} {#[tap-srv].addr[0].[Address]#}"/>
+                        <attribute name="build" type="STRING" value="tar xzf ${SOURCES}/popi-0.9.tar.gz &amp;&amp; cd popi-0.9 &amp;&amp; ./configure --enable-debug --with-host=planetlab &amp;&amp; make"/>
+                        <attribute name="install" type="STRING" value="cp ./popi-0.9/popi ${SOURCES}"/>
+                    </attributes>
+                    <traces>
+                        <trace name="output"/>
+                        <trace name="stderr"/>
+                        <trace name="stdout"/>
+                    </traces>
+                    <connections>
+                        <connection connector="node" other_connector="apps" other_guid="2"/>
+                    </connections>
+                </element>
+                <element factory_id="Internet" guid="9">
+                    <graphical_info height="100.0" width="100.0" x="8.0" y="211.0"/>
+                    <connections>
+                        <connection connector="devs" other_connector="inet" other_guid="16"/>
+                        <connection connector="devs" other_connector="inet" other_guid="11"/>
+                        <connection connector="devs" other_connector="inet" other_guid="12"/>
+                    </connections>
+                </element>
+                <element factory_id="Application" guid="10">
+                    <graphical_info height="100.0" width="100.0" x="374.0" y="-222.0"/>
+                    <attributes>
+                        <attribute name="buildDepends" type="STRING" value="libpcap-devel make gcc "/>
+                        <attribute name="sudo" type="BOOL" value="True"/>
+                        <attribute name="label" type="STRING" value="popi-srv"/>
+                        <attribute name="sources" type="STRING" value="popi-0.9.tar.gz"/>
+                        <attribute name="depends" type="STRING" value="libpcap"/>
+                       <attribute name="command" type="STRING" value="./popid -v -i {#[tap-srv].[if_name]#} -b 136/30002,6/30002,17/30002,1/30002"/>
+                        <attribute name="build" type="STRING" value="tar xzf ${SOURCES}/popi-0.9.tar.gz &amp;&amp; cd popi-0.9 &amp;&amp; ./configure --enable-debug --with-host=planetlab &amp;&amp; make"/>
+                        <attribute name="install" type="STRING" value="cp ./popi-0.9/popid ${SOURCES}"/>
+                    </attributes>
+                    <traces>
+                        <trace name="stderr"/>
+                        <trace name="stdout"/>
+                    </traces>
+                    <connections>
+                        <connection connector="node" other_connector="apps" other_guid="3"/>
+                    </connections>
+                </element>
+                <element factory_id="NodeInterface" guid="11">
+                    <graphical_info height="100.0" width="100.0" x="-355.87051993" y="67.7927863957"/>
+                    <factory_attributes>
+                        <factory_attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </factory_attributes>
+                    <attributes>
+                        <attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </attributes>
+                    <connections>
+                        <connection connector="node" other_connector="devs" other_guid="2"/>
+                        <connection connector="inet" other_connector="devs" other_guid="9"/>
+                    </connections>
+                </element>
+                <element factory_id="NodeInterface" guid="12">
+                    <graphical_info height="100.0" width="100.0" x="356.0" y="76.0"/>
+                    <factory_attributes>
+                        <factory_attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </factory_attributes>
+                    <attributes>
+                        <attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </attributes>
+                    <connections>
+                        <connection connector="node" other_connector="devs" other_guid="3"/>
+                        <connection connector="inet" other_connector="devs" other_guid="9"/>
+                    </connections>
+                </element>
+                <element factory_id="Node" guid="15">
+                    <graphical_info height="100.0" width="100.0" x="1.0" y="-216.0"/>
+                    <attributes>
+                        <attribute name="maxBandwidth" type="DOUBLE" value="512.0"/>
+                        <attribute name="forward_X11" type="BOOL" value="False"/>
+                        <attribute name="minCpu" type="DOUBLE" value="50.0"/>
+                        <attribute name="operatingSystem" type="STRING" value="f12"/>
+                    </attributes>
+                    <connections>
+                        <connection connector="devs" other_connector="node" other_guid="16"/>
+                        <connection connector="devs" other_connector="node" other_guid="22"/>
+                        <connection connector="devs" other_connector="node" other_guid="23"/>
+                    </connections>
+                </element>
+                <element factory_id="NodeInterface" guid="16">
+                    <graphical_info height="100.0" width="100.0" x="6.0" y="72.0"/>
+                    <factory_attributes>
+                        <factory_attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </factory_attributes>
+                    <attributes>
+                        <attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </attributes>
+                    <connections>
+                        <connection connector="node" other_connector="devs" other_guid="15"/>
+                        <connection connector="inet" other_connector="devs" other_guid="9"/>
+                    </connections>
+                </element>
+                <element factory_id="TunInterface" guid="21">
+                    <graphical_info height="100.0" width="100.0" x="-255.0" y="-110.0"/>
+                    <factory_attributes>
+                        <factory_attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </factory_attributes>
+                    <attributes>
+                        <attribute name="up" type="BOOL" value="True"/>
+                        <attribute name="maxAddresses" type="INTEGER" value="1"/>
+                        <attribute name="label" type="STRING" value="tap-cli"/>
+                        <attribute name="bwlimit" type="INTEGER" value="256"/>
+                    </attributes>
+                    <traces>
+                        <trace name="pcap"/>
+                    </traces>
+                    <addresses>
+                        <address Address="192.168.2.2" NetPrefix="27"/>
+                    </addresses>
+                    <connections>
+                        <connection connector="node" other_connector="devs" other_guid="2"/>
+                        <connection connector="udp" other_connector="udp" other_guid="22"/>
+                    </connections>
+                </element>
+                <element factory_id="TunInterface" guid="22">
+                    <graphical_info height="100.0" width="100.0" x="-56.0" y="-105.0"/>
+                    <factory_attributes>
+                        <factory_attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </factory_attributes>
+                    <attributes>
+                        <attribute name="up" type="BOOL" value="True"/>
+                        <attribute name="maxAddresses" type="INTEGER" value="1"/>
+                        <attribute name="bwlimit" type="INTEGER" value="256"/>
+                    </attributes>
+                    <traces>
+                        <trace name="pcap"/>
+                    </traces>
+                    <addresses>
+                        <address Address="192.168.2.3" NetPrefix="27"/>
+                    </addresses>
+                    <connections>
+                        <connection connector="node" other_connector="devs" other_guid="15"/>
+                        <connection connector="udp" other_connector="udp" other_guid="21"/>
+                    </connections>
+                </element>
+                <element factory_id="TunInterface" guid="23">
+                    <graphical_info height="100.0" width="100.0" x="77.0" y="-104.0"/>
+                    <factory_attributes>
+                        <factory_attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </factory_attributes>
+                    <attributes>
+                        <attribute name="up" type="BOOL" value="True"/>
+                        <attribute name="maxAddresses" type="INTEGER" value="1"/>
+                        <attribute name="bwlimit" type="INTEGER" value="##bwlimit##"/>
+                    </attributes>
+                    <traces>
+                        <trace name="pcap"/>
+                    </traces>
+                    <addresses>
+                        <address Address="192.168.2.34" NetPrefix="27"/>
+                    </addresses>
+                    <connections>
+                        <connection connector="node" other_connector="devs" other_guid="15"/>
+                        <connection connector="fd-&gt;" other_connector="-&gt;fd" other_guid="26"/>
+                    </connections>
+                </element>
+                <element factory_id="TunInterface" guid="24">
+                    <graphical_info height="100.0" width="100.0" x="264.0" y="-107.0"/>
+                    <factory_attributes>
+                        <factory_attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </factory_attributes>
+                    <attributes>
+                        <attribute name="up" type="BOOL" value="True"/>
+                        <attribute name="maxAddresses" type="INTEGER" value="1"/>
+                        <attribute name="label" type="STRING" value="tap-srv"/>
+                        <attribute name="bwlimit" type="INTEGER" value="256"/>
+                    </attributes>
+                    <traces>
+                        <trace name="pcap"/>
+                    </traces>
+                    <addresses>
+                        <address Address="192.168.2.35" NetPrefix="27"/>
+                    </addresses>
+                    <connections>
+                        <connection connector="node" other_connector="devs" other_guid="3"/>
+                        <connection connector="udp" other_connector="udp" other_guid="26"/>
+                    </connections>
+                </element>
+                <element factory_id="ClassQueueFilter" guid="26">
+                    <graphical_info height="100.0" width="100.0" x="174.0" y="19.0"/>
+                    <attributes>
+                        <attribute name="args" type="STRING" value="size=500,classes=##classes##"/>
+                    </attributes>
+                    <traces>
+                        <trace name="dropped_stats"/>
+                    </traces>
+                    <connections>
+                        <connection connector="udp" other_connector="udp" other_guid="24"/>
+                        <connection connector="-&gt;fd" other_connector="fd-&gt;" other_guid="23"/>
+                    </connections>
+                </element>
+            </elements>
+        </testbed>
+    </testbeds>
+</experiment>
diff --git a/examples/POPI/popi-tun-classfilter-2MB-q500-pl.xml b/examples/POPI/popi-tun-classfilter-2MB-q500-pl.xml
new file mode 100644 (file)
index 0000000..c73848d
--- /dev/null
@@ -0,0 +1,241 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<experiment>
+    <testbeds>
+        <testbed guid="1" testbed_id="planetlab" testbed_version="0.1">
+            <graphical_info height="580.0" width="872.882843778" x="-317.0" y="-124.0"/>
+            <attributes>
+                <attribute name="slice" type="STRING" value="##plslice##"/>
+                <attribute name="plLogLevel" type="STRING" value="INFO"/>
+                <attribute name="logLevel" type="STRING" value="Debug"/>
+                <attribute name="dedicatedSlice" type="BOOL" value="True"/>
+                <attribute name="plcUrl" type="STRING" value="https://%(hostname)s:443/PLCAPI/"/>
+                <attribute name="recoveryPolicy" type="STRING" value="Recover"/>
+                <attribute name="p2pDeployment" type="BOOL" value="False"/>
+                <attribute name="label" type="STRING" value=""/>
+                <attribute name="tapPortBase" type="INTEGER" value="16000"/>
+                <attribute name="authUser" type="STRING" value="##pluser##"/>
+                <attribute name="sliceSSHKey" type="STRING" value="##plkey##"/>
+                <attribute name="authPass" type="STRING" value="##plpass##"/>
+                <attribute name="plcHost" type="STRING" value="www.planet-lab.eu"/>
+            </attributes>
+            <elements>
+                <element factory_id="Node" guid="2">
+                    <graphical_info height="100.0" width="100.0" x="-256.0" y="-223.0"/>
+                    <attributes>
+                        <attribute name="operatingSystem" type="STRING" value="f12"/>
+                    </attributes>
+                    <routes>
+                        <route Destination="192.168.2.32" Metric="0" NetPrefix="27" NextHop="192.168.2.3"/>
+                    </routes>
+                    <connections>
+                        <connection connector="devs" other_connector="node" other_guid="11"/>
+                        <connection connector="devs" other_connector="node" other_guid="21"/>
+                        <connection connector="apps" other_connector="node" other_guid="8"/>
+                    </connections>
+                </element>
+                <element factory_id="Node" guid="3">
+                    <graphical_info height="100.0" width="100.0" x="263.0" y="-222.0"/>
+                    <attributes>
+                        <attribute name="forward_X11" type="BOOL" value="False"/>
+                        <attribute name="operatingSystem" type="STRING" value="f12"/>
+                    </attributes>
+                    <routes>
+                        <route Destination="192.168.2.0" Metric="0" NetPrefix="27" NextHop="192.168.2.34"/>
+                    </routes>
+                    <connections>
+                        <connection connector="devs" other_connector="node" other_guid="24"/>
+                        <connection connector="devs" other_connector="node" other_guid="12"/>
+                        <connection connector="apps" other_connector="node" other_guid="10"/>
+                    </connections>
+                </element>
+                <element factory_id="Application" guid="8">
+                    <graphical_info height="100.0" width="100.0" x="-365.684303842" y="-223.842151921"/>
+                    <attributes>
+                        <attribute name="buildDepends" type="STRING" value="libpcap-devel make gcc "/>
+                        <attribute name="sudo" type="BOOL" value="True"/>
+                        <attribute name="label" type="STRING" value="popi-cli"/>
+                       <attribute name="sources" type="STRING" value="popi-0.9.tar.gz"/>
+                        <attribute name="depends" type="STRING" value="libpcap"/>
+                        <attribute name="command" type="STRING" value="sleep 2; ./popi -et 136/2004/30002,6/2000/30002,17/2002/30002,1/30002/8 -b 32 -r 2000  -o {#[popi-cli].trace[output].[name]#} -i {#[tap-cli].[if_name]#} {#[tap-srv].addr[0].[Address]#}"/>
+                        <attribute name="build" type="STRING" value="tar xzf ${SOURCES}/popi-0.9.tar.gz &amp;&amp; cd popi-0.9 &amp;&amp; ./configure --enable-debug --with-host=planetlab &amp;&amp; make"/>
+                        <attribute name="install" type="STRING" value="cp ./popi-0.9/popi ${SOURCES}"/>
+                    </attributes>
+                    <traces>
+                        <trace name="output"/>
+                        <trace name="stderr"/>
+                        <trace name="stdout"/>
+                    </traces>
+                    <connections>
+                        <connection connector="node" other_connector="apps" other_guid="2"/>
+                    </connections>
+                </element>
+                <element factory_id="Internet" guid="9">
+                    <graphical_info height="100.0" width="100.0" x="8.0" y="211.0"/>
+                    <connections>
+                        <connection connector="devs" other_connector="inet" other_guid="16"/>
+                        <connection connector="devs" other_connector="inet" other_guid="11"/>
+                        <connection connector="devs" other_connector="inet" other_guid="12"/>
+                    </connections>
+                </element>
+                <element factory_id="Application" guid="10">
+                    <graphical_info height="100.0" width="100.0" x="374.0" y="-222.0"/>
+                    <attributes>
+                        <attribute name="buildDepends" type="STRING" value="libpcap-devel make gcc "/>
+                        <attribute name="sudo" type="BOOL" value="True"/>
+                        <attribute name="label" type="STRING" value="popi-srv"/>
+                        <attribute name="sources" type="STRING" value="popi-0.9.tar.gz"/>
+                        <attribute name="depends" type="STRING" value="libpcap"/>
+                       <attribute name="command" type="STRING" value="./popid -v -i {#[tap-srv].[if_name]#} -b 136/30002,6/30002,17/30002,1/30002"/>
+                        <attribute name="build" type="STRING" value="tar xzf ${SOURCES}/popi-0.9.tar.gz &amp;&amp; cd popi-0.9 &amp;&amp; ./configure --enable-debug --with-host=planetlab &amp;&amp; make"/>
+                        <attribute name="install" type="STRING" value="cp ./popi-0.9/popid ${SOURCES}"/>
+                    </attributes>
+                    <traces>
+                        <trace name="stderr"/>
+                        <trace name="stdout"/>
+                    </traces>
+                    <connections>
+                        <connection connector="node" other_connector="apps" other_guid="3"/>
+                    </connections>
+                </element>
+                <element factory_id="NodeInterface" guid="11">
+                    <graphical_info height="100.0" width="100.0" x="-355.87051993" y="67.7927863957"/>
+                    <factory_attributes>
+                        <factory_attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </factory_attributes>
+                    <attributes>
+                        <attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </attributes>
+                    <connections>
+                        <connection connector="node" other_connector="devs" other_guid="2"/>
+                        <connection connector="inet" other_connector="devs" other_guid="9"/>
+                    </connections>
+                </element>
+                <element factory_id="NodeInterface" guid="12">
+                    <graphical_info height="100.0" width="100.0" x="356.0" y="76.0"/>
+                    <factory_attributes>
+                        <factory_attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </factory_attributes>
+                    <attributes>
+                        <attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </attributes>
+                    <connections>
+                        <connection connector="node" other_connector="devs" other_guid="3"/>
+                        <connection connector="inet" other_connector="devs" other_guid="9"/>
+                    </connections>
+                </element>
+                <element factory_id="Node" guid="15">
+                    <graphical_info height="100.0" width="100.0" x="1.0" y="-216.0"/>
+                    <attributes>
+                        <attribute name="forward_X11" type="BOOL" value="False"/>
+                        <attribute name="operatingSystem" type="STRING" value="f12"/>
+                    </attributes>
+                    <connections>
+                        <connection connector="devs" other_connector="node" other_guid="16"/>
+                        <connection connector="devs" other_connector="node" other_guid="22"/>
+                        <connection connector="devs" other_connector="node" other_guid="23"/>
+                    </connections>
+                </element>
+                <element factory_id="NodeInterface" guid="16">
+                    <graphical_info height="100.0" width="100.0" x="6.0" y="72.0"/>
+                    <factory_attributes>
+                        <factory_attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </factory_attributes>
+                    <attributes>
+                        <attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </attributes>
+                    <connections>
+                        <connection connector="node" other_connector="devs" other_guid="15"/>
+                        <connection connector="inet" other_connector="devs" other_guid="9"/>
+                    </connections>
+                </element>
+                <element factory_id="TunInterface" guid="21">
+                    <graphical_info height="100.0" width="100.0" x="-255.0" y="-110.0"/>
+                    <factory_attributes>
+                        <factory_attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </factory_attributes>
+                    <attributes>
+                        <attribute name="up" type="BOOL" value="True"/>
+                        <attribute name="maxAddresses" type="INTEGER" value="1"/>
+                        <attribute name="label" type="STRING" value="tap-cli"/>
+                        <attribute name="bwlimit" type="INTEGER" value="256"/>
+                    </attributes>
+                    <addresses>
+                        <address Address="192.168.2.2" NetPrefix="27"/>
+                    </addresses>
+                    <connections>
+                        <connection connector="node" other_connector="devs" other_guid="2"/>
+                        <connection connector="udp" other_connector="udp" other_guid="22"/>
+                    </connections>
+                </element>
+                <element factory_id="TunInterface" guid="22">
+                    <graphical_info height="100.0" width="100.0" x="-56.0" y="-105.0"/>
+                    <factory_attributes>
+                        <factory_attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </factory_attributes>
+                    <attributes>
+                        <attribute name="up" type="BOOL" value="True"/>
+                        <attribute name="maxAddresses" type="INTEGER" value="1"/>
+                        <attribute name="bwlimit" type="INTEGER" value="256"/>
+                    </attributes>
+                    <addresses>
+                        <address Address="192.168.2.3" NetPrefix="27"/>
+                    </addresses>
+                    <connections>
+                        <connection connector="node" other_connector="devs" other_guid="15"/>
+                        <connection connector="udp" other_connector="udp" other_guid="21"/>
+                    </connections>
+                </element>
+                <element factory_id="TunInterface" guid="23">
+                    <graphical_info height="100.0" width="100.0" x="77.0" y="-104.0"/>
+                    <factory_attributes>
+                        <factory_attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </factory_attributes>
+                    <attributes>
+                        <attribute name="up" type="BOOL" value="True"/>
+                        <attribute name="maxAddresses" type="INTEGER" value="1"/>
+                        <attribute name="bwlimit" type="INTEGER" value="##bwlimit##"/>
+                    </attributes>
+                    <addresses>
+                        <address Address="192.168.2.34" NetPrefix="27"/>
+                    </addresses>
+                    <connections>
+                        <connection connector="node" other_connector="devs" other_guid="15"/>
+                        <connection connector="fd-&gt;" other_connector="-&gt;fd" other_guid="26"/>
+                    </connections>
+                </element>
+                <element factory_id="TunInterface" guid="24">
+                    <graphical_info height="100.0" width="100.0" x="264.0" y="-107.0"/>
+                    <factory_attributes>
+                        <factory_attribute name="maxAddresses" type="INTEGER" value="1"/>
+                    </factory_attributes>
+                    <attributes>
+                        <attribute name="up" type="BOOL" value="True"/>
+                        <attribute name="maxAddresses" type="INTEGER" value="1"/>
+                        <attribute name="label" type="STRING" value="tap-srv"/>
+                        <attribute name="bwlimit" type="INTEGER" value="256"/>
+                    </attributes>
+                    <addresses>
+                        <address Address="192.168.2.35" NetPrefix="27"/>
+                    </addresses>
+                    <connections>
+                        <connection connector="node" other_connector="devs" other_guid="3"/>
+                        <connection connector="udp" other_connector="udp" other_guid="26"/>
+                    </connections>
+                </element>
+                <element factory_id="ClassQueueFilter" guid="26">
+                    <graphical_info height="100.0" width="100.0" x="174.0" y="19.0"/>
+                    <attributes>
+                        <attribute name="args" type="STRING" value="size=500,classes=##classes##"/>
+                    </attributes>
+                    <traces>
+                        <trace name="dropped_stats"/>
+                    </traces>
+                    <connections>
+                        <connection connector="udp" other_connector="udp" other_guid="24"/>
+                        <connection connector="-&gt;fd" other_connector="fd-&gt;" other_guid="23"/>
+                    </connections>
+                </element>
+            </elements>
+        </testbed>
+    </testbeds>
+</experiment>
diff --git a/examples/POPI/run_one_experiment.py b/examples/POPI/run_one_experiment.py
new file mode 100644 (file)
index 0000000..0b94995
--- /dev/null
@@ -0,0 +1,103 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from nepi.core.execute import ExperimentController
+import os
+import re
+import time
+import commands
+import subprocess
+import collections
+import signal
+import traceback
+import shutil
+import sys
+import cPickle
+import gzip
+
+class PopiExperiment(object):
+    def run(self, duration, xml_filepath, testset, results_dir, iteration):
+        app_guid = 8
+
+        testset_dir = os.path.join(results_dir, testset)
+        
+        # create test results file
+        test_dir = os.path.join(testset_dir, str(iteration))
+
+        # replace results values in xml
+        replacements = cPickle.loads(os.environ['POPI_REPLACEMENTS'].strip().decode("base64"))
+        file = open(xml_filepath)
+        xml2 = xml = file.read()
+        file.close()
+
+        for key,value in replacements.iteritems():
+            xml2 = xml2.replace("##%s##" % (key,), value)
+
+        # launch experiment
+        controller = ExperimentController(xml2, results_dir)
+        
+        try:
+            controller.start()
+
+            t0 = time.time()
+            t1 = t0
+            while (t1-t0) < duration and not controller.is_finished(app_guid):
+                time.sleep(10)
+            
+            # download results
+            for testbed_guid, guids in controller.traces_info().iteritems():
+                for guid, traces in guids.iteritems():
+                    for name, data in traces.iteritems():
+                        path = data["filepath"]
+                        print >>sys.stderr, "Downloading trace", path
+                        
+                        filepath = os.path.join(test_dir, path)
+                        
+                        try:
+                            trace = controller.trace(guid, name)
+                        except:
+                            traceback.print_exc(file=sys.stderr)
+                            continue
+                        try:
+                            if not os.path.exists(os.path.dirname(filepath)):
+                                os.makedirs(os.path.dirname(filepath))
+                        except:
+                            traceback.print_exc(file=sys.stderr)
+                        
+                        try:
+                            if len(trace) >= 2**20:
+                                # Bigger than 1M, compress
+                                tracefile = gzip.GzipFile(filepath+".gz", "wb")
+                            else:
+                                tracefile = open(filepath,"wb")
+                            try:
+                                tracefile.write(trace)
+                            finally:
+                                tracefile.close()
+                        except:
+                            traceback.print_exc(file=sys.stderr)
+
+        finally:
+            # clean up
+            try:
+                controller.stop()
+            except:
+                pass
+            try:
+                controller.shutdown()
+            except:
+                pass
+
+    def results_append(self, file, testset, sta_pcap, ap_pcap):
+        line = "%s %s %s\n" % (testset, sta_pcap, ap_pcap)
+        file.write(line)
+
+if __name__ == '__main__':
+    experiment = PopiExperiment()
+    duration = int(sys.argv[1])
+    xml_filepath = sys.argv[2]
+    testset = sys.argv[3]
+    results_dir = sys.argv[4]
+    iteration = sys.argv[5]
+    experiment.run(duration, xml_filepath, testset, results_dir, iteration)
+
diff --git a/examples/POPI/run_popi_experiments.py b/examples/POPI/run_popi_experiments.py
new file mode 100644 (file)
index 0000000..dcb07e5
--- /dev/null
@@ -0,0 +1,180 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from nepi.core.execute import ExperimentController
+from optparse import OptionParser, SUPPRESS_HELP
+import collections
+import commands
+import os
+import shutil
+import signal
+import subprocess
+import sys
+import time
+import traceback
+import getpass
+import cPickle
+
+class PopiExample(object):
+    _testsets = dict({
+        "popi":  "./popi-tun-classfilter-2MB-q500-pl.xml",
+        "popi_hibw":  "./popi-tun-classfilter-2MB-q500-pl-hibw.xml",
+        })
+    
+    classes = {
+        'tcpx4' : 'udp:tcp*4:icmp:',
+        'icmpx4' : 'udp:tcp:icmp*4:',
+        'udpx4' : 'udp*4:tcp:icmp:',
+        'u1t4i16' : 'udp:tcp*4:icmp*16:',
+        'u4t4i16' : 'udp*4:tcp*4:icmp*16:',
+        'u1t16i16' : 'udp*4:tcp*16:icmp*16:',
+        'u1t1t1' : 'udp:tcp:icmp:',
+    }
+    
+    bwlimits = {
+        '32K' : '32',
+        '64K' : '64',
+        '128K' : '128',
+        '256K' : '256',
+        '384K' : '384',
+    #    '512K' : '512',
+    #    '768K' : '768',
+    #    '1M' : '1024',
+    #    '2M' : '2048',
+    }
+    
+    testsets = dict([
+        ("%s-%s-%s" % (tset,clsname,bwname), (xml, {'classes':cls, 'bwlimit':bw}))
+        for tset,xml in _testsets.iteritems()
+        for clsname,cls in classes.iteritems()
+        for bwname,bw in bwlimits.iteritems()
+    ])
+
+    def __init__(self):
+        usage = "usage: %prog -u user -t times -d results_dir -f remove -e experiment -s start"
+        parser = OptionParser(usage=usage)
+        parser.add_option("-u", "--user", dest="pluser", help="PlanetLab PLC user (email)", type="str")
+        parser.add_option("-p", "--pass", dest="plpass", help="PlanetLab PLC user (password) - leave empty for interactive prompt", type="str")
+        parser.add_option("-k", "--key", dest="plkey", help="PlanetLab PLC private key to use", type="str")
+        parser.add_option("-S", "--slice", dest="plslice", help="PlanetLab slice into which to deploy experiments", type="str")
+        parser.add_option("-t", "--times", dest="times", help="Number of times to run each scenario", type="int")
+        parser.add_option("-d", "--dir", dest="results_dir", help="Results directory", type="str")
+        parser.add_option("-f", "--remove", dest="remove", help="Remove previous results directory",  action="store_true", default=False)
+        parser.add_option("-e", "--experiment", dest="experiment", help="Experiment to execute [%s]" % ('|'.join(self._testsets.keys()),),  type="str")
+        parser.add_option("-s", "--start", dest="start", help="Start experiment at specific iteration",  type="int")
+        (options, args) = parser.parse_args()
+        
+        if not options.pluser:
+            print >>sys.stderr, "Must specify --user"
+            sys.exit(1)
+        else:
+            self.pluser = options.pluser
+            
+        if not options.plslice:
+            print >>sys.stderr, "Must specify --slice"
+            sys.exit(1)
+        else:
+            self.plslice = options.plslice
+            
+        if not options.plkey:
+            print >>sys.stderr, "Must specify --key"
+            sys.exit(1)
+        else:
+            self.plkey = options.plkey
+            
+        if not options.plpass:
+            self.plpass = getpass.getpass("Password for %s: " % (self.pluser,))
+            
+        self.times = options.times if options.times else 5
+        self.results_dir = options.results_dir if options.results_dir else "results"
+        self.remove = options.remove
+        if options.experiment:
+            if ',' in options.experiment:
+                options.experiment = options.experiment.split(',')
+            else:
+                options.experiment = [ options.experiment ]
+        else:
+            options.experiment = self.testsets.keys()
+        self.experiments = [x for x in options.experiment if x in self.testsets]
+        self.start = options.start if options.start else 0
+
+    def run(self):
+        duration = 3600
+
+        if self.remove:
+            try:
+                shutil.rmtree(self.results_dir)
+            except:
+                traceback.print_exc(file=sys.stderr)
+
+        try:
+            os.mkdir(self.results_dir)
+        except:
+            traceback.print_exc(file=sys.stderr)
+
+        for j,testset in enumerate(self.experiments):
+            xml_filepath, replacements = self.testsets[testset]
+            replacements = dict(replacements)
+            replacements['pluser'] = self.pluser
+            replacements['plpass'] = self.plpass
+            replacements['plslice'] = self.plslice
+            replacements['plkey'] = self.plkey
+            
+            for i in xrange(self.start, self.times):
+                testset_dir = os.path.join(self.results_dir, testset, str(i))
+                os.makedirs(testset_dir)
+
+                print >>sys.stderr, "%3d%% - " % ((j+i*1.0/(self.times-self.start))*100/len(self.experiments),), testset, "...",
+                
+                # launch experiment
+                command = "python run_one_experiment.py %d '%s' '%s' '%s' %d" % \
+                        (duration, xml_filepath, testset, self.results_dir, i)
+                # send by environment, we don't want passwords in the commandline
+                env = dict(os.environ)
+                env['POPI_REPLACEMENTS'] = cPickle.dumps(replacements,2).encode("base64").strip()
+                
+                for trials in xrange(5):
+                    logfile = open(os.path.join(testset_dir,"log"), "w")
+                    p = subprocess.Popen(
+                        command, 
+                        shell = True, 
+                        env = env,
+                        stdout = logfile,
+                        stderr = logfile,
+                        stdin = open("/dev/null","rb") )
+                    
+                    # we wait two time the estimated dirantion of the movie (120s)
+                    for i in xrange(0, duration * 2, 10):
+                        time.sleep(10)
+                        returncode = p.poll()
+                        if returncode is not None:
+                            break
+                    time.sleep(10)
+                    try:
+                        os.kill(p.pid, signal.SIGKILL)
+                    except:
+                        pass
+                    
+                    logfile.close()
+                    retfile = open(os.path.join(testset_dir,"retcode"), "w")
+                    if returncode:
+                        rettext = "FAIL %s" % (returncode,)
+                    else:
+                        rettext = "SUCCESS"
+                    retfile.write(rettext)
+                    retfile.close()
+
+                    print >>sys.stderr, rettext,
+                    
+                    if not returncode:
+                        print >>sys.stderr
+                        break
+                    else:
+                        time.sleep(60)
+                else:
+                    print >>sys.stderr, "Giving up"
+
+if __name__ == '__main__':
+    example = PopiExample()
+    example.run()
+
diff --git a/examples/POPI/run_popi_experiments.sh b/examples/POPI/run_popi_experiments.sh
new file mode 100755 (executable)
index 0000000..92ec590
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# description: run nef demo script 
+#
+
+PYTHONPATH="../../../nepi/src:../../../nepi/test/lib:../../../netns/src:../../../python-passfd/src:../../../python-unshare/src" python run_popi_experiments.py $*
+
+