HOW TO REMOVE POLICY

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Please sign in to see details of an important advisory in our Customer Advisories area.

HOW TO REMOVE POLICY

L1 Bithead

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

CE
0 REPLIES 0
  • 1973 Views
  • 0 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

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!