From c1a7ad88a2c804346aa20bf084f4e92d38f90d09 Mon Sep 17 00:00:00 2001 From: David Cruz Date: Wed, 25 Jan 2023 11:30:15 -0800 Subject: [PATCH] implement aggregate-group filtering --- cmd/firewall/get_interfaces.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/firewall/get_interfaces.go b/cmd/firewall/get_interfaces.go index e574282..f35a839 100644 --- a/cmd/firewall/get_interfaces.go +++ b/cmd/firewall/get_interfaces.go @@ -27,6 +27,7 @@ import ( var ( namePattern []string vsysPattern []string + aePattern []string hasIpAddress bool ) @@ -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") } @@ -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 }