NetScaler

Entity template for load balancing virtual server

An entity template is a collection of information for creating a load balancing virtual server template on a NetScaler appliance. It provides a specification and a set of defaults to be configured for a load balancing virtual server. By using a template that defines a set of defaults, you can quickly configure multiple virtual servers that require a similar configuration while eliminating several configuration steps.

You can create an entity template by exporting the load balancing virtual server details to a template file. This can done only through the NetScaler GUI. You use the NetScaler GUI to export, import, and manage entity templates. You can share entity templates with other administrators and manage templates saved locally on your appliance or machine. You can also import entity templates from the appliance or your local computer.

Before creating a template, you should be familiar with the configuration of the load balancing virtual server.

Load balancing virtual server template

Load balancing entity templates are created in the same way that NetScaler application templates are created. When you export a load balancing virtual server to a template file, the following two files are automatically created:

  • Load balancing virtual server template file. Contains XML elements that store the values of the parameters that are configured for the load balancing virtual server. The file also contains XML elements for storing information about bound policies.
  • Deployment file. Contains XML elements that store deployment-specific information such as services, service groups, and configured variables. In the template and deployment files, each unit of configuration information is encapsulated in a specific XML element that is meant for that unit type. For example, the load balancing method parameter, lbMethod, is encapsulated within the <lbmethod> and </lbmethod> tags.

Note:

After you export a load balancing virtual server, you can add elements, remove elements, and modify existing elements before importing the configuration information to a NetScaler appliance.

How a load balancing virtual server template works

When you create a template for a load balancing virtual server, you specify default values for the server. You specify what values must be read-only, what values must not be displayed, and what values users can configure. You also configure the pages that compose the template import wizard. All the information and settings you provide are stored in the template file. When a user imports the template to a NetScaler appliance, the GUI guides the user through the various pages that you configured for the template. The GUI displays the read-only parameter values and prompts the user to specify values for the configurable parameters. After the user follows the instructions, the appliance creates the entity with the configured values. You can create or modify an entity template for a load balancing virtual server from Traffic Management node. To export virtual server details to a template, you must specify the following options and settings for the template:

  • The default value of a parameter.
  • Whether the default values are visible to users.
  • Whether the default values can be changed by users.
  • The number of pages in the entity import wizard, including the page names, text, and available parameters.
  • The entities that must be bound to the entity for which the template is being created.

For example, when you are creating a load balancing virtual server template, you can specify the policies that you want to bind to the virtual server that you create from the template. However, only binding information is included in the template. The bound entities are not included. If the entity template is imported to another NetScaler appliance, the bound entities must exist on the appliance at import time for the binding to succeed. If none of the bound entities exist on the target appliance, the entity (for which the template was configured) is created without any bindings. If only a subset of the bound entities exists on the target appliance, they are bound to the entity that is created from the template. When you export a template for the load balancing virtual server, the configuration settings of the entity appear in the template. All bound entities are selected by default, but you can modify bindings as necessary. As in the case of a template that is not based on an existing entity, only binding information is included and not the entities. You can either save the template with the existing configuration settings or use the settings as a basis for creating a configuration for a template.

Configure variables in load balancing virtual server template

Load balancing virtual server templates support the declaration of variables in the configured load balancing parameters and in bound policies and actions. The ability to declare variables enables you to replace preconfigured values with values that suit the environment into which you are importing the template.

As an example, consider the following expression configured for a policy that is bound to a load balancing virtual server for which you are creating a template. The expression evaluates the value of the accept-language header in an HTTP request. HTTP.REQ.HEADER("Accept-Language").CONTAINS("en-us")

If you want the value of the header to be configurable at import time, you can specify the string en-us as a variable.

After you create a variable, you can do the following:

  • Assign more strings to an existing variable. After you create a variable for a string, you can select and assign other parts of the same or different expression to the variable. The strings you assign to a variable need not be the same. At import time, all the strings that are assigned to the variable are replaced with the value that you provide.
  • View the string or strings that are assigned to the variable.
  • View a list of all the entities and parameters that use the variable

To configure variables in a load balancing virtual server template

Complete the following procedure to configure variables for a load balancing virtual server template by using the Citrix ADC GUI

  1. Navigate to Traffic Management > Load Balancing > Virtual Servers
  2. In the details pane, right-click the virtual server that you want to export to a template file, and then click Add.
  3. In the Create Load balancing Virtual Server page, set the virtual server parameters. For more information on configuring a load balancing virtual server, see. How load balancing works](en-us/netscaler/12/load-balancing/load-balancing-how-it-works.html)
  4. Once you have the set the parameters for the load balancing virtual server, click Done.

    Export as load balancing virtual server template

  5. Click Export as Template link at the top to export the server details as a template file.
  6. In the Create Load Balancing Template page, enter the template settings.
  7. Click Done.

    Confirmation screen

