Bug 1580254 - removing routers external_gateway by port leaks static_routes
Summary: removing routers external_gateway by port leaks static_routes
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-provider-ovn
Classification: oVirt
Component: provider
Version: 1.2.7
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ovirt-4.2.4
: ---
Assignee: Marcin Mirecki
QA Contact: Roni
URL:
Whiteboard:
Depends On:
Blocks: 1586094
TreeView+ depends on / blocked
 
Reported: 2018-05-21 05:56 UTC by Marcin Mirecki
Modified: 2018-06-26 08:43 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-06-26 08:43:50 UTC
oVirt Team: Network
Embargoed:
rule-engine: ovirt-4.2+


Attachments (Terms of Use)
static_route_test.py (12.54 KB, text/x-python)
2018-06-14 15:21 UTC, Roni
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 91567 0 master MERGED Release network ip when a gateway router is cleared. 2018-05-29 13:15:26 UTC

Description Marcin Mirecki 2018-05-21 05:56:37 UTC
When an external_gateway is added to a router, and it is then removed by port (remove_router_interface with port_id specified) does not clean up the static_routes for the router

Comment 1 Marcin Mirecki 2018-06-04 08:46:59 UTC
How to test it (assuming we have a clean ovn db):

1. Add router
 - add router with an external gateway
   {
     "router":
        {
            ...
            "external_gateway_info": {
                "network_id": "8f59df0f-ea10-4bd6-8c33-778603fc22df",
                "enable_snat": false,
                "external_fixed_ips": [
                    {
                        "subnet_id": "5eadbe4e-af6e-4ad6-8421-7e00c9be0788",
                        "ip_address": "10.10.0.100"
                    }
                ]
            },
            ...
        }
   }

 - check static routes: ovn-nbctl list Logical_Router_Static_Route
 - there should only be one static route

2. Modify external gatway ip
 - modify router to use a different gateway ip:
   {
     "router":
        {
            ...
            "external_gateway_info": {
                "network_id": "8f59df0f-ea10-4bd6-8c33-778603fc22df",
                "enable_snat": false,
                "external_fixed_ips": [
                    {
                        "subnet_id": "5eadbe4e-af6e-4ad6-8421-7e00c9be0788",
                        "ip_address": "10.10.0.101"
                    }
                ]
            },
            ...
        }
   }

 - check static routes: ovn-nbctl list Logical_Router_Static_Route
 - there should only be one static route, the old should be removed, a new one added

3. Modify external gatway
 
   {
     "router":
        {
            ...
            "external_gateway_info": {
                "network_id": "other network",
                "enable_snat": false,
                "external_fixed_ips": [
                    {
                        "subnet_id": "other subnet",
                        "ip_address": "66.77.99.33"
                    }
                ]
            },
            ...
        }
   }
 - check static routes: ovn-nbctl list Logical_Router_Static_Route
 - there should only be one static route, the old should be removed, a new one added

4. Remove router
 - remove router
 - check static routes: ovn-nbctl list Logical_Router_Static_Route
 - all static routes should be removed

Comment 2 Roni 2018-06-14 15:21:43 UTC
Created attachment 1451460 [details]
static_route_test.py

This script was created specially to verify this bug
It involve manual verification
It doesn't a pytest script.

Comment 3 Roni 2018-06-19 10:27:04 UTC
The Scenario as describe above is working fine with v4.2.4.4-0.1.el7_3 when deleting the router by ID as followed:
REST: DELETE /routers/<router ID>

The question is if there are other delete options?

Mor suggests to use : PUT /v2.0/routers/<router id>/remove_router_interface
{{"port_id": "<port id>"}


But this isn't working and return an error, see output below:

[root@network-ge-2-he ~]# curl -X PUT -d '{"port_id": "ba45167b-4def-483e-a45f-089c5d0c86a5"}' --insecure --header 'X-Auth-Token:Z09K23bTwNrnep7YWneT06sq7CJ88ZfJ-k1kPRHC6EKD2Zcfd_sgCpkU3eJqrueUL67FEO3dhfircBLiMkDtTQ' https://localhost:9696/v2.0/routers/30628d16-ecab-40d8-87cb-d14f76ca3ff1/remove_router_interface
{
  "error": {
    "message": "Cannot find Logical_Switch_Port with name=ba45167b-4def-483e-a45f-089c5d0c86a5",
    "code": 404,
    "title": "Not Found"
  }
}

Comment 4 Roni 2018-06-19 11:23:43 UTC
Verify on v4.2.4.4-0.1.el7_3

According to Marcin the port ID at the comment above is not correct
To get the port ID use:
 
1.CLI
ovn-nbctl ovn-nbctl lrp-list test_router_1
ba45167b-4def-483e-a45f-089c5d0c86a5 (lrpec753411-0bda-4084-bfca-2dd0c78141fe)

take the "lrpec753411-0bda-4084-bfca-2dd0c78141fe"
and remove lrp: "ec753411-0bda-4084-bfca-2dd0c78141fe"

2.REST
GET https://<ovn ip>:9696/v2.0/ports/

With the above port ID the REST API "/remove_router_interface" is working and returning a positive response, the static route has been removed.

Comment 5 Sandro Bonazzola 2018-06-26 08:43:50 UTC
This bugzilla is included in oVirt 4.2.4 release, published on June 26th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.4 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.