How to Load Partial Configurations
81046
Created On 09/25/18 19:38 PM - Last Modified 01/30/25 21:53 PM
Environment Palo Alto Firewall. PAN-OS 8.1 and below. Loading partial configuration using XML API
Resolution
Details
PAN-OS allows loading part of a configuration file in three ways:
Important: All uncommitted changes must be committed before performing load config to avoid losing uncommitted configuration.
Merge node at dst in x.xml onto node at src in candidate config.
> configure
# load config partial from x.xml from-xpath <path-to-src> to-xpath <path-to-dst> mode merge
Replace node at src in candidate config with node at dst in x.xml.
> configure
# load config partial from x.xml from-xpath <path-to-src> to-xpath <path-to-dst> mode replace
Append node at dst in x.xml UNDER node at src in candidate config.
> configure
# load config partial from x.xml from-xpath <path-to-src> to-xpath <path-to-dst> mode append
Scenario 1:
Device A has security rules that need to be merged with the rules currently on Device B, which currently has no security rules.
Save and export config from Device A. Import the saved config file into Device B. In configuration mode, enter the following command:
> configure
# load config partial from test.xml from-xpath devices/entry/vsys/entry/rulebase/security
mode merge to-xpath /config/devices/entry/vsys/entry/rulebase/security
# commit
# exit
Device B now has the same security rules as Device A.
Scenario 2:
Load the partial config for security policies from a firewall that only has one VSys to a firewall that has multiple VSys.
Export the config of the firewall that has the rules to be loaded. Import the config to the firewall that needs the rules to be loaded. To merge the security policies, run the following command from the CLI:
> configure
# load config partial from {File name e.g test.xml} mode merge from-xpath devices/entry/vsys/entry/
rulebase/security to-xpath /config/devices/entry/vsys/entry[@name="vsys2"]/rulebase/security
# commit
# exit
In the above command, we are loading the security policies from the default VSys1 to VSys2.
Important: When loading security rules, make sure that you have already configured zones, objects, and so on from the firewall where the configuration is being loaded from. Else commit may fail or this reference may show up as empty or none.
Additional Information In PAN-OS 9.0 and above, the format is a little bit changed and the file name should be at the end of the command. Refer to Load a Partial Configuration