use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class DCNMDialog method addZonesStrategy.
/**
* Given a dialog, add one or more zones to the active zoneset of the specified vsan.
* This method is callable from with Bourne or from MDSDialogTest for stand-alone testing.
* For now the only type of zone members supported are pwwn.
*
* @param zones - List of zones to be created. Zone names will be overwritten.
* @param vsanId - Integer vsanId
* @return list of zone names that were added
* @throws ControllerException
*/
public List<String> addZonesStrategy(List<Zone> zones, Integer vsanId) throws Exception {
List<String> addedZoneNames = new ArrayList<String>();
boolean inSession = false;
boolean commit = true;
CIMObjectPath zonesetServicePath = getZoneService(vsanId.toString());
if (zonesetServicePath == null) {
throw new DeviceControllerException("Couldn't locate ZoneSetService vsan: " + vsanId);
}
CIMInstance zonesetService = _client.getInstance(zonesetServicePath, false, false, null);
try {
// Start a session.
inSession = startSession(_client, zonesetService);
// Get the existing zones in the active zoneset.
// XXX FIXME: Need to account for creating the zoneset if none exists.
List<Zoneset> zonesets = getZonesets(vsanId);
if (zonesets == null || zonesets.isEmpty()) {
throw new DeviceControllerException("no zonesets");
}
Zoneset activeZoneset = zonesets.get(0);
if (activeZoneset.getActive() != true) {
throw new DeviceControllerException("no active zoneset");
}
for (Zone zone : zones) {
CIMObjectPath zonePath = addZone(_client, zonesetService, ((CIMObjectPath) activeZoneset.getCimObjectPath()), zone.getName());
}
} finally {
// Commit session.
if (inSession) {
endSession(_client, zonesetService, commit);
}
}
return addedZoneNames;
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class DCNMDialog method getFabricInstance.
public CIMInstance getFabricInstance(String fabricId) throws WBEMException {
CIMObjectPath path = CimObjectPathCreator.createInstance(_fabric_path, _namespace);
CloseableIterator<CIMInstance> fabricIter = null;
try {
fabricIter = _client.enumerateInstances(path, false, true, true, null);
while (fabricIter.hasNext()) {
CIMInstance fabricIns = fabricIter.next();
if (fabricId.equals(cimStringProperty(fabricIns, "ElementName"))) {
return fabricIns;
}
}
} finally {
if (fabricIter != null) {
fabricIter.close();
}
}
return null;
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class SmisDiscoveryArgsCreator method generateDeviceMaskingGroupObjectPath.
/**
* Generate DeviceMasking Group CIMObject Path
*
* @param serialID
* @param bourneCreatedDeviceGroup
* @param keyMap
* @return
*/
private CIMObjectPath generateDeviceMaskingGroupObjectPath(String serialID, String bourneCreatedDeviceGroup, final Map<String, Object> keyMap) {
@SuppressWarnings("unchecked") CIMProperty<?> instanceID = new CIMProperty(Constants.INSTANCEID, CIMDataType.STRING_T, Constants.SYMMETRIX_U + Constants.PLUS + serialID + Constants.PLUS + bourneCreatedDeviceGroup, true, false, null);
CIMProperty<?>[] keys = new CIMProperty<?>[1];
keys[0] = instanceID;
CIMObjectPath deviceGroupPath = CimObjectPathCreator.createInstance(Constants.SE_DEVICEMASKINGGROUP, keyMap.get(Constants._InteropNamespace).toString(), keys);
return deviceGroupPath;
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class SmisDiscoveryArgsCreator method getFASTPolicyAssociatedWithDeviceGroup.
/**
* get FAST policy Object path associated with DeviceGroup
*
* @param argument
* @param keyMap
* @param index
* @return
*/
private final CIMObjectPath getFASTPolicyAssociatedWithDeviceGroup(final Argument argument, final Map<String, Object> keyMap, int index) {
@SuppressWarnings("unchecked") List<CIMObjectPath> deviceGroups = (List<CIMObjectPath>) keyMap.get(argument.getValue());
CIMObjectPath deviceGroupPath = deviceGroups.get(index);
String deviceGroupName = deviceGroupPath.getKey(Constants.INSTANCEID).getValue().toString();
_logger.debug("Device Group Name associated policy :" + deviceGroupName);
CIMObjectPath fastPolicyPath = (CIMObjectPath) keyMap.get(deviceGroupName);
return fastPolicyPath;
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class AllocatedFromStoragePoolProcessor method processInstances.
/**
* {@inheritDoc}
*/
@Override
protected int processInstances(Iterator<CIMInstance> instances, WBEMClient client) {
int count = 0;
while (instances.hasNext()) {
try {
count++;
CIMInstance instance = instances.next();
CIMObjectPath volPath = (CIMObjectPath) instance.getObjectPath().getKeyValue(DEPENDENT);
if (_symmvolume.equals(volPath.getObjectName())) {
String spaceConsumed = getCIMPropertyValue(instance, SPACE_CONSUMED);
_volumeToSpaceConsumedMap.put(volPath.toString(), spaceConsumed);
}
} catch (Exception e) {
_logger.error("Exception on processing instances", e);
}
}
return count;
}
Aggregations