From 0d263ec65eee08ad8bfa1f51d4a87879f84ea5f6 Mon Sep 17 00:00:00 2001 From: lxiaopei Date: Wed, 2 Sep 2020 06:14:20 +0800 Subject: [PATCH] Create entry with a list of plain string as group Change-Id: Ib1a7ebdf6977b78dfbf25606b1f455869c254f2d --- vmware_nsxlib/v3/policy/core_resources.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/vmware_nsxlib/v3/policy/core_resources.py b/vmware_nsxlib/v3/policy/core_resources.py index 2d747ae4..50823404 100644 --- a/vmware_nsxlib/v3/policy/core_resources.py +++ b/vmware_nsxlib/v3/policy/core_resources.py @@ -3417,12 +3417,22 @@ class NsxPolicySecurityPolicyBaseApi(NsxPolicyResourceBase): direction=nsx_constants.IN_OUT, logged=False, tag=None, service_entries=IGNORE, - tenant=constants.POLICY_INFRA_TENANT): + tenant=constants.POLICY_INFRA_TENANT, + plain_groups=False): """Create CommunicationMap Entry. source_groups/dest_groups should be a list of group ids belonging to the domain. + + plain_groups should be True if source_groups/dest_groups is a list + of group paths and IP addresses. IP address support from NSX 3.0.0. """ + if (version.LooseVersion(self.version) < + version.LooseVersion(nsx_constants.NSX_VERSION_3_0_0) and + plain_groups): + err_msg = _("plain_groups support is from NSX 3.0.0") + raise exceptions.NsxLibInvalidInput(error_message=err_msg) + # get the next available sequence number if not sequence_number: last_sequence = self._get_last_seq_num(domain_id, map_id, @@ -3447,7 +3457,8 @@ class NsxPolicySecurityPolicyBaseApi(NsxPolicyResourceBase): logged=logged, tag=tag, service_entries=service_entries, - tenant=tenant) + tenant=tenant, + plain_groups=plain_groups) self._create_or_store(entry_def) return entry_id