forked from meraki/dashboard-api-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevices.py
More file actions
697 lines (489 loc) · 25.6 KB
/
Copy pathdevices.py
File metadata and controls
697 lines (489 loc) · 25.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
import urllib
class Devices(object):
def __init__(self, session):
super(Devices, self).__init__()
self._session = session
def getDevice(self, serial: str):
"""
**Return a single device**
https://developer.cisco.com/meraki/api-v1/#!get-device
- serial (string): Serial
"""
metadata = {
'tags': ['devices', 'configure'],
'operation': 'getDevice'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}'
return self._session.get(metadata, resource)
def updateDevice(self, serial: str, **kwargs):
"""
**Update the attributes of a device**
https://developer.cisco.com/meraki/api-v1/#!update-device
- serial (string): Serial
- name (string): The name of a device
- tags (array): The list of tags of a device
- lat (number): The latitude of a device
- lng (number): The longitude of a device
- address (string): The address of a device
- notes (string): The notes for the device. String. Limited to 255 characters.
- moveMapMarker (boolean): Whether or not to set the latitude and longitude of a device based on the new address. Only applies when lat and lng are not specified.
- switchProfileId (string): The ID of a switch template to bind to the device (for available switch templates, see the 'Switch Templates' endpoint). Use null to unbind the switch device from the current profile. For a device to be bindable to a switch template, it must (1) be a switch, and (2) belong to a network that is bound to a configuration template.
- floorPlanId (string): The floor plan to associate to this device. null disassociates the device from the floorplan.
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'configure'],
'operation': 'updateDevice'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}'
body_params = ['name', 'tags', 'lat', 'lng', 'address', 'notes', 'moveMapMarker', 'switchProfileId', 'floorPlanId', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.put(metadata, resource, payload)
def blinkDeviceLeds(self, serial: str, **kwargs):
"""
**Blink the LEDs on a device**
https://developer.cisco.com/meraki/api-v1/#!blink-device-leds
- serial (string): Serial
- duration (integer): The duration in seconds. Must be between 5 and 120. Default is 20 seconds
- period (integer): The period in milliseconds. Must be between 100 and 1000. Default is 160 milliseconds
- duty (integer): The duty cycle as the percent active. Must be between 10 and 90. Default is 50.
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'liveTools'],
'operation': 'blinkDeviceLeds'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/blinkLeds'
body_params = ['duration', 'period', 'duty', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.post(metadata, resource, payload)
def getDeviceCellularSims(self, serial: str):
"""
**Return the SIM and APN configurations for a cellular device.**
https://developer.cisco.com/meraki/api-v1/#!get-device-cellular-sims
- serial (string): Serial
"""
metadata = {
'tags': ['devices', 'configure', 'cellular', 'sims'],
'operation': 'getDeviceCellularSims'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/cellular/sims'
return self._session.get(metadata, resource)
def updateDeviceCellularSims(self, serial: str, **kwargs):
"""
**Updates the SIM and APN configurations for a cellular device.**
https://developer.cisco.com/meraki/api-v1/#!update-device-cellular-sims
- serial (string): Serial
- sims (array): List of SIMs. If a SIM was previously configured and not specified in this request, it will remain unchanged.
- simOrdering (array): Specifies the ordering of all SIMs for an MG: primary, secondary, and not-in-use (when applicable). It's required for devices with 3 or more SIMs and can be used in place of 'isPrimary' for dual-SIM devices. To indicate eSIM, use 'sim3'. Sim failover will occur only between primary and secondary sim slots.
- simFailover (object): SIM Failover settings.
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'configure', 'cellular', 'sims'],
'operation': 'updateDeviceCellularSims'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/cellular/sims'
body_params = ['sims', 'simOrdering', 'simFailover', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.put(metadata, resource, payload)
def getDeviceClients(self, serial: str, **kwargs):
"""
**List the clients of a device, up to a maximum of a month ago**
https://developer.cisco.com/meraki/api-v1/#!get-device-clients
- serial (string): Serial
- t0 (string): The beginning of the timespan for the data. The maximum lookback period is 31 days from today.
- timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameter t0. The value must be in seconds and be less than or equal to 31 days. The default is 1 day.
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'monitor', 'clients'],
'operation': 'getDeviceClients'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/clients'
query_params = ['t0', 'timespan', ]
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}
return self._session.get(metadata, resource, params)
def createDeviceLiveToolsArpTable(self, serial: str, **kwargs):
"""
**Enqueue a job to perform a ARP table request for the device**
https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-arp-table
- serial (string): Serial
- callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'liveTools', 'arpTable'],
'operation': 'createDeviceLiveToolsArpTable'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/liveTools/arpTable'
body_params = ['callback', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.post(metadata, resource, payload)
def getDeviceLiveToolsArpTable(self, serial: str, arpTableId: str):
"""
**Return an ARP table live tool job.**
https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-arp-table
- serial (string): Serial
- arpTableId (string): Arp table ID
"""
metadata = {
'tags': ['devices', 'liveTools', 'arpTable'],
'operation': 'getDeviceLiveToolsArpTable'
}
serial = urllib.parse.quote(str(serial), safe='')
arpTableId = urllib.parse.quote(str(arpTableId), safe='')
resource = f'/devices/{serial}/liveTools/arpTable/{arpTableId}'
return self._session.get(metadata, resource)
def createDeviceLiveToolsCableTest(self, serial: str, ports: list, **kwargs):
"""
**Enqueue a job to perform a cable test for the device on the specified ports**
https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-cable-test
- serial (string): Serial
- ports (array): A list of ports for which to perform the cable test. For Catalyst switches, IOS interface names are also supported, such as "GigabitEthernet1/0/8", "Gi1/0/8", or even "1/0/8".
- callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'liveTools', 'cableTest'],
'operation': 'createDeviceLiveToolsCableTest'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/liveTools/cableTest'
body_params = ['ports', 'callback', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.post(metadata, resource, payload)
def getDeviceLiveToolsCableTest(self, serial: str, id: str):
"""
**Return a cable test live tool job.**
https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-cable-test
- serial (string): Serial
- id (string): ID
"""
metadata = {
'tags': ['devices', 'liveTools', 'cableTest'],
'operation': 'getDeviceLiveToolsCableTest'
}
serial = urllib.parse.quote(str(serial), safe='')
id = urllib.parse.quote(str(id), safe='')
resource = f'/devices/{serial}/liveTools/cableTest/{id}'
return self._session.get(metadata, resource)
def createDeviceLiveToolsLedsBlink(self, serial: str, duration: int, **kwargs):
"""
**Enqueue a job to blink LEDs on a device**
https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-leds-blink
- serial (string): Serial
- duration (integer): The duration in seconds to blink LEDs.
- callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'liveTools', 'leds', 'blink'],
'operation': 'createDeviceLiveToolsLedsBlink'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/liveTools/leds/blink'
body_params = ['duration', 'callback', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.post(metadata, resource, payload)
def getDeviceLiveToolsLedsBlink(self, serial: str, ledsBlinkId: str):
"""
**Return a blink LEDs job**
https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-leds-blink
- serial (string): Serial
- ledsBlinkId (string): Leds blink ID
"""
metadata = {
'tags': ['devices', 'liveTools', 'leds', 'blink'],
'operation': 'getDeviceLiveToolsLedsBlink'
}
serial = urllib.parse.quote(str(serial), safe='')
ledsBlinkId = urllib.parse.quote(str(ledsBlinkId), safe='')
resource = f'/devices/{serial}/liveTools/leds/blink/{ledsBlinkId}'
return self._session.get(metadata, resource)
def createDeviceLiveToolsMacTable(self, serial: str, **kwargs):
"""
**Enqueue a job to request the MAC table from the device**
https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-mac-table
- serial (string): Serial
- callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'liveTools', 'macTable'],
'operation': 'createDeviceLiveToolsMacTable'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/liveTools/macTable'
body_params = ['callback', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.post(metadata, resource, payload)
def getDeviceLiveToolsMacTable(self, serial: str, macTableId: str):
"""
**Return a MAC table live tool job.**
https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-mac-table
- serial (string): Serial
- macTableId (string): Mac table ID
"""
metadata = {
'tags': ['devices', 'liveTools', 'macTable'],
'operation': 'getDeviceLiveToolsMacTable'
}
serial = urllib.parse.quote(str(serial), safe='')
macTableId = urllib.parse.quote(str(macTableId), safe='')
resource = f'/devices/{serial}/liveTools/macTable/{macTableId}'
return self._session.get(metadata, resource)
def createDeviceLiveToolsMulticastRouting(self, serial: str, **kwargs):
"""
**Enqueue a job to perform a Multicast routing request for the device**
https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-multicast-routing
- serial (string): Serial
- callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'liveTools', 'multicastRouting'],
'operation': 'createDeviceLiveToolsMulticastRouting'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/liveTools/multicastRouting'
body_params = ['callback', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.post(metadata, resource, payload)
def getDeviceLiveToolsMulticastRouting(self, serial: str, multicastRoutingId: str):
"""
**Return a Multicast routing live tool job.**
https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-multicast-routing
- serial (string): Serial
- multicastRoutingId (string): Multicast routing ID
"""
metadata = {
'tags': ['devices', 'liveTools', 'multicastRouting'],
'operation': 'getDeviceLiveToolsMulticastRouting'
}
serial = urllib.parse.quote(str(serial), safe='')
multicastRoutingId = urllib.parse.quote(str(multicastRoutingId), safe='')
resource = f'/devices/{serial}/liveTools/multicastRouting/{multicastRoutingId}'
return self._session.get(metadata, resource)
def createDeviceLiveToolsPing(self, serial: str, target: str, **kwargs):
"""
**Enqueue a job to ping a target host from the device**
https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-ping
- serial (string): Serial
- target (string): FQDN, IPv4 or IPv6 address
- count (integer): Count parameter to pass to ping. [1..5], default 5
- callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'liveTools', 'ping'],
'operation': 'createDeviceLiveToolsPing'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/liveTools/ping'
body_params = ['target', 'count', 'callback', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.post(metadata, resource, payload)
def getDeviceLiveToolsPing(self, serial: str, id: str):
"""
**Return a ping job**
https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-ping
- serial (string): Serial
- id (string): ID
"""
metadata = {
'tags': ['devices', 'liveTools', 'ping'],
'operation': 'getDeviceLiveToolsPing'
}
serial = urllib.parse.quote(str(serial), safe='')
id = urllib.parse.quote(str(id), safe='')
resource = f'/devices/{serial}/liveTools/ping/{id}'
return self._session.get(metadata, resource)
def createDeviceLiveToolsPingDevice(self, serial: str, **kwargs):
"""
**Enqueue a job to check connectivity status to the device**
https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-ping-device
- serial (string): Serial
- count (integer): Count parameter to pass to ping. [1..5], default 5
- callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'liveTools', 'pingDevice'],
'operation': 'createDeviceLiveToolsPingDevice'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/liveTools/pingDevice'
body_params = ['count', 'callback', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.post(metadata, resource, payload)
def getDeviceLiveToolsPingDevice(self, serial: str, id: str):
"""
**Return a ping device job**
https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-ping-device
- serial (string): Serial
- id (string): ID
"""
metadata = {
'tags': ['devices', 'liveTools', 'pingDevice'],
'operation': 'getDeviceLiveToolsPingDevice'
}
serial = urllib.parse.quote(str(serial), safe='')
id = urllib.parse.quote(str(id), safe='')
resource = f'/devices/{serial}/liveTools/pingDevice/{id}'
return self._session.get(metadata, resource)
def createDeviceLiveToolsThroughputTest(self, serial: str, **kwargs):
"""
**Enqueue a job to test a device throughput, the test will run for 10 secs to test throughput**
https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-throughput-test
- serial (string): Serial
- callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'liveTools', 'throughputTest'],
'operation': 'createDeviceLiveToolsThroughputTest'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/liveTools/throughputTest'
body_params = ['callback', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.post(metadata, resource, payload)
def getDeviceLiveToolsThroughputTest(self, serial: str, throughputTestId: str):
"""
**Return a throughput test job**
https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-throughput-test
- serial (string): Serial
- throughputTestId (string): Throughput test ID
"""
metadata = {
'tags': ['devices', 'liveTools', 'throughputTest'],
'operation': 'getDeviceLiveToolsThroughputTest'
}
serial = urllib.parse.quote(str(serial), safe='')
throughputTestId = urllib.parse.quote(str(throughputTestId), safe='')
resource = f'/devices/{serial}/liveTools/throughputTest/{throughputTestId}'
return self._session.get(metadata, resource)
def createDeviceLiveToolsWakeOnLan(self, serial: str, vlanId: int, mac: str, **kwargs):
"""
**Enqueue a job to send a Wake-on-LAN packet from the device**
https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-wake-on-lan
- serial (string): Serial
- vlanId (integer): The target's VLAN (1 to 4094)
- mac (string): The target's MAC address
- callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'liveTools', 'wakeOnLan'],
'operation': 'createDeviceLiveToolsWakeOnLan'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/liveTools/wakeOnLan'
body_params = ['vlanId', 'mac', 'callback', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.post(metadata, resource, payload)
def getDeviceLiveToolsWakeOnLan(self, serial: str, wakeOnLanId: str):
"""
**Return a Wake-on-LAN job**
https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-wake-on-lan
- serial (string): Serial
- wakeOnLanId (string): Wake on lan ID
"""
metadata = {
'tags': ['devices', 'liveTools', 'wakeOnLan'],
'operation': 'getDeviceLiveToolsWakeOnLan'
}
serial = urllib.parse.quote(str(serial), safe='')
wakeOnLanId = urllib.parse.quote(str(wakeOnLanId), safe='')
resource = f'/devices/{serial}/liveTools/wakeOnLan/{wakeOnLanId}'
return self._session.get(metadata, resource)
def getDeviceLldpCdp(self, serial: str):
"""
**List LLDP and CDP information for a device**
https://developer.cisco.com/meraki/api-v1/#!get-device-lldp-cdp
- serial (string): Serial
"""
metadata = {
'tags': ['devices', 'monitor', 'lldpCdp'],
'operation': 'getDeviceLldpCdp'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/lldpCdp'
return self._session.get(metadata, resource)
def getDeviceLossAndLatencyHistory(self, serial: str, ip: str, **kwargs):
"""
**Get the uplink loss percentage and latency in milliseconds, and goodput in kilobits per second for MX, MG and Z devices.**
https://developer.cisco.com/meraki/api-v1/#!get-device-loss-and-latency-history
- serial (string): Serial
- ip (string): The destination IP used to obtain the requested stats. This is required.
- t0 (string): The beginning of the timespan for the data. The maximum lookback period is 60 days from today.
- t1 (string): The end of the timespan for the data. t1 can be a maximum of 31 days after t0.
- timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be less than or equal to 31 days. The default is 1 day.
- resolution (integer): The time resolution in seconds for returned data. The valid resolutions are: 60, 600, 3600, 86400. The default is 60.
- uplink (string): The WAN uplink used to obtain the requested stats. Valid uplinks are wan1, wan2, wan3, cellular. The default is wan1.
"""
kwargs.update(locals())
if 'uplink' in kwargs:
options = ['cellular', 'wan1', 'wan2', 'wan3']
assert kwargs['uplink'] in options, f'''"uplink" cannot be "{kwargs['uplink']}", & must be set to one of: {options}'''
metadata = {
'tags': ['devices', 'monitor', 'uplinks', 'lossAndLatencyHistory'],
'operation': 'getDeviceLossAndLatencyHistory'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/lossAndLatencyHistory'
query_params = ['t0', 't1', 'timespan', 'resolution', 'uplink', 'ip', ]
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}
return self._session.get(metadata, resource, params)
def getDeviceManagementInterface(self, serial: str):
"""
**Return the management interface settings for a device**
https://developer.cisco.com/meraki/api-v1/#!get-device-management-interface
- serial (string): Serial
"""
metadata = {
'tags': ['devices', 'configure', 'managementInterface'],
'operation': 'getDeviceManagementInterface'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/managementInterface'
return self._session.get(metadata, resource)
def updateDeviceManagementInterface(self, serial: str, **kwargs):
"""
**Update the management interface settings for a device**
https://developer.cisco.com/meraki/api-v1/#!update-device-management-interface
- serial (string): Serial
- wan1 (object): WAN 1 settings
- wan2 (object): WAN 2 settings (only for MX devices)
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'configure', 'managementInterface'],
'operation': 'updateDeviceManagementInterface'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/managementInterface'
body_params = ['wan1', 'wan2', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.put(metadata, resource, payload)
def rebootDevice(self, serial: str):
"""
**Reboot a device**
https://developer.cisco.com/meraki/api-v1/#!reboot-device
- serial (string): Serial
"""
metadata = {
'tags': ['devices', 'liveTools'],
'operation': 'rebootDevice'
}
serial = urllib.parse.quote(str(serial), safe='')
resource = f'/devices/{serial}/reboot'
return self._session.post(metadata, resource)