def _build_command(self):
        """
        Command to start the VPCS process.
        (to be passed to subprocess.Popen())

        VPCS command line:
        usage: vpcs [options] [scriptfile]
        Option:
            -h         print this help then exit
            -v         print version information then exit

            -i num     number of vpc instances to start (default is 9)
            -p port    run as a daemon listening on the tcp 'port'
            -m num     start byte of ether address, default from 0
            -r file    load and execute script file
                       compatible with older versions, DEPRECATED.

            -e         tap mode, using /dev/tapx by default (linux only)
            -u         udp mode, default

        udp mode options:
            -s port    local udp base port, default from 20000
            -c port    remote udp base port (dynamips udp port), default from 30000
            -t ip      remote host IP, default 127.0.0.1

        tap mode options:
            -d vm  device name, works only when -i is set to 1

        hypervisor mode option:
            -H port    run as the hypervisor listening on the tcp 'port'

          If no 'scriptfile' specified, vpcs will read and execute the file named
          'startup.vpc' if it exsits in the current directory.

        """

        command = [self._vpcs_path()]
        command.extend(["-p", str(self._internal_console_port)])  # listen to console port
        command.extend(["-m", str(self._manager.get_mac_id(self.id))])   # the unique ID is used to set the MAC address offset
        command.extend(["-i", "1"])  # option to start only one VPC instance
        command.extend(["-F"])  # option to avoid the daemonization of VPCS
        if self._vpcs_version >= parse_version("0.8b"):
            command.extend(["-R"])  # disable the relay feature of VPCS (starting with VPCS 0.8)
        else:
            log.warn("The VPCS relay feature could not be disabled because the VPCS version is below 0.8b")

        # use the local UDP tunnel to uBridge instead
        if not self._local_udp_tunnel:
            self._local_udp_tunnel = self._create_local_udp_tunnel()
        nio = self._local_udp_tunnel[0]
        if nio:

            if isinstance(nio, NIOUDP):
                # UDP tunnel
                command.extend(["-s", str(nio.lport)])  # source UDP port
                command.extend(["-c", str(nio.rport)])  # destination UDP port
                try:
                    command.extend(["-t", socket.gethostbyname(nio.rhost)])  # destination host, we need to resolve the hostname because VPCS doesn't support it
                except socket.gaierror as e:
                    raise VPCSError("Can't resolve hostname {}".format(nio.rhost))

            elif isinstance(nio, NIOTAP):
                # FIXME: remove old code
                # TAP interface
                command.extend(["-e"])
                command.extend(["-d", nio.tap_device])

        if self.script_file:
            command.extend([os.path.basename(self.script_file)])
        return command
def _build_command ( self ) : command = [ self . _vpcs_path ( ) ] command . extend ( [ "-p" , str ( self . _internal_console_port ) ] ) command . extend ( [ "-m" , str ( self . _manager . get_mac_id ( self . id ) ) ] ) command . extend ( [ "-i" , "1" ] ) command . extend ( [ "-F" ] ) if self . _vpcs_version >= parse_version ( "0.8b" ) : command . extend ( [ "-R" ] ) else : log . warn ( "The VPCS relay feature could not be disabled because the VPCS version is below 0.8b" ) if not self . _local_udp_tunnel : self . _local_udp_tunnel = self . _create_local_udp_tunnel ( ) nio = self . _local_udp_tunnel [ 0 ] if nio : if isinstance ( nio , NIOUDP ) : command . extend ( [ "-s" , str ( nio . lport ) ] ) command . extend ( [ "-c" , str ( nio . rport ) ] ) try : command . extend ( [ "-t" , socket . gethostbyname ( nio . rhost ) ] ) except socket . gaierror as e : raise VPCSError ( "Can't resolve hostname {}" . format ( nio . rhost ) ) elif isinstance ( nio , NIOTAP ) : command . extend ( [ "-e" ] ) command . extend ( [ "-d" , nio . tap_device ] ) if self . script_file : command . extend ( [ os . path . basename ( self . script_file ) ] ) return command
Command to start the VPCS process.
        (to be passed to subprocess.Popen())

        VPCS command line:
        usage: vpcs [options] [scriptfile]
        Option:
            -h         print this help then exit
            -v         print version information then exit

            -i num     number of vpc instances to start (default is 9)
            -p port    run as a daemon listening on the tcp 'port'
            -m num     start byte of ether address, default from 0
            -r file    load and execute script file
                       compatible with older versions, DEPRECATED.

            -e         tap mode, using /dev/tapx by default (linux only)
            -u         udp mode, default

        udp mode options:
            -s port    local udp base port, default from 20000
            -c port    remote udp base port (dynamips udp port), default from 30000
            -t ip      remote host IP, default 127.0.0.1

        tap mode options:
            -d vm  device name, works only when -i is set to 1

        hypervisor mode option:
            -H port    run as the hypervisor listening on the tcp 'port'

          If no 'scriptfile' specified, vpcs will read and execute the file named
          'startup.vpc' if it exsits in the current directory.