use of com.emc.storageos.volumecontroller.impl.plugins.metering.vplex.VPlexPerpetualCSVFileCollector in project coprhd-controller by CoprHD.
the class VPlexMeteringTest method testVPlexPerpetualCSVFileCollector.
@Test
public void testVPlexPerpetualCSVFileCollector() throws InstantiationException, IllegalAccessException {
MockDbClient mockDbClient = new MockDbClient();
mockStorageDriverManager();
StorageSystem storageSystem = mockStorageSystem("vplex-1", "000123ABC000XYZ");
mockDbClient.MOCK_DB.put(storageSystem.getId(), storageSystem);
int directorIndex = 1;
String[] directors = DIRECTORS.split(",");
for (String directorName : directors) {
int adapterIndex = (directorIndex % 2);
String aOrB = directorName.substring(directorName.length() - 1);
String adapterSerial = String.format("CF23K00000%d%d", directorIndex, adapterIndex);
StorageHADomain director = mockVPlexAdapter(storageSystem, directorName, adapterSerial);
mockDbClient.MOCK_DB.put(director.getId(), director);
for (int cpuIndex = 0; cpuIndex < 2; cpuIndex++) {
for (int portIndex = 0; portIndex < PORT_PER_DIRECTOR; portIndex++) {
String portName = String.format("%s%d-FC%02d", aOrB, cpuIndex, portIndex);
String wwn = String.format("5C:CC:DD:EE:FF:00:%02d:%02d", directorIndex, portIndex);
StoragePort port = mockStoragePort(director, portName, wwn, adapterSerial);
mockDbClient.MOCK_DB.put(port.getId(), port);
}
}
directorIndex++;
}
AccessProfile accessProfile = new AccessProfile();
accessProfile.setIpAddress(HOST);
accessProfile.setUserName(USERNAME);
accessProfile.setPassword(PASSWORD);
accessProfile.setSystemId(storageSystem.getId());
Map<String, Object> context = new HashMap<>();
context.put(Constants.dbClient, mockDbClient);
context.put(Constants._Stats, new LinkedList<Stat>());
context.put(Constants._TimeCollected, System.currentTimeMillis());
VPlexPerpetualCSVFileCollector collector = new VPlexPerpetualCSVFileCollector();
PortMetricsProcessor portMetricsProcessor = mockPortMetricsProcessor(mockDbClient);
collector.setPortMetricsProcessor(portMetricsProcessor);
collector.collect(accessProfile, context);
}
Aggregations