Datapower Dynamic Domain Creation

Create dpSetup.bat  with the following curl command

curl –data-binary @SetConfigRequest.xml https://%1/service/mgmt/3.0 -k -u %2

Create dpCleanup.bat to clean up the Domains Created

curl –data-binary @DelConfigRequest.xml https://%1/service/mgmt/3.0 -k -u %2

SetConfigRequest.xml (creates 5 domains)

<?xml version=”1.0″ encoding=”UTF-8″?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/&#8221; xmlns:man=”http://www.datapower.com/schemas/management”&gt;

<SOAP-ENV:Header/>

<SOAP-ENV:Body>

<man:request>

<man:set-config>

<HostAlias name=”demoserver”>

<UserSummary>VERIFY IP ADDRESS!! Should point to the VM</UserSummary>

<IPAddress>127.0.0.1</IPAddress>

</HostAlias>

<HostAlias name=”E6BServer”>

<UserSummary>Set for localhost</UserSummary>

<IPAddress>127.0.0.1</IPAddress>

</HostAlias>

<Domain name=”instructor”>

<NeighborDomain>default</NeighborDomain>

</Domain>

<Domain name=”student01″>

<NeighborDomain>default</NeighborDomain>

</Domain>

<Domain name=”student02″>

<NeighborDomain>default</NeighborDomain>

</Domain>

<Domain name=”student03″>

<NeighborDomain>default</NeighborDomain>

</Domain>

<Domain name=”student04″>

<NeighborDomain>default</NeighborDomain>

</Domain>

<Domain name=”student05″>

<NeighborDomain>default</NeighborDomain>

</Domain>

<UserGroup name=”studentGroup01″>

<AccessPolicies>*/student01/*?Access=r+w+a+d+x</AccessPolicies>

</UserGroup>

<UserGroup name=”studentGroup02″>

<AccessPolicies>*/student02/*?Access=r+w+a+d+x</AccessPolicies>

</UserGroup>

<UserGroup name=”studentGroup03″>

<AccessPolicies>*/student03/*?Access=r+w+a+d+x</AccessPolicies>

</UserGroup>

<UserGroup name=”studentGroup04″>

<AccessPolicies>*/student04/*?Access=r+w+a+d+x</AccessPolicies>

</UserGroup>

<UserGroup name=”studentGroup05″>

<AccessPolicies>*/student05/*?Access=r+w+a+d+x</AccessPolicies>

</UserGroup>

<User name=”student01″>

<Password>password</Password>

<AccessLevel>group-defined</AccessLevel>

<GroupName>studentGroup01</GroupName>

</User>

<User name=”student02″>

<Password>password</Password>

<AccessLevel>group-defined</AccessLevel>

<GroupName>studentGroup02</GroupName>

</User>

<User name=”student03″>

<Password>password</Password>

<AccessLevel>group-defined</AccessLevel>

<GroupName>studentGroup03</GroupName>

</User>

<User name=”student04″>

<Password>password</Password>

<AccessLevel>group-defined</AccessLevel>

<GroupName>studentGroup04</GroupName>

</User>

<User name=”student05″>

<Password>password</Password>

<AccessLevel>group-defined</AccessLevel>

<GroupName>studentGroup05</GroupName>

</User>

</man:set-config>

</man:request>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

DelConfigRequest.xml

<?xml version=”1.0″ encoding=”UTF-8″?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/&#8221; xmlns:man=”http://www.datapower.com/schemas/management”&gt;

<SOAP-ENV:Header/>

<SOAP-ENV:Body>

<man:request>

<man:del-config>

<User name=”student01″/>

<User name=”student02″/>

<User name=”student03″/>

<User name=”student04″/>

<User name=”student05″/>

<UserGroup name=”developer_student01-domain”/>

<UserGroup name=”developer_student02-domain”/>

<UserGroup name=”developer_student03-domain”/>

<UserGroup name=”developer_student04-domain”/>

<UserGroup name=”developer_student05-domain”/>

<Domain name=”student01-domain”/>

<Domain name=”student02-domain”/>

<Domain name=”student03-domain”/>

<Domain name=”student04-domain”/>

<Domain name=”student05-domain”/>

</man:del-config>

</man:request>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: