From: Claudio-Daniel Freire Date: Thu, 19 May 2011 16:07:00 +0000 (+0200) Subject: PL Point-to-point link support (TUNs automatically set their interfaces for P2P,... X-Git-Tag: nepi_v2~16 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=f19c2b3ea59f12b0e9d18c5df87456a312e93315;p=nepi.git PL Point-to-point link support (TUNs automatically set their interfaces for P2P, but there's also a way to manually specify it) It needs support from vsys --- diff --git a/src/nepi/testbeds/planetlab/interfaces.py b/src/nepi/testbeds/planetlab/interfaces.py index 671b6ade..1f9ad303 100644 --- a/src/nepi/testbeds/planetlab/interfaces.py +++ b/src/nepi/testbeds/planetlab/interfaces.py @@ -120,6 +120,7 @@ class TunIface(object): self.mtu = None self.snat = False self.txqueuelen = None + self.pointopoint = None # Enabled traces self.capture = False diff --git a/src/nepi/testbeds/planetlab/metadata_v01.py b/src/nepi/testbeds/planetlab/metadata_v01.py index 7913a265..cbb736ab 100644 --- a/src/nepi/testbeds/planetlab/metadata_v01.py +++ b/src/nepi/testbeds/planetlab/metadata_v01.py @@ -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" ], diff --git a/src/nepi/testbeds/planetlab/scripts/tun_connect.py b/src/nepi/testbeds/planetlab/scripts/tun_connect.py index f8a637ca..4950dec1 100644 --- a/src/nepi/testbeds/planetlab/scripts/tun_connect.py +++ b/src/nepi/testbeds/planetlab/scripts/tun_connect.py @@ -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() diff --git a/src/nepi/testbeds/planetlab/tunproto.py b/src/nepi/testbeds/planetlab/tunproto.py index 3b762e66..9a12cec8 100644 --- a/src/nepi/testbeds/planetlab/tunproto.py +++ b/src/nepi/testbeds/planetlab/tunproto.py @@ -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: