Coverage for tests/routers/events_resp.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.9.1, created at 2025-06-25 05:47 +0000

1success = { 

2 "uuid": "8bf7e570-67cd-4670-a37c-0999fd07f9bf", 

3 "action": "EventsRouter", 

4 "result": { 

5 "success": True 

6 }, 

7 "tid": 1, 

8 "type": "rpc", 

9 "method": "detail" 

10} 

11 

12fail = { 

13 "uuid": "8bf7e570-67cd-4670-a37c-0999fd07f9bf", 

14 "action": "EventsRouter", 

15 "result": { 

16 "msg": "ServiceResponseError: Not Found", 

17 "type": "exception", 

18 "success": False 

19 }, 

20 "tid": 1, 

21 "type": "rpc", 

22 "method": "detail" 

23} 

24 

25events_query = { 

26 "uuid": "eadafce3-12ba-44ed-b1aa-e6ffdf6e98c6", 

27 "action": "EventsRouter", 

28 "result": { 

29 "totalCount": 50, 

30 "events": [ 

31 { 

32 "prodState": "Production", 

33 "firstTime": 1505865565.822, 

34 "facility": None, 

35 "eventClassKey": "csm.sessionFailed", 

36 "agent": "zenpython", 

37 "dedupid": "test.example.com|test-01|/Status|ZenPacks.zenoss.NetAppMonitor.datasource_plugins.NetAppMonitorCmodeEventsDataSourcePlugin.NetAppMonitorCmodeEventsDataSourcePlugin|60|3", 

38 "Location": [ 

39 { 

40 "uid": "/zport/dmd/Locations/Moon Base Alpha", 

41 "name": "/Moon Base Alpha" 

42 } 

43 ], 

44 "ownerid": "zenoss", 

45 "eventClass": { 

46 "text": "/Status", 

47 "uid": "/zport/dmd/Events/Status" 

48 }, 

49 "id": "02420a11-0015-98b9-11e7-9d96ae351999", 

50 "DevicePriority": "Normal", 

51 "monitor": "localhost", 

52 "priority": None, 

53 "details": { 

54 "node": [ 

55 "test-01" 

56 ], 

57 "recvtime": [ 

58 "1508797427" 

59 ], 

60 "zenoss.device.location": [ 

61 "/Moon Base Alpha" 

62 ], 

63 "zenoss.device.priority": [ 

64 "3" 

65 ], 

66 "zenoss.device.device_class": [ 

67 "/Storage/NetApp/C-Mode" 

68 ], 

69 "seq-num": [ 

70 "647604" 

71 ], 

72 "source": [ 

73 "CsmMpAgentThread" 

74 ], 

75 "manager": [ 

76 "13a1a22ff067" 

77 ], 

78 "message-name": [ 

79 "csm.sessionFailed" 

80 ], 

81 "resolution": [ 

82 "If you can reach the storage failover (SFO) partner of the target appliance, initiate a storage failover (takeover) of any aggregates on the target appliance. Then perform a 'sendhome' operation on these aggregates after the target appliance is operational again. Examine the network between the initiating appliance and the target appliance for problems. " 

83 ], 

84 "eventClassMapping": [ 

85 "/Status/failureNoFrames" 

86 ], 

87 "time": [ 

88 "1508797427" 

89 ], 

90 "zenoss.device.production_state": [ 

91 "1000" 

92 ], 

93 "zenoss.device.ip_address": [ 

94 "1.2.3.4" 

95 ], 

96 "event": [ 

97 "csm.sessionFailed: Cluster interconnect session (req=test-01:dblade, rsp=test-01:dblade, uniquifier=11055c3e278e5cc8) failed with record state ACTIVE and error CSM_CONNABORTED. " 

98 ] 

99 }, 

100 "DeviceClass": [ 

101 { 

102 "uid": "/zport/dmd/Devices/Storage/NetApp/C-Mode", 

103 "name": "/Storage/NetApp/C-Mode" 

104 } 

105 ], 

106 "eventKey": "ZenPacks.zenoss.NetAppMonitor.datasource_plugins.NetAppMonitorCmodeEventsDataSourcePlugin.NetAppMonitorCmodeEventsDataSourcePlug", 

107 "evid": "02420a11-0015-98b9-11e7-9d96ae351999", 

108 "eventClassMapping": { 

109 "uuid": "1337d66f-d5fa-4c3b-8198-bcfedf83d040", 

110 "name": "failureNoFrames" 

111 }, 

112 "component": { 

113 "url": "/zport/dmd/goto?guid=08c40deb-1009-4634-a529-d66631391733", 

114 "text": "test-01", 

115 "uid": "/zport/dmd/Devices/Storage/NetApp/C-Mode/devices/test.example.com/systemnodes/test-01", 

116 "uuid": "08c40deb-1009-4634-a529-d66631391733" 

117 }, 

118 "clearid": None, 

119 "DeviceGroups": [], 

120 "eventGroup": None, 

121 "device": { 

122 "url": "/zport/dmd/goto?guid=02e21618-b30a-47bf-8591-471c70570932", 

123 "text": "test.example.com", 

124 "uuid": "02e21618-b30a-47bf-8591-471c70570932", 

125 "uid": "/zport/dmd/Devices/Storage/NetApp/C-Mode/devices/test.example.com" 

126 }, 

127 "message": "csm.sessionFailed: Cluster interconnect session (req=test-01:dblade, rsp=test-01:dblade, uniquifier=11055c3e278e5cc8) failed with record state ACTIVE and error CSM_CONNABORTED. \nResolution: If you can reach the storage failover (SFO) partner of the target appliance, initiate a storage failover (takeover) of any aggregates on the target appliance. Then perform a 'sendhome' operation on these aggregates after the target appliance is operational again. Examine the network between the initiating appliance and the target appliance for problems. ", 

128 "severity": 3, 

129 "count": 66, 

130 "stateChange": 1507054918.83, 

131 "ntevid": None, 

132 "summary": "csm.sessionFailed: Cluster interconnect session (req=test-01:dblade, rsp=test-01:dblade, uniquifier=11055c3e278e5cc8) failed with record state ACTIVE and error CSM_CONNABORTED. ", 

133 "eventState": "Acknowledged", 

134 "lastTime": 1508797479.194, 

135 "ipAddress": [ 

136 "1.2.3.4" 

137 ], 

138 "Systems": [] 

139 } 

140 ], 

141 "success": True, 

142 "asof": 1508797504.409547 

143 }, 

144 "tid": 1, 

145 "type": "rpc", 

146 "method": "query" 

147} 

