Ejemplo n.º 1
0
def test_cisco_connect():
    """ Check that connection funtion returns expected hostname
    """
    device = "1.1.1.2"
    username = "******"
    password = "******"
    hostname = crassh.connect(device, username, password)
    crassh.disconnect()
    assert hostname == "r1"
Ejemplo n.º 2
0
def test_cisco_connect():
    """ Check that connection funtion returns expected hostname
    """
    device = "1.1.1.2"
    username = "******"
    password = "******"
    hostname = crassh.connect(device, username, password)
    crassh.disconnect()
    assert hostname == "r1"
Ejemplo n.º 3
0
def test_cisco_connect_enable():
    """ Check that connection funtion returns expected hostname
    """
    device = "1.1.1.2"
    username = "******"
    password = "******"
    enable = True
    enable_password = "******"
    hostname = crassh.connect(device, username, password, enable, enable_password)
    crassh.disconnect()
    assert hostname == "r1"
Ejemplo n.º 4
0
def test_cisco_connect_enable():
    """ Check that connection funtion returns expected hostname
    """
    device = "1.1.1.2"
    username = "******"
    password = "******"
    enable = True
    enable_password = "******"
    hostname = crassh.connect(device, username, password, enable,
                              enable_password)
    crassh.disconnect()
    assert hostname == "r1"
Ejemplo n.º 5
0
def switch_main_cisco_to_primary():
    hostname = crassh.connect(config.main_cisco, config.username, config.password)
    crassh.send_command("conf t", hostname)
    output = crassh.send_command("hostname CSR-TEST1-Primary", hostname, 1)
    crassh.disconnect()
Ejemplo n.º 6
0
cmd01 = "show running-config"

# user need Enablepass, Not work in this lab because default enable=False
""" 
username = "******"
password = "******"
cmd01 = "show running-config"
** need to set option `enable=True` see pyw32.py 
"""

try:
    hostname = crassh.connect(router, username, password)
    print("Connected device %s [%s]" % (hostname, router))
    output = crassh.send_command(cmd01, hostname)
    print(output)
    crassh.disconnect()

except:
    print("Can not connect to [%s]" % router)
""" Output
Connecting to 10.0.1.22 ...
Connected device MNR-RT2 [10.0.1.22]
show running-config
Building configuration...

Current configuration : 1348 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption