How to add external network to a router via restful api?

asked 2015-03-30 06:15:22 -0500

frz59 gravatar image

updated 2015-03-30 06:16:11 -0500

Hi there, I want to update my router and add an external gateway via RestFul api. but I can't find any reference for that. Could you help me?

edit retag flag offensive close merge delete


  1. neutron client is exposing api add_gateway_router() which can be used
Ranjit gravatar imageRanjit ( 2015-03-30 07:40:24 -0500 )edit

or if you want to create http request ,then first debug the output of command

neutron --debug router-gateway-set router-id network-id .

you will get to know the actual restful api and required paramters

Ranjit gravatar imageRanjit ( 2015-03-30 07:44:44 -0500 )edit

^ I agree that's your best bet just reading the debug output and pulling the required curl commands.

omar-munoz gravatar imageomar-munoz ( 2015-03-30 13:16:30 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-03-31 02:49:20 -0500

frz59 gravatar image

I found the answer. Thank You @Ranjit

 curl -i -X PUT http://<server_address>:9696/v2.0/routers/<router_id> -H "User-Agent: python-neutronclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: TOKEN_REDACTED" -d '{"router": {"external_gateway_info": {"network_id":"<network_id>"}}}'
edit flag offensive delete link more


i m creating a router with external ntwrk as a response i dont get any port information from response .But if i see new port get's added dynamically for that network with "router_external_gateway" . Is there any way to collect my port info frm my external network id or routerid without port rest api

micheal-jordan gravatar imagemicheal-jordan ( 2018-08-11 05:48:11 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools



Asked: 2015-03-30 06:15:22 -0500

Seen: 761 times

Last updated: Mar 31 '15