148 

149events_query_evid = { 

150 "uuid": "eadafce3-12ba-44ed-b1aa-e6ffdf6e98c6", 

151 "action": "EventsRouter", 

152 "result": { 

153 "totalCount": 50, 

154 "events": [ 

155 { 

156 "evid": "02420a11-0015-98b9-11e7-9d96ae351999" 

157 } 

158 ], 

159 "success": True, 

160 "asof": 1508797504.409547 

161 }, 

162 "tid": 1, 

163 "type": "rpc", 

164 "method": "query" 

165} 

166 

167event_detail = { 

168 "uuid": "23f0bbd9-b6a3-46bb-909f-aa53891dfbf5", 

169 "action": "EventsRouter", 

170 "result": { 

171 "event": [ 

172 { 

173 "prodState": "Production", 

174 "firstTime": 1505865565.822, 

175 "device_uuid": "02e21618-b30a-47bf-8591-471c70570932", 

176 "eventClassKey": "smc.snapmir.unexpected.err", 

177 "agent": "zenpython", 

178 "dedupid": "test.example.com|test-01|/Status|ZenPacks.zenoss.NetAppMonitor.datasource_plugins.NetAppMonitorCmodeEventsDataSourcePlugin.NetAppMonitorCmodeEventsDataSourcePlugin|60|3", 

179 "Location": [ 

180 { 

181 "uid": "/zport/dmd/Locations/Moon Base Alpha", 

182 "name": "/Moon Base Alpha" 

183 } 

184 ], 

185 "component_url": "/zport/dmd/goto?guid=08c40deb-1009-4634-a529-d66631391733", 

186 "ownerid": "zenoss", 

187 "eventClassMapping_url": "/zport/dmd/goto?guid=1337d66f-d5fa-4c3b-8198-bcfedf83d040", 

188 "eventClass": "/Status", 

189 "id": "02420a11-0015-98b9-11e7-9d96ae351999", 

190 "device_title": "test.example.com", 

191 "DevicePriority": "Normal", 

192 "log": [ 

193 [ 

194 "zenoss", 

195 1507054918830, 

196 "state changed to Acknowledged" 

197 ] 

198 ], 

199 "facility": None, 

200 "eventClass_url": "/zport/dmd/Events/Status", 

201 "monitor": "localhost", 

202 "priority": None, 

203 "device_url": "/zport/dmd/goto?guid=02e21618-b30a-47bf-8591-471c70570932", 

204 "details": [ 

205 { 

206 "key": "event", 

207 "value": "smc.snapmir.unexpected.err: SnapMirror unexpected error 'Destination volume \"cg_name_wildcard\" was not found. It may have been moved.(Failed to get volume attributes for twoaggrdav.(Volume is not known or has been moved))'. Relationship UUID ' '. " 

208 }, 

209 { 

210 "key": "eventClassMapping", 

211 "value": "/Status/failureNoFrames" 

212 }, 

213 { 

214 "key": "manager", 

215 "value": "13a1a22ff067" 

216 }, 

217 { 

218 "key": "message-name", 

219 "value": "smc.snapmir.unexpected.err" 

220 }, 

221 { 

222 "key": "node", 

223 "value": "test-01" 

224 }, 

225 { 

226 "key": "recvtime", 

227 "value": "1508798161" 

228 }, 

229 { 

230 "key": "resolution", 

231 "value": "If the problem persists, contact NetApp technical support. " 

232 }, 

233 { 

234 "key": "seq-num", 

235 "value": "647654" 

236 }, 

237 { 

238 "key": "source", 

239 "value": "sm_logger_main" 

240 }, 

241 { 

242 "key": "time", 

243 "value": "1508798161" 

244 }, 

245 { 

246 "key": "zenoss.device.device_class", 

247 "value": "/Storage/NetApp/C-Mode" 

248 }, 

249 { 

250 "key": "zenoss.device.ip_address", 

251 "value": "1.2.3.4" 

252 }, 

253 { 

254 "key": "zenoss.device.location", 

255 "value": "/Moon Base Alpha" 

256 }, 

257 { 

258 "key": "zenoss.device.priority", 

259 "value": "3" 

260 }, 

261 { 

262 "key": "zenoss.device.production_state", 

263 "value": "1000" 

264 } 

265 ], 

266 "DeviceClass": [ 

267 { 

268 "uid": "/zport/dmd/Devices/Storage/NetApp/C-Mode", 

269 "name": "/Storage/NetApp/C-Mode" 

270 } 

271 ], 

272 "eventKey": "ZenPacks.zenoss.NetAppMonitor.datasource_plugins.NetAppMonitorCmodeEventsDataSourcePlugin.NetAppMonitorCmodeEventsDataSourcePlug", 

273 "evid": "02420a11-0015-98b9-11e7-9d96ae351999", 

274 "eventClassMapping": "failureNoFrames", 

275 "component": "test-01", 

276 "clearid": None, 

277 "DeviceGroups": [], 

278 "eventGroup": None, 

279 "device": "test.example.com", 

280 "Systems": [], 

281 "component_title": "test-01", 

282 "severity": 3, 

283 "count": 66, 

284 "stateChange": 1507054918.83, 

285 "ntevid": None, 

286 "summary": "smc.snapmir.unexpected.err: SnapMirror unexpected error 'Destination volume \"cg_name_wildcard\" was not found. It may have been moved.(Failed to get volume attributes for twoaggrdav.(Volume is not known or has been moved))'. Relationship UUID ' '. ", 

287 "message": "smc.snapmir.unexpected.err: SnapMirror unexpected error 'Destination volume \"cg_name_wildcard\" was not found. It may have been moved.(Failed to get volume attributes for twoaggrdav.(Volume is not known or has been moved))'. Relationship UUID ' '. \nResolution: If the problem persists, contact NetApp technical support. ", 

288 "eventState": "Acknowledged", 

289 "lastTime": 1508798199.186, 

290 "ipAddress": [ 

291 "1.2.3.4" 

292 ], 

293 "component_uuid": "08c40deb-1009-4634-a529-d66631391733" 

294 } 

295 ], 

296 "success": True 

297 }, 

298 "tid": 1, 

299 "type": "rpc", 

300 "method": "detail" 

301} 

