Skip to content

Commit

Permalink
PA: Add address collapsing using nacaddr.CollapseAddrList()
Browse files Browse the repository at this point in the history
  • Loading branch information
hkam40k committed Jun 29, 2021
1 parent 72cfb69 commit 938a994
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions capirca/lib/paloaltofw.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,12 @@ def _TranslatePolicy(self, pol, exp_info):
term.destination_address = nacaddr.RemoveAddressFromList(
term.destination_address, i)

# note: CollapseAddrList must be called after above exclusions.
if len(term.source_address) > 1:
term.source_address = nacaddr.CollapseAddrList(term.source_address)
if len(term.destination_address) > 1:
term.destination_address = nacaddr.CollapseAddrList(term.destination_address)

# Count the number of occurencies of a particular version of the
# address family, i.e. v4/v6 in source and destination IP addresses.
afc = {
Expand Down

0 comments on commit 938a994

Please sign in to comment.