From 05909c7267fa2f5625211ea4fec0ac49d5da0d6e Mon Sep 17 00:00:00 2001 From: Mark Nellemann Date: Mon, 10 Aug 2020 21:22:26 +0200 Subject: [PATCH] Refactored HmcClient to be stateless in regards to systems and partitions. --- src/main/groovy/biz/nellemann/hmci/App.groovy | 150 +++- .../biz/nellemann/hmci/HmcClient.groovy | 167 ++-- .../nellemann/hmci/LogicalPartition.groovy | 12 +- .../biz/nellemann/hmci/ManagedSystem.groovy | 18 +- .../biz/nellemann/hmci/HmcClientTest.groovy | 69 +- .../hmci/LogicalPartitionTest.groovy | 25 + .../nellemann/hmci/ManagedSystemTest.groovy | 27 + src/test/resources/logical-partition-pcm.json | 443 +++++----- .../resources/pcm-data-logical-partition.json | 274 ++++++ .../resources/pcm-data-managed-system.json | 805 ++++++++++++++++++ src/test/resources/pcm-partition.xml | 19 + 11 files changed, 1587 insertions(+), 422 deletions(-) create mode 100644 src/test/groovy/biz/nellemann/hmci/LogicalPartitionTest.groovy create mode 100644 src/test/groovy/biz/nellemann/hmci/ManagedSystemTest.groovy create mode 100644 src/test/resources/pcm-data-logical-partition.json create mode 100644 src/test/resources/pcm-data-managed-system.json create mode 100644 src/test/resources/pcm-partition.xml diff --git a/src/main/groovy/biz/nellemann/hmci/App.groovy b/src/main/groovy/biz/nellemann/hmci/App.groovy index 228baa9..50101ee 100644 --- a/src/main/groovy/biz/nellemann/hmci/App.groovy +++ b/src/main/groovy/biz/nellemann/hmci/App.groovy @@ -8,48 +8,14 @@ import groovy.util.logging.Slf4j @Slf4j class App { + HmcClient hmc + + Map systems = new HashMap() + Map partitions = new HashMap() + + App(String... args) { - println("App()") - - Map systems = new HashMap() - Map partitions = new HashMap() - - - HmcClient hmc - try { - hmc = new HmcClient("https://10.32.64.39:12443", "hmci", "hmcihmci") - hmc.login() - - hmc.getManagedSystems().each { systemKey, system -> - - // Add to list of known systems - systems.putIfAbsent(systemKey, system) - - // Get and process metrics for this system - String json = hmc.getPcmForManagedSystemWithId(system) - system.processPcmJson(json) - - - /*hmc.getLogicalPartitionsForManagedSystem(systemValue).each { lparKey, lpar -> - partitions.putIfAbsent(lparKey, lpar) - //hmc.get - }*/ - - } - - - hmc.logoff() - } catch(Exception e) { - log.error(e.message) - } - - } - - - static void main(String... args) { - - def cli = new CliBuilder() cli.h(longOpt: 'help', 'display usage') cli.v(longOpt: 'version', 'display version') @@ -66,10 +32,110 @@ class App { // TODO: Read configuration file or create new empty file, // pass the properties or configuration bean to App. - new App(args) + println("HMC Insights") + + hmc = new HmcClient("https://10.32.64.39:12443", "hmci", "hmcihmci") + hmc.login() + + scan() + + metricsForSystems() + + metricsForPartitions() + + hmc?.logoff() - System.exit(0); } + void scan() { + + try { + + if(hmc == null) { + hmc = new HmcClient("https://10.32.64.39:12443", "hmci", "hmcihmci") + hmc.login() + } + + hmc.getManagedSystems().each { systemId, system -> + + // Add to list of known systems + systems.putIfAbsent(systemId, system) + + // Get LPAR's for this system + hmc.getLogicalPartitionsForManagedSystemWithId(systemId).each { partitionId, partition -> + + // Add to list of known partitions + partitions.putIfAbsent(partitionId, partition) + } + + } + + } catch(Exception e) { + log.error(e.message) + hmc = null + } + + } + + + void metricsForSystems() { + + try { + + if(hmc == null) { + hmc = new HmcClient("https://10.32.64.39:12443", "hmci", "hmcihmci") + hmc.login() + } + + systems.each {systemId, system -> + + // Get and process metrics for this system + String tmpJsonString = hmc.getPcmDataForManagedSystem(systemId) + if(tmpJsonString && !tmpJsonString.empty) { + system.processMetrics(tmpJsonString) + } + + } + + } catch(Exception e) { + log.error(e.message) + hmc = null + } + + } + + void metricsForPartitions() { + + try { + + if(hmc == null) { + hmc = new HmcClient("https://10.32.64.39:12443", "hmci", "hmcihmci") + hmc.login() + } + + + // Get LPAR's for this system + partitions.each { partitionId, partition -> + + // Get and process metrics for this partition + String tmpJsonString2 = hmc.getPcmDataForLogicalPartition(partition.systemId, partitionId) + if(tmpJsonString2 && !tmpJsonString2.empty) { + partition.processMetrics(tmpJsonString2) + } + + } + + } catch(Exception e) { + log.error(e.message) + hmc = null + } + } + + + static void main(String... args) { + new App(args) + System.exit(0); + } + } \ No newline at end of file diff --git a/src/main/groovy/biz/nellemann/hmci/HmcClient.groovy b/src/main/groovy/biz/nellemann/hmci/HmcClient.groovy index fadc30a..3b20826 100644 --- a/src/main/groovy/biz/nellemann/hmci/HmcClient.groovy +++ b/src/main/groovy/biz/nellemann/hmci/HmcClient.groovy @@ -1,7 +1,5 @@ package biz.nellemann.hmci - -import groovy.json.JsonSlurper import groovy.util.logging.Slf4j import groovy.xml.XmlSlurper import okhttp3.MediaType @@ -39,11 +37,17 @@ class HmcClient { this.username = username this.password = password - //this.client = new OkHttpClient() + //this.client = new OkHttpClient() // OR Unsafe (ignore SSL errors) below this.client = getUnsafeOkHttpClient() } + + /** + * Logon to the HMC and get an authentication token for further requests. + * + * @throws IOException + */ void login() throws IOException { String payload = """\ @@ -75,6 +79,11 @@ class HmcClient { } + + /** + * Logoff from the HMC and remove any session + * + */ void logoff() { URL absUrl = new URL(String.format("%s/rest/api/web/Logon", baseUrl)) Request request = new Request.Builder() @@ -93,6 +102,12 @@ class HmcClient { } + + /** + * Return Map of ManagedSystems seen by this HMC + * + * @return + */ Map getManagedSystems() { log.debug("getManagedSystems()") @@ -121,21 +136,19 @@ class HmcClient { } - void getLogicalPartitions() { - log.debug("getLogicalPartitions()") - managedSystems.each { - getLogicalPartitionsForManagedSystem(it.getValue()) - } - } + /** + * Return Map of LogicalPartitions seen by a ManagedSystem on this HMC - Map getLogicalPartitionsForManagedSystem(ManagedSystem system) { - log.debug("getLogicalPartitionsForManagedSystem() - " + system.name) + * @param UUID of managed system + * @return + */ + Map getLogicalPartitionsForManagedSystemWithId(String systemId) { + log.debug("getLogicalPartitionsForManagedSystem() - systemId: " + systemId) - URL url = new URL(String.format("%s/rest/api/uom/ManagedSystem/%s/LogicalPartition", baseUrl, system.id)) + URL url = new URL(String.format("%s/rest/api/uom/ManagedSystem/%s/LogicalPartition", baseUrl, systemId)) Response response = getResponse(url) String responseBody = response.body.string() - //log.debug(responseBody) Map partitionMap = new HashMap() {} def feed = new XmlSlurper().parseText(responseBody) @@ -144,11 +157,11 @@ class HmcClient { entry.content.each { content -> //log.debug("Content") content.LogicalPartition.each { partition -> - LogicalPartition logicalPartition = new LogicalPartition(partition.PartitionUUID as String) + LogicalPartition logicalPartition = new LogicalPartition(partition.PartitionUUID as String, systemId) logicalPartition.name = partition.PartitionName logicalPartition.type = partition.PartitionType partitionMap.put(logicalPartition.id, logicalPartition) - log.debug("getLogicalPartitionsForManagedSystem() " + logicalPartition.toString()) + log.debug("getLogicalPartitionsForManagedSystem() - Found partition: " + logicalPartition.toString()) } } } @@ -157,100 +170,83 @@ class HmcClient { } - void getProcessedMetrics() { - managedSystems.each { - getPcmForManagedSystemWithId(it.getValue()) - } - } - - String getPcmForManagedSystemWithId(String systemId) { - log.debug("getProcessedMetricsForManagedSystem() " - systemId) + /** + * Parse XML feed to get PCM Data in JSON format + * @param systemId + * @return + */ + String getPcmDataForManagedSystem(String systemId) { + log.debug("getPcmDataForManagedSystem() - " + systemId) URL url = new URL(String.format("%s/rest/api/pcm/ManagedSystem/%s/ProcessedMetrics?NoOfSamples=1", baseUrl, systemId)) Response response = getResponse(url) String responseBody = response.body.string() + String jsonBody + + // Parse XML and fetch JSON link def feed = new XmlSlurper().parseText(responseBody) feed?.entry?.each { entry -> String link = entry.link["@href"] - switch (entry.category["@term"]) { - case "ManagedSystem": - return getPcmJsonForManagedSystem(link) - break - case "LogicalPartition": - //processPcmJsonForLogicalPartition(getPcmJsonForLogicalPartition(getProcessedMetricsForLogicalPartition(link))) - break - default: - log.warn("Unknown category: " + entry.category["@term"]) - break + if(entry.category["@term"] == "ManagedSystem") { + jsonBody = getReponseBody(new URL(link)) } } + + return jsonBody } /** - * Parse XML to get JSON Link - * @param pcmUrl + * Parse XML feed to get PCM Data in JSON format + * @param systemId + * @param partitionId + * @return */ - String getProcessedMetricsForLogicalPartition(String pcmUrl) { - log.debug("getProcessedMetricsForLogicalPartition() - " + pcmUrl) - URL url = new URL(pcmUrl) + String getPcmDataForLogicalPartition(String systemId, String partitionId) { + + log.debug(String.format("getPcmDataForLogicalPartition() - %s @ %s", partitionId, systemId)) + URL url = new URL(String.format("%s/rest/api/pcm/ManagedSystem/%s/LogicalPartition/%s/ProcessedMetrics?NoOfSamples=1", baseUrl, systemId, partitionId)) Response response = getResponse(url) String responseBody = response.body.string() - String link + //log.debug(responseBody) + String jsonBody + + // Parse XML and fetch JSON link def feed = new XmlSlurper().parseText(responseBody) feed?.entry?.each { entry -> - link = entry.link["@href"] - } - - return link - } - - - private String getPcmJsonForManagedSystem(String jsonUrl) { - log.debug("getPcmJsonForManagedSystem() - " + jsonUrl) - URL url = new URL(jsonUrl) - Response response = getResponse(url) - return response.body.string() - } - - - private String getPcmJsonForLogicalPartition(String jsonUrl) { - log.debug("getPcmJsonForLogicalPartition() - " + jsonUrl) - URL url = new URL(jsonUrl) - Response response = getResponse(url) - return response.body.string() - } - - - - void processPcmJsonForLogicalPartition(String json) { - log.debug("processPcmJsonForLogicalPartition()") - - def jsonObject = new JsonSlurper().parseText(json) - String systemUuid = jsonObject?.utilInfo?.uuid as String - - if(systemUuid && managedSystems.containsKey(systemUuid)) { - - log.debug("processPcmJsonForLogicalPartition() - Found UUID for ManagedSystem: " + systemUuid) - ManagedSystem system = managedSystems.get(systemUuid) - String lparUuid = jsonObject?.utilSamples?.lparsUtil?.first()?.first()?.uuid as String - - if(lparUuid && system.partitions.containsKey(lparUuid)) { - - log.debug("processPcmJsonForLogicalPartition() - Found UUID for LogicalPartition: " + lparUuid) - LogicalPartition lpar = system.partitions.get(lparUuid) - lpar.processMetrics(json) + String link = entry.link["@href"] + if(entry.category["@term"] == "LogicalPartition") { + jsonBody = getReponseBody(new URL(link)) } - } + return jsonBody } + /** + * Return body text from a HTTP response from the HMC + * + * @param url + * @return + */ + protected String getReponseBody(URL url) { + //log.debug("getBody() - " + url.toString()) + Response response = getResponse(url) + return response.body.string() + } + + + + /** + * Return a Response from the HMC + * + * @param url + * @return + */ private Response getResponse(URL url) { - //log.debug("getResponse() - " + url.toString()) Request request = new Request.Builder() .url(url) @@ -261,12 +257,17 @@ class HmcClient { Response response = client.newCall(request).execute(); if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); - // TODO: Better error detection return response } + + /** + * Provide an unsafe (ignoring SSL problems) OkHttpClient + * + * @return + */ private static OkHttpClient getUnsafeOkHttpClient() { try { // Create a trust manager that does not validate certificate chains diff --git a/src/main/groovy/biz/nellemann/hmci/LogicalPartition.groovy b/src/main/groovy/biz/nellemann/hmci/LogicalPartition.groovy index f9c3b7a..361b758 100644 --- a/src/main/groovy/biz/nellemann/hmci/LogicalPartition.groovy +++ b/src/main/groovy/biz/nellemann/hmci/LogicalPartition.groovy @@ -1,5 +1,6 @@ package biz.nellemann.hmci +import biz.nellemann.hmci.pojo.PcmData import biz.nellemann.hmci.pojo.SystemUtil import groovy.json.JsonSlurper import groovy.util.logging.Slf4j @@ -10,21 +11,24 @@ class LogicalPartition { public String id public String name public String type + public String systemId - protected SystemUtil metrics + protected PcmData metrics - LogicalPartition(String id) { + LogicalPartition(String id, String systemId) { this.id = id + this.systemId = systemId } String toString() { return "[${id}] ${name} (${type})" } + void processMetrics(String json) { - //metrics = new JsonSlurper().parseText(json) as SystemUtil + log.debug("processMetrics()") def pcmMap = new JsonSlurper().parseText(json) - metrics = new SystemUtil(pcmMap as Map) + metrics = new PcmData(pcmMap as Map) } } diff --git a/src/main/groovy/biz/nellemann/hmci/ManagedSystem.groovy b/src/main/groovy/biz/nellemann/hmci/ManagedSystem.groovy index 431e79d..167d64a 100644 --- a/src/main/groovy/biz/nellemann/hmci/ManagedSystem.groovy +++ b/src/main/groovy/biz/nellemann/hmci/ManagedSystem.groovy @@ -3,7 +3,6 @@ package biz.nellemann.hmci import biz.nellemann.hmci.pojo.PcmData import groovy.json.JsonSlurper -import groovy.transform.CompileStatic import groovy.util.logging.Slf4j @Slf4j @@ -14,7 +13,6 @@ class ManagedSystem { public String type public String model public String serialNumber - public Map partitions = new HashMap() protected PcmData metrics @@ -27,20 +25,8 @@ class ManagedSystem { } - - - void processPcmJson(String json) { - log.debug("processPcmJson()") - def jsonObject = new JsonSlurper().parseText(json) - String systemUuid = jsonObject?.systemUtil?.utilInfo?.uuid as String - if(systemUuid && this.id == systemUuid) { - log.debug("processPcmJson() - Found UUID for this ManagedSystem: " + systemUuid) - processMetrics(json) - } - } - - private void processMetrics(String json) { - //metrics = new JsonSlurper().parseText(json) as PcmData + void processMetrics(String json) { + log.debug("processMetrics()") def pcmMap = new JsonSlurper().parseText(json) metrics = new PcmData(pcmMap as Map) } diff --git a/src/test/groovy/biz/nellemann/hmci/HmcClientTest.groovy b/src/test/groovy/biz/nellemann/hmci/HmcClientTest.groovy index 1014c18..8dc6e33 100644 --- a/src/test/groovy/biz/nellemann/hmci/HmcClientTest.groovy +++ b/src/test/groovy/biz/nellemann/hmci/HmcClientTest.groovy @@ -1,6 +1,5 @@ package biz.nellemann.hmci - import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockWebServer import spock.lang.Specification @@ -30,11 +29,11 @@ class HmcClientTest extends Specification { mockServer.enqueue(new MockResponse().setBody(testXml)); when: - hmc.getManagedSystems() + Map systems = hmc.getManagedSystems() then: - hmc.managedSystems.size() == 2 - hmc.managedSystems.get("e09834d1-c930-3883-bdad-405d8e26e166").name == "S822L-8247-213C1BA" + systems.size() == 2 + systems.get("e09834d1-c930-3883-bdad-405d8e26e166").name == "S822L-8247-213C1BA" } @@ -46,83 +45,41 @@ class HmcClientTest extends Specification { when: ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166") - hmc.managedSystems.put("e09834d1-c930-3883-bdad-405d8e26e166", system) - hmc.getLogicalPartitionsForManagedSystem(system) + Map partitions = hmc.getLogicalPartitionsForManagedSystemWithId(system.id) then: - system.partitions.size() == 12 - system.partitions.get("3380A831-9D22-4F03-A1DF-18B249F0FF8E").name == "AIX_Test1-e0f725f0-00000005" - system.partitions.get("3380A831-9D22-4F03-A1DF-18B249F0FF8E").type == "AIX/Linux" + partitions.size() == 12 + partitions.get("3380A831-9D22-4F03-A1DF-18B249F0FF8E").name == "AIX_Test1-e0f725f0-00000005" + partitions.get("3380A831-9D22-4F03-A1DF-18B249F0FF8E").type == "AIX/Linux" } - void "test getPcmJsonForManagedSystem"() { + void "test getBody with JSON for ManagedSystem"() { setup: - def testFile = new File(getClass().getResource('/managed-system-pcm.json').toURI()) + def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) def testJson = testFile.getText('UTF-8') mockServer.enqueue(new MockResponse().setBody(testJson)); when: - String jsonString = hmc.getPcmJsonForManagedSystem(mockServer.url("/rest/api/pcm/ProcessedMetrics/ManagedSystem_e09834d1-c930-3883-bdad-405d8e26e166_20200807T122600+0200_20200807T122600+0200_30.json").toString()) + String jsonString = hmc.getReponseBody(new URL(mockServer.url("/rest/api/pcm/ProcessedMetrics/ManagedSystem_e09834d1-c930-3883-bdad-405d8e26e166_20200807T122600+0200_20200807T122600+0200_30.json") as String)) then: jsonString.contains('"uuid": "e09834d1-c930-3883-bdad-405d8e26e166"') } - void "test getPcmJsonForLogicalPartition"() { + void "test getBody with JSON for LogicalPartition"() { setup: - def testFile = new File(getClass().getResource('/logical-partition-pcm.json').toURI()) + def testFile = new File(getClass().getResource('/pcm-data-logical-partition.json').toURI()) def testJson = testFile.getText('UTF-8') mockServer.enqueue(new MockResponse().setBody(testJson)); when: - String jsonString = hmc.getPcmJsonForLogicalPartition(mockServer.url("/rest/api/pcm/ProcessedMetrics/LogicalPartition_2DE05DB6-8AD5-448F-8327-0F488D287E82_20200807T123730+0200_20200807T123730+0200_30.json").toString()) + String jsonString = hmc.getReponseBody(new URL(mockServer.url("/rest/api/pcm/ProcessedMetrics/LogicalPartition_2DE05DB6-8AD5-448F-8327-0F488D287E82_20200807T123730+0200_20200807T123730+0200_30.json") as String)) then: jsonString.contains('"uuid": "b597e4da-2aab-3f52-8616-341d62153559"') } - void "test processPcmJsonForManagedSystem"() { - - setup: - def testFile = new File(getClass().getResource('/managed-system-pcm.json').toURI()) - def testJson = testFile.getText('UTF-8') - - when: - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166") - hmc.managedSystems.put("e09834d1-c930-3883-bdad-405d8e26e166", system) - hmc.processPcmJsonForManagedSystem(testJson) - - then: - system.metrics.systemUtil.utilSamples.first().serverUtil.memory.assignedMemToLpars.first() == 40960.000 - system.metrics.systemUtil.utilSamples.first().serverUtil.processor.totalProcUnits.first() == 24.000 - system.metrics.systemUtil.utilSamples.first().viosUtil.first().name == "VIOS1" - system.metrics.systemUtil.utilSamples.first().viosUtil.first().memory.assignedMem.first() == 8192.000 - system.metrics.systemUtil.utilSamples.first().viosUtil.first().storage.genericPhysicalAdapters.first().transmittedBytes.first() == 2321.067 - system.metrics.systemUtil.utilSamples.first().viosUtil.first().storage.fiberChannelAdapters.first().numOfPorts == 3 - - } - - void "test processPcmJsonForLogicalPartition"() { - - setup: - def testFile = new File(getClass().getResource('/logical-partition-pcm.json').toURI()) - def testJson = testFile.getText('UTF-8') - - when: - ManagedSystem system = new ManagedSystem("b597e4da-2aab-3f52-8616-341d62153559") - hmc.managedSystems.put("b597e4da-2aab-3f52-8616-341d62153559", system) - LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82") - system.partitions.put("2DE05DB6-8AD5-448F-8327-0F488D287E82", lpar) - hmc.processPcmJsonForLogicalPartition(testJson) - - then: - lpar.metrics.utilSamples.first().lparsUtil.first().memory.logicalMem.first() == 112640.000 - lpar.metrics.utilSamples.first().lparsUtil.first().processor.utilizedProcUnits.first() == 0.574 - lpar.metrics.utilSamples.first().lparsUtil.first().network.virtualEthernetAdapters.first().receivedPackets.first() == 11.933 - } - - } diff --git a/src/test/groovy/biz/nellemann/hmci/LogicalPartitionTest.groovy b/src/test/groovy/biz/nellemann/hmci/LogicalPartitionTest.groovy new file mode 100644 index 0000000..eb5e871 --- /dev/null +++ b/src/test/groovy/biz/nellemann/hmci/LogicalPartitionTest.groovy @@ -0,0 +1,25 @@ +package biz.nellemann.hmci + +import spock.lang.Specification + +class LogicalPartitionTest extends Specification { + + + void "test processPcmJson for LogicalPartition"() { + + setup: + def testFile = new File(getClass().getResource('/pcm-data-logical-partition.json').toURI()) + def testJson = testFile.getText('UTF-8') + + when: + LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82", "e09834d1-c930-3883-bdad-405d8e26e166") + lpar.processMetrics(testJson) + + then: + lpar.metrics.systemUtil.utilSamples.first().lparsUtil.first().memory.logicalMem.first() == 8192.000 + lpar.metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.utilizedProcUnits.first() == 0.001 + lpar.metrics.systemUtil.utilSamples.first().lparsUtil.first().network.virtualEthernetAdapters.first().receivedPackets.first() == 3.867 + } + + +} diff --git a/src/test/groovy/biz/nellemann/hmci/ManagedSystemTest.groovy b/src/test/groovy/biz/nellemann/hmci/ManagedSystemTest.groovy new file mode 100644 index 0000000..3102c5d --- /dev/null +++ b/src/test/groovy/biz/nellemann/hmci/ManagedSystemTest.groovy @@ -0,0 +1,27 @@ +package biz.nellemann.hmci + +import spock.lang.Specification + +class ManagedSystemTest extends Specification { + + 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: + ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166") + system.processMetrics(testJson) + + then: + system.metrics.systemUtil.utilSamples.first().serverUtil.memory.assignedMemToLpars.first() == 40960.000 + system.metrics.systemUtil.utilSamples.first().serverUtil.processor.totalProcUnits.first() == 24.000 + system.metrics.systemUtil.utilSamples.first().viosUtil.first().name == "VIOS1" + system.metrics.systemUtil.utilSamples.first().viosUtil.first().memory.assignedMem.first() == 8192.000 + system.metrics.systemUtil.utilSamples.first().viosUtil.first().storage.genericPhysicalAdapters.first().transmittedBytes.first() == 9966.933 + system.metrics.systemUtil.utilSamples.first().viosUtil.first().storage.fiberChannelAdapters.first().numOfPorts == 3 + + } + +} diff --git a/src/test/resources/logical-partition-pcm.json b/src/test/resources/logical-partition-pcm.json index deb1749..0cf20a5 100644 --- a/src/test/resources/logical-partition-pcm.json +++ b/src/test/resources/logical-partition-pcm.json @@ -1,222 +1,223 @@ { - "utilInfo": { - "version": "1.3.0", - "metricType": "Processed", - "frequency": 30, - "startTimeStamp": "2020-08-07T12:37:30+0200", - "endTimeStamp": "2020-08-07T12:37:30+0200", - "mtms": "9009-42A*21F64EV", - "name": "Server-9009-42A-SN21F64EV", - "uuid": "b597e4da-2aab-3f52-8616-341d62153559", - "metricArrayOrder": [ - "AVG" - ] - }, - "utilSamples": [ - { - "sampleType": "LogicalPartition", - "sampleInfo": { - "timeStamp": "2020-08-07T12:37:30+0200", - "status": 2, - "errorInfo": [ - { - "errId": "3004", - "errMsg": "Failed to fetch SRIOV adapter physical port statistics due to a technical error.", - "uuid": "b597e4da-2aab-3f52-8616-341d62153559", - "reportedBy": "ManagedSystem", - "occurrenceCount": 1 - }, - { - "errId": "3004", - "errMsg": "Failed to fetch SRIOV adapter physical port statistics due to a technical error.", - "uuid": "b597e4da-2aab-3f52-8616-341d62153559", - "reportedBy": "ManagedSystem", - "occurrenceCount": 1 - } - ] - }, - "lparsUtil": [ - { - "id": 10, - "uuid": "2DE05DB6-8AD5-448F-8327-0F488D287E82", - "name": "P9-PowerVC", - "state": "Running", - "type": "AIX/Linux", - "osType": "Linux", - "affinityScore": 100, - "memory": { - "logicalMem": [ - 112640.000 - ], - "backedPhysicalMem": [ - 112640.000 - ] - }, - "processor": { - "poolId": 0, - "weight": 128, - "mode": "uncap", - "maxVirtualProcessors": [ - 8.000 - ], - "currentVirtualProcessors": [ - 4.000 - ], - "maxProcUnits": [ - 8.000 - ], - "entitledProcUnits": [ - 1.000 - ], - "utilizedProcUnits": [ - 0.574 - ], - "utilizedCappedProcUnits": [ - 0.498 - ], - "utilizedUncappedProcUnits": [ - 0.076 - ], - "idleProcUnits": [ - 0.376 - ], - "donatedProcUnits": [ - 0.000 - ], - "timeSpentWaitingForDispatch": [ - 0.000 - ], - "timePerInstructionExecution": [ - 0.000 - ] - }, - "network": { - "virtualEthernetAdapters": [ - { - "physicalLocation": "U9009.42A.21F64EV-V10-C2", - "vlanId": 1, - "vswitchId": 0, - "isPortVlanId": true, - "viosId": 1, - "sharedEthernetAdapterId": "ent5", - "receivedPackets": [ - 11.933 - ], - "sentPackets": [ - 7.767 - ], - "droppedPackets": [ - 0.000 - ], - "sentBytes": [ - 2020.467 - ], - "receivedBytes": [ - 4291.167 - ], - "receivedPhysicalPackets": [ - 11.933 - ], - "sentPhysicalPackets": [ - 7.767 - ], - "droppedPhysicalPackets": [ - 0.000 - ], - "sentPhysicalBytes": [ - 2020.467 - ], - "receivedPhysicalBytes": [ - 4291.167 - ], - "transferredBytes": [ - 6311.634 - ], - "transferredPhysicalBytes": [ - 6311.634 - ] - } - ] - }, - "storage": { - "genericVirtualAdapters": [ - { - "id": "vhost5", - "type": "virtual", - "viosId": 1, - "physicalLocation": "U9009.42A.21F64EV-V10-C3", - "numOfReads": [ - 0.000 - ], - "numOfWrites": [ - 0.000 - ], - "readBytes": [ - 0.000 - ], - "writeBytes": [ - 0.000 - ], - "transmittedBytes": [ - null - ] - } - ], - "virtualFiberChannelAdapters": [ - { - "wwpn": "c050760b1d10002a", - "wwpn2": "c050760b1d10002b", - "physicalLocation": "U9009.42A.21F64EV-V10-C87", - "physicalPortWWPN": "100000109b89aca8", - "viosId": 1, - "numOfReads": [ - 0.000 - ], - "numOfWrites": [ - 2.867 - ], - "readBytes": [ - 0.000 - ], - "writeBytes": [ - 138786.133 - ], - "runningSpeed": [ - 8.000 - ], - "transmittedBytes": [ - 0.000 - ] - }, - { - "wwpn": "c050760b1d10002c", - "wwpn2": "c050760b1d10002d", - "physicalLocation": "U9009.42A.21F64EV-V10-C88", - "physicalPortWWPN": "100000109b7db96a", - "viosId": 2, - "numOfReads": [ - 0.000 - ], - "numOfWrites": [ - 2.933 - ], - "readBytes": [ - 0.000 - ], - "writeBytes": [ - 140731.733 - ], - "runningSpeed": [ - 8.000 - ], - "transmittedBytes": [ - 0.000 - ] - } - ] - } - } - ] - } - ] -}} +"utilInfo": { +"version": "1.3.0", +"metricType": "Processed", +"frequency": 30, +"startTimeStamp": "2020-08-07T12:37:30+0200", +"endTimeStamp": "2020-08-07T12:37:30+0200", +"mtms": "9009-42A*21F64EV", +"name": "Server-9009-42A-SN21F64EV", +"uuid": "b597e4da-2aab-3f52-8616-341d62153559", +"metricArrayOrder": [ +"AVG" +] +}, +"utilSamples": [ +{ +"sampleType": "LogicalPartition", +"sampleInfo": { +"timeStamp": "2020-08-07T12:37:30+0200", +"status": 2, +"errorInfo": [ +{ +"errId": "3004", +"errMsg": "Failed to fetch SRIOV adapter physical port statistics due to a technical error.", +"uuid": "b597e4da-2aab-3f52-8616-341d62153559", +"reportedBy": "ManagedSystem", +"occurrenceCount": 1 +}, +{ +"errId": "3004", +"errMsg": "Failed to fetch SRIOV adapter physical port statistics due to a technical error.", +"uuid": "b597e4da-2aab-3f52-8616-341d62153559", +"reportedBy": "ManagedSystem", +"occurrenceCount": 1 +} +] +}, +"lparsUtil": [ +{ +"id": 10, +"uuid": "2DE05DB6-8AD5-448F-8327-0F488D287E82", +"name": "P9-PowerVC", +"state": "Running", +"type": "AIX/Linux", +"osType": "Linux", +"affinityScore": 100, +"memory": { +"logicalMem": [ +112640.000 +], +"backedPhysicalMem": [ +112640.000 +] +}, +"processor": { +"poolId": 0, +"weight": 128, +"mode": "uncap", +"maxVirtualProcessors": [ +8.000 +], +"currentVirtualProcessors": [ +4.000 +], +"maxProcUnits": [ +8.000 +], +"entitledProcUnits": [ +1.000 +], +"utilizedProcUnits": [ +0.574 +], +"utilizedCappedProcUnits": [ +0.498 +], +"utilizedUncappedProcUnits": [ +0.076 +], +"idleProcUnits": [ +0.376 +], +"donatedProcUnits": [ +0.000 +], +"timeSpentWaitingForDispatch": [ +0.000 +], +"timePerInstructionExecution": [ +0.000 +] +}, +"network": { +"virtualEthernetAdapters": [ +{ +"physicalLocation": "U9009.42A.21F64EV-V10-C2", +"vlanId": 1, +"vswitchId": 0, +"isPortVlanId": true, +"viosId": 1, +"sharedEthernetAdapterId": "ent5", +"receivedPackets": [ +11.933 +], +"sentPackets": [ +7.767 +], +"droppedPackets": [ +0.000 +], +"sentBytes": [ +2020.467 +], +"receivedBytes": [ +4291.167 +], +"receivedPhysicalPackets": [ +11.933 +], +"sentPhysicalPackets": [ +7.767 +], +"droppedPhysicalPackets": [ +0.000 +], +"sentPhysicalBytes": [ +2020.467 +], +"receivedPhysicalBytes": [ +4291.167 +], +"transferredBytes": [ +6311.634 +], +"transferredPhysicalBytes": [ +6311.634 +] +} +] +}, +"storage": { +"genericVirtualAdapters": [ +{ +"id": "vhost5", +"type": "virtual", +"viosId": 1, +"physicalLocation": "U9009.42A.21F64EV-V10-C3", +"numOfReads": [ +0.000 +], +"numOfWrites": [ +0.000 +], +"readBytes": [ +0.000 +], +"writeBytes": [ +0.000 +], +"transmittedBytes": [ +null +] +} +], +"virtualFiberChannelAdapters": [ +{ +"wwpn": "c050760b1d10002a", +"wwpn2": "c050760b1d10002b", +"physicalLocation": "U9009.42A.21F64EV-V10-C87", +"physicalPortWWPN": "100000109b89aca8", +"viosId": 1, +"numOfReads": [ +0.000 +], +"numOfWrites": [ +2.867 +], +"readBytes": [ +0.000 +], +"writeBytes": [ +138786.133 +], +"runningSpeed": [ +8.000 +], +"transmittedBytes": [ +0.000 +] +}, +{ +"wwpn": "c050760b1d10002c", +"wwpn2": "c050760b1d10002d", +"physicalLocation": "U9009.42A.21F64EV-V10-C88", +"physicalPortWWPN": "100000109b7db96a", +"viosId": 2, +"numOfReads": [ +0.000 +], +"numOfWrites": [ +2.933 +], +"readBytes": [ +0.000 +], +"writeBytes": [ +140731.733 +], +"runningSpeed": [ +8.000 +], +"transmittedBytes": [ +0.000 +] +} +] +} +} +] +} +] +} +} diff --git a/src/test/resources/pcm-data-logical-partition.json b/src/test/resources/pcm-data-logical-partition.json new file mode 100644 index 0000000..b4c7dee --- /dev/null +++ b/src/test/resources/pcm-data-logical-partition.json @@ -0,0 +1,274 @@ +{ + "systemUtil": { + "utilInfo": { + "version": "1.3.0", + "metricType": "Processed", + "frequency": 30, + "startTimeStamp": "2020-08-10T21:06:30+0200", + "endTimeStamp": "2020-08-10T21:06:30+0200", + "mtms": "9009-42A*21F64EV", + "name": "Server-9009-42A-SN21F64EV", + "uuid": "b597e4da-2aab-3f52-8616-341d62153559", + "metricArrayOrder": [ + "AVG" + ] + }, + "utilSamples": [ + { + "sampleType": "LogicalPartition", + "sampleInfo": { + "timeStamp": "2020-08-10T21:06:30+0200", + "status": 2, + "errorInfo": [ + { + "errId": "3004", + "errMsg": "Failed to fetch SRIOV adapter physical port statistics due to a technical error.", + "uuid": "b597e4da-2aab-3f52-8616-341d62153559", + "reportedBy": "ManagedSystem", + "occurrenceCount": 1 + }, + { + "errId": "3004", + "errMsg": "Failed to fetch SRIOV adapter physical port statistics due to a technical error.", + "uuid": "b597e4da-2aab-3f52-8616-341d62153559", + "reportedBy": "ManagedSystem", + "occurrenceCount": 1 + } + ] + }, + "lparsUtil": [ + { + "id": 13, + "uuid": "6B7D14D3-BBD2-475B-8284-70FADBFC37FB", + "name": "ubuntu-bionic-a02af293-00000006", + "state": "Running", + "type": "AIX/Linux", + "osType": "Linux", + "affinityScore": 100, + "memory": { + "logicalMem": [ + 8192.000 + ], + "backedPhysicalMem": [ + 8192.000 + ] + }, + "processor": { + "poolId": 0, + "weight": 128, + "mode": "uncap", + "maxVirtualProcessors": [ + 2.000 + ], + "currentVirtualProcessors": [ + 2.000 + ], + "maxProcUnits": [ + 2.000 + ], + "entitledProcUnits": [ + 1.000 + ], + "utilizedProcUnits": [ + 0.001 + ], + "utilizedCappedProcUnits": [ + 0.001 + ], + "utilizedUncappedProcUnits": [ + 0.000 + ], + "idleProcUnits": [ + 0.001 + ], + "donatedProcUnits": [ + 0.000 + ], + "timeSpentWaitingForDispatch": [ + 0.000 + ], + "timePerInstructionExecution": [ + 0.000 + ] + }, + "network": { + "virtualEthernetAdapters": [ + { + "physicalLocation": "U9009.42A.21F64EV-V13-C32", + "vlanId": 1, + "vswitchId": 0, + "isPortVlanId": true, + "viosId": 1, + "sharedEthernetAdapterId": "ent5", + "receivedPackets": [ + 3.867 + ], + "sentPackets": [ + 0.233 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 35.667 + ], + "receivedBytes": [ + 276.467 + ], + "receivedPhysicalPackets": [ + 3.867 + ], + "sentPhysicalPackets": [ + 0.233 + ], + "droppedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalBytes": [ + 35.667 + ], + "receivedPhysicalBytes": [ + 276.467 + ], + "transferredBytes": [ + 312.134 + ], + "transferredPhysicalBytes": [ + 312.134 + ] + } + ] + }, + "storage": { + "genericVirtualAdapters": [ + { + "id": "vhost7", + "type": "virtual", + "viosId": 1, + "physicalLocation": "U9009.42A.21F64EV-V13-C3", + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.000 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 0.000 + ], + "transmittedBytes": [ + null + ] + } + ], + "virtualFiberChannelAdapters": [ + { + "wwpn": "c050760b1d10005c", + "wwpn2": "c050760b1d10005d", + "physicalLocation": "U9009.42A.21F64EV-V13-C6", + "physicalPortWWPN": "100000109b89aca9", + "viosId": 1, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.100 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 6690.133 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 0.000 + ] + }, + { + "wwpn": "c050760b1d100056", + "wwpn2": "c050760b1d100057", + "physicalLocation": "U9009.42A.21F64EV-V13-C2", + "physicalPortWWPN": "100000109b7db96a", + "viosId": 2, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.100 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 546.133 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 0.000 + ] + }, + { + "wwpn": "c050760b1d100058", + "wwpn2": "c050760b1d100059", + "physicalLocation": "U9009.42A.21F64EV-V13-C4", + "physicalPortWWPN": "100000109b89aca8", + "viosId": 1, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.100 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 6690.133 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 0.000 + ] + }, + { + "wwpn": "c050760b1d10005a", + "wwpn2": "c050760b1d10005b", + "physicalLocation": "U9009.42A.21F64EV-V13-C5", + "physicalPortWWPN": "100000109b7db969", + "viosId": 2, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.100 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 546.133 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 0.000 + ] + } + ] + } + } + ] + } + ] + } +} \ No newline at end of file diff --git a/src/test/resources/pcm-data-managed-system.json b/src/test/resources/pcm-data-managed-system.json new file mode 100644 index 0000000..f04aee8 --- /dev/null +++ b/src/test/resources/pcm-data-managed-system.json @@ -0,0 +1,805 @@ +{ + "systemUtil": { + "utilInfo": { + "version": "1.3.0", + "metricType": "Processed", + "frequency": 30, + "startTimeStamp": "2020-08-10T21:10:30+0200", + "endTimeStamp": "2020-08-10T21:10:30+0200", + "mtms": "8247-22L*213C1BA", + "name": "S822L-8247-213C1BA", + "uuid": "e09834d1-c930-3883-bdad-405d8e26e166", + "metricArrayOrder": [ + "AVG" + ] + }, + "utilSamples": [ + { + "sampleType": "ManagedSystem", + "sampleInfo": { + "timeStamp": "2020-08-10T21:10:30+0200", + "status": 0 + }, + "systemFirmwareUtil": { + "utilizedProcUnits": [ + 0.000 + ], + "assignedMem": [ + 5632.000 + ] + }, + "serverUtil": { + "processor": { + "totalProcUnits": [ + 24.000 + ], + "utilizedProcUnits": [ + 0.027 + ], + "availableProcUnits": [ + 16.000 + ], + "configurableProcUnits": [ + 24.000 + ] + }, + "memory": { + "totalMem": [ + 1048576.000 + ], + "availableMem": [ + 1001984.000 + ], + "configurableMem": [ + 1048576.000 + ], + "assignedMemToLpars": [ + 40960.000 + ] + }, + "physicalProcessorPool": { + "assignedProcUnits": [ + 23.767 + ], + "utilizedProcUnits": [ + 0.007 + ], + "availableProcUnits": [ + 23.760 + ], + "configuredProcUnits": [ + 0.000 + ], + "borrowedProcUnits": [ + 16.000 + ] + }, + "sharedProcessorPool": [ + { + "id": 0, + "name": "DefaultPool", + "assignedProcUnits": [ + 23.767 + ], + "utilizedProcUnits": [ + 0.006 + ], + "availableProcUnits": [ + 23.761 + ], + "configuredProcUnits": [ + 6.000 + ], + "borrowedProcUnits": [ + 16.000 + ] + } + ] + }, + "viosUtil": [ + { + "id": 1, + "uuid": "2F30379A-860B-4661-A24E-CD8E449C81AC", + "name": "VIOS1", + "state": "Running", + "affinityScore": 100, + "memory": { + "assignedMem": [ + 8192.000 + ], + "utilizedMem": [ + 2093.000 + ] + }, + "processor": { + "weight": 0, + "mode": "share_idle_procs_active", + "maxVirtualProcessors": [ + 2.000 + ], + "currentVirtualProcessors": [ + 0.000 + ], + "maxProcUnits": [ + 2.000 + ], + "entitledProcUnits": [ + 1.000 + ], + "utilizedProcUnits": [ + 0.011 + ], + "utilizedCappedProcUnits": [ + 0.120 + ], + "utilizedUncappedProcUnits": [ + 0.000 + ], + "idleProcUnits": [ + 0.109 + ], + "donatedProcUnits": [ + 0.880 + ], + "timeSpentWaitingForDispatch": [ + 0.000 + ], + "timePerInstructionExecution": [ + 50.000 + ] + }, + "network": { + "clientLpars": [ + "62F4D488-C838-41E2-B83B-E68E004E3B63" + ], + "genericAdapters": [ + { + "id": "ent2", + "type": "physical", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C10-T3", + "receivedPackets": [ + 13.100 + ], + "sentPackets": [ + 8.700 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 3511.833 + ], + "receivedBytes": [ + 1614.567 + ], + "transferredBytes": [ + 5126.400 + ] + }, + { + "id": "ent6", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V1-C3-T1", + "receivedPackets": [ + 5.733 + ], + "sentPackets": [ + 1.600 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 1378.267 + ], + "receivedBytes": [ + 490.500 + ], + "transferredBytes": [ + 1868.767 + ] + }, + { + "id": "ent4", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V1-C2-T1", + "receivedPackets": [ + 9.700 + ], + "sentPackets": [ + 17.200 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 4835.967 + ], + "receivedBytes": [ + 4217.833 + ], + "transferredBytes": [ + 9053.800 + ] + } + ], + "sharedAdapters": [ + { + "id": "ent5", + "type": "sea", + "physicalLocation": "U8247.22L.213C1BA-V1-C2-T1", + "receivedPackets": [ + 22.800 + ], + "sentPackets": [ + 25.900 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 8347.800 + ], + "receivedBytes": [ + 5832.400 + ], + "transferredBytes": [ + 14180.200 + ], + "bridgedAdapters": [ + "ent2", + "ent4", + "ent4" + ] + } + ], + "virtualEthernetAdapters": [ + { + "physicalLocation": "U8247.22L.213C1BA-V1-C2", + "vlanId": 1, + "vswitchId": 0, + "isPortVlanId": true, + "receivedPackets": [ + 16.167 + ], + "sentPackets": [ + 20.133 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 3155.500 + ], + "receivedBytes": [ + 5089.900 + ], + "receivedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalPackets": [ + 0.000 + ], + "droppedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalBytes": [ + 0.000 + ], + "receivedPhysicalBytes": [ + 0.000 + ], + "transferredBytes": [ + 8245.400 + ], + "transferredPhysicalBytes": [ + 0.000 + ] + }, + { + "physicalLocation": "U8247.22L.213C1BA-V1-C3", + "vlanId": 1, + "vswitchId": 0, + "isPortVlanId": true, + "receivedPackets": [ + 8.800 + ], + "sentPackets": [ + 4.567 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 2086.400 + ], + "receivedBytes": [ + 1169.400 + ], + "receivedPhysicalPackets": [ + 8.800 + ], + "sentPhysicalPackets": [ + 4.567 + ], + "droppedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalBytes": [ + 2086.400 + ], + "receivedPhysicalBytes": [ + 1169.400 + ], + "transferredBytes": [ + 3255.800 + ], + "transferredPhysicalBytes": [ + 3255.800 + ] + } + ] + }, + "storage": { + "clientLpars": [ + "62F4D488-C838-41E2-B83B-E68E004E3B63" + ], + "genericPhysicalAdapters": [ + { + "id": "sissas0", + "type": "sas", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C14-T1", + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 19.467 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 9966.933 + ], + "transmittedBytes": [ + 9966.933 + ] + } + ], + "genericVirtualAdapters": [ + { + "id": "vhost1", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V1-C6", + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.000 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 0.000 + ], + "transmittedBytes": [ + 0.000 + ] + }, + { + "id": "vhost0", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V1-C5", + "numOfReads": [ + 0.467 + ], + "numOfWrites": [ + 0.467 + ], + "readBytes": [ + 238.933 + ], + "writeBytes": [ + 238.933 + ], + "transmittedBytes": [ + 477.866 + ] + }, + { + "id": "vhost2", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V1-C7", + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.000 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 0.000 + ], + "transmittedBytes": [ + 0.000 + ] + } + ], + "fiberChannelAdapters": [ + { + "id": "fcs0", + "wwpn": "10000090faba5108", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C12-T1", + "numOfPorts": 3, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.067 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 4369.067 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 4369.067 + ] + }, + { + "id": "fcs1", + "wwpn": "10000090faba5109", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C12-T2", + "numOfPorts": 0, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.000 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 0.000 + ], + "runningSpeed": [ + 0.000 + ], + "transmittedBytes": [ + 0.000 + ] + } + ] + } + }, + { + "id": 2, + "uuid": "2BA128CE-38E4-4522-B823-7471633C2717", + "name": "VIOS2", + "state": "Running", + "affinityScore": 100, + "memory": { + "assignedMem": [ + 8192.000 + ], + "utilizedMem": [ + 2116.000 + ] + }, + "processor": { + "weight": 0, + "mode": "share_idle_procs_active", + "maxVirtualProcessors": [ + 2.000 + ], + "currentVirtualProcessors": [ + 0.000 + ], + "maxProcUnits": [ + 2.000 + ], + "entitledProcUnits": [ + 1.000 + ], + "utilizedProcUnits": [ + 0.009 + ], + "utilizedCappedProcUnits": [ + 0.113 + ], + "utilizedUncappedProcUnits": [ + 0.000 + ], + "idleProcUnits": [ + 0.104 + ], + "donatedProcUnits": [ + 0.887 + ], + "timeSpentWaitingForDispatch": [ + 0.000 + ], + "timePerInstructionExecution": [ + 51.000 + ] + }, + "network": { + "genericAdapters": [ + { + "id": "ent6", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V2-C3-T1", + "receivedPackets": [ + 5.967 + ], + "sentPackets": [ + 1.967 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 1340.100 + ], + "receivedBytes": [ + 536.100 + ], + "transferredBytes": [ + 1876.200 + ] + }, + { + "id": "ent4", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V2-C2-T1", + "receivedPackets": [ + 4.667 + ], + "sentPackets": [ + 1.000 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 706.000 + ], + "receivedBytes": [ + 3294.667 + ], + "transferredBytes": [ + 4000.667 + ] + }, + { + "id": "ent2", + "type": "physical", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C6-T3", + "receivedPackets": [ + 6.000 + ], + "sentPackets": [ + 0.000 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 0.000 + ], + "receivedBytes": [ + 420.167 + ], + "transferredBytes": [ + 420.167 + ] + } + ], + "sharedAdapters": [ + { + "id": "ent5", + "type": "sea", + "physicalLocation": "U8247.22L.213C1BA-V2-C2-T1", + "receivedPackets": [ + 10.667 + ], + "sentPackets": [ + 1.000 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 706.000 + ], + "receivedBytes": [ + 3714.833 + ], + "transferredBytes": [ + 4420.833 + ], + "bridgedAdapters": [ + "ent2", + "ent4", + "ent4" + ] + } + ], + "virtualEthernetAdapters": [ + { + "physicalLocation": "U8247.22L.213C1BA-V2-C2", + "vlanId": 1, + "vswitchId": 0, + "isPortVlanId": true, + "receivedPackets": [ + 0.000 + ], + "sentPackets": [ + 0.000 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 0.000 + ], + "receivedBytes": [ + 0.000 + ], + "receivedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalPackets": [ + 0.000 + ], + "droppedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalBytes": [ + 0.000 + ], + "receivedPhysicalBytes": [ + 0.000 + ], + "transferredBytes": [ + 0.000 + ], + "transferredPhysicalBytes": [ + 0.000 + ] + }, + { + "physicalLocation": "U8247.22L.213C1BA-V2-C3", + "vlanId": 1, + "vswitchId": 0, + "isPortVlanId": true, + "receivedPackets": [ + 8.467 + ], + "sentPackets": [ + 4.333 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 1849.500 + ], + "receivedBytes": [ + 1100.000 + ], + "receivedPhysicalPackets": [ + 8.467 + ], + "sentPhysicalPackets": [ + 4.333 + ], + "droppedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalBytes": [ + 1849.500 + ], + "receivedPhysicalBytes": [ + 1100.000 + ], + "transferredBytes": [ + 2949.500 + ], + "transferredPhysicalBytes": [ + 2949.500 + ] + } + ] + }, + "storage": { + "clientLpars": [ + "62F4D488-C838-41E2-B83B-E68E004E3B63" + ], + "genericPhysicalAdapters": [ + { + "id": "sissas1", + "type": "sas", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C15-T1", + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 12.000 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 6144.000 + ], + "transmittedBytes": [ + 6144.000 + ] + } + ], + "fiberChannelAdapters": [ + { + "id": "fcs1", + "wwpn": "10000090fab674d7", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C2-T2", + "numOfPorts": 0, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.000 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 0.000 + ], + "runningSpeed": [ + 0.000 + ], + "transmittedBytes": [ + 0.000 + ] + }, + { + "id": "fcs0", + "wwpn": "10000090fab674d6", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C2-T1", + "numOfPorts": 3, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.067 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 4369.067 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 4369.067 + ] + } + ] + } + } + ] + } + ] + } +} \ No newline at end of file diff --git a/src/test/resources/pcm-partition.xml b/src/test/resources/pcm-partition.xml new file mode 100644 index 0000000..1e6e931 --- /dev/null +++ b/src/test/resources/pcm-partition.xml @@ -0,0 +1,19 @@ + + 1700D42D-C9FA-4131-B024-588FDDC70649 + 2020-08-10T20:54:30.000+02:00 + ProcessedMetrics + LogicalPartition 1700D42D-C9FA-4131-B024-588FDDC70649 + + + + 160106d5-1803-42f3-a81f-c1fd90456e8c + 2020-08-10T20:54:30.000+02:00 + LogicalPartition_1700D42D-C9FA-4131-B024-588FDDC70649_20200810T185530+0200_20200810T205430+0200_30.json + 2020-08-10T18:55:30.000+02:00 + + + IBM Power Systems Management Console + + + + \ No newline at end of file