Need help to configure DPBuddy and small example

210 views
Skip to first unread message

Chennu

unread,
Jan 20, 2012, 12:26:34 AM1/20/12
to DataPower Buddy
Hi Everyone,

I am new to DPBuddy. We are having Data Power with the folowing
conifiguration.

Firmware Rev:XI50.3.7.3.7
Build:180345

Now I want to configure the DPBuddy to automate the administrative
tasks.

Would you please give me guidance on configuraion and running small
task.

Thanks,
Chennu


Gerry Put

unread,
Jan 20, 2012, 3:45:40 AM1/20/12
to dpb...@myarch.com
Hi,

this is a snippet out of our ant.xml

<project name="datapower" basedir="." xmlns:dp="antlib:com.myarch.datapower" default="status">
<property name="dp.env.prefix" value="acc" />
<loadproperties srcFile="dp.properties" />

   <target name="resetTest" description="Reset the DataPower domain">
       <dp:action name="ResetThisDomain" />
</target>
 
    <target name="saveAcc" description="Save running domain configuration">
        <dp:save/>
    </target>
    
    <target name="status" description="Get device status" >
        <!-- 'class' is any valid value from StatusEnum defined in xml-mgmt.xsd -->
        <dp:status class="FilesystemStatus" />
    </target>
    
</project>

to do these command you start it by do:

# ant status 

this will go get a filesystemstatus of the DP

cheers,
Gerry

2012/1/20 Chennu <mrutyu...@gmail.com>
Message has been deleted

Chennu

unread,
Jan 20, 2012, 7:05:14 AM1/20/12
to DataPower Buddy
Hi Gerry,

Thanks for the reply. I had successfully configured the DPBuddy and
tried to ran the above ant script but got the exception.

Here is the ant script which I ran in my environment :

<?xml version="1.0" encoding="UTF-8"?>
<project name="datapower" basedir="."
xmlns:dp="antlib:com.myarch.datapower" default="status">
<property name="dp.env.prefix" value="dev" />
<loadproperties srcFile="dp.properties" />

<target name="resetDomain" description="Reset the DataPower domain">
<dp:action name="ResetThisDomain" />
</target>

<target name="saveDomain" description="Save running domain
configuration">
<dp:save/>
</target>

<target name="status" description="Get device status" >
<!-- 'class' is any valid value from StatusEnum defined in
xml-
mgmt.xsd -->
<dp:status class="FilesystemStatus" />
</target>
</project>

Exception :

