Changeset 10892 in genesis for tools/check-batch-cmd


Ignore:
Timestamp:
May 16, 2012, 10:49:54 PM (13 years ago)
Author:
rick
Message:

Doe een import van de bridge unit dmv een scan.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/check-batch-cmd

    r10434 r10892  
    1818import pysnmp
    1919from pysnmp.entity.rfc3413.oneliner import cmdgen
     20import netsnmp
    2021
    2122def snmp_test():
     
    109110    elif line.startswith('Elan-mmcr'):
    110111      datadump['board'] = 'net45xx'
    111   #for iface_key in datadump['autogen_iface_keys']:
    112   #  ifacedump = datadump[iface_key]
    113   #  if ifacedump.has_key('ns_ip') and ifacedump['ns_ip']:
    114   #    addr = ifacedump['ns_ip'].split('/')[0]
    115   #    print "## Bridge IP: %(ns_ip)s at %(interface)s" % ifacedump
    116   #    try:
    117   #      socket.create_connection((addr,80),2)
    118   #      bridge_type = get_bridge_type(addr)
    119   #      datadump[iface_key]['bridge_type'] = bridge_type
    120   #    except (socket.timeout, socket.error) as e:
    121   #      print "### %s (%s)" % (e, addr)
    122   #    except paramiko.AuthenticationException:
    123   #      print "### Conection failed (invalid username/password)"
    124   #    except CmdError, e:
    125   #      print "### Command error: %s" % e
     112  for iface_key in datadump['autogen_iface_keys']:
     113    ifacedump = datadump[iface_key]
     114    if ifacedump.has_key('ns_ip') and ifacedump['ns_ip']:
     115      addr = ifacedump['ns_ip'].split('/')[0]
     116      print "## Bridge IP: %(ns_ip)s at %(autogen_ifname)s" % ifacedump
     117      try:
     118        socket.create_connection((addr,80),2)
     119        bridge_type = get_bridge_type(addr)
     120        datadump[iface_key]['bridge_type'] = bridge_type
     121      except (socket.timeout, socket.error) as e:
     122        print "### %s (%s)" % (e, addr)
     123      except paramiko.AuthenticationException:
     124        print "### Conection failed (invalid username/password)"
     125      except CmdError, e:
     126        print "### Command error: %s" % e
    126127  gformat.store_yaml(datadump)
    127128
Note: See TracChangeset for help on using the changeset viewer.