Use unique SNI identifier when building data model
The to_data_model method previously labeled an SNI container without a unique identifier, using the "listener_id". Now it will use the "tls_container_id" to ensure it is truly unique. Change-Id: I174f8f650fc51668fd7b70e845d4706916f06295
This commit is contained in:
parent
dd542b1080
commit
428fee9748
@ -34,12 +34,15 @@ class OctaviaBase(models.ModelBase):
|
||||
return obj.__class__.__name__ + obj.id
|
||||
elif obj.__class__.__name__ in ['SessionPersistence', 'HealthMonitor']:
|
||||
return obj.__class__.__name__ + obj.pool_id
|
||||
elif obj.__class__.__name__ in ['ListenerStatistics', 'SNI']:
|
||||
elif obj.__class__.__name__ in ['ListenerStatistics']:
|
||||
return obj.__class__.__name__ + obj.listener_id
|
||||
elif obj.__class__.__name__ in ['VRRPGroup', 'Vip']:
|
||||
return obj.__class__.__name__ + obj.load_balancer_id
|
||||
elif obj.__class__.__name__ in ['AmphoraHealth']:
|
||||
return obj.__class__.__name__ + obj.amphora_id
|
||||
elif obj.__class__.__name__ in ['SNI']:
|
||||
return (obj.__class__.__name__ +
|
||||
obj.listener_id + obj.tls_container_id)
|
||||
else:
|
||||
raise NotImplementedError
|
||||
|
||||
|
@ -779,10 +779,10 @@ class L7RuleModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
self.assertIsInstance(new_l7rule.l7policy, models.L7Policy)
|
||||
|
||||
|
||||
class DataModelConversionTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
class TestDataModelConversionTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
|
||||
def setUp(self):
|
||||
super(DataModelConversionTest, self).setUp()
|
||||
super(TestDataModelConversionTest, self).setUp()
|
||||
self.lb = self.create_load_balancer(self.session)
|
||||
self.pool = self.create_pool(self.session, load_balancer_id=self.lb.id)
|
||||
self.hm = self.create_health_monitor(self.session, self.pool.id)
|
||||
@ -821,6 +821,9 @@ class DataModelConversionTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
return obj.__class__.__name__ + obj.load_balancer_id
|
||||
elif obj.__class__.__name__ in ['AmphoraHealth']:
|
||||
return obj.__class__.__name__ + obj.amphora_id
|
||||
elif obj.__class__.__name__ in ['SNI']:
|
||||
return (obj.__class__.__name__ +
|
||||
obj.listener_id + obj.tls_container_id)
|
||||
else:
|
||||
raise NotImplementedError
|
||||
|
||||
|
@ -645,6 +645,20 @@ class ListenerRepositoryTest(BaseRepositoryTest):
|
||||
self.assertRaises(exceptions.NotFound, self.create_listener,
|
||||
self.FAKE_UUID_1, 80, default_pool_id=pool.id)
|
||||
|
||||
def test_create_2_sni_containers(self):
|
||||
listener = self.create_listener(self.FAKE_UUID_1, 80)
|
||||
container1 = {'listener_id': listener.id,
|
||||
'tls_container_id': self.FAKE_UUID_1}
|
||||
container2 = {'listener_id': listener.id,
|
||||
'tls_container_id': self.FAKE_UUID_2}
|
||||
container1_dm = models.SNI(**container1)
|
||||
container2_dm = models.SNI(**container2)
|
||||
self.sni_repo.create(self.session, **container1)
|
||||
self.sni_repo.create(self.session, **container2)
|
||||
new_listener = self.listener_repo.get(self.session, id=listener.id)
|
||||
self.assertIn(container1_dm, new_listener.sni_containers)
|
||||
self.assertIn(container2_dm, new_listener.sni_containers)
|
||||
|
||||
def test_update(self):
|
||||
name_change = "new_listener_name"
|
||||
listener = self.create_listener(self.FAKE_UUID_1, 80)
|
||||
|
Loading…
Reference in New Issue
Block a user