+
+ # Wait for pid file to be generated
+ pid, ppid = self.node.wait_pid(connection_run_home)
+
+ # If the process is not running, check for error information
+ # on the remote machine
+ if not pid or not ppid:
+ (out, err), proc = self.node.check_errors(connection_run_home)
+ # Out is what was written in the stderr file
+ if err:
+ msg = " Failed to start command '%s' " % command
+ self.error(msg, out, err)
+ raise RuntimeError, msg
+
+ return pid, ppid
+
+ def _udp_connect_command(self, remote_endpoint, connection_run_home,
+ cipher, cipher_key, bwlimit, txqueuelen):
+
+ # Set the remote endpoint
+ self.set("pointopoint", remote_endpoint.get("ip4"))
+
+ remote_ip = socket.gethostbyname(
+ remote_endpoint.node.get("hostname"))
+
+ 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 pl-vif-up.py script to configure TAP with peer info
+ vif_up_command = self._vif_up_command
+
+ command = ["( "]
+ command.append(vif_up_command)
+
+ # 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)
+ command.append("-S %s " % self.sock_name)
+ command.append("-l %s " % local_port_file)
+ command.append("-r %s " % remote_port_file)
+ command.append("-H %s " % remote_ip)
+ command.append("-R %s " % ret_file)
+ 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.append(")")
+
+ command = " ".join(command)
+ command = self.replace_paths(command)
+
+ return command
+
+ def _gre_connect_command(self, remote_endpoint, connection_run_home):
+ # Set the remote endpoint
+ self.set("pointopoint", remote_endpoint.get("ip4"))
+ self.set("greRemote", socket.gethostbyname(
+ remote_endpoint.node.get("hostname")))
+
+ # Generate GRE connect command
+
+ # Use vif_down command to first kill existing TAP in GRE mode
+ vif_down_command = self._vif_down_command
+
+ # Use pl-vif-up.py script to configure TAP with peer info
+ vif_up_command = self._vif_up_command
+
+ command = ["("]
+ command.append(vif_down_command)
+ command.append(") ; (")
+ command.append(vif_up_command)
+ command.append(")")