Distinguish between MX and Z

KarstenI
Kind of a big deal
Kind of a big deal

Distinguish between MX and Z

Hi,

 

most of my  networks have an MX, but some networks "only" have a Z3.

When updating the network, I want to make sure not to apply any setting to the Z3 network that is not available (e.g. content filter parameter).

Is there an efficient way to find out if a network has an MX or a Z-device?

 

My only idea is using "getNetworkDevices" and look for the model. But that can't be the solution as the next Meraki innovation could be a Z4 or a new device-type "MZ" and the script will likely fail ...

 

Any idea?

If you found this post helpful, please give it Kudos. If my answer solves your problem, please click Accept as Solution so others can benefit from it.
13 Replies 13
ww
Kind of a big deal
Kind of a big deal

I dont know another way. But you could use ".startswith(Z)" to look for models starting with Z

KarstenI
Kind of a big deal
Kind of a big deal

Still hope there is something better ... 😉

If you found this post helpful, please give it Kudos. If my answer solves your problem, please click Accept as Solution so others can benefit from it.
PhilipDAth
Kind of a big deal
Kind of a big deal

You could just apply the settings, catch the error, and ignore.

Ryan_Miles
Meraki Employee
Meraki Employee

What is the issue though? You can bind a Z3 to a MX template. Unsupported features just won't be used on the Z3.

Ryan

If you found this post helpful, please give it Kudos. If my answer solves your problem please click Accept as Solution so others can benefit from it.
PhilipDAth
Kind of a big deal
Kind of a big deal

I got the impression that @KarstenI is not using a template.  He is just walking across the networks trying to apply a common setting (and perhaps other settings are different preventing the use of a template).

Ryan_Miles
Meraki Employee
Meraki Employee

Perhaps. The scenario sounded like a template type question. If not templates then I understand the issue even less so.

 

They mentioned applying an unsupported config. So, does that mean via API? If so, that would just fail out as well if unsupported.

Ryan

If you found this post helpful, please give it Kudos. If my answer solves your problem please click Accept as Solution so others can benefit from it.
KarstenI
Kind of a big deal
Kind of a big deal

Oh, I just realized that I used the wrong area of the community. My intention was to post in “Developer and API”. Perhaps that caused the confusion …

If you found this post helpful, please give it Kudos. If my answer solves your problem, please click Accept as Solution so others can benefit from it.
KarstenI
Kind of a big deal
Kind of a big deal

One or the other knows that I am not a fan of templates …

For example I want to iterate through all networks and add a new content filtering category that was requested by management.

I really don’t like the suggestion from @PhilipDAth to just run into the error, catch and ignore it. But probably it is more efficient than to check each network.

If you found this post helpful, please give it Kudos. If my answer solves your problem, please click Accept as Solution so others can benefit from it.
rhbirkelund
Kind of a big deal
Kind of a big deal

From the top of my mind;

 

import meraki

## Assume MERAKI_API_ENV_KEY environment variable
dashboard = meraki.Dashboard()

OrgID = "xxx"
Networks = []

OrgDevices = dashboard.organizations.getOrganizationDevices(OrgID, total_pages='all')

for device in OrgDevices:
    if "MX" in device['model']:
        Networks.append(device['networkId']) # Append all network IDs where device Model contains 'MX'. 

for network in Networks:
    do_stuff()
LinkedIn ::: https://blog.rhbirkelund.dk/

Like what you see? - Give a Kudo ## Did it answer your question? - Mark it as a Solution 🙂

All code examples are provided as is. Responsibility for Code execution lies solely your own.
rhbirkelund
Kind of a big deal
Kind of a big deal

Actually, you could also, append all the Z networks in a separat list as well, if you still want to do stuff on it.

 

import meraki

## Assume MERAKI_API_ENV_KEY environment variable
dashboard = meraki.Dashboard()

OrgID = "xxx"
MX_Networks = []
Z_Networks = []

OrgDevices = dashboard.organizations.getOrganizationDevices(OrgID, total_pages='all')

for device in OrgDevices:
    if "MX" in device['model']:
        MX_Networks.append(device['networkId']) # Append all network IDs where device Model contains 'MX'. 
    if "Z" in device['model']:
        Z_Networks.append(device['networkId']) # Append all network IDs where device Model contains 'MX'. 

for network in MX_Networks:
    do_MX_stuff()

for network in Z_Networks:
    do_Z_stuff()
LinkedIn ::: https://blog.rhbirkelund.dk/

Like what you see? - Give a Kudo ## Did it answer your question? - Mark it as a Solution 🙂

All code examples are provided as is. Responsibility for Code execution lies solely your own.
KarstenI
Kind of a big deal
Kind of a big deal

Yes, I think this could be the best solution. Reduces the amount of calls that have to be sent to the dashboard.

If you found this post helpful, please give it Kudos. If my answer solves your problem, please click Accept as Solution so others can benefit from it.
rhbirkelund
Kind of a big deal
Kind of a big deal

You could also test the the NetworkID isn't already in MX_Networks list, so that you don't get double hits, in the case of two MX'es in Warm Spare.

import meraki

## Assume MERAKI_API_ENV_KEY environment variable
dashboard = meraki.Dashboard()

OrgID = "xxx"
MX_Networks = []
Z_Networks = []

OrgDevices = dashboard.organizations.getOrganizationDevices(OrgID, total_pages='all')

for device in OrgDevices:
    if "MX" in device['model'] and device['networkID'] not in MX_Networks:
        MX_Networks.append(device['networkId']) # Append all network IDs where device Model contains 'MX'. 
    if "Z" in device['model']:
        Z_Networks.append(device['networkId']) # Append all network IDs where device Model contains 'Z'. 

for network in MX_Networks:
    do_MX_stuff()

for network in Z_Networks:
    do_Z_stuff()
LinkedIn ::: https://blog.rhbirkelund.dk/

Like what you see? - Give a Kudo ## Did it answer your question? - Mark it as a Solution 🙂

All code examples are provided as is. Responsibility for Code execution lies solely your own.
KarstenI
Kind of a big deal
Kind of a big deal

Yes, that’s important, minimum 90% of my MX are redundant. Although the Z3 is never …

If you found this post helpful, please give it Kudos. If my answer solves your problem, please click Accept as Solution so others can benefit from it.
Get notified when there are additional replies to this discussion.