PL Point-to-point link support (TUNs automatically set their interfaces for P2P,...
authorClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Thu, 19 May 2011 16:07:00 +0000 (18:07 +0200)
committerClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Thu, 19 May 2011 16:07:00 +0000 (18:07 +0200)
It needs support from vsys

src/nepi/testbeds/planetlab/interfaces.py
src/nepi/testbeds/planetlab/metadata_v01.py
src/nepi/testbeds/planetlab/scripts/tun_connect.py
src/nepi/testbeds/planetlab/tunproto.py

index 671b6ad..1f9ad30 100644 (file)
@@ -120,6 +120,7 @@ class TunIface(object):
         self.mtu = None
         self.snat = False
         self.txqueuelen = None
+        self.pointopoint = None
         
         # Enabled traces
         self.capture = False
index 7913a26..cbb736a 100644 (file)
@@ -711,6 +711,14 @@ attributes = dict({
                 "value": False,
                 "validation_function": validation.is_bool
             }),
+    "pointopoint":  dict({
+                "name": "pointopoint", 
+                "help": "If the interface is a P2P link, the remote endpoint's IP "
+                        "should be set on this attribute.",
+                "type": Attribute.STRING,
+                "flags": Attribute.DesignOnly,
+                "validation_function": validation.is_string
+            }),
     "txqueuelen":  dict({
                 "name": "mask", 
                 "help": "Transmission queue length (in packets)",
@@ -933,7 +941,7 @@ factories_info = dict({
             "configure_function": postconfigure_tuniface,
             "start_function": wait_tuniface,
             "box_attributes": [
-                "up", "device_name", "mtu", "snat",
+                "up", "device_name", "mtu", "snat", "pointopoint",
                 "txqueuelen",
                 "tun_proto", "tun_addr", "tun_port", "tun_key"
             ],
@@ -949,7 +957,7 @@ factories_info = dict({
             "configure_function": postconfigure_tuniface,
             "start_function": wait_tuniface,
             "box_attributes": [
-                "up", "device_name", "mtu", "snat",
+                "up", "device_name", "mtu", "snat", "pointopoint",
                 "txqueuelen",
                 "tun_proto", "tun_addr", "tun_port", "tun_key"
             ],
index f8a637c..4950dec 100644 (file)
@@ -246,6 +246,8 @@ def pl_vif_start(tun_path, tun_name):
     stdin.write(str(options.vif_mask)+"\n")
     if options.vif_snat:
         stdin.write("snat=1\n")
+    if options.vif_pointopoint:
+        stdin.write("pointopoint=%s\n" % (options.vif_pointopoint,))
     if options.vif_txqueuelen is not None:
         stdin.write("txqueuelen=%d\n" % (options.vif_txqueuelen,))
     stdin.close()
index 3b762e6..9a12cec 100644 (file)
@@ -134,6 +134,10 @@ class TunProtoBase(object):
         local_mask = local.netprefix
         local_snat = local.snat
         local_txq  = local.txqueuelen
+        local_p2p  = local.pointopoint
+        
+        if not local_p2p and hasattr(peer, 'address'):
+            local_p2p = peer.address
         
         if check_proto != peer_proto:
             raise RuntimeError, "Peering protocol mismatch: %s != %s" % (check_proto, peer_proto)
@@ -167,6 +171,8 @@ class TunProtoBase(object):
         
         if local_snat:
             args.append("-S")
+        if local_p2p:
+            args.extend(("-P",str(local_p2p)))
         if local_txq:
             args.extend(("-Q",str(local_txq)))
         if extra_args: