From 4dbcd76517fead73f91adaab9cdaf0e92a4aff4e Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Fri, 17 Jun 2022 08:34:04 +0000 Subject: [PATCH] Fix "ip route" commands to work with pyroute2 APIv2 Fixed "ip route" commands to work with pyroute2 >= 0.6.10, that introduces APIv2 for link, neighbour and route [1]. [1]https://github.com/svinota/pyroute2/commit/bc0f5e2209a937fdec6e9931ca7b3c45c0278f31 Closes-Bug: #1979031 Change-Id: Id2239b6827485a4d466b0916947428ceabef9139 --- neutron/privileged/agent/linux/ip_lib.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/neutron/privileged/agent/linux/ip_lib.py b/neutron/privileged/agent/linux/ip_lib.py index c31fed1cadb..5617fd03f4f 100644 --- a/neutron/privileged/agent/linux/ip_lib.py +++ b/neutron/privileged/agent/linux/ip_lib.py @@ -741,8 +741,8 @@ def _make_pyroute2_route_args(namespace, ip_version, cidr, device, via, table, @privileged.default.entrypoint def add_ip_route(namespace, cidr, ip_version, device=None, via=None, - table=None, metric=None, scope=None, proto='static', - **kwargs): + table=None, metric=None, scope=None, + proto=rtnl.rt_proto['static'], **kwargs): """Add an IP route""" kwargs.update(_make_pyroute2_route_args( namespace, ip_version, cidr, device, via, table, metric, scope, @@ -766,7 +766,8 @@ def add_ip_route(namespace, cidr, ip_version, device=None, via=None, def list_ip_routes(namespace, ip_version, device=None, table=None, **kwargs): """List IP routes""" kwargs.update(_make_pyroute2_route_args( - namespace, ip_version, None, device, None, table, None, None, None)) + namespace, ip_version, None, device, None, table, None, 'universe', + None)) try: with get_iproute(namespace) as ip: return make_serializable(ip.route('show', **kwargs))