302 

303events_config = { 

304 "uuid": "7f7109f2-1a6f-41f5-a12f-bbd95f280b9c", 

305 "action": "EventsRouter", 

306 "result": { 

307 "data": [ 

308 { 

309 "xtype": "eventageseverity", 

310 "defaultValue": 4, 

311 "id": "event_age_disable_severity", 

312 "value": 4, 

313 "name": "Don't Age This Severity and Above" 

314 }, 

315 { 

316 "defaultValue": False, 

317 "id": "event_age_severity_inclusive", 

318 "value": False, 

319 "xtype": "hidden" 

320 } 

321 ], 

322 "success": True 

323 }, 

324 "tid": 1, 

325 "type": "rpc", 

326 "method": "getConfig" 

327} 

328 

329add_event_evid_query = { 

330 "uuid": "6700ab59-c559-42ec-959b-ebc33bc52257", 

331 "action": "EventsRouter", 

332 "result": { 

333 "totalCount": 1, 

334 "events": [ 

335 { 

336 "evid": "02420a11-000c-a561-11e7-ba9b510182b3", 

337 } 

338 ], 

339 "success": True, 

340 "asof": 1509056503.945677 

341 }, 

342 "tid": 1, 

343 "type": "rpc", 

344 "method": "query" 

345} 