C:\dpbuddy>ant -v
Apache Ant version 1.8.1 compiled on April 30 2010
Trying the default build file: build.xml
Buildfile: C:\dpbuddy\build.xml
Detected Java version: 1.6 in: C:\Program Files\Java\jdk1.6.0_26\jre
Detected OS: Windows XP
parsing buildfile C:\dpbuddy\build.xml with URI = file:/C:/dpbuddy/
build.xml
Project base dir set to: C:\dpbuddy
parsing buildfile jar:file:/C:/apache-ant-1.8.1/lib/ant.jar!/org/
apache/tools/ant/antlib.xml with URI = jar:file:/C:/apache-a
nt-1.8.1/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
Build sequence for target(s) `status' is [status]
Complete build sequence is [status, resetDomain, saveDomain, ]

status:
parsing buildfile jar:file:/C:/apache-ant-1.8.1/lib/dpbuddy-2.2-
single.jar!/com/myarch/datapower/antlib.xml with URI = jar:fi
le:/C:/apache-ant-1.8.1/lib/dpbuddy-2.2-single.jar!/com/myarch/
datapower/antlib.xml from a zip file
[dp:status] Executing request 'get-status' against 'STUDENT03' domain
[dp:status] Request:
[dp:status] <?xml version="1.0" encoding="UTF-8"?>
[dp:status] <Envelope xmlns="http://schemas.xmlsoap.org/soap/
envelope/">
[dp:status] <Body>
[dp:status] <request xmlns="http://www.datapower.com/schemas/
management" domain="test03">
[dp:status] <get-status class="FilesystemStatus" />
[dp:status] </request>
[dp:status] </Body>
[dp:status] </Envelope>
[dp:status] Validating against the schema C:\dpbuddy\schema\xml-mgmt-
ops.xsd
[dp:status] Successfully validated get-status against DataPower schema
[dp:status] Connecting to URL https://xxx.xxx.xxx.xx:xxxx/service/mgmt/current
Username: test

BUILD FAILED
C:\dpbuddy\build.xml:16: java.net.SocketException: Unexpected end of
file from server
at
com.myarch.datapower.ant.BaseDPTask.executeRequest(BaseDPTask.java:
218)
at
com.myarch.datapower.ant.StatusTask.executeDPTask(StatusTask.java:31)
at
com.myarch.datapower.ant.BaseDPTask.execute(BaseDPTask.java:
191)
at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:
106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
at org.apache.tools.ant.Project.executeTarget(Project.java:
1366)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:
41)
at org.apache.tools.ant.Project.executeTargets(Project.java:
1249)
at org.apache.tools.ant.Main.runBuild(Main.java:801)
at org.apache.tools.ant.Main.startAnt(Main.java:218)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:
109)
Caused by: java.lang.RuntimeException: java.net.SocketException:
Unexpected end of file from server
at com.myarch.datapower.JDomUtil.parse(JDomUtil.java:38)
at com.myarch.datapower.DPResponse.populate(DPResponse.java:
27)
at
com.myarch.datapower.client.DPClient.executeRequest(DPClient.java:67)
at com.myarch.datapower.DPRequest.execute(DPRequest.java:99)
at
com.myarch.datapower.ant.BaseDPTask.executeRequest(BaseDPTask.java:
215)
... 19 more
Caused by: java.net.SocketException: Unexpected end of file from
server
at
sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:
769)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at
sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:
766)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection....
1195)
at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:
677)
at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:
1315)
at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:
1252)
at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.startPE(XMLDTDScannerImpl.java:
722)
at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.skipSeparator(XMLDTDScannerImpl.java:
2069)
at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDecls(XMLDTDScannerImpl.java:
2032)
at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDTDExternalSubset(XMLDTDScannerImpl.java:
320)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl
$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1203
)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl
$DTDDriver.next(XMLDocumentScannerImpl.java:1090)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl
$PrologDriver.next(XMLDocumentScannerImpl.java:1003)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:
648)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:
140)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl
.java:511)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:
808)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:
737)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:
119)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:
1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:518)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:946)
at com.myarch.datapower.JDomUtil.parse(JDomUtil.java:34)
... 23 more

Total time: 3 minutes 6 seconds

Note : I have masked the server URL with 'x' at URL "https://
xxx.xxx.xxx.xx:xxxx/service/mgmt/current" for security reasons.

Would you please help me out to fix this issue.

Thanks,
Chennu http://www.chennu.com

On Jan 20, 3:45 am, Gerry Put <put.ge...@gmail.com> wrote:
> Hi,
>
> this is a snippet out of our ant.xml
>
> <project name="datapower" basedir="."
> xmlns:dp="antlib:com.myarch.datapower" default="status">
> <property name="dp.env.prefix" value="acc" />
> <loadproperties srcFile="dp.properties" />
>
>    <target name="resetTest" description="Reset the DataPower domain">
>         <dp:action name="ResetThisDomain" />
> </target>
>
>     <target name="saveAcc" description="Save running domain configuration">
>         <dp:save/>
>     </target>
>
>     <target name="status" description="Get device status" >
>         <!-- 'class' is any valid value from StatusEnum defined in
> xml-mgmt.xsd -->
>         <dp:status class="FilesystemStatus" />
>     </target>
>
> </project>
>
> to do these command you start it by do:
>
> # ant status
>
> this will go get a filesystemstatus of the DP
>
> cheers,
> Gerry
>
> 2012/1/20 Chennu <mrutyumjay...@gmail.com>

Alexander 'Sasha' Ananiev

unread,
Jan 20, 2012, 8:46:43 AM1/20/12
to Chennu, DataPower Buddy
Chennu, 
Is XML management enabled on your device? Is it a standard port (5550)?
-Alexander

Alexander 'Sasha' Ananiev

unread,
Jun 6, 2012, 2:45:29 PM6/6/12
to kiran v, DataPower Buddy
There is no specific task to roll back, just use DataPower checkpoints. In other words, create a checkpoint using dpbuddy checkpoint task and if you need to roll back, just do it from Web GUI.
-Alexander

On Wed, Jun 6, 2012 at 2:00 PM, kiran v <kira...@gmail.com> wrote:
Do we have a target to rollback the configuration

On Jan 20, 6:46 am, "Alexander 'Sasha' Ananiev" <alexan...@myarch.com>

wrote:
> Chennu,
> Is XML management enabled on your device? Is it a standard port (5550)?
> > Chennuhttp://www.chennu.com

Alexander 'Sasha' Ananiev

unread,
Jun 6, 2012, 9:40:34 PM6/6/12
to kiran v, DataPower Buddy
Karthik,
The "rollback" task does not exist. The rollback itself would have to be manual (which is OK, given that a need for rollback is rare). There is however the "checkpoint" task which can be called before every "import".
Regards,
-Alexander

On Wed, Jun 6, 2012 at 3:41 PM, kiran v <kira...@gmail.com> wrote:
do you think this works :

 <target name="dp.rollback" depends="dp.init,dp.delete.domain,dp.import,dp.save" description="Do a rollback.">
    <dp:rollback domain="${dp.domain}" name="${dp.domain}" timestamp="true"/>
   </target>


Thanks,
Karthik
Message has been deleted

Alexander (Sasha) Ananiev

unread,
Feb 5, 2015, 12:09:29 PM2/5/15
to Santhi, DataPower Buddy
Hello Santhi,
You need to provide the target name, e.g., "ant testConnection".
Thanks,
- Alexander

On Thu, Feb 5, 2015 at 4:42 AM, Santhi <santhi...@gmail.com> wrote:
Hello All,

I need some guidance in executing dpbuddy scripts for automation.

I have set up 'apache-ant-1.9.4' and 'dpbuddy-3.1' on my system.

I have a sample script, and when I execute it says build successful as below in the command prompt. But could not see any output.

Can anyone help me in understanding this.

 

D:\DataPower\DPBuddy\dpbuddy-3.1\samples\ant-tasks>ant -v
Apache Ant(TM) version 1.9.3 compiled on December 23 2013
Trying the default build file: build.xml
Buildfile: D:\DataPower\DPBuddy\dpbuddy-3.1\samples\ant-tasks\build.xml
Detected Java version: 1.7 in: C:\Program Files\Java\jre7
Detected OS: Windows 7
parsing buildfile D:\DataPower\DPBuddy\dpbuddy-3.1\samples\ant-tasks\build.xml with URI = file:/D:/DataPower/DPBuddy/dpbuddy-3.1/samples/ant-tasks/build.xml
Project base dir set to: D:\DataPower\DPBuddy\dpbuddy-3.1\samples\ant-tasks
parsing buildfile jar:file:/D:/DataPower/DPBuddy/apache-ant-1.9.4/lib/ant-1.9.3.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/D:/DataPower/DPBuddy/apache-ant-1.9.4/lib/
ant-1.9.3.jar!/org/apache/tools/ant/antlib.xml from a zip file
parsing buildfile jar:file:/D:/DataPower/DPBuddy/apache-ant-1.9.4/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/D:/DataPower/DPBuddy/apache-ant-1.9.4/lib/ant.ja
r!/org/apache/tools/ant/antlib.xml from a zip file
 
BUILD SUCCESSFUL
Total time: 0 seconds

Thanks,
Santhi

Santhi

unread,
Feb 6, 2015, 4:57:55 AM2/6/15
to dpb...@myarch.com
Thanks Alexander for your reply.
Now for some reason I am getting below error.


D:\DataPower\DPBuddy\dpbuddy-3.1\samples\ant-tasks>ant status
Buildfile: D:\DataPower\DPBuddy\dpbuddy-3.1\samples\ant-tasks\build.xml

status:
[dp:status] Executing request 'get-status' against 'default' domain

BUILD FAILED
D:\DataPower\DPBuddy\dpbuddy-3.1\samples\ant-tasks\build.xml:22: Can't connect to DataPower at https://xx.xx.xx.xx:5550/service/mgmt/current

Total time: 21 seconds

Note: XML management interface is enabled on my appliance.

I am running this againist the virtual appliance(XI52) that has only one ethernet interface configured. Will that be a problem?

Thanks,
Santhi.

Alexander (Sasha) Ananiev

unread,
Feb 6, 2015, 9:10:03 AM2/6/15
to Santhi, DataPower Buddy
Hello Santhi,
Could you first verify that the appliance is reachable from the machine where DPBuddy is running and that the port is not blocked? Just run telnet or portqry or netcat to check the port.
The number of Ethernet interfaces should not be an issue.
Regards,
- Alexander

Reply all
Reply to author
Forward
0 new messages