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
This commit is contained in:
parent
9fdac1e887
commit
761b91fd22
@ -12,6 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import random
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
@ -118,9 +119,10 @@ class FdbInterfaceTestCase(testscenarios.WithScenarios, base.BaseSudoTestCase):
|
|||||||
else:
|
else:
|
||||||
self._cleanup()
|
self._cleanup()
|
||||||
self.addCleanup(self._cleanup)
|
self.addCleanup(self._cleanup)
|
||||||
|
vni = random.randint(1, 2**24 - 1)
|
||||||
ip_wrapper = ip_lib.IPWrapper(self.namespace)
|
ip_wrapper = ip_lib.IPWrapper(self.namespace)
|
||||||
ip_wrapper.add_dummy(self.device)
|
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 = ip_lib.IPDevice(self.device, self.namespace)
|
||||||
ip_device.link.set_up()
|
ip_device.link.set_up()
|
||||||
ip_device.addr.add(self.ip)
|
ip_device.addr.add(self.ip)
|
||||||
|
Loading…
Reference in New Issue
Block a user