示例#1
0
def test_hostinfo_get_all(declared_hostinfo):
    dev = SnmpHandler(host='1.1.1.1', version='2c', community='public')
    hostinfo = HostInfo(dev)
    hostinfo.get_all()
    assert hostinfo.description == 'Cisco Adaptive Security Appliance Version 9.3(2)2'
    assert hostinfo.contact == 'Networklore'
    assert hostinfo.location == 'Westeros'
    assert hostinfo.vendor == 'cisco'
    assert hostinfo.version == '9.3(2)2'
示例#2
0
def main():
    argparser = SnmpArgs(description)
    args = argparser.parser.parse_args()
    snmp = NelkitSnmp(args)
    hostinfo = HostInfo(snmp)
    hostinfo.get_all()
    print ('OS: %s' % hostinfo.os)
    print ('Version: %s' % hostinfo.version)
    print ('Vendor: %s' % hostinfo.vendor)
    print ('Description: %s' % hostinfo.description)
示例#3
0
def main():
    argparser = SnmpArgs(description)
    args = argparser.parser.parse_args()
    snmp = NelkitSnmp(args)
    hostinfo = HostInfo(snmp)
    hostinfo.get_all()
    print('OS: %s' % hostinfo.os)
    print('Version: %s' % hostinfo.version)
    print('Vendor: %s' % hostinfo.vendor)
    print('Description: %s' % hostinfo.description)
示例#4
0
def main():
    """run nk-snmp-deviceinfo."""
    argparser = SnmpArgs(description)
    args = argparser.parser.parse_args()
    snmp = NelkitSnmp(args)
    hostinfo = HostInfo(snmp)
    try:
        hostinfo.get_all()
        print('OS: %s' % hostinfo.os)
        print('Version: %s' % hostinfo.version)
        print('Vendor: %s' % hostinfo.vendor)
        print('Description: %s' % hostinfo.description)
    except Exception as e:
        print('ERROR: {0}'.format(e))