Config Templates settings

SOLVED
Greenberet
Head in the Cloud

Config Templates settings

Hello,

 

is it possible to read the config template settings?

I know you can get the config templates itself with "

GET /organizations/{organizationId}/configTemplates

 

And the result looks like this
 

[ { "id": "N_24329156", "name": "My config template", "productTypes": [ "appliance", "switch", "wireless" ] } ]

 

I've tried to get a list of devices with the id from this result as "network" id, but it is always empty. In this special case I'm interested in the appliance settings.

I want to read the local subnets settings and compare that to the ones which are used by the networks to get some kind of usage report.

1 ACCEPTED SOLUTION

I've created the needed script.

Please make sure, that you have the latest meraki api installed (released a few days ago).

pip3 install meraki -U

 

script download

 

usage:

 

usage: aio_list_used_template_ranges.py [-h] -o ORGANIZATIONS
                                        [ORGANIZATIONS ...]

Analyze the usage of subnetPool templates

optional arguments:
  -h, --help            show this help message and exit
  -o ORGANIZATIONS [ORGANIZATIONS ...], --organization ORGANIZATIONS [ORGANIZATIONS ...]
                        the name/id of the organization(s) you want to analyze

 

 

 

Example Output:

 

 

Analyzing organization Template_Demo
Downloading Changelog
Downloading templates
Analyzing template Template_One
Analyzing template Template_Two
Analyzing template Template_Three
Analyzing template Template_Four
Analyzing template Template_Five
Getting largest supernetworks:
172.16.0.0/21 mask 28
172.16.8.0/21 mask 29
172.16.16.0/21 mask 28
Downloading VLAN information
172.16.0.0/21 mask 28 subnetworks: total=128 used=34 free=94 -> usage 26.5625%
172.16.8.0/21 mask 29 subnetworks: total=256 used=20 free=236 -> usage 7.8125%
172.16.16.0/21 mask 28 subnetworks: total=128 used=32 free=96 -> usage 25.0%

 

 

 

How it works:

 

Step 1:

Since we don't have access yet to the address settings in the network template, this script will download the organization changelog.

 

Step 2:

It will download all templates and map all network configuration changes to the templates.

Which also means, that it can only detect networks of a template which got changed in the last 14 months or 2 years. see Meraki Documentation for details 

 

Step 3:

It will search for the biggest standalone supernetworks and map the smallest possible mask.

 

Step 4:

It will download the vlan information of all networks and calculate their usage on their respective supernetwork.

 

Step 5:

Print results

View solution in original post

11 REPLIES 11
PhilipDAth
Kind of a big deal
Kind of a big deal

I've done exactly this to retrieve network settings.

 

You do just as you say - treated the retrieve template ID and use it as a network ID.  Then you can retrieve all the settings.

 

You wont be able to retrieve information on specific devices - as a template doesn't contain actual physical devices.

Do you know how to get the address/vlan configuration over the api from the template?

Not specifically.  What happens when you use the normal API calls to retrieve the VLANs?

 

https://dashboard.meraki.com/api_docs/v0#vlans 

Empty IP Addresses 😞

If you have auto-generated IP addresses, it won't pull those back for some reason.

The generated IP subnets are in the normal networks, so you should be querying the networks to get that info.

I'm not talking about the generated one. I want the address settings from which they are generated

Unfortunately it looks like you are out of luck.  Maybe use the make a wish function? 

I've added a new IDEA in the early developer community. API related wishes are getting more attention there.

If someone else needs that information, then there is some tricky workaround.

You can extract the subnet settings from the dashboard changelog and use the latest one.

 

Greenberet_0-1585265742395.png

 

Edgar-VO
Building a reputation

Good Morning,

 

We used templates as well, however due to some freak things, we were not able to autogenerate the VLAN IP addresses anymore. This really sucks... Also due to the nature of binding a network to the template, adding or removing stuff will result in errors.. Also later unbinding the template will have some effects on the current settings....

 

We in our organisation are not using templates anymore, and start using scripts to create networks and adding devices to that network... 

 

The easiest way would be browsing through your route table but it is not really possible to find a free IP range, so i created a python script which browses though all the networks, creates a list of all used network subnets, and then picks one which is not in use.

 

 

 

 

I've created the needed script.

Please make sure, that you have the latest meraki api installed (released a few days ago).

pip3 install meraki -U

 

script download

 

usage:

 

usage: aio_list_used_template_ranges.py [-h] -o ORGANIZATIONS
                                        [ORGANIZATIONS ...]

Analyze the usage of subnetPool templates

optional arguments:
  -h, --help            show this help message and exit
  -o ORGANIZATIONS [ORGANIZATIONS ...], --organization ORGANIZATIONS [ORGANIZATIONS ...]
                        the name/id of the organization(s) you want to analyze

 

 

 

Example Output:

 

 

Analyzing organization Template_Demo
Downloading Changelog
Downloading templates
Analyzing template Template_One
Analyzing template Template_Two
Analyzing template Template_Three
Analyzing template Template_Four
Analyzing template Template_Five
Getting largest supernetworks:
172.16.0.0/21 mask 28
172.16.8.0/21 mask 29
172.16.16.0/21 mask 28
Downloading VLAN information
172.16.0.0/21 mask 28 subnetworks: total=128 used=34 free=94 -> usage 26.5625%
172.16.8.0/21 mask 29 subnetworks: total=256 used=20 free=236 -> usage 7.8125%
172.16.16.0/21 mask 28 subnetworks: total=128 used=32 free=96 -> usage 25.0%

 

 

 

How it works:

 

Step 1:

Since we don't have access yet to the address settings in the network template, this script will download the organization changelog.

 

Step 2:

It will download all templates and map all network configuration changes to the templates.

Which also means, that it can only detect networks of a template which got changed in the last 14 months or 2 years. see Meraki Documentation for details 

 

Step 3:

It will search for the biggest standalone supernetworks and map the smallest possible mask.

 

Step 4:

It will download the vlan information of all networks and calculate their usage on their respective supernetwork.

 

Step 5:

Print results

Get notified when there are additional replies to this discussion.