346 

347add_event_detail = { 

348 "uuid": "c54074e8-af8b-4e40-a679-7dbe314709ed", 

349 "action": "EventsRouter", 

350 "result": { 

351 "event": [ 

352 { 

353 "prodState": None, 

354 "firstTime": 1509056189.91, 

355 "device_uuid": None, 

356 "eventClassKey": None, 

357 "agent": None, 

358 "dedupid": "Heart of Gold|Arthur Dent|/Status|3|Out of Tea", 

359 "Location": [], 

360 "component_url": None, 

361 "ownerid": None, 

362 "eventClassMapping_url": None, 

363 "eventClass": "/Status", 

364 "id": "02420a11-000c-a561-11e7-ba9b510182b3", 

365 "device_title": "Heart of Gold", 

366 "DevicePriority": None, 

367 "log": [ 

368 [ 

369 "zenoss", 

370 1509057815980, 

371 "<p>Test log entry</p>" 

372 ] 

373 ], 

374 "facility": None, 

375 "eventClass_url": "/zport/dmd/Events/Status", 

376 "monitor": None, 

377 "priority": None, 

378 "device_url": None, 

379 "details": [], 

380 "DeviceClass": [], 

381 "eventKey": "", 

382 "evid": "02420a11-000c-a561-11e7-ba9b510182b3", 

383 "eventClassMapping": None, 

384 "component": "Arthur Dent", 

385 "clearid": None, 

386 "DeviceGroups": [], 

387 "eventGroup": None, 

388 "device": "Heart of Gold", 

389 "Systems": [], 

390 "component_title": "Arthur Dent", 

391 "severity": 3, 

392 "count": 1, 

393 "stateChange": 1509056189.91, 

394 "ntevid": None, 

395 "summary": "Out of Tea", 

396 "message": "Out of Tea", 

397 "eventState": "New", 

398 "lastTime": 1509056189.91, 

399 "ipAddress": "", 

400 "component_uuid": None 

401 } 

402 ], 

403 "success": True 

404 }, 

405 "tid": 1, 

406 "type": "rpc", 

407 "method": "detail" 

408}