Package Products :: Package DataCollector :: Package CommandParsers :: Module CiscoDhcpHelperAddress
[hide private]
[frames] | no frames]

Source Code for Module Products.DataCollector.CommandParsers.CiscoDhcpHelperAddress

 1  ############################################################################## 
 2  #  
 3  # Copyright (C) Zenoss, Inc. 2007, all rights reserved. 
 4  #  
 5  # This content is made available according to terms specified in 
 6  # License.zenoss under the directory where your Zenoss product is installed. 
 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   
23 -class CiscoDhcpHelperAddress(CommandParser):
24 25 command = 'show run | include helper-address' 26
27 - def condition(self, device, log):
28 return "UBR" in device.getPrimaryPath()
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
44 - def description(self):
45 return "Collect dhcp helper servers that a UBR uses"
46