Hide Forgot
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
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
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.
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" } }
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.
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.