summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Alvarez <dalvarez@redhat.com>2019-01-02 11:46:20 +0000
committerDaniel Alvarez <dalvarez@redhat.com>2019-01-02 12:50:58 +0000
commit0cdd7ad8fe38c263b480b849d625a1ac94bea26a (patch)
tree4e73bba05412a5fefc1a765196d61ce66987a817
parent649c7d7af9a23da46b44db344ad16b1b186ef3ca (diff)
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>
Notes
Notes (review): Code-Review+2: Lucas Alvares Gomes <lucasagomes@gmail.com> Code-Review+2: Numan Siddique <nusiddiq@redhat.com> Workflow+1: Numan Siddique <nusiddiq@redhat.com> Code-Review+1: Reedip <rbanerje@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 03 Jan 2019 13:23:28 +0000 Reviewed-on: https://review.openstack.org/627961 Project: openstack/networking-ovn Branch: refs/heads/master
-rw-r--r--networking_ovn/tests/functional/base.py13
-rw-r--r--networking_ovn/tests/functional/test_impl_idl.py4
2 files changed, 13 insertions, 4 deletions
diff --git a/networking_ovn/tests/functional/base.py b/networking_ovn/tests/functional/base.py
index 0342cac..d4b78e4 100644
--- a/networking_ovn/tests/functional/base.py
+++ b/networking_ovn/tests/functional/base.py
@@ -87,6 +87,7 @@ class TestOVNFunctionalBase(test_plugin.Ml2PluginV2TestCase):
87 OVS_INSTALL_SHARE_PATH = '/usr/local/share/openvswitch' 87 OVS_INSTALL_SHARE_PATH = '/usr/local/share/openvswitch'
88 _mechanism_drivers = ['logger', 'ovn'] 88 _mechanism_drivers = ['logger', 'ovn']
89 _extension_drivers = ['port_security'] 89 _extension_drivers = ['port_security']
90 _counter = 0
90 l3_plugin = 'networking_ovn.l3.l3_ovn.OVNL3RouterPlugin' 91 l3_plugin = 'networking_ovn.l3.l3_ovn.OVNL3RouterPlugin'
91 92
92 def setUp(self, ovn_worker=False): 93 def setUp(self, ovn_worker=False):
@@ -258,7 +259,15 @@ class TestOVNFunctionalBase(test_plugin.Ml2PluginV2TestCase):
258 for i, phys_net in enumerate(physical_nets)]) 259 for i, phys_net in enumerate(physical_nets)])
259 name = uuidutils.generate_uuid() 260 name = uuidutils.generate_uuid()
260 external_ids['ovn-bridge-mappings'] = bridge_mapping 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 self.sb_api.chassis_add( 270 self.sb_api.chassis_add(
262 name, ['geneve'], '172.24.4.10', external_ids=external_ids, 271 name, ['geneve'], '172.24.4.%d' % self._counter,
263 hostname=host).execute(check_error=True) 272 external_ids=external_ids, hostname=host).execute(check_error=True)
264 return name 273 return name
diff --git a/networking_ovn/tests/functional/test_impl_idl.py b/networking_ovn/tests/functional/test_impl_idl.py
index 6d1c366..468c88a 100644
--- a/networking_ovn/tests/functional/test_impl_idl.py
+++ b/networking_ovn/tests/functional/test_impl_idl.py
@@ -52,11 +52,11 @@ class TestSbApi(base.FunctionalTestCase):
52 52
53 def load_test_data(self): 53 def load_test_data(self):
54 with self.api.transaction(check_error=True) as txn: 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 chassis['name'] = utils.get_rand_device_name('chassis') 56 chassis['name'] = utils.get_rand_device_name('chassis')
57 chassis['hostname'] = '%s.localdomain.com' % chassis['name'] 57 chassis['hostname'] = '%s.localdomain.com' % chassis['name']
58 txn.add(self.api.chassis_add( 58 txn.add(self.api.chassis_add(
59 chassis['name'], ['geneve'], '192.0.2.%d' % (i + 1,), 59 chassis['name'], ['geneve'], chassis['hostname'],
60 hostname=chassis['hostname'], 60 hostname=chassis['hostname'],
61 external_ids=chassis['external_ids'])) 61 external_ids=chassis['external_ids']))
62 62