PaloAltoNetworks / pan-os-python

The PAN-OS SDK for Python is a package to help interact with Palo Alto Networks devices (including physical and virtualized Next-generation Firewalls and Panorama). The pan-os-python SDK is object oriented and mimics the traditional interaction with the device via the GUI or CLI/API.
https://pan-os-python.readthedocs.io
ISC License
347 stars 172 forks source link

feat(network.StaticRoute): conditions and none value nexthop_type #578

Open alperenkose opened 1 month ago

alperenkose commented 1 month ago

Description

Add conditions to StaticRoute nexthop and nexthop_type params as well as accepting 'none' value as an input for nexthop_type.

Motivation and Context

Providing None vs a 'none' string to nexthop_type param in pan-os-ansible panos_static_route module cause different behaviour. Providing None (meaning no value is provided) means to use the default value of the object on present/merged states whereas providing a 'none' value means to set the nexthop_type to "None" in panos.

This is causing an issue with a recent change in pan-os-ansible where it fetches default values from pan-os-python sdk while creating or updating objects with None value params. With this change pan-os-python can also accept "none" str value for nexthop_type as well as structure the xml depending on the nexthop_type via conditions.

This is NOT a breaking change since it's still possible to use StaticRoute class with nexthop_type and nexthop set to None in order to produce "None" next hop type in panos xml.

How Has This Been Tested?

Tested live on VMSeries firewalls as well as with the written integration tests.

Types of changes

Checklist