Search in sources :

Example 1 with StorageDriverRestRep

use of com.emc.storageos.model.storagedriver.StorageDriverRestRep in project coprhd-controller by CoprHD.

the class StorageDriverService method setDriverIntoMap.

private void setDriverIntoMap(String driverName, StorageSystemType type, Map<String, StorageDriverRestRep> driverMap) {
    if (driverMap.containsKey(driverName)) {
        StorageDriverRestRep driverRestRep = driverMap.get(driverName);
        driverRestRep.getSupportedTypes().add(type.getStorageTypeDispName());
        if (!(IN_USE.equals(driverRestRep.getDriverStatus()) && READY.equals(type.getDriverStatus()))) {
            driverRestRep.setDriverStatus(type.getDriverStatus());
        }
    } else {
        driverMap.put(type.getDriverName(), StorageDriverMapper.map(type));
    }
}
Also used : StorageDriverRestRep(com.emc.storageos.model.storagedriver.StorageDriverRestRep)

Example 2 with StorageDriverRestRep

use of com.emc.storageos.model.storagedriver.StorageDriverRestRep in project coprhd-controller by CoprHD.

the class StorageDriverServiceTest method testGetStorageDrivers.

@Test
public void testGetStorageDrivers() {
    StorageDriverList driverList = service.getStorageDrivers();
    assertEquals(driverList.getDrivers().size(), 2);
    for (StorageDriverRestRep driver : driverList.getDrivers()) {
        if ("driver1".equals(driver.getDriverName())) {
            assertEquals(driver.getSupportedTypes().size(), 2);
            assertTrue(driver.getSupportedTypes().contains("systemtype1"));
            assertTrue(driver.getSupportedTypes().contains("providertype1"));
            assertEquals(driver.getDriverStatus(), "IN_USE");
        }
        if ("driver2".equals(driver.getDriverName())) {
            assertEquals(driver.getSupportedTypes().size(), 1);
            assertTrue(driver.getSupportedTypes().contains("systemtype2"));
            assertEquals(driver.getDriverStatus(), "READY");
        }
    }
}
Also used : StorageDriverList(com.emc.storageos.model.storagedriver.StorageDriverList) StorageDriverRestRep(com.emc.storageos.model.storagedriver.StorageDriverRestRep) Test(org.junit.Test)

Example 3 with StorageDriverRestRep

use of com.emc.storageos.model.storagedriver.StorageDriverRestRep in project coprhd-controller by CoprHD.

the class StorageDriverServiceTest method testGetSingleDriver.

@Test
public void testGetSingleDriver() {
    StorageDriverRestRep driver = service.getSingleStorageDriver("driver1");
    assertEquals(driver.getDriverName(), "driver1");
    assertEquals(driver.getSupportedTypes().size(), 2);
    assertTrue(driver.getSupportedTypes().contains("systemtype1"));
    assertTrue(driver.getSupportedTypes().contains("providertype1"));
    assertEquals(driver.getDriverStatus(), "IN_USE");
}
Also used : StorageDriverRestRep(com.emc.storageos.model.storagedriver.StorageDriverRestRep) Test(org.junit.Test)

Example 4 with StorageDriverRestRep

use of com.emc.storageos.model.storagedriver.StorageDriverRestRep in project coprhd-controller by CoprHD.

the class StorageDriverService method queryStorageDriver.

/**
 * @return driver specified by the name; return all drivers if name is null
 */
private List<StorageDriverRestRep> queryStorageDriver(String name) {
    Set<String> usedProviderTypes = getUsedStorageProviderTypes();
    Set<String> usedSystemTypes = getUsedStorageSystemTypes();
    Map<String, StorageDriverRestRep> driverMap = new HashMap<String, StorageDriverRestRep>();
    List<URI> ids = dbClient.queryByType(StorageSystemType.class, true);
    Iterator<StorageSystemType> it = dbClient.queryIterativeObjects(StorageSystemType.class, ids);
    while (it.hasNext()) {
        StorageSystemType type = it.next();
        String driverName = type.getDriverName();
        if (name != null && !name.equals(driverName)) {
            continue;
        }
        if (type.getIsNative() == null || type.getIsNative()) {
            // bypass native storage types
            continue;
        }
        setTypeDriverStatus(type, usedProviderTypes, usedSystemTypes);
        setDriverIntoMap(driverName, type, driverMap);
    }
    List<StorageDriverRestRep> drivers = new ArrayList<StorageDriverRestRep>();
    drivers.addAll(driverMap.values());
    return drivers;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) StorageSystemType(com.emc.storageos.db.client.model.StorageSystemType) URI(java.net.URI) StorageDriverRestRep(com.emc.storageos.model.storagedriver.StorageDriverRestRep)

Example 5 with StorageDriverRestRep

use of com.emc.storageos.model.storagedriver.StorageDriverRestRep in project coprhd-controller by CoprHD.

the class StorageDriverMapper method map.

public static StorageDriverRestRep map(StorageSystemType type) {
    StorageDriverRestRep rep = new StorageDriverRestRep();
    rep.setDriverName(type.getDriverName());
    rep.setDriverVersion(type.getDriverVersion());
    rep.setDriverFileName(type.getDriverFileName());
    rep.setDriverStatus(type.getDriverStatus());
    rep.setDriverClassName(type.getDriverClassName());
    rep.setMetaType(type.getMetaType());
    List<String> supportedTypes = new ArrayList<String>();
    supportedTypes.add(type.getStorageTypeDispName());
    rep.setSupportedTypes(supportedTypes);
    rep.setDefaultSslOn(type.getIsDefaultSsl());
    rep.setSslPort(type.getSslPort());
    rep.setNonSslPort(type.getNonSslPort());
    rep.setSupportAutoTierPolicy(type.getSupportAutoTierPolicy());
    return rep;
}
Also used : ArrayList(java.util.ArrayList) StorageDriverRestRep(com.emc.storageos.model.storagedriver.StorageDriverRestRep)

Aggregations

StorageDriverRestRep (com.emc.storageos.model.storagedriver.StorageDriverRestRep)7 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)2 StorageSystemType (com.emc.storageos.db.client.model.StorageSystemType)1 StorageDriverList (com.emc.storageos.model.storagedriver.StorageDriverList)1 URI (java.net.URI)1 HashMap (java.util.HashMap)1 StorageDriverInfo (models.datatable.StorageDriverDataTable.StorageDriverInfo)1