Fix get_firewall_section_id to return a valid section

Change-Id: I1fac23589092e0bddd97b1ffa05c9f6fbb21d798
This commit is contained in:
asarfaty 2020-07-14 17:18:50 +02:00 committed by Adit Sarfaty
parent 23598d570b
commit 902ac80ebf
1 changed files with 2 additions and 1 deletions

View File

@ -831,6 +831,7 @@ class NsxLibLogicalRouter(utils.NsxLibApiBase):
If the router was already retrieved from the backend it is possible If the router was already retrieved from the backend it is possible
to give it as an input to avoid another backend call. to give it as an input to avoid another backend call.
In case of multiple sections, the first valid one will be returned
""" """
if not router_body: if not router_body:
router_body = self.get(lrouter_id) router_body = self.get(lrouter_id)
@ -839,7 +840,7 @@ class NsxLibLogicalRouter(utils.NsxLibApiBase):
for sec in firewall_sections: for sec in firewall_sections:
if (sec.get('is_valid') and if (sec.get('is_valid') and
sec.get('target_type') == "FirewallSection"): sec.get('target_type') == "FirewallSection"):
return firewall_sections[0].get('target_id') return sec.get('target_id')
def list(self, router_type=None): def list(self, router_type=None):
"""List all/by type logical routers.""" """List all/by type logical routers."""