pan-os-python icon indicating copy to clipboard operation
pan-os-python copied to clipboard

Setting address object failed on PA-3260 (v8.1.4.H2) while succeeded on PA-3000 (v8.1.2)

Open galaxyh opened this issue 6 years ago • 2 comments

Synopsis: Setting address object failed on PA-3260 (v8.1.4.H2) while succeeded on PA-3000 (v8.1.2)

Exception: vsys1 -> address has unexpected text.

Python package: pan-python=0.13.0 pandevice=0.6.6

Code snippet (sample):

fw = pandevice.firewall.Firewall('10.0.0.1', 'username', 'password', port='443')

bulk_objects = []
ao = pandevice.objects.AddressObject(
    name='test',
    value='10.0.0.2/32',
    type='ip-netmask')
bulk_objects.append(ao)
fw.add(ao)

bulk_objects[0].create_similar()
bulk_objects[0].apply_similar()

galaxyh avatar Nov 16 '18 06:11 galaxyh

The error you're getting is coming from the firewall, so something is not conforming to the firewall's configuration requirements.

You shouldn't need to do a create_similar() and apply_similar(). Just one or the other. Does it help to remove one of them? Try just create() or create_similar().

Also, note that since you instantiate only one address object, doing an apply_similar() would wipe out any address objects already on the device. Make sure that's your intention.

I tested this on 8.1.3 and it works. I'll try to test on 8.1.4 soon, but I doubt it's a version-related problem. More likely it's configuration related.

btorresgil avatar Nov 19 '18 23:11 btorresgil

@btorresgil Thanks for your prompt reply and suggestion.

  1. In my production code, I do need to wipe out any address objects already on the device.
  2. The version at hand is 8.1.4.H2 instead of 8.1.4. Does it matter?

galaxyh avatar Nov 20 '18 09:11 galaxyh