use of javax.cim.UnsignedInteger32 in project coprhd-controller by CoprHD.
the class BrocadeNetworkSMIS method addZone.
@SuppressWarnings("rawtypes")
public CIMObjectPath addZone(WBEMClient client, CIMInstance zoneServiceIns, CIMObjectPath zonesetPath, String zoneName, String fabricId, String fabricWwn) throws WBEMException {
CIMObjectPath zonePath = null;
CIMArgument[] outargs = new CIMArgument[1];
CIMArgument[] inargs = new CIMArgument[3];
inargs[0] = _cimArgumentFactory.string(_ZoneName, zoneName);
inargs[1] = _cimArgumentFactory.uint16(_ZoneType, 2);
inargs[2] = _cimArgumentFactory.uint16(_ZoneSubType, 1);
_log.info("Creating zone: " + zoneName);
UnsignedInteger32 result = new UnsignedInteger32(Integer.MAX_VALUE);
int count = 0;
while (result.intValue() != 0 && count < 2) {
result = (UnsignedInteger32) client.invokeMethod(zoneServiceIns.getObjectPath(), _CreateZone, inargs, outargs);
if (result.intValue() == 0 && outargs[0].getValue() != null) {
zonePath = (CIMObjectPath) outargs[0].getValue();
_log.info("Created zone: " + zoneName + " with path " + zonePath);
break;
} else if (result.intValue() == 32770) {
_log.info("Created zone: " + zoneName + " failed with result.intvalue() 32770: " + "Transaction Not Started. Retry to get a new session lock.");
endSession(client, zoneServiceIns, false);
zoneServiceIns = startSession(client, fabricId, fabricWwn);
count++;
} else {
_log.info("Created zone failed: " + zoneName + " with result.intValue() " + result.intValue());
break;
}
}
if (zonePath == null) {
if (count >= 2) {
_log.info("Failed to create zone " + zoneName + ". The maximum number of retries (" + (count + 1) + ") was reached without successfully starting a transaction.");
}
} else {
// add zone to zoneset
outargs = new CIMArgument[1];
inargs = new CIMArgument[2];
inargs[0] = _cimArgumentFactory.reference(_ZoneSet, zonesetPath);
inargs[1] = _cimArgumentFactory.reference(_Zone, zonePath);
_log.info("Adding zone: " + zoneName + " to zoneset " + zonesetPath);
result = (UnsignedInteger32) client.invokeMethod(zoneServiceIns.getObjectPath(), "AddZone", inargs, outargs);
if (result.intValue() != 0) {
_log.info("Failed to add zone: " + zoneName + " to zoneset " + zonesetPath);
_log.info("result.intValue(): " + result.intValue());
zonePath = null;
}
}
return zonePath;
}
use of javax.cim.UnsignedInteger32 in project coprhd-controller by CoprHD.
the class DCNMDialog method endSession.
/**
* End a session, commit if commit == true
*
* @param client
* @param zonesetService
* @param commit
* @return true iff worked
* @throws WBEMException
*/
@SuppressWarnings("rawtypes")
public boolean endSession(WBEMClient client, CIMInstance zonesetService, boolean commit) throws WBEMException {
UnsignedInteger32 result = null;
try {
int sessionState = cimIntegerProperty(zonesetService, "SessionState");
if (sessionState == _notApplicable) {
// no session control implemented by this agent
return true;
}
// if (sessionState != _started) {
// // no session control implemented by this agent
// return true;
// }
int endMode = commit ? _ended : _terminated;
CIMArgument[] inargs = new CIMArgument[] { _cimArgumentFactory.uint16("RequestedSessionState", endMode) };
result = (UnsignedInteger32) client.invokeMethod(zonesetService.getObjectPath(), "SessionControl", inargs, new CIMArgument[1]);
_log.info("End session returned code: " + result.intValue());
return result.intValue() == 0;
} catch (WBEMException ex) {
_log.error("Encountered an exception while trying to start a zone session." + ex.getLocalizedMessage());
throw ex;
}
}
use of javax.cim.UnsignedInteger32 in project coprhd-controller by CoprHD.
the class DCNMDialog method addZoneMember.
@SuppressWarnings("rawtypes")
public CIMObjectPath addZoneMember(WBEMClient client, CIMInstance zonesetServiceIns, CIMObjectPath zonePath, String wwn) throws WBEMException {
CIMObjectPath zoneMemberPath = null;
CIMArgument[] outargs = new CIMArgument[1];
CIMArgument[] inargs = new CIMArgument[3];
inargs[0] = _cimArgumentFactory.uint16("ConnectivityMemberType", 2);
inargs[1] = _cimArgumentFactory.string("ConnectivityMemberID", wwn);
inargs[2] = _cimArgumentFactory.reference("SystemSpecificCollection", zonePath);
UnsignedInteger32 result = (UnsignedInteger32) client.invokeMethod(zonesetServiceIns.getObjectPath(), "CreateZoneMembershipSettingData", inargs, outargs);
if (result.intValue() == 0 && outargs.length > 0) {
zoneMemberPath = (CIMObjectPath) outargs[0].getValue();
}
return zoneMemberPath;
}
use of javax.cim.UnsignedInteger32 in project coprhd-controller by CoprHD.
the class DCNMDialog method addZone.
@SuppressWarnings("rawtypes")
public CIMObjectPath addZone(WBEMClient client, CIMInstance zonesetServiceIns, CIMObjectPath zonesetPath, String zoneName) throws WBEMException {
CIMObjectPath zonePath = null;
CIMArgument[] outargs = new CIMArgument[1];
CIMArgument[] inargs = new CIMArgument[3];
inargs[0] = _cimArgumentFactory.string("ZoneName", zoneName);
inargs[1] = _cimArgumentFactory.uint16("ZoneType", 2);
// TODO - I am not sure what subtype is yet, I need to find out.
inargs[2] = _cimArgumentFactory.uint16("ZoneSubType", 1);
UnsignedInteger32 result = (UnsignedInteger32) client.invokeMethod(zonesetServiceIns.getObjectPath(), "CreateZone", inargs, outargs);
if (result.intValue() == 0 && outargs.length > 0) {
zonePath = (CIMObjectPath) outargs[0].getValue();
}
if (zonePath != null) {
// add zone to zoneset
outargs = new CIMArgument[1];
inargs = new CIMArgument[2];
inargs[0] = _cimArgumentFactory.reference("ZoneSet", zonesetPath);
inargs[1] = _cimArgumentFactory.reference("Zone", zonePath);
result = (UnsignedInteger32) client.invokeMethod(zonesetServiceIns.getObjectPath(), "AddZone", inargs, outargs);
if (result.intValue() != 0) {
// TODO - I need to add more error handling
zonePath = null;
}
}
return zonePath;
}
Aggregations