- def _start_script(self):
- return ( "import vsys, time, os \n"
- "(fd, if_name) = vsys.fd_tuntap(vsys.%(devtype)s)\n"
- "vsys.vif_up(if_name, '%(ip)s', %(prefix)s%(snat)s%(pointopoint)s)\n"
- "f = open('%(if_name_file)s', 'w')\n"
- "f.write(if_name)\n"
- "f.close()\n\n"
- "f = open('%(if_stop_file)s', 'w')\n"
- "f.close()\n\n"
- "while os.path.exists('%(if_stop_file)s'):\n"
- " time.sleep(2)\n"
- ) % ({
- "devtype": self._vif_type,
- "ip": self.get("ip4"),
- "prefix": self.get("prefix4"),
- "snat": ", snat=True" if self.get("snat") else "",
- "pointopoint": ", pointopoint=%s" % self.get("pointopoint") \
- if self.get("pointopoint") else "",
- "if_name_file": os.path.join(self.run_home, "if_name"),
- "if_stop_file": os.path.join(self.run_home, "if_stop"),
- })
+ def _stop_command(self):
+ command = ["sudo -S python ${SRC}/pl-vif-stop.py"]
+
+ command.append("-S %s " % self.sock_name)
+ return " ".join(command)