1
2
3
4
5
6
7
8
9
10
11 __doc__ = """CommandParser
12
13 CommandParser parses the output of a command to return a datamap
14
15 $Id: CiscoDhcpHelperAddress.py,v 1.3 2003/10/02 19:05:28 edahl Exp $"""
16
17 __version__ = '$Revision: 1.3 $'[11:-2]
18
19 import re
20
21 from CommandParser import CommandParser
22
24
25 command = 'show run | include helper-address'
26
29
30
31 - def parse(self, device, results, log):
32 dhcpips = {}
33 findip = re.compile('(\d+\.\d+\.\d+\.\d+)$').search
34 for line in results.split('\n'):
35 m = findip(line)
36 if m:
37 ip = m.group(1)
38 dhcpips[ip] = 1
39 om = self.newObjectMap()
40 om['setDhcpHelpers'] = dhcpips.keys()
41 return om
42
43
45 return "Collect dhcp helper servers that a UBR uses"
46