Changed how net interface and connection is compared. No longer cares if node repo says shouldn't have interface, even though it actually has
@@ -64,13 +64,45 @@ public class HardwareNodeComparator {
private static void setNetMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, VerificationReport verificationReport) {
double expectedInterfaceSpeed = nodeRepoHardwareInfo.getInterfaceSpeedMbs();
double actualInterfaceSpeed = actualHardware.getInterfaceSpeedMbs();
- if (expectedInterfaceSpeed > actualInterfaceSpeed) {
- verificationReport.setActualInterfaceSpeed(actualInterfaceSpeed);
+ if (nodeRepoHardwareInfo.getInterfaceSpeedMbs() > actualHardware.getInterfaceSpeedMbs()) {
+ specReportMetrics.setExpectedInterfaceSpeed(expectedInterfaceSpeed);
+ specReportMetrics.setActualInterfaceSpeed(actualInterfaceSpeed);
}
- if (nodeRepoHardwareInfo.isIpv6Connection() && !actualHardware.isIpv6Connection()) {
- verificationReport.setActualIpv6Connection(actualHardware.isIpv6Connection());
+ if (nodeRepoHardwareInfo.isIpv6Connection() != actualHardware.isIpv6Connection()) {
+ specReportMetrics.setActualIpv6Connection(actualHardware.isIpv6Connection());
+ specReportMetrics.setExpectedIpv6Connection(nodeRepoHardwareInfo.isIpv6Connection());
}
+
+ 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 = nodeRepoHardwareInfo.getInterfaceSpeedMbs() <= actualHardware.getInterfaceSpeedMbs();
+ 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;
+ }
+
+ 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;
}
private static boolean outsideThreshold(double value1, double value2 , double thresholdPercentage) {
