From ee2331fa2b552ff0b0208041e9ccff9b538b6374 Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Thu, 8 Jun 2017 11:27:29 +0300 Subject: [PATCH] New api: Get the default rule in a firewall section Change-Id: I3debf0c090d5237f0e273904de13432433fac49e --- vmware_nsxlib/v3/security.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vmware_nsxlib/v3/security.py b/vmware_nsxlib/v3/security.py index 7781054a..7fc32bbe 100644 --- a/vmware_nsxlib/v3/security.py +++ b/vmware_nsxlib/v3/security.py @@ -460,6 +460,12 @@ class NsxLibFirewallSection(utils.NsxLibApiBase): resource = 'firewall/sections/%s/rules' % section_id return self.client.get(resource) + def get_default_rule(self, section_id): + rules = self.get_rules(section_id)['results'] + last_rule = rules[-1] + if last_rule['is_default']: + return last_rule + def _get_fw_rule_from_sg_rule(self, sg_rule, nsgroup_id, rmt_nsgroup_id, logged, action): # IPV4 or IPV6