1
2
3
4
5
6
7
8
9
10
11
12
13
14 __doc__="""PowerSupply
15
16 PowerSupply is an abstraction of a power supply on a device.
17
18 $Id: PowerSupply.py,v 1.7 2004/04/06 22:33:24 edahl Exp $"""
19
20 __version__ = "$Revision: 1.7 $"[11:-2]
21
22 from Globals import InitializeClass
23
24 from Products.ZenRelations.RelSchema import *
25
26 from HWComponent import HWComponent
27
28 from Products.ZenModel.ZenossSecurity import *
29
31 """PowerSupply object"""
32
33 portal_type = meta_type = 'PowerSupply'
34
35 watts = None
36 type = "unknown"
37 state = "unknown"
38
39 _properties = HWComponent._properties + (
40 {'id':'watts', 'type':'int', 'mode':'w'},
41 {'id':'type', 'type':'string', 'mode':'w'},
42 {'id':'state', 'type':'string', 'mode':'w'},
43 )
44
45 _relations = HWComponent._relations + (
46 ("hw", ToOne(ToManyCont, "Products.ZenModel.DeviceHW",
47 "powersupplies")),
48 )
49
50
51 factory_type_information = (
52 {
53 'id' : 'PowerSupply',
54 'meta_type' : 'PowerSupply',
55 'description' : """Arbitrary device grouping class""",
56 'icon' : 'PowerSupply_icon.gif',
57 'product' : 'ZenModel',
58 'factory' : 'manage_addPowerSupply',
59 'immediate_view' : 'viewPowerSupply',
60 'actions' :
61 (
62 { 'id' : 'status'
63 , 'name' : 'Status'
64 , 'action' : 'viewPowerSupply'
65 , 'permissions' : ('View',)
66 },
67 { 'id' : 'perfConf'
68 , 'name' : 'Template'
69 , 'action' : 'objTemplates'
70 , 'permissions' : ("Change Device", )
71 },
72 { 'id' : 'viewHistory'
73 , 'name' : 'Modifications'
74 , 'action' : 'viewHistory'
75 , 'permissions' : (ZEN_VIEW_MODIFICATIONS,)
76 },
77 )
78 },
79 )
80
81
83 """
84 Return a string representation of the watts
85 """
86 return self.watts is None and "unknown" or str(self.watts)
87
88
97
98
105
106
109 name = viewName
110
111
112 InitializeClass(PowerSupply)
113