From 0fb87d99cce02d9806a4557459e279d96a975b08 Mon Sep 17 00:00:00 2001 From: Alina Quereilhac Date: Mon, 28 Jul 2014 19:09:30 +0200 Subject: [PATCH] Omitting explicit setting of pointopoint attribute for PlanetLab TAP/TUN devices --- .../resources/planetlab/scripts/pl-vif-up.py | 2 +- src/nepi/resources/planetlab/tap.py | 19 +++++++++++++++++-- test/resources/planetlab/udptunnel.py | 4 ---- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/nepi/resources/planetlab/scripts/pl-vif-up.py b/src/nepi/resources/planetlab/scripts/pl-vif-up.py index 6805e31a..f6a8a98e 100644 --- a/src/nepi/resources/planetlab/scripts/pl-vif-up.py +++ b/src/nepi/resources/planetlab/scripts/pl-vif-up.py @@ -86,7 +86,7 @@ def get_options(): if __name__ == '__main__': (vif_name, vif_type, ip4_address, net_prefix, snat, pointopoint, - pointopoint, txqueuelen, gre_key, gre_remote) = get_options() + txqueuelen, gre_key, gre_remote) = get_options() if (gre_key): import pwd diff --git a/src/nepi/resources/planetlab/tap.py b/src/nepi/resources/planetlab/tap.py index fd4df486..bbfa85a6 100644 --- a/src/nepi/resources/planetlab/tap.py +++ b/src/nepi/resources/planetlab/tap.py @@ -284,7 +284,21 @@ class PlanetlabTap(LinuxApplication): ret_file = os.path.join(connection_run_home, "ret_file") - command = ["sudo -S "] + # Use pl-vif-up.py script to configure TAP with peer info + command = ["( sudo -S "] + command.append("PYTHONPATH=$PYTHONPATH:${SRC}") + command.append("python ${SRC}/pl-vif-up.py") + command.append("-N %s" % self.get("deviceName")) + command.append("-t %s" % self.vif_type) + command.append("-a %s" % self.get("ip4")) + command.append("-n %d" % self.get("prefix4")) + if self.get("snat") == True: + command.append("-s") + command.append("-p %s" % remote_endpoint.get("ip4")) + + # Use pl-vid-udp-connect.py to stablish the tunnel between endpoints + command.append(") & (") + command.append("sudo -S") command.append("PYTHONPATH=$PYTHONPATH:${SRC}") command.append("python ${SRC}/pl-vif-udp-connect.py") command.append("-t %s" % self.vif_type) @@ -302,10 +316,11 @@ class PlanetlabTap(LinuxApplication): if bwlimit: command.append("-b %s " % bwlimit) + command.append(")") + command = " ".join(command) command = self.replace_paths(command) - # TODO: RECONFIGUTE THE TAP WITH THE INFORMATION ENDPOINT! return command @property diff --git a/test/resources/planetlab/udptunnel.py b/test/resources/planetlab/udptunnel.py index 6b767fa3..36915ac0 100755 --- a/test/resources/planetlab/udptunnel.py +++ b/test/resources/planetlab/udptunnel.py @@ -52,7 +52,6 @@ class UdpTunnelTestCase(unittest.TestCase): tap1 = ec.register_resource("PlanetlabTap") ec.set(tap1, "ip4", "%s.1" % self.netblock) - ec.set(tap1, "pointopoint", "%s.2" % self.netblock) ec.set(tap1, "prefix4", 24) ec.register_connection(tap1, node1) @@ -65,7 +64,6 @@ class UdpTunnelTestCase(unittest.TestCase): tap2 = ec.register_resource("PlanetlabTap") ec.set(tap2, "ip4", "%s.2" % self.netblock) - ec.set(tap2, "pointopoint", "%s.1" % self.netblock) ec.set(tap2, "prefix4", 24) ec.register_connection(tap2, node2) @@ -108,7 +106,6 @@ class UdpTunnelTestCase(unittest.TestCase): tun1 = ec.register_resource("PlanetlabTun") ec.set(tun1, "ip4", "%s.1" % self.netblock) - ec.set(tun1, "pointopoint", "%s.2" % self.netblock) ec.set(tun1, "prefix4", 24) ec.register_connection(tun1, node1) @@ -121,7 +118,6 @@ class UdpTunnelTestCase(unittest.TestCase): tun2 = ec.register_resource("PlanetlabTun") ec.set(tun2, "ip4", "%s.2" % self.netblock) - ec.set(tun2, "pointopoint", "%s.1" % self.netblock ) ec.set(tun2, "prefix4", 24) ec.register_connection(tun2, node2) -- 2.43.0