summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-15 07:37:55 +0000
committerGerrit Code Review <review@openstack.org>2017-06-15 07:37:55 +0000
commitf9fce412dbbaa8532cacf752097577fa8e927d9d (patch)
tree14b89996d7c42eba43742fa04d7452bfe2f58f3b
parente7e7a1d39f23e2aff165ac7df014c3268bf0f6ff (diff)
parentfce4f77c5b3dd22a056b0913e785bacee3522c99 (diff)
Merge "Add missing unit test for segment db" into stable/ocata
-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 7529c29..4476883 100644
--- a/neutron/tests/unit/plugins/ml2/test_db.py
+++ b/neutron/tests/unit/plugins/ml2/test_db.py
@@ -171,6 +171,33 @@ class Ml2DBTestCase(testlib_api.SqlTestCase):
171 segment_uuid) 171 segment_uuid)
172 self.assertIsNone(net_segment) 172 self.assertIsNone(net_segment)
173 173
174 def test_get_dynamic_segment(self):
175 net_id = uuidutils.generate_uuid()
176 segment1 = {api.NETWORK_TYPE: 'vlan',
177 api.PHYSICAL_NETWORK: 'physnet1',
178 api.SEGMENTATION_ID: 1}
179
180 self._create_segments(
181 [segment1], is_seg_dynamic=True, network_id=net_id)
182
183 segs1 = segments_db.get_dynamic_segment(
184 self.ctx, net_id)
185 self.assertEqual('vlan', segs1[api.NETWORK_TYPE])
186 self.assertEqual('physnet1', segs1[api.PHYSICAL_NETWORK])
187 self.assertEqual(1, segs1[api.SEGMENTATION_ID])
188
189 segs2 = segments_db.get_dynamic_segment(
190 self.ctx, net_id, physical_network='physnet1')
191 self.assertEqual('vlan', segs2[api.NETWORK_TYPE])
192 self.assertEqual('physnet1', segs2[api.PHYSICAL_NETWORK])
193 self.assertEqual(1, segs2[api.SEGMENTATION_ID])
194
195 segs3 = segments_db.get_dynamic_segment(
196 self.ctx, net_id, segmentation_id=1)
197 self.assertEqual('vlan', segs3[api.NETWORK_TYPE])
198 self.assertEqual('physnet1', segs3[api.PHYSICAL_NETWORK])
199 self.assertEqual(1, segs3[api.SEGMENTATION_ID])
200
174 def test_add_port_binding(self): 201 def test_add_port_binding(self):
175 network_id = uuidutils.generate_uuid() 202 network_id = uuidutils.generate_uuid()
176 port_id = uuidutils.generate_uuid() 203 port_id = uuidutils.generate_uuid()