DPBuddy Cookbook

This document provides a list of various “recipes” explaining how to perform most common tasks with DPBuddy 3.4. You can find more details in our samples and documentation.
This is a living document, we’ll be updating it based on the feedback and questions we receive from users.

DataPower Configuration Import

Import with State Checking and Quiesce/Un-quiesce


dpbuddy import -file dpconfigs/WSProxy.zip -save -quiesce -assertObjectsUp  -unquiesce -assertObjectsUp


<dp:import file="${wsproxy.zip.file}" save="true" quiesce="true" assertObjectsUp="true" unquiesce="true"/>

Disable Probes and Change Port During Import


dpbuddy import -file dpconfigs/XMLFirewall.xml -updates "LocalPort:3087, DebugMode:off"
    -applyUpdatesTo "XMLFirewallService:testFirewall"


<dp:import file="${dpconfig.home}/XMLFirewall.xml" updates="LocalPort:3087, DebugMode:off"
    applyUpdatesTo="XMLFirewallService:testFirewall" />

Running Configuration Transformations from CLI

Create file transformDefs.xml containing your transformations:

<project name="transforms" xmlns:dp="antlib:com.myarch.dpbuddy" >
    <dp:transform verbose="true" id="set.fw.port">
        <setText xpath="//*[@name='testFirewall']/LocalPort" value="3087"/>

You can then reference the file from CLI:

dpbuddy import -file dpconfigs/XMLFirewall.xml -transformDefs transformDefs.xml -transformId "set.fw.port"

Version Control-Friendly Export-Import (Preserve Object Order)


dpbuddy export -file dpconfigs/XMLFirewallSorted.xml -classPattern XMLFirewallService -sortObjects
dpbuddy import -file dpconfigs/XMLFirewallSorted.xml -reimportOnError


<dp:export file="${export.xml.file}" classPattern="XMLFirewallService" sortObjects="true"/>
<dp:import file="${export.xml.file}" reimportOnError="true"/>


Creating Log Targets


dpbuddy syslogTarget -name syslg-trg -remoteHost syslog-server -remotePort 123
    -localIdentifier dp7-qa--test" -localAddress dp-qa -levelInfo "all:info, mgmt:info"


<dp:syslogTarget name="syslog-trg" remoteHost="syslog-server" remotePort="123" localIdentifier="dp7-qa--test"
    localAddress="dp-qa" levelInfo="all:info, mgmt:info" />

Updating Log Target Level


# Change logging levels of all targets that start with "syslog"
dpbuddy updateLogTargetLevel -name "syslg.*" -levelInfo "all:notice, mgmt:warn"


<dp:updateLogTargetLevel name="syslg.*" levelInfo="all:notice, mgmt:warn" />

Tailing Logs Remotely


dpbuddy tail -f -domainPatterns "dpbuddy-.*, e2e.*"  -lines 100

Encrypted Properties, Passwords

Set Master Password

export DP_MASTER_PASSWORD="secret"

Encrypt a Value

dpbuddy encrypt -value dpbuddy

Password Alias

In dpbuddy.conf:

// Output of the ecrypt command:
testAliasPassword: "ENC{r5MmGcyzV01h1ErKUx6/uA==}"


dpbuddy passwordAlias -name "test-alias" -passwd "\${testAliasPassword}"


<dp:passwordAlias name="test-alias" passwd="${testAliasPassword}" />

Updating Configuration In Place (without Export/Import)

# Set certain objects to "up" admin state
dpbuddy updateConfig -classPattern "(XMLFire.*|WSG.*)" -updates "mAdminState: enabled"
# Change arbitrary elements of XML firewall configuration
dpbuddy updateConfig -classPattern "XMLFire.*" -updates "DoHostRewrite:on, Priority: normal, HTTPCompression: off"
# Update MPGW back-end:
dpbuddy updateConfig -classPattern "MultiProtocolGateway" -namePattern "test-mpgw"
    -updates "BackendUrl: \"http://test-host:8080\""
# Update a Web service proxy back-end
dpbuddy updateConfig -classPattern WSEndpointRewritePolicy
-updates  "WSEndpointRemoteRewriteRule:[{ServicePortMatchRegexp: \"{http://personservice}PersonService$\"},
{RemoteEndpointProtocol: http}, {RemoteEndpointHostname:foo1}, {RemoteEndpointPort:3040},

Querying Status of Objects (up/down, disabled/enabled)

dpbuddy objectStatus -objects "XMLFire.*,WSGateway" -domains ".*" -device "dev, test" | grep disabled

List Domains

dpbuddy listObjects -domain default -objects domain -device "dev,qa"

See what domains are down or quiesced:

dpbuddy listObjects -domain default -objects domain -device "dev,qa" | grep down

Diffing DataPower Configuration


dpbuddy configReport -dir confrep -objects "WSGatew.*, .*Firewall.*" -domains ".*" -excel -reportFileName DPReport.xlsx -diff

Report sample

Moving/Copying a File Remotely without Downloading

dpbuddy exec -cmd "move local://test1 local://test2"
# Note three slashes in the "from" parameter
dpbuddy exec -cmd "copy -f local:///test1 local://test2"