Search in sources :

Example 1 with UnsignedInteger64

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

the class SmisCommandHelper method getCreateVolumesInputArgumentsasList80.

public List<CIMArgument> getCreateVolumesInputArgumentsasList80(StorageSystem storageDevice, StoragePool pool, List<String> labels, Long capacity, int count, boolean isThinlyProvisioned) {
    ArrayList<CIMArgument> list = new ArrayList<>();
    try {
        CIMProperty[] inPoolPropKeys = { _cimProperty.string(CP_INSTANCE_ID, _cimPath.getPoolName(storageDevice, pool.getNativeId())) };
        CIMObjectPath inPoolPath = CimObjectPathCreator.createInstance(pool.getPoolClassName(), _cimConnection.getNamespace(storageDevice), inPoolPropKeys);
        // Use thick/thin volume type
        Integer volumeType = isThinlyProvisioned ? STORAGE_VOLUME_TYPE_THIN : STORAGE_VOLUME_VALUE;
        // Create array values
        // Adding Goal parameter if volumes need to be FAST Enabled
        list.add(_cimArgument.referenceArray(CP_IN_POOL, toMultiElementArray(count, inPoolPath)));
        list.add(_cimArgument.uint64Array(CP_SIZE, toMultiElementArray(count, new UnsignedInteger64(Long.toString(capacity)))));
        list.add(_cimArgument.uint32Array(CP_EMC_NUMBER_OF_DEVICE_FOR_EACH_CONFIG, toMultiElementArray(count, SINGLE_DEVICE_FOR_EACH_CONFIG)));
        if (labels != null) {
            // Convert labels to array
            String[] labelsArray = labels.toArray(new String[] {});
            list.add(_cimArgument.stringArray(CP_ELEMENT_NAMES, labelsArray));
        }
        // Add CIMArgument instances to the list
        if (!storageDevice.checkIfVmax3()) {
            list.add(_cimArgument.uint16Array(CP_ELEMENT_TYPE, toMultiElementArray(count, new UnsignedInteger16(volumeType))));
        }
    } catch (Exception e) {
        throw new IllegalStateException("Problem getting input arguments: " + storageDevice.getSerialNumber());
    }
    return list;
}
Also used : UnsignedInteger64(javax.cim.UnsignedInteger64) ArrayList(java.util.ArrayList) CIMObjectPath(javax.cim.CIMObjectPath) UnsignedInteger16(javax.cim.UnsignedInteger16) 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) CIMProperty(javax.cim.CIMProperty) CIMArgument(javax.cim.CIMArgument)

Example 2 with UnsignedInteger64

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

the class CommunicationInterfaceTest method testArrayWeight.

