Search code examples
openstackopenstack-neutron

Openstack Neutron: Adding static Router for the router via rest api


I am unable to make PUT request for adding static route for the Router .

I got the following error :

{
"NeutronError": {
 "message": "Invalid input for external_gateway_info. Reason: Unexpected keys supplied: routes.",
"type": "HTTPBadRequest",
"detail": ""
}
} 

and my request payload is :

{ 

"router": { 

"distributed": false, 
"external_gateway_info": { 
"network_id": "04901d68-eb70-410c-a2ae-e4b77d4e4641",
"enable_snat": true, 
"routes": [ 
{ 
"destination": "112.112.112.0/24", 
"nexthop": "117.97.10.2" 
} 

] 

} 

} 

} 

And, my url is: /routers/{:routerId}

With the same routes, I am able to add static route in open stack neutron but not via API request.

Any improvements in this method?


Solution

  • Please use this below payload.

    { "router": { "distributed": false, "routes": [ { "destination": "172.1.1.0/24", "nexthop": "177.77.44.11" } ] } }