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 b99765df8f1d1d6d3ceee3d481d1e6ee1b2200e7)
This commit is contained in:
parent
6d9aae2ab3
commit
124680084c
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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…
x
Reference in New Issue
Block a user