Search in sources :

Example 51 with CIMProperty

use of javax.cim.CIMProperty in project coprhd-controller by CoprHD.

the class CimCompositeIDTest method testCimCompositeID.

/**
 * Tests the CimCompositeID constructor.
 */
@SuppressWarnings("rawtypes")
@Test
public void testCimCompositeID() {
    CIMProperty[] properties = new CIMProperty[] { new CIMProperty<String>(OBJ_PATH_PROP1_NAME, CIMDataType.STRING_T, OBJ_PATH_PROP1_VALUE), new CIMProperty<String>(OBJ_PATH_PROP2_NAME, CIMDataType.STRING_T, OBJ_PATH_PROP2_VALUE), new CIMProperty<String>(OBJ_PATH_PROP3_NAME, CIMDataType.STRING_T, OBJ_PATH_PROP3_VALUE) };
    CIMObjectPath objPath = CimObjectPathCreator.createInstance(OBJ_PATH_NAME, NAME_SPACE, properties);
    CimCompositeID compositeId = new CimCompositeID(objPath);
    Assert.assertEquals(compositeId.toString(), OBJ_PATH_PROP3_VALUE + "/" + OBJ_PATH_PROP1_VALUE);
}
Also used : CIMProperty(javax.cim.CIMProperty) CIMObjectPath(javax.cim.CIMObjectPath) Test(org.junit.Test)

Example 52 with CIMProperty

use of javax.cim.CIMProperty in project coprhd-controller by CoprHD.

the class CimListenerTest method createAlertIndication.

/**
 * Creates a CIMInstance representing an alert indication.
 *
 * @return A CIMInstance representing an alert indication.
 */
@SuppressWarnings("rawtypes")
private CIMInstance createAlertIndication() {
    CIMObjectPath objPath = CimObjectPathCreator.createInstance(ALERT_INDICATION_CLASS_NAME);
    CIMProperty[] properties = new CIMProperty[] { new CIMProperty<String>(ALERTING_MANGED_ELEMENT_KEY, CIMDataType.STRING_T, ALERTING_MANGED_ELEMENT_VALUE) };
    CIMInstance indication = new CIMInstance(objPath, properties);
    return indication;
}
Also used : CIMProperty(javax.cim.CIMProperty) CIMObjectPath(javax.cim.CIMObjectPath) CIMInstance(javax.cim.CIMInstance)

Example 53 with CIMProperty

use of javax.cim.CIMProperty in project coprhd-controller by CoprHD.

the class SmisDiscoveryArgsCreator method getInitialStorageTierMethodologyValue.

/**
 * get Initial Storage Tiering methodology value for given Storage Pool Setting.
 * used while modifying Storage Pool Setting Instance
 *
 * @param argument
 * @param keyMap
 * @param index
 * @return
 */
public Object getInitialStorageTierMethodologyValue(final Argument argument, final Map<String, Object> keyMap, int index) {
    @SuppressWarnings("unchecked") List<CIMInstance> vnxPoolSettingInstances = (List<CIMInstance>) keyMap.get(argument.getValue());
    CIMInstance vnxPoolSettingInstance = vnxPoolSettingInstances.get(index);
    String tierMethod = (String) keyMap.get(vnxPoolSettingInstance.getObjectPath().toString() + Constants.HYPHEN + Constants.TIERMETHODOLOGY);
    _logger.debug("Tier Method got from Mapping :" + tierMethod);
    CIMProperty<?> prop = new CIMProperty<Object>(Constants.INITIAL_STORAGE_TIER_METHODOLOGY, CIMDataType.UINT16_T, new UnsignedInteger16(tierMethod));
    CIMProperty<?> initialStorageTierSelectionProp = new CIMProperty<Object>(Constants.INITIAL_STORAGE_TIERING_SELECTION, CIMDataType.UINT16_T, new UnsignedInteger16(Constants.RELATIVE_PERFORMANCE_ORDER));
    CIMProperty<?>[] propArray = new CIMProperty<?>[] { prop, initialStorageTierSelectionProp };
    return propArray;
}
Also used : CIMProperty(javax.cim.CIMProperty) List(java.util.List) CIMInstance(javax.cim.CIMInstance) UnsignedInteger16(javax.cim.UnsignedInteger16)

Example 54 with CIMProperty

use of javax.cim.CIMProperty in project coprhd-controller by CoprHD.

the class SmisCommandHelper method getSettingsDefineStateFromSource.

/**
 * Get Synchronization aspects associated with the source block object, then
 * constructs SettingsDefineState instances based on the source and aspects.
 *
 * @param storage
 *            StorageSystem that holds the SettingsDefineState instances
 * @param blockObject
 *            BlockObject representing the source of replication
 * @return A List of CIMObjectPaths for SettingsDefineState instances
 * @throws WBEMException
 */