@Test
public void testArrayWeight() {
    // long s = UnsignedLongs.parseUnsignedLong("18446744073709551104");
    String s = "18446744073709551104";
    String s1 = s.substring(0, s.length() - 6);
    long l = Long.parseLong(s1);
    BigInteger t = new BigInteger("-1");
    UnsignedInteger64 ui = new UnsignedInteger64("18446744073709551104");
    String providerIPAddress = EnvConfig.get(UNIT_TEST_CONFIG_FILE, "smis.host.ipaddress");
    String providerNamespace = EnvConfig.get(UNIT_TEST_CONFIG_FILE, "smis.namespace");
    String providerPortNumber = EnvConfig.get(UNIT_TEST_CONFIG_FILE, "smis.host.port");
    String providerUser = EnvConfig.get(UNIT_TEST_CONFIG_FILE, "smis.host.username");
    String providerPwd = EnvConfig.get(UNIT_TEST_CONFIG_FILE, "smis.host.password");
    String providerUseSSL = EnvConfig.get(UNIT_TEST_CONFIG_FILE, "smis.usessl");
    String providerSystemSerialId = EnvConfig.get(UNIT_TEST_CONFIG_FILE, "smis.host.array.serial");
    BigInteger l1 = ui.bigIntegerValue();
    _logger.info("Test Started");
    WBEMClientCIMXML _wbemClient = null;
    try {
        final NamespaceList _nsList = (NamespaceList) _context.getBean("namespaces");
        _wbemClient = (WBEMClientCIMXML) _context.getBean("cimClient");
        AccessProfile _profile = new AccessProfile();
        _profile.setInteropNamespace(providerNamespace);
        _profile.setIpAddress(providerIPAddress);
        _profile.setPassword(providerPwd);
        _profile.setProviderPort(providerPortNumber);
        _profile.setnamespace("Performance");
        _profile.setelementType("Array");
        _profile.setUserName(providerUser);
        // need to set Array serial ID;
        _profile.setSslEnable(providerUseSSL);
        _profile.setserialID(providerSystemSerialId);
        getCIMClient(_profile, _wbemClient);
        Map<String, Object> _keyMap = new ConcurrentHashMap<String, Object>();
        _keyMap.put(Constants._computerSystem, new ArrayList<CIMObjectPath>());
        _keyMap.put(Constants.REGISTEREDPROFILE, CimObjectPathCreator.createInstance(Constants.PROFILECLASS, "interop"));
        _keyMap.put(Constants._cimClient, new WBEMClientCIMXML());
        _keyMap.put(Constants.ACCESSPROFILE, _profile);
        _profile.setSystemId(new URI("tag"));
        _profile.setSystemClazz(StorageSystem.class);
        _keyMap.put(Constants._serialID, _profile.getserialID());
        _keyMap.put(Constants._storagePool, CimObjectPathCreator.createInstance(Constants._cimPool, _profile.getInteropNamespace()));
        _keyMap.put(Constants.STORAGEPOOLS, new LinkedList<CIMObjectPath>());
        _keyMap.put("storageProcessors", new LinkedList<CIMObjectPath>());
        _keyMap.put(Constants._computerSystem, CimObjectPathCreator.createInstance(Constants._cimSystem, _profile.getInteropNamespace()));
        _keyMap.put(Constants._cimClient, _wbemClient);
        _keyMap.put(Constants._serialID, _profile.getserialID());
        // _keyMap.put(Constants.dbClient, _dbClient);
        _keyMap.put(Constants._Volumes, new LinkedList<CIMObjectPath>());
        _keyMap.put(Constants._nativeGUIDs, Sets.newHashSet());
        _keyMap.put(Constants._Stats, new LinkedList<Stat>());
        _keyMap.put(Constants._InteropNamespace, _profile.getInteropNamespace());
        _keyMap.put(Constants._debug, true);
        // _keyMap.put(Constants._cache, _Cache);
        // _keyMap.put(Constants._globalCacheKey, cacheVolumes);
        // _keyMap.put(Constants._cachePools, cachePools);
        // _keyMap.put(Constants._cassandraInsertion, _dbUtil);
        // _keyMap.put(Constants.PROPS, accessProfile.getProps());
        // Add storagePool Object path & LinkedList<CIMObjectPath> to Map
        _keyMap.put(Constants._storagePool, CimObjectPathCreator.createInstance(Constants._cimPool, _profile.getInteropNamespace()));
        _keyMap.put(Constants.STORAGEPOOLS, new LinkedList<CIMObjectPath>());
        Executor _executor = new Executor() {

            @Override
            protected void customizeException(Exception e, Operation operation) throws BaseCollectionException {
            // TODO Auto-generated method stub
            }
        };
        Util _util = new Util();
        CommandGenerator _gen = new CommandGenerator();
        _gen.setutil(_util);
        _executor.set_keyMap(_keyMap);
        _executor.set_generator(_gen);
        _executor.set_util(_util);
        _executor.execute((Namespace) _nsList.getNsList().get("metering"));
    } catch (Exception e) {
        _logger.error(e.getMessage(), e);
    } finally {
        _wbemClient.close();
    }
}
Also used : UnsignedInteger64(javax.cim.UnsignedInteger64) CIMObjectPath(javax.cim.CIMObjectPath) Util(com.emc.storageos.plugins.common.Util) AccessProfile(com.emc.storageos.plugins.AccessProfile) Operation(com.emc.storageos.plugins.common.domainmodel.Operation) URI(java.net.URI) WBEMException(javax.wbem.WBEMException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) SMIPluginException(com.emc.storageos.plugins.metering.smis.SMIPluginException) NamespaceList(com.emc.storageos.plugins.common.domainmodel.NamespaceList) WBEMClientCIMXML(org.sblim.cimclient.internal.wbem.WBEMClientCIMXML) CommandGenerator(com.emc.storageos.plugins.common.commandgenerator.CommandGenerator) Stat(com.emc.storageos.db.client.model.Stat) Executor(com.emc.storageos.plugins.common.Executor) BigInteger(java.math.BigInteger) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Test(org.junit.Test)

