2020-08-10 19:22:26 +00:00
|
|
|
package biz.nellemann.hmci
|
|
|
|
|
|
|
|
import spock.lang.Specification
|
|
|
|
|
2020-12-11 07:39:19 +00:00
|
|
|
class ManagedSystemTest extends Specification {
|
2020-08-10 19:22:26 +00:00
|
|
|
|
|
|
|
void "test processPcmJson for ManagedSystem"() {
|
|
|
|
|
|
|
|
setup:
|
|
|
|
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
|
|
|
|
def testJson = testFile.getText('UTF-8')
|
|
|
|
|
|
|
|
when:
|
2021-01-14 12:51:18 +00:00
|
|
|
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
|
2020-08-10 19:22:26 +00:00
|
|
|
system.processMetrics(testJson)
|
|
|
|
|
|
|
|
then:
|
2020-10-11 10:25:55 +00:00
|
|
|
system.metrics.systemUtil.sample.serverUtil.memory.assignedMemToLpars == 40960.000
|
|
|
|
system.metrics.systemUtil.sample.serverUtil.processor.totalProcUnits == 24.000
|
|
|
|
system.metrics.systemUtil.sample.viosUtil.first().name == "VIOS1"
|
|
|
|
system.metrics.systemUtil.sample.viosUtil.first().memory.assignedMem == 8192.0
|
|
|
|
system.metrics.systemUtil.sample.viosUtil.first().storage.genericPhysicalAdapters.first().transmittedBytes == 9966.933
|
|
|
|
system.metrics.systemUtil.sample.viosUtil.first().storage.fiberChannelAdapters.first().numOfPorts == 3
|
2020-08-10 19:22:26 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-12-11 07:39:19 +00:00
|
|
|
|
2020-08-13 09:48:00 +00:00
|
|
|
void "test getMemoryMetrics"() {
|
|
|
|
|
|
|
|
setup:
|
|
|
|
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
|
|
|
|
def testJson = testFile.getText('UTF-8')
|
2021-01-14 12:51:18 +00:00
|
|
|
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
|
2020-08-13 09:48:00 +00:00
|
|
|
|
|
|
|
when:
|
|
|
|
system.processMetrics(testJson)
|
2020-10-09 08:20:50 +00:00
|
|
|
List<Measurement> listOfMeasurements = system.getMemoryMetrics()
|
2020-08-13 09:48:00 +00:00
|
|
|
|
|
|
|
then:
|
2020-10-09 08:20:50 +00:00
|
|
|
listOfMeasurements.size() == 1
|
|
|
|
listOfMeasurements.first().fields['totalMem'] == 1048576.000
|
2020-08-13 09:48:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void "test getProcessorMetrics"() {
|
|
|
|
|
|
|
|
setup:
|
|
|
|
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
|
|
|
|
def testJson = testFile.getText('UTF-8')
|
2021-01-14 12:51:18 +00:00
|
|
|
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
|
2020-08-13 09:48:00 +00:00
|
|
|
|
|
|
|
when:
|
|
|
|
system.processMetrics(testJson)
|
2020-10-09 08:20:50 +00:00
|
|
|
List<Measurement> listOfMeasurements = system.getProcessorMetrics()
|
2020-08-13 09:48:00 +00:00
|
|
|
|
|
|
|
then:
|
2020-10-09 08:20:50 +00:00
|
|
|
listOfMeasurements.size() == 1
|
|
|
|
listOfMeasurements.first().fields['availableProcUnits'] == 16.000
|
2020-08-13 09:48:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void "test getSystemSharedProcessorPools"() {
|
|
|
|
|
|
|
|
setup:
|
|
|
|
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
|
|
|
|
def testJson = testFile.getText('UTF-8')
|
2021-01-14 12:51:18 +00:00
|
|
|
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
|
2020-08-13 09:48:00 +00:00
|
|
|
|
|
|
|
when:
|
|
|
|
system.processMetrics(testJson)
|
2020-10-09 08:20:50 +00:00
|
|
|
List<Measurement> listOfMeasurements = system.getSharedProcessorPools()
|
2020-08-13 09:48:00 +00:00
|
|
|
|
|
|
|
then:
|
2020-10-09 08:20:50 +00:00
|
|
|
listOfMeasurements.size() == 1
|
|
|
|
listOfMeasurements.first().fields['assignedProcUnits'] == 23.767
|
2020-08-13 09:48:00 +00:00
|
|
|
}
|
|
|
|
|
2020-08-18 11:49:48 +00:00
|
|
|
void "test VIOS data"() {
|
|
|
|
setup:
|
|
|
|
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
|
|
|
|
def testJson = testFile.getText('UTF-8')
|
2021-01-14 12:51:18 +00:00
|
|
|
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
|
2020-08-18 11:49:48 +00:00
|
|
|
|
|
|
|
when:
|
|
|
|
system.processMetrics(testJson)
|
2020-10-09 08:20:50 +00:00
|
|
|
List<Measurement> listOfMeasurements = system.getSharedProcessorPools()
|
2020-08-18 11:49:48 +00:00
|
|
|
|
|
|
|
then:
|
2020-10-09 08:20:50 +00:00
|
|
|
listOfMeasurements.size() == 1
|
|
|
|
listOfMeasurements.first().fields['assignedProcUnits'] == 23.767
|
2020-08-18 11:49:48 +00:00
|
|
|
}
|
|
|
|
|
2020-12-16 11:36:08 +00:00
|
|
|
void "test getViosMemoryMetrics"() {
|
|
|
|
|
|
|
|
setup:
|
|
|
|
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
|
|
|
|
def testJson = testFile.getText('UTF-8')
|
2021-01-14 12:51:18 +00:00
|
|
|
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
|
2020-12-16 11:36:08 +00:00
|
|
|
|
|
|
|
when:
|
|
|
|
system.processMetrics(testJson)
|
|
|
|
List<Measurement> listOfMeasurements = system.getViosMemoryMetrics()
|
|
|
|
|
|
|
|
then:
|
|
|
|
listOfMeasurements.size() == 2
|
|
|
|
listOfMeasurements.first().fields['assignedMem'] == 8192.000
|
|
|
|
listOfMeasurements.first().fields['utilizedMem'] == 2093.000
|
2020-12-21 10:41:48 +00:00
|
|
|
listOfMeasurements.first().fields['utilizedMemPct'] == 25.000
|
2020-12-16 11:36:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void "test getViosProcessorMetrics"() {
|
|
|
|
|
|
|
|
setup:
|
|
|
|
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
|
|
|
|
def testJson = testFile.getText('UTF-8')
|
2021-01-14 12:51:18 +00:00
|
|
|
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
|
2020-12-16 11:36:08 +00:00
|
|
|
|
|
|
|
when:
|
|
|
|
system.processMetrics(testJson)
|
|
|
|
List<Measurement> listOfMeasurements = system.getViosProcessorMetrics()
|
|
|
|
|
|
|
|
then:
|
|
|
|
listOfMeasurements.size() == 2
|
|
|
|
listOfMeasurements.first().fields['entitledProcUnits'] == 1.0
|
|
|
|
listOfMeasurements.first().fields['utilizedCappedProcUnits'] == 0.12
|
|
|
|
}
|
|
|
|
|
2020-08-10 19:22:26 +00:00
|
|
|
}
|