private List<CIMObjectPath> getSettingsDefineStateFromSource(StorageSystem storage, BlockObject blockObject) throws WBEMException {
    List<CIMObjectPath> settingsDefineStatePaths = new ArrayList<>();
    CIMObjectPath blockObjectPath = _cimPath.getBlockObjectPath(storage, blockObject);
    CloseableIterator<CIMInstance> aspectInstancesItr = null;
    try {
        aspectInstancesItr = getAssociatorInstances(storage, blockObjectPath, null, SYMM_SYNCHRONIZATION_ASPECT_FOR_SOURCE, null, null, new String[] { CP_SYNC_TYPE, CP_SYNC_STATE });
        while (aspectInstancesItr.hasNext()) {
            CIMInstance aspectInstance = aspectInstancesItr.next();
            CIMObjectPath aspectPath = aspectInstance.getObjectPath();
            String syncType = CIMPropertyFactory.getPropertyValue(aspectInstance, CP_SYNC_TYPE);
            String syncState = CIMPropertyFactory.getPropertyValue(aspectInstance, CP_SYNC_STATE);
            if (SNAPSHOT_SYNC_TYPE_STR.equals(syncType) && RESTORED_SYNC_STATE_STR.equals(syncState)) {
                CIMProperty[] settingsKeys = { _cimProperty.reference(CP_MANAGED_ELEMENT, blockObjectPath), _cimProperty.reference(CP_SETTING_DATA, aspectPath) };
                settingsDefineStatePaths.add(CimObjectPathCreator.createInstance(SYMM_SETTINGS_DEFINE_STATE_SV_SAFS, ROOT_EMC_NAMESPACE, settingsKeys));
            }
        }
    } finally {
        closeCIMIterator(aspectInstancesItr);
    }
    return settingsDefineStatePaths;
}
Also used : CIMProperty(javax.cim.CIMProperty) CIMObjectPath(javax.cim.CIMObjectPath) ArrayList(java.util.ArrayList) CIMInstance(javax.cim.CIMInstance)

Example 55 with CIMProperty

use of javax.cim.CIMProperty in project coprhd-controller by CoprHD.

the class SmisCommandHelper method getBindVolumeInputArguments.

public CIMArgument[] getBindVolumeInputArguments(StorageSystem storageDevice, StoragePool pool, Volume volume, long thinVolumePreAllocateSize) throws IOException {
    ArrayList<CIMArgument> list = new ArrayList<CIMArgument>();
    try {
        CIMProperty[] inPoolPropKeys = { _cimProperty.string(CP_INSTANCE_ID, _cimPath.getPoolName(storageDevice, pool.getNativeId())) };
        CIMObjectPath inPoolPath = CimObjectPathCreator.createInstance(pool.getPoolClassName(), _cimConnection.getNamespace(storageDevice), inPoolPropKeys);
        list.add(_cimArgument.reference(CP_IN_POOL, inPoolPath));
        CIMObjectPath volumePath = _cimPath.getBlockObjectPath(storageDevice, volume);
        list.add(_cimArgument.reference(CP_THE_ELEMENT, volumePath));
        if (thinVolumePreAllocateSize > 0) {
            list.add(_cimArgument.uint64(CP_SIZE, thinVolumePreAllocateSize));
        }
    } catch (Exception e) {
        throw new IllegalStateException("Problem getting input arguments for volume bind: " + storageDevice.getSerialNumber());
    }
    CIMArgument[] result = {};
    result = list.toArray(result);
    return result;
}
Also used : CIMProperty(javax.cim.CIMProperty) ArrayList(java.util.ArrayList) CIMObjectPath(javax.cim.CIMObjectPath) IOException(java.io.IOException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) ServiceCodeException(com.emc.storageos.svcs.errorhandling.resources.ServiceCodeException) CIMArgument(javax.cim.CIMArgument)

Aggregations

CIMProperty (javax.cim.CIMProperty)74 CIMObjectPath (javax.cim.CIMObjectPath)57 CIMInstance (javax.cim.CIMInstance)37 ArrayList (java.util.ArrayList)26 WBEMException (javax.wbem.WBEMException)25 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)18 CIMArgument (javax.cim.CIMArgument)16 WBEMClient (javax.wbem.client.WBEMClient)14 IOException (java.io.IOException)11 Volume (com.emc.storageos.db.client.model.Volume)10 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)10 URI (java.net.URI)9 ServiceCodeException (com.emc.storageos.svcs.errorhandling.resources.ServiceCodeException)8 UnsignedInteger16 (javax.cim.UnsignedInteger16)8 DbClient (com.emc.storageos.db.client.DbClient)7 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)7 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)6 HashMap (java.util.HashMap)6 ExportMask (com.emc.storageos.db.client.model.ExportMask)5 Initiator (com.emc.storageos.db.client.model.Initiator)5