@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
try {
_name = (String) params.get("name");
if (_name == null) {
throw new ConfigurationException("Unable to find name in the configuration parameters");
}
_zoneId = (String) params.get("zoneId");
if (_zoneId == null) {
throw new ConfigurationException("Unable to find zone Id in the configuration parameters");
}
_physicalNetworkId = (String) params.get("physicalNetworkId");
if (_physicalNetworkId == null) {
throw new ConfigurationException("Unable to find physical network id in the configuration parameters");
}
_ip = (String) params.get("ip");
if (_ip == null) {
throw new ConfigurationException("Unable to find IP address in the configuration parameters");
}
_username = (String) params.get("username");
if (_username == null) {
throw new ConfigurationException("Unable to find username in the configuration parameters");
}
_password = (String) params.get("password");
if (_password == null) {
throw new ConfigurationException("Unable to find password in the configuration parameters");
}
_publicInterface = (String) params.get("publicinterface");
if (_publicInterface == null) {
throw new ConfigurationException("Unable to find public interface in the configuration parameters");
}
_privateInterface = (String) params.get("privateinterface");
if (_privateInterface == null) {
throw new ConfigurationException("Unable to find private interface in the configuration parameters");
}
_numRetries = NumbersUtil.parseInt((String) params.get("numretries"), 2);
_guid = (String)params.get("guid");
if (_guid == null) {
throw new ConfigurationException("Unable to find the guid in the configuration parameters");
}
_deviceName = (String) params.get("deviceName");
if (_deviceName == null) {
throw new ConfigurationException("Unable to find the device name in the configuration parameters");
}
_isSdx = _deviceName.equalsIgnoreCase("NetscalerSDXLoadBalancer");
_inline = Boolean.parseBoolean((String) params.get("inline"));
if (((String) params.get("cloudmanaged")) != null) {
_cloudManaged = Boolean.parseBoolean((String) params.get("cloudmanaged"));
}
// validate device configuration parameters
login();
validateDeviceType(_deviceName);
validateInterfaces(_publicInterface, _privateInterface);
//enable load balancing feature
enableLoadBalancingFeature();
//if the the device is cloud stack provisioned then make it part of the public network
if (_cloudManaged) {
_publicIP = (String) params.get("publicip");
_publicIPGateway = (String) params.get("publicipgateway");
_publicIPNetmask = (String) params.get("publicipnetmask");
_publicIPVlan = (String) params.get("publicipvlan");
if ("untagged".equalsIgnoreCase(_publicIPVlan)) {
// if public network is un-tagged just add subnet IP
addSubnetIP(_publicIP, _publicIPNetmask);
} else {
// if public network is tagged then add vlan and bind subnet IP to the vlan
addGuestVlanAndSubnet(Long.parseLong(_publicIPVlan), _publicIP, _publicIPNetmask, false);
}
}
return true;
} catch (Exception e) {
throw new ConfigurationException(e.getMessage());
}
}