summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-17 09:23:08 +0000
committerGerrit Code Review <review@openstack.org>2017-06-17 09:23:08 +0000
commit9615febab13079048d553c8e931e419ab28318f3 (patch)
tree53643be375f052f66a4fb7f53e50d307b3d51c27
parent8aa67a7674c408827c5b11b8f0bf0e7bc85cf715 (diff)
parent00ac588968c62c5c47acee558a69142ca94505dc (diff)
Merge "Add missing unit test for segment db" into stable/newton
-rw-r--r--neutron/tests/unit/plugins/ml2/test_db.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/neutron/tests/unit/plugins/ml2/test_db.py b/neutron/tests/unit/plugins/ml2/test_db.py
index ab2271e..eccc020 100644
--- a/neutron/tests/unit/plugins/ml2/test_db.py
+++ b/neutron/tests/unit/plugins/ml2/test_db.py
@@ -164,6 +164,33 @@ class Ml2DBTestCase(testlib_api.SqlTestCase):
164 segment_uuid) 164 segment_uuid)
165 self.assertIsNone(net_segment) 165 self.assertIsNone(net_segment)
166 166
167 def test_get_dynamic_segment(self):
168 net_id = uuidutils.generate_uuid()
169 segment1 = {api.NETWORK_TYPE: 'vlan',
170 api.PHYSICAL_NETWORK: 'physnet1',
171 api.SEGMENTATION_ID: 1}
172
173 self._create_segments(
174 [segment1], is_seg_dynamic=True, network_id=net_id)
175
176 segs1 = segments_db.get_dynamic_segment(
177 self.ctx.session, net_id)
178 self.assertEqual('vlan', segs1[api.NETWORK_TYPE])
179 self.assertEqual('physnet1', segs1[api.PHYSICAL_NETWORK])
180 self.assertEqual(1, segs1[api.SEGMENTATION_ID])
181
182 segs2 = segments_db.get_dynamic_segment(
183 self.ctx.session, net_id, physical_network='physnet1')
184 self.assertEqual('vlan', segs2[api.NETWORK_TYPE])
185 self.assertEqual('physnet1', segs2[api.PHYSICAL_NETWORK])
186 self.assertEqual(1, segs2[api.SEGMENTATION_ID])
187
188 segs3 = segments_db.get_dynamic_segment(
189 self.ctx.session, net_id, segmentation_id=1)
190 self.assertEqual('vlan', segs3[api.NETWORK_TYPE])
191 self.assertEqual('physnet1', segs3[api.PHYSICAL_NETWORK])
192 self.assertEqual(1, segs3[api.SEGMENTATION_ID])
193
167 def test_add_port_binding(self): 194 def test_add_port_binding(self):
168 network_id = 'foo-network-id' 195 network_id = 'foo-network-id'
169 port_id = 'foo-port-id' 196 port_id = 'foo-port-id'