Create multiple static routes with a single API call - is it possible with an input file?

Steven
Getting noticed

Create multiple static routes with a single API call - is it possible with an input file?

I tried creating a file like so: [ {static1...}, {static2...}, {staticN...} ] And then I tried using curl with the -d @filename option to add multiple statics to a network but it doesn't work. I can add a single static route using this method but I'm hoping to be able to do it with a single call if possible. I have a lot of routes I need to add.
10 Replies 10
Uberseehandel
Kind of a big deal

@Steven

 

Have you considered using a list structure and iterating through it  . . . 

 

route_dest = ['static_1', 'static_2', . . . ]

for route in route_dest:

       . . . .

       . . . .

Robin St.Clair | Principal, Caithness Analytics | @uberseehandel
MerakiDave
Meraki Employee
Meraki Employee

Unfortunately no, not today, the API call passes a single data structure for a single static route, so unfortunately it will require one API call per route today.  Certainly easy enough to set up a for loop in your script, but it will be individual API calls.  Make a wish and I'll do the same, I recently had to create some networks with about 2 dozen statics, and ran into this, cannot do it from a single call, unlike L3 FW rules for example, where you could place dozens or hundreds of FW rules with a single API call.  Just not there today for statics.

Steven
Getting noticed


@MerakiDavewrote:

Unfortunately no, not today, the API call passes a single data structure for a single static route, so unfortunately it will require one API call per route today.  Certainly easy enough to set up a for loop in your script, but it will be individual API calls.  Make a wish and I'll do the same, I recently had to create some networks with about 2 dozen statics, and ran into this, cannot do it from a single call, unlike L3 FW rules for example, where you could place dozens or hundreds of FW rules with a single API call.  Just not there today for statics.


My kingdom to only have to create a couple of dozen statics.  I'm looking at between 500 and 1000.  While we're wishing for stuff, how about policy-based routing?  It's only been a common thing for about a decade or more.  Would absolutely solve all of my problems right now.

Uberseehandel
Kind of a big deal

I am using Node-Red to do an autonomous flight control project, it is asynchronous, and is used by Meraki & Cisco devs for demo purposes. You may be able to use it to run multiple threads, and not have to sweat Python. It might sound over-kill, but it is a joy and a revelation to use. You just plug stuff in, it is built on node.js

Robin St.Clair | Principal, Caithness Analytics | @uberseehandel
MerakiDave
Meraki Employee
Meraki Employee

Not to oversimplify, but if I had 1,000 static routes, I would redesign and consider running an appropriate routing protocol.  MX can do both policy based routing and performance based routing as part of the standard SDWAN offering.  I'm guessing it's not fitting your use case for some reason, please discuss with your Meraki or Meraki Partner SE and they will attach notes to the appropriate feature request.  Agree on the API calls for statics that for now it won't be a problem, but will just take longer, might take a couple minutes to place that many statics via API.

DexterLaBora
Meraki Employee
Meraki Employee

You got my attention at Node-RED 🙂

 

Here is an early preview of a Demo Node-RED server I am setting up. 

 

https://merakidemo.internetoflego.com

 

It will demonstrate how to use all of the Meraki APIs in various ways.

- Meraki API proxy

- Captive Portal

- Scanning

- Spark

- Meraki API Endpoint samples

 

Working on a complete article, but interested in feedback.

(and sorry for hijacking the thread)

 

API endpointsAPI endpointsSample frontendSample frontend

Uberseehandel
Kind of a big deal

@DexterLaBora

 

I think what you are doing is terrific, a big thumbs up from me.

 

 

Robin St.Clair | Principal, Caithness Analytics | @uberseehandel
Steven
Getting noticed


@Uberseehandelwrote:

@Steven

 

Have you considered using a list structure and iterating through it  . . . 

 

route_dest = ['static_1', 'static_2', . . . ]

for route in route_dest:

       . . . .

       . . . .


For now this is what I've done (in my own backwards way) due to the limitation I seem to be running into.  It's slow but as long as it's automated it shouldn't be a problem.

Overhead
Conversationalist

I would like to ping you on using the JSON or XML get response from /v0/networks/{{networkId}}/staticRoutes

to import the static routes table onto another network in the same org.

Uberseehandel
Kind of a big deal

@Overhead 
I am not currently using a Meraki stack, although I remain a big fan, so you are probably better off discussing this with some of the other posters on this thread or Phil D'Ath.
Our Node-Red projects are very satisfying, in part because when working with multi-disciplinary teams, the user interface is really easy for engineers to interact with (and we hide the geeky protocol pizazz inside innocent sounding functions.

Robin St.Clair | Principal, Caithness Analytics | @uberseehandel
Get notified when there are additional replies to this discussion.