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

21 statements  

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

1tz = { 

2 "uuid": "93e16a10-d4c7-419f-93fa-4e5bc50ca076", 

3 "action": "DeviceManagementRouter", 

4 "result": { 

5 "data": "UTC", 

6 "success": True 

7 }, 

8 "tid": 1, 

9 "type": "rpc", 

10 "method": "getTimeZone" 

11} 

12 

13windows = { 

14 "uuid": "7b1aa255-096a-4818-bb53-3028beaa7572", 

15 "action": "DeviceManagementRouter", 

16 "result": { 

17 "data": [ 

18 { 

19 "niceRepeat": "Never", 

20 "startProdState": "Maintenance", 

21 "repeat": "Never", 

22 "occurrence": "1st", 

23 "startState": 300, 

24 "started": None, 

25 "skip": 1, 

26 "duration": "01:00:00", 

27 "enabled": False, 

28 "days": "Sunday", 

29 "name": "TestWindow", 

30 "start": 1510930800, 

31 "meta_type": "MaintenanceWindow", 

32 "startTime": "2017/11/17 15:00:00.000 UTC", 

33 "inspector_type": "MaintenanceWindow", 

34 "uid": "/zport/dmd/Devices/Server/TEST/maintenanceWindows/TestWindow", 

35 "id": "TestWindow", 

36 "description": "" 

37 }, 

38 { 

39 "niceRepeat": "1st Friday of the month", 

40 "startProdState": "Maintenance", 

41 "repeat": "Monthly: day of week", 

42 "occurrence": "1st", 

43 "startState": 300, 

44 "started": None, 

45 "skip": 1, 

46 "duration": "01:00:00", 

47 "enabled": False, 

48 "days": "Friday", 

49 "name": "TestWindowRepeat", 

50 "start": 1510930800, 

51 "meta_type": "MaintenanceWindow", 

52 "startTime": "2017/11/17 15:00:00.000 UTC", 

53 "inspector_type": "MaintenanceWindow", 

54 "uid": "/zport/dmd/Devices/Server/TEST/maintenanceWindows/TestWindowRepeat", 

55 "id": "TestWindowRepeat", 

56 "description": "" 

57 }, 

58 { 

59 "niceRepeat": "Never", 

60 "startProdState": "Maintenance", 

61 "repeat": "Never", 

62 "occurrence": "1st", 

63 "startState": 300, 

64 "started": None, 

65 "skip": 1, 

66 "duration": "01:00:00", 

67 "enabled": False, 

68 "days": "Sunday", 

69 "name": "TestAddWindow", 

70 "start": 1511204287.20076, 

71 "meta_type": "MaintenanceWindow", 

72 "startTime": "2017/11/20 18:58:07.000 UTC", 

73 "inspector_type": "MaintenanceWindow", 

74 "uid": "/zport/dmd/Devices/Server/TEST/maintenanceWindows/TestAddWindow", 

75 "id": "TestAddWindow", 

76 "description": "" 

77 } 

78 ], 

79 "success": True 

80 }, 

81 "tid": 1, 

82 "type": "rpc", 

83 "method": "getMaintWindows" 

84} 

85 

86add_maint = { 

87 "uuid": "eba4e39b-cad1-4b53-ab86-d2a5f126a991", 

88 "action": "DeviceManagementRouter", 

89 "result": { 

90 "msg": "Maintenance Window TestAddWindow added successfully.", 

91 "success": True 

92 }, 

93 "tid": 1, 

94 "type": "rpc", 

95 "method": "addMaintWindow" 

96} 

97 

98test_add = { 

99 "uuid": "5ed83a5d-bc49-46c6-b30d-3d7bac7bf4c3", 

100 "action": "DeviceManagementRouter", 

101 "result": { 

102 "data": [ 

103 ], 

104 "success": True 

105 }, 

106 "tid": 1, 

107 "type": "rpc", 

108 "method": "getMaintWindows" 

109} 

110 

111delete_maint = { 

112 "uuid": "190220ac-e119-4923-b1f5-767d8138765f", 

113 "action": "DeviceManagementRouter", 

114 "result": { 

115 "data": None, 

116 "success": True 

117 }, 

118 "tid": 1, 

119 "type": "rpc", 

120 "method": "deleteMaintWindow" 

121} 

122 

123update_maint = { 

124 "uuid": "c9e72e83-f061-45d6-9c8e-4cc11156fee2", 

125 "action": "DeviceManagementRouter", 

126 "result": { 

127 "data": [ 

128 { 

129 "niceRepeat": "Never", 

130 "startProdState": "Maintenance", 

131 "repeat": "Never", 

132 "occurrence": "2nd", 

133 "startState": 300, 

134 "started": None, 

135 "skip": 1, 

136 "duration": "01:30:00", 

137 "enabled": False, 

138 "days": "Monday", 

139 "name": "TestAddWindow", 

140 "start": 1511267400, 

141 "meta_type": "MaintenanceWindow", 

142 "startTime": "2017/11/21 12:30:00.000 UTC", 

143 "inspector_type": "MaintenanceWindow", 

144 "uid": "/zport/dmd/Devices/Server/TEST/maintenanceWindows/TestAddWindow", 

145 "id": "TestAddWindow", 

146 "description": "" 

147 } 

148 ], 

149 "success": True 

150 }, 

151 "tid": 1, 

152 "type": "rpc", 

153 "method": "editMaintWindow" 

154} 

