Closed adi105 closed 1 year ago
:tada: Thanks for opening your first issue here! Welcome to the community!
I have always used a 2 step process of first creating the rule and then moving it (rule.create()
/rule.move()
). From what I understand, .insert()
does not modify the device but rather the local tree.
I have discovered the issue is in the way I was using .apply(). Running
newrule = pre_rulebase.insert(0,rule).apply()
ends up running apply() on the rule itself, not the rulebase. The following code works as I intended:
newrule = pre_rulebase.insert(0,rule)
pre_rulebase.apply()
Describe the bug
When using the insert command to insert a rule into a PAN prerulebase, the index is ignored and the rule is inserted at the bottom of the prerulebase.
Expected behavior
When adding a new rule to the prerulebase using insert, i.e. .insert(0, rule). I expect the rule should be added at the top of the rulebase.
Current behavior
When using insert(0,rule), the rule is created on the live Pano device, however the rule is placed at the bottom of the policy.
Steps to reproduce
Using the following code will reproduce the issue:
Assuming devicegroup "DG1" with an existing prerulebase exists.
Context
I am unsure if the issue is due to a bug with my own code, or if the insert function was not working appropriately.
Your Environment