-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #114: Last modification and tests
Issue #114: Developed IPMI extension Developed IPMI extension.
- Loading branch information
1 parent
ba71684
commit 6811ed9
Showing
30 changed files
with
1,407 additions
and
705 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 0 additions & 83 deletions
83
...rc/main/java/org/sentrysoftware/metricshub/agent/config/protocols/IpmiProtocolConfig.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
...nt/src/test/java/org/sentrysoftware/metricshub/agent/extension/IpmiTestConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package org.sentrysoftware.metricshub.agent.extension; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.sentrysoftware.metricshub.engine.common.exception.InvalidConfigurationException; | ||
import org.sentrysoftware.metricshub.engine.common.helpers.StringHelper; | ||
import org.sentrysoftware.metricshub.engine.configuration.IConfiguration; | ||
|
||
/** | ||
* The IpmiConfiguration class represents the configuration for IPMI (Intelligent Platform Management Interface) connections | ||
* in the MetricsHub engine. | ||
*/ | ||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class IpmiTestConfiguration implements IConfiguration { | ||
|
||
@Builder.Default | ||
private final Long timeout = 120L; | ||
|
||
private String username; | ||
private char[] password; | ||
private byte[] bmcKey; | ||
private boolean skipAuth; | ||
|
||
@Override | ||
public String toString() { | ||
String description = "IPMI"; | ||
if (username != null) { | ||
description = description + " as " + username; | ||
} | ||
return description; | ||
} | ||
|
||
/** | ||
* Validate the given IPMI information (username and timeout) | ||
* | ||
* @param resourceKey Resource unique identifier | ||
* @throws InvalidConfigurationException | ||
*/ | ||
@Override | ||
public void validateConfiguration(String resourceKey) throws InvalidConfigurationException { | ||
StringHelper.validateConfigurationAttribute( | ||
username, | ||
attr -> attr == null || attr == "", | ||
() -> | ||
String.format( | ||
"Resource %s - Username value is invalid for protocol %s." + | ||
" Timeout value returned: %s. This resource will not be monitored. Please verify the configured timeout value.", | ||
resourceKey, | ||
"HTTP", | ||
timeout | ||
) | ||
); | ||
|
||
StringHelper.validateConfigurationAttribute( | ||
timeout, | ||
attr -> attr == null || attr < 0L, | ||
() -> | ||
String.format( | ||
"Resource %s - Timeout value is invalid for protocol %s." + | ||
" Timeout value returned: %s. This resource will not be monitored. Please verify the configured timeout value.", | ||
resourceKey, | ||
"HTTP", | ||
timeout | ||
) | ||
); | ||
|
||
StringHelper.validateConfigurationAttribute( | ||
timeout, | ||
attr -> attr == null || attr < 0L, | ||
() -> | ||
String.format( | ||
"Resource %s - Timeout value is invalid for protocol %s." + | ||
" Timeout value returned: %s. This resource will not be monitored. Please verify the configured timeout value.", | ||
resourceKey, | ||
"HTTP", | ||
timeout | ||
) | ||
); | ||
|
||
StringHelper.validateConfigurationAttribute( | ||
timeout, | ||
attr -> attr == null || attr < 0L, | ||
() -> | ||
String.format( | ||
"Resource %s - Timeout value is invalid for protocol %s." + | ||
" Timeout value returned: %s. This resource will not be monitored. Please verify the configured timeout value.", | ||
resourceKey, | ||
"HTTP", | ||
timeout | ||
) | ||
); | ||
} | ||
} |
Oops, something went wrong.