1
2
3
4
5
6
7
8
9
10
11
12
13
14 __doc__="""DeviceResult
15
16 A mixin for objects that get listed like devices
17 The primary object must implement device.
18
19 $Id: DeviceResultInt.py,v 1.9 2004/04/23 01:24:48 edahl Exp $"""
20
21 __version__ = "$Revision: 1.9 $"[11:-2]
22
23 from AccessControl import ClassSecurityInfo
24 from Globals import InitializeClass
25
26
28
29 security = ClassSecurityInfo()
30
31 security.declareProtected('View', 'getDeviceName')
33 '''Get the device name of this device or associated device'''
34 d = self.device()
35 if d:
36 return d.getId()
37 return "No Device"
38
39
40 security.declareProtected('View', 'getDeviceUrl')
42 '''Get the primary url path of the device in which this
43 interface is located'''
44 d = self.device()
45 if d:
46 return d.getPrimaryUrlPath()
47 return ""
48
49
50 security.declareProtected('View', 'getDeviceLink')
61
62
63 security.declareProtected('View', 'getDeviceClassPath')
65 '''Get the device class for this device'''
66 d = self.device()
67 if d:
68 return d.deviceClass().getOrganizerName()
69 return "No Device"
70 security.declareProtected('View', 'getDeviceClassName')
71 getDeviceClassName = getDeviceClassPath
72
73
74 security.declareProtected('View', 'getProdState')
82
83
84 security.declareProtected('View', 'getPingStatus')
98 security.declareProtected('View', 'getPingStatusNumber')
99 getPingStatusNumber = getPingStatus
100
101
102 security.declareProtected('View', 'getSnmpStatus')
116 getSnmpStatusNumber = getSnmpStatus
117 security.declareProtected('View', 'getSnmpStatusNumber')
118
119
120 security.declareProtected('View', 'isResultLockedFromUpdates')
122 """Return the locked from updates flag"""
123 d = self.device()
124 if d:
125 return d.isLockedFromUpdates()
126 return False
127
128 security.declareProtected('View', 'isResultLockedFromDeletion')
130 """Return the locked from deletion flag"""
131 d = self.device()
132 if d:
133 return d.isLockedFromDeletion()
134 return False
135
136 security.declareProtected('View', 'sendEventWhenResultBlocked')
143
144
145 security.declareProtected('View', 'getDeviceIp')
147 """Get the management ip (only) of a device"""
148 d = self.device()
149 if d:
150 return d.manageIp
151 return ""
152
153
154 security.declareProtected('View', 'getDeviceIpAddress')
156 """Get the management ip with netmask (1.1.1.1/24) of a device"""
157 d = self.device()
158 if d:
159 int = d.getManageInterface()
160 if int:
161 return int.getIpAddress()
162 return ""
163
164
165 security.declareProtected('View', 'getDeviceMacaddress')
174
175
176 InitializeClass(DeviceResultInt)
177