Ejemplo n.º 1
0
    def connect(switch):
        """Connect to the switch and log in.

        Login using public key is untested on this switch.
        """
        console = _console.login(switch)

        # send a new line so that we can "expect" a prompt again if we already
        # matched when logged in using pubkey
        console.sendline('')
        prompts = _console.get_prompts(console)

        # create the dummy vlan for port_revert
        # this is a one time thing though; maybe we could remove this and let
        # the admin create the dummy vlan on the switch
        console.sendline('config')
        console.expect(prompts['config_prompt'])
        console.sendline('vlan ' + switch.dummy_vlan)
        console.sendline('exit')
        console.sendline('exit')
        console.expect(prompts['main_prompt'])

        return _DellN3000Session(switch=switch,
                                 dummy_vlan=switch.dummy_vlan,
                                 console=console,
                                 **prompts)
Ejemplo n.º 2
0
    def connect(switch):
        # connect to the switch, and log in:
        console = pexpect.spawn('telnet ' + switch.hostname)
        console.expect('User:'******'Password:'******'>')
        console.sendline('en')

        logger.debug('Logged in to switch %r', switch)

        prompts = _console.get_prompts(console)
        # create the dummy vlan for port_revert
        # this is a one time thing though; maybe we could remove this and let
        # the admin create the dummy vlan on the switch
        console.sendline('config')
        console.expect(prompts['config_prompt'])
        console.sendline('vlan ' + switch.dummy_vlan)
        console.sendline('exit')
        console.sendline('exit')
        console.expect(prompts['main_prompt'])

        return _DellN3000Session(switch=switch,
                                 dummy_vlan=switch.dummy_vlan,
                                 console=console,
                                 **prompts)
Ejemplo n.º 3
0
    def connect(switch):
        """Connect to the switch and log in.

        Login using public key is untested on this switch.
        """
        console = _console.login(switch)

        # send a new line so that we can "expect" a prompt again if we already
        # matched when logged in using pubkey
        console.sendline('')
        prompts = _console.get_prompts(console)

        # create the dummy vlan for port_revert
        # this is a one time thing though; maybe we could remove this and let
        # the admin create the dummy vlan on the switch
        console.sendline('config')
        console.expect(prompts['config_prompt'])
        console.sendline('vlan ' + switch.dummy_vlan)
        console.sendline('exit')
        console.sendline('exit')
        console.expect(prompts['main_prompt'])

        return _DellN3000Session(switch=switch,
                                 dummy_vlan=switch.dummy_vlan,
                                 console=console,
                                 **prompts)
Ejemplo n.º 4
0
Archivo: n3000.py Proyecto: shwsun/haas
    def connect(switch):
        # connect to the switch, and log in:
        console = pexpect.spawn('telnet ' + switch.hostname)
        console.expect('User:'******'Password:'******'>')
        console.sendline('en')

        logger.debug('Logged in to switch %r', switch)

        prompts = _console.get_prompts(console)
        # create the dummy vlan for port_revert
        # this is a one time thing though; maybe we could remove this and let
        # the admin create the dummy vlan on the switch
        console.sendline('config')
        console.expect(prompts['config_prompt'])
        console.sendline('vlan ' + switch.dummy_vlan)
        console.sendline('exit')
        console.sendline('exit')
        console.expect(prompts['main_prompt'])

        return _DellN3000Session(switch=switch,
                                 dummy_vlan=switch.dummy_vlan,
                                 console=console,
                                 **prompts)
Ejemplo n.º 5
0
    def connect(switch):
        console = pexpect.spawn('telnet ' + switch.hostname)
        console.expect('login: '******'Password: ')
        console.sendline(switch.password)

        prompts = _console.get_prompts(console)

        return _Session(console=console,
                        dummy_vlan=switch.dummy_vlan,
                        switch=switch,
                        **prompts)
