Browse Source

Use "via" in gateway dictionary in Linux Bridge agent

The gateway IP address in the gateway dictionary returned by
"ip_lib.list_ip_routes" is stored in "via".

"priority" parameter is changed to "metric", to match input and
output parameters.

Change-Id: I67ae473dca8d706f963c3b55b9410f9a79d7f32b
Closes-Bug: #1855759
(cherry picked from commit b99765df8f)
tags/15.0.2
Rodolfo Alonso Hernandez 10 months ago
parent
commit
124680084c
4 changed files with 7 additions and 7 deletions
  1. +1
    -1
      neutron/agent/linux/ip_lib.py
  2. +2
    -2
      neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py
  3. +3
    -3
      neutron/tests/functional/agent/linux/test_ip_lib.py
  4. +1
    -1
      neutron/tests/unit/plugins/ml2/drivers/linuxbridge/agent/test_linuxbridge_neutron_agent.py

+ 1
- 1
neutron/agent/linux/ip_lib.py View File

@@ -1500,7 +1500,7 @@ def list_ip_routes(namespace, ip_version, scope=None, via=None, table=None,
'scope': IP_ADDRESS_SCOPE[int(route['scope'])],
'device': get_device(int(get_attr(route, 'RTA_OIF')), devices),
'via': get_attr(route, 'RTA_GATEWAY'),
'priority': get_attr(route, 'RTA_PRIORITY'),
'metric': get_attr(route, 'RTA_PRIORITY'),
}

ret.append(value)


+ 2
- 2
neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py View File

@@ -399,9 +399,9 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
metric = 100
if 'metric' in gateway:
metric = gateway['metric'] - 1
dst_device.route.add_gateway(gateway=gateway['gateway'],
dst_device.route.add_gateway(gateway=gateway['via'],
metric=metric)
src_device.route.delete_gateway(gateway=gateway['gateway'])
src_device.route.delete_gateway(gateway=gateway['via'])

# Remove IP's from interface
if ips:


+ 3
- 3
neutron/tests/functional/agent/linux/test_ip_lib.py View File

@@ -323,10 +323,10 @@ class IpLibTestCase(IpLibTestFramework):
}
expected_gateways = {
constants.IP_VERSION_4: {
'priority': metric,
'metric': metric,
'via': gateways[constants.IP_VERSION_4]},
constants.IP_VERSION_6: {
'priority': metric,
'metric': metric,
'via': gateways[constants.IP_VERSION_6]}}

for ip_version, gateway_ip in gateways.items():
@@ -876,7 +876,7 @@ class IpRouteCommandTestCase(functional_base.BaseSudoTestCase):
'scope': scope,
'device': 'test_device',
'via': via,
'priority': metric}
'metric': metric}
try:
utils.wait_until_true(fn, timeout=5)
except utils.WaitTimeout:


+ 1
- 1
neutron/tests/unit/plugins/ml2/drivers/linuxbridge/agent/test_linuxbridge_neutron_agent.py View File

@@ -471,7 +471,7 @@ class TestLinuxBridgeManager(base.BaseTestCase):
dv6_fn.assert_not_called()

def test__update_interface_ip_details(self):
gwdict = dict(gateway='1.1.1.1',
gwdict = dict(via='1.1.1.1',
metric=50)
ipdict = dict(cidr='1.1.1.1/24',
broadcast='1.1.1.255',


Loading…
Cancel
Save