Example 3 with UnsignedInteger64

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

the class SmisCommandHelper method getCreateVolumesBasedOnVolumeGroupInputArguments80.

public CIMArgument[] getCreateVolumesBasedOnVolumeGroupInputArguments80(StorageSystem storage, CIMObjectPath poolPath, CIMObjectPath volumeGroupPath, String label, int count, long capacity) {
    List<CIMArgument> list = new ArrayList<>();
    list.add(_cimArgument.uint16Array(CP_ELEMENT_TYPE, toMultiElementArray(count, new UnsignedInteger16(STORAGE_VOLUME_VALUE))));
    list.add(_cimArgument.uint32Array(CP_EMC_NUMBER_OF_DEVICE_FOR_EACH_CONFIG, toMultiElementArray(count, SINGLE_DEVICE_FOR_EACH_CONFIG)));
    list.add(_cimArgument.uint64Array(CP_SIZE, toMultiElementArray(count, new UnsignedInteger64(Long.toString(capacity)))));
    list.add(_cimArgument.referenceArray(CP_IN_POOL, toMultiElementArray(count, poolPath)));
    if (volumeGroupPath != null) {
        list.add(_cimArgument.referenceArray(CP_EMC_COLLECTIONS, toMultiElementArray(count, volumeGroupPath)));
    }
    if (label != null) {
        list.add(_cimArgument.stringArray(CP_ELEMENT_NAMES, toMultiElementArray(count, label)));
    }
    return list.toArray(new CIMArgument[list.size()]);
}
Also used : UnsignedInteger64(javax.cim.UnsignedInteger64) ArrayList(java.util.ArrayList) UnsignedInteger16(javax.cim.UnsignedInteger16) CIMArgument(javax.cim.CIMArgument)

Aggregations

UnsignedInteger64 (javax.cim.UnsignedInteger64)3 ArrayList (java.util.ArrayList)2 CIMArgument (javax.cim.CIMArgument)2 CIMObjectPath (javax.cim.CIMObjectPath)2 UnsignedInteger16 (javax.cim.UnsignedInteger16)2 WBEMException (javax.wbem.WBEMException)2 Stat (com.emc.storageos.db.client.model.Stat)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 AccessProfile (com.emc.storageos.plugins.AccessProfile)1 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)1 Executor (com.emc.storageos.plugins.common.Executor)1 Util (com.emc.storageos.plugins.common.Util)1 CommandGenerator (com.emc.storageos.plugins.common.commandgenerator.CommandGenerator)1 NamespaceList (com.emc.storageos.plugins.common.domainmodel.NamespaceList)1 Operation (com.emc.storageos.plugins.common.domainmodel.Operation)1 SMIPluginException (com.emc.storageos.plugins.metering.smis.SMIPluginException)1 ServiceCodeException (com.emc.storageos.svcs.errorhandling.resources.ServiceCodeException)1 IOException (java.io.IOException)1 BigInteger (java.math.BigInteger)1