Unable to remove the last route from the Router #903

Open
silvanstrueby opened this Issue Dec 13, 2016 · 3 comments

Projects

None yet

3 participants

@silvanstrueby
silvanstrueby commented Dec 13, 2016 edited

I have a static route on my router.
As far as I can see, unfortunately it's impossible to delete the last route from a router with this API.

Router router = client.networking().router().get("ROUTER_ID");
router.getRoutes().clear();
client.networking().router().update(router);

Because if there are no routes left in the router, the body of the router-update-request is getting parsed without the attribute routes.

{
  "router" : {
    "name" : "NAME",
    "external_gateway_info" : {
      "network_id" : "ID",
      "enable_snat" : true
    },
    "admin_state_up" : true,
  }
}

That's why the routes won't get updated.
It would work if the body is getting parsed like this.

{
  "router" : {
    "name" : "NAME",
    "external_gateway_info" : {
      "network_id" : "ID",
      "enable_snat" : true
    },
    "admin_state_up" : true,
    "routes" : []
  }
}

Even when the JavaDoc says update does only work on [ name, admin_state_up and external_gateway_info ], I don't see any other option to remove static routes.

Do I miss something here or is there another possibility to remove static routes?

@silvanstrueby silvanstrueby changed the title from Unable to romove the last route from the Router to Unable to remove the last route from the Router Dec 19, 2016
@auhlig
Member
auhlig commented Dec 22, 2016

Hey @silvanstrueby ,
Is this missing in OpenStack iitself? Or do we need to update OpenStack4j? If so, you're very welcome to submit a PR.

@silvanstrueby

Hi @auhlig,
I would like to create a PR with my fix.
I tried to push my branch but obviously I'm not entitled to do so. Could you please give me a quick hint how i could create a PR?
Thx

@vinodborole
Contributor

@silvanstrueby
You push to your forked copy and create a Pull request from the git gui;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment