예제 #1
0
    def test_changing_default_connect_timeout(self, open_channel_method_mock):
        shell.default_connect_timeout = 60

        SshClient(**self._get_some_credentials())
        self.assertEqual(60, open_channel_method_mock.call_args[0][4])

        shell.default_connect_timeout = 120

        SshClient(**self._get_some_credentials())
        self.assertEqual(120, open_channel_method_mock.call_args[0][4])
예제 #2
0
    def test_changing_default_command_timeout(self):
        shell.base.default_command_timeout = 300

        ssh = SshClient(**self._get_some_credentials())
        self.assertEqual(300, ssh.command_timeout)

        shell.default_command_timeout = 600

        ssh2 = SshClient(**self._get_some_credentials())
        self.assertEqual(600, ssh2.command_timeout)
예제 #3
0
파일: cisco.py 프로젝트: simon-begin/netman
    def _connect(self):
        params = dict(
            host=self.switch_descriptor.hostname,
            username=self.switch_descriptor.username,
            password=self.switch_descriptor.password,
        )
        if self.switch_descriptor.port:
            params["port"] = self.switch_descriptor.port

        self.ssh = SshClient(**params)

        if self.ssh.get_current_prompt().endswith(">"):
            self.ssh.do("enable", wait_for=": ")
            self.ssh.do(self.switch_descriptor.password)

        self.ssh.do("terminal length 0")
        self.ssh.do("terminal width 0")