Remove server ssl profile when removing client ssl profile

In nsx virtual server, server_ssl_profile_binding can not
exist without client_ssl_profile_binding. So in the function
removing client_ssl_profile_binding, the 'server_ssl_profile_binding'
needs to be poped out as well

Change-Id: I1654655dee8533c35a1b9d1df710a25598ac62f5
This commit is contained in:
Erica Liu 2020-01-13 15:03:12 -08:00
parent fd736d5a15
commit 0a11fcc5bd
2 changed files with 8 additions and 2 deletions

View File

@ -1296,11 +1296,14 @@ class TestPolicyLBVirtualServer(test_resources.NsxPolicyLibTestCase):
def test_remove_virtual_server_client_ssl_profile_binding(self):
vs_id = 'test-id'
vs_name = 'test-name'
exist_binding = {
client_binding = {
'default_certificate_path': '/infra/certificates/test-cert',
'client_ssl_profile_path': '/infra/lb-client-ssl-profiles/default'}
server_binding = {
'ssl_profile_path': '/infra/lb-server-ssl-profiles/test'}
with self.mock_get(
vs_id, vs_name, client_ssl_profile_binding=exist_binding), \
vs_id, vs_name, client_ssl_profile_binding=client_binding,
server_ssl_profile_binding=server_binding), \
self.mock_create_update() as update_call:
self.resourceApi.remove_virtual_server_client_ssl_profile_binding(
vs_id)

View File

@ -873,6 +873,9 @@ class NsxPolicyLoadBalancerVirtualServerAPI(NsxPolicyResourceBase):
virtual_server_id=virtual_server_id, tenant=tenant)
body = lbvs_def.body if lbvs_def.body else {}
body.pop('client_ssl_profile_binding', None)
# Server ssl profile binding can not exist without client ssl profile
# binding
body.pop('server_ssl_profile_binding', None)
if body:
lbvs_def.set_obj_dict(body)
self.policy_api.create_or_update(