I have the following script:
#!/usr/bin/python3 import panos from panos import base from panos import firewall from panos import panorama from panos import policies from panos import objects from panos import network from panos import device from panos.policies import Rulebase, SecurityRule fw = firewall.Firewall("192.168.122.5", "admin", "admin") webserver = objects.AddressObject("Apache-webserver", "18.104.22.168", description="Company web server") fw.add(webserver) webserver.create() fw.commit() #Create a new rule new_rule = panos.policies.SecurityRule("Madinah-Rule", description="Madinah") #rule = Rulebase.add(SecurityRule("Madinah-Rule")) Rulebase.add(new_rule) new_rule.create() fw.commit(Sync=True)
But when I run it using the command python3 script.py I am getting the error:
Traceback (most recent call last): File "madinah-pan-os-script.py", line 22, in <module> Rulebase.add(new_rule) TypeError: add() missing 1 required positional argument: 'child'
Can someone please point me in the right direction. I guess it has something to do with difference in Python2 and Python3.
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!