155 

156user_commands = { 

157 "uuid": "9157db75-274a-4cec-b7ce-335ff7fce133", 

158 "action": "DeviceManagementRouter", 

159 "result": { 

160 "data": [ 

161 { 

162 "description": "Name to IP address lookup", 

163 "name": "DNS forward", 

164 "meta_type": "UserCommand", 

165 "command": "host ${device/id}", 

166 "inspector_type": "UserCommand", 

167 "id": "DNS forward", 

168 "uid": "/zport/dmd/userCommands/DNS forward" 

169 }, 

170 { 

171 "description": "IP address to name lookup", 

172 "name": "DNS reverse", 

173 "meta_type": "UserCommand", 

174 "command": "host ${device/manageIp}", 

175 "inspector_type": "UserCommand", 

176 "id": "DNS reverse", 

177 "uid": "/zport/dmd/userCommands/DNS reverse" 

178 }, 

179 { 

180 "description": "Is the device responding to ping?", 

181 "name": "ping", 

182 "meta_type": "UserCommand", 

183 "command": "${device/pingCommand} -c2 ${device/manageIp}", 

184 "inspector_type": "UserCommand", 

185 "id": "ping", 

186 "uid": "/zport/dmd/userCommands/ping" 

187 }, 

188 { 

189 "description": "Display the OIDs available on a device", 

190 "name": "snmpwalk", 

191 "meta_type": "UserCommand", 

192 "command": "snmpwalk -${device/zSnmpVer} -c${device/zSnmpCommunity} ${device/snmpwalkPrefix}${here/manageIp} system", 

193 "inspector_type": "UserCommand", 

194 "id": "snmpwalk", 

195 "uid": "/zport/dmd/userCommands/snmpwalk" 

196 }, 

197 { 

198 "description": "snmp version v3 Display the OIDs available on a device", 

199 "name": "snmpwalk_v3", 

200 "meta_type": "UserCommand", 

201 "command": "snmpwalk -${device/zSnmpVer} -l authPriv -a ${device/zSnmpAuthType} -x ${device/zSnmpPrivType} -A ${device/zSnmpAuthPassword} -X ${device/zSnmpPrivPassword} -u ${device/zSnmpSecurityName} ${device/snmpwalkPrefix}${here/manageIp}:${device/zSnmpPort} 1.3.6.1.2.1.25.2.3.1", 

202 "inspector_type": "UserCommand", 

203 "id": "snmpwalk_v3", 

204 "uid": "/zport/dmd/userCommands/snmpwalk_v3" 

205 }, 

206 { 

207 "description": "Show the route to the device", 

208 "name": "traceroute", 

209 "meta_type": "UserCommand", 

210 "command": "${device/tracerouteCommand} -q 1 -w 2 ${device/manageIp}", 

211 "inspector_type": "UserCommand", 

212 "id": "traceroute", 

213 "uid": "/zport/dmd/userCommands/traceroute" 

214 } 

215 ], 

216 "success": True 

217 }, 

218 "tid": 1, 

219 "type": "rpc", 

220 "method": "getUserCommands" 

221} 

222 

223add_user_command = { 

224 "uuid": "cd50fa2c-4099-4e42-bd44-8a24d018b380", 

225 "action": "DeviceManagementRouter", 

226 "result": { 

227 "success": True 

228 }, 

229 "tid": 1, 

230 "type": "rpc", 

231 "method": "addUserCommand" 

232} 

233 

234add_uc_bad_password = { 

235 "uuid": "859d530b-9a66-4a2e-8a9f-10e57a73de4d", 

236 "action": "DeviceManagementRouter", 

237 "result": { 

238 "msg": "Exception: Add new command failed. Incorrect or missing password.", 

239 "type": "exception", 

240 "success": False 

241 }, 

242 "tid": 1, 

243 "type": "rpc", 

244 "method": "addUserCommand" 

245} 

246 

247added_uc = { 

248 "uuid": "9157db75-274a-4cec-b7ce-335ff7fce133", 

249 "action": "DeviceManagementRouter", 

250 "result": { 

251 "data": [ 

252 { 

253 "description": "uname -a", 

254 "name": "uname_a", 

255 "meta_type": "UserCommand", 

256 "command": "uname -a", 

257 "inspector_type": "UserCommand", 

258 "id": "uname_a", 

259 "uid": "/zport/dmd/Devices/Server/TEST/devices/test.example.com/userCommands/uname_a" 

260 } 

261 ], 

262 "success": True 

263 }, 

264 "tid": 1, 

265 "type": "rpc", 

266 "method": "getUserCommands" 

267} 

