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
This commit is contained in:
Rodolfo Alonso Hernandez 2019-12-10 15:50:20 +00:00
parent 4051e0b19d
commit b99765df8f
4 changed files with 7 additions and 7 deletions

View File

@ -1508,7 +1508,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)

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:

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:

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',