Modify a load balancing virtual server template

You can modify only the parameters, bindings, and pages configured for a template. The name and location of the template specified when the template was created cannot be changed. The Citrix ADC appliance does not provide you with the option of modifying a load balancing virtual server template.

To modify a load balancing virtual server by using NetScaler GUI

  1. Navigate to Traffic Management > Load balancing > Virtual Servers.
  2. In the Load Balancing Virtual Server page, modify the entity parameters.
  3. Click Done.
  4. Click Export as a Template link.
  5. The modified changes are now available in the load balancing virtual server template file.
  6. In the Exported Load Balancing Template page, click Done.

Manage load balancing virtual server templates

You can organize load balancing virtual server template files and deployment files by using the NetScaler GUI.

  1. Navigate to Traffic Management > Load Balancing > Virtual Servers.
  2. In the Virtual Servers page, select Manage Template action.
  3. In the Load Balancing Templates page, click Template File tab.
  4. In the Template Files tab page, you can upload or download a template from and to the appliance template folder.

    Manage template

  5. Click Close.

To upload load balancing virtual server entity template by using NetScaler GUI

  1. Navigate to Traffic Management > Load Balancing > Virtual Servers.
  2. In the Virtual Servers page, click Select Action and then select Manage Template.
  3. In the Load Balancing Templates page, click Template Files tab.
  4. In the Template Files tab page, click Upload to upload a template.
  5. Click Close.

    Upload template

To download load balancing virtual server entity template by using NetScaler GUI

  1. Navigate to Traffic Management > Load Balancing > Virtual Servers.
  2. In the Virtual Servers page, click Select Action and then select Manage Template.
  3. In the Load Balancing Templates page, click Template Files tab.
  4. In the Template Files tab page, select a template file and click Download.
  5. Click Close.

    Download template

Example of load balancing virtual server template and deployment template

Following is an example of a template file that was created from a load balancing virtual server called “Lbvip”:

COPY

<?xml version="1.0" encoding="UTF-8" ?>
  <template>
    <template_info>
      <entity_name>Lbvip</entity_name>
      <version_major>10</version_major>
      <version_minor>0</version_minor>
      <build_number>40.406</build_number>
    </template_info>
    <entitytemplate>
      <lbvserver_list>
        <lbvserver>
          <name>Lbvip</name>
          <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>
          <sopersistencetimeout>2</sopersistencetimeout>
          <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>
          <appflowlog>DISABLED</appflowlog>
          <icmpvsrresponse>PASSIVE</icmpvsrresponse>
          <lbvserver_cmppolicy_binding_list>
            <lbvserver_cmppolicy_binding>
              <name>Lbvip</name>
              <policyname>NOPOLICY-COMPRESSION</policyname>
              <priority>100</priority>
              <gotopriorityexpression>END</gotopriorityexpression>
              <bindpoint>REQUEST</bindpoint>
            </lbvserver_cmppolicy_binding>
          </lbvserver_cmppolicy_binding_list>
        </lbvserver>
      </lbvserver_list>
    </entitytemplate>
  </template>

Example of a deployment file

Following is the deployment file associated with the virtual server in the preceding example: COPY

<?xml version="1.0" encoding="UTF-8" ?>
  <template_deployment>
    <template_info>
      <entity_name>Lbvip</entity_name>
      <version_major>10</version_major>
      <version_minor>0</version_minor>
      <build_number>40.406</build_number>
    </template_info>
    <service_list>
      <service>
      <ip>1.2.3.4</ip>
      <port>80</port>
      <servicetype>HTTP</servicetype>
      </service>
    </service_list>
    <servicegroup_list>
      <servicegroup>
        <name>svcgrp</name>
        <servicetype>HTTP</servicetype>
        <servicegroup_servicegroupmember_binding_list>
          <servicegroup_servicegroupmember_binding>
            <ip>1.2.3.90</ip>
            <port>80</port>
          </servicegroup_servicegroupmember_binding>
        <servicegroup_servicegroupmember_binding>
          <ip>1.2.8.0</ip>
          <port>80</port>
        </servicegroup_servicegroupmember_binding>
        <servicegroup_servicegroupmember_binding>
          <ip>1.2.8.1</ip>
          <port>80</port>
        </servicegroup_servicegroupmember_binding>
        <servicegroup_servicegroupmember_binding>
          <ip>1.2.9.0</ip>
          <port>80</port>
        </servicegroup_servicegroupmember_binding>
      </servicegroup_servicegroupmember_binding_list>
    </servicegroup>
  </servicegroup_list>
</template_deployment>

Entity template for load balancing virtual server