Trees | Indices | Help |
|
---|
|
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 as published by 8 # the Free Software Foundation. 9 # 10 # For complete information please visit: http://www.zenoss.com/oss/ 11 # 12 ########################################################################### 13 14 from Globals import InitializeClass 15 from AccessControl import ClassSecurityInfo 16 from AccessControl import Permissions 17 18 from Products.ZenRelations.RelSchema import * 19 20 from ZenModelRM import ZenModelRM 21 from ZenPackable import ZenPackable 2224 25 types = ('COUNTER', 'GAUGE', 'DERIVE', 'ABSOLUTE') 26 27 language = "" 28 contact = "" 29 description = "" 30 31 _properties = ( 32 {'id':'language', 'type':'string', 'mode':'w'}, 33 {'id':'contact', 'type':'string', 'mode':'w'}, 34 {'id':'description', 'type':'string', 'mode':'w'}, 35 ) 36 37 _relations = ZenPackable._relations + ( 38 ("miborganizer", ToOne(ToManyCont, "Products.ZenModel.MibOrganizer", "mibs")), 39 ("nodes", ToManyCont(ToOne, "Products.ZenModel.MibNode", "module")), 40 ("notifications", ToManyCont(ToOne, "Products.ZenModel.MibNotification", "module")), 41 ) 42 43 # Screen action bindings (and tab definitions) 44 factory_type_information = ( 45 { 46 'immediate_view' : 'viewMibModule', 47 'actions' : 48 ( 49 { 'id' : 'overview' 50 , 'name' : 'Overview' 51 , 'action' : 'viewMibModule' 52 , 'permissions' : ( Permissions.view, ) 53 }, 54 { 'id' : 'edit' 55 , 'name' : 'Edit' 56 , 'action' : 'editMibModule' 57 , 'permissions' : ( Permissions.view, ) 58 }, 59 { 'id' : 'viewHistory' 60 , 'name' : 'Modifications' 61 , 'action' : 'viewHistory' 62 , 'permissions' : ( Permissions.view, ) 63 }, 64 ) 65 }, 66 ) 67 68 security = ClassSecurityInfo() 69 71 return self.id72 7375 return self.nodes.countObjects()76 7779 return self.notifications.countObjects()80 8183 """Delete MibNodes 84 """ 85 for node in self.nodes(): 86 id = getattr(node, 'id', None) 87 if id in ids: 88 self.nodes._delObject(id) 89 if REQUEST: 90 REQUEST['message'] = 'OID Mappings deleted' 91 return self.callZenScreen(REQUEST)92 9395 """Add a MibNode 96 """ 97 node = self.createMibNode(id, oid=oid, nodetype=nodetype) 98 if REQUEST: 99 if node: REQUEST['message'] = 'OID Mapping created' 100 else: REQUEST['message'] = 'Invalid OID' 101 return self.callZenScreen(REQUEST)102 103105 """Create a MibNotification 106 """ 107 from MibNode import MibNode 108 if self.oid2name(kwargs['oid']): 109 return None 110 node = MibNode(id, **kwargs) 111 self.nodes._setObject(node.id, node) 112 node = self.nodes._getOb(node.id) 113 return node114 115117 """Delete MibNotifications 118 """ 119 for notification in self.notifications(): 120 id = getattr(notification, 'id', None) 121 if id in ids: 122 self.notifications._delObject(id) 123 if REQUEST: 124 REQUEST['message'] = 'Traps deleted' 125 return self.callZenScreen(REQUEST)126 127129 """Add a MibNotification 130 """ 131 notification = self.createMibNotification(id, oid=oid, nodetype=nodetype) 132 if REQUEST: 133 if notification: REQUEST['message'] = 'Trap created' 134 else: REQUEST['message'] = 'Invalid OID' 135 return self.callZenScreen(REQUEST)136 137139 """Create a MibNotification 140 """ 141 from MibNotification import MibNotification 142 if self.oid2name(kwargs['oid']): 143 return None 144 node = MibNotification(id, **kwargs) 145 self.notifications._setObject(node.id, node) 146 node = self.notifications._getOb(node.id) 147 return node148 149151 """ 152 Device only propagates afterAdd if it is the added object. 153 """ 154 super(MibModule,self).manage_afterAdd(item, container) 155 self.index_object()156 157159 """Not really sure when this is called.""" 160 super(MibModule,self).manage_afterClone(item) 161 self.index_object()162 163165 """ 166 Device only propagates beforeDelete if we are being deleted or copied. 167 Moving and renaming don't propagate. 168 """ 169 super(MibModule,self).manage_beforeDelete(item, container) 170 self.unindex_object()171 172 173 InitializeClass(MibModule) 174
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Thu Oct 25 16:28:48 2007 | http://epydoc.sourceforge.net |