Swtich ACL scripts??

MSquared
Conversationalist

Swtich ACL scripts??

Hi All,

 

**to start i am not a developer but i do have some experience with python.**

 

Is anyone aware of any scripts to add in ACLs for our switches? we have about 150+ switches we're deploying and we need to create a decent sized ACL for each switch and I would like to automate this process?

 

I was able to use the get the switch ACL in postman for one of our switches and got the json output but my problem is for our different switches i need to modify the third octet of the source IP and apply it to the respected switch so:

 

switch A will get - 10.10.1.0/24

switch b will get - 10.10.2.0/24

and so on....

 

I was able to write a script to get all our our network IDs which is what the postman GET requires but now i am not sure how to go from here.

 

This may be a big ask but if anyone can help i'd appreciate it!!!

 

Thank you,

Matt

7 Replies 7
PhilipDAth
Kind of a big deal
Kind of a big deal

I'll give you a completely different way or doing this.  This is the API reference and it contains a command line curl example to update the ACL.

https://dashboard.meraki.com/api_docs#update-the-access-control-lists-for-a-ms-network 

 

Create your curl command as one line.  Start up excel.  Put the bit of the command up to the network ID in the first cell, the network ID in the second cell and the rest of the curl command in the third cell.

In the fourth cell "add" the prior three prior cells together to form one command.

 

Now replicate this row for every device, and then copy and paste in all the network IDs into the second column.

 

Now the fourth column has call the commands you need to run.  Copy and paste this fourth cell into something like notepad.  If you need to, do a global search/replace to clean up anything you didn't quite get right (formatting wise).

 

Then copy and past the result into a command prompt.

 

 

Your finished.  No coding required.

Hi Philip,

 

Not sure i really follow, never used this method before, is there any more in-depth documentation on this or examples anywhere?

PhilipDAth
Kind of a big deal
Kind of a big deal

I did a Google and can't find any walk throughs sorry.

no worries, I actually get what you have mentioned below, 

 

Where would i run these curl commands though? in a windows command prompt? if so do i need to install anything? I have postman with the Meraki dashboard API, and was able to do a PUT for a switch ACL but it seems like a very manual process

PhilipDAth
Kind of a big deal
Kind of a big deal

>in a windows command prompt?

 

Yes.

 

>if so do i need to install anything?

 

Just curl.  Curl is invaluable for testing, so its a good tool to have anyway.  I put it in my path.  This looks like a valid download.

https://curl.haxx.se/windows/ 

I just found out for the PUT and GET requests in postman you can view the source code in python and get the CURL code so i think i can figure this one out. Thank you for the help! 

PhilipDAth
Kind of a big deal
Kind of a big deal

Python ha a great way of solving this problem.

 

My way is a dirty hack but saves you having to learn another whole skill to solve one problem.

Get notified when there are additional replies to this discussion.