summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorolaaun <ola.aunroe@gmail.com>2017-08-09 15:50:28 +0800
committerGitHub <noreply@github.com>2017-08-09 15:50:28 +0800
commitccfecc714b51ff47dff28e9ccd21dec4aeb0e8e3 (patch)
tree777cd57671245f888abd6ab9e55d0239997083c1
parentf76406b88df47f6bdbf9d24feda4c9ff55c63e06 (diff)
Interns/verification fix 4 (#3059)
* Made diskbenchmark heavier * Changed how net interface and connection is compared. No longer cares if node repo says shouldn't have interface, even though it actually has * Now supports taking in comma separated config server urls as parameter * Added VerifierSettings to be able to choose what tests to be executed based on node repo * Changed how SpecVerification reports. Now creates JSON containing only actual hardware values that are different from node repo * Changed reporting of benchmarks * Now tests config server url generation when comma separated list is passed to program * Added system exit in benchmarks to allow testing * Ping6 logger writes full error message * Added and changed some class level comments * Added verificationReport test and removed skipwords in parseInstructions * cleanup * Code cleanup * Added information to README for hardware verification * Readme to spec * Now retrieves interface speed independent of previous command * ethtool and ifconfig now ignores docker and veth-interfaces * Removed some references to prod.
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/commons/HostURLGenerator.java (renamed from node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/HostURLGenerator.java)12
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/commons/ParseInstructions.java18
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/BenchmarkResultInspector.java34
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/HardwareBenchmarker.java32
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/README.md8
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/TerminationController.java48
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/CPUBenchmark.java4
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/DiskBenchmark.java2
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/report/BenchmarkReport.java (renamed from node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/yamasreport/HardwareReportMetrics.java)21
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/yamasreport/HardwareReportDimensions.java13
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/yamasreport/YamasHardwareReport.java79
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparator.java116
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/README.md8
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifier.java48
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/VerifierSettings.java26
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/IPAddressVerifier.java9
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/NodeRepoJsonModel.java10
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/report/VerificationReport.java58
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfoRetriever.java5
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetriever.java40
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/SpecReportDimensions.java82
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/SpecReportMetrics.java102
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/YamasSpecReport.java82
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/HostURLGeneratorTest.java (renamed from node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HostURLGeneratorTest.java)17
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/BenchmarkResultInspectorTest.java85
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/TerminationControllerTest.java61
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/report/BenchmarkReportTest.java28
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/yamasreport/YamasHardwareReportTest.java31
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparatorTest.java22
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifierTest.java54
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/report/VerificationReportTest.java43
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/SpecVerifierReport2
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/hostURLGeneratorTest2
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeRepo.json (renamed from node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodes/v2/node/nodeRepo.json)3
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeRepoVirtualMachine.json (renamed from node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodes/v2/node/nodeRepoVirtualMachine.json)0
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/reportJSON1
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/yamasJSON1
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfoRetrieverTest.java7
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetrieverTest.java43
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/YamasSpecReportTest.java59
40 files changed, 486 insertions, 830 deletions
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/HostURLGenerator.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/commons/HostURLGenerator.java
index 157f618761d..42ac9cd4a45 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/HostURLGenerator.java
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/commons/HostURLGenerator.java
@@ -1,4 +1,4 @@
-package com.yahoo.vespa.hosted.node.verification.spec;
+package com.yahoo.vespa.hosted.node.verification.commons;
import com.yahoo.vespa.hosted.node.verification.commons.CommandExecutor;
@@ -31,6 +31,16 @@ public class HostURLGenerator {
return nodeInfoUrls;
}
+ public static ArrayList<URL> generateNodeInfoUrl(CommandExecutor commandExecutor, String commaSeparatedUrls) throws IOException {
+ ArrayList<URL> nodeInfoUrls = new ArrayList<>();
+ String[] configServerHostNames = commaSeparatedUrls.split(PARSE_ALL_HOSTNAMES_REGEX);
+ String nodeHostName = generateNodeHostName(commandExecutor);
+ for (String configServerHostName : configServerHostNames) {
+ nodeInfoUrls.add(buildNodeInfoURL(configServerHostName, nodeHostName));
+ }
+ return nodeInfoUrls;
+ }
+
protected static String[] getConfigServerHostNames(CommandExecutor commandExecutor) throws IOException {
ArrayList<String> output = commandExecutor.executeCommand(CONFIG_SERVER_HOST_NAME_COMMAND);
if (output.size() != 1)
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/commons/ParseInstructions.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/commons/ParseInstructions.java
index 1e8531512f2..f2bf2d60758 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/commons/ParseInstructions.java
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/commons/ParseInstructions.java
@@ -11,8 +11,6 @@ public class ParseInstructions {
private final int valueElementIndex;
private final String splitRegex;
private final ArrayList<String> searchWords;
- private String skipWord;
- private String skipUntilKeyword;
public ParseInstructions(int searchElementIndex, int returnElementNum, String splitRegex, ArrayList<String> searchWords) {
this.searchElementIndex = searchElementIndex;
@@ -37,20 +35,4 @@ public class ParseInstructions {
return searchWords;
}
- public void setSkipWord(String skipWord) {
- this.skipWord = skipWord;
- }
-
- public void setSkipUntilKeyword(String skipUntilWord) {
- this.skipUntilKeyword = skipUntilWord;
- }
-
- public String getSkipWord() {
- return this.skipWord;
- }
-
- public String getSkipUntilKeyword() {
- return this.skipUntilKeyword;
- }
-
}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/BenchmarkResultInspector.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/BenchmarkResultInspector.java
new file mode 100644
index 00000000000..d5174549b9d
--- /dev/null
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/BenchmarkResultInspector.java
@@ -0,0 +1,34 @@
+package com.yahoo.vespa.hosted.node.verification.hardware;
+
+import com.yahoo.vespa.hosted.node.verification.hardware.benchmarks.BenchmarkResults;
+import com.yahoo.vespa.hosted.node.verification.hardware.report.BenchmarkReport;
+
+public class BenchmarkResultInspector {
+
+ private static final double CPU_FREQUENCY_LOWER_LIMIT = 0.5;
+ private static final double MEMORY_WRITE_SPEED_LOWER_LIMIT = 1D;
+ private static final double MEMORY_READ_SPEED_LOWER_LIMIT = 1D;
+ private static final double DISK_SPEED_LOWER_LIMIT = 50D;
+
+ public static BenchmarkReport makeBenchmarkReport(BenchmarkResults benchmarkResults) {
+ BenchmarkReport benchmarkReport = new BenchmarkReport();
+ double cpuCyclesPerSec = benchmarkResults.getCpuCyclesPerSec();
+ if (cpuCyclesPerSec < CPU_FREQUENCY_LOWER_LIMIT) {
+ benchmarkReport.setCpuCyclesPerSec(cpuCyclesPerSec);
+ }
+ double memoryWriteSpeed = benchmarkResults.getMemoryWriteSpeedGBs();
+ if (memoryWriteSpeed < MEMORY_WRITE_SPEED_LOWER_LIMIT) {
+ benchmarkReport.setMemoryWriteSpeedGBs(memoryWriteSpeed);
+ }
+ double memoryReadSpeed = benchmarkResults.getMemoryReadSpeedGBs();
+ if (memoryReadSpeed < MEMORY_READ_SPEED_LOWER_LIMIT) {
+ benchmarkReport.setMemoryReadSpeedGBs(memoryReadSpeed);
+ }
+ double diskSpeed = benchmarkResults.getDiskSpeedMbs();
+ if (diskSpeed < DISK_SPEED_LOWER_LIMIT) {
+ benchmarkReport.setDiskSpeedMbs(diskSpeed);
+ }
+ return benchmarkReport;
+ }
+
+}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/HardwareBenchmarker.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/HardwareBenchmarker.java
index cd4bcdfd758..5bd407ae0fd 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/HardwareBenchmarker.java
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/HardwareBenchmarker.java
@@ -1,5 +1,6 @@
package com.yahoo.vespa.hosted.node.verification.hardware;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yahoo.vespa.hosted.node.verification.commons.CommandExecutor;
import com.yahoo.vespa.hosted.node.verification.hardware.benchmarks.Benchmark;
@@ -7,7 +8,7 @@ import com.yahoo.vespa.hosted.node.verification.hardware.benchmarks.BenchmarkRes
import com.yahoo.vespa.hosted.node.verification.hardware.benchmarks.CPUBenchmark;
import com.yahoo.vespa.hosted.node.verification.hardware.benchmarks.DiskBenchmark;
import com.yahoo.vespa.hosted.node.verification.hardware.benchmarks.MemoryBenchmark;
-import com.yahoo.vespa.hosted.node.verification.hardware.yamasreport.YamasHardwareReport;
+import com.yahoo.vespa.hosted.node.verification.hardware.report.BenchmarkReport;
import java.util.ArrayList;
import java.util.Arrays;
@@ -26,23 +27,26 @@ public class HardwareBenchmarker {
for (Benchmark benchmark : benchmarks) {
benchmark.doBenchmark();
}
-
- YamasHardwareReport yamasHardwareReport = makeYamasHardwareReport(benchmarkResults);
- printBenchmarkResults(yamasHardwareReport);
- TerminationController.terminateIfInvalidBenchmarkResults(benchmarkResults);
- return true;
+ BenchmarkReport benchmarkReport = BenchmarkResultInspector.makeBenchmarkReport(benchmarkResults);
+ printBenchmarkResults(benchmarkReport);
+ return isAllBenchmarksOK(benchmarkReport);
}
- protected static YamasHardwareReport makeYamasHardwareReport(BenchmarkResults benchmarkResults) {
- YamasHardwareReport yamasHardwareReport = new YamasHardwareReport();
- yamasHardwareReport.createReportFromBenchmarkResults(benchmarkResults);
- return yamasHardwareReport;
+ private static boolean isAllBenchmarksOK(BenchmarkReport benchmarkReport) {
+ ObjectMapper om = new ObjectMapper();
+ try {
+ String jsonReport = om.writeValueAsString(benchmarkReport);
+ return jsonReport.length() == 2;
+ } catch (JsonProcessingException e){
+ e.printStackTrace();
+ return false;
+ }
}
- private static void printBenchmarkResults(YamasHardwareReport yamasHardwareReport) {
+ private static void printBenchmarkResults(BenchmarkReport benchmarkReport) {
ObjectMapper om = new ObjectMapper();
try {
- System.out.println(om.writeValueAsString(yamasHardwareReport));
+ System.out.println(om.writeValueAsString(benchmarkReport));
} catch (Exception e) {
e.printStackTrace();
}
@@ -50,7 +54,9 @@ public class HardwareBenchmarker {
public static void main(String[] args) {
CommandExecutor commandExecutor = new CommandExecutor();
- HardwareBenchmarker.hardwareBenchmarks(commandExecutor);
+ if (!HardwareBenchmarker.hardwareBenchmarks(commandExecutor)){
+ System.exit(2);
+ }
}
}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/README.md b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/README.md
index 2797a6b5a9c..c995739d255 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/README.md
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/README.md
@@ -1,2 +1,8 @@
# Hardware Verification
-Verification of behaviour and performance of hardware \ No newline at end of file
+Verification of behaviour and performance of hardware. Benchmarks cpu frequency, disk write speed and memory write/read speed.
+A report is sent to the node repository if any of the results are below an accepted threshold.
+
+## Code Walkthrough
+The main class, HardwareBenchmarker, calls every benchmark in the benchmark package. The results of these benchmarks are passed through
+the BenchmarkResultInstructor, which creates a report containing the values below the accepted threshold. If the report is non-empty,
+the node repository is updated with the poor benchmark result. \ No newline at end of file
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/TerminationController.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/TerminationController.java
deleted file mode 100644
index fe75cdf88a2..00000000000
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/TerminationController.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.yahoo.vespa.hosted.node.verification.hardware;
-
-import com.yahoo.vespa.hosted.node.verification.hardware.benchmarks.BenchmarkResults;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-public class TerminationController {
-
- private static final Logger logger = Logger.getLogger(TerminationController.class.getName());
-
- private static final double CPU_FREQUENCY_LOWER_LIMIT = 0.5;
- private static final double MEMORY_WRITE_SPEED_LOWER_LIMIT = 1D;
- private static final double MEMORY_READ_SPEED_LOWER_LIMIT = 1D;
- private static final double DISK_SPEED_LOWER_LIMIT = 50D;
-
- public static void terminateIfInvalidBenchmarkResults(BenchmarkResults benchmarkResults) {
- if (!isBenchmarkResultsValid(benchmarkResults)) {
- System.exit(1);
- }
- }
-
- public static boolean isBenchmarkResultsValid(BenchmarkResults benchmarkResults) {
- boolean validResults = true;
-
- if (benchmarkResults.getCpuCyclesPerSec() < CPU_FREQUENCY_LOWER_LIMIT) {
- logger.log(Level.WARNING, "CPU frequency below accepted value. Value: " + benchmarkResults.getCpuCyclesPerSec() + " GHz");
- validResults = false;
- }
-
- if (benchmarkResults.getMemoryWriteSpeedGBs() < MEMORY_WRITE_SPEED_LOWER_LIMIT) {
- logger.log(Level.WARNING, "Memory write speed below accepted value. Value: " + benchmarkResults.getMemoryWriteSpeedGBs() + " GB/s");
- validResults = false;
- }
-
- if (benchmarkResults.getMemoryReadSpeedGBs() < MEMORY_READ_SPEED_LOWER_LIMIT) {
- logger.log(Level.WARNING, "Memory read speed below accepted value. Value: " + benchmarkResults.getMemoryReadSpeedGBs() + " GB/s");
- validResults = false;
- }
-
- if (benchmarkResults.getDiskSpeedMbs() < DISK_SPEED_LOWER_LIMIT) {
- logger.log(Level.WARNING, "Disk speed below accepted value. Value: " + benchmarkResults.getDiskSpeedMbs() + " MB/s");
- validResults = false;
- }
- return validResults;
- }
-
-}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/CPUBenchmark.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/CPUBenchmark.java
index 169fb11447b..76c5bfef4ac 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/CPUBenchmark.java
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/CPUBenchmark.java
@@ -16,7 +16,7 @@ import java.util.logging.Logger;
*/
public class CPUBenchmark implements Benchmark {
- private static final String CPU_BENCHMARK_COMMAND = "perf stat -e cycles dd if=/dev/zero of=/dev/null count=100000 2>&1 | grep 'cycles\\|seconds'";
+ private static final String CPU_BENCHMARK_COMMAND = "perf stat -e cycles dd if=/dev/zero of=/dev/null count=2000000 2>&1 | grep 'cycles\\|seconds'";
private static final String CYCLES_SEARCH_WORD = "cycles";
private static final String SECONDS_SEARCH_WORD = "seconds";
private static final String SPLIT_REGEX_STRING = "\\s+";
@@ -68,7 +68,7 @@ public class CPUBenchmark implements Benchmark {
seconds = makeSecondsDouble(parseResult.getValue());
break;
default:
- throw new RuntimeException("Invalid ParseResult searchWord");
+ throw new RuntimeException("Invalid ParseResult searchWord: " + parseResult.getSearchWord());
}
}
if (cycles > 0 && seconds > 0) {
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/DiskBenchmark.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/DiskBenchmark.java
index 191b26ee584..0512d79a023 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/DiskBenchmark.java
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/DiskBenchmark.java
@@ -72,7 +72,7 @@ public class DiskBenchmark implements Benchmark {
diskSpeedMBs = convertToMBs(diskSpeed, convertGBsToMBs);
break;
default:
- throw new RuntimeException("Invalid ParseResult searchWord");
+ throw new RuntimeException("Invalid ParseResult searchWord: " + parseResult.getSearchWord());
}
}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/yamasreport/HardwareReportMetrics.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/report/BenchmarkReport.java
index e0c1c704174..e1b8cd9bb8c 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/yamasreport/HardwareReportMetrics.java
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/report/BenchmarkReport.java
@@ -1,20 +1,23 @@
-package com.yahoo.vespa.hosted.node.verification.hardware.yamasreport;
+package com.yahoo.vespa.hosted.node.verification.hardware.report;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by sgrostad on 12/07/2017.
+ * JSON-mapped class for reporting benchmark results to node repo
*/
-public class HardwareReportMetrics {
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class BenchmarkReport {
@JsonProperty
- private double cpuCyclesPerSec;
+ private Double cpuCyclesPerSec;
@JsonProperty
- private double diskSpeedMbs;
+ private Double diskSpeedMbs;
@JsonProperty
- private double memoryWriteSpeedGBs;
+ private Double memoryWriteSpeedGBs;
@JsonProperty
- private double memoryReadSpeedGBs;
+ private Double memoryReadSpeedGBs;
public void setCpuCyclesPerSec(double cpuCyclesPerSec) {
this.cpuCyclesPerSec = cpuCyclesPerSec;
@@ -37,15 +40,15 @@ public class HardwareReportMetrics {
return cpuCyclesPerSec;
}
- public double getDiskSpeedMbs() {
+ public Double getDiskSpeedMbs() {
return diskSpeedMbs;
}
- public double getMemoryWriteSpeedGBs() {
+ public Double getMemoryWriteSpeedGBs() {
return memoryWriteSpeedGBs;
}
- public double getMemoryReadSpeedGBs() {
+ public Double getMemoryReadSpeedGBs() {
return memoryReadSpeedGBs;
}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/yamasreport/HardwareReportDimensions.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/yamasreport/HardwareReportDimensions.java
deleted file mode 100644
index 44c7ff44c67..00000000000
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/yamasreport/HardwareReportDimensions.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.yahoo.vespa.hosted.node.verification.hardware.yamasreport;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Created by sgrostad on 12/07/2017.
- */
-public class HardwareReportDimensions {
-
- @JsonProperty
- private String hostname = "hostname.something";
-
-}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/yamasreport/YamasHardwareReport.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/yamasreport/YamasHardwareReport.java
deleted file mode 100644
index c76edd39b3a..00000000000
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/hardware/yamasreport/YamasHardwareReport.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.yahoo.vespa.hosted.node.verification.hardware.yamasreport;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.yahoo.vespa.hosted.node.verification.hardware.benchmarks.BenchmarkResults;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Created by sgrostad on 12/07/2017.
- * JSON-mapped class for reporting to YAMAS
- */
-public class YamasHardwareReport {
-
- @JsonProperty
- private long timestamp;
- @JsonProperty
- private HardwareReportDimensions dimensions;
- @JsonProperty
- private HardwareReportMetrics metrics;
- @JsonProperty
- JsonObjectWrapper<JsonObjectWrapper<String[]>> routing;
-
- public YamasHardwareReport() {
- this.timestamp = System.currentTimeMillis() / 1000L;
- setRouting();
- }
-
- public HardwareReportDimensions getDimensions() {
- return dimensions;
- }
-
- public void setDimensions(HardwareReportDimensions dimensions) {
- this.dimensions = dimensions;
- }
-
- public HardwareReportMetrics getMetrics() {
- return metrics;
- }
-
- public void setMetrics(HardwareReportMetrics metrics) {
- this.metrics = metrics;
- }
-
- private void setRouting() {
- JsonObjectWrapper<String[]> wrap = new JsonObjectWrapper<>("namespace", new String[]{"Vespa"});
- routing = new JsonObjectWrapper<>("yamas", wrap);
- }
-
- public void createReportFromBenchmarkResults(BenchmarkResults benchmarkResults) {
- metrics = new HardwareReportMetrics();
- dimensions = new HardwareReportDimensions();
- metrics.setCpuCyclesPerSec(benchmarkResults.getCpuCyclesPerSec());
- metrics.setDiskSpeedMbs(benchmarkResults.getDiskSpeedMbs());
- metrics.setMemoryWriteSpeedGBs(benchmarkResults.getMemoryWriteSpeedGBs());
- metrics.setMemoryReadSpeedGBs(benchmarkResults.getMemoryReadSpeedGBs());
- }
-
- class JsonObjectWrapper<T> {
- private Map<String, T> wrappedObjects = new HashMap<String, T>();
-
- public JsonObjectWrapper(String name, T wrappedObject) {
- this.wrappedObjects.put(name, wrappedObject);
- }
-
- @JsonAnyGetter
- public Map<String, T> any() {
- return wrappedObjects;
- }
-
- @JsonAnySetter
- public void set(String name, T value) {
- wrappedObjects.put(name, value);
- }
- }
-
-}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparator.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparator.java
index b201e5c803d..6788419898c 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparator.java
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparator.java
@@ -2,135 +2,81 @@ package com.yahoo.vespa.hosted.node.verification.spec;
import com.yahoo.vespa.hosted.node.verification.spec.retrievers.HardwareInfo;
import com.yahoo.vespa.hosted.node.verification.spec.retrievers.HardwareInfo.DiskType;
-import com.yahoo.vespa.hosted.node.verification.spec.yamasreport.SpecReportDimensions;
-import com.yahoo.vespa.hosted.node.verification.spec.yamasreport.SpecReportMetrics;
-import com.yahoo.vespa.hosted.node.verification.spec.yamasreport.YamasSpecReport;
+import com.yahoo.vespa.hosted.node.verification.spec.report.VerificationReport;
/**
* Created by olaa on 04/07/2017.
- * Compares two HardwareInfo objects
+ * Compares two HardwareInfo objects and stores divergent values in a VerificationReport
*/
public class HardwareNodeComparator {
private static final double PERCENTAGE_THRESHOLD = 0.05;
- public static YamasSpecReport compare(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware) {
- Boolean equalHardware = true;
- YamasSpecReport yamasSpecReport = new YamasSpecReport();
- SpecReportDimensions specReportDimensions = new SpecReportDimensions();
- SpecReportMetrics specReportMetrics = new SpecReportMetrics();
-
+ public static VerificationReport compare(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware) {
+ VerificationReport verificationReport = new VerificationReport();
if (nodeRepoHardwareInfo == null || actualHardware == null) {
- return yamasSpecReport;
+ return verificationReport;
}
-
- setReportMetrics(nodeRepoHardwareInfo, actualHardware, specReportMetrics);
-
- equalHardware &= compareMemory(nodeRepoHardwareInfo, actualHardware, specReportDimensions);
- equalHardware &= compareCPU(nodeRepoHardwareInfo, actualHardware, specReportDimensions);
- equalHardware &= compareNetInterface(nodeRepoHardwareInfo, actualHardware, specReportDimensions);
- equalHardware &= compareDisk(nodeRepoHardwareInfo, actualHardware, specReportDimensions);
-
- specReportMetrics.setMatch(equalHardware);
- yamasSpecReport.setDimensions(specReportDimensions);
- yamasSpecReport.setMetrics(specReportMetrics);
-
- return yamasSpecReport;
+ setReportMetrics(nodeRepoHardwareInfo, actualHardware, verificationReport);
+ return verificationReport;
}
- private static void setReportMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) {
- setMemoryMetrics(nodeRepoHardwareInfo, actualHardware, specReportMetrics);
- setCpuMetrics(nodeRepoHardwareInfo, actualHardware, specReportMetrics);
- setDiskTypeMetrics(nodeRepoHardwareInfo, actualHardware, specReportMetrics);
- setDiskSpaceMetrics(nodeRepoHardwareInfo, actualHardware, specReportMetrics);
- setNetMetrics(nodeRepoHardwareInfo, actualHardware, specReportMetrics);
+ private static void setReportMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, VerificationReport verificationReport) {
+ setMemoryMetrics(nodeRepoHardwareInfo, actualHardware, verificationReport);
+ setCpuMetrics(nodeRepoHardwareInfo, actualHardware, verificationReport);
+ setDiskTypeMetrics(nodeRepoHardwareInfo, actualHardware, verificationReport);
+ setDiskSpaceMetrics(nodeRepoHardwareInfo, actualHardware, verificationReport);
+ setNetMetrics(nodeRepoHardwareInfo, actualHardware, verificationReport);
}
- private static void setMemoryMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) {
+ private static void setMemoryMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, VerificationReport verificationReport) {
double expectedMemory = nodeRepoHardwareInfo.getMinMainMemoryAvailableGb();
double actualMemory = actualHardware.getMinMainMemoryAvailableGb();
- if (!insideThreshold(expectedMemory, actualMemory, PERCENTAGE_THRESHOLD)) {
- specReportMetrics.setExpectedMemoryAvailable(expectedMemory);
- specReportMetrics.setActualMemoryAvailable(actualMemory);
+ if (outsideThreshold(expectedMemory, actualMemory, PERCENTAGE_THRESHOLD)) {
+ verificationReport.setActualMemoryAvailable(actualMemory);
}
}
- private static void setCpuMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) {
+ private static void setCpuMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, VerificationReport verificationReport) {
int expectedCpuCores = nodeRepoHardwareInfo.getMinCpuCores();
int actualCpuCores = actualHardware.getMinCpuCores();
if (expectedCpuCores != actualCpuCores) {
- specReportMetrics.setExpectedcpuCores(expectedCpuCores);
- specReportMetrics.setActualcpuCores(actualCpuCores);
+ verificationReport.setActualcpuCores(actualCpuCores);
}
}
- private static void setDiskTypeMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) {
+ private static void setDiskTypeMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, VerificationReport verificationReport) {
DiskType expectedFastDisk = nodeRepoHardwareInfo.getDiskType();
DiskType actualFastDisk = actualHardware.getDiskType();
if (expectedFastDisk != null && actualFastDisk != null && expectedFastDisk != actualFastDisk) {
- specReportMetrics.setExpectedDiskType(expectedFastDisk);
- specReportMetrics.setActualDiskType(actualFastDisk);
+ verificationReport.setActualDiskType(actualFastDisk);
}
}
- private static void setDiskSpaceMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) {
+ private static void setDiskSpaceMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, VerificationReport verificationReport) {
double expectedDiskSpace = nodeRepoHardwareInfo.getMinDiskAvailableGb();
double actualDiskSpace = actualHardware.getMinDiskAvailableGb();
- if (!insideThreshold(expectedDiskSpace, actualDiskSpace, PERCENTAGE_THRESHOLD)) {
- specReportMetrics.setExpectedDiskSpaceAvailable(expectedDiskSpace);
- specReportMetrics.setActualDiskSpaceAvailable(actualDiskSpace);
+ if (outsideThreshold(expectedDiskSpace, actualDiskSpace, PERCENTAGE_THRESHOLD)) {
+ verificationReport.setActualDiskSpaceAvailable(actualDiskSpace);
}
}
- private static void setNetMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) {
+ private static void setNetMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, VerificationReport verificationReport) {
double expectedInterfaceSpeed = nodeRepoHardwareInfo.getInterfaceSpeedMbs();
double actualInterfaceSpeed = actualHardware.getInterfaceSpeedMbs();
- //if (!insideThreshold(expectedInterfaceSpeed, actualInterfaceSpeed, PERCENTAGE_THRESHOLD)) {
- specReportMetrics.setExpectedInterfaceSpeed(expectedInterfaceSpeed);
- specReportMetrics.setActualInterfaceSpeed(actualInterfaceSpeed);
- //} TODO uncomment this if wanted
-
- if (nodeRepoHardwareInfo.isIpv6Connection() != actualHardware.isIpv6Connection()) {
- specReportMetrics.setActualIpv6Connection(actualHardware.isIpv6Connection());
- specReportMetrics.setExpectedIpv6Connection(nodeRepoHardwareInfo.isIpv6Connection());
+ if (expectedInterfaceSpeed > actualInterfaceSpeed) {
+ verificationReport.setActualInterfaceSpeed(actualInterfaceSpeed);
}
- }
- private static boolean compareCPU(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportDimensions specReportDimensions) {
- boolean equalCPU = nodeRepoHardwareInfo.getMinCpuCores() == actualHardware.getMinCpuCores();
- specReportDimensions.setCpuCoresMatch(equalCPU);
- return equalCPU;
- }
-
- private static boolean compareMemory(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportDimensions specReportDimensions) {
- boolean equalMemory = insideThreshold(nodeRepoHardwareInfo.getMinMainMemoryAvailableGb(), actualHardware.getMinMainMemoryAvailableGb(), PERCENTAGE_THRESHOLD);
- specReportDimensions.setMemoryMatch(equalMemory);
- return equalMemory;
- }
-
- private static boolean compareNetInterface(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportDimensions specReportDimensions) {
- boolean equalNetInterfaceSpeed = insideThreshold(nodeRepoHardwareInfo.getInterfaceSpeedMbs(), actualHardware.getInterfaceSpeedMbs(), PERCENTAGE_THRESHOLD);
- boolean equalIpv6Interface = nodeRepoHardwareInfo.getIpv6Interface() == actualHardware.getIpv6Interface();
- boolean equalIpv4Interface = nodeRepoHardwareInfo.getIpv4Interface() == actualHardware.getIpv4Interface();
- boolean equalIpv6Connection = nodeRepoHardwareInfo.isIpv6Connection() == actualHardware.isIpv6Connection();
- specReportDimensions.setNetInterfaceSpeedMatch(equalNetInterfaceSpeed);
- specReportDimensions.setIpv6Match(equalIpv6Interface);
- specReportDimensions.setIpv4Match(equalIpv4Interface);
- return equalIpv4Interface && equalIpv6Connection; // && equalNetInterfaceSpeed && equalIpv6Interface; TODO include these if wanted.
- }
-
- private static boolean compareDisk(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportDimensions specReportDimensions) {
- boolean equalDiskType = nodeRepoHardwareInfo.getDiskType() == actualHardware.getDiskType();
- boolean equalDiskSize = insideThreshold(nodeRepoHardwareInfo.getMinDiskAvailableGb(), actualHardware.getMinDiskAvailableGb(), PERCENTAGE_THRESHOLD);
- specReportDimensions.setDiskTypeMatch(equalDiskType);
- specReportDimensions.setDiskAvailableMatch(equalDiskSize);
- return equalDiskType && equalDiskSize;
+ if (nodeRepoHardwareInfo.isIpv6Connection() && !actualHardware.isIpv6Connection()) {
+ verificationReport.setActualIpv6Connection(actualHardware.isIpv6Connection());
+ }
}
- private static boolean insideThreshold(double value1, double value2 , double thresholdPercentage) {
+ private static boolean outsideThreshold(double value1, double value2 , double thresholdPercentage) {
double lowerThresholdPercentage = 1 - thresholdPercentage;
double upperThresholdPercentage = 1 + thresholdPercentage;
- return value1 > lowerThresholdPercentage * value2 && value1 < upperThresholdPercentage * value2;
+ return value1 < lowerThresholdPercentage * value2 || value1 > upperThresholdPercentage * value2;
}
}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/README.md b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/README.md
index b250223841f..caddf3adf9e 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/README.md
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/README.md
@@ -1,2 +1,8 @@
# Spec Verification
-Verification of node repo information
+Verifies that the spec information in node repo coincides with what found on the node and reports back to node repo.
+
+## Code "walkthrough"
+The main class SpecVerifier uses the "noderepo" package to retrieve node spec from node repo.
+It can be called with one parameter, the config server hostname, or with none (it will then use yinst to retrieve config server host name). It finds hostname using "HostURLGenerator" in the "commons" package.
+It then retrieves all the hardware information at the node with the "retrievers" package and stores the values as a "HardwareInfo" object.
+SpecVerifier then uses HardwareNodeComparator to compare spec from node repo and the node itself and uses the "report" package to generate a report and to report back to node repo. \ No newline at end of file
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifier.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifier.java
index ea263abb723..0fcb6206237 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifier.java
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifier.java
@@ -3,13 +3,14 @@ package com.yahoo.vespa.hosted.node.verification.spec;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yahoo.vespa.hosted.node.verification.commons.CommandExecutor;
+import com.yahoo.vespa.hosted.node.verification.commons.HostURLGenerator;
import com.yahoo.vespa.hosted.node.verification.spec.noderepo.IPAddressVerifier;
import com.yahoo.vespa.hosted.node.verification.spec.noderepo.NodeJsonConverter;
import com.yahoo.vespa.hosted.node.verification.spec.noderepo.NodeRepoInfoRetriever;
import com.yahoo.vespa.hosted.node.verification.spec.noderepo.NodeRepoJsonModel;
import com.yahoo.vespa.hosted.node.verification.spec.retrievers.HardwareInfo;
import com.yahoo.vespa.hosted.node.verification.spec.retrievers.HardwareInfoRetriever;
-import com.yahoo.vespa.hosted.node.verification.spec.yamasreport.YamasSpecReport;
+import com.yahoo.vespa.hosted.node.verification.spec.report.VerificationReport;
import java.io.IOException;
import java.net.URL;
@@ -27,36 +28,41 @@ public class SpecVerifier {
private static final Logger logger = Logger.getLogger(SpecVerifier.class.getName());
private static final String VIRTUAL_ENVIRONMENT = "VIRTUAL_MACHINE";
- public static boolean verifySpec(CommandExecutor commandExecutor) throws IOException {
- NodeRepoJsonModel nodeRepoJsonModel = getNodeRepositoryJSON(commandExecutor);
+ public static boolean verifySpec(CommandExecutor commandExecutor, ArrayList<URL> nodeInfoUrls) throws IOException {
+ NodeRepoJsonModel nodeRepoJsonModel = getNodeRepositoryJSON(nodeInfoUrls);
if (nodeRepoJsonModel.getEnvironment().equals(VIRTUAL_ENVIRONMENT)) {
logger.log(Level.INFO, "Node is virtual machine - No need for verification");
return true;
}
- HardwareInfo actualHardware = HardwareInfoRetriever.retrieve(commandExecutor);
- YamasSpecReport yamasSpecReport = makeYamasSpecReport(actualHardware, nodeRepoJsonModel);
- printResults(yamasSpecReport);
- return yamasSpecReport.getMetrics().isMatch();
+ VerifierSettings verifierSettings = new VerifierSettings(nodeRepoJsonModel);
+ HardwareInfo actualHardware = HardwareInfoRetriever.retrieve(commandExecutor, verifierSettings);
+ VerificationReport verificationReport = makeVerificationReport(actualHardware, nodeRepoJsonModel);
+ printResults(verificationReport);
+ return isValidSpec(verificationReport);
}
- protected static YamasSpecReport makeYamasSpecReport(HardwareInfo actualHardware, NodeRepoJsonModel nodeRepoJsonModel) {
- YamasSpecReport yamasSpecReport = HardwareNodeComparator.compare(NodeJsonConverter.convertJsonModelToHardwareInfo(nodeRepoJsonModel), actualHardware);
+ private static boolean isValidSpec(VerificationReport verificationReport) throws JsonProcessingException {
+ ObjectMapper om = new ObjectMapper();
+ return om.writeValueAsString(verificationReport).length() == 2;
+ }
+
+ protected static VerificationReport makeVerificationReport(HardwareInfo actualHardware, NodeRepoJsonModel nodeRepoJsonModel) {
+ VerificationReport verificationReport = HardwareNodeComparator.compare(NodeJsonConverter.convertJsonModelToHardwareInfo(nodeRepoJsonModel), actualHardware);
IPAddressVerifier ipAddressVerifier = new IPAddressVerifier();
- ipAddressVerifier.reportFaultyIpAddresses(nodeRepoJsonModel, yamasSpecReport);
- return yamasSpecReport;
+ ipAddressVerifier.reportFaultyIpAddresses(nodeRepoJsonModel, verificationReport);
+ return verificationReport;
}
- protected static NodeRepoJsonModel getNodeRepositoryJSON(CommandExecutor commandExecutor) throws IOException {
- ArrayList<URL> nodeInfoUrls = HostURLGenerator.generateNodeInfoUrl(commandExecutor);
+ protected static NodeRepoJsonModel getNodeRepositoryJSON(ArrayList<URL> nodeInfoUrls) throws IOException {
NodeRepoJsonModel nodeRepoJsonModel = NodeRepoInfoRetriever.retrieve(nodeInfoUrls);
return nodeRepoJsonModel;
}
- private static void printResults(YamasSpecReport yamasSpecReport) {
- //TODO: Instead of println, report JSON to YAMAS
+ private static void printResults(VerificationReport verificationReport) {
+ //TODO: Instead of println, report JSON to node repo
ObjectMapper om = new ObjectMapper();
try {
- System.out.println(om.writeValueAsString(yamasSpecReport));
+ System.out.println(om.writeValueAsString(verificationReport));
} catch (JsonProcessingException e) {
e.printStackTrace();
}
@@ -64,9 +70,17 @@ public class SpecVerifier {
public static void main(String[] args) throws IOException {
CommandExecutor commandExecutor = new CommandExecutor();
- if (!SpecVerifier.verifySpec(commandExecutor)) {
+ ArrayList<URL> nodeInfoUrls;
+ if (args.length == 0) {
+ nodeInfoUrls = HostURLGenerator.generateNodeInfoUrl(commandExecutor);
+ } else {
+ nodeInfoUrls = HostURLGenerator.generateNodeInfoUrl(commandExecutor, args[0]);
+ }
+
+ if (!SpecVerifier.verifySpec(commandExecutor, nodeInfoUrls)) {
System.exit(2);
}
+
}
}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/VerifierSettings.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/VerifierSettings.java
new file mode 100644
index 00000000000..936c19f6c7f
--- /dev/null
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/VerifierSettings.java
@@ -0,0 +1,26 @@
+package com.yahoo.vespa.hosted.node.verification.spec;
+
+import com.yahoo.vespa.hosted.node.verification.spec.noderepo.NodeRepoJsonModel;
+
+/**
+ * Created by sgrostad on 07/08/2017.
+ * Contains information on what spec should be verified or not.
+ */
+
+public class VerifierSettings {
+
+ private final boolean checkIPv6;
+
+ public VerifierSettings(){
+ this.checkIPv6 = true;
+ }
+
+ public VerifierSettings(NodeRepoJsonModel nodeRepoJsonModel){
+ checkIPv6 = nodeRepoJsonModel.getIpv6Address() != null;
+ }
+
+ public boolean isCheckIPv6() {
+ return checkIPv6;
+ }
+
+}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/IPAddressVerifier.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/IPAddressVerifier.java
index bdbfae33651..72149d561c5 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/IPAddressVerifier.java
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/IPAddressVerifier.java
@@ -1,6 +1,6 @@
package com.yahoo.vespa.hosted.node.verification.spec.noderepo;
-import com.yahoo.vespa.hosted.node.verification.spec.yamasreport.YamasSpecReport;
+import com.yahoo.vespa.hosted.node.verification.spec.report.VerificationReport;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
@@ -16,17 +16,17 @@ import java.util.logging.Logger;
/**
* Created by olaa on 14/07/2017.
- * Checks if all additional Ipv6 addresses has the same hostname as the main Ipv6 address.
+ * Verifies that the IP addresses of a node points to the correct hostname
*/
public class IPAddressVerifier {
private static final Logger logger = Logger.getLogger(IPAddressVerifier.class.getName());
- public void reportFaultyIpAddresses(NodeRepoJsonModel nodeRepoJsonModel, YamasSpecReport yamasSpecReport) {
+ public void reportFaultyIpAddresses(NodeRepoJsonModel nodeRepoJsonModel, VerificationReport verificationReport) {
String[] faultyIpAddresses = getFaultyIpAddresses(nodeRepoJsonModel);
if (faultyIpAddresses.length > 0) {
- yamasSpecReport.setFaultyIpAddresses(faultyIpAddresses);
+ verificationReport.setFaultyIpAddresses(faultyIpAddresses);
}
}
@@ -83,6 +83,7 @@ public class IPAddressVerifier {
Enumeration<?> vals = attr.getAll();
if (vals.hasMoreElements()) {
String hostname = vals.nextElement().toString();
+ ctx.close();
return hostname.substring(0, hostname.length() - 1);
}
}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/NodeRepoJsonModel.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/NodeRepoJsonModel.java
index f708057f6a5..319fa08f28f 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/NodeRepoJsonModel.java
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/NodeRepoJsonModel.java
@@ -28,17 +28,11 @@ public class NodeRepoJsonModel {
private boolean fastDisk;
@JsonProperty("ipAddresses")
private String[] ipAddresses;
- @JsonProperty("additionalIpAddresses")
- private String[] additionalIpAddresses;
@JsonProperty
private String hostname;
@JsonProperty
private String environment;
- public String[] getAdditionalIpAddresses() {
- return additionalIpAddresses;
- }
-
public HardwareInfo copyToHardwareInfo() {
HardwareInfo hardwareInfo = new HardwareInfo();
hardwareInfo.setMinMainMemoryAvailableGb(this.minMainMemoryAvailableGb);
@@ -79,10 +73,6 @@ public class NodeRepoJsonModel {
return fastDisk;
}
- public String[] getIpAddresses() {
- return ipAddresses;
- }
-
public String getHostname() {
return hostname;
}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/report/VerificationReport.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/report/VerificationReport.java
new file mode 100644
index 00000000000..ede4b0fc73a
--- /dev/null
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/report/VerificationReport.java
@@ -0,0 +1,58 @@
+package com.yahoo.vespa.hosted.node.verification.spec.report;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.yahoo.vespa.hosted.node.verification.spec.retrievers.HardwareInfo;
+
+
+/**
+ * Stores results of caomparing node repo spec and actual hardware info.
+ * In case of divergent values, set the corresponding attribute to the actual hardware info value.
+ * Attributes of equal value remain null.
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class VerificationReport {
+
+ @JsonProperty
+ private Double actualMemoryAvailable;
+ @JsonProperty
+ private HardwareInfo.DiskType actualDiskType;
+ @JsonProperty
+ private Double actualDiskSpaceAvailable;
+ @JsonProperty
+ private Double actualInterfaceSpeed;
+ @JsonProperty
+ private Integer actualcpuCores;
+ @JsonProperty
+ private String[] faultyIpAddresses;
+ @JsonProperty
+ private Boolean actualIpv6Connection;
+
+ public void setActualIpv6Connection(boolean actualIpv6Connection) {
+ this.actualIpv6Connection = actualIpv6Connection;
+ }
+
+ public void setActualMemoryAvailable(Double actualMemoryAvailable) {
+ this.actualMemoryAvailable = actualMemoryAvailable;
+ }
+
+ public void setActualDiskType(HardwareInfo.DiskType actualFastDisk) {
+ this.actualDiskType = actualFastDisk;
+ }
+
+ public void setActualDiskSpaceAvailable(Double actualDiskSpaceAvailable) {
+ this.actualDiskSpaceAvailable = actualDiskSpaceAvailable;
+ }
+
+ public void setActualcpuCores(int actualcpuCores) {
+ this.actualcpuCores = actualcpuCores;
+ }
+
+ public void setActualInterfaceSpeed(Double actualInterfaceSpeed) {
+ this.actualInterfaceSpeed = actualInterfaceSpeed;
+ }
+
+ public void setFaultyIpAddresses(String[] faultyIpAddresses) {
+ this.faultyIpAddresses = faultyIpAddresses;
+ }
+}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfoRetriever.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfoRetriever.java
index 77b514a56b3..a9b0ffcd0bb 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfoRetriever.java
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfoRetriever.java
@@ -1,6 +1,7 @@
package com.yahoo.vespa.hosted.node.verification.spec.retrievers;
import com.yahoo.vespa.hosted.node.verification.commons.CommandExecutor;
+import com.yahoo.vespa.hosted.node.verification.spec.VerifierSettings;
import java.util.ArrayList;
@@ -10,13 +11,13 @@ import java.util.ArrayList;
*/
public class HardwareInfoRetriever {
- public static HardwareInfo retrieve(CommandExecutor commandExecutor) {
+ public static HardwareInfo retrieve(CommandExecutor commandExecutor, VerifierSettings verifierSettings) {
HardwareInfo hardwareInfo = new HardwareInfo();
ArrayList<HardwareRetriever> infoList = new ArrayList<>();
infoList.add(new CPURetriever(hardwareInfo, commandExecutor));
infoList.add(new MemoryRetriever(hardwareInfo, commandExecutor));
infoList.add(new DiskRetriever(hardwareInfo, commandExecutor));
- infoList.add(new NetRetriever(hardwareInfo, commandExecutor));
+ infoList.add(new NetRetriever(hardwareInfo, commandExecutor, verifierSettings));
for (HardwareRetriever hardwareInfoType : infoList) {
hardwareInfoType.updateInfo();
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetriever.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetriever.java
index c775ee7a846..85bd585d595 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetriever.java
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetriever.java
@@ -4,6 +4,7 @@ import com.yahoo.vespa.hosted.node.verification.commons.CommandExecutor;
import com.yahoo.vespa.hosted.node.verification.commons.OutputParser;
import com.yahoo.vespa.hosted.node.verification.commons.ParseInstructions;
import com.yahoo.vespa.hosted.node.verification.commons.ParseResult;
+import com.yahoo.vespa.hosted.node.verification.spec.VerifierSettings;
import org.apache.commons.exec.ExecuteException;
import java.io.IOException;
@@ -16,11 +17,12 @@ import java.util.logging.Logger;
* Created by olaa on 30/06/2017.
*/
public class NetRetriever implements HardwareRetriever {
- private static final String NET_FIND_INTERFACE = "/sbin/ifconfig | awk 'BEGIN {RS=\"\\n\\n\"; } { if ( $1 != \"lo\") {print} }'";
- private static final String NET_CHECK_INTERFACE_SPEED = "/sbin/ethtool";
+
+ // Interface commands ignores lo-, veth- and docker interfaces
+ private static final String NET_FIND_INTERFACE = "/sbin/ifconfig | awk 'BEGIN {RS=\"\\n\\n\"; } { if ( $1 != \"lo\" && !match($1, \"^veth\") && !match($1, \"^docker\")) {print} }'";
+ private static final String NET_CHECK_INTERFACE_SPEED = "for i in $(/sbin/ifconfig | awk 'BEGIN {RS=\"\\n\\n\"; } { if ( $1 != \"lo\" && !match($1, \"^veth\") && !match($1, \"^docker\")) {print $1} }'); do /sbin/ethtool $i; done;";
private static final String SEARCH_WORD_INTERFACE_IP4 = "inet";
private static final String SEARCH_WORD_INTERFACE_IPV6 = "inet6";
- private static final String SEARCH_WORD_INTERFACE_NAME = "interface name";
private static final String SEARCH_WORD_INTERFACE_SPEED = "Speed";
private static final String INTERFACE_NAME_REGEX_SPLIT = "\\s+";
private static final int INTERFACE_SEARCH_ELEMENT_INDEX = 0;
@@ -36,17 +38,21 @@ public class NetRetriever implements HardwareRetriever {
private static final Logger logger = Logger.getLogger(NetRetriever.class.getName());
private final HardwareInfo hardwareInfo;
private final CommandExecutor commandExecutor;
+ private final VerifierSettings verifierSettings;
- public NetRetriever(HardwareInfo hardwareInfo, CommandExecutor commandExecutor) {
+ public NetRetriever(HardwareInfo hardwareInfo, CommandExecutor commandExecutor, VerifierSettings verifierSettings) {
this.hardwareInfo = hardwareInfo;
this.commandExecutor = commandExecutor;
+ this.verifierSettings = verifierSettings;
}
public void updateInfo() {
ArrayList<ParseResult> parseResults = findInterface();
findInterfaceSpeed(parseResults);
- testPingResponse(parseResults);
+ if (verifierSettings.isCheckIPv6()) {
+ testPingResponse(parseResults);
+ }
updateHardwareInfoWithNet(parseResults);
}
@@ -66,15 +72,12 @@ public class NetRetriever implements HardwareRetriever {
ArrayList<String> searchWords = new ArrayList<>(Arrays.asList(SEARCH_WORD_INTERFACE_IP4, SEARCH_WORD_INTERFACE_IPV6));
ParseInstructions parseInstructions = new ParseInstructions(INTERFACE_SEARCH_ELEMENT_INDEX, INTERFACE_RETURN_ELEMENT_INDEX, INTERFACE_NAME_REGEX_SPLIT, searchWords);
ArrayList<ParseResult> parseResults = OutputParser.parseOutput(parseInstructions, commandOutput);
- parseResults.add(findInterfaceName(commandOutput));
return parseResults;
}
protected void findInterfaceSpeed(ArrayList<ParseResult> parseResults) {
try {
- String interfaceName = getInterfaceName(parseResults);
- String command = NET_CHECK_INTERFACE_SPEED + " " + interfaceName;
- ArrayList<String> commandOutput = commandExecutor.executeCommand(command);
+ ArrayList<String> commandOutput = commandExecutor.executeCommand(NET_CHECK_INTERFACE_SPEED);
ParseResult parseResult = parseInterfaceSpeed(commandOutput);
parseResults.add(parseResult);
} catch (IOException e) {
@@ -82,22 +85,6 @@ public class NetRetriever implements HardwareRetriever {
}
}
- protected ParseResult findInterfaceName(ArrayList<String> commandOutput) {
- try {
- return new ParseResult(SEARCH_WORD_INTERFACE_NAME, commandOutput.get(0).trim().split(" ")[0]);
- } catch (NullPointerException e) {
- return new ParseResult("invalid", "invalid");
- }
- }
-
- protected String getInterfaceName(ArrayList<ParseResult> parseResults) {
- for (ParseResult parseResult : parseResults) {
- if (!parseResult.getSearchWord().matches(SEARCH_WORD_INTERFACE_NAME)) continue;
- return parseResult.getValue();
- }
- return "";
- }
-
protected ParseResult parseInterfaceSpeed(ArrayList<String> commandOutput) throws IOException {
ArrayList<String> searchWords = new ArrayList<>(Arrays.asList(SEARCH_WORD_INTERFACE_SPEED));
ParseInstructions parseInstructions = new ParseInstructions(INTERFACE_SPEED_SEARCH_ELEMENT_INDEX, INTERFACE_SPEED_RETURN_ELEMENT_INDEX, INTERFACE_SPEED_REGEX_SPLIT, searchWords);
@@ -113,7 +100,7 @@ public class NetRetriever implements HardwareRetriever {
ArrayList<String> commandOutput = commandExecutor.executeCommand(PING_NET_COMMAND);
parseResults.add(parsePingResponse(commandOutput));
} catch (ExecuteException e) {
- logger.log(Level.WARNING, "Failed to execute ping6");
+ logger.log(Level.WARNING, "Failed to execute ping6", e);
} catch (IOException e) {
logger.log(Level.WARNING, e.getMessage());
}
@@ -148,7 +135,6 @@ public class NetRetriever implements HardwareRetriever {
setIpv6Connectivity(parseResult);
break;
default:
- if (parseResult.getSearchWord().matches(SEARCH_WORD_INTERFACE_NAME)) break;
throw new RuntimeException("Invalid ParseResult search word: " + parseResult.getSearchWord());
}
}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/SpecReportDimensions.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/SpecReportDimensions.java
deleted file mode 100644
index 2a1ee4e9a53..00000000000
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/SpecReportDimensions.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.yahoo.vespa.hosted.node.verification.spec.yamasreport;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Created by olaa on 12/07/2017.
- */
-public class SpecReportDimensions {
-
-
- @JsonProperty
- private boolean memoryMatch;
- @JsonProperty
- private boolean cpuCoresMatch;
- @JsonProperty
- private boolean diskTypeMatch;
- @JsonProperty
- private boolean netInterfaceSpeedMatch;
- @JsonProperty
- private boolean diskAvailableMatch;
- @JsonProperty
- private boolean ipv4Match;
- @JsonProperty
- private boolean ipv6Match;
-
- public boolean isNetInterfaceSpeedMatch() {
- return netInterfaceSpeedMatch;
- }
-
- public void setNetInterfaceSpeedMatch(boolean netInterfaceSpeedMatch) {
- this.netInterfaceSpeedMatch = netInterfaceSpeedMatch;
- }
-
- public boolean isMemoryMatch() {
- return memoryMatch;
- }
-
- public void setMemoryMatch(boolean memoryMatch) {
- this.memoryMatch = memoryMatch;
- }
-
- public boolean isCpuCoresMatch() {
- return cpuCoresMatch;
- }
-
- public void setCpuCoresMatch(boolean cpuCoresMatch) {
- this.cpuCoresMatch = cpuCoresMatch;
- }
-
- public boolean isDiskTypeMatch() {
- return diskTypeMatch;
- }
-
- public void setDiskTypeMatch(boolean diskTypeMatch) {
- this.diskTypeMatch = diskTypeMatch;
- }
-
- public boolean isDiskAvailableMatch() {
- return diskAvailableMatch;
- }
-
- public void setDiskAvailableMatch(boolean diskAvailableMatch) {
- this.diskAvailableMatch = diskAvailableMatch;
- }
-
- public boolean isIpv4Match() {
- return ipv4Match;
- }
-
- public void setIpv4Match(boolean ipv4Match) {
- this.ipv4Match = ipv4Match;
- }
-
- public boolean isIpv6Match() {
- return ipv6Match;
- }
-
- public void setIpv6Match(boolean ipv6Match) {
- this.ipv6Match = ipv6Match;
- }
-
-}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/SpecReportMetrics.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/SpecReportMetrics.java
deleted file mode 100644
index 23ddba32d5c..00000000000
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/SpecReportMetrics.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package com.yahoo.vespa.hosted.node.verification.spec.yamasreport;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.yahoo.vespa.hosted.node.verification.spec.retrievers.HardwareInfo.DiskType;
-
-/**
- * Created by olaa on 12/07/2017.
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class SpecReportMetrics {
-
- @JsonProperty
- private boolean match;
- @JsonProperty
- private Double expectedMemoryAvailable;
- @JsonProperty
- private Double actualMemoryAvailable;
- @JsonProperty
- private DiskType expectedDiskType;
- @JsonProperty
- private DiskType actualDiskType;
- @JsonProperty
- private Double expectedDiskSpaceAvailable;
- @JsonProperty
- private Double actualDiskSpaceAvailable;
- @JsonProperty
- private Double expectedInterfaceSpeed;
- @JsonProperty
- private Double actualInterfaceSpeed;
- @JsonProperty
- private Integer expectedcpuCores;
- @JsonProperty
- private Integer actualcpuCores;
- @JsonProperty
- private String[] faultyIpAddresses;
- @JsonProperty
- private Boolean actualIpv6Connection;
- @JsonProperty
- private Boolean expectedIpv6Connection;
-
- public void setActualIpv6Connection(boolean actualIpv6Connection) {
- this.actualIpv6Connection = actualIpv6Connection;
- }
-
- public void setExpectedIpv6Connection(Boolean expectedIpv6Connection) {
- this.expectedIpv6Connection = expectedIpv6Connection;
- }
-
- public void setMatch(boolean match) {
- this.match = match;
- }
-
- public boolean isMatch() {
- return this.match;
- }
-
- public void setExpectedMemoryAvailable(Double expectedMemoryAvailable) {
- this.expectedMemoryAvailable = expectedMemoryAvailable;
- }
-
- public void setActualMemoryAvailable(Double actualMemoryAvailable) {
- this.actualMemoryAvailable = actualMemoryAvailable;
- }
-
- public void setExpectedDiskType(DiskType expectedFastDisk) {
- this.expectedDiskType = expectedFastDisk;
- }
-
- public void setActualDiskType(DiskType actualFastDisk) {
- this.actualDiskType = actualFastDisk;
- }
-
- public void setExpectedDiskSpaceAvailable(Double expectedDiskSpaceAvailable) {
- this.expectedDiskSpaceAvailable = expectedDiskSpaceAvailable;
- }
-
- public void setActualDiskSpaceAvailable(Double actualDiskSpaceAvailable) {
- this.actualDiskSpaceAvailable = actualDiskSpaceAvailable;
- }
-
- public void setExpectedcpuCores(int expectedcpuCores) {
- this.expectedcpuCores = expectedcpuCores;
- }
-
- public void setActualcpuCores(int actualcpuCores) {
- this.actualcpuCores = actualcpuCores;
- }
-
- public void setExpectedInterfaceSpeed(Double expectedInterfaceSpeed) {
- this.expectedInterfaceSpeed = expectedInterfaceSpeed;
- }
-
- public void setActualInterfaceSpeed(Double actualInterfaceSpeed) {
- this.actualInterfaceSpeed = actualInterfaceSpeed;
- }
-
- public void setFaultyIpAddresses(String[] faultyIpAddresses) {
- this.faultyIpAddresses = faultyIpAddresses;
- }
-
-}
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/YamasSpecReport.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/YamasSpecReport.java
deleted file mode 100644
index 7286c2d6d95..00000000000
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/YamasSpecReport.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.yahoo.vespa.hosted.node.verification.spec.yamasreport;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Created by olaa on 12/07/2017.
- */
-public class YamasSpecReport {
-
- @JsonProperty
- private long timeStamp;
- @JsonProperty
- private SpecReportDimensions dimensions;
- @JsonProperty
- private SpecReportMetrics metrics;
- @JsonProperty
- private JsonObjectWrapper<JsonObjectWrapper<String[]>> routing;
-
- public YamasSpecReport() {
- this.timeStamp = System.currentTimeMillis() / 1000L;
- setRouting();
- }
-
- public void setDimensions(SpecReportDimensions dimensions) {
- this.dimensions = dimensions;
- }
-
- public SpecReportDimensions getDimensions() {
- return this.dimensions;
- }
-
- public void setMetrics(SpecReportMetrics metrics) {
- this.metrics = metrics;
- }
-
- public void setFaultyIpAddresses(String[] faultyIpAddresses) {
- this.metrics.setFaultyIpAddresses(faultyIpAddresses);
- metrics.setMatch(false);
- }
-
- public SpecReportMetrics getMetrics() {
- return this.metrics;
- }
-
- public long getTimeStamp() {
- return this.timeStamp;
- }
-
- public void setTimeStamp(long timeStamp) {
- this.timeStamp = timeStamp;
- }
-
- private void setRouting() {
- JsonObjectWrapper<String[]> wrap = new JsonObjectWrapper<>("namespace", new String[]{"Vespa"});
- routing = new JsonObjectWrapper<>("yamas", wrap);
- }
-
- class JsonObjectWrapper<T> {
-
- private Map<String, T> wrappedObjects = new HashMap<String, T>();
-
- public JsonObjectWrapper(String name, T wrappedObject) {
- this.wrappedObjects.put(name, wrappedObject);
- }
-
- @JsonAnyGetter
- public Map<String, T> any() {
- return wrappedObjects;
- }
-
- @JsonAnySetter
- public void set(String name, T value) {
- wrappedObjects.put(name, value);
- }
- }
-
-}
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HostURLGeneratorTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/HostURLGeneratorTest.java
index f3c7637332f..8fe1e20b63e 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HostURLGeneratorTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/HostURLGeneratorTest.java
@@ -1,6 +1,7 @@
-package com.yahoo.vespa.hosted.node.verification.spec;
+package com.yahoo.vespa.hosted.node.verification.commons;
import com.yahoo.vespa.hosted.node.verification.mock.MockCommandExecutor;
+import com.yahoo.vespa.hosted.node.verification.commons.HostURLGenerator;
import org.junit.Before;
import org.junit.Test;
@@ -22,7 +23,7 @@ public class HostURLGeneratorTest {
private static final String CAT_WRONG_HOSTNAME_PATH = "cat src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/hostURLGeneratorExceptionTest";
private static final String CONFIG_SERVER_HOSTNAME = "http://cfg1.prod.region1:4080";
private static final String NODE_HOSTNAME_PREFIX = "/nodes/v2/node/";
- private static final String EXPECTED_HOSTNAME = "13305821.ostk.bm2.prod.gq1.yahoo.com";
+ private static final String EXPECTED_HOSTNAME = "expected.hostname";
@Before
public void setup() {
@@ -30,7 +31,7 @@ public class HostURLGeneratorTest {
}
@Test
- public void generateNodeInfoUrl_test_if_url_is_formatted_correctly() throws Exception {
+ public void generateNodeInfoUrl_find_config_server_test_if_url_is_formatted_correctly() throws Exception {
mockCommandExecutor.addCommand(CAT_CONFIG_SERVER_HOST_NAME_PATH);
mockCommandExecutor.addCommand(CAT_NODE_HOST_NAME_PATH);
ArrayList<URL> url = HostURLGenerator.generateNodeInfoUrl(mockCommandExecutor);
@@ -54,6 +55,16 @@ public class HostURLGeneratorTest {
}
@Test
+ public void generateNodeInfoUrl_retrieve_config_server_as_parameter_test_if_url_is_formatted_correctly() throws Exception {
+ mockCommandExecutor.addCommand(CAT_NODE_HOST_NAME_PATH);
+ String configServerHostname = "cfg1.prod.region1";
+ ArrayList<URL> actualUrls = HostURLGenerator.generateNodeInfoUrl(mockCommandExecutor, configServerHostname);
+ String expectedUrl = CONFIG_SERVER_HOSTNAME + NODE_HOSTNAME_PREFIX + EXPECTED_HOSTNAME;
+ String actualUrl = actualUrls.get(0).toString();
+ assertEquals(expectedUrl, actualUrl);
+ }
+
+ @Test
public void buildNodeInfoURL_should_add_protocol_and_port_in_front_when_protocol_is_absent() throws IOException {
String configServerHostName = "www.yahoo.com";
String nodeHostName = "index.html";
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/BenchmarkResultInspectorTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/BenchmarkResultInspectorTest.java
new file mode 100644
index 00000000000..55f5af05771
--- /dev/null
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/BenchmarkResultInspectorTest.java
@@ -0,0 +1,85 @@
+package com.yahoo.vespa.hosted.node.verification.hardware;
+
+import com.yahoo.vespa.hosted.node.verification.hardware.benchmarks.BenchmarkResults;
+import com.yahoo.vespa.hosted.node.verification.hardware.report.BenchmarkReport;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+
+public class BenchmarkResultInspectorTest {
+
+ private BenchmarkResults benchmarkResults;
+ private static final double VALID_CPU_FREQUENCY = 2.031;
+ private static final double INVALID_CPU_FREQUENCY = 0.1;
+ private static final double VALID_DISK_SPEED = 1100.0;
+ private static final double INVALID_DISK_SPEED = 0.1;
+ private static final double VALID_MEMORY_WRITE_SPEED = 1.7;
+ private static final double INVALID_MEMORY_WRITE_SPEED = 0.1;
+ private static final double VALID_MEMORY_READ_SPEED = 4.3;
+ private static final double INVALID_MEMORY_READ_SPEED = 0.1;
+
+ @Before
+ public void setup() {
+ benchmarkResults = new BenchmarkResults();
+ benchmarkResults.setCpuCyclesPerSec(VALID_CPU_FREQUENCY);
+ benchmarkResults.setDiskSpeedMbs(VALID_DISK_SPEED);
+ benchmarkResults.setMemoryWriteSpeedGBs(VALID_MEMORY_WRITE_SPEED);
+ benchmarkResults.setMemoryReadSpeedGBs(VALID_MEMORY_READ_SPEED);
+ }
+
+ @Test
+ public void isBenchmarkResultsValid_should_return_BenchmarkReport_with_all_values_null() {
+ BenchmarkReport benchmarkReport = BenchmarkResultInspector.makeBenchmarkReport(benchmarkResults);
+ assertNull(benchmarkReport.getCpuCyclesPerSec());
+ assertNull(benchmarkReport.getDiskSpeedMbs());
+ assertNull(benchmarkReport.getMemoryReadSpeedGBs());
+ assertNull(benchmarkReport.getMemoryWriteSpeedGBs());
+ }
+
+ @Test
+ public void isBenchmarkResultsValid_should_only_set_cpu_frequency() {
+ benchmarkResults.setCpuCyclesPerSec(INVALID_CPU_FREQUENCY);
+ BenchmarkReport benchmarkReport = BenchmarkResultInspector.makeBenchmarkReport(benchmarkResults);
+ assertNotNull(benchmarkReport.getCpuCyclesPerSec());
+ assertNull(benchmarkReport.getDiskSpeedMbs());
+ assertNull(benchmarkReport.getMemoryReadSpeedGBs());
+ assertNull(benchmarkReport.getMemoryWriteSpeedGBs());
+ }
+
+ @Test
+ public void isBenchmarkResultsValid_should_only_set_disk_speed() {
+ benchmarkResults.setDiskSpeedMbs(INVALID_DISK_SPEED);
+ BenchmarkReport benchmarkReport = BenchmarkResultInspector.makeBenchmarkReport(benchmarkResults);
+ assertNull(benchmarkReport.getCpuCyclesPerSec());
+ assertNotNull(benchmarkReport.getDiskSpeedMbs());
+ assertNull(benchmarkReport.getMemoryReadSpeedGBs());
+ assertNull(benchmarkReport.getMemoryWriteSpeedGBs());
+ }
+
+ @Test
+ public void isBenchmarkResultsValid_should_only_set_memory_read_speed() {
+ benchmarkResults.setMemoryReadSpeedGBs(INVALID_MEMORY_READ_SPEED);
+ BenchmarkReport benchmarkReport = BenchmarkResultInspector.makeBenchmarkReport(benchmarkResults);
+ assertNull(benchmarkReport.getCpuCyclesPerSec());
+ assertNull(benchmarkReport.getDiskSpeedMbs());
+ assertNotNull(benchmarkReport.getMemoryReadSpeedGBs());
+ assertNull(benchmarkReport.getMemoryWriteSpeedGBs());
+ }
+
+ @Test
+ public void isBenchmarkResultsValid_should_only_set_memory_write_speed() {
+ benchmarkResults.setMemoryWriteSpeedGBs(INVALID_MEMORY_WRITE_SPEED);
+ BenchmarkReport benchmarkReport = BenchmarkResultInspector.makeBenchmarkReport(benchmarkResults);
+ assertNull(benchmarkReport.getCpuCyclesPerSec());
+ assertNull(benchmarkReport.getDiskSpeedMbs());
+ assertNull(benchmarkReport.getMemoryReadSpeedGBs());
+ assertNotNull(benchmarkReport.getMemoryWriteSpeedGBs());
+ }
+
+} \ No newline at end of file
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/TerminationControllerTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/TerminationControllerTest.java
deleted file mode 100644
index 82bffd96b1e..00000000000
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/TerminationControllerTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.yahoo.vespa.hosted.node.verification.hardware;
-
-import com.yahoo.vespa.hosted.node.verification.hardware.benchmarks.BenchmarkResults;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-
-public class TerminationControllerTest {
-
- private BenchmarkResults benchmarkResults;
- private static final double VALID_CPU_FREQUENCY = 2.031;
- private static final double INVALID_CPU_FREQUENCY = 0.1;
- private static final double VALID_DISK_SPEED = 1100.0;
- private static final double INVALID_DISK_SPEED = 0.1;
- private static final double VALID_MEMORY_WRITE_SPEED = 1.7;
- private static final double INVALID_MEMORY_WRITE_SPEED = 0.1;
- private static final double VALID_MEMORY_READ_SPEED = 4.3;
- private static final double INVALID_MEMORY_READ_SPEED = 0.1;
-
- @Before
- public void setup() {
- benchmarkResults = new BenchmarkResults();
- benchmarkResults.setCpuCyclesPerSec(VALID_CPU_FREQUENCY);
- benchmarkResults.setDiskSpeedMbs(VALID_DISK_SPEED);
- benchmarkResults.setMemoryWriteSpeedGBs(VALID_MEMORY_WRITE_SPEED);
- benchmarkResults.setMemoryReadSpeedGBs(VALID_MEMORY_READ_SPEED);
- }
-
- @Test
- public void isBenchmarkResultsValid_should_return_true() {
- assertTrue(TerminationController.isBenchmarkResultsValid(benchmarkResults));
- }
-
- @Test
- public void isBenchmarkResultsValid_should_be_false_because_of_cpu_frequency() {
- benchmarkResults.setCpuCyclesPerSec(INVALID_CPU_FREQUENCY);
- assertFalse(TerminationController.isBenchmarkResultsValid(benchmarkResults));
- }
-
- @Test
- public void isBenchmarkResultsValid_should_be_false_because_of_disk_speed() {
- benchmarkResults.setDiskSpeedMbs(INVALID_DISK_SPEED);
- assertFalse(TerminationController.isBenchmarkResultsValid(benchmarkResults));
- }
-
- @Test
- public void isBenchmarkResultsValid_should_be_false_because_of_memory_write_speed() {
- benchmarkResults.setMemoryWriteSpeedGBs(INVALID_MEMORY_WRITE_SPEED);
- assertFalse(TerminationController.isBenchmarkResultsValid(benchmarkResults));
- }
-
- @Test
- public void isBenchmarkResultsValid_should_be_false_because_of_memory_read_speed() {
- benchmarkResults.setMemoryReadSpeedGBs(INVALID_MEMORY_READ_SPEED);
- assertFalse(TerminationController.isBenchmarkResultsValid(benchmarkResults));
- }
-
-} \ No newline at end of file
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/report/BenchmarkReportTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/report/BenchmarkReportTest.java
new file mode 100644
index 00000000000..8b501d4bcff
--- /dev/null
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/report/BenchmarkReportTest.java
@@ -0,0 +1,28 @@
+package com.yahoo.vespa.hosted.node.verification.hardware.report;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.yahoo.vespa.hosted.node.verification.hardware.benchmarks.BenchmarkResults;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class BenchmarkReportTest {
+
+ private BenchmarkReport benchmarkReport = new BenchmarkReport();
+
+ @Test
+ public void createFromHardwareResults_should_create_correct_report() throws Exception {
+ double expectedCpuCyclesPerSec = 4;
+ double expectedDiskSpeedMbps = 120;
+ double expectedMemoryReadSpeedGBs = 7.1;
+ double expectedMemoryWriteSpeedGBs = 5.9;
+ benchmarkReport.setCpuCyclesPerSec(expectedCpuCyclesPerSec);
+ benchmarkReport.setDiskSpeedMbs(expectedDiskSpeedMbps);
+ benchmarkReport.setMemoryReadSpeedGBs(expectedMemoryReadSpeedGBs);
+ benchmarkReport.setMemoryWriteSpeedGBs(expectedMemoryWriteSpeedGBs);
+ ObjectMapper om = new ObjectMapper();
+ String expectedResultJson = "{\"cpuCyclesPerSec\":4.0,\"diskSpeedMbs\":120.0,\"memoryWriteSpeedGBs\":5.9,\"memoryReadSpeedGBs\":7.1}";
+ assertEquals(expectedResultJson, om.writeValueAsString(benchmarkReport));
+ }
+
+} \ No newline at end of file
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/yamasreport/YamasHardwareReportTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/yamasreport/YamasHardwareReportTest.java
deleted file mode 100644
index 9f3f88163b2..00000000000
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/yamasreport/YamasHardwareReportTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.yahoo.vespa.hosted.node.verification.hardware.yamasreport;
-
-import com.yahoo.vespa.hosted.node.verification.hardware.benchmarks.BenchmarkResults;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class YamasHardwareReportTest {
-
- private YamasHardwareReport yamasHardwareReport = new YamasHardwareReport();
- private static final double DELTA = 0.1;
-
- @Test
- public void createFromHardwareResults_should_create_correct_report() {
- double expectedCpuCyclesPerSec = 4;
- double expectedDiskSpeedMbps = 120;
- double expectedMemoryReadSpeedGBs = 7.1;
- double expectedMemoryWriteSpeedGBs = 5.9;
- BenchmarkResults benchmarkResults = new BenchmarkResults();
- benchmarkResults.setCpuCyclesPerSec(expectedCpuCyclesPerSec);
- benchmarkResults.setDiskSpeedMbs(expectedDiskSpeedMbps);
- benchmarkResults.setMemoryReadSpeedGBs(expectedMemoryReadSpeedGBs);
- benchmarkResults.setMemoryWriteSpeedGBs(expectedMemoryWriteSpeedGBs);
- yamasHardwareReport.createReportFromBenchmarkResults(benchmarkResults);
- assertEquals(expectedCpuCyclesPerSec, yamasHardwareReport.getMetrics().getCpuCyclesPerSec(), DELTA);
- assertEquals(expectedDiskSpeedMbps, yamasHardwareReport.getMetrics().getDiskSpeedMbs(), DELTA);
- assertEquals(expectedMemoryReadSpeedGBs, yamasHardwareReport.getMetrics().getMemoryReadSpeedGBs(), DELTA);
- assertEquals(expectedMemoryWriteSpeedGBs, yamasHardwareReport.getMetrics().getMemoryWriteSpeedGBs(), DELTA);
- }
-
-} \ No newline at end of file
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparatorTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparatorTest.java
index ec621189269..30dff7c1c42 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparatorTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparatorTest.java
@@ -1,10 +1,12 @@
package com.yahoo.vespa.hosted.node.verification.spec;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.yahoo.vespa.hosted.node.verification.spec.retrievers.HardwareInfo;
import com.yahoo.vespa.hosted.node.verification.spec.retrievers.HardwareInfo.DiskType;
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -31,23 +33,29 @@ public class HardwareNodeComparatorTest {
}
@Test
- public void compare_should_be_equal() {
- assertTrue(HardwareNodeComparator.compare(nodeInfo, actualHardware).getMetrics().isMatch());
+ public void compare_equal_hardware_should_create_emmpty_json() throws Exception {
+ String actualJson = new ObjectMapper().writeValueAsString(HardwareNodeComparator.compare(nodeInfo, actualHardware));
+ String expectedJson = "{}";
+ assertEquals(expectedJson, actualJson);
}
@Test
- public void compare_different_amount_of_cores_should_be_false() {
+ public void compare_different_amount_of_cores_should_create_json_with_actual_core_amount() throws Exception {
actualHardware.setMinCpuCores(4);
nodeInfo.setMinCpuCores(1);
- assertFalse(HardwareNodeComparator.compare(nodeInfo, actualHardware).getMetrics().isMatch());
+ String actualJson = new ObjectMapper().writeValueAsString(HardwareNodeComparator.compare(nodeInfo, actualHardware));
+ String expectedJson = "{\"actualcpuCores\":4}";
+ assertEquals(expectedJson, actualJson);
}
@Test
- public void compare_different_disk_type_should_return_false() {
- actualHardware.setDiskType(DiskType.UNKNOWN);
+ public void compare_different_disk_type_should_create_json_with_actual_disk_type() throws Exception {
+ actualHardware.setDiskType(DiskType.SLOW);
nodeInfo.setDiskType(DiskType.FAST);
- assertFalse(HardwareNodeComparator.compare(nodeInfo, actualHardware).getMetrics().isMatch());
+ String actualJson = new ObjectMapper().writeValueAsString(HardwareNodeComparator.compare(nodeInfo, actualHardware));
+ String expectedJson = "{\"actualDiskType\":\"SLOW\"}";
+ assertEquals(expectedJson, actualJson);
}
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifierTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifierTest.java
index b2fccbf2091..6d6708f938f 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifierTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifierTest.java
@@ -5,7 +5,7 @@ import com.yahoo.vespa.hosted.node.verification.mock.MockCommandExecutor;
import com.yahoo.vespa.hosted.node.verification.spec.noderepo.NodeRepoInfoRetriever;
import com.yahoo.vespa.hosted.node.verification.spec.noderepo.NodeRepoJsonModel;
import com.yahoo.vespa.hosted.node.verification.spec.retrievers.HardwareInfo;
-import com.yahoo.vespa.hosted.node.verification.spec.yamasreport.YamasSpecReport;
+import com.yahoo.vespa.hosted.node.verification.spec.report.VerificationReport;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -27,92 +27,86 @@ public class SpecVerifierTest {
private static final String RESOURCE_PATH = "src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources";
private static final String URL_RESOURCE_PATH = "file://" + ABSOLUTE_PATH + "/" + RESOURCE_PATH;
private static final String NODE_REPO_PATH = "src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeInfoTest.json";
- private static final String YAMAS_REPORT_PATH = "src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/SpecVerifierReport";
private static final String CPU_INFO_PATH = RESOURCE_PATH + "/cpuinfoTest";
private static final String MEMORY_INFO_PATH = RESOURCE_PATH + "/meminfoTest";
- private static final String DISK_TYPE_INFO_PATH = RESOURCE_PATH + "/DiskTypeFastDisk";
+ private static final String FAST_DISK_TYPE_INFO_PATH = RESOURCE_PATH + "/DiskTypeFastDisk";
+ private static final String NON_FAST_DISK_TYPE_INFO_PATH = RESOURCE_PATH + "/DiskTypeNonFastDisk";
private static final String DISK_SIZE_INFO_PATH = RESOURCE_PATH + "/filesize";
private static final String NET_INTERFACE_INFO_PATH = RESOURCE_PATH + "/ifconfig";
private static final String NET_INTERFACE_SPEED_INFO_PATH = RESOURCE_PATH + "/eth0";
private static final String PING_RESPONSE = RESOURCE_PATH + "/validpingresponse";
private static final String INVALID_PING_RESPONSE = RESOURCE_PATH + "/pingresponse-all-packets-lost";
private static final double DELTA = 0.1;
+ ArrayList<URL> nodeInfoUrls;
@Before
public void setup() {
mockCommandExecutor = new MockCommandExecutor();
+ nodeInfoUrls = new ArrayList<>();
+
}
@Test
- @Ignore
public void verifySpec_equal_nodeRepoInfo_and_hardware_should_return_true() throws Exception {
- mockCommandExecutor.addCommand("echo notUsed " + URL_RESOURCE_PATH);
- mockCommandExecutor.addCommand("echo nodeRepo.json");
+ nodeInfoUrls.add(new URL(URL_RESOURCE_PATH + "/nodeRepo.json"));
mockCommandExecutor.addCommand("cat " + CPU_INFO_PATH);
mockCommandExecutor.addCommand("cat " + MEMORY_INFO_PATH);
- mockCommandExecutor.addCommand("cat " + DISK_TYPE_INFO_PATH);
+ mockCommandExecutor.addCommand("cat " + FAST_DISK_TYPE_INFO_PATH);
mockCommandExecutor.addCommand("cat " + DISK_SIZE_INFO_PATH);
mockCommandExecutor.addCommand("cat " + NET_INTERFACE_INFO_PATH);
mockCommandExecutor.addCommand("cat " + NET_INTERFACE_SPEED_INFO_PATH);
mockCommandExecutor.addCommand("cat " + PING_RESPONSE);
- assertTrue(SpecVerifier.verifySpec(mockCommandExecutor));
+ assertTrue(SpecVerifier.verifySpec(mockCommandExecutor, nodeInfoUrls));
}
@Test
public void verifySpec_environment_is_virtual_machine_should_return_true() throws Exception {
- mockCommandExecutor.addCommand("echo notUsed " + URL_RESOURCE_PATH);
- mockCommandExecutor.addCommand("echo nodeRepoVirtualMachine.json");
- assertTrue(SpecVerifier.verifySpec(mockCommandExecutor));
+ nodeInfoUrls.add(new URL(URL_RESOURCE_PATH + "/nodeRepoVirtualMachine.json"));
+ assertTrue(SpecVerifier.verifySpec(mockCommandExecutor, nodeInfoUrls));
}
@Test
public void verifySpec_unequal_nodeRepoInfo_and_hardware_should_return_false() throws Exception {
- mockCommandExecutor.addCommand("echo notUsed " + URL_RESOURCE_PATH);
- mockCommandExecutor.addCommand("echo nodeRepo.json");
+ nodeInfoUrls.add(new URL(URL_RESOURCE_PATH + "/nodeRepo.json"));
mockCommandExecutor.addCommand("cat " + CPU_INFO_PATH);
mockCommandExecutor.addCommand("cat " + MEMORY_INFO_PATH);
- mockCommandExecutor.addCommand("cat " + DISK_TYPE_INFO_PATH);
+ mockCommandExecutor.addCommand("cat " + NON_FAST_DISK_TYPE_INFO_PATH);
mockCommandExecutor.addCommand("cat " + DISK_SIZE_INFO_PATH);
mockCommandExecutor.addCommand("cat " + NET_INTERFACE_INFO_PATH + "NoIpv6");
mockCommandExecutor.addCommand("cat " + NET_INTERFACE_SPEED_INFO_PATH);
mockCommandExecutor.addCommand("cat " + INVALID_PING_RESPONSE);
- assertFalse(SpecVerifier.verifySpec(mockCommandExecutor));
+ assertFalse(SpecVerifier.verifySpec(mockCommandExecutor, nodeInfoUrls));
}
@Test
- public void makeYamasSpecReport_should_return_false_interface_speed_and_ipv6_connection() throws Exception {
+ public void makeVerificationSpecReport_should_return_false_interface_speed_and_ipv6_connection() throws Exception {
HardwareInfo actualHardware = new HardwareInfo();
actualHardware.setMinCpuCores(24);
actualHardware.setMinMainMemoryAvailableGb(24);
- actualHardware.setInterfaceSpeedMbs(10009); //this is wrong
+ actualHardware.setInterfaceSpeedMbs(100); //this is wrong
actualHardware.setMinDiskAvailableGb(500);
actualHardware.setIpv4Interface(true);
- actualHardware.setIpv6Interface(false);
+ actualHardware.setIpv6Interface(true);
actualHardware.setIpv6Connection(true);
actualHardware.setDiskType(HardwareInfo.DiskType.SLOW);
- ArrayList<URL> url = new ArrayList<>(Arrays.asList(new File(NODE_REPO_PATH).toURI().toURL()));
- NodeRepoJsonModel nodeRepoJsonModel = NodeRepoInfoRetriever.retrieve(url);
- YamasSpecReport yamasSpecReport = SpecVerifier.makeYamasSpecReport(actualHardware, nodeRepoJsonModel);
- long timeStamp = 1501504035;
- yamasSpecReport.setTimeStamp(timeStamp);
- String expectedJson = MockCommandExecutor.readFromFile(YAMAS_REPORT_PATH).get(0);
+ nodeInfoUrls.add(new File(NODE_REPO_PATH).toURI().toURL());
+ NodeRepoJsonModel nodeRepoJsonModel = NodeRepoInfoRetriever.retrieve(nodeInfoUrls);
+ VerificationReport verificationSpecReport = SpecVerifier.makeVerificationReport(actualHardware, nodeRepoJsonModel);
+ String expectedJson = "{\"actualInterfaceSpeed\":100.0}";
ObjectMapper om = new ObjectMapper();
- String actualJson = om.writeValueAsString(yamasSpecReport);
+ String actualJson = om.writeValueAsString(verificationSpecReport);
assertEquals(expectedJson, actualJson);
}
@Test
public void getNodeRepositoryJSON_should_return_valid_nodeRepoJSONModel() throws Exception {
- mockCommandExecutor.addCommand("echo notUsed " + URL_RESOURCE_PATH);
- mockCommandExecutor.addCommand("echo nodeRepo.json");
- NodeRepoJsonModel actualNodeRepoJsonModel = SpecVerifier.getNodeRepositoryJSON(mockCommandExecutor);
+ nodeInfoUrls.add(new URL(URL_RESOURCE_PATH + "/nodeRepo.json"));
+ NodeRepoJsonModel actualNodeRepoJsonModel = SpecVerifier.getNodeRepositoryJSON(nodeInfoUrls);
double expectedMinCpuCores = 4D;
double expectedMinMainMemoryAvailableGb = 4.04D;
double expectedMinDiskAvailableGb = 1759.84;
boolean expectedFastDisk = true;
- String expectedIpv6Address = "2001:4998:c:2940:0:0:0:111c";
- assertEquals(expectedIpv6Address, actualNodeRepoJsonModel.getIpv6Address());
assertEquals(expectedMinCpuCores, actualNodeRepoJsonModel.getMinCpuCores(), DELTA);
assertEquals(expectedMinMainMemoryAvailableGb, actualNodeRepoJsonModel.getMinMainMemoryAvailableGb(), DELTA);
assertEquals(expectedMinDiskAvailableGb, actualNodeRepoJsonModel.getMinDiskAvailableGb(), DELTA);
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/report/VerificationReportTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/report/VerificationReportTest.java
new file mode 100644
index 00000000000..2f7bc75af75
--- /dev/null
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/report/VerificationReportTest.java
@@ -0,0 +1,43 @@
+package com.yahoo.vespa.hosted.node.verification.spec.report;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.yahoo.vespa.hosted.node.verification.mock.MockCommandExecutor;
+import com.yahoo.vespa.hosted.node.verification.spec.retrievers.HardwareInfo;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class VerificationReportTest {
+
+ private VerificationReport verificationReport;
+ private static final String REPORT_PATH = "src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/reportJSON";
+
+ @Before
+ public void setup() {
+ verificationReport = new VerificationReport();
+ }
+
+ @Test
+ public void VerificationReport_returns_empty_string_when_all_specs_are_correct() throws Exception {
+ String expectedJson = "{}";
+ ObjectMapper om = new ObjectMapper();
+ String actualJson = om.writeValueAsString(verificationReport);
+ assertEquals(expectedJson, actualJson);
+ }
+
+ @Test
+ public void Json_is_in_wanted_format_when_all_specs_are_wrong() throws Exception {
+ verificationReport.setActualInterfaceSpeed(100D);
+ verificationReport.setActualDiskSpaceAvailable(500D);
+ verificationReport.setActualDiskType(HardwareInfo.DiskType.FAST);
+ verificationReport.setActualMemoryAvailable(123D);
+ verificationReport.setActualcpuCores(4);
+ verificationReport.setFaultyIpAddresses(new String[]{"2001:4998:44:505d:0:0:0:2618"});
+ String expectedJson = MockCommandExecutor.readFromFile(REPORT_PATH).get(0);
+ ObjectMapper om = new ObjectMapper();
+ String actualJson = om.writeValueAsString(verificationReport);
+ assertEquals(expectedJson, actualJson);
+ }
+
+} \ No newline at end of file
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/SpecVerifierReport b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/SpecVerifierReport
index 39022f761cd..c0dcdcbad49 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/SpecVerifierReport
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/SpecVerifierReport
@@ -1 +1 @@
-{"timeStamp":1501504035,"dimensions":{"memoryMatch":true,"cpuCoresMatch":true,"diskTypeMatch":true,"netInterfaceSpeedMatch":false,"diskAvailableMatch":true,"ipv4Match":true,"ipv6Match":true},"metrics":{"match":false,"expectedInterfaceSpeed":1000.0,"actualInterfaceSpeed":10009.0,"actualIpv6Connection":true,"expectedIpv6Connection":false},"routing":{"yamas":{"namespace":["Vespa"]}}}
+{"timeStamp":1501504035,"dimensions":{"memoryMatch":true,"cpuCoresMatch":true,"diskTypeMatch":true,"netInterfaceSpeedMatch":true,"diskAvailableMatch":true,"ipv4Match":true,"ipv6Match":true},"metrics":{"match":true,"actualIpv6Connection":true,"expectedIpv6Connection":false},"routing":{"yamas":{"namespace":["Vespa"]}}} \ No newline at end of file
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/hostURLGeneratorTest b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/hostURLGeneratorTest
index 32258f52c05..7e62b32ad26 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/hostURLGeneratorTest
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/hostURLGeneratorTest
@@ -1 +1 @@
-13305821.ostk.bm2.prod.gq1.yahoo.com \ No newline at end of file
+expected.hostname \ No newline at end of file
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodes/v2/node/nodeRepo.json b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeRepo.json
index fd2313e3c34..ad2444c9076 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodes/v2/node/nodeRepo.json
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeRepo.json
@@ -1,6 +1,5 @@
{
"url": "https://example.com:4443/zone/v2/prod/us-west-1/nodes/v2/node/host.name",
- "id": "zt74722.ostk.bm2.prod.gq1.yahoo.com",
"state": "active",
"type": "host",
"hostname": "host.name",
@@ -73,8 +72,6 @@
}
],
"ipAddresses": [
- "10.213.181.113",
- "2001:4998:c:2940::111c"
],
"additionalIpAddresses": [
]
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodes/v2/node/nodeRepoVirtualMachine.json b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeRepoVirtualMachine.json
index 100e9337f9d..100e9337f9d 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodes/v2/node/nodeRepoVirtualMachine.json
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeRepoVirtualMachine.json
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/reportJSON b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/reportJSON
new file mode 100644
index 00000000000..9b874f1be68
--- /dev/null
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/reportJSON
@@ -0,0 +1 @@
+{"actualMemoryAvailable":123.0,"actualDiskType":"FAST","actualDiskSpaceAvailable":500.0,"actualInterfaceSpeed":100.0,"actualcpuCores":4,"faultyIpAddresses":["2001:4998:44:505d:0:0:0:2618"]} \ No newline at end of file
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/yamasJSON b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/yamasJSON
deleted file mode 100644
index 1a9d7b610f0..00000000000
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/yamasJSON
+++ /dev/null
@@ -1 +0,0 @@
-{"timeStamp":1501504035,"dimensions":{"memoryMatch":true,"cpuCoresMatch":true,"diskTypeMatch":true,"netInterfaceSpeedMatch":true,"diskAvailableMatch":true,"ipv4Match":true,"ipv6Match":true},"metrics":{"match":true,"expectedMemoryAvailable":123.0,"actualMemoryAvailable":123.0,"expectedDiskType":"FAST","actualDiskType":"FAST","expectedDiskSpaceAvailable":500.0,"actualDiskSpaceAvailable":500.0,"expectedInterfaceSpeed":100.0,"actualInterfaceSpeed":100.0,"expectedcpuCores":4,"actualcpuCores":4},"routing":{"yamas":{"namespace":["Vespa"]}}}
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfoRetrieverTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfoRetrieverTest.java
index ffa0a44feb3..c068ca83de9 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfoRetrieverTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfoRetrieverTest.java
@@ -2,8 +2,11 @@ package com.yahoo.vespa.hosted.node.verification.spec.retrievers;
import com.yahoo.vespa.hosted.node.verification.mock.MockCommandExecutor;
+import com.yahoo.vespa.hosted.node.verification.spec.VerifierSettings;
import org.junit.Before;
import org.junit.Test;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
import static org.junit.Assert.assertEquals;
@@ -19,6 +22,7 @@ public class HardwareInfoRetrieverTest {
private static String PING_RESPONSE = RESOURCE_PATH + "invalidpingresponse";
private MockCommandExecutor mockCommandExecutor;
private HardwareInfo expectedHardwareInfo;
+ private VerifierSettings verifierSettings = spy(new VerifierSettings());
private static final double DELTA = 0.1;
@Before
@@ -45,7 +49,8 @@ public class HardwareInfoRetrieverTest {
@Test
public void retriever_should_return_valid_HardwareInfo() {
- HardwareInfo actualHardwareInfo = HardwareInfoRetriever.retrieve(mockCommandExecutor);
+ doReturn(true).when(verifierSettings).isCheckIPv6();
+ HardwareInfo actualHardwareInfo = HardwareInfoRetriever.retrieve(mockCommandExecutor, verifierSettings);
assertEquals(expectedHardwareInfo.getMinDiskAvailableGb(), actualHardwareInfo.getMinDiskAvailableGb(), DELTA);
assertEquals(expectedHardwareInfo.getMinMainMemoryAvailableGb(), actualHardwareInfo.getMinMainMemoryAvailableGb(), DELTA);
assertEquals(expectedHardwareInfo.getMinCpuCores(), actualHardwareInfo.getMinCpuCores());
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetrieverTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetrieverTest.java
index e20304b8448..365e2f2f9d4 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetrieverTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetrieverTest.java
@@ -2,6 +2,7 @@ package com.yahoo.vespa.hosted.node.verification.spec.retrievers;
import com.yahoo.vespa.hosted.node.verification.commons.ParseResult;
import com.yahoo.vespa.hosted.node.verification.mock.MockCommandExecutor;
+import com.yahoo.vespa.hosted.node.verification.spec.VerifierSettings;
import org.junit.Before;
import org.junit.Test;
@@ -13,6 +14,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
/**
* Created by sgrostad on 07/07/2017.
@@ -29,13 +32,15 @@ public class NetRetrieverTest {
private MockCommandExecutor commandExecutor;
private NetRetriever net;
private ArrayList<ParseResult> parseResults;
+ private VerifierSettings verifierSettings = spy(new VerifierSettings());
private static final double DELTA = 0.1;
@Before
public void setup() {
hardwareInfo = new HardwareInfo();
commandExecutor = new MockCommandExecutor();
- net = new NetRetriever(hardwareInfo, commandExecutor);
+ doReturn(true).when(verifierSettings).isCheckIPv6();
+ net = new NetRetriever(hardwareInfo, commandExecutor, verifierSettings);
parseResults = new ArrayList<>();
}
@@ -53,21 +58,13 @@ public class NetRetrieverTest {
}
@Test
- public void findInterface_valid_input() throws IOException {
- commandExecutor.addCommand("cat " + NET_FIND_INTERFACE);
- parseResults = net.findInterface();
- ParseResult expectedParseResult = new ParseResult("interface name", "eth0");
- assertEquals(expectedParseResult, parseResults.get(2));
- }
-
- @Test
public void findInterfaceSpeed_valid_input() throws IOException {
commandExecutor.addCommand("cat " + NET_FIND_INTERFACE);
commandExecutor.addCommand("cat " + NET_CHECK_INTERFACE_SPEED);
parseResults = net.findInterface();
net.findInterfaceSpeed(parseResults);
ParseResult expectedParseResults = new ParseResult("Speed", "1000Mb/s");
- assertEquals(expectedParseResults, parseResults.get(3));
+ assertEquals(expectedParseResults, parseResults.get(2));
}
@Test
@@ -84,21 +81,11 @@ public class NetRetrieverTest {
ArrayList<String> mockOutput = MockCommandExecutor.readFromFile(NET_FIND_INTERFACE + "NoIpv6");
parseResults = net.parseNetInterface(mockOutput);
ArrayList<ParseResult> expextedParseResults = new ArrayList<>(Arrays.asList(
- new ParseResult("inet", "inet"),
- new ParseResult("interface name", "eth0")));
+ new ParseResult("inet", "inet")));
assertEquals(expextedParseResults, parseResults);
}
@Test
- public void parseNetInterface_get_interfaceName_from_ifconfig_testFile() throws IOException {
- ArrayList<String> mockOutput = MockCommandExecutor.readFromFile(NET_FIND_INTERFACE);
- parseResults = net.parseNetInterface(mockOutput);
- String interfaceName = net.getInterfaceName(parseResults);
- String expectedInterfaceName = "eth0";
- assertEquals(expectedInterfaceName, interfaceName);
- }
-
- @Test
public void parseInterfaceSpeed_get_interfaceSpeed_from_eth0_testFile() throws IOException {
ArrayList<String> mockOutput = MockCommandExecutor.readFromFile("src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/eth0");
ParseResult parseResult = net.parseInterfaceSpeed(mockOutput);
@@ -106,23 +93,9 @@ public class NetRetrieverTest {
assertEquals(expectedParseResult, parseResult);
}
- @Test
- public void findInterfaceName_should_return_interface_name() {
- parseResults.add(new ParseResult("interface name", "eth0"));
- String expectedInterfaceName = "eth0";
- assertEquals(expectedInterfaceName, net.getInterfaceName(parseResults));
- }
-
- @Test
- public void findInterfaceName_should_return_empty_interface_name() {
- parseResults.add(new ParseResult("et", "et0"));
- String expectedInterfaceName = "";
- assertEquals(expectedInterfaceName, net.getInterfaceName(parseResults));
- }
@Test
public void updateHardwareinfoWithNet_valid_input() {
- parseResults.add(new ParseResult("interface name", "eth0"));
parseResults.add(new ParseResult("inet", "inet"));
parseResults.add(new ParseResult("inet6", "inet6"));
parseResults.add(new ParseResult("Speed", "1000Mb/s"));
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/YamasSpecReportTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/YamasSpecReportTest.java
deleted file mode 100644
index 5fe7b015c44..00000000000
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/YamasSpecReportTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.yahoo.vespa.hosted.node.verification.spec.yamasreport;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.yahoo.vespa.hosted.node.verification.mock.MockCommandExecutor;
-import com.yahoo.vespa.hosted.node.verification.spec.retrievers.HardwareInfo;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Created by olaa on 12/07/2017.
- */
-public class YamasSpecReportTest {
-
- private SpecReportDimensions specReportDimensions;
- private SpecReportMetrics specReportMetrics;
- private static final String YAMAS_REPORT_PATH = "src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/yamasJSON";
-
-
- @Before
- public void setup() {
- specReportDimensions = new SpecReportDimensions();
- specReportMetrics = new SpecReportMetrics();
- specReportDimensions.setCpuCoresMatch(true);
- specReportDimensions.setDiskAvailableMatch(true);
- specReportDimensions.setIpv4Match(true);
- specReportDimensions.setIpv6Match(true);
- specReportDimensions.setMemoryMatch(true);
- specReportDimensions.setNetInterfaceSpeedMatch(true);
- specReportDimensions.setDiskTypeMatch(true);
- specReportMetrics.setActualInterfaceSpeed(100D);
- specReportMetrics.setExpectedInterfaceSpeed(100D);
- specReportMetrics.setActualDiskSpaceAvailable(500D);
- specReportMetrics.setExpectedDiskSpaceAvailable(500D);
- specReportMetrics.setActualDiskType(HardwareInfo.DiskType.FAST);
- specReportMetrics.setExpectedDiskType(HardwareInfo.DiskType.FAST);
- specReportMetrics.setActualMemoryAvailable(123D);
- specReportMetrics.setExpectedMemoryAvailable(123D);
- specReportMetrics.setActualcpuCores(4);
- specReportMetrics.setExpectedcpuCores(4);
- specReportMetrics.setMatch(true);
- }
-
- @Test
- public void Json_is_in_wanted_format() throws Exception {
- YamasSpecReport yamasSpecReport = new YamasSpecReport();
- yamasSpecReport.setMetrics(specReportMetrics);
- yamasSpecReport.setDimensions(specReportDimensions);
- yamasSpecReport.setMetrics(specReportMetrics);
- long timeStamp = 1501504035;
- yamasSpecReport.setTimeStamp(timeStamp);
- String expectedJson = MockCommandExecutor.readFromFile(YAMAS_REPORT_PATH).get(0);
- ObjectMapper om = new ObjectMapper();
- String json = om.writeValueAsString(yamasSpecReport);
- assertEquals(expectedJson, json);
- }
-
-} \ No newline at end of file