forked from meraki/dashboard-api-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcellularGateway.py
More file actions
298 lines (204 loc) · 11.8 KB
/
Copy pathcellularGateway.py
File metadata and controls
298 lines (204 loc) · 11.8 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
class CellularGateway(object):
def __init__(self, session):
super(CellularGateway, self).__init__()
self._session = session
def getDeviceCellularGatewayLan(self, serial: str):
"""
**Show the LAN Settings of a MG**
https://developer.cisco.com/meraki/api-v1/#!get-device-cellular-gateway-lan
- serial (string): (required)
"""
metadata = {
'tags': ['cellularGateway', 'configure', 'lan'],
'operation': 'getDeviceCellularGatewayLan'
}
resource = f'/devices/{serial}/cellularGateway/lan'
return self._session.get(metadata, resource)
def updateDeviceCellularGatewayLan(self, serial: str, **kwargs):
"""
**Update the LAN Settings for a single MG.**
https://developer.cisco.com/meraki/api-v1/#!update-device-cellular-gateway-lan
- serial (string): (required)
- reservedIpRanges (array): list of all reserved IP ranges for a single MG
- fixedIpAssignments (array): list of all fixed IP assignments for a single MG
"""
kwargs.update(locals())
metadata = {
'tags': ['cellularGateway', 'configure', 'lan'],
'operation': 'updateDeviceCellularGatewayLan'
}
resource = f'/devices/{serial}/cellularGateway/lan'
body_params = ['reservedIpRanges', 'fixedIpAssignments', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.put(metadata, resource, payload)
def getDeviceCellularGatewayPortForwardingRules(self, serial: str):
"""
**Returns the port forwarding rules for a single MG.**
https://developer.cisco.com/meraki/api-v1/#!get-device-cellular-gateway-port-forwarding-rules
- serial (string): (required)
"""
metadata = {
'tags': ['cellularGateway', 'configure', 'portForwardingRules'],
'operation': 'getDeviceCellularGatewayPortForwardingRules'
}
resource = f'/devices/{serial}/cellularGateway/portForwardingRules'
return self._session.get(metadata, resource)
def updateDeviceCellularGatewayPortForwardingRules(self, serial: str, **kwargs):
"""
**Updates the port forwarding rules for a single MG.**
https://developer.cisco.com/meraki/api-v1/#!update-device-cellular-gateway-port-forwarding-rules
- serial (string): (required)
- rules (array): An array of port forwarding params
"""
kwargs.update(locals())
metadata = {
'tags': ['cellularGateway', 'configure', 'portForwardingRules'],
'operation': 'updateDeviceCellularGatewayPortForwardingRules'
}
resource = f'/devices/{serial}/cellularGateway/portForwardingRules'
body_params = ['rules', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.put(metadata, resource, payload)
def getNetworkCellularGatewayConnectivityMonitoringDestinations(self, networkId: str):
"""
**Return the connectivity testing destinations for an MG network**
https://developer.cisco.com/meraki/api-v1/#!get-network-cellular-gateway-connectivity-monitoring-destinations
- networkId (string): (required)
"""
metadata = {
'tags': ['cellularGateway', 'configure', 'connectivityMonitoringDestinations'],
'operation': 'getNetworkCellularGatewayConnectivityMonitoringDestinations'
}
resource = f'/networks/{networkId}/cellularGateway/connectivityMonitoringDestinations'
return self._session.get(metadata, resource)
def updateNetworkCellularGatewayConnectivityMonitoringDestinations(self, networkId: str, **kwargs):
"""
**Update the connectivity testing destinations for an MG network**
https://developer.cisco.com/meraki/api-v1/#!update-network-cellular-gateway-connectivity-monitoring-destinations
- networkId (string): (required)
- destinations (array): The list of connectivity monitoring destinations
"""
kwargs.update(locals())
metadata = {
'tags': ['cellularGateway', 'configure', 'connectivityMonitoringDestinations'],
'operation': 'updateNetworkCellularGatewayConnectivityMonitoringDestinations'
}
resource = f'/networks/{networkId}/cellularGateway/connectivityMonitoringDestinations'
body_params = ['destinations', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.put(metadata, resource, payload)
def getNetworkCellularGatewayDhcp(self, networkId: str):
"""
**List common DHCP settings of MGs**
https://developer.cisco.com/meraki/api-v1/#!get-network-cellular-gateway-dhcp
- networkId (string): (required)
"""
metadata = {
'tags': ['cellularGateway', 'configure', 'dhcp'],
'operation': 'getNetworkCellularGatewayDhcp'
}
resource = f'/networks/{networkId}/cellularGateway/dhcp'
return self._session.get(metadata, resource)
def updateNetworkCellularGatewayDhcp(self, networkId: str, **kwargs):
"""
**Update common DHCP settings of MGs**
https://developer.cisco.com/meraki/api-v1/#!update-network-cellular-gateway-dhcp
- networkId (string): (required)
- dhcpLeaseTime (string): DHCP Lease time for all MG of the network. It can be '30 minutes', '1 hour', '4 hours', '12 hours', '1 day' or '1 week'.
- dnsNameservers (string): DNS name servers mode for all MG of the network. It can take 4 different values: 'upstream_dns', 'google_dns', 'opendns', 'custom'.
- dnsCustomNameservers (array): list of fixed IP representing the the DNS Name servers when the mode is 'custom'
"""
kwargs.update(locals())
metadata = {
'tags': ['cellularGateway', 'configure', 'dhcp'],
'operation': 'updateNetworkCellularGatewayDhcp'
}
resource = f'/networks/{networkId}/cellularGateway/dhcp'
body_params = ['dhcpLeaseTime', 'dnsNameservers', 'dnsCustomNameservers', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.put(metadata, resource, payload)
def getNetworkCellularGatewaySubnetPool(self, networkId: str):
"""
**Return the subnet pool and mask configured for MGs in the network.**
https://developer.cisco.com/meraki/api-v1/#!get-network-cellular-gateway-subnet-pool
- networkId (string): (required)
"""
metadata = {
'tags': ['cellularGateway', 'configure', 'subnetPool'],
'operation': 'getNetworkCellularGatewaySubnetPool'
}
resource = f'/networks/{networkId}/cellularGateway/subnetPool'
return self._session.get(metadata, resource)
def updateNetworkCellularGatewaySubnetPool(self, networkId: str, **kwargs):
"""
**Update the subnet pool and mask configuration for MGs in the network.**
https://developer.cisco.com/meraki/api-v1/#!update-network-cellular-gateway-subnet-pool
- networkId (string): (required)
- mask (integer): Mask used for the subnet of all MGs in this network.
- cidr (string): CIDR of the pool of subnets. Each MG in this network will automatically pick a subnet from this pool.
"""
kwargs.update(locals())
metadata = {
'tags': ['cellularGateway', 'configure', 'subnetPool'],
'operation': 'updateNetworkCellularGatewaySubnetPool'
}
resource = f'/networks/{networkId}/cellularGateway/subnetPool'
body_params = ['mask', 'cidr', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.put(metadata, resource, payload)
def getNetworkCellularGatewayUplink(self, networkId: str):
"""
**Returns the uplink settings for your MG network.**
https://developer.cisco.com/meraki/api-v1/#!get-network-cellular-gateway-uplink
- networkId (string): (required)
"""
metadata = {
'tags': ['cellularGateway', 'configure', 'uplink'],
'operation': 'getNetworkCellularGatewayUplink'
}
resource = f'/networks/{networkId}/cellularGateway/uplink'
return self._session.get(metadata, resource)
def updateNetworkCellularGatewayUplink(self, networkId: str, **kwargs):
"""
**Updates the uplink settings for your MG network.**
https://developer.cisco.com/meraki/api-v1/#!update-network-cellular-gateway-uplink
- networkId (string): (required)
- bandwidthLimits (object): The bandwidth settings for the 'cellular' uplink
"""
kwargs.update(locals())
metadata = {
'tags': ['cellularGateway', 'configure', 'uplink'],
'operation': 'updateNetworkCellularGatewayUplink'
}
resource = f'/networks/{networkId}/cellularGateway/uplink'
body_params = ['bandwidthLimits', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
return self._session.put(metadata, resource, payload)
def getOrganizationCellularGatewayUplinkStatuses(self, organizationId: str, total_pages=1, direction='next', **kwargs):
"""
**List the uplink status of every Meraki MG cellular gateway in the organization**
https://developer.cisco.com/meraki/api-v1/#!get-organization-cellular-gateway-uplink-statuses
- organizationId (string): (required)
- total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages
- direction (string): direction to paginate, either "next" (default) or "prev" page
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 1000.
- startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it.
- endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it.
- networkIds (array): A list of network IDs. The returned devices will be filtered to only include these networks.
- serials (array): A list of serial numbers. The returned devices will be filtered to only include these serials.
- iccids (array): A list of ICCIDs. The returned devices will be filtered to only include these ICCIDs.
"""
kwargs.update(locals())
metadata = {
'tags': ['cellularGateway', 'monitor', 'uplink', 'statuses'],
'operation': 'getOrganizationCellularGatewayUplinkStatuses'
}
resource = f'/organizations/{organizationId}/cellularGateway/uplink/statuses'
query_params = ['perPage', 'startingAfter', 'endingBefore', 'networkIds', 'serials', 'iccids', ]
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}
array_params = ['networkIds', 'serials', 'iccids', ]
for k, v in kwargs.items():
if k.strip() in array_params:
params[f'{k.strip()}[]'] = kwargs[f'{k}']
params.pop(k.strip())
return self._session.get_pages(metadata, resource, params, total_pages, direction)