How to Deal with Generated DataPower Policies

DataPower creates generated policy objects for multi-protocol gateways and other services. These objects look like this in the exported DataPower configuration:

<GeneratedPolicy intrinsic="true" name="__gp_1454554441_1173" read-only="true" />

If your exported configuration contains generated policies, importing of this configuration into a different domain can fail. Additionally, keeping generated policies in the exported file makes tracking changes more difficult, should you decide to keep your DataPower configuration under version control (which is highly recommended). So it is a good idea to remove generated policies either during export or during import.

Removing objects from DataPower configuration is extremely easy with DPBuddy. The following example shows how to remove generated policy objects and all the references to these objects during export:

<dp:export file="${filename}.xml">
    <transform verbose="true" >
        <!-- Get rid of generated policies -->
        <delete xpath="//GeneratedPolicies | //GeneratedPolicy" matchRequired="false"/>
    </transform>
</dp:export>

Alternatively, the policies can be removed during import. This is useful if you’re importing a configuration in zip format as opposed to XML. You can use exact same “delete” transformation or “dpExclude” filter. “dpExclude” is somewhat more explicit since it deals directly with DataPower types (classes) instead of xpath:

<dp:import file="${filename}.zip">
    <transform verbose="true" >
        <dpExclude class="GeneratedPolicy" />
    </transform>
</dp:import>

If you want to use automated checking of object statuses in DataPower (e.g., using “assertObjectsUp” option of the import command), make sure to add generated policy type to the global exclusion list, e.g.:

dp.status.ignore.objects: "ISAMRuntime:isam-runtime,GeneratedPolicy"

Interested in automating deployment of your DataPower configuration? Download the current version of DPBuddy and give it a try.

A Few Simple Commands is All You Need

Automate without scripting, monitor your services, check for compliance
Realize full potential of DataPower gateways

Download DPBuddy Request A Demo