Browse Source

functional: Use different IP addresses for every fake chassis

As of OVS 2.11, the SB schema changed to not allow having two
Encap rows with the same (ip, type) pairs. Some of our
functional tests need more than one chassis and they all get
created with the same (ip, type) values so they'll fail.

This patch changes it so that a new IP address is used every
time we create a fake chassis. It shouldn't have any impact
as ovn-controller is not running so tunnels won't be created
anyways.

Change-Id: I900e847851d10f7faf474b70eaecb47b2b016a24
Closes-Bug: #1810292
Signed-off-by: Daniel Alvarez <dalvarez@redhat.com>
Daniel Alvarez 3 months ago
parent
commit
0cdd7ad8fe

+ 11
- 2
networking_ovn/tests/functional/base.py View File

@@ -87,6 +87,7 @@ class TestOVNFunctionalBase(test_plugin.Ml2PluginV2TestCase):
87 87
     OVS_INSTALL_SHARE_PATH = '/usr/local/share/openvswitch'
88 88
     _mechanism_drivers = ['logger', 'ovn']
89 89
     _extension_drivers = ['port_security']
90
+    _counter = 0
90 91
     l3_plugin = 'networking_ovn.l3.l3_ovn.OVNL3RouterPlugin'
91 92
 
92 93
     def setUp(self, ovn_worker=False):
@@ -258,7 +259,15 @@ class TestOVNFunctionalBase(test_plugin.Ml2PluginV2TestCase):
258 259
                                   for i, phys_net in enumerate(physical_nets)])
259 260
         name = uuidutils.generate_uuid()
260 261
         external_ids['ovn-bridge-mappings'] = bridge_mapping
262
+        # We'll be using different IP addresses every time for the Encap of
263
+        # the fake chassis as the SB schema doesn't allow to have two entries
264
+        # with same (ip,type) pairs as of OVS 2.11. This shouldn't have any
265
+        # impact as the tunnels won't get created anyways since ovn-controller
266
+        # is not running. Ideally we shouldn't be creating more than 255
267
+        # fake chassis but from the SB db point of view, 'ip' column can be
268
+        # any string so we could add entries with ip='172.24.4.1000'.
269
+        self._counter += 1
261 270
         self.sb_api.chassis_add(
262
-            name, ['geneve'], '172.24.4.10', external_ids=external_ids,
263
-            hostname=host).execute(check_error=True)
271
+            name, ['geneve'], '172.24.4.%d' % self._counter,
272
+            external_ids=external_ids, hostname=host).execute(check_error=True)
264 273
         return name

+ 2
- 2
networking_ovn/tests/functional/test_impl_idl.py View File

@@ -52,11 +52,11 @@ class TestSbApi(base.FunctionalTestCase):
52 52
 
53 53
     def load_test_data(self):
54 54
         with self.api.transaction(check_error=True) as txn:
55
-            for i, chassis in enumerate(self.data['chassis']):
55
+            for chassis in self.data['chassis']:
56 56
                 chassis['name'] = utils.get_rand_device_name('chassis')
57 57
                 chassis['hostname'] = '%s.localdomain.com' % chassis['name']
58 58
                 txn.add(self.api.chassis_add(
59
-                    chassis['name'], ['geneve'], '192.0.2.%d' % (i + 1,),
59
+                    chassis['name'], ['geneve'], chassis['hostname'],
60 60
                     hostname=chassis['hostname'],
61 61
                     external_ids=chassis['external_ids']))
62 62
 

Loading…
Cancel
Save