From 54c8943ab5a6b980212d9c4c94173dc6b41dc78d Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Wed, 25 Sep 2019 16:23:31 +0000 Subject: [PATCH] Randomize VNI in FdbInterfaceTestCase Randomize VNI in FdbInterfaceTestCase to avoid clashes if several test cases are creating VXLAN interfaces in the kernel namespace at the same time. Change-Id: Ic90fa31aa15723eab7f518a42762a7f1c80ee736 Closes-Bug: #1845354 (cherry picked from commit 761b91fd221914ce06ded381264740abc29fe066) --- neutron/tests/functional/agent/linux/test_bridge_lib.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/neutron/tests/functional/agent/linux/test_bridge_lib.py b/neutron/tests/functional/agent/linux/test_bridge_lib.py index 1be9785e2a7..f9887e45262 100644 --- a/neutron/tests/functional/agent/linux/test_bridge_lib.py +++ b/neutron/tests/functional/agent/linux/test_bridge_lib.py @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. +import random import re import netaddr @@ -118,9 +119,10 @@ class FdbInterfaceTestCase(testscenarios.WithScenarios, base.BaseSudoTestCase): else: self._cleanup() self.addCleanup(self._cleanup) + vni = random.randint(1, 2**24 - 1) ip_wrapper = ip_lib.IPWrapper(self.namespace) ip_wrapper.add_dummy(self.device) - ip_wrapper.add_vxlan(self.device_vxlan, 100, dev=self.device) + ip_wrapper.add_vxlan(self.device_vxlan, vni, dev=self.device) ip_device = ip_lib.IPDevice(self.device, self.namespace) ip_device.link.set_up() ip_device.addr.add(self.ip)