268 

269delete_uc = { 

270 "uuid": "54aef422-46bd-4ea8-a32a-1ffc5cd18650", 

271 "action": "DeviceManagementRouter", 

272 "result": { 

273 "data": None, 

274 "success": True 

275 }, 

276 "tid": 1, 

277 "type": "rpc", 

278 "method": "deleteUserCommand" 

279} 

280 

281update_uc = { 

282 "uuid": "f01f1c8f-abf9-4b4a-a4c2-5d4dfcaae876", 

283 "action": "DeviceManagementRouter", 

284 "result": { 

285 "success": True 

286 }, 

287 "tid": 1, 

288 "type": "rpc", 

289 "method": "updateUserCommand" 

290} 

291 

292update_uc_bad_passwd = { 

293 "uuid": "658bf790-c4e9-4427-aa5c-e763281d8731", 

294 "action": "DeviceManagementRouter", 

295 "result": { 

296 "msg": "Exception: Update failed. Incorrect or missing password.", 

297 "type": "exception", 

298 "success": False 

299 }, 

300 "tid": 1, 

301 "type": "rpc", 

302 "method": "updateUserCommand" 

303} 

304 

305updated_uc = { 

306 "uuid": "9157db75-274a-4cec-b7ce-335ff7fce133", 

307 "action": "DeviceManagementRouter", 

308 "result": { 

309 "data": [ 

310 { 

311 "description": "uname -a", 

312 "name": "uname_a", 

313 "meta_type": "UserCommand", 

314 "command": "uname -a", 

315 "inspector_type": "UserCommand", 

316 "id": "uname_a", 

317 "uid": "/zport/dmd/Devices/Server/TEST/devices/test2.example.com/userCommands/uname_a" 

318 } 

319 ], 

320 "success": True 

321 }, 

322 "tid": 1, 

323 "type": "rpc", 

324 "method": "getUserCommands" 

325} 

326 

327user_list = { 

328 "uuid": "a4923782-2efc-48a1-a591-043b3d14c976", 

329 "action": "DeviceManagementRouter", 

330 "result": { 

331 "data": [ 

332 "admin", 

333 "ccuser", 

334 "lenny", 

335 "zenoss_system" 

336 ], 

337 "success": True 

338 }, 

339 "tid": 1, 

340 "type": "rpc", 

341 "method": "getUserList" 

342} 

343 

344roles_list = { 

345 "uuid": "dbd64697-73a5-402b-820d-fd01f9db4a05", 

346 "action": "DeviceManagementRouter", 

347 "result": { 

348 "data": [ 

349 "Manager", 

350 "ZenManager", 

351 "ZenOperator", 

352 "ZenUser" 

353 ], 

354 "success": True 

355 }, 

356 "tid": 1, 

357 "type": "rpc", 

358 "method": "getRolesList" 

359} 

360 

361admin_roles = { 

362 "uuid": "2fc85112-ca3b-4778-b3fe-54686c4a434e", 

363 "action": "DeviceManagementRouter", 

364 "result": { 

365 "data": [ 

366 { 

367 "description": "", 

368 "name": "admin", 

369 "id": "admin", 

370 "meta_type": "AdministrativeRole", 

371 "role": "ZenManager", 

372 "inspector_type": "AdministrativeRole", 

373 "pager": "", 

374 "email": "", 

375 "uid": "/zport/dmd/Devices/Server/TEST/devices/test.example.com/adminRoles/admin" 

376 } 

377 ], 

378 "success": True 

379 }, 

380 "tid": 1, 

381 "type": "rpc", 

382 "method": "getAdminRoles" 

383} 

384 

385remove_admin = { 

386 "uuid": "76001a52-2f8e-42cd-b582-e9de5e9644b5", 

387 "action": "DeviceManagementRouter", 

388 "result": { 

389 "success": True 

390 }, 

391 "tid": 1, 

392 "type": "rpc", 

393 "method": "removeAdmin" 

394} 

395 

396add_admin = { 

397 "uuid": "7a12bc91-0d66-4653-92eb-5813175a0ff0", 

398 "action": "DeviceManagementRouter", 

399 "result": { 

400 "msg": "New Administrator added successfully.", 

401 "success": True 

402 }, 

403 "tid": 1, 

404 "type": "rpc", 

405 "method": "addAdminRole" 

406} 

407 

408update_admin = { 

409 "uuid": "cca5e9ec-32c2-4a0f-8659-ee006bf87bdc", 

410 "action": "DeviceManagementRouter", 

411 "result": { 

412 "success": True 

413 }, 

414 "tid": 1, 

415 "type": "rpc", 

416 "method": "updateAdminRole" 

417} 

418 

419delete_admin = { 

420 "uuid": "1176f85f-1a27-4d8b-8c4a-e00b952e812b", 

421 "action": "DeviceManagementRouter", 

422 "result": { 

423 "success": True 

424 }, 

425 "tid": 1, 

426 "type": "rpc", 

427 "method": "removeAdmin" 

428}