use of com.cloud.network.cisco.CiscoVnmcConnectionImpl in project cloudstack by apache.
the class CiscoVnmcResource method configure.
@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");
}
_zoneId = (String) params.get("zoneId");
if (_zoneId == null) {
throw new ConfigurationException("Unable to find zone");
}
_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");
}
_username = (String) params.get("username");
if (_username == null) {
throw new ConfigurationException("Unable to find username");
}
_password = (String) params.get("password");
if (_password == null) {
throw new ConfigurationException("Unable to find password");
}
_guid = (String) params.get("guid");
if (_guid == null) {
throw new ConfigurationException("Unable to find the guid");
}
_numRetries = NumbersUtil.parseInt((String) params.get("numretries"), 1);
NumbersUtil.parseInt((String) params.get("timeout"), 300);
// Open a socket and login
_connection = new CiscoVnmcConnectionImpl(_ip, _username, _password);
if (!refreshVnmcConnection()) {
throw new ConfigurationException("Unable to connect to VNMC, check if ip/username/password is valid.");
}
return true;
} catch (Exception e) {
throw new ConfigurationException(e.getMessage());
}
}
Aggregations