The unified diff between revisions [eb1440d9..] and [6364f075..] is displayed below. It can also be downloaded as a raw diff.
#
#
# add_file "tables/adjacency.csv"
# content [861c88bdae06e933c547f725ee3a33394dd85e6e]
#
# add_file "tables/ethernet_vlans.csv"
# content [ca46781abfd80ff2dfb7d265d2d09489f0c8c436]
#
# add_file "tables/interfaces.csv"
# content [bb56302f6893dd9977ef192c319117208e361e09]
#
# add_file "tables/ip_addresses.csv"
# content [4a2e47baf26615242696e40dafc74c578facf850]
#
# add_file "tables/ip_arp.csv"
# content [c77b49090c461e8ee6d4025e1292f70861c5f678]
#
# add_file "tables/ip_routing.csv"
# content [23816e18c6971526c40bcac8b0cffe4794171dd6]
#
# patch "plugins/basic_snmp.py"
# from [fb0fb2d026d99c1259a12ad5003a3a75eeacbc1e]
# to [b1a5c576594e6e78dcfd217c4d96f67ede54f12c]
#
# patch "plugins/cisco_ios.py"
# from [0b3dc43befd7a56156d092305ac3cc62968f9327]
# to [95b2e65cd99a63cdff98a4e12fbab2d976dc9478]
#
# patch "yowie.py"
# from [7b6a0cb3235f0229a909686791a0fb28738e5685]
# to [ed3480915d645765aa989b4e88e66da2b195c417]
#
============================================================
--- tables/adjacency.csv 861c88bdae06e933c547f725ee3a33394dd85e6e
+++ tables/adjacency.csv 861c88bdae06e933c547f725ee3a33394dd85e6e
@@ -0,0 +1 @@
+"zone","device","connected_interface","device_interface_description","device_address_type","device_address"
============================================================
--- tables/ethernet_vlans.csv ca46781abfd80ff2dfb7d265d2d09489f0c8c436
+++ tables/ethernet_vlans.csv ca46781abfd80ff2dfb7d265d2d09489f0c8c436
@@ -0,0 +1 @@
+"zone","vlan","description"
============================================================
--- tables/interfaces.csv bb56302f6893dd9977ef192c319117208e361e09
+++ tables/interfaces.csv bb56302f6893dd9977ef192c319117208e361e09
@@ -0,0 +1 @@
+"zone","interface","name","admin_status","oper_status","mtu","ethernet_address","speed"
============================================================
--- tables/ip_addresses.csv 4a2e47baf26615242696e40dafc74c578facf850
+++ tables/ip_addresses.csv 4a2e47baf26615242696e40dafc74c578facf850
@@ -0,0 +1 @@
+"zone","ip_address","interface"
============================================================
--- tables/ip_arp.csv c77b49090c461e8ee6d4025e1292f70861c5f678
+++ tables/ip_arp.csv c77b49090c461e8ee6d4025e1292f70861c5f678
@@ -0,0 +1 @@
+"zone","vlan","ethernet_address","ip_address"
============================================================
--- tables/ip_routing.csv 23816e18c6971526c40bcac8b0cffe4794171dd6
+++ tables/ip_routing.csv 23816e18c6971526c40bcac8b0cffe4794171dd6
@@ -0,0 +1 @@
+"zone","route_type","interface_id","is_null_route","network","via","metric"
============================================================
--- plugins/basic_snmp.py fb0fb2d026d99c1259a12ad5003a3a75eeacbc1e
+++ plugins/basic_snmp.py b1a5c576594e6e78dcfd217c4d96f67ede54f12c
@@ -15,11 +15,27 @@ that exports the required MIBs.
'''
}
+def interfaces(table_name, table_io, device):
+ ifaces = {}
+ for oid, type, value in snmpwalk(device.device_name, device.config['community'], "2c", ".interfaces", ssh_dest=device.config.get('ssh')):
+ current_row = int(oid[-1])
+ row_name = oid[-2]
+ colon = row_name.rfind(':')
+ if colon <> -1:
+ row_name = row_name[colon+1:]
+ if not ifaces.has_key(current_row):
+ ifaces[current_row] = {}
+ ifaces[current_row][row_name] = value
+ for interface in ifaces:
+ yield device.config['zone'], interface, ifaces[interface].get('ifDescr'), ifaces[interface].get('ifAdminStatus'), \
+ ifaces[interface].get('ifOperStatus'), ifaces[interface].get('ifMtu'), \
+ normalise_ethernet_address(ifaces[interface].get('ifPhysAddress')), ifaces[interface].get('ifSpeed')
+
def ip_arp(table_name, table_io, device):
for oid, type, value in snmpwalk(device.device_name, device.config['community'], "2c", "IP-MIB::ipNetToMediaPhysAddress", ssh_dest=device.config.get('ssh')):
ip_address = '.'.join(oid[-4:])
mac_address = value
- yield device.config['zone'], None, mac_address, ip_address
+ yield device.config['zone'], None, normalise_ethernet_address(mac_address), ip_address
def ip_routing(table_name, table_io, device):
routes = {}
@@ -63,6 +79,7 @@ tables = {
yield device.config['zone'], ip, interface
tables = {
+ 'interfaces' : interfaces,
'ip_addresses' : ip_addresses,
'ip_arp' : ip_arp,
'ip_routing' : ip_routing,
============================================================
--- plugins/cisco_ios.py 0b3dc43befd7a56156d092305ac3cc62968f9327
+++ plugins/cisco_ios.py 95b2e65cd99a63cdff98a4e12fbab2d976dc9478
@@ -8,6 +8,9 @@ network_protocol = { '1' : 'ip', '2' : '
# http://tools.cisco.com/Support/SNMP/do/BrowseMIB.do?local=en&step=2&mibName=CISCO-TC-V1SMI
network_protocol = { '1' : 'ip', '2' : 'decnet', '3' : 'pup', '4' : 'chaos', '5' : 'xna', '6' : 'x121', '7' : 'appletalk', '8' : 'clns', '9' : 'lat', '10' : 'vines', '11' : 'cons', '12' : 'apollo', '13' : 'stun', '14' : 'novell', '15' : 'qllc', '16' : 'snapshot', '17' : 'atmIlmi', '18' : 'bstun', '19' : 'x25pvc', '20' : 'ipv6', '21' : 'cdm', '22' : 'nbf', '23' : 'bpxIgx', '24' : 'clnsPfx', '25' : 'http' }
+# skip these VLANs (1002..1005)
+skip_vlans = ('1002', '1003', '1004', '1005')
+
# http://tools.cisco.com/Support/SNMP/do/BrowseMIB.do?local=en&mibName=CISCO-CDP-MIB
def adjacency(table_name, table_io, device):
def to_ipaddr(s):
@@ -76,6 +79,8 @@ def ethernet_forwarding(table_name, tabl
return rv
for vlan in vlans:
+ if vlan in skip_vlans:
+ continue
log("retrieving vlan forwarding table for : %s" % (vlan))
uid_to_mac = get_uid_to_mac(vlan)
uid_to_bridgeport = get_uid_to_bridgeport(vlan)
@@ -83,7 +88,7 @@ def ethernet_forwarding(table_name, tabl
mac, bridgeport = uid_to_mac.get(uid), uid_to_bridgeport.get(uid)
if bridgeport and mac:
ifindex = bridgeport_to_ifindex.get(bridgeport)
- yield device.config['zone'], vlan, mac, ifindex
+ yield device.config['zone'], vlan, normalise_ethernet_address(mac), ifindex
def ethernet_vlans(table_name, table_io, device):
# walk vtpVlanName
@@ -95,6 +100,7 @@ tables = {
'adjacency' : adjacency,
'ethernet_forwarding' : ethernet_forwarding,
'ethernet_vlans' : ethernet_vlans,
+ 'interfaces' : basic_snmp.interfaces,
'ip_addresses' : basic_snmp.ip_addresses,
'ip_arp' : basic_snmp.ip_arp,
'ip_routing' : basic_snmp.ip_routing
============================================================
--- yowie.py 7b6a0cb3235f0229a909686791a0fb28738e5685
+++ yowie.py ed3480915d645765aa989b4e88e66da2b195c417
@@ -84,6 +84,18 @@ def simple_get_table(supported):
return supported[args[0]](*args, **kwargs)
return __get_table
+@export_to_drivers
+def normalise_ethernet_address(addr):
+ if not addr:
+ return addr
+ rv = ''
+ valid = '0123456789abcdef'
+ addr = addr.lower()
+ for s in addr:
+ if s in valid:
+ rv += s
+ return rv
+
pq = pipes.quote
mtn_cmd = '%s --db=%s ' % (config.mtn,
pq(config.mtn_database))