© 1999-2017 Citrix Systems, Inc. All rights reserved. p.222https://docs.citrix.com
ns newns = new ns();
//Set the properties of the NetScaler locally
newns.set_name("ns_instance");
newns.set_ip_address("10.70.136.5");
newns.set_netmask("255.255.255.0");
newns.set_gateway("10.70.136.1");
newns.set_image_name("nsvpx-9.3.45_nc.xva");
newns.set_profile_name("ns_nsroot_profile");
newns.set_vm_memory_total(new Double(2048));
newns.set_throughput(new Double(1000));
newns.set_pps(new Double(1000000));
newns.set_license("Standard");
newns.set_username("admin");
newns.set_password("admin");
int number_of_interfaces = 2;
network_interface[] interface_array = new network_interface[number_of_interfaces];
//Adding 10/1
interface_array[0] = new network_interface();
interface_array[0].set_port_name("10/1");
//Adding 10/2
interface_array[1] = new network_interface();
interface_array[1].set_port_name("10/2");
newns.set_network_interfaces(interface_array);
//Upload the NetScaler instance
ns result = ns.add(nitroservice, newns);
Retrieving Resource Details
To retrieve the properties of a resource on the NetScaler SDX appliance, do the following:
1. Retrieve the configurations from the appliance by using the get() method. The result is a resource object.
2. Extract the required property from the object by using the corresponding property name.
The following sample code retrieves the details of all NetScaler resources:
//Retrieve the resource object from the NetScaler SDX appliance
ns[] returned_ns = ns.get(nitroservice);
//Extract the properties of the resource from the object
System.out.println(returned_ns[i].get_ip_address());
System.out.println(returned_ns[i].get_netmask());
Retrieving Resource Statistics
A NetScaler SDX appliance collects statistics on the usage of its features. You can retrieve these statistics using NITRO.