aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/onap/clamp/loop/LoopController.java23
-rw-r--r--src/main/java/org/onap/clamp/loop/LoopService.java10
2 files changed, 30 insertions, 3 deletions
diff --git a/src/main/java/org/onap/clamp/loop/LoopController.java b/src/main/java/org/onap/clamp/loop/LoopController.java
index 7b037da6d..2ad47a3c1 100644
--- a/src/main/java/org/onap/clamp/loop/LoopController.java
+++ b/src/main/java/org/onap/clamp/loop/LoopController.java
@@ -26,10 +26,8 @@ package org.onap.clamp.loop;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
-
import java.lang.reflect.Type;
import java.util.List;
-
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
import org.onap.clamp.policy.operational.OperationalPolicy;
@@ -103,6 +101,27 @@ public class LoopController {
}
/**
+ * This method add an operational policy to a loop instance.
+ *
+ * @param loopName The loop name
+ * @param policyType The policy model type
+ * @param policyVersion The policy model version
+ * @return The loop modified
+ */
+ public Loop addOperationalPolicy(String loopName, String policyType, String policyVersion) {
+ return loopService.addOperationalPolicy(loopName,policyType,policyVersion);
+ }
+
+ /**
+ * This method deletes the loop.
+ *
+ * @param loopName The loop Name
+ */
+ public void deleteLoop(String loopName) {
+ loopService.deleteLoop(loopName);
+ }
+
+ /**
* Update one MicroService policy properties.
*
* @param loopName The loop name
diff --git a/src/main/java/org/onap/clamp/loop/LoopService.java b/src/main/java/org/onap/clamp/loop/LoopService.java
index 34be2038e..0be3132b0 100644
--- a/src/main/java/org/onap/clamp/loop/LoopService.java
+++ b/src/main/java/org/onap/clamp/loop/LoopService.java
@@ -102,8 +102,16 @@ public class LoopService {
loopsRepository.save(loop);
}
+ /**
+ * This method add an operational policy to a loop instance.
+ *
+ * @param loopName The loop name
+ * @param policyType The policy model type
+ * @param policyVersion The policy model version
+ * @return The loop modified
+ */
Loop addOperationalPolicy(String loopName, String policyType, String policyVersion) {
- Loop loop = findClosedLoopByName(loopName);
+ Loop loop = getLoop(loopName);
PolicyModel policyModel = policyModelsService.getPolicyModel(policyType, policyVersion);
if (policyModel == null) {
return null;