Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushmittal-arista committed Jun 17, 2024
1 parent 25dcf75 commit 69572f5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def new_network_services_bgp_vrf_config(self: SharedUtils) -> bool:
return get(self.hostvars, "new_network_services_bgp_vrf_config", default=default_value)

@cached_property
def ipv4_acls(self: SharedUtils) -> list:
def ipv4_acls(self: SharedUtils) -> dict:
return {acl["name"]: acl for acl in get(self.hostvars, "ipv4_acls", default=[])}

def get_ipv4_acl(self: SharedUtils, name: str, interface_name: str, *, interface_ip: str | None = None, peer_ip: str | None = None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ def _acl_internet_exit(self, internet_exit_policy_type: Literal["zscaler", "dire
else:
if internet_exit_policy_type == "zscaler":
return [self._acl_internet_exit_zscaler]
elif internet_exit_policy_type == "direct":
if acl := self._acl_internet_exit_direct:
return [acl]
elif internet_exit_policy_type == "direct" and (acl := self._acl_internet_exit_direct):
return [acl]
return None

@cached_property
Expand All @@ -112,6 +111,6 @@ def ip_access_lists(self) -> list | None:
for ie_policy_type in self._filtered_internet_exit_policy_types:
acls = self._acl_internet_exit(ie_policy_type)
if acls:
ip_access_lists += acls
ip_access_lists.extend(acls)

return natural_sort(ip_access_lists, "name") or None
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ def get_internet_exit_nat_pool_and_profile(self, internet_exit_policy_type: Lite
return None, profile

@cached_property
def _filtered_internet_exit_policy_types(self):
def _filtered_internet_exit_policy_types(self) -> list:
return sorted(set(internet_exit_policy["type"] for internet_exit_policy in self._filtered_internet_exit_policies))

@cached_property
Expand Down

0 comments on commit 69572f5

Please sign in to comment.