Support remove client_ssl_profile_binding from virtual server

This change support removing client_ssl_profile_binding field
from virtual server spec and update without partial patch

Change-Id: I9f51aeac43c8f511750841f9a4e681cd3f941e72
This commit is contained in:
Erica Liu 2020-01-02 11:51:00 -08:00
parent 0b076c6e85
commit bcf20e2466
2 changed files with 26 additions and 0 deletions

View File

@ -1191,6 +1191,21 @@ class TestPolicyLBVirtualServer(test_resources.NsxPolicyLibTestCase):
sleep=0.1, tenant=TEST_TENANT)
self.assertEqual(info, actual_info)
def test_remove_virtual_server_client_ssl_profile_binding(self):
vs_id = 'test-id'
vs_name = 'test-name'
exist_binding = {
'default_certificate_path': '/infra/certificates/test-cert',
'client_ssl_profile_path': '/infra/lb-client-ssl-profiles/default'}
with self.mock_get(
vs_id, vs_name, client_ssl_profile_binding=exist_binding), \
self.mock_create_update() as update_call:
self.resourceApi.remove_virtual_server_client_ssl_profile_binding(
vs_id)
expected_def = lb_defs.LBVirtualServerDef(
virtual_server_id=vs_id, name=vs_name)
self.assert_called_with_def(update_call, expected_def)
class TestPolicyLBPoolApi(test_resources.NsxPolicyLibTestCase):

View File

@ -812,6 +812,17 @@ class NsxPolicyLoadBalancerVirtualServerAPI(NsxPolicyResourceBase):
client_ssl_profile_binding=client_ssl_profile_binding,
tenant=tenant)
def remove_virtual_server_client_ssl_profile_binding(
self, virtual_server_id, tenant=constants.POLICY_INFRA_TENANT):
lbvs_def = self._get_and_update_def(
virtual_server_id=virtual_server_id, tenant=tenant)
body = lbvs_def.body if lbvs_def.body else {}
body.pop('client_ssl_profile_binding', None)
if body:
lbvs_def.set_obj_dict(body)
self.policy_api.create_or_update(
lbvs_def, partial_updates=False)
def update_virtual_server_with_vip(self, virtual_server_id, vip,
tenant=constants.POLICY_INFRA_TENANT):
return self.update(