Overview

Cisco Application Networking Manager (ANM) 5.1 and later include application template functionality. The ANM application templates allow you to quickly configure ACE devices with a complex configuration for well known or custom in-house applications. More details …
This section of Cisco Developer Network provides the tools and resources necessary for ANM users to post, download and review ANM User-defined templates.


 

Application Template Contribution

« Back

Template to create multiple vservers and server farms based on list of port

Combination View Flat View Tree View
Threads [ Previous | Next ]
I am trying to create a templae which will create multiple virtual servers and server farms based on a list of ports.
I created the template and it validates ok but errors when I try to generate an application.
The errors are
Line 6, Col 22: The content of element 'serverfarm' is not complete. One of '{probe, rserver}' is expected.

Line 9, Col 22: The content of element 'serverfarm' is not complete. One of '{probe, rserver}' is expected.
 
the full template is listed below. Any got any ideas or can point me to the full syntax for templates.
 
<?xml version="1.0" encoding="UTF-8"?>
<template xmlns:xalan="http://xml.apache.org/xslt" applicationType="Webmethods" version="1.0" xsi:noNamespaceSchemaLocation="file:application_template_v2.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" description="Webmethods Template Multiple ports" showsInGuidedSetup="true">
  <input>
    <group name="service" type="group" displayString="Application Configuration">
      <variable name="name" type="name" displayString="Application Config Name:" perm="ace_vip"/>
      <variable name="vip" type="ipaddresswithprefix" displayString="VIP Address:" perm="ace_vip"/>
      <array name="reals" displayString="IP Addresses of Real Servers" perm="ace_vip">
        <variable name="ipAddr" displayString="" type="ipaddress" perm="ace_vip"/>
      </array>
      <variable name="sticky" type="boolean" displayString="Session Persistence:" perm="ace_vip"/>
      <array name="portList" displayString="List of ports to load balance" perm="ace_vip">
        <variable name="lPort" type="port" displayString="Listener Port:" perm="ace_vip"/>
      </array>
    </group>
    <group name="network" type="group" displayString="Network Configuration">
      <variable name="device" type="device" displayString="Load Balancer (DeviceemoticonirtualContext):" perm="ace_vip"/>
      <variable name="vlans" type="vlans" displayString="Client VLANs:" perm="ace_vip"/>
      <variable name="autoNat" type="boolean" displayString="Enable Source NAT:" perm="ace_vip"/>
    </group>
  </input>
  <config device="{$device}">
    <slb>
      <foreach iterate="{$portList/$lPort}">
        <serverfarm name="{$name}-{$portList/$lPort}" predictor="leastconns">
          <probe name="TCP_Probe" type="tcp"/>
          <foreach iterate="{$reals/$ipAddr}">
            <rserver name="{$reals/$ipAddr}" ipAddr="{$reals/$ipAddr}" port="{$portList/$lPort}"/>
          </foreach>
        </serverfarm>
        <vserver-http name="{$name}-{$portList/$lPort}" vlans="{$vlans}" inService="true" autoNat="{$autoNat}" icmpReply="active">
          <vip address="{$vip}" protocol="any"/>
          <if test="{$sticky}=true">
            <sticky-loadbalance>
              <ip-sticky activeConns="true" replication="true" name="{$name}-{$portList/$lPort}-sticky" addressType="source" netmask="255.255.255.255" serverfarm="{$name}-{$portList/$lPort}"/>
            </sticky-loadbalance>
          </if>
          <else>
            <loadbalance serverfarm="{$name}-{$portList/$lPort}"/>
          </else>
        </vserver-http>
      </foreach>
    </slb>
  </config>
</template>

Chris--

Interesting usecase. Unfortunately it looks like the nested loop is being stripped out during processing (thus the message about the missing tags). In general I would say that what you had written mostly looks right, except for a missing port on the vip, and the fact that it doesn't seem to be working.

That said I think based on the configuration that you presented you could get a usable configuration with the attached xml. This is using your same port query, but creating a single vserver/serverfarm combo with multiple probes checking the different ports. The end behavior should be pretty much what you are looking for. A nice difference with this is that the sticky will by applied consistently between ports, the not so nice thing is that a failure on one port will take an rserver down on all ports.

Hopefully this works for you.

--Jason

<?xml version="1.0" encoding="UTF-8"?>
<template xmlns:xalan="http://xml.apache.org/xslt" applicationType="Webmethods" version="1.0" xsi:noNamespaceSchemaLocation="file:application_template_v2.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" description="Webmethods Template Multiple ports" showsInGuidedSetup="true">
<input>
<group name="service" type="group" displayString="Application Configuration">
<variable name="name" type="name" displayString="Application Config Name:" perm="ace_vip"/>
<variable name="vip" type="ipaddresswithprefix" displayString="VIP Address:" perm="ace_vip"/>
<array name="reals" displayString="IP Addresses of Real Servers" perm="ace_vip">
<variable name="ipAddr" displayString="" type="ipaddress" perm="ace_vip"/>
</array>
<variable name="sticky" type="boolean" displayString="Session Persistence:" perm="ace_vip"/>
<array name="portList" displayString="List of ports to load balance" perm="ace_vip">
<variable name="lPort" type="port" displayString="Listener Port:" perm="ace_vip"/>
</array>
</group>
<group name="network" type="group" displayString="Network Configuration">
<variable name="device" type="device" displayString="Load Balancer (DeviceemoticonirtualContext):" perm="ace_vip"/>
<variable name="vlans" type="vlans" displayString="Client VLANs:" perm="ace_vip"/>
<variable name="autoNat" type="boolean" displayString="Enable Source NAT:" perm="ace_vip"/>
</group>
</input>
<config device="{$device}">
<slb>
<serverfarm name="{$name}" predictor="leastconns">
<foreach iterate="{$portList/$lPort}">
<probe name="{$name}-TCP_Probe-{$portList/$lPort}" type="tcp" port="{$portList/$lPort}"/>
</foreach>
<foreach iterate="{$reals/$ipAddr}">
<rserver name="{$reals/$ipAddr}" ipAddr="{$reals/$ipAddr}"/>
</foreach>
</serverfarm>
<vserver-http name="{$name}" vlans="{$vlans}" inService="true" autoNat="{$autoNat}" icmpReply="active">
<vip address="{$vip}" protocol="any"/>
<if test="{$sticky}=true">
<sticky-loadbalance>
<ip-sticky activeConns="true" replication="true" name="{$name}-sticky" addressType="source" netmask="255.255.255.255" serverfarm="{$name}"/>
</sticky-loadbalance>
</if>
<else>
<loadbalance serverfarm="{$name}"/>
</else>
</vserver-http>
</slb>
</config>
</template>

Thanks for the response. I will give it a try.

My client wants the who rserver to be taken out if a port fails so that is no big deal. With your template it looks like it will listen and load balance all ports but only probe the specified ports is that correct.?
I ended up reworking it so that I reuse the same template for each port. which is a bit of pain when using multiple ports but no real big issue.