-
Notifications
You must be signed in to change notification settings - Fork 51
/
deploy.ant.xml
1581 lines (1244 loc) · 71.1 KB
/
deploy.ant.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright 2014, 2018 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
-->
<!--
This stylesheet performs DataPower deployment operations (* = matching plug-in step):
backup-device* - Backup all domains on a device (minus key/certificate files)
backup-domains* - Backup one or more domains on a device (minus key/certificate files)
certificate-from-def - upload a cert (or multiple certs) based on a dcm:definition (with Crypto Certificate objects, of course)
check-access - check whether the device is accessible and that the userid/password works
checkpoint-delete* - delete the specified checkpoint
checkpoint-restore* - restore from the specified checkpoint
checkpoint-save* - create/overwrite the specified checkpoint
create-tam-files - Create TAM files based on a whole bunch of parameters
clean - delete any temp files created by this ant script
domain-create* - ensure the domain exists
domain-delete* - delete the domain
domain-init - delete and recreate the domain, then upload the standard files
domain-quiesce* - quiesce all the services in the domain
domain-recreate - delete and recreate the domain, then save
domain-reset - clear all the objects from the domain (but not files)
domain-restart* - restart the domain
domain-unquiesce* - unquiesce all the services in the domain
download-files* - Download target files or all files from a filestore
export-object* - export an object i.e. service
export-objects* - export objects based on a dcm:definition file
firmware-rollback - Rollback to the previous firmware (and filesystem contents!)
firmware-update - Update to a new level of firmware
host-alias-remove* - remove a specific host alias
host-alias-set* - create/overwrite a host alias
idcred-from-def* - create an idcred object based on a dcm:definition
idcred-from-key-and-cert - create an idcred object after uploading matching key and certificate files
idcred-from-p12 - create an idcred object after uploading a #PKCS12 file containing matching key and certificate
import-changed - import a specified .zip or .xcfg file into the domain, making changes along the way
import-from-def* - ditto
import-dpo* - import a specified .zip or .xcfg file into the domain, making changes along the way
key-from-def - upload a key (or multiple keys) based on a dcm:definition (with Crypto Key objects, of course)
key-create - generate a private key, a public key and a self-signed certificate
load-balancer-group-from-def* - create/overwrite a load balancer group object
ltpa-password - prompt the console user for the LTPA shared-secret password
main (default target) - execute the import-changed and save targets (in that order)
objects-from-def - create, delete, or modify objects based on dcm:object-* elements
object-status - check the opstate of objects are as required based on a dcm:definition file
password-alias-create - Create PasswordAlias object
password-alias-update - Update password in PasswordAlias object
raw-mgmt-call* - make a raw management (SOMA or AMP etc) call based on raw request file input
reboot - make an appliance reboot request
restore-backup* - Restore one or more domains from backup file (see Backup Device or Backup Domains)
save* - save the domain
secure-backup-device - secure backup of device
service-quiesce - quiesce a service
service-unquiesce - unquiesce a service
service-status - get the opstate of a service
upload-dir* - upload an entire directory
upload-from-def* - upload files specified in dcm:definition/dcm:upload elements
valcred-from-def* - create a valcred object based on a dcm:definition
valcred-from-dir - create a valcred object from a set of certificates in a directory
This script relies on the following ANT properties:
host - the hostname or IP address of the DataPower device
domain - the name of the domain on that device
uid - the userid on that device
pwd - the password for the userid on that device
port - the XML Management Interface port on that device (optional, defaults to 5550)
dcm.jar - location of DCM jar file
work.dir - location of DCM temp directory
dcm.dir - location of DCM stylesheets directory
schema.dir - location of directory used by DCM to cache internally-generated schemas
IF YOU ARE NEW TO ANT:
Ant executes the specified "targets" in the order that you specified them on the command line, or
it executes the "main" target, which is the default. Each target may depend on other targets, and those
will be executed first. For example, the "main" target depends on "domain-create", which in turn depends on
"check-access". So Ant will begin by executing the "check-access" target, then the "domain-create"
target, and finally the "main" target. Oh, and the code preceding all the <target> elements is initialization
code and will be executed before everything else. Targets that are defined but not needed are ignored.
Properties are the lifeblood of Ant. A property is simply a name/value pair and it can be set once. Further
changes to a property are ignored. For example, if the property xyz is defined on the command line like this:
ant -Dxyz=10
then xyz will have that value for the life of the Ant execution, regardless of how many times you attempt to
set xyz after that. Several places in the script provide default values for some properties but it isn't
possible (or generally desirable) to prevent the user from setting a property either on the command line,
or through a property file named on the command line.
Properties, once defined, exist for the rest of Ant's execution. With one exception of course. ;)
The lifetime of Ant properties can be confined by writing code this way:
<sequential>
<local name="def"/>
<property name="def" value="123"/>
...
</sequential>
The property "def" will be forgotten at the end of the <sequential> task.
There you go. With these concepts in hand, Ant scripts are generally straightforward to read.
-->
<project name="deploy" default="main" xmlns:props="antlib:ibm">
<description>Implement various DataPower deployment operations.</description>
<!-- Ensure we know where DCM is located. -->
<fail message="Please define the ANT property 'dcm.dir', which points to the directory where DCM is installed." unless="dcm.dir"/>
<available filepath="${dcm.dir}" file="dist/dcm.jar" property="dcm.dir.good"/>
<fail message="The Ant property 'dcm.dir' doesn't seem to point to DCM since ${dcm.dir}/dist/dcm.jar is not found." unless="dcm.dir.good"/>
<!-- Provide reasonable defaults for some optional properties. -->
<property name="dcm.jar" location="${dcm.dir}/dist/dcm.jar"/>
<property name="work.dir" location="./tmp"/>
<property name="schema.dir" location="${dcm.dir}/schemas"/>
<property name="capturesoma" value=""/>
<property name="dumpinput" value="false"/>
<property name="dumpoutput" value="false"/>
<property name="mgmt.method" value="/service/mgmt/current"/>
<property name="reboot.mode" value="reboot"/>
<property name="ignore.error" value=""/>
<!--
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Provide necessary definitions
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-->
<!-- Definitions related to the DCM jar file. -->
<!--
(This block, along with the xmlns:props="antlib:ibm" above, allows the use of
nested Ant properties, which is sometimes useful. For example, suppose the ant property
"environment" is defined as "SIT" and the ant property "xyz" is defined as "somedirectory_${environment}".
This <propertyhelper> definition means that ${xyz} correctly turns into "somedirectory_SIT".)
-->
<typedef uri="antlib:ibm" resource="com/ibm/antlib.xml" classpath="${dcm.jar}"/>
<propertyhelper>
<props:nested/>
</propertyhelper>
<include file="${dcm.dir}/src/dcm-taskdefs.ant.xml"/> <!-- pull in standard dcm taskdefs/macrodefs such as <createDomain> -->
<!--
Backup all the domains on the device. Note that this is not a secure backup that includes
key and certificate files.
-->
<target name="backup-device" depends="-init-dir, check-access">
<fail message="The Ant property 'device.backup.file' is required but not defined. This is the filename where the device backup will be written." unless="device.backup.file"/>
<sequential>
<local name="dirname"/>
<dirname property="dirname" file="${device.backup.file}"/>
<if>
<not>
<isfileselected file="${dirname}">
<writable/>
</isfileselected>
</not>
<then>
<fail message="Unable to write the device backup file : ${device.backup.file}"/>
</then>
</if>
</sequential>
<!--
Backup all the domains on the device, which is not a secure backup that includes
key and certificate files.
-->
<backupDevice host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" local="${device.backup.file}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</target>
<!--
Backup specific domains on the device.
-->
<target name="backup-domains" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<fail message="The Ant property 'backup.file' is required but not defined. This is the filename where the backup will be written." unless="backup.file"/>
<sequential>
<local name="dirname"/>
<dirname property="dirname" file="${backup.file}"/>
<if>
<not>
<isfileselected file="${dirname}">
<writable/>
</isfileselected>
</not>
<then>
<fail message="Unable to write the domain backup file : ${backup.file}"/>
</then>
</if>
</sequential>
<!--
Backup the specified domains on the device.
-->
<backupDomains host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}" domains="${domains}" local="${backup.file}" saveIfNeeded="true" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</target>
<target name="certificate-from-def" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<fail message="The Ant property 'cert.file' is required but not defined. This is the file containing the dcm:definition/dcm:certificate definition." unless="cert.file"/>
<if>
<not>
<available file="${cert.file}"/>
</not>
<then>
<fail message="Unable to see the file containing the certificate definition : ${cert.file}"/>
</then>
</if>
<sequential>
<local name="tmpl-file"/>
<!-- Generate an ant script that will do the actual work. -->
<nxslt infile="${cert.file}" outprop="tmp" xsl="${dcm.dir}/src/remove-unwanted-elements.xsl">
<param ant="environment" xsl="param1"/>
<param ant="device" xsl="param2"/>
</nxslt>
<property name="tmpl-file" location="${dcm.dir}/src/_quickie.template.ant.xml"/>
<nxslt inprop="tmp" outfile="${work.dir}/cert.ant.xml" xsl="${dcm.dir}/src/certificate-to-ant.xsl">
<param ant="tmpl-file" xsl="template-file"/>
</nxslt>
<!-- Run the little darling, inheriting all the currently-defined ant properties. -->
<ant antfile="${work.dir}/cert.ant.xml" inheritall="yes"/>
</sequential>
</target>
<target name="check-access" depends="-check-std-args">
<!--
Check whether we have access to the device by fetching the firmware version. Throws an exception, terminating Ant,
in case of an error. Also, detects that firmware.version is already set and does nothing in that case.
In case of an error it throws an exception or prints the SOAP response and terminates Ant.
-->
<checkDeviceAccess host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" versionprop="firmware.version" domain="${domain}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
<if>
<or>
<not>
<isset property="firmware.version"/>
</not>
<equals arg1="${firmware.version}" arg2=""/>
</or>
<then>
<fail message="Unable to reach ${host} or the userid/password doesn't work."/>
</then>
</if>
</target>
<target name="checkpoint-delete" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<fail message="The Ant property 'checkpoint.name' is required but not defined. This defines name of the checkpoint that will be deleted." unless="checkpoint.name"/>
<removeCheckpoint host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}" checkpoint-name="${checkpoint.name}"
dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</target>
<target name="checkpoint-restore" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<fail message="The Ant property 'checkpoint.name' is required but not defined. This defines name of the checkpoint that will be restored." unless="checkpoint.name"/>
<rollbackCheckpoint host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}" checkpoint-name="${checkpoint.name}"
dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</target>
<target name="checkpoint-save" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<fail message="The Ant property 'checkpoint.name' is required but not defined. This defines name of the checkpoint that will be saved." unless="checkpoint.name"/>
<saveCheckpoint host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}" checkpoint-name="${checkpoint.name}"
dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</target>
<!-- All ANT scripts support this by convention. -->
<target name="clean">
<delete dir="${work.dir}"/>
</target>
<target name="create-tam-files" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<fail message="The Ant property 'tam.outputconfigfile' is required but not defined. This defines the TAM files that will be created." unless="tam.outputconfigfile"/>
<fail message="The Ant property 'tam.administrator-uid' is required but not defined. This is the TAM userid." unless="tam.administrator-uid"/>
<fail message="The Ant property 'tam.tamdomain' is required but not defined. This is the TAM domain." unless="tam.tamdomain"/>
<fail message="The Ant property 'tam.application' is required but not defined. This TAM Application ID." unless="tam.application"/>
<fail message="The Ant property 'tam.tamhost' is required but not defined. This is the hostname or IP address of the TAM server." unless="tam.tamhost"/>
<fail message="The Ant property 'tam.tamport' is required but not defined. This is the port for TAM on the TAM server." unless="tam.tamport"/>
<fail message="The Ant property 'tam.sslkeyfilelifetime' is required but not defined. This is the number of days the generated SSL key will be valid." unless="tam.sslkeyfilelifetime"/>
<fail message="The Ant property 'tam.ssltimeout' is required but not defined. This the number of seconds before the connection to TAM times out." unless="tam.ssltimeout"/>
<fail message="The Ant property 'tam.localmode' is required but not defined. This defines whether to use a local authentication server (on/off)." unless="tam.localmode"/>
<fail message="The Ant property 'tam.useadregistry' is required but not defined. This defines whether to use Active Directory (on/off)." unless="tam.useadregistry"/>
<if>
<and>
<not>
<isset property="tam.administrator-pwd"/>
</not>
<isset property="tam.administrator-uid"/>
</and>
<then>
<input message="Please enter the password for TAM userid '${tam.administrator-uid}' : " addproperty="tam.administrator-pwd">
<handler type="secure"/>
</input>
</then>
</if>
<if>
<and>
<not>
<isset property="tam.ldapbindpassword"/>
</not>
<isset property="tam.ldapserver"/>
</and>
<then>
<input message="Please enter the LDAP password for '${tam.ldapserver}' : " addproperty="tam.ldapbindpassword">
<handler type="secure"/>
</input>
</then>
</if>
<sequential>
<local name="okay"/>
<local name="response"/>
<local name="success"/>
<local name="createcopy"/>
<local name="listenmode"/>
<local name="localhost"/>
<local name="localport"/>
<local name="adpprimarydomain"/>
<local name="adpprimaryhost"/>
<local name="adpprimaryreplicas"/>
<local name="ldapserver"/>
<local name="ldapport"/>
<local name="ldapbindpassword"/>
<local name="ldapauthtimeout"/>
<local name="ldapsearchtimeout"/>
<local name="adpclienttimeout"/>
<local name="enableregistrycache"/>
<local name="ldapusercachesize"/>
<local name="ldappolicycachesize"/>
<local name="adldapcachesize"/>
<local name="adldapcachelife"/>
<local name="addnforpd"/>
<local name="adusemultidomain"/>
<local name="addomaindomain"/>
<local name="addomainhost"/>
<local name="addomainreplicas"/>
<local name="aduseemailuid"/>
<local name="adgchost"/>
<defprop-set name="createcopy" from="tam.createcopy" defvalue="off"/>
<defprop-set name="listenmode" from="tam.listenmode" defvalue="off"/>
<defprop-set name="localhost" from="tam.localhost" defvalue=""/>
<defprop-set name="localport" from="tam.localport" defvalue="0"/>
<defprop-set name="adpprimarydomain" from="tam.adpprimarydomain" defvalue=""/>
<defprop-set name="adpprimaryhost" from="tam.adpprimaryhost" defvalue=""/>
<defprop-set name="adpprimaryreplicas" from="tam.adpprimaryreplicas" defvalue=""/>
<defprop-set name="ldapserver" from="tam.ldapserver" defvalue=""/>
<defprop-set name="ldapport" from="tam.ldapport" defvalue="0"/>
<defprop-set name="ldapbindpassword" from="tam.ldapbindpassword" defvalue=""/>
<defprop-set name="ldapauthtimeout" from="tam.ldapauthtimeout" defvalue="30"/>
<defprop-set name="ldapsearchtimeout" from="tam.ldapsearchtimeout" defvalue="30"/>
<defprop-set name="adpclienttimeout" from="tam.adpclienttimeout" defvalue="30"/>
<defprop-set name="enableregistrycache" from="tam.enableregistrycache" defvalue="off"/>
<defprop-set name="ldapusercachesize" from="tam.ldapusercachesize" defvalue="256"/>
<defprop-set name="ldappolicycachesize" from="tam.ldappolicycachesize" defvalue="20"/>
<defprop-set name="adldapcachesize" from="tam.adldapcachesize" defvalue="251"/>
<defprop-set name="adldapcachelife" from="tam.adldapcachelife" defvalue="300"/>
<defprop-set name="addnforpd" from="tam.addnforpd" defvalue=""/>
<defprop-set name="adusemultidomain" from="tam.adusemultidomain" defvalue="off"/>
<defprop-set name="addomaindomain" from="tam.addomaindomain" defvalue=""/>
<defprop-set name="addomainhost" from="tam.addomainhost" defvalue=""/>
<defprop-set name="addomainreplicas" from="tam.addomainreplicas" defvalue=""/>
<defprop-set name="aduseemailuid" from="tam.aduseemailuid" defvalue="off"/>
<defprop-set name="adgchost" from="tam.adgchost" defvalue=""/>
<wdp operation="CreateTAMFiles" successprop="success" responseprop="response" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"
xpath="normalize-space(/env:Envelope/env:Body/soma:response/soma:result)" xpathprop="okay">
<hostname>${host}</hostname>
<port>${port}</port>
<uid>${uid}</uid>
<pwd>${pwd}</pwd>
<domain>${domain}</domain>
<outputconfigfile>${tam.outputconfigfile}</outputconfigfile>
<administrator-uid>${tam.administrator-uid}</administrator-uid>
<administrator-pwd>${tam.administrator-pwd}</administrator-pwd>
<tamdomain>${tam.tamdomain}</tamdomain>
<application>${tam.application}</application>
<tamhost>${tam.tamhost}</tamhost>
<tamport>${tam.tamport}</tamport>
<sslkeyfilelifetime>${tam.sslkeyfilelifetime}</sslkeyfilelifetime>
<ssltimeout>${tam.ssltimeout}</ssltimeout>
<localmode>${tam.localmode}</localmode>
<useadregistry>${tam.useadregistry}</useadregistry>
<createcopy>${createcopy}</createcopy>
<listenmode>${listenmode}</listenmode>
<localhost>${localhost}</localhost>
<localport>${localport}</localport>
<adpprimarydomain>${adpprimarydomain}</adpprimarydomain>
<adpprimaryhost>${adpprimaryhost}</adpprimaryhost>
<adpprimaryreplicas>${adpprimaryreplicas}</adpprimaryreplicas>
<ldapserver>${ldapserver}</ldapserver>
<ldapport>${ldapport}</ldapport>
<ldapbindpassword>${ldapbindpassword}</ldapbindpassword>
<ldapauthtimeout>${ldapauthtimeout}</ldapauthtimeout>
<ldapsearchtimeout>${ldapsearchtimeout}</ldapsearchtimeout>
<adpclienttimeout>${adpclienttimeout}</adpclienttimeout>
<enableregistrycache>${enableregistrycache}</enableregistrycache>
<ldapusercachesize>${ldapusercachesize}</ldapusercachesize>
<ldappolicycachesize>${ldappolicycachesize}</ldappolicycachesize>
<adldapcachesize>${adldapcachesize}</adldapcachesize>
<adldapcachelife>${adldapcachelife}</adldapcachelife>
<addnforpd>${addnforpd}</addnforpd>
<adusemultidomain>${adusemultidomain}</adusemultidomain>
<addomaindomain>${addomaindomain}</addomaindomain>
<addomainhost>${addomainhost}</addomainhost>
<addomainreplicas>${addomainreplicas}</addomainreplicas>
<aduseemailuid>${aduseemailuid}</aduseemailuid>
<adgchost>${adgchost}</adgchost>
</wdp>
<if>
<and>
<istrue value="${success}"/>
<equals arg1="${okay}" arg2="OK"/>
</and>
<then>
<echo>Created TAM files (${tam.outputconfigfile}) in ${domain} on ${host}.</echo>
</then>
<else>
<echo>Raw response for TAM create files: ${response}</echo>
<fail message="Failed to create TAM files (${tam.outputconfigfile}) in ${domain} on ${host}."/>
</else>
</if>
</sequential>
</target>
<!-- All ANT scripts support this by convention. -->
<target name="debug">
<echo/>
<echoproperties/>
<echo/>
</target>
<target name="domain-create" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<!--
Creates the domain when it doesn't exist and prints whether it had to create the domain or not.
In case of an error it throws an exception or prints the SOAP response and terminates Ant.
-->
<createDomain host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
<sequential>
<local name="domainstatus"/>
<getDomainStatus host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domainsprop="domainstatus" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
<saveDomainIfChanged host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domainStatusProp="domainstatus" domain="default" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</sequential>
</target>
<target name="domain-delete" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<!--
Deletes the domain when it exists and prints whether it had to delete the domain or not.
In case of an error it throws an exception or prints the SOAP response and terminates Ant.
-->
<deleteDomain host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
<sequential>
<local name="domainstatus"/>
<getDomainStatus host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domainsprop="domainstatus" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
<saveDomainIfChanged host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domainStatusProp="domainstatus" domain="default" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</sequential>
</target>
<target name="domain-init" depends="domain-delete, domain-create">
<echo>Completed initialization of the domain.</echo>
</target>
<target name="domain-recreate" depends="domain-delete, domain-create, save"/>
<target name="domain-reset" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<!--
Resets the domain conventionally, when the domain exists, printing what it did.
In case of an error it throws an exception or prints the SOAP response and terminates Ant.
-->
<resetDomainConventionally host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
<sequential>
<local name="domainstatus"/>
<getDomainStatus host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domainsprop="domainstatus" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
<saveDomainIfChanged host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domainStatusProp="domainstatus" domain="${domain}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</sequential>
</target>
<target name="domain-quiesce" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<!--
Quiesces the domain, when the domain exists, printing what it did.
In case of an error it throws an exception or prints the SOAP response and terminates Ant.
-->
<quiesceDomain host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</target>
<target name="domain-restart" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<!--
Restarts the domain, when the domain exists, printing what it did.
In case of an error it throws an exception or prints the SOAP response and terminates Ant.
-->
<restartDomain host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</target>
<target name="domain-unquiesce" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<!--
Unquiesces the domain, when the domain exists, printing what it did.
In case of an error it throws an exception or prints the SOAP response and terminates Ant.
-->
<unquiesceDomain host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</target>
<!--
Download target files or all files from a filestore
-->
<target name="download-files" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<fail message="The Ant property 'filestore' is required but not defined. This is filestore in the device." unless="filestore"/>
<fail message="The Ant property 'download-dir.to' is required but not defined. This local directory will contain the downloaded files." unless="download-dir.to"/>
<if>
<isset property="files"/>
<then>
<!-- download target files -->
<downloadFiles host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}"
dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"
filestore="${filestore}" local="${download-dir.to}" files="${files}" />
</then>
<else>
<!-- download all files from the target filestore -->
<downloadFilestore host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}"
dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"
filestore="${filestore}" local="${download-dir.to}" dcmdir="${dcm.dir}" />
</else>
</if>
</target>
<!--
Export an object from a domain on the device.
-->
<target name="export-object" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<fail message="The Ant property 'object.class' is required but not defined. This is the object's class." unless="object.class"/>
<fail message="The Ant property 'object.name' is required but not defined. This is the name of the target object on the DataPower device." unless="object.name"/>
<fail message="The Ant property 'export.file' is required but not defined. This is the filename where the backup will be written." unless="export.file"/>
<property name="ref.objects" value="true"/> <!-- provide defaults if not specified by user -->
<property name="ref.files" value="true"/>
<property name="all.files" value="false"/>
<property name="format" value="ZIP"/>
<sequential>
<local name="dirname"/>
<dirname property="dirname" file="${export.file}"/>
<if>
<not>
<isfileselected file="${dirname}">
<writable/>
</isfileselected>
</not>
<then>
<fail message="No permission to write ${export.file} into folder ${dirname}"/>
</then>
</if>
</sequential>
<exportObject host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}" local="${export.file}"
format="${format}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"
objclass="${object.class}" objname="${object.name}" refobjs="${ref.objects}" reffiles="${ref.files}" allfiles="${all.files}" />
</target>
<!--
Export objects based on a dcm:definition file.
-->
<target name="export-objects" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<fail message="The Ant property 'export-manifest.file' is required but not defined. This is the required export-manifest dcm:definition file." unless="export-manifest.file"/>
<fail message="The Ant property 'export.file' is required but not defined. This is the filename where the backup will be written." unless="export.file"/>
<property name="ref.objects" value="true"/> <!-- provide defaults if not specified by user -->
<property name="ref.files" value="true"/>
<property name="format" value="ZIP"/>
<sequential>
<local name="dirname"/>
<dirname property="dirname" file="${export.file}"/>
<if>
<not>
<isfileselected file="${dirname}">
<writable/>
</isfileselected>
</not>
<then>
<fail message="No permission to write ${export.file} into folder ${dirname}"/>
</then>
</if>
<!-- Generate a SOMA export objects request xml-->
<nxslt infile="${export-manifest.file}" outprop="tmp" xsl="${dcm.dir}/src/export-objects-request.xsl">
<param xsl="domain" ant="${domain}"/>
</nxslt>
<!-- Log results to console -->
<echo message="${tmp}" />
<exportObjects host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}" local="${export.file}"
format="${format}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"
objects="${tmp}" refobjs="${ref.objects}" reffiles="${ref.files}" />
</sequential>
</target>
<!--
Rollback to the previous firmware (and filesystem contents!).
-->
<target name="firmware-rollback" depends="-init-dir, check-access">
<firmwareRollback host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</target>
<!--
Update to a new level of firmware.
-->
<target name="firmware-update" depends="-init-dir, check-access">
<fail message="The Ant property 'new.firmware.file' is required but not defined. This is the file containing the the new firmware for the appliance." unless="new.firmware.file"/>
<if>
<not>
<available file="${new.firmware.file}"/>
</not>
<then>
<fail message="Unable to see the firmware file : ${new.firmware.file}"/>
</then>
</if>
<firmwareUpdate host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" scryptfile="${new.firmware.file}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</target>
<target name="host-alias-remove" depends="-init-dir, check-access">
<fail message="The Ant property 'host-alias.name' is required but not defined. This is the name of the host alias (e.g. www.ibm.com) to delete." unless="host-alias.name"/>
<sequential>
<!-- Create or overwrite the specified host alias. -->
<objectDelete host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="default"
class="HostAlias" name="${host-alias.name}"
dcmdir="${dcm.dir}" workdir="${work.dir}"
dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</sequential>
</target>
<target name="host-alias-set" depends="-init-dir, check-access">
<fail message="The Ant property 'host-alias.name' is required but not defined. This is the name of the host alias (e.g. www.ibm.com) to create or overwrite." unless="host-alias.name"/>
<fail message="The Ant property 'host-alias.ip' is required but not defined. This is the IP address to assign (e.g. 10.11.12.13)." unless="host-alias.ip"/>
<property name="host-alias.comment" value=""/>
<property name="host-alias.mAdminState" value="enabled"/>
<sequential>
<!-- Create or overwrite the specified host alias. -->
<objectCreateByInline host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="default" versionprop="firmware.version"
dcmdir="${dcm.dir}" schemadir="${schema.dir}" workdir="${work.dir}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}">
<HostAlias name="${host-alias.name}">
<mAdminState>${host-alias.mAdminState}</mAdminState>
<UserSummary>${host-alias.comment}</UserSummary>
<IPAddress>${host-alias.ip}</IPAddress>
</HostAlias>
</objectCreateByInline>
</sequential>
</target>
<target name="idcred-from-def" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<fail message="The Ant property 'idcred.file' is required but not defined. This is the file containing the dcm:definition/dcm:idcred definition." unless="idcred.file"/>
<if>
<not>
<available file="${idcred.file}"/>
</not>
<then>
<fail message="Unable to see the file containing the idcred definition : ${idcred.file}"/>
</then>
</if>
<sequential>
<local name="tmp"/>
<local name="tmpl-file"/>
<!-- Generate an ant script that will do the actual work. -->
<property name="tmpl-file" location="${dcm.dir}/src/_quickie.template.ant.xml"/>
<nxslt infile="${idcred.file}" outprop="tmp" xsl="${dcm.dir}/src/remove-unwanted-elements.xsl">
<param ant="environment" xsl="param1"/>
<param ant="device" xsl="param2"/>
</nxslt>
<nxslt inprop="tmp" outfile="${work.dir}/idcred.ant.xml" xsl="${dcm.dir}/src/idcred-to-ant.xsl">
<param ant="tmpl-file" xsl="template-file"/>
</nxslt>
<!-- Run the little darling, inheriting all the currently-defined ant properties. -->
<ant antfile="${work.dir}/idcred.ant.xml" inheritall="yes"/>
</sequential>
</target>
<target name="idcred-from-key-and-cert" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<fail message="The Ant property 'idcred.key.file' is required but not defined. This is the file containing the key for the ID credential." unless="idcred.key.file"/>
<if>
<not>
<available file="${idcred.key.file}"/>
</not>
<then>
<fail message="Unable to see the key file : ${idcred.key.file}"/>
</then>
</if>
<fail message="The Ant property 'idcred.cert.file' is required but not defined. This is the file containing the certificate for the ID credential." unless="idcred.cert.file"/>
<if>
<not>
<available file="${idcred.cert.file}"/>
</not>
<then>
<fail message="Unable to see the certificate file : ${idcred.cert.file}"/>
</then>
</if>
<fail message="The Ant property 'idcred.objname' is required but not defined. This is the name for the ID Credential object to create/overwrite on DataPower." unless="idcred.objname"/>
<if>
<equals arg1="${idcred.objname}" arg2=""/>
<then>
<fail message="The Ant property 'idcred.objname', which is the name of the ID Credential object, is empty!"/>
</then>
</if>
<if>
<not>
<isset property="idcred.key.pwd"/>
</not>
<then>
<input message="What is the password for ${idcred.key.file} (Press Enter if none)? " addproperty="idcred.key.pwd">
<handler type="secure"/>
</input>
</then>
</if>
<if>
<not>
<isset property="idcred.cert.pwd"/>
</not>
<then>
<input message="What is the password for ${idcred.cert.file} (Press Enter if none)? " addproperty="idcred.cert.pwd">
<handler type="secure"/>
</input>
</then>
</if>
<sequential>
<local name="ignoreexpiration"/>
<if>
<and>
<isset property="${idcred.ignoreexpiration}"/>
<equals arg1="${idcred.ignoreexpiration}" arg2="true"/>
</and>
<then>
<property name="ignoreexpiration" value="on"/>
</then>
<else>
<property name="ignoreexpiration" value="off"/>
</else>
</if>
<idcredFromKeyAndCert host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}"
certfile="${idcred.cert.file}" certpwd="${idcred.cert.pwd}" keyfile="${idcred.key.file}" keypwd="${idcred.key.pwd}"
objname="${idcred.objname}" ignoreexpiration="${ignoreexpiration}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</sequential>
</target>
<target name="idcred-from-p12" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<fail message="The Ant property 'idcred.p12.file' is required but not defined. This is the #PKCS12-format file containing the key and certificate for the ID credential." unless="idcred.p12.file"/>
<if>
<not>
<available file="${idcred.p12.file}"/>
</not>
<then>
<fail message="Unable to see the #PKCS12 file : ${idcred.p12.file}"/>
</then>
</if>
<fail message="The Ant property 'idcred.objname' is required but not defined. This is the name for the ID Credential object to create/overwrite on DataPower." unless="idcred.objname"/>
<if>
<equals arg1="${idcred.objname}" arg2=""/>
<then>
<fail message="The Ant property 'idcred.objname', which is the name of the ID Credential object, is empty!"/>
</then>
</if>
<if>
<not>
<isset property="idcred.p12.pwd"/>
</not>
<then>
<input message="What is the password for ${idcred.p12.file}? " addproperty="idcred.p12.pwd">
<handler type="secure"/>
</input>
</then>
</if>
<sequential>
<local name="ignoreexpiration"/>
<if>
<and>
<isset property="${idcred.ignoreexpiration}"/>
<equals arg1="${idcred.ignoreexpiration}" arg2="true"/>
</and>
<then>
<property name="ignoreexpiration" value="on"/>
</then>
<else>
<property name="ignoreexpiration" value="off"/>
</else>
</if>
<idcredFromPKCS12 host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}"
p12file="${idcred.p12.file}" p12pwd="${idcred.p12.pwd}" objname="${idcred.objname}" ignoreexpiration="${ignoreexpiration}"
dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>
</sequential>
</target>
<target name="import-changed" depends="import-from-def"/>
<target name="import-from-def" depends="-init-dir, check-access">
<fail message="The Ant property 'domain' is required but not defined. This is the name of a domain on the DataPower device." unless="domain"/>
<fail message="The Ant property 'import.file' is required but not defined. This is the .zip or .xcfg file to import into the domain." unless="import.file"/>
<if>
<not>
<available file="${import.file}"/>
</not>
<then>
<fail message="Unable to see the import file : ${import.file}"/>
</then>
</if>
<sequential>
<local name="dcmdefinition"/>
<local name="tmp"/>
<local name="tmp2"/>
<!-- Load and preprocess the set of deployment policies, or substitute an empty set. -->
<property name="import.changes.file" location="${dcm.dir}/src/no-changes.dcm.xml"/> <!-- provide a default, if property not defined. -->
<loadfile srcfile="${import.changes.file}" property="tmp">
<filterchain>
<expandproperties/>
</filterchain>
</loadfile>
<nxslt inprop="tmp" outprop="tmp2" xsl="${dcm.dir}/src/remove-unwanted-elements.xsl">
<param ant="environment" xsl="param1"/>
<param ant="device" xsl="param2"/>
</nxslt>
<nxslt inprop="tmp2" outprop="dcmdefinition" xsl="${dcm.dir}/src/expand-black-white-modify.xsl"/>
<!-- <echo>dcmdefinition = ${dcmdefinition}</echo> -->
<!--
Import a plain .zip or .xcfg file into the domain, making no changes to the import objects or files.
In case of an error it throws an exception or prints the SOAP response and terminates Ant.
-->
<importConfig host="${host}" port="${port}" uid="${uid}" pwd="${pwd}" domain="${domain}"
inputfile="${import.file}" ignoreError="${ignore.error}"
dcmdir="${dcm.dir}" workdir="${work.dir}" changes="${dcmdefinition}" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}"/>