Uncommented node in examples/ccnx/planetlab_ccnx_unicast.py
[nepi.git] / examples / Multicast / multicast_experiment.py
old mode 100644 (file)
new mode 100755 (executable)
index e628547..0f93259
@@ -91,7 +91,7 @@ class PlanetLabMulticastOverlay:
         pl_desc.set_attribute_value("plcHost", plchost)
         pl_desc.set_attribute_value("tapPortBase", self.port_base)
         pl_desc.set_attribute_value("p2pDeployment", not self.no_p2p_deploy)
-        pl_desc.set_attribute_value("dedicatedSlice", True)
+        pl_desc.set_attribute_value("cleanProc", True)
         pl_desc.set_attribute_value("plLogLevel", "INFO")
         
         return pl_desc, exp_desc
@@ -141,13 +141,17 @@ class PlanetLabMulticastOverlay:
             r1.set_attribute_value("NextHop", nexthop)
         
         if mcast:
-            fwd = pl.create("MulticastForwarder")
-            fwd.enable_trace("stderr")
-            fwd.connector("node").connect(node1.connector("apps"))
             if mcastrouter:
+                fwd = pl.create("MulticastForwarder")
+                fwd.enable_trace("stderr")
+                fwd.connector("node").connect(node1.connector("apps"))
                 mrt = pl.create("MulticastRouter")
                 mrt.connector("fwd").connect(fwd.connector("router"))
                 mrt.enable_trace("stderr")
+            else:
+                ann = pl.create("MulticastAnnouncer")
+                ann.enable_trace("stderr")
+                ann.connector("node").connect(node1.connector("apps"))
                 
         return node1, iface1, tap1, tap1ip, inet
     
@@ -167,11 +171,11 @@ class PlanetLabMulticastOverlay:
         app.set_attribute_value("label","vlc_restreamer_%d" % (node.guid,))
         app.set_attribute_value("command",
             "sudo -S dbus-uuidgen --ensure ; "
-            "while true ; do if "
+            "while true ; do "
             "vlc -vvv -I dummy"
             " udp/ts://@239.255.12.42"
-            " --sout '#std{access=http,mux=ts,dst="+hostname+":8080}'"
-            " ; then break ; else sleep 5 ; fi ; done ")
+            " --sout '#std{access=http,mux=ts,dst=:8080}'"
+            " ; sleep 5 ; done ")
         return app
     
     def add_vlc_dumper(self, pl, node, hostname=None, labelprefix = "vlc_dumper", precmd = "sleep 5 ; "):
@@ -183,11 +187,12 @@ class PlanetLabMulticastOverlay:
         app.set_attribute_value("command",
             precmd+
             "sudo -S dbus-uuidgen --ensure ; "
-            "while true ; do if "
+            "cat /dev/null > {#["+mylabel+"].trace[output].[name]#} ; "
+            "while [[ $(stat -c '%s' {#["+mylabel+"].trace[output].[name]#}) == '0' ]] ; do "
             "vlc -vvv -I dummy"
-            " http://"+hostname+":8080"
+            " http://"+hostname+":8080 vlc://quit"
             " --sout '#std{access=file,mux=ts,dst={#["+mylabel+"].trace[output].[name]#}}'"
-            " ; then break ; else sleep 5 ; fi ; done ")
+            " ; sleep 5 ; done ")
         app.enable_trace("output")
         return app
     
@@ -529,20 +534,22 @@ class PlanetLabMulticastOverlay:
         ap_wifi, ap_phy = self.add_ns_wifi_dev(ns, ap_node, access_point = True)
         ap_phy.connector("chan").connect(wifi_chan.connector("phys"))
 
+        # Net range free for WiFi
+        wifi_net_prefix = 32-int(math.floor(math.log(256-nextip[0]&0xff) / math.log(2)))
+        wifi_net = vnet_i | (256 - (1<<(32-wifi_net_prefix)))
+
         # connect AP to PL
-        pl_addr = str(ipaddr.IPAddress(vnet_i | 254))
-        ns_addr = str(ipaddr.IPAddress(vnet_i | 253))
+        pl_addr = str(ipaddr.IPAddress(wifi_net | 1))
+        ns_addr = str(ipaddr.IPAddress(wifi_net | 2))
         self.add_pl_ns_connection(
             pl, pl_ns_root, pl_addr, 
             ns, ap_node, ns_addr, 
             fd = True, ptp = True, prefix=30)
 
-        wifi_net_prefix = 32-int(math.floor(math.log(256-nextip[0]&0xff) / math.log(2)))
-        wifi_net = vnet_i | (256 - (1<<(32-wifi_net_prefix)))
         
         # AP ip
-        ap_addr = str(ipaddr.IPAddress(vnet_i | 251))
-        ap_addr_prefix = 32-int(math.ceil(math.log(self.nsta+6) / math.log(2)))
+        ap_addr = str(ipaddr.IPAddress(vnet_i | 254))
+        ap_addr_prefix = 32-int(math.ceil(math.log(self.nsta+3) / math.log(2)))
         self.add_ip_address(ap_wifi, ap_addr, ap_addr_prefix)
         
         # route for PL->wifi
@@ -556,7 +563,7 @@ class PlanetLabMulticastOverlay:
         print " |                  R %s/%d --> %s" % (str(ipaddr.IPAddress(wifi_net)), wifi_net_prefix, ns_addr)
        
         nextpip = (vnet_i | 255) >> (32-ap_addr_prefix) << (32-ap_addr_prefix)
-        nextdip = vnet_i | 250
+        nextdip = vnet_i | 253
         ap_net = nextpip - (1<<(32-ap_addr_prefix))
         r = 50
         # STA nodes
@@ -606,7 +613,7 @@ class PlanetLabMulticastOverlay:
                 prefix = 30)
             
             self.add_vlc_dumper(pl, pl_nodei,
-                hostname = pl_addr2,
+                hostname = pl_addr,
                 labelprefix = "vlc_dumper_ns",
                 precmd = "sleep 15 ; ")