Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions meraki.py
Original file line number Diff line number Diff line change
Expand Up @@ -1679,6 +1679,25 @@ def removedevfromnet(apikey, networkid, serial, suppressprint=False):
return result


# Reboot a single device
# https://api.meraki.com/api_docs#reboot-a-device
def reboot_device(apikey, networkid, serial, suppressprint=False):
calltype = 'Device'
posturl = '{0}/networks/{1}/devices/{2}/reboot'.format(
str(base_url), str(networkid), str(serial))
headers = {
'x-cisco-meraki-api-key': format(str(apikey)),
'Content-Type': 'application/json'
}
dashboard = requests.post(posturl, headers=headers)
#
# Call return handler function to parse Dashboard response
#
result = __returnhandler(
dashboard.status_code, dashboard.text, calltype, suppressprint)
return result


# List LLDP and CDP information for a device
# https://dashboard.meraki.com/api_docs#list-lldp-and-cdp-information-for-a-device
def getlldpcdp(apikey, networkid, serial, timespan=10800, suppressprint=False):
Expand Down Expand Up @@ -2536,6 +2555,44 @@ def get_device_statuses(api_key, org_id, suppress_print=False):
return result


# Return the uplink loss and latency for every MX in the organization from at latest 2 minutes ago
# https://dashboard.meraki.com/api_docs#return-the-uplink-loss-and-latency-for-every-mx-in-the-organization-from-at-latest-2-minutes-ago
def get_uplinks_loss_and_latency(api_key, org_id, params_dict=None, suppress_print=False):
__hasorgaccess(api_key, org_id)

"""
Args:
apikey: User's Meraki API Key
orgid: OrganizationId for operation to be performed against
params_dict (optional): A dictionary of parameters to include in the request. See the dashboard API docs for more details on the available parameters. Below is an example dictionary to include with this function call to return uplink stats for all MXs, for the most recent 60 seconds, for WAN 2:
{'timespan':60, 'uplink':'wan2'}
suppressprint: Suppress any print output from function (Default: False)

Returns: JSON formatted string of uplink stats for each MX in the organization
"""

call_type = 'Device Statuses'

params_string = ''
if params_dict is not None:
for param in params_dict:
params_string += f'{param}={params_dict[param]}&'

get_url = '{0}/organizations/{1}/uplinksLossAndLatency?{2}'.format(
str(base_url), str(org_id), params_string)
headers = {
'x-cisco-meraki-api-key': format(str(api_key)),
'Content-Type': 'application/json'
}
dashboard = requests.get(get_url, headers=headers)
#
# Call return handler function to parse Dashboard response
#
result = __returnhandler(
dashboard.status_code, dashboard.text, call_type, suppress_print)
return result


# Return the SNMP settings for an organization
# https://api.meraki.com/api_docs#return-the-snmp-settings-for-an-organization
def getsnmpsettings(apikey, orgid, suppressprint=False):
Expand Down