예제 #1
0
    def open(self):
        """
        Open an ssh-client connection and issue the 'start shell' command to
        drop into the Junos shell (csh).  This process opens a
        :class:`paramiko.SSHClient` instance.
        """
        self._client = open_ssh_client(dev=self._nc)
        self._chan = self._client.invoke_shell()

        got = self.wait_for(r"(%|>|#|\$)")
        if got[-1].endswith(_JUNOS_PROMPT):
            self.send("start shell")
            self.wait_for(_SHELL_PROMPT)
예제 #2
0
    def open(self, **scpargs):
        """
        Creates an instance of the scp object and return to caller for use.

        .. note:: This method uses the same username/password authentication
                   credentials as used by :class:`jnpr.junos.device.Device`.
                   It can also use ``ssh_private_key_file`` option if provided
                   to the :class:`jnpr.junos.device.Device`

        :returns: SCPClient object
        """
        self._ssh = open_ssh_client(junos=self._junos)
        return SCPClient(self._ssh.get_transport(), **scpargs)
예제 #3
0
    def open(self, **scpargs):
        """
        Creates an instance of the scp object and return to caller for use.

        .. note:: This method uses the same username/password authentication
                   credentials as used by :class:`jnpr.junos.device.Device`.
                   It can also use ``ssh_private_key_file`` option if provided
                   to the :class:`jnpr.junos.device.Device`

        :returns: SCPClient object
        """
        self._ssh = open_ssh_client(junos=self._junos)
        return SCPClient(self._ssh.get_transport(), **scpargs)
예제 #4
0
    def open(self, **scpargs):
        """
        Creates an instance of the scp object and return to caller for use.

        .. note:: This method uses the same username/password authentication
                   credentials as used by :class:`jnpr.junos.device.Device`.
                   It can also use ``ssh_private_key_file`` option if provided
                   to the :class:`jnpr.junos.device.Device`

        :returns: SCPClient object
        """
        # @@@ should check for multi-calls to connect to ensure we don't keep
        # @@@ opening new connections
        self._ssh = open_ssh_client(dev=self._junos)
        return SCPClient(self._ssh.get_transport(), **scpargs)
예제 #5
0
    def open(self):
        """
        Open an ssh-client connection and issue the 'start shell' command to
        drop into the Junos shell (csh).  This process opens a
        :class:`paramiko.SSHClient` instance.
        """
        if self.ON_JUNOS is True:
            self._chan = subprocess.Popen(
                ["cli", "start", "shell"],
                shell=False,
                stdin=subprocess.PIPE,
                stdout=subprocess.PIPE,
            )
        else:
            self._client = open_ssh_client(dev=self._nc)
            self._chan = self._client.invoke_shell()

            got = self.wait_for(r"(%|>|#|\$)")
            if got[-1].endswith(_JUNOS_PROMPT):
                self.send("start shell")
                self.wait_for(_SHELL_PROMPT)