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:
parent
4051e0b19d
commit
b99765df8f
|
@ -1508,7 +1508,7 @@ def list_ip_routes(namespace, ip_version, scope=None, via=None, table=None,
|
||||||
'scope': IP_ADDRESS_SCOPE[int(route['scope'])],
|
'scope': IP_ADDRESS_SCOPE[int(route['scope'])],
|
||||||
'device': get_device(int(get_attr(route, 'RTA_OIF')), devices),
|
'device': get_device(int(get_attr(route, 'RTA_OIF')), devices),
|
||||||
'via': get_attr(route, 'RTA_GATEWAY'),
|
'via': get_attr(route, 'RTA_GATEWAY'),
|
||||||
'priority': get_attr(route, 'RTA_PRIORITY'),
|
'metric': get_attr(route, 'RTA_PRIORITY'),
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.append(value)
|
ret.append(value)
|
||||||
|
|
|
@ -399,9 +399,9 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
|
||||||
metric = 100
|
metric = 100
|
||||||
if 'metric' in gateway:
|
if 'metric' in gateway:
|
||||||
metric = gateway['metric'] - 1
|
metric = gateway['metric'] - 1
|
||||||
dst_device.route.add_gateway(gateway=gateway['gateway'],
|
dst_device.route.add_gateway(gateway=gateway['via'],
|
||||||
metric=metric)
|
metric=metric)
|
||||||
src_device.route.delete_gateway(gateway=gateway['gateway'])
|
src_device.route.delete_gateway(gateway=gateway['via'])
|
||||||
|
|
||||||
# Remove IP's from interface
|
# Remove IP's from interface
|
||||||
if ips:
|
if ips:
|
||||||
|
|
|
@ -323,10 +323,10 @@ class IpLibTestCase(IpLibTestFramework):
|
||||||
}
|
}
|
||||||
expected_gateways = {
|
expected_gateways = {
|
||||||
constants.IP_VERSION_4: {
|
constants.IP_VERSION_4: {
|
||||||
'priority': metric,
|
'metric': metric,
|
||||||
'via': gateways[constants.IP_VERSION_4]},
|
'via': gateways[constants.IP_VERSION_4]},
|
||||||
constants.IP_VERSION_6: {
|
constants.IP_VERSION_6: {
|
||||||
'priority': metric,
|
'metric': metric,
|
||||||
'via': gateways[constants.IP_VERSION_6]}}
|
'via': gateways[constants.IP_VERSION_6]}}
|
||||||
|
|
||||||
for ip_version, gateway_ip in gateways.items():
|
for ip_version, gateway_ip in gateways.items():
|
||||||
|
@ -876,7 +876,7 @@ class IpRouteCommandTestCase(functional_base.BaseSudoTestCase):
|
||||||
'scope': scope,
|
'scope': scope,
|
||||||
'device': 'test_device',
|
'device': 'test_device',
|
||||||
'via': via,
|
'via': via,
|
||||||
'priority': metric}
|
'metric': metric}
|
||||||
try:
|
try:
|
||||||
utils.wait_until_true(fn, timeout=5)
|
utils.wait_until_true(fn, timeout=5)
|
||||||
except utils.WaitTimeout:
|
except utils.WaitTimeout:
|
||||||
|
|
|
@ -471,7 +471,7 @@ class TestLinuxBridgeManager(base.BaseTestCase):
|
||||||
dv6_fn.assert_not_called()
|
dv6_fn.assert_not_called()
|
||||||
|
|
||||||
def test__update_interface_ip_details(self):
|
def test__update_interface_ip_details(self):
|
||||||
gwdict = dict(gateway='1.1.1.1',
|
gwdict = dict(via='1.1.1.1',
|
||||||
metric=50)
|
metric=50)
|
||||||
ipdict = dict(cidr='1.1.1.1/24',
|
ipdict = dict(cidr='1.1.1.1/24',
|
||||||
broadcast='1.1.1.255',
|
broadcast='1.1.1.255',
|
||||||
|
|
Loading…
Reference in New Issue