summaryrefslogtreecommitdiffstats
path: root/models-tosca
diff options
context:
space:
mode:
Diffstat (limited to 'models-tosca')
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplate.java10
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyGuardMessageBodyHandler.java56
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyGuardPolicy.java30
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyOperationalMessageBodyHandler.java56
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyOperationalPolicy.java30
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaPoliciesJsonAdapter.java72
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaPolicyJsonAdapter.java85
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaServiceTemplateJsonAdapter.java75
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaServiceTemplateMessageBodyHandler.java64
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaTopologyTemplateJsonAdapter.java72
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplateTest.java3
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplateTest.java9
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/serialization/MonitoringPolicySerializationTest.java94
-rw-r--r--models-tosca/src/test/resources/logback-test.xml50
-rw-r--r--models-tosca/src/test/resources/policies/README.txt25
-rw-r--r--models-tosca/src/test/resources/policies/vCPE.policy.monitoring.input.tosca.json48
-rw-r--r--models-tosca/src/test/resources/policies/vCPE.policy.monitoring.input.tosca.yaml35
-rw-r--r--models-tosca/src/test/resources/policies/vCPE.policy.monitoring.output.tosca.yaml36
-rw-r--r--models-tosca/src/test/resources/policies/vCPE.policy.operational.input.json4
-rw-r--r--models-tosca/src/test/resources/policies/vCPE.policy.operational.input.tosca.yaml33
-rw-r--r--models-tosca/src/test/resources/policies/vCPE.policy.operational.output.json5
-rw-r--r--models-tosca/src/test/resources/policies/vCPE.policy.operational.output.tosca.json46
-rw-r--r--models-tosca/src/test/resources/policies/vCPE.policy.operational.output.tosca.yaml34
-rw-r--r--models-tosca/src/test/resources/policies/vDNS.policy.guard.frequency.input.json14
-rw-r--r--models-tosca/src/test/resources/policies/vDNS.policy.guard.frequency.output.json23
-rw-r--r--models-tosca/src/test/resources/policies/vDNS.policy.guard.minmax.input.json14
-rw-r--r--models-tosca/src/test/resources/policies/vDNS.policy.guard.minmax.output.json10
-rw-r--r--models-tosca/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.json46
-rw-r--r--models-tosca/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.yaml35
-rw-r--r--models-tosca/src/test/resources/policies/vDNS.policy.monitoring.output.tosca.yaml36
-rw-r--r--models-tosca/src/test/resources/policies/vDNS.policy.operational.input.json4
-rw-r--r--models-tosca/src/test/resources/policies/vDNS.policy.operational.input.tosca.yaml35
-rw-r--r--models-tosca/src/test/resources/policies/vDNS.policy.operational.output.json5
-rw-r--r--models-tosca/src/test/resources/policies/vDNS.policy.operational.output.tosca.json49
-rw-r--r--models-tosca/src/test/resources/policies/vDNS.policy.operational.output.tosca.yaml36
-rw-r--r--models-tosca/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.json43
-rw-r--r--models-tosca/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.yaml35
-rw-r--r--models-tosca/src/test/resources/policies/vFirewall.policy.operational.input.json4
-rw-r--r--models-tosca/src/test/resources/policies/vFirewall.policy.operational.input.tosca.json46
-rw-r--r--models-tosca/src/test/resources/policies/vFirewall.policy.operational.input.tosca.yaml35
-rw-r--r--models-tosca/src/test/resources/policies/vFirewall.policy.operational.output.json5
-rw-r--r--models-tosca/src/test/resources/policies/vFirewall.policy.operational.output.tosca.yaml36
-rw-r--r--models-tosca/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml17
-rw-r--r--models-tosca/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml158
44 files changed, 1648 insertions, 10 deletions
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplate.java
index e8541f514..aed181f94 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplate.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplate.java
@@ -38,8 +38,8 @@ import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
import org.onap.policy.common.utils.validation.Assertions;
import org.onap.policy.models.base.PfConcept;
-import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfKey;
+import org.onap.policy.models.base.PfReferenceKey;
import org.onap.policy.models.base.PfValidationMessage;
import org.onap.policy.models.base.PfValidationResult;
import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@@ -59,7 +59,7 @@ public class ToscaTopologyTemplate extends PfConcept {
private static final long serialVersionUID = 8969698734673232603L;
@EmbeddedId
- private PfConceptKey key;
+ private PfReferenceKey key;
@Column(name = "description")
private String description;
@@ -71,7 +71,7 @@ public class ToscaTopologyTemplate extends PfConcept {
* The Default Constructor creates a {@link ToscaTopologyTemplate} object with a null key.
*/
public ToscaTopologyTemplate() {
- this(new PfConceptKey());
+ this(new PfReferenceKey());
}
/**
@@ -80,7 +80,7 @@ public class ToscaTopologyTemplate extends PfConcept {
*
* @param key the key
*/
- public ToscaTopologyTemplate(@NonNull final PfConceptKey key) {
+ public ToscaTopologyTemplate(@NonNull final PfReferenceKey key) {
this.key = key;
}
@@ -169,7 +169,7 @@ public class ToscaTopologyTemplate extends PfConcept {
Assertions.instanceOf(copyObject, PfConcept.class);
final ToscaTopologyTemplate copy = ((ToscaTopologyTemplate) copyObject);
- copy.setKey(new PfConceptKey(key));
+ copy.setKey(new PfReferenceKey(key));
copy.setDescription(description);
copy.setPolicies(policies != null ? new ToscaPolicies(policies) : null);
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyGuardMessageBodyHandler.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyGuardMessageBodyHandler.java
new file mode 100644
index 000000000..b343c9e66
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyGuardMessageBodyHandler.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.policy.models.tosca.serialization.legacy;
+
+import com.google.gson.GsonBuilder;
+
+import org.onap.policy.common.gson.GsonMessageBodyHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Provider used to serialize and deserialize TOSCA objects using GSON.
+ */
+public class LegacyGuardMessageBodyHandler extends GsonMessageBodyHandler {
+
+ public static final Logger logger = LoggerFactory.getLogger(LegacyGuardMessageBodyHandler.class);
+
+ /**
+ * Constructs the object.
+ */
+ public LegacyGuardMessageBodyHandler() {
+ this(new GsonBuilder());
+
+ logger.info("Using GSON with TOSCA for REST calls");
+ }
+
+ /**
+ * Constructs the object.
+ *
+ * @param builder builder to use to create the gson object
+ */
+ public LegacyGuardMessageBodyHandler(final GsonBuilder builder) {
+ // @formatter:off
+ super(builder
+ .create()
+ );
+ // @formatter:on
+ }
+
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyGuardPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyGuardPolicy.java
new file mode 100644
index 000000000..a365696c3
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyGuardPolicy.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.models.tosca.serialization.legacy;
+
+/**
+ * Definition of a legacy guard policy stored as a TOSCA policy.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class LegacyGuardPolicy {
+
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyOperationalMessageBodyHandler.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyOperationalMessageBodyHandler.java
new file mode 100644
index 000000000..f51a427f0
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyOperationalMessageBodyHandler.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.policy.models.tosca.serialization.legacy;
+
+import com.google.gson.GsonBuilder;
+
+import org.onap.policy.common.gson.GsonMessageBodyHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Provider used to serialize and deserialize TOSCA objects using GSON.
+ */
+public class LegacyOperationalMessageBodyHandler extends GsonMessageBodyHandler {
+
+ public static final Logger logger = LoggerFactory.getLogger(LegacyOperationalMessageBodyHandler.class);
+
+ /**
+ * Constructs the object.
+ */
+ public LegacyOperationalMessageBodyHandler() {
+ this(new GsonBuilder());
+
+ logger.info("Using GSON with TOSCA for REST calls");
+ }
+
+ /**
+ * Constructs the object.
+ *
+ * @param builder builder to use to create the gson object
+ */
+ public LegacyOperationalMessageBodyHandler(final GsonBuilder builder) {
+ // @formatter:off
+ super(builder
+ .create()
+ );
+ // @formatter:on
+ }
+
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyOperationalPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyOperationalPolicy.java
new file mode 100644
index 000000000..0b63f2d68
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/legacy/LegacyOperationalPolicy.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.models.tosca.serialization.legacy;
+
+/**
+ * Definition of a legacy operational policy stored as a TOSCA policy.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class LegacyOperationalPolicy {
+
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaPoliciesJsonAdapter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaPoliciesJsonAdapter.java
new file mode 100644
index 000000000..a12ba8be9
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaPoliciesJsonAdapter.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.models.tosca.serialization.simple;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+
+import java.lang.reflect.Type;
+import java.util.Iterator;
+
+import lombok.NonNull;
+
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.tosca.concepts.ToscaPolicies;
+import org.onap.policy.models.tosca.concepts.ToscaPolicy;
+
+/**
+ * GSON type adapter for TOSCA policies.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaPoliciesJsonAdapter implements JsonSerializer<ToscaPolicies>, JsonDeserializer<ToscaPolicies> {
+ @Override
+ public ToscaPolicies deserialize(@NonNull final JsonElement policiesElement, @NonNull final Type type,
+ @NonNull final JsonDeserializationContext context) {
+ // The incoming JSON
+ final JsonArray policiesJsonArray = policiesElement.getAsJsonArray();
+
+ // The outgoing object
+ final PfConceptKey policiesKey = new PfConceptKey("IncomingPolicies", "0.0.1");
+ final ToscaPolicies policies = new ToscaPolicies(policiesKey);
+
+ // Get the policies
+ for (Iterator<JsonElement> policiesIterator = policiesJsonArray.iterator(); policiesIterator.hasNext(); ) {
+ ToscaPolicy policy = new ToscaPolicyJsonAdapter()
+ .deserialize(policiesIterator.next(), ToscaPolicy.class, context);
+
+ policies.getConceptMap().put(policy.getKey(), policy);
+ }
+
+ return policies;
+ }
+
+ @Override
+ public JsonElement serialize(@NonNull final ToscaPolicies policy, @NonNull final Type type,
+ @NonNull final JsonSerializationContext context) {
+
+ return null;
+ }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaPolicyJsonAdapter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaPolicyJsonAdapter.java
new file mode 100644
index 000000000..ae5e596ba
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaPolicyJsonAdapter.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.models.tosca.serialization.simple;
+
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+
+import java.lang.reflect.Type;
+
+import javax.ws.rs.core.Response;
+
+import lombok.NonNull;
+
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfModelRuntimeException;
+import org.onap.policy.models.tosca.concepts.ToscaPolicy;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * GSON type adapter for TOSCA policies.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaPolicyJsonAdapter implements JsonSerializer<ToscaPolicy>, JsonDeserializer<ToscaPolicy> {
+ // Logger for this class
+ private static final Logger LOGGER = LoggerFactory.getLogger(ToscaPolicyJsonAdapter.class);
+
+ @Override
+ public ToscaPolicy deserialize(@NonNull final JsonElement policyElement, @NonNull final Type type,
+ @NonNull final JsonDeserializationContext context) {
+
+ // The incoming JSON
+ final JsonObject policyJsonMapObject = policyElement.getAsJsonObject();
+
+ // We should only have a single entry for the policy
+ if (policyJsonMapObject.entrySet().size() != 1) {
+ String errorMessage = "a policy list entry may only contain one and only one policy";
+ LOGGER.debug(errorMessage);
+ throw new PfModelRuntimeException(Response.Status.NOT_ACCEPTABLE, errorMessage);
+ }
+
+ String policyName = policyJsonMapObject.entrySet().iterator().next().getKey();
+ JsonObject policyJsonObject = policyJsonMapObject.entrySet().iterator().next().getValue().getAsJsonObject();
+
+ PfConceptKey policyKey = new PfConceptKey(policyName, policyJsonObject.get("version").getAsString());
+ PfConceptKey policyTypeKey = new PfConceptKey(
+ policyJsonObject.get("type").getAsString(),
+ policyJsonObject.get("version").getAsString());
+ ToscaPolicy policy = new ToscaPolicy(policyKey, policyTypeKey);
+
+ // TODO: Rest of parsing
+
+ return policy;
+ }
+
+ @Override
+ public JsonElement serialize(@NonNull final ToscaPolicy policy, @NonNull final Type type,
+ @NonNull final JsonSerializationContext context) {
+
+ return null;
+ }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaServiceTemplateJsonAdapter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaServiceTemplateJsonAdapter.java
new file mode 100644
index 000000000..b08a33d64
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaServiceTemplateJsonAdapter.java
@@ -0,0 +1,75 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.models.tosca.serialization.simple;
+
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+
+import java.lang.reflect.Type;
+
+import lombok.NonNull;
+
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.tosca.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.concepts.ToscaTopologyTemplate;
+
+/**
+ * GSON type adapter for TOSCA policies.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaServiceTemplateJsonAdapter
+ implements JsonSerializer<ToscaServiceTemplate>, JsonDeserializer<ToscaServiceTemplate> {
+ @Override
+ public ToscaServiceTemplate deserialize(@NonNull final JsonElement serviceTemplateElement, @NonNull final Type type,
+ @NonNull final JsonDeserializationContext context) {
+
+ // The incoming JSON
+ final JsonObject serviceTemplateJsonObject = serviceTemplateElement.getAsJsonObject();
+
+ // The outgoing object
+ final PfConceptKey serviceTemplateKey = new PfConceptKey("IncomingServiceTemplate", "0.0.1");
+ final ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate(serviceTemplateKey);
+ serviceTemplate
+ .setToscaDefinitionsVersion(serviceTemplateJsonObject.get("tosca_definitions_version").getAsString());
+
+ if (serviceTemplateJsonObject.has("topology_template")) {
+ serviceTemplate.setTopologyTemplate(new ToscaTopologyTemplateJsonAdapter().deserialize(
+ serviceTemplateJsonObject.get("topology_template"), ToscaTopologyTemplate.class, context));
+ }
+
+ // Set the parent key of the topology template to be this service template
+ serviceTemplate.getTopologyTemplate().getKey().setParentConceptKey(serviceTemplateKey);
+
+ return serviceTemplate;
+ }
+
+ @Override
+ public JsonElement serialize(@NonNull final ToscaServiceTemplate serviceTemplate, @NonNull final Type type,
+ @NonNull final JsonSerializationContext context) {
+
+ return null;
+ }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaServiceTemplateMessageBodyHandler.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaServiceTemplateMessageBodyHandler.java
new file mode 100644
index 000000000..9abbf1c72
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaServiceTemplateMessageBodyHandler.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.policy.models.tosca.serialization.simple;
+
+import com.google.gson.GsonBuilder;
+
+import org.onap.policy.common.gson.GsonMessageBodyHandler;
+import org.onap.policy.models.tosca.concepts.ToscaPolicies;
+import org.onap.policy.models.tosca.concepts.ToscaPolicy;
+import org.onap.policy.models.tosca.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.concepts.ToscaTopologyTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Provider used to serialize and deserialize TOSCA objects using GSON.
+ */
+public class ToscaServiceTemplateMessageBodyHandler extends GsonMessageBodyHandler {
+
+ public static final Logger logger = LoggerFactory.getLogger(ToscaServiceTemplateMessageBodyHandler.class);
+
+ /**
+ * Constructs the object.
+ */
+ public ToscaServiceTemplateMessageBodyHandler() {
+ this(new GsonBuilder());
+
+ logger.info("Using GSON with TOSCA for REST calls");
+ }
+
+ /**
+ * Constructs the object.
+ *
+ * @param builder builder to use to create the gson object
+ */
+ public ToscaServiceTemplateMessageBodyHandler(final GsonBuilder builder) {
+ // @formatter:off
+ super(builder
+ .registerTypeAdapter(ToscaServiceTemplate.class, new ToscaServiceTemplateJsonAdapter())
+ .registerTypeAdapter(ToscaTopologyTemplate.class, new ToscaTopologyTemplateJsonAdapter())
+ .registerTypeAdapter(ToscaPolicies.class, new ToscaPoliciesJsonAdapter())
+ .registerTypeAdapter(ToscaPolicy.class, new ToscaPolicyJsonAdapter())
+ .create()
+ );
+ // @formatter:on
+ }
+
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaTopologyTemplateJsonAdapter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaTopologyTemplateJsonAdapter.java
new file mode 100644
index 000000000..4f2f590b7
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/serialization/simple/ToscaTopologyTemplateJsonAdapter.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.models.tosca.serialization.simple;
+
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+
+import java.lang.reflect.Type;
+
+import lombok.NonNull;
+
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfReferenceKey;
+import org.onap.policy.models.tosca.concepts.ToscaPolicies;
+import org.onap.policy.models.tosca.concepts.ToscaTopologyTemplate;
+
+/**
+ * GSON type adapter for TOSCA policies.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaTopologyTemplateJsonAdapter
+ implements JsonSerializer<ToscaTopologyTemplate>, JsonDeserializer<ToscaTopologyTemplate> {
+
+ @Override
+ public ToscaTopologyTemplate deserialize(@NonNull final JsonElement toplogyTemplateElement,
+ @NonNull final Type type, @NonNull final JsonDeserializationContext context) {
+
+ // The incoming JSON
+ final JsonObject topologyTemplateJsonObject = toplogyTemplateElement.getAsJsonObject();
+
+ // The outgoing object
+ final PfReferenceKey topologyTemplateKey = new PfReferenceKey(new PfConceptKey(), "IncomingTopologyTemplate");
+ final ToscaTopologyTemplate topologyTemplate = new ToscaTopologyTemplate(topologyTemplateKey);
+
+ if (topologyTemplateJsonObject.has("policies")) {
+ topologyTemplate.setPolicies(new ToscaPoliciesJsonAdapter()
+ .deserialize(topologyTemplateJsonObject.get("policies"), ToscaPolicies.class, context));
+ }
+
+ return topologyTemplate;
+ }
+
+ @Override
+ public JsonElement serialize(@NonNull final ToscaTopologyTemplate topologyTemplate, @NonNull final Type type,
+ @NonNull final JsonSerializationContext context) {
+
+ return null;
+ }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplateTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplateTest.java
index 0fc7a0bf3..5d8615814 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplateTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplateTest.java
@@ -31,6 +31,7 @@ import java.util.TreeMap;
import org.junit.Test;
import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfReferenceKey;
import org.onap.policy.models.base.PfValidationResult;
/**
@@ -103,7 +104,7 @@ public class ToscaServiceTemplateTest {
tst.setPolicyTypes(policyTypes);
assertEquals(policyTypes, tst.getPolicyTypes());
- PfConceptKey tttKey = new PfConceptKey("TopologyTemplate", "0.0.1");
+ PfReferenceKey tttKey = new PfReferenceKey(tstKey, "TopologyTemplate");
ToscaTopologyTemplate ttt = new ToscaTopologyTemplate(tttKey);
tst.setTopologyTemplate(ttt);
assertEquals(ttt, tst.getTopologyTemplate());
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplateTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplateTest.java
index 4a288f183..97bbdbe71 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplateTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplateTest.java
@@ -31,6 +31,7 @@ import java.util.TreeMap;
import org.junit.Test;
import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfReferenceKey;
import org.onap.policy.models.base.PfValidationResult;
/**
@@ -43,11 +44,11 @@ public class ToscaTopologyTemplateTest {
@Test
public void testTopologyTemplatePojo() {
assertNotNull(new ToscaTopologyTemplate());
- assertNotNull(new ToscaTopologyTemplate(new PfConceptKey()));
+ assertNotNull(new ToscaTopologyTemplate(new PfReferenceKey()));
assertNotNull(new ToscaTopologyTemplate(new ToscaTopologyTemplate()));
try {
- new ToscaTopologyTemplate((PfConceptKey) null);
+ new ToscaTopologyTemplate((PfReferenceKey) null);
fail("test should throw an exception");
} catch (Exception exc) {
assertEquals("key is marked @NonNull but is null", exc.getMessage());
@@ -60,7 +61,7 @@ public class ToscaTopologyTemplateTest {
assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
}
- PfConceptKey tttKey = new PfConceptKey("ttt", "0.0.1");
+ PfReferenceKey tttKey = new PfReferenceKey("tst", "0.0.1", "ttt");
ToscaTopologyTemplate ttt = new ToscaTopologyTemplate(tttKey);
ttt.setDescription("A Description");
@@ -89,7 +90,7 @@ public class ToscaTopologyTemplateTest {
assertEquals(0, ttt.compareTo(ttt));
assertFalse(ttt.compareTo(ttt.getKey()) == 0);
- PfConceptKey otherDtKey = new PfConceptKey("otherDt", "0.0.1");
+ PfReferenceKey otherDtKey = new PfReferenceKey("otherSt", "0.0.1", "otherDt");
ToscaTopologyTemplate otherDt = new ToscaTopologyTemplate(otherDtKey);
assertFalse(ttt.compareTo(otherDt) == 0);
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/serialization/MonitoringPolicySerializationTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/serialization/MonitoringPolicySerializationTest.java
new file mode 100644
index 000000000..07f5bca7d
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/serialization/MonitoringPolicySerializationTest.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.models.tosca.serialization;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonSyntaxException;
+
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.common.utils.resources.TextFileUtils;
+import org.onap.policy.models.base.PfValidationResult;
+import org.onap.policy.models.tosca.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.serialization.simple.ToscaServiceTemplateMessageBodyHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.yaml.snakeyaml.Yaml;
+
+/**
+ * Test serialization of monitoring policies.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class MonitoringPolicySerializationTest {
+ // Logger for this class
+ private static final Logger LOGGER = LoggerFactory.getLogger(MonitoringPolicySerializationTest.class);
+
+ private Gson gson;
+
+ @Before
+ public void setUp() {
+ gson = new ToscaServiceTemplateMessageBodyHandler().getGson();
+ }
+
+ @Test
+ public void testJsonDeserialization() throws JsonSyntaxException, IOException {
+ ToscaServiceTemplate serviceTemplate = gson.fromJson(
+ TextFileUtils
+ .getTextFileAsString("src/test/resources/policies/vCPE.policy.monitoring.input.tosca.json"),
+ ToscaServiceTemplate.class);
+
+ assertNotNull(serviceTemplate);
+ LOGGER.info(serviceTemplate.validate(new PfValidationResult()).toString());
+ assertTrue(serviceTemplate.validate(new PfValidationResult()).isValid());
+
+ assertEquals("onap.vcpe.tca:1.0.0",
+ serviceTemplate.getTopologyTemplate().getPolicies().get("onap.vcpe.tca").getId());
+ assertEquals("onap.vcpe.tca:1.0.0",
+ serviceTemplate.getTopologyTemplate().getPolicies().get("onap.vcpe.tca").getId());
+ }
+
+ @Test
+ public void testYamlDeserialization() throws JsonSyntaxException, IOException {
+ Yaml yaml = new Yaml();
+ Object yamlObject = yaml.load(TextFileUtils
+ .getTextFileAsString("src/test/resources/policies/vCPE.policy.monitoring.input.tosca.yaml"));
+
+ String yamlAsJsonString = new Gson().toJson(yamlObject);
+
+ ToscaServiceTemplate serviceTemplate = gson.fromJson(yamlAsJsonString, ToscaServiceTemplate.class);
+
+ assertNotNull(serviceTemplate);
+ LOGGER.info(serviceTemplate.validate(new PfValidationResult()).toString());
+ assertTrue(serviceTemplate.validate(new PfValidationResult()).isValid());
+
+ assertEquals("onap.vcpe.tca:1.0.0",
+ serviceTemplate.getTopologyTemplate().getPolicies().get("onap.vcpe.tca").getId());
+ assertEquals("onap.vcpe.tca:1.0.0",
+ serviceTemplate.getTopologyTemplate().getPolicies().get("onap.vcpe.tca").getId());
+ }
+}
diff --git a/models-tosca/src/test/resources/logback-test.xml b/models-tosca/src/test/resources/logback-test.xml
new file mode 100644
index 000000000..6e2737da6
--- /dev/null
+++ b/models-tosca/src/test/resources/logback-test.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ Copyright (C) 2016-2018 Ericsson. 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.
+
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+-->
+
+<configuration>
+
+ <contextName>Apex</contextName>
+ <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
+ <property name="LOG_DIR" value="${java.io.tmpdir}/pf_logging/" />
+
+ <!-- USE FOR STD OUT ONLY -->
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
+ </encoder>
+ </appender>
+
+ <root level="info">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+ <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${LOG_DIR}/apex.log</file>
+ <encoder>
+ <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
+ %logger{26} - %msg %n %ex{full}</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.onap.policy" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+</configuration>
diff --git a/models-tosca/src/test/resources/policies/README.txt b/models-tosca/src/test/resources/policies/README.txt
new file mode 100644
index 000000000..942913d5c
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/README.txt
@@ -0,0 +1,25 @@
+The "input" prefix indicates that this is what the payload looks like on the POST. While the "output" prefix
+indicates that this is what the payload looks like when the response goes back to the caller.
+
+For each of the use cases, there is at least one configuration policy for DCAE Microservice.
+
+*.monitoring.input.[json|yaml] <-- POST request
+
+*.monitoring.output.[json|yaml] --> POST response
+
+The Operational Policies:
+
+*.operational.input.yaml --> Can Pam change this to JSON??
+
+*.operational.output.json --> POST response
+
+The Guard Policies:
+
+*.guard.[frequency|minmax].json <-- POST request
+
+*.guard.[frequency|minmax].json --> POST response
+
+For DBAO, the following are internal TOSCA Representations for the Operational and Guard policies, with the
+contents of the yaml or JSON URL Encoded:
+
+*.output.tosca.yaml
diff --git a/models-tosca/src/test/resources/policies/vCPE.policy.monitoring.input.tosca.json b/models-tosca/src/test/resources/policies/vCPE.policy.monitoring.input.tosca.json
new file mode 100644
index 000000000..27de380c2
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vCPE.policy.monitoring.input.tosca.json
@@ -0,0 +1,48 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_0_0",
+ "topology_template": {
+ "policies": [
+ {
+ "onap.vcpe.tca": {
+ "type": "onap.policies.monitoring.cdap.tca.hi.lo.app",
+ "version": "1.0.0",
+ "metadata": {
+ "policy-id": "onap.vcpe.tca"
+ },
+ "properties": {
+ "domain": "measurementsForVfScaling",
+ "metricsPerEventName": [
+ {
+ "eventName": "Measurement_vGMUX",
+ "controlLoopSchemaType": "VNF",
+ "policyScope": "DCAE",
+ "policyName": "DCAE.Config_tca-hi-lo",
+ "policyVersion": "v0.0.1",
+ "thresholds": [
+ {
+ "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",
+ "version": "1.0.2",
+ "fieldPath": "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value",
+ "thresholdValue": 0,
+ "direction": "EQUAL",
+ "severity": "MAJOR",
+ "closedLoopEventStatus": "ABATED"
+ },
+ {
+ "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",
+ "version": "1.0.2",
+ "fieldPath": "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value",
+ "thresholdValue": 0,
+ "direction": "GREATER",
+ "severity": "CRITICAL",
+ "closedLoopEventStatus": "ONSET"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vCPE.policy.monitoring.input.tosca.yaml b/models-tosca/src/test/resources/policies/vCPE.policy.monitoring.input.tosca.yaml
new file mode 100644
index 000000000..a193cba41
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vCPE.policy.monitoring.input.tosca.yaml
@@ -0,0 +1,35 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+topology_template:
+ policies:
+ -
+ onap.vcpe.tca:
+ type: onap.policies.monitoring.cdap.tca.hi.lo.app
+ version: 1.0.0
+ metadata:
+ policy-id: onap.vcpe.tca
+ properties:
+ domain: measurementsForVfScaling
+ metricsPerEventName:
+ -
+ eventName: Measurement_vGMUX
+ controlLoopSchemaType: VNF
+ policyScope: DCAE
+ policyName: "DCAE.Config_tca-hi-lo"
+ policyVersion: "v0.0.1"
+ thresholds:
+ -
+ closedLoopControlName: "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e"
+ version: "1.0.2"
+ fieldPath: "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value"
+ thresholdValue: 0
+ direction: EQUAL
+ severity: MAJOR
+ closedLoopEventStatus: ABATED
+ -
+ closedLoopControlName: "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e"
+ version: "1.0.2"
+ fieldPath: "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value"
+ thresholdValue: 0
+ direction: GREATER
+ severity: CRITICAL
+ closedLoopEventStatus: ONSET \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vCPE.policy.monitoring.output.tosca.yaml b/models-tosca/src/test/resources/policies/vCPE.policy.monitoring.output.tosca.yaml
new file mode 100644
index 000000000..53ac55d28
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vCPE.policy.monitoring.output.tosca.yaml
@@ -0,0 +1,36 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+topology_template:
+ policies:
+ -
+ onap.vcpe.tca:
+ type: onap.policies.monitoring.cdap.tca.hi.lo.app
+ version: 1.0.0
+ metadata:
+ policy-id: onap.vcpe.tca
+ policy-version: 1
+ properties:
+ domain: measurementsForVfScaling
+ metricsPerEventName:
+ -
+ eventName: Measurement_vGMUX
+ controlLoopSchemaType: VNF
+ policyScope: DCAE
+ policyName: "DCAE.Config_tca-hi-lo"
+ policyVersion: "v0.0.1"
+ thresholds:
+ -
+ closedLoopControlName: "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e"
+ version: "1.0.2"
+ fieldPath: "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value"
+ thresholdValue: 0
+ direction: EQUAL
+ severity: MAJOR
+ closedLoopEventStatus: ABATED
+ -
+ closedLoopControlName: "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e"
+ version: "1.0.2"
+ fieldPath: "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value"
+ thresholdValue: 0
+ direction: GREATER
+ severity: CRITICAL
+ closedLoopEventStatus: ONSET \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vCPE.policy.operational.input.json b/models-tosca/src/test/resources/policies/vCPE.policy.operational.input.json
new file mode 100644
index 000000000..393cb0282
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vCPE.policy.operational.input.json
@@ -0,0 +1,4 @@
+{
+ "policy-id" : "operational.restart",
+ "content" : "controlLoop%3A%0A%20%20version%3A%202.0.0%0A%20%20controlLoopName%3A%20ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e%0A%20%20trigger_policy%3A%20unique-policy-id-1-restart%0A%20%20timeout%3A%203600%0A%20%20abatement%3A%20true%0A%20%0Apolicies%3A%0A%20%20-%20id%3A%20unique-policy-id-1-restart%0A%20%20%20%20name%3A%20Restart%20the%20VM%0A%20%20%20%20description%3A%0A%20%20%20%20actor%3A%20APPC%0A%20%20%20%20recipe%3A%20Restart%0A%20%20%20%20target%3A%0A%20%20%20%20%20%20type%3A%20VM%0A%20%20%20%20retry%3A%203%0A%20%20%20%20timeout%3A%201200%0A%20%20%20%20success%3A%20final_success%0A%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20failure_guard%3A%20final_failure_guard"
+} \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vCPE.policy.operational.input.tosca.yaml b/models-tosca/src/test/resources/policies/vCPE.policy.operational.input.tosca.yaml
new file mode 100644
index 000000000..dda0169f1
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vCPE.policy.operational.input.tosca.yaml
@@ -0,0 +1,33 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+topology_template:
+ policies:
+ -
+ operational.restart:
+ type: onap.policies.controlloop.Operational
+ version: 1.0.0
+ metadata:
+ policy-id: operational.restart
+ properties:
+ controlLoop:
+ version: 2.0.0
+ controlLoopName: ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 3600
+ abatement: true
+
+ policies:
+ - id: unique-policy-id-1-restart
+ name: Restart the VM
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ retry: 3
+ timeout: 1200
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+ failure_guard: final_failure_guard \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vCPE.policy.operational.output.json b/models-tosca/src/test/resources/policies/vCPE.policy.operational.output.json
new file mode 100644
index 000000000..7d26e8e67
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vCPE.policy.operational.output.json
@@ -0,0 +1,5 @@
+{
+ "policy-id" : "operational.restart",
+ "policy-version" : "1",
+ "content" : "controlLoop%3A%0A%20%20version%3A%202.0.0%0A%20%20controlLoopName%3A%20ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e%0A%20%20trigger_policy%3A%20unique-policy-id-1-restart%0A%20%20timeout%3A%203600%0A%20%20abatement%3A%20true%0A%20%0Apolicies%3A%0A%20%20-%20id%3A%20unique-policy-id-1-restart%0A%20%20%20%20name%3A%20Restart%20the%20VM%0A%20%20%20%20description%3A%0A%20%20%20%20actor%3A%20APPC%0A%20%20%20%20recipe%3A%20Restart%0A%20%20%20%20target%3A%0A%20%20%20%20%20%20type%3A%20VM%0A%20%20%20%20retry%3A%203%0A%20%20%20%20timeout%3A%201200%0A%20%20%20%20success%3A%20final_success%0A%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20failure_guard%3A%20final_failure_guard"
+} \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vCPE.policy.operational.output.tosca.json b/models-tosca/src/test/resources/policies/vCPE.policy.operational.output.tosca.json
new file mode 100644
index 000000000..d73853735
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vCPE.policy.operational.output.tosca.json
@@ -0,0 +1,46 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_0_0",
+ "topology_template": {
+ "policies": [
+ {
+ "operational.restart": {
+ "type": "onap.policies.controlloop.Operational",
+ "version": "1.0.0",
+ "metadata": {
+ "policy-id": "operational.restart",
+ "policy-version": 1
+ },
+ "properties": {
+ "controlLoop": {
+ "version": "2.0.0",
+ "controlLoopName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",
+ "trigger_policy": "unique-policy-id-1-restart",
+ "timeout": 3600,
+ "abatement": true
+ },
+ "policies": [
+ {
+ "id": "unique-policy-id-1-restart",
+ "name": "Restart the VM",
+ "description": null,
+ "actor": "APPC",
+ "recipe": "Restart",
+ "target": {
+ "type": "VM"
+ },
+ "retry": 3,
+ "timeout": 1200,
+ "success": "final_success",
+ "failure": "final_failure",
+ "failure_timeout": "final_failure_timeout",
+ "failure_retries": "final_failure_retries",
+ "failure_exception": "final_failure_exception",
+ "failure_guard": "final_failure_guard"
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vCPE.policy.operational.output.tosca.yaml b/models-tosca/src/test/resources/policies/vCPE.policy.operational.output.tosca.yaml
new file mode 100644
index 000000000..e4a06947f
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vCPE.policy.operational.output.tosca.yaml
@@ -0,0 +1,34 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+topology_template:
+ policies:
+ -
+ operational.restart:
+ type: onap.policies.controlloop.Operational
+ version: 1.0.0
+ metadata:
+ policy-id: operational.restart
+ policy-version: 1
+ properties:
+ controlLoop:
+ version: 2.0.0
+ controlLoopName: ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 3600
+ abatement: true
+
+ policies:
+ - id: unique-policy-id-1-restart
+ name: Restart the VM
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ retry: 3
+ timeout: 1200
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+ failure_guard: final_failure_guard \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vDNS.policy.guard.frequency.input.json b/models-tosca/src/test/resources/policies/vDNS.policy.guard.frequency.input.json
new file mode 100644
index 000000000..442f3ec40
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vDNS.policy.guard.frequency.input.json
@@ -0,0 +1,14 @@
+{
+ "policy-id" : "guard.frequency.scaleout",
+ "content" : {
+ "actor": "SO",
+ "recipe": "scaleOut",
+ "targets": ".*",
+ "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",
+ "limit": "1",
+ "timeWindow": "10",
+ "timeUnits": "minute",
+ "guardActiveStart": "00:00:01-05:00",
+ "guardActiveEnd": "23:59:59-05:00"
+ }
+}
diff --git a/models-tosca/src/test/resources/policies/vDNS.policy.guard.frequency.output.json b/models-tosca/src/test/resources/policies/vDNS.policy.guard.frequency.output.json
new file mode 100644
index 000000000..48c92c3ba
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vDNS.policy.guard.frequency.output.json
@@ -0,0 +1,23 @@
+{
+ "guard.frequency.scaleout": {
+ "type": "onap.policies.controlloop.guard.FrequencyLimiter",
+ "version": "1.0.0",
+ "metadata": {
+ "policy-id": "guard.frequency.scaleout",
+ "policy-version": 1
+ },
+ "properties": {
+ "content": {
+ "actor": "SO",
+ "recipe": "scaleOut",
+ "targets": ".*",
+ "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",
+ "limit": "1",
+ "timeWindow": "10",
+ "timeUnits": "minute",
+ "guardActiveStart": "00:00:01-05:00",
+ "guardActiveEnd": "23:59:59-05:00"
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vDNS.policy.guard.minmax.input.json b/models-tosca/src/test/resources/policies/vDNS.policy.guard.minmax.input.json
new file mode 100644
index 000000000..c62a229a6
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vDNS.policy.guard.minmax.input.json
@@ -0,0 +1,14 @@
+{
+{
+ "policy-id" : "guard.minmax.scaleout",
+ "contents" : {
+ "actor": "SO",
+ "recipe": "scaleOut",
+ "targets": ".*",
+ "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",
+ "min": "1",
+ "max": "5",
+ "guardActiveStart": "00:00:01-05:00",
+ "guardActiveEnd": "23:59:59-05:00"
+ }
+} \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vDNS.policy.guard.minmax.output.json b/models-tosca/src/test/resources/policies/vDNS.policy.guard.minmax.output.json
new file mode 100644
index 000000000..83d2f272f
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vDNS.policy.guard.minmax.output.json
@@ -0,0 +1,10 @@
+{
+ "guard.minmax.scaleout": {
+ "type": "onap.policies.controlloop.guard.MinMax",
+ "version": "1.0.0",
+ "metadata": {
+ "policy-id": "guard.minmax.scaleout",
+ "policy-version": 1
+ }
+ }
+} \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.json b/models-tosca/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.json
new file mode 100644
index 000000000..69b52129b
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.json
@@ -0,0 +1,46 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_0_0",
+ "policies": [
+ {
+ "onap.scaleout.tca": {
+ "type": "onap.policies.monitoring.cdap.tca.hi.lo.app",
+ "version": "1.0.0",
+ "metadata": {
+ "policy-id": "onap.scaleout.tca"
+ },
+ "properties": {
+ "domain": "measurementsForVfScaling",
+ "metricsPerEventName": [
+ {
+ "eventName": "vLoadBalancer",
+ "controlLoopSchemaType": "VNF",
+ "policyScope": "type=configuration",
+ "policyName": "onap.scaleout.tca",
+ "policyVersion": "v0.0.1",
+ "thresholds": [
+ {
+ "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",
+ "closedLoopEventStatus": "ONSET",
+ "version": "1.0.2",
+ "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",
+ "thresholdValue": 500,
+ "direction": "LESS_OR_EQUAL",
+ "severity": "MAJOR"
+ },
+ {
+ "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",
+ "closedLoopEventStatus": "ONSET",
+ "version": "1.0.2",
+ "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",
+ "thresholdValue": 5000,
+ "direction": "GREATER_OR_EQUAL",
+ "severity": "CRITICAL"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.yaml b/models-tosca/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.yaml
new file mode 100644
index 000000000..054b994bb
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.yaml
@@ -0,0 +1,35 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+topology_template:
+ policies:
+ -
+ onap.scaleout.tca:
+ type: onap.policies.monitoring.cdap.tca.hi.lo.app
+ version: 1.0.0
+ metadata:
+ policy-id: onap.scaleout.tca
+ properties:
+ domain: measurementsForVfScaling
+ metricsPerEventName:
+ -
+ eventName: vLoadBalancer
+ controlLoopSchemaType: VNF
+ policyScope: "type=configuration"
+ policyName: "onap.scaleout.tca"
+ policyVersion: "v0.0.1"
+ thresholds:
+ -
+ closedLoopControlName: "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3"
+ closedLoopEventStatus: ONSET
+ version: "1.0.2"
+ fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated"
+ thresholdValue: 500
+ direction: LESS_OR_EQUAL
+ severity: MAJOR
+ -
+ closedLoopControlName: "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3"
+ closedLoopEventStatus: ONSET
+ version: "1.0.2"
+ fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated"
+ thresholdValue: 5000
+ direction: GREATER_OR_EQUAL
+ severity: CRITICAL
diff --git a/models-tosca/src/test/resources/policies/vDNS.policy.monitoring.output.tosca.yaml b/models-tosca/src/test/resources/policies/vDNS.policy.monitoring.output.tosca.yaml
new file mode 100644
index 000000000..5a2fac7b0
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vDNS.policy.monitoring.output.tosca.yaml
@@ -0,0 +1,36 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+topology_template:
+ policies:
+ -
+ onap.scaleout.tca:
+ type: onap.policies.monitoring.cdap.tca.hi.lo.app
+ version: 1.0.0
+ metadata:
+ policy-id: onap.scaleout.tca
+ policy-version: 1
+ properties:
+ domain: measurementsForVfScaling
+ metricsPerEventName:
+ -
+ eventName: vLoadBalancer
+ controlLoopSchemaType: VNF
+ policyScope: "type=configuration"
+ policyName: "onap.scaleout.tca"
+ policyVersion: "v0.0.1"
+ thresholds:
+ -
+ closedLoopControlName: "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3"
+ closedLoopEventStatus: ONSET
+ version: "1.0.2"
+ fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated"
+ thresholdValue: 500
+ direction: LESS_OR_EQUAL
+ severity: MAJOR
+ -
+ closedLoopControlName: "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3"
+ closedLoopEventStatus: ONSET
+ version: "1.0.2"
+ fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated"
+ thresholdValue: 5000
+ direction: GREATER_OR_EQUAL
+ severity: CRITICAL
diff --git a/models-tosca/src/test/resources/policies/vDNS.policy.operational.input.json b/models-tosca/src/test/resources/policies/vDNS.policy.operational.input.json
new file mode 100644
index 000000000..dabde0114
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vDNS.policy.operational.input.json
@@ -0,0 +1,4 @@
+{
+ "policy-id" : "operational.scaleout",
+ "content" : "controlLoop%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20version%3A%202.0.0%0A%20%20%20%20%20%20%20%20%20%20%20%20%20controlLoopName%3A%20ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3%0A%20%20%20%20%20%20%20%20%20%20%20%20%20trigger_policy%3A%20unique-policy-id-1-scale-up%0A%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%201200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20abatement%3A%20false%0A%20%20%20%20%20%20%20%20%20%20%20policies%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20-%20id%3A%20unique-policy-id-1-scale-up%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20name%3A%20Create%20a%20new%20VF%20Module%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20description%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20actor%3A%20SO%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20recipe%3A%20VF%20Module%20Create%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20target%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20type%3A%20VNF%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20payload%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20requestParameters%3A%20'%7B%22usePreload%22%3Atrue%2C%22userParams%22%3A%5B%5D%7D'%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20configurationParameters%3A%20'%5B%7B%22ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B9%5D%22%2C%22oam-ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B16%5D%22%2C%22enabled%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B23%5D%22%7D%5D'%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20retry%3A%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%201200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20success%3A%20final_success%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_guard%3A%20final_failure_guard"
+} \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vDNS.policy.operational.input.tosca.yaml b/models-tosca/src/test/resources/policies/vDNS.policy.operational.input.tosca.yaml
new file mode 100644
index 000000000..0f5498804
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vDNS.policy.operational.input.tosca.yaml
@@ -0,0 +1,35 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+topology_template:
+ policies:
+ -
+ operational.scaleout:
+ type: onap.policies.controlloop.Operational
+ version: 1.0.0
+ metadata:
+ policy-id: operational.scaleout
+ properties:
+ controlLoop:
+ version: 2.0.0
+ controlLoopName: ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ trigger_policy: unique-policy-id-1-scale-up
+ timeout: 1200
+ abatement: false
+ policies:
+ - id: unique-policy-id-1-scale-up
+ name: Create a new VF Module
+ description:
+ actor: SO
+ recipe: VF Module Create
+ target:
+ type: VNF
+ payload:
+ requestParameters: '{"usePreload":true,"userParams":[]}'
+ configurationParameters: '[{"ip-addr":"$.vf-module-topology.vf-module-parameters.param[9]","oam-ip-addr":"$.vf-module-topology.vf-module-parameters.param[16]","enabled":"$.vf-module-topology.vf-module-parameters.param[23]"}]'
+ retry: 0
+ timeout: 1200
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+ failure_guard: final_failure_guard \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vDNS.policy.operational.output.json b/models-tosca/src/test/resources/policies/vDNS.policy.operational.output.json
new file mode 100644
index 000000000..5ce44e0ba
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vDNS.policy.operational.output.json
@@ -0,0 +1,5 @@
+{
+ "policy-id" : "operational.scaleout",
+ "policy-version" : "1",
+ "content" : "controlLoop%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20version%3A%202.0.0%0A%20%20%20%20%20%20%20%20%20%20%20%20%20controlLoopName%3A%20ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3%0A%20%20%20%20%20%20%20%20%20%20%20%20%20trigger_policy%3A%20unique-policy-id-1-scale-up%0A%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%201200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20abatement%3A%20false%0A%20%20%20%20%20%20%20%20%20%20%20policies%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20-%20id%3A%20unique-policy-id-1-scale-up%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20name%3A%20Create%20a%20new%20VF%20Module%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20description%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20actor%3A%20SO%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20recipe%3A%20VF%20Module%20Create%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20target%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20type%3A%20VNF%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20payload%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20requestParameters%3A%20'%7B%22usePreload%22%3Atrue%2C%22userParams%22%3A%5B%5D%7D'%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20configurationParameters%3A%20'%5B%7B%22ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B9%5D%22%2C%22oam-ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B16%5D%22%2C%22enabled%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B23%5D%22%7D%5D'%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20retry%3A%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%201200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20success%3A%20final_success%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_guard%3A%20final_failure_guard"
+} \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vDNS.policy.operational.output.tosca.json b/models-tosca/src/test/resources/policies/vDNS.policy.operational.output.tosca.json
new file mode 100644
index 000000000..2478ff07a
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vDNS.policy.operational.output.tosca.json
@@ -0,0 +1,49 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_0_0",
+ "topology_template": {
+ "policies": [
+ {
+ "operational.scaleout": {
+ "type": "onap.policies.controlloop.Operational",
+ "version": "1.0.0",
+ "metadata": {
+ "policy-id": "operational.scaleout",
+ "policy-version": 1
+ },
+ "properties": null,
+ "controlLoop": {
+ "version": "2.0.0",
+ "controlLoopName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",
+ "trigger_policy": "unique-policy-id-1-scale-up",
+ "timeout": 1200,
+ "abatement": false
+ },
+ "policies": [
+ {
+ "id": "unique-policy-id-1-scale-up",
+ "name": "Create a new VF Module",
+ "description": null,
+ "actor": "SO",
+ "recipe": "VF Module Create",
+ "target": {
+ "type": "VNF"
+ },
+ "payload": {
+ "requestParameters": "{\"usePreload\":true,\"userParams\":[]}",
+ "configurationParameters": "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\",\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\",\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]"
+ },
+ "retry": 0,
+ "timeout": 1200,
+ "success": "final_success",
+ "failure": "final_failure",
+ "failure_timeout": "final_failure_timeout",
+ "failure_retries": "final_failure_retries",
+ "failure_exception": "final_failure_exception",
+ "failure_guard": "final_failure_guard"
+ }
+ ]
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vDNS.policy.operational.output.tosca.yaml b/models-tosca/src/test/resources/policies/vDNS.policy.operational.output.tosca.yaml
new file mode 100644
index 000000000..a09a235a4
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vDNS.policy.operational.output.tosca.yaml
@@ -0,0 +1,36 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+topology_template:
+ policies:
+ -
+ operational.scaleout:
+ type: onap.policies.controlloop.Operational
+ version: 1.0.0
+ metadata:
+ policy-id: operational.scaleout
+ policy-version: 1
+ properties:
+ controlLoop:
+ version: 2.0.0
+ controlLoopName: ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ trigger_policy: unique-policy-id-1-scale-up
+ timeout: 1200
+ abatement: false
+ policies:
+ - id: unique-policy-id-1-scale-up
+ name: Create a new VF Module
+ description:
+ actor: SO
+ recipe: VF Module Create
+ target:
+ type: VNF
+ payload:
+ requestParameters: '{"usePreload":true,"userParams":[]}'
+ configurationParameters: '[{"ip-addr":"$.vf-module-topology.vf-module-parameters.param[9]","oam-ip-addr":"$.vf-module-topology.vf-module-parameters.param[16]","enabled":"$.vf-module-topology.vf-module-parameters.param[23]"}]'
+ retry: 0
+ timeout: 1200
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+ failure_guard: final_failure_guard \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.json b/models-tosca/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.json
new file mode 100644
index 000000000..1593d2033
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.json
@@ -0,0 +1,43 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_0_0",
+ "policies": [
+ {
+ "onap.vfirewall.tca": {
+ "type": "onap.policy.monitoring.cdap.tca.hi.lo.app",
+ "version": "1.0.0",
+ "properties": {
+ "domain": "measurementsForVfScaling",
+ "metricsPerEventName": [
+ {
+ "eventName": "vLoadBalancer",
+ "controlLoopSchemaType": "VNF",
+ "policyScope": "resource=vLoadBalancer;type=configuration",
+ "policyName": "onap.vfirewall.tca",
+ "policyVersion": "v0.0.1",
+ "thresholds": [
+ {
+ "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",
+ "closedLoopEventStatus": "ONSET",
+ "version": "1.0.2",
+ "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",
+ "thresholdValue": 500,
+ "direction": "LESS_OR_EQUAL",
+ "severity": "MAJOR"
+ },
+ {
+ "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",
+ "closedLoopEventStatus": "ONSET",
+ "version": "1.0.2",
+ "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",
+ "thresholdValue": 5000,
+ "direction": "GREATER_OR_EQUAL",
+ "severity": "CRITICAL"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.yaml b/models-tosca/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.yaml
new file mode 100644
index 000000000..c59b89060
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.yaml
@@ -0,0 +1,35 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+topology_template:
+ policies:
+ -
+ onap.vfirewall.tca:
+ type: onap.policy.monitoring.cdap.tca.hi.lo.app
+ version: 1.0.0
+ metadata:
+ policy-id: onap.vfirewall.tca
+ properties:
+ domain: measurementsForVfScaling
+ metricsPerEventName:
+ -
+ eventName: vLoadBalancer
+ controlLoopSchemaType: VNF
+ policyScope: "resource=vLoadBalancer;type=configuration"
+ policyName: "onap.vfirewall.tca"
+ policyVersion: "v0.0.1"
+ thresholds:
+ -
+ closedLoopControlName: "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a"
+ closedLoopEventStatus: ONSET
+ version: "1.0.2"
+ fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated"
+ thresholdValue: 500
+ direction: LESS_OR_EQUAL
+ severity: MAJOR
+ -
+ closedLoopControlName: "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a"
+ closedLoopEventStatus: ONSET
+ version: "1.0.2"
+ fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated"
+ thresholdValue: 5000
+ direction: GREATER_OR_EQUAL
+ severity: CRITICAL \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vFirewall.policy.operational.input.json b/models-tosca/src/test/resources/policies/vFirewall.policy.operational.input.json
new file mode 100644
index 000000000..623a68992
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vFirewall.policy.operational.input.json
@@ -0,0 +1,4 @@
+{
+ "policy-id" : "operational.modifyconfig",
+ "content" : "controlLoop%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20version%3A%202.0.0%0A%20%20%20%20%20%20%20%20%20%20%20%20%20controlLoopName%3A%20ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0A%20%20%20%20%20%20%20%20%20%20%20%20%20trigger_policy%3A%20unique-policy-id-1-modifyConfig%0A%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%201200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20abatement%3A%20false%0A%20%0A%20%20%20%20%20%20%20%20%20%20%20policies%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20-%20id%3A%20unique-policy-id-1-modifyConfig%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20name%3A%20modify%20packet%20gen%20config%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20description%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20actor%3A%20APPC%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20recipe%3A%20ModifyConfig%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20target%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20TBD%20-%20Cannot%20be%20known%20until%20instantiation%20is%20done%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20resourceID%3A%20Eace933104d443b496b8.nodes.heat.vpg%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20type%3A%20VNF%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20retry%3A%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%20300%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20success%3A%20final_success%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_guard%3A%20final_failure_guard"
+} \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vFirewall.policy.operational.input.tosca.json b/models-tosca/src/test/resources/policies/vFirewall.policy.operational.input.tosca.json
new file mode 100644
index 000000000..63c0d8b85
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vFirewall.policy.operational.input.tosca.json
@@ -0,0 +1,46 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_0_0",
+ "topology_template": {
+ "policies": [
+ {
+ "operational.modifyconfig": {
+ "type": "onap.policies.controlloop.Operational",
+ "version": "1.0.0",
+ "metadata": {
+ "policy-id": "operational.modifyconfig"
+ },
+ "properties": {
+ "controlLoop": {
+ "version": "2.0.0",
+ "controlLoopName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",
+ "trigger_policy": "unique-policy-id-1-modifyConfig",
+ "timeout": 1200,
+ "abatement": false
+ },
+ "policies": [
+ {
+ "id": "unique-policy-id-1-modifyConfig",
+ "name": "modify packet gen config",
+ "description": null,
+ "actor": "APPC",
+ "recipe": "ModifyConfig",
+ "target": {
+ "resourceID": "Eace933104d443b496b8.nodes.heat.vpg",
+ "type": "VNF"
+ },
+ "retry": 0,
+ "timeout": 300,
+ "success": "final_success",
+ "failure": "final_failure",
+ "failure_timeout": "final_failure_timeout",
+ "failure_retries": "final_failure_retries",
+ "failure_exception": "final_failure_exception",
+ "failure_guard": "final_failure_guard"
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vFirewall.policy.operational.input.tosca.yaml b/models-tosca/src/test/resources/policies/vFirewall.policy.operational.input.tosca.yaml
new file mode 100644
index 000000000..ca36d5309
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vFirewall.policy.operational.input.tosca.yaml
@@ -0,0 +1,35 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+topology_template:
+ policies:
+ -
+ operational.modifyconfig:
+ type: onap.policies.controlloop.Operational
+ version: 1.0.0
+ metadata:
+ policy-id: operational.modifyconfig
+ properties:
+ controlLoop:
+ version: 2.0.0
+ controlLoopName: ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ trigger_policy: unique-policy-id-1-modifyConfig
+ timeout: 1200
+ abatement: false
+
+ policies:
+ - id: unique-policy-id-1-modifyConfig
+ name: modify packet gen config
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ # TBD - Cannot be known until instantiation is done
+ resourceID: Eace933104d443b496b8.nodes.heat.vpg
+ type: VNF
+ retry: 0
+ timeout: 300
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+ failure_guard: final_failure_guard \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vFirewall.policy.operational.output.json b/models-tosca/src/test/resources/policies/vFirewall.policy.operational.output.json
new file mode 100644
index 000000000..bb8b907f8
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vFirewall.policy.operational.output.json
@@ -0,0 +1,5 @@
+{
+ "policy-id" : "operational.modifyconfig",
+ "policy-version" : "1",
+ "content" : "controlLoop%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20version%3A%202.0.0%0A%20%20%20%20%20%20%20%20%20%20%20%20%20controlLoopName%3A%20ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0A%20%20%20%20%20%20%20%20%20%20%20%20%20trigger_policy%3A%20unique-policy-id-1-modifyConfig%0A%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%201200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20abatement%3A%20false%0A%20%0A%20%20%20%20%20%20%20%20%20%20%20policies%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20-%20id%3A%20unique-policy-id-1-modifyConfig%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20name%3A%20modify%20packet%20gen%20config%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20description%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20actor%3A%20APPC%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20recipe%3A%20ModifyConfig%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20target%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20TBD%20-%20Cannot%20be%20known%20until%20instantiation%20is%20done%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20resourceID%3A%20Eace933104d443b496b8.nodes.heat.vpg%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20type%3A%20VNF%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20retry%3A%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%20300%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20success%3A%20final_success%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_guard%3A%20final_failure_guard"
+} \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policies/vFirewall.policy.operational.output.tosca.yaml b/models-tosca/src/test/resources/policies/vFirewall.policy.operational.output.tosca.yaml
new file mode 100644
index 000000000..42ea511d9
--- /dev/null
+++ b/models-tosca/src/test/resources/policies/vFirewall.policy.operational.output.tosca.yaml
@@ -0,0 +1,36 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+topology_template:
+ policies:
+ -
+ operational.modifyconfig:
+ type: onap.policies.controlloop.Operational
+ version: 1.0.0
+ metadata:
+ policy-id: operational.modifyconfig
+ policy-version: 1
+ properties:
+ controlLoop:
+ version: 2.0.0
+ controlLoopName: ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ trigger_policy: unique-policy-id-1-modifyConfig
+ timeout: 1200
+ abatement: false
+
+ policies:
+ - id: unique-policy-id-1-modifyConfig
+ name: modify packet gen config
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ # TBD - Cannot be known until instantiation is done
+ resourceID: Eace933104d443b496b8.nodes.heat.vpg
+ type: VNF
+ retry: 0
+ timeout: 300
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+ failure_guard: final_failure_guard \ No newline at end of file
diff --git a/models-tosca/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml b/models-tosca/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml
new file mode 100644
index 000000000..5a093ddbf
--- /dev/null
+++ b/models-tosca/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml
@@ -0,0 +1,17 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+policy_types:
+ version: 1.0.0
+ onap.policies.Monitoring:
+ derived_from: tosca.policies.Root
+ description: a base policy type for all policies that govern monitoring provision
+ version: 1.0.0
+ onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server:
+ derived_from: policy.nodes.Root
+ version: 1.0.0
+ properties:
+ buscontroller_feed_publishing_endpoint:
+ type: string
+ description: DMAAP Bus Controller feed endpoint
+ datafile.policy:
+ type: string
+ description: datafile Policy JSON as string
diff --git a/models-tosca/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml b/models-tosca/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml
new file mode 100644
index 000000000..699cffd7e
--- /dev/null
+++ b/models-tosca/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml
@@ -0,0 +1,158 @@
+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.policy.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