summaryrefslogtreecommitdiffstats
path: root/participant/participant-impl
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-impl')
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java14
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java3
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java4
3 files changed, 14 insertions, 7 deletions
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java
index e1e9195eb..3f2113d98 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java
@@ -20,9 +20,9 @@
package org.onap.policy.clamp.controlloop.participant.kubernetes.handler;
-
import java.io.IOException;
import java.lang.invoke.MethodHandles;
+import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@@ -30,6 +30,7 @@ import java.util.concurrent.ConcurrentHashMap;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
@@ -51,7 +52,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
/**
* This class handles implementation of controlLoopElement updates.
*/
@@ -170,10 +170,16 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
* Overridden method.
*
* @param controlLoopElementId controlLoopElement id
- * @throws PfModelException incase of error
+ * @throws PfModelException in case of error
*/
@Override
public synchronized void handleStatistics(UUID controlLoopElementId) throws PfModelException {
- // TODO Implement statistics functionality
+ var clElement = intermediaryApi.getControlLoopElement(controlLoopElementId);
+ if (clElement != null) {
+ var clElementStatistics = new ClElementStatistics();
+ clElementStatistics.setControlLoopState(clElement.getState());
+ clElementStatistics.setTimeStamp(Instant.now());
+ intermediaryApi.updateControlLoopElementStatistics(controlLoopElementId, clElementStatistics);
+ }
}
}
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java
index 1c405539b..31fa62f1f 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java
@@ -47,6 +47,7 @@ public class HelmClient {
private ChartStore chartStore;
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+ private static final String PATH_DELIMITER = "/";
/**
* Install a chart.
@@ -100,7 +101,7 @@ public class HelmClient {
}
var localHelmChartDir = chartStore.getAppPath(chart.getChartId()).toString();
logger.info("Chart not found in helm repositories, verifying local repo {} ", localHelmChartDir);
- if (verifyLocalHelmRepo(new File(localHelmChartDir + "/" + chart.getChartId().getName()))) {
+ if (verifyLocalHelmRepo(new File(localHelmChartDir + PATH_DELIMITER + chart.getChartId().getName()))) {
repository = localHelmChartDir;
}
return repository;
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java
index f6d616dac..901fb682b 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java
@@ -102,7 +102,7 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
break;
case PASSIVE:
try {
- undeployPolicies(controlLoopElementId, orderedState);
+ undeployPolicies(controlLoopElementId);
} catch (PfModelRuntimeException e) {
LOGGER.debug("Undeploying policies failed - no policies to undeploy {}", controlLoopElementId);
}
@@ -157,7 +157,7 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
}
- private void undeployPolicies(UUID controlLoopElementId, ControlLoopOrderedState newState) {
+ private void undeployPolicies(UUID controlLoopElementId) {
// Undeploy all policies of this controlloop from Policy Framework
if (policyMap.entrySet() != null) {
for (Entry<String, String> policy : policyMap.entrySet()) {