Configuration Modification Examples

CLI:

# Apply configuration residing in "modify-lbg.xml"
# This file could reference variables defined in DPBuddy configuraiton file
dpbuddy modifyConfig -file dpconfigs/modify-lbg.xml

Ant:

<project name="dpbuddy.samples.modifyConfig" xmlns:dp="antlib:com.myarch.dpbuddy" >

    <description>
        Samples demonstrating modifying DataPower configuration
    </description>

    <property name="lbg.name" value="test-group" />
    <property name="server.name" value="server1" />

    <target name="modify.lbg" description="Modify an LBG configuration">
        
        <dp:modifyConfig save="true">
            <!-- We can provide configuration inline. 
            Alternatively, we can use the "file" attribute or the nested fileset.
            Multiple "configuration" tags can be provided.
            -->
            <configuration>
                <LoadBalancerGroup name="${lbg.name}">
                    <!-- Note how we can specify only a subset of LBG configuration -->
                    <LBGroupMembers>
                        <Server>${server.name}</Server>
                        <Weight>1</Weight>
                        <MappedPort>0</MappedPort>
                        <Activity/>
                        <!-- Note-you must provide the port, otherwise the validation fails.
                        Set it to 0 to default to the port defined at the group level -->
                        <HealthPort>0</HealthPort>
                        <LBMemberState>enabled</LBMemberState>
                    </LBGroupMembers>
                </LoadBalancerGroup>
            </configuration>
            <!-- Transformations will be applied to all inline configurations and the file 
            specified in the "file" attribute.
            It is not necessary in this case (we could've set the value of LBMemberState to "disabled" directly),
            included for demo purposes.-->
            <transform>
                <setText xpath="//LBGroupMembers/LBMemberState" value="disabled" />
            </transform>
        </dp:modifyConfig>

    </target>

    <target name="modify.config.all" depends="modify.lbg" />

</project>