Ejemplo n.º 6
0
Archivo: nexus.py Proyecto: shwsun/haas
    def connect(switch):
        console = pexpect.spawn('telnet ' + switch.hostname)
        console.expect('login: '******'Password: ')
        console.sendline(switch.password)

        prompts = _console.get_prompts(console)

        return _Session(console=console,
                        dummy_vlan=switch.dummy_vlan,
                        switch=switch,
                        **prompts)
Ejemplo n.º 7
0
    def connect(switch):
        """Connect to the switch."""

        console = _console.login(switch)

        # send a new line so that we can "expect" a prompt again if we already
        # matched when logged in using pubkey
        console.sendline('')
        prompts = _console.get_prompts(console)

        return _Session(console=console,
                        dummy_vlan=switch.dummy_vlan,
                        switch=switch,
                        **prompts)
Ejemplo n.º 8
0
    def connect(switch):
        """Connect to the switch."""

        console = _console.login(switch)

        # send a new line so that we can "expect" a prompt again if we already
        # matched when logged in using pubkey
        console.sendline('')
        prompts = _console.get_prompts(console)

        return _Session(console=console,
                        dummy_vlan=switch.dummy_vlan,
                        switch=switch,
                        **prompts)
Ejemplo n.º 9
0
    def connect(switch):
        # connect to the switch, and log in:
        console = pexpect.spawn('telnet ' + switch.hostname)
        console.expect('User Name:')
        console.sendline(switch.username)
        console.expect('Password:'******'Logged in to switch %r', switch)

        prompts = _console.get_prompts(console)
        return _PowerConnect55xxSession(switch=switch,
                                        console=console,
                                        **prompts)
Ejemplo n.º 10
0
    def connect(switch):
        """Connect to the switch."""
        console = pexpect.spawn(
            'ssh ' + switch.username + '@' + switch.hostname)

        console.expect('Password: ')
        console.sendline(switch.password)

        prompts = _console.get_prompts(console)

        return _Session(console=console,
                        dummy_vlan=switch.dummy_vlan,
                        switch=switch,
                        **prompts)
Ejemplo n.º 11
0
Archivo: dell.py Proyecto: mikelyy/hil
    def connect(switch):
        """connect to the switch, and log in."""

        console = _console.login(switch)

        # Send some string, so we expect the prompt again. Sending only new a
        # line doesn't work, it returns some unwanted ANSI sequences in
        # console.after
        # Eg; main_prompts looks like '\r\n\r\r\x1b[Kconsole#'
        # Here \x1b[K is unwanted and causes trouble parsing it.
        # Sending some other random string doesn't have this issue.
        console.sendline('some-unrecognized-command')
        prompts = _console.get_prompts(console)
        return _PowerConnect55xxSession(switch=switch,
                                        console=console,
                                        **prompts)
Ejemplo n.º 12
0
Archivo: dell.py Proyecto: CCI-MOC/hil
    def connect(switch):
        """connect to the switch, and log in."""

        console = _console.login(switch)

        # Send some string, so we expect the prompt again. Sending only new a
        # line doesn't work, it returns some unwanted ANSI sequences in
        # console.after
        # Eg; main_prompts looks like '\r\n\r\r\x1b[Kconsole#'
        # Here \x1b[K is unwanted and causes trouble parsing it.
        # Sending some other random string doesn't have this issue.
        console.sendline('some-unrecognized-command')
        prompts = _console.get_prompts(console)
        return _PowerConnect55xxSession(switch=switch,
                                        console=console,
                                        **prompts)
Ejemplo n.º 13
0
    def connect(switch):
        """connect to the switch, and log in."""

        console = pexpect.spawn('ssh ' + switch.username + '@' +
                                switch.hostname)
        # dell switch gets user name for the second time

        console.expect('User Name:')
        console.sendline(switch.username)
        console.expect('Password:'******'Logged in to switch %r', switch)

        prompts = _console.get_prompts(console)
        return _PowerConnect55xxSession(switch=switch,
                                        console=console,
                                        **prompts)