Skip to content

Commit

Permalink
implement aggregate-group filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
David Cruz committed Jan 28, 2023
1 parent c62e5b5 commit c1a7ad8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/firewall/get_interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
var (
namePattern []string
vsysPattern []string
aePattern []string
hasIpAddress bool
)

Expand Down Expand Up @@ -182,6 +183,7 @@ func init() {
getInterfacesCmd.Flags().StringVar(&password, "password", password, "password for PAN user")
getInterfacesCmd.Flags().StringSliceVarP(&namePattern, "name", "n", []string{}, "print interfaces matching a comma separated set of name patterns (wildcards supported)")
getInterfacesCmd.Flags().StringSliceVarP(&vsysPattern, "vsys", "v", []string{}, "print interfaces matching a comma separated set of vsys patterns (wildcards supported)")
getInterfacesCmd.Flags().StringSliceVarP(&aePattern, "aggregate-group", "a", []string{}, "print interfaces matching a comma separated set of aggregate-group patterns (wildcards supported)")
getInterfacesCmd.Flags().BoolVarP(&hasIpAddress, "has-ip", "i", false, "print interfaces with an IP address")
}

Expand Down Expand Up @@ -390,6 +392,8 @@ func printInterfaces(ch <-chan interfaceSlice, doneCh chan<- struct{}, cmd *cobr
continue
case cmd.Flags().Changed("vsys") && !match(vsysPattern, "", ints[k].VirtualSystem):
continue
case cmd.Flags().Changed("aggregate-group") && !match(aePattern, "", ints[k].AggregateGroup) && !match(aePattern, "", ints[k].Name):
continue
case hasIpAddress && !r.MatchString(ints[k].IP):
continue
}
Expand Down

0 comments on commit c1a7ad8

Please sign in to comment.