Understanding NetScaler application templates and deployment files

When you export a NetScaler application, the following two files are automatically created:

  • NetScaler application template file. Contains application-configuration information such as application units, rules, and configured policies.
  • Deployment file. Contains deployment-specific information such as public endpoints, services, associated IP addresses, and configured variables.

In a template file or deployment file, each unit of application-configuration information is encapsulated in a specific XML element that is meant for that unit type. For example, each public endpoint and associated endpoint details are encapsulated within the <appendpoint> and <appendpoint> tags, and all the endpoint elements are encapsulated within the <appendpoint_list> and <appendpoint_list> tags.

Note: After you export a NetScaler application, you can add elements, remove elements, and modify existing elements before importing the application to a NetScaler appliance.

Example of a NetScaler Application Template

Following is an example of a template file that was created from a NetScaler application called SharePoint_Team_Site:

<?xml version="1.0" encoding="UTF-8" ?>
<template>
<template_info>
   <application_name>SharePoint_Team_Site</application_name>
   <templateversion_major>1</templateversion_major>
   <templateversion_minor>1</templateversion_minor>
   <author>Ed</author>
   <introduction>An application for managing a SharePoint team site with images, reports, and, XML content.</introduction>
   <summary>This template includes variables</summary>
   <version_major>9</version_major>
   <version_minor>3</version_minor>
   <build_number>38</build_number>
</template_info>
<apptemplate>
   <rewrite>
      <rewriteaction_list>
         <rewriteaction>
            <name>Rw_name</name>
            <type>replace</type>
            <target>HTTP.REQ.BODY(10000).AFTER_REGEX(re/number/).BEFORE_REGEX(re/address/)</target>
            <stringbuilderexpr>"NA"</stringbuilderexpr>
            <allow_unsafe_pi1>NO</allow_unsafe_pi1>
         </rewriteaction>
         <rewriteaction>
            .
            .
            .
         </rewriteaction>
         .
         .
         .
      </rewriteaction_list>
      <rewritepolicy_list>
         <rewritepolicy>
            <name>Rw_number_NA</name>
            <rule>HTTP.REQ.BODY(100000).CONTAINS("admin")</rule>
            <action>Rw_name</action>
         </rewritepolicy>
         <rewritepolicy>
            .
            .
            .
         </rewritepolicy>
         .
         .
         .
      </rewritepolicy_list>
   </rewrite>
   <appunit_list>
      <appunit>
         <name>SharePoint_Team_Sitedefault</name>
         <rule />
         <expressiontype>PE</expressiontype>
         <servicetype>HTTP</servicetype>
         <ipv46>0.0.0.0</ipv46>
         <ipmask>*</ipmask>
         <port>0</port>
         <range>1</range>
         <persistencetype>NONE</persistencetype>
         <timeout>2</timeout>
         <persistencebackup>NONE</persistencebackup>
         <backuppersistencetimeout>2</backuppersistencetimeout>
         <lbmethod>LEASTCONNECTION</lbmethod>
         <persistmask>255.255.255.255</persistmask>
         <v6persistmasklen>128</v6persistmasklen>
         <pq>OFF</pq>
         <sc>OFF</sc>
         <m>IP</m>
         <datalength>0</datalength>
         <dataoffset>0</dataoffset>
         <sessionless>DISABLED</sessionless>
         <state>ENABLED</state>
         <connfailover>DISABLED</connfailover>
         <clttimeout>180</clttimeout>
         <somethod>NONE</somethod>
         <sopersistence>DISABLED</sopersistence>
         <redirectportrewrite>DISABLED</redirectportrewrite>
         <downstateflush>DISABLED</downstateflush>
         <gt2gb>DISABLED</gt2gb>
         <ipmapping>0.0.0.0</ipmapping>
         <disableprimaryondown>DISABLED</disableprimaryondown>
         <insertvserveripport>OFF</insertvserveripport>
         <authentication>OFF</authentication>
         <authn401>OFF</authn401>
         <push>DISABLED</push>
         <pushlabel>none</pushlabel>
         <l2conn>OFF</l2conn>
      </appunit>
      <appunit>
         .
         .
         .
      </appunit>
      .
      .
      .
   </appunit_list>
   </apptemplate>
   <parameters>
      <property_list>
         <property>
            <variable_definition_list>
               <variable_definition>
                  <name>body_size</name>
                  <defaultvalue>10000</defaultvalue>
                  <description>Evaluation Scope</description>
                  <startindex>14</startindex>
                  <length>5</length>
               </variable_definition>
               .
               .
               .
            </variable_definition_list>
            <object_type>rewriteaction</object_type>
            <object_name>Rw_name</object_name>
            <name>target</name>
         </property>
         .
         .
         .
      </property_list>
   </parameters>
</template>

Example of a deployment file

Following is the deployment file associated with the SharePoint_Team_Site application in the preceding example:

<?xml version="1.0" encoding="UTF8" ?>
<template_deployment>
   <template_info>
      <application_name>SharePoint_Team_Site</application_name>
      <templateversion_major>1</templateversion_major>
      <templateversion_minor>1</templateversion_minor>
      <author>Ed</author>
      <introduction>An application for managing a SharePoint team site with images, reports, and, XML content.</introduction>
      <summary>This template includes variables</summary>
      <version_major>9</version_major>
      <version_minor>3</version_minor>
      <build_number>38</build_number>
   </template_info>
   <appendpoint_list>
      <appendpoint>
         <ipv46>10.111.111.1</ipv46>
         <port>80</port>
         <servicetype>HTTP</servicetype>
      </appendpoint>
   </appendpoint_list>
   <service_list>
      <service>
         <ip>10.102.29.5</ip>
         <port>80</port>
         <servicetype>HTTP</servicetype>
      </service>
      <service>
         .
         .
         .
      </service>
      .
      .
      .
   </service_list>
   <variable_list>
      <variable>
         <name>body_size</name>
         <description>Evaluation Scope</description>
         <value>10000</value>
      </variable>
      <variable>
         .
         .
         .
      </variable>
      .
      .
      .
   </variable_list>
</template_deployment>

Understanding NetScaler application templates and deployment files