- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
10-07-2020 03:13 PM
I am relatively new to using PANOS/PANDEVICE libraries in Python with Panorama. I am trying to figure out how to get a list of AddressObjects associated with a specific Static AddressGroup in the "Shared" DeviceGroup.
11-27-2020 08:11 AM
Greetings,
Since doing the refreshall returns a list, you are going to have to iterate through the list to get your result. See example below.
import panos
from panos import firewall
from panos import panorama
from panos import network
from panos import device
from panos import updater
from panos import errors
from panos import objects
pano = panorama.Panorama(IP, ADMIN, PASSWORD)
grp = objects.AddressGroup(name='some group name')
pano.add(grp)
ListOfAllGroups = grp.refreshall(pano)
for i in ListOfAllGroups:
if i.name == grp.name:
print(i.static_value)
11-27-2020 08:11 AM
Greetings,
Since doing the refreshall returns a list, you are going to have to iterate through the list to get your result. See example below.
import panos
from panos import firewall
from panos import panorama
from panos import network
from panos import device
from panos import updater
from panos import errors
from panos import objects
pano = panorama.Panorama(IP, ADMIN, PASSWORD)
grp = objects.AddressGroup(name='some group name')
pano.add(grp)
ListOfAllGroups = grp.refreshall(pano)
for i in ListOfAllGroups:
if i.name == grp.name:
print(i.static_value)
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!