- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
06-22-2020 06:03 AM - edited 06-22-2020 06:04 AM
Hi all,
I'm writing a script that removes policies that have hit counts equal to 0. How can I delethe them? what is the method to use. In the documentation I have not found the method to access the hit count variable, does it exist?
import pandevice
import pandevice.firewall
import pandevice.policies
HOSTNAME = 'ip'
API_KEY = 'key'
fw = pandevice.firewall.Firewall(hostname=HOSTNAME, api_key=API_KEY)
rulebase = pandevice.policies.Rulebase()
fw.add(rulebase)
rules = pandevice.policies.SecurityRule.refreshall(rulebase)
for rule in rules:
if(rule.hit_count == 0 ) ??
fw.remove(rule) ??
rule.apply()
THANKS
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!