use of com.emc.storageos.volumecontroller.impl.plugins.metering.vplex.ReadAndParseVPlexPerpetualCSVFile in project coprhd-controller by CoprHD.
the class VPlexMeteringTest method testReadingDataFiles.
@Test
public void testReadingDataFiles() {
LinuxSystemCLI cli = new LinuxSystemCLI(HOST, USERNAME, PASSWORD);
ListVPlexPerpetualCSVFileNames listDataFileNamesCmd = new ListVPlexPerpetualCSVFileNames();
cli.executeCommand(listDataFileNamesCmd);
List<String> filenames = listDataFileNamesCmd.getResults();
Assert.assertFalse("Expected to find file names", filenames.isEmpty());
for (String filename : filenames) {
ReadAndParseVPlexPerpetualCSVFile readDataFile = new ReadAndParseVPlexPerpetualCSVFile(filename);
cli.executeCommand(readDataFile);
VPlexPerpetualCSVFileData fileData = readDataFile.getResults();
Assert.assertNotNull("Expect file data to be non-null", fileData);
out("For file {} these are the headers:\n{}", filename, Joiner.on('\n').join(fileData.getHeaders()));
List<Map<String, String>> dataLines = fileData.getDataLines();
Assert.assertTrue("Expect file data to have data values", !dataLines.isEmpty());
out("For file {} there are {} data lines", filename, dataLines.size());
fileData.close();
}
}
use of com.emc.storageos.volumecontroller.impl.plugins.metering.vplex.ReadAndParseVPlexPerpetualCSVFile in project coprhd-controller by CoprHD.
the class VPlexMeteringTest method testReadAndParseMetrics.
@Test
public void testReadAndParseMetrics() {
LinuxSystemCLI cli = new LinuxSystemCLI(HOST, USERNAME, PASSWORD);
ListVPlexPerpetualCSVFileNames listDataFileNamesCmd = new ListVPlexPerpetualCSVFileNames();
cli.executeCommand(listDataFileNamesCmd);
List<String> fileNames = listDataFileNamesCmd.getResults();
for (String fileName : fileNames) {
ReadAndParseVPlexPerpetualCSVFile readDataFile = new ReadAndParseVPlexPerpetualCSVFile(fileName);
cli.executeCommand(readDataFile);
VPlexPerpetualCSVFileData fileData = readDataFile.getResults();
// Read each data line from the file
int processedLines = 0;
int headerCount = fileData.getHeaders().size();
for (Map<String, String> dataLine : fileData.getDataLines()) {
// Extract the metrics and their values, translate them into ViPR statistics
Set<String> keys = dataLine.keySet();
Assert.assertTrue("Expected number of data keys to match headers", headerCount == keys.size());
for (String metricName : keys) {
String value = dataLine.get(metricName);
// If the value is not "no data" for the value, then parse it...
if (!VPlexPerpetualCSVFileData.NO_DATA.equals(value)) {
readAndParseMetrics(metricName, value);
}
}
processedLines++;
alreadyPrinted = true;
}
Assert.assertTrue("Data lines processed does not match total expected", fileData.getTotalLines() == (processedLines + 1));
// Clean up fileData resources
fileData.close();
}
}
Aggregations