Package Products :: Package ZenModel :: Module MibBase
[hide private]
[frames] | no frames]

Source Code for Module Products.ZenModel.MibBase

 1  ########################################################################### 
 2  # 
 3  # This program is part of Zenoss Core, an open source monitoring platform. 
 4  # Copyright (C) 2007, Zenoss Inc. 
 5  # 
 6  # This program is free software; you can redistribute it and/or modify it 
 7  # under the terms of the GNU General Public License version 2 or (at your 
 8  # option) any later version as published by the Free Software Foundation. 
 9  # 
10  # For complete information please visit: http://www.zenoss.com/oss/ 
11  # 
12  ########################################################################### 
13   
14  from zope.interface import implements 
15   
16  from Products.ZenModel.interfaces import IIndexed 
17  from ZenModelRM import ZenModelRM 
18  from ZenPackable import ZenPackable 
19   
20 -class MibBase(ZenModelRM, ZenPackable):
21 implements(IIndexed) 22 default_catalog = 'mibSearch' 23 24 _relations = ZenPackable._relations[:] 25 26 moduleName = "" 27 nodetype = "" 28 oid = "" 29 status = "" 30 description = "" 31 32 _properties = ( 33 {'id':'moduleName', 'type':'string', 'mode':'w'}, 34 {'id':'nodetype', 'type':'string', 'mode':'w'}, 35 {'id':'oid', 'type':'string', 'mode':'w'}, 36 {'id':'status', 'type':'string', 'mode':'w'}, 37 {'id':'description', 'type':'string', 'mode':'w'}, 38 ) 39 40
41 - def __init__(self, id, title="", **kwargs):
42 super(ZenModelRM, self).__init__(id, title) 43 atts = self.propertyIds() 44 for key, val in kwargs.items(): 45 if key in atts: setattr(self, key, val)
46 47
48 - def getFullName(self):
49 """Return full value name in form MODULE::attribute. 50 """ 51 return "%s::%s" % (self.moduleName, self.id)
52 53
54 - def summary(self):
55 """Return summary string for Mib objects. 56 """ 57 return [str(getattr(self, p)) for p in self.propertyIds() \ 58 if str(getattr(self, p))]
59