The unified diff between revisions [c65bc853..] and [055ec4ad..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'plugins/cisco_ios.py'
#
#
# patch "plugins/cisco_ios.py"
# from [342b04adca958885588dcf59b73292c012393175]
# to [968be90e387e8c74200767668a7dbacdb18a1917]
#
============================================================
--- plugins/cisco_ios.py 342b04adca958885588dcf59b73292c012393175
+++ plugins/cisco_ios.py 968be90e387e8c74200767668a7dbacdb18a1917
@@ -4,16 +4,12 @@ def adjacency(table_name, table_io, devi
import re
def adjacency(table_name, table_io, device):
- def h2i(s):
- h = {'0':0,'1':1,'2':2,'3':3,'4':4,'5':5,'6':6,'7':7,'8':8,'9':9,'A':10,'B':11,'C':12,'D':13,'E':14,'F':15}
- if len(s) == 1: return h[s[0]]
- else :return 16*h[s[0]] + h[s[1]]
def to_ipaddr(s):
if s == None: return s
- return '.'.join([str(t) for t in map(h2i, s.split(' '))])
+ return '.'.join([str(t) for t in map(lambda h: int(h, 16), s.split(' '))])
def to_ascii(s):
if s == None: return s
- asdigits = [h2i(t) for t in s.split(' ')]
+ asdigits = [int(t, 16) for t in s.split(' ')]
asdigits = filter(lambda x: x >= 32 and x <= 122, asdigits)
return ''.join([chr(t) for t in asdigits])
row_to_field = { 4 : ('Hex-STRING', 'ip_address'),