summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/clamp/clds/config/ClampProperties.java36
-rw-r--r--src/main/java/org/onap/clamp/clds/config/LegacyOperationalPolicy.java48
-rw-r--r--src/main/java/org/onap/clamp/loop/Loop.java14
-rw-r--r--src/main/java/org/onap/clamp/loop/LoopController.java6
-rw-r--r--src/main/java/org/onap/clamp/policy/Policy.java100
-rw-r--r--src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java81
-rw-r--r--src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java81
-rw-r--r--src/main/resources/META-INF/resources/swagger.html95
-rw-r--r--src/main/resources/application-noaaf.properties41
-rw-r--r--src/main/resources/application.properties35
-rw-r--r--src/main/resources/clds/camel/rest/clamp-api-v2.xml55
-rw-r--r--src/main/resources/clds/camel/routes/policy-flows.xml96
-rw-r--r--src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java48
-rw-r--r--src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java12
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java13
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopToJsonTest.java4
-rw-r--r--src/test/java/org/onap/clamp/loop/PolicyComponentTest.java76
-rw-r--r--src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java4
-rw-r--r--src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java9
-rw-r--r--src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java6
-rw-r--r--src/test/resources/application.properties34
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes?connectionTimeToLive=5000/.file29
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0?connectionTimeToLive=5000/.file158
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0?connectionTimeToLive=5000/.header1
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0?connectionTimeToLive=5000/.file158
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0?connectionTimeToLive=5000/.header1
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file192
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file202
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000/.file196
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Apex/versions/1.0.0?connectionTimeToLive=5000/.file158
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Apex/versions/1.0.0?connectionTimeToLive=5000/.header1
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Drools/versions/1.0.0?connectionTimeToLive=5000/.file158
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Drools/versions/1.0.0?connectionTimeToLive=5000/.header1
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0?connectionTimeToLive=5000/.file311
-rw-r--r--src/test/resources/tosca/operational-policy-payload.json2
-rw-r--r--src/test/resources/tosca/operational-policy-payload.yaml4
36 files changed, 746 insertions, 1720 deletions
diff --git a/src/main/java/org/onap/clamp/clds/config/ClampProperties.java b/src/main/java/org/onap/clamp/clds/config/ClampProperties.java
index 8eae9066d..0b5c951bf 100644
--- a/src/main/java/org/onap/clamp/clds/config/ClampProperties.java
+++ b/src/main/java/org/onap/clamp/clds/config/ClampProperties.java
@@ -23,14 +23,10 @@
package org.onap.clamp.clds.config;
-import com.google.gson.JsonElement;
-
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
-
import org.apache.commons.io.IOUtils;
-import org.onap.clamp.clds.util.JsonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
@@ -75,38 +71,6 @@ public class ClampProperties {
}
/**
- * Return json as objects that can be updated. The value obtained from the
- * clds-reference file will be used as a filename.
- *
- * @param key The key that will be used to access the clds-reference file
- * @return A jsonNode
- * @throws IOException In case of issues with the JSON parser
- */
- public JsonElement getJsonTemplate(String key) throws IOException {
- String fileReference = getStringValue(key);
- return (fileReference != null)
- ? JsonUtils.GSON.fromJson(getFileContentFromPath(fileReference), JsonElement.class)
- : null;
- }
-
- /**
- * Return json as objects that can be updated. First try with combo key (key1 +
- * "." + key2), otherwise default to just key1. The value obtained from the
- * clds-reference file will be used as a filename.
- *
- * @param key1 The first key
- * @param key2 The second key after a dot
- * @return A JsonNode
- * @throws IOException In case of issues with the JSON parser
- */
- public JsonElement getJsonTemplate(String key1, String key2) throws IOException {
- String fileReference = getStringValue(key1, key2);
- return (fileReference != null)
- ? JsonUtils.GSON.fromJson(getFileContentFromPath(fileReference), JsonElement.class)
- : null;
- }
-
- /**
* Return the file content. The value obtained from the clds-reference file will
* be used as a filename.
*
diff --git a/src/main/java/org/onap/clamp/clds/config/LegacyOperationalPolicy.java b/src/main/java/org/onap/clamp/clds/config/LegacyOperationalPolicy.java
new file mode 100644
index 000000000..7d4b5f8fe
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/config/LegacyOperationalPolicy.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.config;
+
+import javax.annotation.PostConstruct;
+import org.onap.clamp.loop.template.PolicyModel;
+import org.onap.clamp.loop.template.PolicyModelsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+
+@Configuration
+@Profile("legacy-operational-policy")
+public class LegacyOperationalPolicy {
+
+ @Autowired
+ PolicyModelsService policyModelService;
+
+ public static final String OPERATIONAL_POLICY_LEGACY = "onap.policies.operational.legacy";
+
+ @PostConstruct
+ public void init() {
+ policyModelService.saveOrUpdatePolicyModel(new PolicyModel(OPERATIONAL_POLICY_LEGACY, "", "1.0.0",
+ "OperationalPolicyLegacy"));
+ }
+}
+
diff --git a/src/main/java/org/onap/clamp/loop/Loop.java b/src/main/java/org/onap/clamp/loop/Loop.java
index 122b4c77f..f185460cf 100644
--- a/src/main/java/org/onap/clamp/loop/Loop.java
+++ b/src/main/java/org/onap/clamp/loop/Loop.java
@@ -48,6 +48,7 @@ import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
+import org.apache.commons.lang3.RandomStringUtils;
import org.hibernate.annotations.SortNatural;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
@@ -62,6 +63,7 @@ import org.onap.clamp.loop.log.LoopLog;
import org.onap.clamp.loop.service.Service;
import org.onap.clamp.loop.template.LoopElementModel;
import org.onap.clamp.loop.template.LoopTemplate;
+import org.onap.clamp.policy.Policy;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
import org.onap.clamp.policy.operational.OperationalPolicy;
@@ -168,12 +170,18 @@ public class Loop extends AuditEntity implements Serializable {
this.setModelService(loopTemplate.getModelService());
loopTemplate.getLoopElementModelsUsed().forEach(element -> {
if (LoopElementModel.MICRO_SERVICE_TYPE.equals(element.getLoopElementModel().getLoopElementType())) {
- this.addMicroServicePolicy(new MicroServicePolicy(name,
+ this.addMicroServicePolicy(new MicroServicePolicy(Policy.generatePolicyName("MICROSERVICE_",
+ loopTemplate.getModelService().getName(),loopTemplate.getModelService().getVersion(),
+ RandomStringUtils.randomAlphanumeric(3),RandomStringUtils.randomAlphanumeric(3)),
element.getLoopElementModel().getPolicyModels().first(), false, element.getLoopElementModel()));
} else if (LoopElementModel.OPERATIONAL_POLICY_TYPE
.equals(element.getLoopElementModel().getLoopElementType())) {
- this.addOperationalPolicy(new OperationalPolicy(name, null, new JsonObject(),
- element.getLoopElementModel().getPolicyModels().first(), element.getLoopElementModel(), null, null));
+ this.addOperationalPolicy(new OperationalPolicy(Policy.generatePolicyName("OPERATIONAL_",
+ loopTemplate.getModelService().getName(),loopTemplate.getModelService().getVersion(),
+ RandomStringUtils.randomAlphanumeric(3),RandomStringUtils.randomAlphanumeric(3)), null,
+ new JsonObject(),
+ element.getLoopElementModel().getPolicyModels().first(), element.getLoopElementModel(),
+ null,null));
}
});
}
diff --git a/src/main/java/org/onap/clamp/loop/LoopController.java b/src/main/java/org/onap/clamp/loop/LoopController.java
index 59b97e1a2..1a67455e8 100644
--- a/src/main/java/org/onap/clamp/loop/LoopController.java
+++ b/src/main/java/org/onap/clamp/loop/LoopController.java
@@ -38,11 +38,9 @@ import org.springframework.stereotype.Controller;
public class LoopController {
private final LoopService loopService;
- private static final Type OPERATIONAL_POLICY_TYPE = new TypeToken<List<OperationalPolicy>>() {
- }.getType();
+ private static final Type OPERATIONAL_POLICY_TYPE = new TypeToken<List<OperationalPolicy>>() {}.getType();
- private static final Type MICROSERVICE_POLICY_TYPE = new TypeToken<List<MicroServicePolicy>>() {
- }.getType();
+ private static final Type MICROSERVICE_POLICY_TYPE = new TypeToken<List<MicroServicePolicy>>() {}.getType();
@Autowired
public LoopController(LoopService loopService) {
diff --git a/src/main/java/org/onap/clamp/policy/Policy.java b/src/main/java/org/onap/clamp/policy/Policy.java
index 47dee1ae9..ebeb84fd6 100644
--- a/src/main/java/org/onap/clamp/policy/Policy.java
+++ b/src/main/java/org/onap/clamp/policy/Policy.java
@@ -23,28 +23,40 @@
package org.onap.clamp.policy;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.annotations.Expose;
import java.io.UnsupportedEncodingException;
-
+import java.util.Map;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
+import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
-
+import javax.persistence.Transient;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;
+import org.json.JSONObject;
import org.onap.clamp.dao.model.jsontype.StringJsonUserType;
import org.onap.clamp.loop.common.AuditEntity;
import org.onap.clamp.loop.template.LoopElementModel;
+import org.onap.clamp.loop.template.PolicyModel;
+import org.yaml.snakeyaml.Yaml;
@MappedSuperclass
@TypeDefs({@TypeDef(name = "json", typeClass = StringJsonUserType.class)})
public abstract class Policy extends AuditEntity {
+ @Transient
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(Policy.class);
+
@Expose
@Type(type = "json")
@Column(columnDefinition = "json", name = "json_representation", nullable = false)
@@ -72,7 +84,67 @@ public abstract class Policy extends AuditEntity {
@Column(name = "pdp_sub_group")
private String pdpSubgroup;
- public abstract String createPolicyPayload() throws UnsupportedEncodingException;
+ @Expose
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumns({@JoinColumn(name = "policy_model_type", referencedColumnName = "policy_model_type"),
+ @JoinColumn(name = "policy_model_version", referencedColumnName = "version")})
+ private PolicyModel policyModel;
+
+ private JsonObject createJsonFromPolicyTosca() {
+ Map<String, Object> map =
+ new Yaml().load(this.getPolicyModel() != null ? this.getPolicyModel().getPolicyModelTosca() : "");
+ JSONObject jsonObject = new JSONObject(map);
+ return new Gson().fromJson(jsonObject.toString(), JsonObject.class);
+ }
+
+ private String getModelPropertyNameFromTosca(JsonObject object, String policyModelType) {
+ return object.getAsJsonObject("policy_types").getAsJsonObject(policyModelType)
+ .getAsJsonObject(
+ "properties")
+ .keySet().toArray(new String[1])[0];
+ }
+
+ /**
+ * This method create the policy payload that must be sent to PEF.
+ *
+ * @return A String containing the payload
+ * @throws UnsupportedEncodingException In case of failure
+ */
+ public String createPolicyPayload() throws UnsupportedEncodingException {
+ JsonObject toscaJson = createJsonFromPolicyTosca();
+
+ JsonObject policyPayloadResult = new JsonObject();
+
+ policyPayloadResult.add("tosca_definitions_version", toscaJson.get("tosca_definitions_version"));
+
+ JsonObject topologyTemplateNode = new JsonObject();
+ policyPayloadResult.add("topology_template", topologyTemplateNode);
+
+ JsonArray policiesArray = new JsonArray();
+ topologyTemplateNode.add("policies", policiesArray);
+
+ JsonObject thisPolicy = new JsonObject();
+ policiesArray.add(thisPolicy);
+
+ JsonObject policyDetails = new JsonObject();
+ thisPolicy.add(this.getName(), policyDetails);
+ policyDetails.addProperty("type", this.getPolicyModel().getPolicyModelType());
+ policyDetails.addProperty("version", this.getPolicyModel().getVersion());
+
+ JsonObject policyMetadata = new JsonObject();
+ policyDetails.add("metadata", policyMetadata);
+ policyMetadata.addProperty("policy-id", this.getName());
+
+ JsonObject policyProperties = new JsonObject();
+ policyDetails.add("properties", policyProperties);
+ policyProperties
+ .add(this.getModelPropertyNameFromTosca(toscaJson, this.getPolicyModel().getPolicyModelType()),
+ this.getConfigurationsJson());
+ String policyPayload = new GsonBuilder().setPrettyPrinting().create().toJson(policyPayloadResult);
+ logger.info("Policy payload: " + policyPayload);
+ return policyPayload;
+ }
+
/**
* Name getter.
@@ -105,6 +177,24 @@ public abstract class Policy extends AuditEntity {
}
/**
+ * policyModel getter.
+ *
+ * @return the policyModel
+ */
+ public PolicyModel getPolicyModel() {
+ return policyModel;
+ }
+
+ /**
+ * policyModel setter.
+ *
+ * @param policyModel The new policyModel
+ */
+ public void setPolicyModel(PolicyModel policyModel) {
+ this.policyModel = policyModel;
+ }
+
+ /**
* configurationsJson getter.
*
* @return The configurationsJson
@@ -160,7 +250,7 @@ public abstract class Policy extends AuditEntity {
/**
* pdpSubgroup getter.
- *
+ *
* @return the pdpSubgroup
*/
public String getPdpSubgroup() {
@@ -169,7 +259,7 @@ public abstract class Policy extends AuditEntity {
/**
* pdpSubgroup setter.
- *
+ *
* @param pdpSubgroup the pdpSubgroup to set
*/
public void setPdpSubgroup(String pdpSubgroup) {
diff --git a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java
index 7fd752c31..c4037ffb6 100644
--- a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java
+++ b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java
@@ -25,28 +25,20 @@ package org.onap.clamp.policy.microservice;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.annotations.Expose;
import java.io.Serializable;
import java.util.HashSet;
-import java.util.Map;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinColumns;
import javax.persistence.ManyToMany;
-import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;
-import org.json.JSONObject;
import org.onap.clamp.clds.tosca.ToscaYamlToJsonConvertor;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.dao.model.jsontype.StringJsonUserType;
@@ -54,7 +46,6 @@ import org.onap.clamp.loop.Loop;
import org.onap.clamp.loop.template.LoopElementModel;
import org.onap.clamp.loop.template.PolicyModel;
import org.onap.clamp.policy.Policy;
-import org.yaml.snakeyaml.Yaml;
@Entity
@Table(name = "micro_service_policies")
@@ -100,12 +91,6 @@ public class MicroServicePolicy extends Policy implements Serializable {
@Column(name = "dcae_blueprint_id")
private String dcaeBlueprintId;
- @Expose
- @ManyToOne(fetch = FetchType.EAGER)
- @JoinColumns({@JoinColumn(name = "policy_model_type", referencedColumnName = "policy_model_type"),
- @JoinColumn(name = "policy_model_version", referencedColumnName = "version")})
- private PolicyModel policyModel;
-
public MicroServicePolicy() {
// serialization
}
@@ -119,20 +104,15 @@ public class MicroServicePolicy extends Policy implements Serializable {
* @param shared The flag indicate whether the MicroService is shared
*/
public MicroServicePolicy(String name, PolicyModel policyModel, Boolean shared, LoopElementModel loopElementModel) {
- this(name,policyModel,shared,JsonUtils.GSON_JPA_MODEL
+ this(name, policyModel, shared, JsonUtils.GSON_JPA_MODEL
.fromJson(new ToscaYamlToJsonConvertor().parseToscaYaml(policyModel.getPolicyModelTosca(),
- policyModel.getPolicyModelType()), JsonObject.class),loopElementModel, null, null);
- }
-
- private JsonObject createJsonFromPolicyTosca() {
- Map<String, Object> map = new Yaml().load(this.getPolicyModel().getPolicyModelTosca());
- JSONObject jsonObject = new JSONObject(map);
- return new Gson().fromJson(jsonObject.toString(), JsonObject.class);
+ policyModel.getPolicyModelType()), JsonObject.class), loopElementModel,null,null);
}
/**
* The constructor that does not make use of ToscaYamlToJsonConvertor but take
* the jsonRepresentation instead.
+ *
* @param name The name of the MicroService
* @param policyModel The policy model type of the MicroService
* @param shared The flag indicate whether the MicroService is
@@ -145,7 +125,7 @@ public class MicroServicePolicy extends Policy implements Serializable {
public MicroServicePolicy(String name, PolicyModel policyModel, Boolean shared,
JsonObject jsonRepresentation, LoopElementModel loopElementModel, String pdpGroup, String pdpSubgroup) {
this.name = name;
- this.policyModel = policyModel;
+ this.setPolicyModel(policyModel);
this.shared = shared;
this.setJsonRepresentation(jsonRepresentation);
this.setLoopElementModel(loopElementModel);
@@ -200,14 +180,6 @@ public class MicroServicePolicy extends Policy implements Serializable {
this.deviceTypeScope = deviceTypeScope;
}
- public PolicyModel getPolicyModel() {
- return policyModel;
- }
-
- public void setPolicyModel(PolicyModel policyModel) {
- this.policyModel = policyModel;
- }
-
/**
* dcaeDeploymentId getter.
*
@@ -288,48 +260,7 @@ public class MicroServicePolicy extends Policy implements Serializable {
}
} else if (!name.equals(other.name)) {
return false;
- } return true;
- }
-
- private String getMicroServicePropertyNameFromTosca(JsonObject object) {
- return object.getAsJsonObject("policy_types").getAsJsonObject(this.getPolicyModel().getPolicyModelType())
- .getAsJsonObject(
- "properties")
- .keySet().toArray(new String[1])[0];
- }
-
- @Override
- public String createPolicyPayload() {
- JsonObject toscaJson = createJsonFromPolicyTosca();
-
- JsonObject policyPayloadResult = new JsonObject();
-
- policyPayloadResult.add("tosca_definitions_version", toscaJson.get("tosca_definitions_version"));
-
- JsonObject topologyTemplateNode = new JsonObject();
- policyPayloadResult.add("topology_template", topologyTemplateNode);
-
- JsonArray policiesArray = new JsonArray();
- topologyTemplateNode.add("policies", policiesArray);
-
- JsonObject thisPolicy = new JsonObject();
- policiesArray.add(thisPolicy);
-
- JsonObject policyDetails = new JsonObject();
- thisPolicy.add(this.getName(), policyDetails);
- policyDetails.addProperty("type", this.getPolicyModel().getPolicyModelType());
- policyDetails.addProperty("version", this.getPolicyModel().getVersion());
-
- JsonObject policyMetadata = new JsonObject();
- policyDetails.add("metadata", policyMetadata);
- policyMetadata.addProperty("policy-id", this.getName());
-
- JsonObject policyProperties = new JsonObject();
- policyDetails.add("properties", policyProperties);
- policyProperties.add(this.getMicroServicePropertyNameFromTosca(toscaJson), this.getConfigurationsJson());
- String policyPayload = new GsonBuilder().setPrettyPrinting().create().toJson(policyPayloadResult);
- logger.info("Micro service policy payload: " + policyPayload);
- return policyPayload;
+ }
+ return true;
}
-
}
diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
index aab30bfb6..82cfcf4ef 100644
--- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
+++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
@@ -50,6 +50,8 @@ import javax.persistence.Table;
import javax.persistence.Transient;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;
+import org.onap.clamp.clds.tosca.ToscaYamlToJsonConvertor;
+import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.dao.model.jsontype.StringJsonUserType;
import org.onap.clamp.loop.Loop;
import org.onap.clamp.loop.template.LoopElementModel;
@@ -79,12 +81,6 @@ public class OperationalPolicy extends Policy implements Serializable {
@JoinColumn(name = "loop_id", nullable = false)
private Loop loop;
- @Expose
- @ManyToOne(fetch = FetchType.EAGER)
- @JoinColumns({@JoinColumn(name = "policy_model_type", referencedColumnName = "policy_model_type"),
- @JoinColumn(name = "policy_model_version", referencedColumnName = "version")})
- private PolicyModel policyModel;
-
public OperationalPolicy() {
// Serialization
}
@@ -110,16 +106,32 @@ public class OperationalPolicy extends Policy implements Serializable {
this.setPdpGroup(pdpGroup);
this.setPdpSubgroup(pdpSubgroup);
this.setLoopElementModel(loopElementModel);
- if (policyModel != null && policyModel.getPolicyModelType().contains("legacy")) {
- LegacyOperationalPolicy.preloadConfiguration(configurationsJson, loop);
+ this.setJsonRepresentation(this.generateJsonRepresentation(policyModel));
+
+ }
+
+ private JsonObject generateJsonRepresentation(PolicyModel policyModel) {
+ JsonObject jsonReturned = new JsonObject();
+ if (policyModel == null) {
+ return new JsonObject();
}
try {
- this.setJsonRepresentation(
- OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(loop.getModelService()));
+ if (isLegacy()) {
+ // Op policy Legacy case
+ LegacyOperationalPolicy.preloadConfiguration(jsonReturned, loop);
+ this.setJsonRepresentation(
+ OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(loop.getModelService()));
+ } else {
+ // Generic Case
+ this.setJsonRepresentation(JsonUtils.GSON
+ .fromJson(new ToscaYamlToJsonConvertor().parseToscaYaml(policyModel.getPolicyModelTosca(),
+ policyModel.getPolicyModelType()), JsonObject.class));
+ }
} catch (JsonSyntaxException | IOException | NullPointerException e) {
logger.error("Unable to generate the operational policy Schema ... ", e);
this.setJsonRepresentation(new JsonObject());
}
+ return jsonReturned;
}
public void setLoop(Loop loopName) {
@@ -145,24 +157,6 @@ public class OperationalPolicy extends Policy implements Serializable {
this.name = name;
}
- /**
- * policyModel getter.
- *
- * @return the policyModel
- */
- public PolicyModel getPolicyModel() {
- return policyModel;
- }
-
- /**
- * policyModel setter.
- *
- * @param policyModel the policyModel to set
- */
- public void setPolicyModel(PolicyModel policyModel) {
- this.policyModel = policyModel;
- }
-
@Override
public int hashCode() {
final int prime = 31;
@@ -193,6 +187,10 @@ public class OperationalPolicy extends Policy implements Serializable {
return true;
}
+ public Boolean isLegacy() {
+ return (this.getPolicyModel() != null) && this.getPolicyModel().getPolicyModelType().contains("legacy");
+ }
+
/**
* Create policy Yaml from json defined here.
*
@@ -235,17 +233,22 @@ public class OperationalPolicy extends Policy implements Serializable {
@Override
public String createPolicyPayload() throws UnsupportedEncodingException {
- // Now using the legacy payload fo Dublin
- JsonObject payload = new JsonObject();
- payload.addProperty("policy-id", this.getName());
- payload.addProperty("content",
- URLEncoder.encode(
- LegacyOperationalPolicy
- .createPolicyPayloadYamlLegacy(this.getConfigurationsJson().get("operational_policy")),
- StandardCharsets.UTF_8.toString()));
- String opPayload = new GsonBuilder().setPrettyPrinting().create().toJson(payload);
- logger.info("Operational policy payload: " + opPayload);
- return opPayload;
+ if (isLegacy()) {
+ // Now using the legacy payload fo Dublin
+ JsonObject payload = new JsonObject();
+ payload.addProperty("policy-id", this.getName());
+ payload.addProperty("content",
+ URLEncoder.encode(
+ LegacyOperationalPolicy
+ .createPolicyPayloadYamlLegacy(
+ this.getConfigurationsJson().get("operational_policy")),
+ StandardCharsets.UTF_8.toString()));
+ String opPayload = new GsonBuilder().setPrettyPrinting().create().toJson(payload);
+ logger.info("Operational policy payload: " + opPayload);
+ return opPayload;
+ } else {
+ return super.createPolicyPayload();
+ }
}
/**
diff --git a/src/main/resources/META-INF/resources/swagger.html b/src/main/resources/META-INF/resources/swagger.html
index 23844cb23..9c4c9fff2 100644
--- a/src/main/resources/META-INF/resources/swagger.html
+++ b/src/main/resources/META-INF/resources/swagger.html
@@ -444,25 +444,25 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</li>
<li><a href="#_paths">2. Paths</a>
<ul class="sectlevel2">
-<li><a href="#_route30">2.1. GET /v1/healthcheck</a>
+<li><a href="#_route61">2.1. GET /v1/healthcheck</a>
<ul class="sectlevel3">
<li><a href="#_responses">2.1.1. Responses</a></li>
<li><a href="#_produces">2.1.2. Produces</a></li>
</ul>
</li>
-<li><a href="#_route31">2.2. GET /v1/user/getUser</a>
+<li><a href="#_route62">2.2. GET /v1/user/getUser</a>
<ul class="sectlevel3">
<li><a href="#_responses_2">2.2.1. Responses</a></li>
<li><a href="#_produces_2">2.2.2. Produces</a></li>
</ul>
</li>
-<li><a href="#_route18">2.3. GET /v2/dictionary</a>
+<li><a href="#_route49">2.3. GET /v2/dictionary</a>
<ul class="sectlevel3">
<li><a href="#_responses_3">2.3.1. Responses</a></li>
<li><a href="#_produces_3">2.3.2. Produces</a></li>
</ul>
</li>
-<li><a href="#_route20">2.4. PUT /v2/dictionary</a>
+<li><a href="#_route51">2.4. PUT /v2/dictionary</a>
<ul class="sectlevel3">
<li><a href="#_parameters">2.4.1. Parameters</a></li>
<li><a href="#_responses_4">2.4.2. Responses</a></li>
@@ -491,7 +491,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<li><a href="#_produces_7">2.7.4. Produces</a></li>
</ul>
</li>
-<li><a href="#_route22">2.8. DELETE /v2/dictionary/{name}</a>
+<li><a href="#_route53">2.8. DELETE /v2/dictionary/{name}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_4">2.8.1. Parameters</a></li>
<li><a href="#_responses_8">2.8.2. Responses</a></li>
@@ -505,75 +505,75 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<li><a href="#_produces_9">2.9.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route14">2.10. PUT /v2/loop/delete/{loopName}</a>
+<li><a href="#_route45">2.10. PUT /v2/loop/delete/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_6">2.10.1. Parameters</a></li>
<li><a href="#_responses_10">2.10.2. Responses</a></li>
</ul>
</li>
-<li><a href="#_route8">2.11. PUT /v2/loop/deploy/{loopName}</a>
+<li><a href="#_route39">2.11. PUT /v2/loop/deploy/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_7">2.11.1. Parameters</a></li>
<li><a href="#_responses_11">2.11.2. Responses</a></li>
<li><a href="#_produces_10">2.11.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route2">2.12. GET /v2/loop/getAllNames</a>
+<li><a href="#_route33">2.12. GET /v2/loop/getAllNames</a>
<ul class="sectlevel3">
<li><a href="#_responses_12">2.12.1. Responses</a></li>
<li><a href="#_produces_11">2.12.2. Produces</a></li>
</ul>
</li>
-<li><a href="#_route15">2.13. GET /v2/loop/getstatus/{loopName}</a>
+<li><a href="#_route46">2.13. GET /v2/loop/getstatus/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_8">2.13.1. Parameters</a></li>
<li><a href="#_responses_13">2.13.2. Responses</a></li>
<li><a href="#_produces_12">2.13.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route9">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a>
+<li><a href="#_route40">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_9">2.14.1. Parameters</a></li>
<li><a href="#_responses_14">2.14.2. Responses</a></li>
<li><a href="#_produces_13">2.14.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route12">2.15. PUT /v2/loop/restart/{loopName}</a>
+<li><a href="#_route43">2.15. PUT /v2/loop/restart/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_10">2.15.1. Parameters</a></li>
<li><a href="#_responses_15">2.15.2. Responses</a></li>
<li><a href="#_produces_14">2.15.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route11">2.16. PUT /v2/loop/stop/{loopName}</a>
+<li><a href="#_route42">2.16. PUT /v2/loop/stop/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_11">2.16.1. Parameters</a></li>
<li><a href="#_responses_16">2.16.2. Responses</a></li>
<li><a href="#_produces_15">2.16.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route13">2.17. PUT /v2/loop/submit/{loopName}</a>
+<li><a href="#_route44">2.17. PUT /v2/loop/submit/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_12">2.17.1. Parameters</a></li>
<li><a href="#_responses_17">2.17.2. Responses</a></li>
<li><a href="#_produces_16">2.17.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route4">2.18. GET /v2/loop/svgRepresentation/{loopName}</a>
+<li><a href="#_route35">2.18. GET /v2/loop/svgRepresentation/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_13">2.18.1. Parameters</a></li>
<li><a href="#_responses_18">2.18.2. Responses</a></li>
<li><a href="#_produces_17">2.18.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route10">2.19. PUT /v2/loop/undeploy/{loopName}</a>
+<li><a href="#_route41">2.19. PUT /v2/loop/undeploy/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_14">2.19.1. Parameters</a></li>
<li><a href="#_responses_19">2.19.2. Responses</a></li>
<li><a href="#_produces_18">2.19.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route5">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a>
+<li><a href="#_route36">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_15">2.20.1. Parameters</a></li>
<li><a href="#_responses_20">2.20.2. Responses</a></li>
@@ -581,7 +581,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<li><a href="#_produces_19">2.20.4. Produces</a></li>
</ul>
</li>
-<li><a href="#_route7">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a>
+<li><a href="#_route38">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_16">2.21.1. Parameters</a></li>
<li><a href="#_responses_21">2.21.2. Responses</a></li>
@@ -589,7 +589,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<li><a href="#_produces_20">2.21.4. Produces</a></li>
</ul>
</li>
-<li><a href="#_route6">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a>
+<li><a href="#_route37">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_17">2.22.1. Parameters</a></li>
<li><a href="#_responses_22">2.22.2. Responses</a></li>
@@ -597,14 +597,14 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<li><a href="#_produces_21">2.22.4. Produces</a></li>
</ul>
</li>
-<li><a href="#_route3">2.23. GET /v2/loop/{loopName}</a>
+<li><a href="#_route34">2.23. GET /v2/loop/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_18">2.23.1. Parameters</a></li>
<li><a href="#_responses_23">2.23.2. Responses</a></li>
<li><a href="#_produces_22">2.23.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route25">2.24. GET /v2/policyToscaModels</a>
+<li><a href="#_route56">2.24. GET /v2/policyToscaModels</a>
<ul class="sectlevel3">
<li><a href="#_responses_24">2.24.1. Responses</a></li>
<li><a href="#_produces_23">2.24.2. Produces</a></li>
@@ -624,7 +624,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<li><a href="#_produces_25">2.26.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route26">2.27. PUT /v2/policyToscaModels/{policyModelType}</a>
+<li><a href="#_route57">2.27. PUT /v2/policyToscaModels/{policyModelType}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_21">2.27.1. Parameters</a></li>
<li><a href="#_responses_27">2.27.2. Responses</a></li>
@@ -632,7 +632,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<li><a href="#_produces_26">2.27.4. Produces</a></li>
</ul>
</li>
-<li><a href="#_route29">2.28. GET /v2/templates</a>
+<li><a href="#_route60">2.28. GET /v2/templates</a>
<ul class="sectlevel3">
<li><a href="#_responses_28">2.28.1. Responses</a></li>
<li><a href="#_produces_27">2.28.2. Produces</a></li>
@@ -692,7 +692,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<div class="sect2">
<h3 id="_uri_scheme"><a class="anchor" href="#_uri_scheme"></a><a class="link" href="#_uri_scheme">1.2. URI scheme</a></h3>
<div class="paragraph">
-<p><em>Host</em> : localhost:37295<br>
+<p><em>Host</em> : localhost:39099<br>
<em>BasePath</em> : /restservices/clds/<br>
<em>Schemes</em> : HTTP</p>
</div>
@@ -703,7 +703,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<h2 id="_paths"><a class="anchor" href="#_paths"></a><a class="link" href="#_paths">2. Paths</a></h2>
<div class="sectionbody">
<div class="sect2">
-<h3 id="_route30"><a class="anchor" href="#_route30"></a><a class="link" href="#_route30">2.1. GET /v1/healthcheck</a></h3>
+<h3 id="_route61"><a class="anchor" href="#_route61"></a><a class="link" href="#_route61">2.1. GET /v1/healthcheck</a></h3>
<div class="sect3">
<h4 id="_responses"><a class="anchor" href="#_responses"></a><a class="link" href="#_responses">2.1.1. Responses</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -740,7 +740,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route31"><a class="anchor" href="#_route31"></a><a class="link" href="#_route31">2.2. GET /v1/user/getUser</a></h3>
+<h3 id="_route62"><a class="anchor" href="#_route62"></a><a class="link" href="#_route62">2.2. GET /v1/user/getUser</a></h3>
<div class="sect3">
<h4 id="_responses_2"><a class="anchor" href="#_responses_2"></a><a class="link" href="#_responses_2">2.2.1. Responses</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -774,7 +774,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route18"><a class="anchor" href="#_route18"></a><a class="link" href="#_route18">2.3. GET /v2/dictionary</a></h3>
+<h3 id="_route49"><a class="anchor" href="#_route49"></a><a class="link" href="#_route49">2.3. GET /v2/dictionary</a></h3>
<div class="sect3">
<h4 id="_responses_3"><a class="anchor" href="#_responses_3"></a><a class="link" href="#_responses_3">2.3.1. Responses</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -811,7 +811,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route20"><a class="anchor" href="#_route20"></a><a class="link" href="#_route20">2.4. PUT /v2/dictionary</a></h3>
+<h3 id="_route51"><a class="anchor" href="#_route51"></a><a class="link" href="#_route51">2.4. PUT /v2/dictionary</a></h3>
<div class="sect3">
<h4 id="_parameters"><a class="anchor" href="#_parameters"></a><a class="link" href="#_parameters">2.4.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1060,7 +1060,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route22"><a class="anchor" href="#_route22"></a><a class="link" href="#_route22">2.8. DELETE /v2/dictionary/{name}</a></h3>
+<h3 id="_route53"><a class="anchor" href="#_route53"></a><a class="link" href="#_route53">2.8. DELETE /v2/dictionary/{name}</a></h3>
<div class="sect3">
<h4 id="_parameters_4"><a class="anchor" href="#_parameters_4"></a><a class="link" href="#_parameters_4">2.8.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1184,7 +1184,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route14"><a class="anchor" href="#_route14"></a><a class="link" href="#_route14">2.10. PUT /v2/loop/delete/{loopName}</a></h3>
+<h3 id="_route45"><a class="anchor" href="#_route45"></a><a class="link" href="#_route45">2.10. PUT /v2/loop/delete/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_6"><a class="anchor" href="#_parameters_6"></a><a class="link" href="#_parameters_6">2.10.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1233,7 +1233,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route8"><a class="anchor" href="#_route8"></a><a class="link" href="#_route8">2.11. PUT /v2/loop/deploy/{loopName}</a></h3>
+<h3 id="_route39"><a class="anchor" href="#_route39"></a><a class="link" href="#_route39">2.11. PUT /v2/loop/deploy/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_7"><a class="anchor" href="#_parameters_7"></a><a class="link" href="#_parameters_7">2.11.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1295,7 +1295,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route2"><a class="anchor" href="#_route2"></a><a class="link" href="#_route2">2.12. GET /v2/loop/getAllNames</a></h3>
+<h3 id="_route33"><a class="anchor" href="#_route33"></a><a class="link" href="#_route33">2.12. GET /v2/loop/getAllNames</a></h3>
<div class="sect3">
<h4 id="_responses_12"><a class="anchor" href="#_responses_12"></a><a class="link" href="#_responses_12">2.12.1. Responses</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1332,7 +1332,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route15"><a class="anchor" href="#_route15"></a><a class="link" href="#_route15">2.13. GET /v2/loop/getstatus/{loopName}</a></h3>
+<h3 id="_route46"><a class="anchor" href="#_route46"></a><a class="link" href="#_route46">2.13. GET /v2/loop/getstatus/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_8"><a class="anchor" href="#_parameters_8"></a><a class="link" href="#_parameters_8">2.13.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1394,7 +1394,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route9"><a class="anchor" href="#_route9"></a><a class="link" href="#_route9">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a></h3>
+<h3 id="_route40"><a class="anchor" href="#_route40"></a><a class="link" href="#_route40">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_9"><a class="anchor" href="#_parameters_9"></a><a class="link" href="#_parameters_9">2.14.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1456,7 +1456,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route12"><a class="anchor" href="#_route12"></a><a class="link" href="#_route12">2.15. PUT /v2/loop/restart/{loopName}</a></h3>
+<h3 id="_route43"><a class="anchor" href="#_route43"></a><a class="link" href="#_route43">2.15. PUT /v2/loop/restart/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_10"><a class="anchor" href="#_parameters_10"></a><a class="link" href="#_parameters_10">2.15.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1518,7 +1518,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route11"><a class="anchor" href="#_route11"></a><a class="link" href="#_route11">2.16. PUT /v2/loop/stop/{loopName}</a></h3>
+<h3 id="_route42"><a class="anchor" href="#_route42"></a><a class="link" href="#_route42">2.16. PUT /v2/loop/stop/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_11"><a class="anchor" href="#_parameters_11"></a><a class="link" href="#_parameters_11">2.16.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1580,7 +1580,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route13"><a class="anchor" href="#_route13"></a><a class="link" href="#_route13">2.17. PUT /v2/loop/submit/{loopName}</a></h3>
+<h3 id="_route44"><a class="anchor" href="#_route44"></a><a class="link" href="#_route44">2.17. PUT /v2/loop/submit/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_12"><a class="anchor" href="#_parameters_12"></a><a class="link" href="#_parameters_12">2.17.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1642,7 +1642,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route4"><a class="anchor" href="#_route4"></a><a class="link" href="#_route4">2.18. GET /v2/loop/svgRepresentation/{loopName}</a></h3>
+<h3 id="_route35"><a class="anchor" href="#_route35"></a><a class="link" href="#_route35">2.18. GET /v2/loop/svgRepresentation/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_13"><a class="anchor" href="#_parameters_13"></a><a class="link" href="#_parameters_13">2.18.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1704,7 +1704,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route10"><a class="anchor" href="#_route10"></a><a class="link" href="#_route10">2.19. PUT /v2/loop/undeploy/{loopName}</a></h3>
+<h3 id="_route41"><a class="anchor" href="#_route41"></a><a class="link" href="#_route41">2.19. PUT /v2/loop/undeploy/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_14"><a class="anchor" href="#_parameters_14"></a><a class="link" href="#_parameters_14">2.19.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1766,7 +1766,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route5"><a class="anchor" href="#_route5"></a><a class="link" href="#_route5">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a></h3>
+<h3 id="_route36"><a class="anchor" href="#_route36"></a><a class="link" href="#_route36">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_15"><a class="anchor" href="#_parameters_15"></a><a class="link" href="#_parameters_15">2.20.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1844,7 +1844,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route7"><a class="anchor" href="#_route7"></a><a class="link" href="#_route7">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a></h3>
+<h3 id="_route38"><a class="anchor" href="#_route38"></a><a class="link" href="#_route38">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_16"><a class="anchor" href="#_parameters_16"></a><a class="link" href="#_parameters_16">2.21.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1922,7 +1922,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route6"><a class="anchor" href="#_route6"></a><a class="link" href="#_route6">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a></h3>
+<h3 id="_route37"><a class="anchor" href="#_route37"></a><a class="link" href="#_route37">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_17"><a class="anchor" href="#_parameters_17"></a><a class="link" href="#_parameters_17">2.22.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -2000,7 +2000,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route3"><a class="anchor" href="#_route3"></a><a class="link" href="#_route3">2.23. GET /v2/loop/{loopName}</a></h3>
+<h3 id="_route34"><a class="anchor" href="#_route34"></a><a class="link" href="#_route34">2.23. GET /v2/loop/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_18"><a class="anchor" href="#_parameters_18"></a><a class="link" href="#_parameters_18">2.23.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -2062,7 +2062,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route25"><a class="anchor" href="#_route25"></a><a class="link" href="#_route25">2.24. GET /v2/policyToscaModels</a></h3>
+<h3 id="_route56"><a class="anchor" href="#_route56"></a><a class="link" href="#_route56">2.24. GET /v2/policyToscaModels</a></h3>
<div class="sect3">
<h4 id="_responses_24"><a class="anchor" href="#_responses_24"></a><a class="link" href="#_responses_24">2.24.1. Responses</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -2223,7 +2223,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route26"><a class="anchor" href="#_route26"></a><a class="link" href="#_route26">2.27. PUT /v2/policyToscaModels/{policyModelType}</a></h3>
+<h3 id="_route57"><a class="anchor" href="#_route57"></a><a class="link" href="#_route57">2.27. PUT /v2/policyToscaModels/{policyModelType}</a></h3>
<div class="sect3">
<h4 id="_parameters_21"><a class="anchor" href="#_parameters_21"></a><a class="link" href="#_parameters_21">2.27.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -2301,7 +2301,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route29"><a class="anchor" href="#_route29"></a><a class="link" href="#_route29">2.28. GET /v2/templates</a></h3>
+<h3 id="_route60"><a class="anchor" href="#_route60"></a><a class="link" href="#_route60">2.28. GET /v2/templates</a></h3>
<div class="sect3">
<h4 id="_responses_28"><a class="anchor" href="#_responses_28"></a><a class="link" href="#_responses_28">2.28.1. Responses</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -3617,6 +3617,11 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_jsonobject">JsonObject</a></p></td>
</tr>
<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>legacy</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">boolean</p></td>
+</tr>
+<tr>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>loop</strong><br>
<em>optional</em></p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_loop">Loop</a></p></td>
diff --git a/src/main/resources/application-noaaf.properties b/src/main/resources/application-noaaf.properties
index 69d16875c..320e0c2a3 100644
--- a/src/main/resources/application-noaaf.properties
+++ b/src/main/resources/application-noaaf.properties
@@ -21,11 +21,6 @@
#
###
-info.build.artifact=@project.artifactId@
-info.build.name=@project.name@
-info.build.description=@project.description@
-info.build.version=@project.version@
-
### Set the port for HTTP or HTTPS protocol (Controlled by Spring framework, only one at a time).
### (See below for the parameter 'server.http.port' if you want to have both enabled)
### To have only HTTP, keep the lines server.ssl.* commented
@@ -73,7 +68,7 @@ clamp.config.keyFile=classpath:/clds/aaf/org.onap.clamp.keyfile
server.servlet.context-path=/
#Modified engine-rest applicationpath
-spring.profiles.active=clamp-default,clamp-default-user,clamp-sdc-controller,clamp-ssl-config,clamp-policy-controller
+spring.profiles.active=clamp-default,clamp-default-user,clamp-sdc-controller,clamp-ssl-config,clamp-policy-controller,legacy-operational-policy
spring.http.converters.preferred-json-mapper=gson
#The max number of active threads in this pool
@@ -145,12 +140,7 @@ clamp.config.files.cldsUsers=classpath:/clds/clds-users.json
clamp.config.files.globalProperties=classpath:/clds/templates/globalProperties.json
clamp.config.files.sdcController=classpath:/clds/sdc-controllers-config.json
-# Properties for Clamp
-# DCAE request build properties
-#
-clamp.config.dcae.template=classpath:/clds/templates/dcae-template.json
-clamp.config.dcae.deployment.template=classpath:/clds/templates/dcae-deployment-template.json
-#
+
#
# Configuration Settings for Policy Engine Components
clamp.config.policy.api.url=http4://localhost:8085
@@ -160,36 +150,9 @@ clamp.config.policy.pap.url=http4://localhost:8085
clamp.config.policy.pap.userName=healthcheck
clamp.config.policy.pap.password=zb!XztG34
-# TCA MicroService Policy request build properties
-#
-clamp.config.tca.policyid.prefix=DCAE.Config_
-clamp.config.tca.policy.template=classpath:/clds/templates/tca-policy-template.json
-clamp.config.tca.template=classpath:/clds/templates/tca-template.json
-clamp.config.tca.thresholds.template=classpath:/clds/templates/tca-thresholds-template.json
-
-#
-#
-# Operational Policy request build properties
-#
-clamp.config.op.policyDescription=from CLAMP
-# default
-clamp.config.op.templateName=ClosedLoopControlName
-clamp.config.op.operationTopic=APPC-CL
-clamp.config.op.notificationTopic=POLICY-CL-MGT
-clamp.config.op.controller=amsterdam
-clamp.config.op.policy.appc=APPC
#
# Sdc service properties
clamp.config.sdc.csarFolder = /tmp/sdc-controllers
-clamp.config.sdc.blueprint.parser.mapping = classpath:/clds/blueprint-parser-mapping.json
-#
-clamp.config.ui.location.default=classpath:/clds/templates/ui-location-default.json
-#
-# if action.test.override is true, then any action will be marked as test=true (even if incoming action request had test=false); otherwise, test flag will be unchanged on the action request
-clamp.config.action.test.override=false
-# if action.insert.test.event is true, then insert event even if the action is set to test
-clamp.config.action.insert.test.event=false
-clamp.config.clds.service.cache.invalidate.after.seconds=120
#DCAE Inventory Url Properties
clamp.config.dcae.inventory.url=http4://localhost:8085
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 695319d5b..e856743a8 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -73,7 +73,7 @@ server.ssl.trust-store-password=enc:iDnPBBLq_EMidXlMa1FEuBR8TZzYxrCg66vq_XfLHdJ
server.servlet.context-path=/
#Modified engine-rest applicationpath
-spring.profiles.active=clamp-default,clamp-aaf-authentication,clamp-sdc-controller,clamp-ssl-config,clamp-policy-controller
+spring.profiles.active=clamp-default,clamp-aaf-authentication,clamp-sdc-controller,clamp-ssl-config,clamp-policy-controller,legacy-operational-policy
spring.http.converters.preferred-json-mapper=gson
#The max number of active threads in this pool
@@ -143,12 +143,6 @@ clamp.config.files.cldsUsers=classpath:/clds/clds-users.json
clamp.config.files.globalProperties=classpath:/clds/templates/globalProperties.json
clamp.config.files.sdcController=classpath:/clds/sdc-controllers-config.json
-# Properties for Clamp
-# DCAE request build properties
-#
-clamp.config.dcae.template=classpath:/clds/templates/dcae-template.json
-clamp.config.dcae.deployment.template=classpath:/clds/templates/dcae-deployment-template.json
-#
#
# Configuration Settings for Policy Engine Components
clamp.config.policy.api.url=http4://policy.api.simpledemo.onap.org:6969
@@ -158,36 +152,9 @@ clamp.config.policy.pap.url=http4://policy.api.simpledemo.onap.org:6969
clamp.config.policy.pap.userName=healthcheck
clamp.config.policy.pap.password=zb!XztG34
-# TCA MicroService Policy request build properties
-#
-clamp.config.tca.policyid.prefix=DCAE.Config_
-clamp.config.tca.policy.template=classpath:/clds/templates/tca-policy-template.json
-clamp.config.tca.template=classpath:/clds/templates/tca-template.json
-clamp.config.tca.thresholds.template=classpath:/clds/templates/tca-thresholds-template.json
-
-#
-#
-# Operational Policy request build properties
-#
-clamp.config.op.policyDescription=from CLAMP
-# default
-clamp.config.op.templateName=ClosedLoopControlName
-clamp.config.op.operationTopic=APPC-CL
-clamp.config.op.notificationTopic=POLICY-CL-MGT
-clamp.config.op.controller=amsterdam
-clamp.config.op.policy.appc=APPC
#
# Sdc service properties
clamp.config.sdc.csarFolder = /tmp/sdc-controllers
-clamp.config.sdc.blueprint.parser.mapping = classpath:/clds/blueprint-parser-mapping.json
-#
-clamp.config.ui.location.default=classpath:/clds/templates/ui-location-default.json
-#
-# if action.test.override is true, then any action will be marked as test=true (even if incoming action request had test=false); otherwise, test flag will be unchanged on the action request
-clamp.config.action.test.override=false
-# if action.insert.test.event is true, then insert event even if the action is set to test
-clamp.config.action.insert.test.event=false
-clamp.config.clds.service.cache.invalidate.after.seconds=120
#DCAE Inventory Url Properties
clamp.config.dcae.inventory.url=http4://dcae.api.simpledemo.onap.org:8080
diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
index 3ed272e7c..fbf90712a 100644
--- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml
+++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
@@ -377,51 +377,56 @@
<split>
<simple>${exchangeProperty[loopObject].getMicroServicePolicies()}
</simple>
- <setProperty propertyName="microServicePolicy">
+ <setProperty propertyName="policy">
<simple>${body}</simple>
</setProperty>
<log loggingLevel="INFO"
- message="Processing Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
+ message="Processing Micro Service Policy: ${exchangeProperty[policy].getName()}" />
<setProperty propertyName="raiseHttpExceptionFlag">
<simple resultType="java.lang.Boolean">false</simple>
</setProperty>
- <to uri="direct:delete-micro-service-policy" />
- <to uri="direct:create-micro-service-policy" />
+ <to uri="direct:delete-policy" />
+ <to uri="direct:create-policy" />
</split>
<log loggingLevel="INFO"
message="Processing all OPERATIONAL policies defined in loop ${exchangeProperty[loopObject].getName()}" />
<split>
<simple>${exchangeProperty[loopObject].getOperationalPolicies()}
</simple>
- <setProperty propertyName="operationalPolicy">
+ <setProperty propertyName="policy">
<simple>${body}</simple>
</setProperty>
<log loggingLevel="INFO"
- message="Processing Operational Policy: ${exchangeProperty[operationalPolicy].getName()}" />
+ message="Processing Operational Policy: ${exchangeProperty[policy].getName()}" />
<setProperty propertyName="raiseHttpExceptionFlag">
<simple resultType="java.lang.Boolean">false</simple>
</setProperty>
- <to uri="direct:delete-operational-policy" />
- <to uri="direct:create-operational-policy" />
-
- <log loggingLevel="INFO"
- message="Processing all GUARD policies defined in loop ${exchangeProperty[loopObject].getName()}" />
- <split>
- <simple>${exchangeProperty[operationalPolicy].createGuardPolicyPayloads().entrySet()}
- </simple>
- <setProperty propertyName="guardPolicy">
- <simple>${body}</simple>
- </setProperty>
- <log loggingLevel="INFO"
- message="Processing Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" />
+ <to uri="direct:delete-policy" />
+ <to uri="direct:create-policy" />
+ <choice>
+ <when>
+ <simple>${exchangeProperty['policy'].isLegacy()} == true
+ </simple>
+ <log loggingLevel="INFO"
+ message="Processing all GUARD policies (LEGACY) defined in loop ${exchangeProperty[loopObject].getName()}" />
+ <split>
+ <simple>${exchangeProperty[operationalPolicy].createGuardPolicyPayloads().entrySet()}
+ </simple>
+ <setProperty propertyName="guardPolicy">
+ <simple>${body}</simple>
+ </setProperty>
+ <log loggingLevel="INFO"
+ message="Processing Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" />
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <to uri="direct:delete-guard-policy" />
- <to uri="direct:create-guard-policy" />
- </split>
+ <setProperty propertyName="raiseHttpExceptionFlag">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setProperty>
+ <to uri="direct:delete-guard-policy" />
+ <to uri="direct:create-guard-policy" />
+ </split>
+ </when>
+ </choice>
</split>
<delay>
diff --git a/src/main/resources/clds/camel/routes/policy-flows.xml b/src/main/resources/clds/camel/routes/policy-flows.xml
index afc5f952a..48e518da9 100644
--- a/src/main/resources/clds/camel/routes/policy-flows.xml
+++ b/src/main/resources/clds/camel/routes/policy-flows.xml
@@ -183,6 +183,102 @@
</doFinally>
</doTry>
</route>
+ <route id="create-policy">
+ <from uri="direct:create-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Creating Policy: ${exchangeProperty[policy].getName()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Policy')"/>
+ <setBody>
+ <simple>${exchangeProperty[policy].createPolicyPayload()}
+ </simple>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>POST</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to create policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policy].getPolicyModel().getPolicyModelType()}/versions/${exchangeProperty[policy].getPolicyModel().getVersion()}/policies"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policy].getPolicyModel().getPolicyModelType()}/versions/${exchangeProperty[policy].getPolicyModel().getVersion()}/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[policy].getName()} creation
+ status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
+
+ <route id="delete-policy">
+ <from uri="direct:delete-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Deleting Policy: ${exchangeProperty[policy].getName()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Policy')"/>
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to delete microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policy].getPolicyModel().getPolicyModelType()}/versions/${exchangeProperty[policy].getPolicyModel().getVersion()}/policies/${exchangeProperty[policy].getName()}/versions/1.0.0"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policy].getPolicyModel().getPolicyModelType()}/versions/${exchangeProperty[policy].getPolicyModel().getVersion()}/policies/${exchangeProperty[policy].getName()}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[policy].getName()} removal
+ status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
<route id="create-micro-service-policy">
<from uri="direct:create-micro-service-policy"/>
<doTry>
diff --git a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
index c25415ecc..4bf2de030 100644
--- a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
@@ -24,17 +24,11 @@
package org.onap.clamp.clds.it.config;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import com.google.gson.JsonElement;
-
import java.io.IOException;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.clamp.clds.config.ClampProperties;
+import org.onap.clamp.clds.util.ResourceFileUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@@ -57,37 +51,6 @@ public class CldsReferencePropertiesItCase {
assertEquals("healthcheck", refProp.getStringValue("policy.api.userName"));
}
- @Test
- public void shouldReturnJsonFromTemplate() throws IOException {
- // when
- JsonElement root = refProp.getJsonTemplate("ui.location.default");
-
- // then
- assertNotNull(root);
- assertTrue(root.isJsonObject());
- assertEquals("Data Center 1", root.getAsJsonObject().get("DC1").getAsString());
- }
-
- @Test
- public void shouldReturnJsonFromTemplate_2() throws IOException {
- // when
- JsonElement root = refProp.getJsonTemplate("ui.location", "default");
-
- // then
- assertNotNull(root);
- assertTrue(root.isJsonObject());
- assertEquals("Data Center 1", root.getAsJsonObject().get("DC1").getAsString());
- }
-
- @Test
- public void shouldReturnNullIfPropertyNotFound() throws IOException {
- // when
- JsonElement root = refProp.getJsonTemplate("ui.location", "");
-
- // then
- assertNull(root);
- }
-
/**
* Test getting prop value as a JSON Node / template.
*
@@ -95,12 +58,9 @@ public class CldsReferencePropertiesItCase {
*/
@Test
public void testGetFileContent() throws IOException {
- String location = "{\n\t\"DC1\": \"Data Center 1\","
- + "\n\t\"DC2\": \"Data Center 2\",\n\t\"DC3\": \"Data Center 3\"\n}\n";
- String content = refProp.getFileContent("ui.location.default");
- assertEquals(location, content);
+ String users = ResourceFileUtil.getResourceAsString("clds/clds-users.json");
+ assertEquals(users, refProp.getFileContent("files.cldsUsers"));
// Test composite key
- content = refProp.getFileContent("ui.location", "default");
- assertEquals(location, content);
+ assertEquals(users, refProp.getFileContent("files", "cldsUsers"));
}
}
diff --git a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
index a1499f720..fd215dd39 100644
--- a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
+++ b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
@@ -34,9 +34,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-
import javax.transaction.Transactional;
-
import org.apache.commons.lang3.RandomStringUtils;
import org.json.JSONException;
import org.junit.Assert;
@@ -44,6 +42,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.onap.clamp.clds.Application;
+import org.onap.clamp.clds.config.LegacyOperationalPolicy;
import org.onap.clamp.clds.exception.sdc.controller.BlueprintParserException;
import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException;
import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
@@ -74,7 +73,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-@ActiveProfiles(profiles = "clamp-default,clamp-default-user,clamp-sdc-controller")
+@ActiveProfiles(profiles = "clamp-default,clamp-default-user,clamp-sdc-controller,legacy-operational-policy")
public class CsarInstallerItCase {
private static final String CSAR_ARTIFACT_NAME = "example/sdc/service_Vloadbalancerms_csar.csar";
@@ -162,6 +161,13 @@ public class CsarInstallerItCase {
@Test
@Transactional
+ public void testPolicyModelAddedAtStartup() {
+ assertThat(policyModelsRepository.findByPolicyModelType(
+ LegacyOperationalPolicy.OPERATIONAL_POLICY_LEGACY).get(0)).isNotNull();
+ }
+
+ @Test
+ @Transactional
public void testGetPolicyModelYaml() throws IOException, SdcToscaParserException, CsarHandlerException {
INotificationData notificationData = Mockito.mock(INotificationData.class);
IArtifactInfo serviceArtifacts = Mockito.mock(IArtifactInfo.class);
diff --git a/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java b/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java
index 47b4b65c3..164625fef 100644
--- a/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java
+++ b/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java
@@ -90,7 +90,8 @@ public class LoopRepositoriesItCase {
}
private OperationalPolicy getOperationalPolicy(String configJson, String name, PolicyModel policyModel) {
- return new OperationalPolicy(name, null, new Gson().fromJson(configJson, JsonObject.class), policyModel, null, null, null);
+ return new OperationalPolicy(name, null, new Gson().fromJson(configJson, JsonObject.class), policyModel,
+ null, null, null);
}
private LoopElementModel getLoopElementModel(String yaml, String name, String policyType, String createdBy,
@@ -105,11 +106,13 @@ public class LoopRepositoriesItCase {
return new PolicyModel(policyType, policyModelTosca, version, policyAcronym);
}
- private LoopTemplate getLoopTemplate(String name, String blueprint, String svgRepresentation, String createdBy,
- Integer maxInstancesAllowed) {
+ private LoopTemplate getLoopTemplates(String name, String blueprint, String svgRepresentation, String createdBy,
+ Integer maxInstancesAllowed) {
LoopTemplate template = new LoopTemplate(name, blueprint, svgRepresentation, maxInstancesAllowed, null);
template.addLoopElementModel(getLoopElementModel("yaml", "microService1", "org.onap.policy.drools", createdBy,
getPolicyModel("org.onap.policy.drools", "yaml", "1.0.0", "Drools")));
+ template.addLoopElementModel(getLoopElementModel("yaml", "oppolicy1", "org.onap.policy.drools.legacy",
+ createdBy, getPolicyModel("org.onap.policy.drools.legacy", "yaml", "1.0.0", "DroolsLegacy")));
loopTemplateRepository.save(template);
return template;
}
@@ -123,7 +126,7 @@ public class LoopRepositoriesItCase {
loop.setLastComputedState(LoopState.DESIGN);
loop.setDcaeDeploymentId(dcaeId);
loop.setDcaeDeploymentStatusUrl(dcaeUrl);
- loop.setLoopTemplate(getLoopTemplate("templateName", "yaml", "svg", "toto", 1));
+ loop.setLoopTemplate(getLoopTemplates("templateName", "yaml", "svg", "toto", 1));
return loop;
}
@@ -149,7 +152,7 @@ public class LoopRepositoriesItCase {
Loop loopTest = getLoop("ControlLoopTest", "<xml></xml>", "yamlcontent", "{\"testname\":\"testvalue\"}",
"123456789", "https://dcaetest.org", "UUID-blueprint");
OperationalPolicy opPolicy = this.getOperationalPolicy("{\"type\":\"GUARD\"}", "GuardOpPolicyTest",
- getPolicyModel("org.onap.policy.drools", "yaml", "1.0.0", "Drools"));
+ getPolicyModel("org.onap.policy.drools.legacy", "yaml", "1.0.0", "DroolsLegacy"));
loopTest.addOperationalPolicy(opPolicy);
MicroServicePolicy microServicePolicy = getMicroServicePolicy("configPolicyTest", "{\"configtype\":\"json\"}",
"{\"param1\":\"value1\"}", true, getPolicyModel("org.onap.policy.drools", "yaml", "1.0.0", "Drools"));
diff --git a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
index de2ef145a..6c7836e50 100644
--- a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
+++ b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
@@ -37,6 +37,7 @@ import java.util.Random;
import org.junit.Test;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.loop.components.external.PolicyComponent;
import org.onap.clamp.loop.log.LogType;
import org.onap.clamp.loop.log.LoopLog;
import org.onap.clamp.loop.service.Service;
@@ -45,6 +46,7 @@ import org.onap.clamp.loop.template.LoopTemplate;
import org.onap.clamp.loop.template.PolicyModel;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
import org.onap.clamp.policy.operational.OperationalPolicy;
+import org.skyscreamer.jsonassert.JSONAssert;
public class LoopToJsonTest {
@@ -52,7 +54,7 @@ public class LoopToJsonTest {
private OperationalPolicy getOperationalPolicy(String configJson, String name) {
return new OperationalPolicy(name, null, gson.fromJson(configJson, JsonObject.class),
- getPolicyModel("org.onap.policy.drools", "yaml", "1.0.0", "Drools", "type1"), null, null, null);
+ getPolicyModel("org.onap.policy.drools.legacy", "yaml", "1.0.0", "Drools", "type1"), null,null,null);
}
private Loop getLoop(String name, String svgRepresentation, String blueprint, String globalPropertiesJson,
diff --git a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java
index 370c319b3..89d3e6172 100644
--- a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java
+++ b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java
@@ -24,9 +24,9 @@
package org.onap.clamp.loop;
import static org.assertj.core.api.Assertions.assertThat;
+
import com.google.gson.Gson;
import com.google.gson.JsonObject;
-
import java.io.IOException;
import java.util.HashSet;
import org.apache.camel.Exchange;
@@ -44,13 +44,13 @@ import org.onap.clamp.policy.operational.OperationalPolicy;
public class PolicyComponentTest {
/**
- * Test the computeState method.
- * oldState newState expectedFinalState
- * NOT_SENT SENT_AND_DEPLOYED NOT_SENT
- * NOT_SENT SENT NOT_SENT
- * NOT_SENT NOT_SENT NOT_SENT
- * NOT_SENT IN_ERROR IN_ERROR
- */
+ * Test the computeState method.
+ * oldState newState expectedFinalState
+ * NOT_SENT SENT_AND_DEPLOYED NOT_SENT
+ * NOT_SENT SENT NOT_SENT
+ * NOT_SENT NOT_SENT NOT_SENT
+ * NOT_SENT IN_ERROR IN_ERROR
+ */
@Test
public void computeStateTestOriginalStateUnknown() {
Exchange exchange = Mockito.mock(Exchange.class);
@@ -81,14 +81,15 @@ public class PolicyComponentTest {
ExternalComponentState state3 = policy.computeState(exchange);
assertThat(state3.getStateName()).isEqualTo("IN_ERROR");
}
+
/**
- * Test the computeState method.
- * oldState newState expectedFinalState
- * NOT_SENT SENT_AND_DEPLOYED NOT_SENT
- * NOT_SENT SENT NOT_SENT
- * NOT_SENT NOT_SENT NOT_SENT
- * NOT_SENT IN_ERROR IN_ERROR
- */
+ * Test the computeState method.
+ * oldState newState expectedFinalState
+ * NOT_SENT SENT_AND_DEPLOYED NOT_SENT
+ * NOT_SENT SENT NOT_SENT
+ * NOT_SENT NOT_SENT NOT_SENT
+ * NOT_SENT IN_ERROR IN_ERROR
+ */
@Test
public void computeStateTestOriginalStateNotSent() {
Exchange exchange = Mockito.mock(Exchange.class);
@@ -124,13 +125,13 @@ public class PolicyComponentTest {
/**
- * Test the computeState method.
- * oldState newState expectedFinalState
- * SENT SENT SENT
- * SENT SENT_AND_DEPLOYED SENT
- * SENT IN_ERROR IN_ERROR
- * SENT NOT_SENT NOT_SENT
- */
+ * Test the computeState method.
+ * oldState newState expectedFinalState
+ * SENT SENT SENT
+ * SENT SENT_AND_DEPLOYED SENT
+ * SENT IN_ERROR IN_ERROR
+ * SENT NOT_SENT NOT_SENT
+ */
@Test
public void computeStateTestOriginalStateSent() throws IOException {
Exchange exchange = Mockito.mock(Exchange.class);
@@ -166,13 +167,13 @@ public class PolicyComponentTest {
}
/**
- * Test the computeState method.
- * oldState newState expectedFinalState
- * SENT_AND_DEPLOYED SENT_AND_DEPLOYED SENT_AND_DEPLOYED
- * SENT_AND_DEPLOYED SENT SENT
- * SENT_AND_DEPLOYED IN_ERROR IN_ERROR
- * SENT_AND_DEPLOYED NOT_SENT NOT_SENT
- */
+ * Test the computeState method.
+ * oldState newState expectedFinalState
+ * SENT_AND_DEPLOYED SENT_AND_DEPLOYED SENT_AND_DEPLOYED
+ * SENT_AND_DEPLOYED SENT SENT
+ * SENT_AND_DEPLOYED IN_ERROR IN_ERROR
+ * SENT_AND_DEPLOYED NOT_SENT NOT_SENT
+ */
@Test
public void computeStateTestOriginalStateSentAndDeployed() throws IOException {
Exchange exchange = Mockito.mock(Exchange.class);
@@ -209,13 +210,13 @@ public class PolicyComponentTest {
/**
- * Test the computeState method.
- * oldState newState expectedFinalState
- * IN_ERROR SENT_AND_DEPLOYED IN_ERROR
- * IN_ERROR SENT IN_ERROR
- * IN_ERROR IN_ERROR IN_ERROR
- * IN_ERROR NOT_SENT IN_ERROR
- */
+ * Test the computeState method.
+ * oldState newState expectedFinalState
+ * IN_ERROR SENT_AND_DEPLOYED IN_ERROR
+ * IN_ERROR SENT IN_ERROR
+ * IN_ERROR IN_ERROR IN_ERROR
+ * IN_ERROR NOT_SENT IN_ERROR
+ */
@Test
public void computeStateTestOriginalStateInError() throws IOException {
Exchange exchange = Mockito.mock(Exchange.class);
@@ -265,7 +266,8 @@ public class PolicyComponentTest {
PolicyModel policyModel2 = new PolicyModel("onap.policies.controlloop.Operational", null, "1.0.0");
OperationalPolicy opPolicy = new OperationalPolicy("opPolicy", loopTest,
- new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), policyModel2, null, "pdpGroup2", "pdpSubgroup2");
+ new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), policyModel2, null, "pdpGroup2",
+ "pdpSubgroup2");
loopTest.addOperationalPolicy(opPolicy);
LoopTemplate loopTemplate = new LoopTemplate("test", "yaml", "svg", 1, null);
diff --git a/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java b/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java
index d918a8e6d..b16aa558d 100644
--- a/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java
+++ b/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java
@@ -119,7 +119,7 @@ public class PolicyModelServiceItCase {
/**
* This tests a create Policy Model from Tosca.
*
- * @throws IOException
+ * @throws IOException In case of failure
*/
@Test
@Transactional
@@ -137,7 +137,7 @@ public class PolicyModelServiceItCase {
/**
* This tests a update Policy Model.
*
- * @throws IOException
+ * @throws IOException In case of failure
*/
@Test
@Transactional
diff --git a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java b/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java
index 3f502ff78..2cd301850 100644
--- a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java
+++ b/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java
@@ -68,9 +68,12 @@ public class PolicyEngineControllerTestItCase {
Instant firstExecution = policyController.getLastInstantExecuted();
assertThat(firstExecution).isNotNull();
List<PolicyModel> policyModelsList = policyModelsRepository.findAll();
- assertThat(policyModelsList.size()).isGreaterThanOrEqualTo(8);
- assertThat(policyModelsList).contains(new PolicyModel("onap.policies.Monitoring", null, "1.0.0"));
- assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.Operational", null, "1.0.0"));
+ assertThat(policyModelsList.size()).isGreaterThanOrEqualTo(5);
+ assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.operational.Drools", null, "1.0.0"));
+ assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.operational.Apex", null, "1.0.0"));
+ assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.guard.FrequencyLimiter", null, "1.0.0"));
+ assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.guard.Blacklist", null, "1.0.0"));
+ assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.guard.MinMax", null, "2.0.0"));
// Re-do it to check that there is no issue with duplicate key
policyController.synchronizeAllPolicies();
diff --git a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
index 5686bc161..4b8eee921 100644
--- a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
+++ b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
@@ -31,6 +31,7 @@ import java.io.IOException;
import java.util.Map;
import org.junit.Test;
import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.loop.template.PolicyModel;
import org.onap.clamp.policy.operational.LegacyOperationalPolicy;
import org.onap.clamp.policy.operational.OperationalPolicy;
import org.skyscreamer.jsonassert.JSONAssert;
@@ -38,10 +39,11 @@ import org.skyscreamer.jsonassert.JSONAssert;
public class OperationalPolicyPayloadTest {
@Test
- public void testOperationalPolicyPayloadConstruction() throws IOException {
+ public void testOperationalPolicyLegacyPayloadConstruction() throws IOException {
JsonObject jsonConfig = new GsonBuilder().create().fromJson(
ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
- OperationalPolicy policy = new OperationalPolicy("testPolicy", null, jsonConfig, null, null, null, null);
+ OperationalPolicy policy = new OperationalPolicy("testPolicy.legacy", null, jsonConfig,
+ new PolicyModel("onap.policies.controlloop.Operational.legacy","","1.0.0","test"), null,null,null);
assertThat(policy.createPolicyPayloadYaml())
.isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload.yaml"));
diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties
index 5b921e9e3..e842abd4c 100644
--- a/src/test/resources/application.properties
+++ b/src/test/resources/application.properties
@@ -128,12 +128,6 @@ clamp.config.files.cldsUsers=classpath:/clds/clds-users.json
clamp.config.files.globalProperties=classpath:/clds/templates/globalProperties.json
clamp.config.files.sdcController=classpath:/clds/sdc-controllers-config.json
-# Properties for Clamp
-# DCAE request build properties
-#
-clamp.config.dcae.template=classpath:/clds/templates/dcae-template.json
-clamp.config.dcae.deployment.template=classpath:/clds/templates/dcae-deployment-template.json
-#
#
# Configuration Settings for Policy Engine Components
clamp.config.policy.api.url=http4://localhost:${docker.http-cache.port.host}
@@ -143,37 +137,9 @@ clamp.config.policy.pap.url=http4://localhost:${docker.http-cache.port.host}
clamp.config.policy.pap.userName=healthcheck
clamp.config.policy.pap.password=zb!XztG34
-# TCA MicroService Policy request build properties
-#
-clamp.config.tca.policyid.prefix=DCAE.Config_
-clamp.config.tca.policy.template=classpath:/clds/templates/tca-policy-template.json
-clamp.config.tca.template=classpath:/clds/templates/tca-template.json
-clamp.config.tca.thresholds.template=classpath:/clds/templates/tca-thresholds-template.json
-
-#
-#
-# Operational Policy request build properties
-#
-clamp.config.op.policyDescription=from clds
-# default
-clamp.config.op.templateName=ClosedLoopControlName
-clamp.config.op.operationTopic=APPC-CL
-clamp.config.op.notificationTopic=POLICY-CL-MGT
-clamp.config.op.controller=amsterdam
-clamp.config.op.policy.appc=APPC
-#
# Sdc service properties
#
clamp.config.sdc.csarFolder = ${project.build.directory}/sdc-tests
-clamp.config.sdc.blueprint.parser.mapping = classpath:/clds/blueprint-parser-mapping.json
-#
-clamp.config.ui.location.default=classpath:/clds/templates/ui-location-default.json
-#
-# if action.test.override is true, then any action will be marked as test=true (even if incoming action request had test=false); otherwise, test flag will be unchanged on the action request
-clamp.config.action.test.override=false
-# if action.insert.test.event is true, then insert event even if the action is set to test
-clamp.config.action.insert.test.event=false
-clamp.config.clds.service.cache.invalidate.after.seconds=120
#DCAE Inventory Url Properties
clamp.config.dcae.inventory.url=http4://localhost:${docker.http-cache.port.host}
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes&#63;connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes&#63;connectionTimeToLive=5000/.file
index ab3b40e2f..4b27438cc 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes&#63;connectionTimeToLive=5000/.file
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes&#63;connectionTimeToLive=5000/.file
@@ -1,40 +1,19 @@
tosca_definitions_version: tosca_simple_yaml_1_0_0
policy_types:
- - onap.policies.Monitoring:
- version: 1.0.0
- description: A base policy type for all policies that govern monitoring provision
- derived_from: tosca.policies.Root
- properties:
- # Omitted for brevity, see Section 1
-
- - onap.policies.controlloop.Operational:
- version: 1.0.0
- description: Operational Policy for Control Loops
- derived_from: tosca.policies.Root
- properties:
- # Omitted for brevity, see Section 1
-
- - onap.policies.controloop.operational.Drools:
+ - onap.policies.controlloop.operational.Drools:
version: 1.0.0
description: Operational Policy for Control Loops using the Drools PDP
- derived_from: onap.policies.controlloop.Operational
+ derived_from: onapy.policies.controlloop.Operational
properties:
# Omitted for brevity, see Section 1
- - onap.policies.controloop.operational.Apex:
+ - onap.policies.controlloop.operational.Apex:
version: 1.0.0
description: Operational Policy for Control Loops using the APEX PDP
derived_from: onap.policies.controlloop.Operational
properties:
# Omitted for brevity, see Section 1
- - onap.policies.controlloop.Guard:
- version: 1.0.0
- description: Operational Policy for Control Loops
- derived_from: tosca.policies.Root
- properties:
- # Omitted for brevity, see Section 1
-
- onap.policies.controlloop.guard.FrequencyLimiter:
version: 1.0.0
description: Supports limiting the frequency of actions being taken by a Actor.
@@ -50,7 +29,7 @@ policy_types:
# Omitted for brevity, see Section 1
- onap.policies.controlloop.guard.MinMax:
- version: 1.0.0
+ version: 2.0.0
description: Supports Min/Max number of VF Modules
derived_from: onap.policies.controlloop.Guard
properties:
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0&#63;connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0&#63;connectionTimeToLive=5000/.file
deleted file mode 100644
index b0119f887..000000000
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0&#63;connectionTimeToLive=5000/.file
+++ /dev/null
@@ -1,158 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_0_0
-policy_types:
- onap.policies.Monitoring:
- derived_from: tosca.policies.Root
- description: a base policy type for all policies that governs monitoring provisioning
- onap.policies.monitoring.cdap.tca.hi.lo.app:
- derived_from: onap.policies.Monitoring
- version: 1.0.0
- properties:
- tca_policy:
- type: map
- description: TCA Policy JSON
- entry_schema:
- type: onap.datatypes.monitoring.tca_policy
-data_types:
- onap.datatypes.monitoring.metricsPerEventName:
- derived_from: tosca.datatypes.Root
- properties:
- controlLoopSchemaType:
- type: string
- required: true
- description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM
- constraints:
- - valid_values:
- - VM
- - VNF
- eventName:
- type: string
- required: true
- description: Event name to which thresholds need to be applied
- policyName:
- type: string
- required: true
- description: TCA Policy Scope Name
- policyScope:
- type: string
- required: true
- description: TCA Policy Scope
- policyVersion:
- type: string
- required: true
- description: TCA Policy Scope Version
- thresholds:
- type: list
- required: true
- description: Thresholds associated with eventName
- entry_schema:
- type: onap.datatypes.monitoring.thresholds
- onap.datatypes.monitoring.tca_policy:
- derived_from: tosca.datatypes.Root
- properties:
- domain:
- type: string
- required: true
- description: Domain name to which TCA needs to be applied
- default: measurementsForVfScaling
- constraints:
- - equal: measurementsForVfScaling
- metricsPerEventName:
- type: list
- required: true
- description: Contains eventName and threshold details that need to be applied to given eventName
- entry_schema:
- type: onap.datatypes.monitoring.metricsPerEventName
- onap.datatypes.monitoring.thresholds:
- derived_from: tosca.datatypes.Root
- properties:
- closedLoopControlName:
- type: string
- required: true
- description: Closed Loop Control Name associated with the threshold
- closedLoopEventStatus:
- type: string
- required: true
- description: Closed Loop Event Status of the threshold
- constraints:
- - valid_values:
- - ONSET
- - ABATED
- direction:
- type: string
- required: true
- description: Direction of the threshold
- constraints:
- - valid_values:
- - LESS
- - LESS_OR_EQUAL
- - GREATER
- - GREATER_OR_EQUAL
- - EQUAL
- fieldPath:
- type: string
- required: true
- description: Json field Path as per CEF message which needs to be analyzed for TCA
- constraints:
- - valid_values:
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage
- - $.event.measurementsForVfScalingFields.meanRequestLatency
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed
- - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value
- severity:
- type: string
- required: true
- description: Threshold Event Severity
- constraints:
- - valid_values:
- - CRITICAL
- - MAJOR
- - MINOR
- - WARNING
- - NORMAL
- thresholdValue:
- type: integer
- required: true
- description: Threshold value for the field Path inside CEF message
- version:
- type: string
- required: true
- description: Version number associated with the threshold
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0&#63;connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0&#63;connectionTimeToLive=5000/.header
deleted file mode 100644
index 6a280d972..000000000
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0&#63;connectionTimeToLive=5000/.header
+++ /dev/null
@@ -1 +0,0 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0&#63;connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0&#63;connectionTimeToLive=5000/.file
deleted file mode 100644
index b0119f887..000000000
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0&#63;connectionTimeToLive=5000/.file
+++ /dev/null
@@ -1,158 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_0_0
-policy_types:
- onap.policies.Monitoring:
- derived_from: tosca.policies.Root
- description: a base policy type for all policies that governs monitoring provisioning
- onap.policies.monitoring.cdap.tca.hi.lo.app:
- derived_from: onap.policies.Monitoring
- version: 1.0.0
- properties:
- tca_policy:
- type: map
- description: TCA Policy JSON
- entry_schema:
- type: onap.datatypes.monitoring.tca_policy
-data_types:
- onap.datatypes.monitoring.metricsPerEventName:
- derived_from: tosca.datatypes.Root
- properties:
- controlLoopSchemaType:
- type: string
- required: true
- description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM
- constraints:
- - valid_values:
- - VM
- - VNF
- eventName:
- type: string
- required: true
- description: Event name to which thresholds need to be applied
- policyName:
- type: string
- required: true
- description: TCA Policy Scope Name
- policyScope:
- type: string
- required: true
- description: TCA Policy Scope
- policyVersion:
- type: string
- required: true
- description: TCA Policy Scope Version
- thresholds:
- type: list
- required: true
- description: Thresholds associated with eventName
- entry_schema:
- type: onap.datatypes.monitoring.thresholds
- onap.datatypes.monitoring.tca_policy:
- derived_from: tosca.datatypes.Root
- properties:
- domain:
- type: string
- required: true
- description: Domain name to which TCA needs to be applied
- default: measurementsForVfScaling
- constraints:
- - equal: measurementsForVfScaling
- metricsPerEventName:
- type: list
- required: true
- description: Contains eventName and threshold details that need to be applied to given eventName
- entry_schema:
- type: onap.datatypes.monitoring.metricsPerEventName
- onap.datatypes.monitoring.thresholds:
- derived_from: tosca.datatypes.Root
- properties:
- closedLoopControlName:
- type: string
- required: true
- description: Closed Loop Control Name associated with the threshold
- closedLoopEventStatus:
- type: string
- required: true
- description: Closed Loop Event Status of the threshold
- constraints:
- - valid_values:
- - ONSET
- - ABATED
- direction:
- type: string
- required: true
- description: Direction of the threshold
- constraints:
- - valid_values:
- - LESS
- - LESS_OR_EQUAL
- - GREATER
- - GREATER_OR_EQUAL
- - EQUAL
- fieldPath:
- type: string
- required: true
- description: Json field Path as per CEF message which needs to be analyzed for TCA
- constraints:
- - valid_values:
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage
- - $.event.measurementsForVfScalingFields.meanRequestLatency
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed
- - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value
- severity:
- type: string
- required: true
- description: Threshold Event Severity
- constraints:
- - valid_values:
- - CRITICAL
- - MAJOR
- - MINOR
- - WARNING
- - NORMAL
- thresholdValue:
- type: integer
- required: true
- description: Threshold value for the field Path inside CEF message
- version:
- type: string
- required: true
- description: Version number associated with the threshold
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0&#63;connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0&#63;connectionTimeToLive=5000/.header
deleted file mode 100644
index 6a280d972..000000000
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0&#63;connectionTimeToLive=5000/.header
+++ /dev/null
@@ -1 +0,0 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0&#63;connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0&#63;connectionTimeToLive=5000/.file
index b0119f887..91a825212 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0&#63;connectionTimeToLive=5000/.file
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0&#63;connectionTimeToLive=5000/.file
@@ -1,158 +1,40 @@
tosca_definitions_version: tosca_simple_yaml_1_0_0
policy_types:
- onap.policies.Monitoring:
- derived_from: tosca.policies.Root
- description: a base policy type for all policies that governs monitoring provisioning
- onap.policies.monitoring.cdap.tca.hi.lo.app:
- derived_from: onap.policies.Monitoring
- version: 1.0.0
- properties:
- tca_policy:
- type: map
- description: TCA Policy JSON
- entry_schema:
- type: onap.datatypes.monitoring.tca_policy
+ onap.policies.controlloop.Guard:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ description: Guard Policies for Control Loop Operational Policies
+ onap.policies.controlloop.guard.Blacklist:
+ derived_from: onap.policies.controlloop.Guard
+ version: 1.0.0
+ description: Supports blacklist of VNF's from performing control loop actions on.
+ properties:
+ blacklist_policy:
+ type: map
+ description: null
+ entry_schema:
+ type: onap.datatypes.guard.Blacklist
data_types:
- onap.datatypes.monitoring.metricsPerEventName:
- derived_from: tosca.datatypes.Root
- properties:
- controlLoopSchemaType:
- type: string
- required: true
- description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM
- constraints:
- - valid_values:
- - VM
- - VNF
- eventName:
- type: string
- required: true
- description: Event name to which thresholds need to be applied
- policyName:
- type: string
- required: true
- description: TCA Policy Scope Name
- policyScope:
- type: string
- required: true
- description: TCA Policy Scope
- policyVersion:
- type: string
- required: true
- description: TCA Policy Scope Version
- thresholds:
- type: list
- required: true
- description: Thresholds associated with eventName
- entry_schema:
- type: onap.datatypes.monitoring.thresholds
- onap.datatypes.monitoring.tca_policy:
- derived_from: tosca.datatypes.Root
- properties:
- domain:
- type: string
- required: true
- description: Domain name to which TCA needs to be applied
- default: measurementsForVfScaling
- constraints:
- - equal: measurementsForVfScaling
- metricsPerEventName:
- type: list
- required: true
- description: Contains eventName and threshold details that need to be applied to given eventName
- entry_schema:
- type: onap.datatypes.monitoring.metricsPerEventName
- onap.datatypes.monitoring.thresholds:
- derived_from: tosca.datatypes.Root
- properties:
- closedLoopControlName:
- type: string
- required: true
- description: Closed Loop Control Name associated with the threshold
- closedLoopEventStatus:
- type: string
- required: true
- description: Closed Loop Event Status of the threshold
- constraints:
- - valid_values:
- - ONSET
- - ABATED
- direction:
- type: string
- required: true
- description: Direction of the threshold
- constraints:
- - valid_values:
- - LESS
- - LESS_OR_EQUAL
- - GREATER
- - GREATER_OR_EQUAL
- - EQUAL
- fieldPath:
- type: string
- required: true
- description: Json field Path as per CEF message which needs to be analyzed for TCA
- constraints:
- - valid_values:
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage
- - $.event.measurementsForVfScalingFields.meanRequestLatency
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed
- - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value
- severity:
- type: string
- required: true
- description: Threshold Event Severity
- constraints:
- - valid_values:
- - CRITICAL
- - MAJOR
- - MINOR
- - WARNING
- - NORMAL
- thresholdValue:
- type: integer
- required: true
- description: Threshold value for the field Path inside CEF message
- version:
- type: string
- required: true
- description: Version number associated with the threshold
+ onap.datatypes.guard.Blacklist:
+ derived_from: tosca.datatypes.Root
+ properties:
+ actor:
+ type: string
+ description: Specifies the Actor
+ required: true
+ recipe:
+ type: string
+ description: Specified the Recipe
+ required: true
+ time_range:
+ type: tosca.datatypes.TimeInterval
+ description: An optional range of time during the day the blacklist is valid for.
+ required: false
+ controlLoopName:
+ type: string
+ description: An optional specific control loop to apply this guard to.
+ required: false
+ blacklist:
+ type: list
+ description: List of VNF's
+ required: true \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0&#63;connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0&#63;connectionTimeToLive=5000/.file
index b0119f887..45e5471fc 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0&#63;connectionTimeToLive=5000/.file
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0&#63;connectionTimeToLive=5000/.file
@@ -1,158 +1,50 @@
tosca_definitions_version: tosca_simple_yaml_1_0_0
policy_types:
- onap.policies.Monitoring:
- derived_from: tosca.policies.Root
- description: a base policy type for all policies that governs monitoring provisioning
- onap.policies.monitoring.cdap.tca.hi.lo.app:
- derived_from: onap.policies.Monitoring
- version: 1.0.0
- properties:
- tca_policy:
- type: map
- description: TCA Policy JSON
- entry_schema:
- type: onap.datatypes.monitoring.tca_policy
+ onap.policies.controlloop.Guard:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ description: Guard Policies for Control Loop Operational Policies
+ onap.policies.controlloop.guard.FrequencyLimiter:
+ derived_from: onap.policies.controlloop.Guard
+ version: 1.0.0
+ description: Supports limiting the frequency of actions being taken by a Actor.
+ properties:
+ frequency_policy:
+ type: map
+ description: null
+ entry_schema:
+ type: onap.datatypes.guard.FrequencyLimiter
data_types:
- onap.datatypes.monitoring.metricsPerEventName:
- derived_from: tosca.datatypes.Root
- properties:
- controlLoopSchemaType:
- type: string
- required: true
- description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM
- constraints:
- - valid_values:
- - VM
- - VNF
- eventName:
- type: string
- required: true
- description: Event name to which thresholds need to be applied
- policyName:
- type: string
- required: true
- description: TCA Policy Scope Name
- policyScope:
- type: string
- required: true
- description: TCA Policy Scope
- policyVersion:
- type: string
- required: true
- description: TCA Policy Scope Version
- thresholds:
- type: list
- required: true
- description: Thresholds associated with eventName
- entry_schema:
- type: onap.datatypes.monitoring.thresholds
- onap.datatypes.monitoring.tca_policy:
- derived_from: tosca.datatypes.Root
- properties:
- domain:
- type: string
- required: true
- description: Domain name to which TCA needs to be applied
- default: measurementsForVfScaling
- constraints:
- - equal: measurementsForVfScaling
- metricsPerEventName:
- type: list
- required: true
- description: Contains eventName and threshold details that need to be applied to given eventName
- entry_schema:
- type: onap.datatypes.monitoring.metricsPerEventName
- onap.datatypes.monitoring.thresholds:
- derived_from: tosca.datatypes.Root
- properties:
- closedLoopControlName:
- type: string
- required: true
- description: Closed Loop Control Name associated with the threshold
- closedLoopEventStatus:
- type: string
- required: true
- description: Closed Loop Event Status of the threshold
- constraints:
- - valid_values:
- - ONSET
- - ABATED
- direction:
- type: string
- required: true
- description: Direction of the threshold
- constraints:
- - valid_values:
- - LESS
- - LESS_OR_EQUAL
- - GREATER
- - GREATER_OR_EQUAL
- - EQUAL
- fieldPath:
- type: string
- required: true
- description: Json field Path as per CEF message which needs to be analyzed for TCA
- constraints:
- - valid_values:
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage
- - $.event.measurementsForVfScalingFields.meanRequestLatency
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed
- - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value
- severity:
- type: string
- required: true
- description: Threshold Event Severity
- constraints:
- - valid_values:
- - CRITICAL
- - MAJOR
- - MINOR
- - WARNING
- - NORMAL
- thresholdValue:
- type: integer
- required: true
- description: Threshold value for the field Path inside CEF message
- version:
- type: string
- required: true
- description: Version number associated with the threshold
+ onap.datatypes.guard.FrequencyLimiter:
+ derived_from: tosca.datatypes.Root
+ properties:
+ actor:
+ type: string
+ description: Specifies the Actor
+ required: true
+ recipe:
+ type: string
+ description: Specified the Recipe
+ required: true
+ time_window:
+ type: scalar-unit.time
+ description: The time window to count the actions against.
+ required: true
+ limit:
+ type: integer
+ description: The limit
+ required: true
+ constraints:
+ - greater_than: 0
+ time_range:
+ type: tosca.datatypes.TimeInterval
+ description: An optional range of time during the day the frequency is valid for.
+ required: false
+ controlLoopName:
+ type: string
+ description: An optional specific control loop to apply this guard to.
+ required: false
+ target:
+ type: string
+ description: An optional specific VNF to apply this guard to.
+ required: false \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0&#63;connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0&#63;connectionTimeToLive=5000/.file
index b0119f887..54c4204e2 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0&#63;connectionTimeToLive=5000/.file
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0&#63;connectionTimeToLive=5000/.file
@@ -1,158 +1,44 @@
tosca_definitions_version: tosca_simple_yaml_1_0_0
policy_types:
- onap.policies.Monitoring:
- derived_from: tosca.policies.Root
- description: a base policy type for all policies that governs monitoring provisioning
- onap.policies.monitoring.cdap.tca.hi.lo.app:
- derived_from: onap.policies.Monitoring
- version: 1.0.0
- properties:
- tca_policy:
- type: map
- description: TCA Policy JSON
- entry_schema:
- type: onap.datatypes.monitoring.tca_policy
+ onap.policies.controlloop.Guard:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ description: Guard Policies for Control Loop Operational Policies
+ onap.policies.controlloop.guard.MinMax:
+ derived_from: onap.policies.controlloop.Guard
+ version: 1.0.0
+ description: Supports Min/Max number of VF Modules
+ properties:
+ minmax_policy:
+ type: map
+ description: null
+ entry_schema:
+ type: onap.datatypes.guard.MinMax
data_types:
- onap.datatypes.monitoring.metricsPerEventName:
- derived_from: tosca.datatypes.Root
- properties:
- controlLoopSchemaType:
- type: string
- required: true
- description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM
- constraints:
- - valid_values:
- - VM
- - VNF
- eventName:
- type: string
- required: true
- description: Event name to which thresholds need to be applied
- policyName:
- type: string
- required: true
- description: TCA Policy Scope Name
- policyScope:
- type: string
- required: true
- description: TCA Policy Scope
- policyVersion:
- type: string
- required: true
- description: TCA Policy Scope Version
- thresholds:
- type: list
- required: true
- description: Thresholds associated with eventName
- entry_schema:
- type: onap.datatypes.monitoring.thresholds
- onap.datatypes.monitoring.tca_policy:
- derived_from: tosca.datatypes.Root
- properties:
- domain:
- type: string
- required: true
- description: Domain name to which TCA needs to be applied
- default: measurementsForVfScaling
- constraints:
- - equal: measurementsForVfScaling
- metricsPerEventName:
- type: list
- required: true
- description: Contains eventName and threshold details that need to be applied to given eventName
- entry_schema:
- type: onap.datatypes.monitoring.metricsPerEventName
- onap.datatypes.monitoring.thresholds:
- derived_from: tosca.datatypes.Root
- properties:
- closedLoopControlName:
- type: string
- required: true
- description: Closed Loop Control Name associated with the threshold
- closedLoopEventStatus:
- type: string
- required: true
- description: Closed Loop Event Status of the threshold
- constraints:
- - valid_values:
- - ONSET
- - ABATED
- direction:
- type: string
- required: true
- description: Direction of the threshold
- constraints:
- - valid_values:
- - LESS
- - LESS_OR_EQUAL
- - GREATER
- - GREATER_OR_EQUAL
- - EQUAL
- fieldPath:
- type: string
- required: true
- description: Json field Path as per CEF message which needs to be analyzed for TCA
- constraints:
- - valid_values:
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage
- - $.event.measurementsForVfScalingFields.meanRequestLatency
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed
- - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value
- severity:
- type: string
- required: true
- description: Threshold Event Severity
- constraints:
- - valid_values:
- - CRITICAL
- - MAJOR
- - MINOR
- - WARNING
- - NORMAL
- thresholdValue:
- type: integer
- required: true
- description: Threshold value for the field Path inside CEF message
- version:
- type: string
- required: true
- description: Version number associated with the threshold
+ onap.datatypes.guard.MinMax:
+ derived_from: tosca.datatypes.Root
+ properties:
+ actor:
+ type: string
+ description: Specifies the Actor
+ required: true
+ recipe:
+ type: string
+ description: Specified the Recipe
+ required: true
+ time_range:
+ type: tosca.datatypes.TimeInterval
+ description: An optional range of time during the day the Min/Max limit is valid for.
+ required: false
+ controlLoopName:
+ type: string
+ description: An optional specific control loop to apply this guard to.
+ required: false
+ min_vf_module_instances:
+ type: integer
+ required: true
+ description: The minimum instances of this VF-Module
+ max_vf_module_instances:
+ type: integer
+ required: false
+ description: The maximum instances of this VF-Module \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Apex/versions/1.0.0&#63;connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Apex/versions/1.0.0&#63;connectionTimeToLive=5000/.file
deleted file mode 100644
index b0119f887..000000000
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Apex/versions/1.0.0&#63;connectionTimeToLive=5000/.file
+++ /dev/null
@@ -1,158 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_0_0
-policy_types:
- onap.policies.Monitoring:
- derived_from: tosca.policies.Root
- description: a base policy type for all policies that governs monitoring provisioning
- onap.policies.monitoring.cdap.tca.hi.lo.app:
- derived_from: onap.policies.Monitoring
- version: 1.0.0
- properties:
- tca_policy:
- type: map
- description: TCA Policy JSON
- entry_schema:
- type: onap.datatypes.monitoring.tca_policy
-data_types:
- onap.datatypes.monitoring.metricsPerEventName:
- derived_from: tosca.datatypes.Root
- properties:
- controlLoopSchemaType:
- type: string
- required: true
- description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM
- constraints:
- - valid_values:
- - VM
- - VNF
- eventName:
- type: string
- required: true
- description: Event name to which thresholds need to be applied
- policyName:
- type: string
- required: true
- description: TCA Policy Scope Name
- policyScope:
- type: string
- required: true
- description: TCA Policy Scope
- policyVersion:
- type: string
- required: true
- description: TCA Policy Scope Version
- thresholds:
- type: list
- required: true
- description: Thresholds associated with eventName
- entry_schema:
- type: onap.datatypes.monitoring.thresholds
- onap.datatypes.monitoring.tca_policy:
- derived_from: tosca.datatypes.Root
- properties:
- domain:
- type: string
- required: true
- description: Domain name to which TCA needs to be applied
- default: measurementsForVfScaling
- constraints:
- - equal: measurementsForVfScaling
- metricsPerEventName:
- type: list
- required: true
- description: Contains eventName and threshold details that need to be applied to given eventName
- entry_schema:
- type: onap.datatypes.monitoring.metricsPerEventName
- onap.datatypes.monitoring.thresholds:
- derived_from: tosca.datatypes.Root
- properties:
- closedLoopControlName:
- type: string
- required: true
- description: Closed Loop Control Name associated with the threshold
- closedLoopEventStatus:
- type: string
- required: true
- description: Closed Loop Event Status of the threshold
- constraints:
- - valid_values:
- - ONSET
- - ABATED
- direction:
- type: string
- required: true
- description: Direction of the threshold
- constraints:
- - valid_values:
- - LESS
- - LESS_OR_EQUAL
- - GREATER
- - GREATER_OR_EQUAL
- - EQUAL
- fieldPath:
- type: string
- required: true
- description: Json field Path as per CEF message which needs to be analyzed for TCA
- constraints:
- - valid_values:
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage
- - $.event.measurementsForVfScalingFields.meanRequestLatency
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed
- - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value
- severity:
- type: string
- required: true
- description: Threshold Event Severity
- constraints:
- - valid_values:
- - CRITICAL
- - MAJOR
- - MINOR
- - WARNING
- - NORMAL
- thresholdValue:
- type: integer
- required: true
- description: Threshold value for the field Path inside CEF message
- version:
- type: string
- required: true
- description: Version number associated with the threshold
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Apex/versions/1.0.0&#63;connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Apex/versions/1.0.0&#63;connectionTimeToLive=5000/.header
deleted file mode 100644
index 6a280d972..000000000
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Apex/versions/1.0.0&#63;connectionTimeToLive=5000/.header
+++ /dev/null
@@ -1 +0,0 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Drools/versions/1.0.0&#63;connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Drools/versions/1.0.0&#63;connectionTimeToLive=5000/.file
deleted file mode 100644
index b0119f887..000000000
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Drools/versions/1.0.0&#63;connectionTimeToLive=5000/.file
+++ /dev/null
@@ -1,158 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_0_0
-policy_types:
- onap.policies.Monitoring:
- derived_from: tosca.policies.Root
- description: a base policy type for all policies that governs monitoring provisioning
- onap.policies.monitoring.cdap.tca.hi.lo.app:
- derived_from: onap.policies.Monitoring
- version: 1.0.0
- properties:
- tca_policy:
- type: map
- description: TCA Policy JSON
- entry_schema:
- type: onap.datatypes.monitoring.tca_policy
-data_types:
- onap.datatypes.monitoring.metricsPerEventName:
- derived_from: tosca.datatypes.Root
- properties:
- controlLoopSchemaType:
- type: string
- required: true
- description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM
- constraints:
- - valid_values:
- - VM
- - VNF
- eventName:
- type: string
- required: true
- description: Event name to which thresholds need to be applied
- policyName:
- type: string
- required: true
- description: TCA Policy Scope Name
- policyScope:
- type: string
- required: true
- description: TCA Policy Scope
- policyVersion:
- type: string
- required: true
- description: TCA Policy Scope Version
- thresholds:
- type: list
- required: true
- description: Thresholds associated with eventName
- entry_schema:
- type: onap.datatypes.monitoring.thresholds
- onap.datatypes.monitoring.tca_policy:
- derived_from: tosca.datatypes.Root
- properties:
- domain:
- type: string
- required: true
- description: Domain name to which TCA needs to be applied
- default: measurementsForVfScaling
- constraints:
- - equal: measurementsForVfScaling
- metricsPerEventName:
- type: list
- required: true
- description: Contains eventName and threshold details that need to be applied to given eventName
- entry_schema:
- type: onap.datatypes.monitoring.metricsPerEventName
- onap.datatypes.monitoring.thresholds:
- derived_from: tosca.datatypes.Root
- properties:
- closedLoopControlName:
- type: string
- required: true
- description: Closed Loop Control Name associated with the threshold
- closedLoopEventStatus:
- type: string
- required: true
- description: Closed Loop Event Status of the threshold
- constraints:
- - valid_values:
- - ONSET
- - ABATED
- direction:
- type: string
- required: true
- description: Direction of the threshold
- constraints:
- - valid_values:
- - LESS
- - LESS_OR_EQUAL
- - GREATER
- - GREATER_OR_EQUAL
- - EQUAL
- fieldPath:
- type: string
- required: true
- description: Json field Path as per CEF message which needs to be analyzed for TCA
- constraints:
- - valid_values:
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage
- - $.event.measurementsForVfScalingFields.meanRequestLatency
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed
- - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value
- severity:
- type: string
- required: true
- description: Threshold Event Severity
- constraints:
- - valid_values:
- - CRITICAL
- - MAJOR
- - MINOR
- - WARNING
- - NORMAL
- thresholdValue:
- type: integer
- required: true
- description: Threshold value for the field Path inside CEF message
- version:
- type: string
- required: true
- description: Version number associated with the threshold
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Drools/versions/1.0.0&#63;connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Drools/versions/1.0.0&#63;connectionTimeToLive=5000/.header
deleted file mode 100644
index 6a280d972..000000000
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controloop.operational.Drools/versions/1.0.0&#63;connectionTimeToLive=5000/.header
+++ /dev/null
@@ -1 +0,0 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0&#63;connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0&#63;connectionTimeToLive=5000/.file
index b0119f887..5fa4308db 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0&#63;connectionTimeToLive=5000/.file
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0&#63;connectionTimeToLive=5000/.file
@@ -1,158 +1,159 @@
tosca_definitions_version: tosca_simple_yaml_1_0_0
policy_types:
- onap.policies.Monitoring:
- derived_from: tosca.policies.Root
- description: a base policy type for all policies that governs monitoring provisioning
- onap.policies.monitoring.cdap.tca.hi.lo.app:
- derived_from: onap.policies.Monitoring
- version: 1.0.0
- properties:
- tca_policy:
- type: map
- description: TCA Policy JSON
- entry_schema:
- type: onap.datatypes.monitoring.tca_policy
+ onap.policies.Monitoring:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ description: a base policy type for all policies that govern monitoring provisioning
+ onap.policies.monitoring.cdap.tca.hi.lo.app:
+ derived_from: onap.policies.Monitoring
+ version: 1.0.0
+ properties:
+ tca_policy:
+ type: map
+ description: TCA Policy JSON
+ entry_schema:
+ type: onap.datatypes.monitoring.tca_policy
data_types:
- onap.datatypes.monitoring.metricsPerEventName:
- derived_from: tosca.datatypes.Root
- properties:
- controlLoopSchemaType:
- type: string
- required: true
- description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM
- constraints:
- - valid_values:
- - VM
- - VNF
- eventName:
- type: string
- required: true
- description: Event name to which thresholds need to be applied
- policyName:
- type: string
- required: true
- description: TCA Policy Scope Name
- policyScope:
- type: string
- required: true
- description: TCA Policy Scope
- policyVersion:
- type: string
- required: true
- description: TCA Policy Scope Version
- thresholds:
- type: list
- required: true
- description: Thresholds associated with eventName
- entry_schema:
- type: onap.datatypes.monitoring.thresholds
- onap.datatypes.monitoring.tca_policy:
- derived_from: tosca.datatypes.Root
- properties:
- domain:
- type: string
- required: true
- description: Domain name to which TCA needs to be applied
- default: measurementsForVfScaling
- constraints:
- - equal: measurementsForVfScaling
- metricsPerEventName:
- type: list
- required: true
- description: Contains eventName and threshold details that need to be applied to given eventName
- entry_schema:
- type: onap.datatypes.monitoring.metricsPerEventName
- onap.datatypes.monitoring.thresholds:
- derived_from: tosca.datatypes.Root
- properties:
- closedLoopControlName:
- type: string
- required: true
- description: Closed Loop Control Name associated with the threshold
- closedLoopEventStatus:
- type: string
- required: true
- description: Closed Loop Event Status of the threshold
- constraints:
- - valid_values:
- - ONSET
- - ABATED
- direction:
- type: string
- required: true
- description: Direction of the threshold
- constraints:
- - valid_values:
- - LESS
- - LESS_OR_EQUAL
- - GREATER
- - GREATER_OR_EQUAL
- - EQUAL
- fieldPath:
- type: string
- required: true
- description: Json field Path as per CEF message which needs to be analyzed for TCA
- constraints:
- - valid_values:
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated
- - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait
- - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage
- - $.event.measurementsForVfScalingFields.meanRequestLatency
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree
- - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed
- - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value
- severity:
- type: string
- required: true
- description: Threshold Event Severity
- constraints:
- - valid_values:
- - CRITICAL
- - MAJOR
- - MINOR
- - WARNING
- - NORMAL
- thresholdValue:
- type: integer
- required: true
- description: Threshold value for the field Path inside CEF message
- version:
- type: string
- required: true
- description: Version number associated with the threshold
+ onap.datatypes.monitoring.metricsPerEventName:
+ derived_from: tosca.datatypes.Root
+ properties:
+ controlLoopSchemaType:
+ type: string
+ required: true
+ description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM
+ constraints:
+ - valid_values:
+ - VM
+ - VNF
+ eventName:
+ type: string
+ required: true
+ description: Event name to which thresholds need to be applied
+ policyName:
+ type: string
+ required: true
+ description: TCA Policy Scope Name
+ policyScope:
+ type: string
+ required: true
+ description: TCA Policy Scope
+ policyVersion:
+ type: string
+ required: true
+ description: TCA Policy Scope Version
+ thresholds:
+ type: list
+ required: true
+ description: Thresholds associated with eventName
+ entry_schema:
+ type: onap.datatypes.monitoring.thresholds
+ onap.datatypes.monitoring.tca_policy:
+ derived_from: tosca.datatypes.Root
+ properties:
+ domain:
+ type: string
+ required: true
+ description: Domain name to which TCA needs to be applied
+ default: measurementsForVfScaling
+ constraints:
+ - equal: measurementsForVfScaling
+ metricsPerEventName:
+ type: list
+ required: true
+ description: Contains eventName and threshold details that need to be applied to given eventName
+ entry_schema:
+ type: onap.datatypes.monitoring.metricsPerEventName
+ onap.datatypes.monitoring.thresholds:
+ derived_from: tosca.datatypes.Root
+ properties:
+ closedLoopControlName:
+ type: string
+ required: true
+ description: Closed Loop Control Name associated with the threshold
+ closedLoopEventStatus:
+ type: string
+ required: true
+ description: Closed Loop Event Status of the threshold
+ constraints:
+ - valid_values:
+ - ONSET
+ - ABATED
+ direction:
+ type: string
+ required: true
+ description: Direction of the threshold
+ constraints:
+ - valid_values:
+ - LESS
+ - LESS_OR_EQUAL
+ - GREATER
+ - GREATER_OR_EQUAL
+ - EQUAL
+ fieldPath:
+ type: string
+ required: true
+ description: Json field Path as per CEF message which needs to be analyzed for TCA
+ constraints:
+ - valid_values:
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage
+ - $.event.measurementsForVfScalingFields.meanRequestLatency
+ - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered
+ - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached
+ - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured
+ - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree
+ - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed
+ - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value
+ severity:
+ type: string
+ required: true
+ description: Threshold Event Severity
+ constraints:
+ - valid_values:
+ - CRITICAL
+ - MAJOR
+ - MINOR
+ - WARNING
+ - NORMAL
+ thresholdValue:
+ type: integer
+ required: true
+ description: Threshold value for the field Path inside CEF message
+ version:
+ type: string
+ required: true
+ description: Version number associated with the threshold \ No newline at end of file
diff --git a/src/test/resources/tosca/operational-policy-payload.json b/src/test/resources/tosca/operational-policy-payload.json
index bfb109ec1..033eecd17 100644
--- a/src/test/resources/tosca/operational-policy-payload.json
+++ b/src/test/resources/tosca/operational-policy-payload.json
@@ -1,4 +1,4 @@
{
- "policy-id": "testPolicy",
+ "policy-id": "testPolicy.legacy",
"content": "controlLoop%3A%0A++abatement%3A+true%0A++controlLoopName%3A+LOOP_ASJOy_v1_0_ResourceInstanceName1_tca%0A++timeout%3A+0%0A++trigger_policy%3A+policy1%0Apolicies%3A%0A-+actor%3A+APPC%0A++failure%3A+policy2%0A++failure_exception%3A+final_failure_exception%0A++failure_guard%3A+final_failure_guard%0A++failure_retries%3A+final_failure_retries%0A++failure_timeout%3A+final_failure_timeout%0A++id%3A+policy1%0A++payload%3A%0A++++configurationParameters%3A+%27%5B%7B%22ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B10%5D.value%22%2C%22oam-ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B15%5D.value%22%2C%22enabled%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B22%5D.value%22%7D%5D%27%0A++++requestParameters%3A+%27%7B%22usePreload%22%3Atrue%2C%22userParams%22%3A%5B%5D%7D%27%0A++recipe%3A+Restart%0A++retry%3A+0%0A++success%3A+final_success%0A++target%3A%0A++++resourceID%3A+vLoadBalancerMS%0A++++type%3A+VNF%0A++timeout%3A+0%0A-+actor%3A+SO%0A++failure%3A+final_failure%0A++failure_exception%3A+final_failure_exception%0A++failure_guard%3A+final_failure_guard%0A++failure_retries%3A+final_failure_retries%0A++failure_timeout%3A+final_failure_timeout%0A++id%3A+policy2%0A++recipe%3A+VF+Module+Create%0A++retry%3A+0%0A++success%3A+final_success%0A++target%3A%0A++++modelCustomizationId%3A+1bffdc31-a37d-4dee-b65c-dde623a76e52%0A++++modelInvariantId%3A+ca052563-eb92-4b5b-ad41-9111768ce043%0A++++modelName%3A+Vloadbalancerms..vpkg..module-1%0A++++modelVersion%3A+1%0A++++modelVersionId%3A+1e725ccc-b823-4f67-82b9-4f4367070dbc%0A++++resourceID%3A+Vloadbalancerms..vpkg..module-1%0A++++type%3A+VFMODULE%0A++timeout%3A+0%0A"
} \ No newline at end of file
diff --git a/src/test/resources/tosca/operational-policy-payload.yaml b/src/test/resources/tosca/operational-policy-payload.yaml
index ed03842f5..4e667e59b 100644
--- a/src/test/resources/tosca/operational-policy-payload.yaml
+++ b/src/test/resources/tosca/operational-policy-payload.yaml
@@ -1,11 +1,11 @@
tosca_definitions_version: tosca_simple_yaml_1_0_0
topology_template:
policies:
- - testPolicy:
+ - testPolicy.legacy:
type: onap.policies.controlloop.Operational
version: 1.0.0
metadata:
- policy-id: testPolicy
+ policy-id: testPolicy.legacy
properties:
controlLoop:
timeout: '0'