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));
}
}
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");
}
}
}
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");
}
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;
}
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;
}
Aggregations