+ @property
+ def _stop_gre_command(self):
+ command = []
+ command.append("sudo -S modprobe -r ip_gre")
+ command.append("sudo -S ip link set down dev %s" % (
+ self.get("deviceName"),
+ ))
+ command.append("sudo -S ip link del dev %s" % (
+ self.get("deviceName"),
+ ))
+
+ return ";".join(command)
+
+ def _udp_connect_command(self, remote_endpoint,
+ connection_app_home, connection_run_home,
+ cipher, cipher_key, bwlimit, txqueuelen):
+
+ # Set the remote endpoint to the IP of the device
+ self.set("pointopoint", remote_endpoint.get("ip"))
+
+ # Public IP of the remote NODE to stablish tunnel
+ remote_ip = remote_endpoint.node.get("ip")
+ local_ip = self.node.get("ip")
+
+ local_port_file = os.path.join(connection_run_home,
+ "local_port")
+
+ remote_port_file = os.path.join(connection_run_home,
+ "remote_port")
+
+ ret_file = os.path.join(connection_run_home,
+ "ret_file")
+
+ # Generate UDP connect command
+ # Use the start command to configure TAP with peer info
+ start_command = self._start_command
+
+ command = [""]
+ # Use pl-vid-udp-connect.py to stablish the tunnel between endpoints
+ command.append("sudo -S")
+ command.append("PYTHONPATH=$PYTHONPATH:${SRC}")
+ command.append("python ${SRC}/linux-udp-connect.py")
+ command.append("-t %s" % self.vif_type)
+ command.append("-S %s " % self.sock_name)
+ command.append("-p %s " % local_port_file)
+ command.append("-P %s " % remote_port_file)
+ command.append("-o %s " % local_ip)
+ command.append("-O %s " % remote_ip)
+ command.append("-R %s " % ret_file)
+ if self.get("pi"):
+ command.append("-n")
+ if cipher:
+ command.append("-c %s " % cipher)
+ if cipher_key:
+ command.append("-k %s " % cipher_key)
+ if txqueuelen:
+ command.append("-q %s " % txqueuelen)
+ if bwlimit:
+ command.append("-b %s " % bwlimit)
+
+ command = " ".join(command)
+ command = self.replace_paths(command)
+
+ return command
+
+ @property
+ def _dependencies(self):
+ return "mercurial make gcc"
+
+ @property
+ def _install(self):
+ # Install python-vsys and python-passfd
+ install_passfd = ( " ( python -c 'import passfd' ) "
+ " || "
+ " ( "
+ " cd ${SRC} ; "
+ " hg clone http://nepi.inria.fr/code/python-passfd ; "
+ " cd python-passfd ; "
+ " make all ; "
+ " sudo -S make install "
+ " )" )
+
+ return install_passfd
+
+ def valid_connection(self, guid):
+ # TODO: Validate!
+ return True
+