Product Documentation

Cluster APIs

Jun 14, 2016

For managing clusters, you can add or remove a cluster instance or an individual node and perform a few other instance or node operations such as viewing instance or node properties. You can also configure the cluster IP address. Other cluster-management tasks include joining a NetScaler appliance to the cluster and configuring a linkset.

Cluster Instance Operations

The com.citrix.netscaler.nitro.resource.config.cluster.clusterinstance class provides APIs to manage a cluster instance.

The following sample code creates a cluster instance with ID 1:

clusterinstance new_cl_inst_obj = new clusterinstance(); 
//Set the properties of the cluster instance locally 
new_cl_inst_obj.set_clid(1); 
new_cl_inst_obj.set_preemption("ENABLED"); 
 
//Upload the cluster instance 
clusterinstance.add(ns_session,new_cl_inst_obj);

Cluster Node Operations

The com.citrix.netscaler.nitro.resource.config.cluster.clusternode class provides APIs to manage cluster nodes.

The following sample code adds a cluster node with NSIP address 10.102.29.60:

clusternode new_cl_node_obj = new clusternode(); 
//Set the properties of the cluster node locally 
new_cl_node_obj.set_nodeid(0); 
new_cl_node_obj.set_ipaddress("10.102.29.60"); 
new_cl_node_obj.set_state("ACTIVE"); 
new_cl_node_obj.set_backplane("0/1/1"); 
 
//Upload the cluster node 
clusternode.add(ns_session,new_cl_node_obj);

Add a Cluster IP Address

The com.citrix.netscaler.nitro.resource.config.ns.nsip class provides the add() API to configure an IP address. To configure the IP address as a cluster IP address, you must specify the type as CLIP.

The following sample code configures a cluster IP address on NetScaler appliance with IP address 10.102.29.60:

nsip new_nsip_obj = new nsip(); 
//Set the properties locally 
new_nsip_obj.set_ipaddress("10.102.29.61"); 
new_nsip_obj.set_netmask("255.255.255.255"); 
new_nsip_obj.set_type("CLIP"); 
 
//Upload the cluster node 
nsip.add(ns_session,new_nsip_obj);

Add a Spotted IP Address

The com.citrix.netscaler.nitro.resource.config.ns.nsip class provides the add() API to configure an IP address. To configure the IP address as spotted, you must specify the ID of the node that must own the IP address. This configuration must be done on the cluster IP address.

The following sample code configures a spotted SNIP address on a node with ID 1:

nsip new_nsip_obj = new nsip(); 
//Set the properties locally 
new_nsip_obj.set_ipaddress("10.102.29.77"); 
new_nsip_obj.set_netmask("255.255.255.0"); 
new_nsip_obj.set_type("SNIP"); 
new_nsip_obj.set_ownernode(1); 
 
//Upload the cluster node 
nsip.add(ns_session,new_nsip_obj);

Join NetScaler Appliance to Cluster

The com.citrix.netscaler.nitro.resource.config.cluster.cluster class provides the join() API to join a NetScaler appliance to the cluster. You must specify the cluster IP address and the nsroot password of the configuration coordinator.

The following sample joins a NetScaler appliance to a cluster:

cluster new_cl_obj = new cluster(); 
//Set the properties of the cluster  locally 
new_cl_obj.set_clip("10.102.29.61"); 
new_cl_obj.set_password("verysecret"); 
 
//Upload the cluster 
cluster.add(ns_session,new_cl_obj);

Linkset Operations

The com.citrix.netscaler.nitro.resource.config.network.linkset class provides the APIs to manage linksets.

To configure a linkset, do the following:

  1. Add a linkset by invoking the add() method of the linkset class.
  2. Bind the interfaces to the linkset using the add() method of the linkset_interface_binding class.

The following sample code creates a linkset LS/1 and bind interfaces 1/1/2 and 2/1/2 to it:

//Create the linkset 
linkset new_linkset_obj = new linkset(); 
new_linkset_obj.set_id("LS/1"); 
linkset.add(ns_session,new_linkset_obj); 
 
//Bind the interfaces to the linkset 
linkset_interface_binding new_linkif_obj = new linkset_interface_binding(); 
new_linkif_obj.set_id("LS/1"); 
new_linkif_obj.set_ifnum("1/1/2 2/1/2"); 
linkset_interface_binding.add(ns_session,new_linkif_obj);