示例#1
0
def ssh_main():
    """Process show version using SSH."""
    ip = raw_input("Enter IP Address: ")
    username = '******'
    password = getpass()

    test_device = NetworkDevice(ip, username, password)

    (remote_conn_pre, remote_conn,
     _) = ssh.establish_connection(ip, username, password)
    ssh.disable_paging(remote_conn)
    remote_conn.send("\n")
    remote_conn.send("show version\n")

    # Read the output from the 'show version' command
    test_device.show_version = ssh.read_ssh_data(remote_conn)
    remote_conn_pre.close()
    process_show_version(test_device)

    # Print to stdout for verification
    net_device_verification(test_device)

    # Write object to a file
    with open('ssh_file.pkl', 'wb') as f:
        pickle.dump(test_device, f)
示例#2
0
def ssh_main():
    '''
    Process show version using SSH
    '''

    ip = '10.220.88.1'
    username = '******'
    password = '******'

    test_device = NetworkDevice(ip, username, password)

    (remote_conn_pre, remote_conn,
     output) = ssh.establish_connection(ip, username, password)
    output = ssh.disable_paging(remote_conn)

    remote_conn.send("\n")
    remote_conn.send("show version\n")

    # Read the output from the 'show version' command
    test_device.show_version = ssh.read_ssh_data(remote_conn)

    remote_conn_pre.close()
    process_show_version(test_device)

    # Print to stdout for verification
    net_device_verification(test_device)

    # Write object to a file
    with open('ssh_file.pkl', 'wb') as f:
        pickle.dump(test_device, f)
示例#3
0
文件: main_program.py 项目: 13X/pynet
def ssh_main():
    '''
    Process show version using SSH
    '''

    ip = '10.220.88.1'
    username = '******'
    password = '******'

    test_device = NetworkDevice(ip, username, password)

    (remote_conn_pre, remote_conn, output) = ssh.establish_connection(ip, username, password)
    output = ssh.disable_paging(remote_conn)

    remote_conn.send("\n")
    remote_conn.send("show version\n")

    # Read the output from the 'show version' command
    test_device.show_version = ssh.read_ssh_data(remote_conn)

    remote_conn_pre.close()
    process_show_version(test_device)

    # Print to stdout for verification
    net_device_verification(test_device)

    # Write object to a file
    with open('ssh_file.pkl', 'wb') as f:
        pickle.dump(test_device, f)
示例#4
0
def ssh_main():
    """Process show version using SSH."""
    ip = raw_input("Enter IP Address: ")
    username = '******'
    password = getpass()

    test_device = NetworkDevice(ip, username, password)

    (remote_conn_pre, remote_conn, _) = ssh.establish_connection(ip, username, password)
    ssh.disable_paging(remote_conn)
    remote_conn.send("\n")
    remote_conn.send("show version\n")

    # Read the output from the 'show version' command
    test_device.show_version = ssh.read_ssh_data(remote_conn)
    remote_conn_pre.close()
    process_show_version(test_device)

    # Print to stdout for verification
    net_device_verification(test_device)

    # Write object to a file
    with open('ssh_file.pkl', 'wb') as f:
        pickle.dump(test_device, f)