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