diff --git a/quantum/agent/linux/ip_lib.py b/quantum/agent/linux/ip_lib.py index 4065b44fff..31337087e6 100644 --- a/quantum/agent/linux/ip_lib.py +++ b/quantum/agent/linux/ip_lib.py @@ -297,7 +297,7 @@ class IpRouteCommand(IpDeviceCommandBase): COMMAND = 'route' def add_gateway(self, gateway, metric=None): - args = ['add', 'default', 'via', gateway] + args = ['replace', 'default', 'via', gateway] if metric: args += ['metric', metric] args += ['dev', self.name] diff --git a/quantum/tests/unit/test_linux_ip_lib.py b/quantum/tests/unit/test_linux_ip_lib.py index f4a67dec13..cc54ff23cd 100644 --- a/quantum/tests/unit/test_linux_ip_lib.py +++ b/quantum/tests/unit/test_linux_ip_lib.py @@ -548,7 +548,7 @@ class TestIpRouteCommand(TestIPCmdBase): metric = 100 self.route_cmd.add_gateway(gateway, metric) self._assert_sudo([], - ('add', 'default', 'via', gateway, + ('replace', 'default', 'via', gateway, 'metric', metric, 'dev', self.parent.name))