summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-yaml/src/test
diff options
context:
space:
mode:
authorning.xi <ning.xi@est.tech>2019-04-04 02:55:50 +0000
committerPamela Dragosh <pdragosh@research.att.com>2019-04-05 15:34:01 +0000
commit0b860c87dc3bcc9058cde521f3fbda6f0aad2ec4 (patch)
tree42503b4d62575e770d9236a32dbdb53b477acf16 /models-interactions/model-yaml/src/test
parent38cc81922273039d2d32979123bb83a15c49debf (diff)
remove dependency of drool-application/yaml in actors
Issue-ID: POLICY-1264 Change-Id: Ie89749cf25d6880fd2884eb6935f36f046114b23 Signed-off-by: ning.xi <ning.xi@est.tech>
Diffstat (limited to 'models-interactions/model-yaml/src/test')
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/CompilerExceptionTest.java32
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopCompilerTest.java221
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopGuardCompilerTest.java110
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java947
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyTest.java141
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopTest.java183
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/OperationsAccumulateParamsTest.java125
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/PolicyTest.java221
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ConstraintTest.java256
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuardBuilderTest.java218
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuardTest.java170
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/GuardPolicyTest.java271
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/bad_control_loop_no_control_loop_name.yaml37
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_connected_to_unknown_policy.yaml37
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_exception_connected_to_unknown_policy.yaml37
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_guard_connected_to_unknown_policy.yaml37
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_retries_connected_to_unknown_policy.yaml37
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_timeout_connected_to_unknown_policy.yaml37
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_success_connected_to_unknown_policy.yaml37
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/bad_trigger_1.yaml109
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/bad_trigger_2.yaml109
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/bad_trigger_no_trigger_id.yaml35
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/empty.yaml14
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/policy_OpenLoop.yaml26
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/policy_Test.yaml109
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/policy_vService.yaml75
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/test.yaml318
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/test_evil.yaml39
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0-guard/duplicate_guard_constraint.yaml35
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0-guard/duplicate_guard_policy.yaml41
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0-guard/no_guard_constraint.yaml25
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0-guard/no_guard_policy.yaml16
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0-guard/policy_guard_ONAP_demo_vDNS.yaml33
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0-guard/policy_guard_appc_restart.yaml38
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0-guard/policy_guard_blacklist.yaml31
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-59a2ee3fB58045feB5a1-template.yml1698
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-Eace933104d443b496b8-template.yml2525
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-57e66ea70ed645c7970f-template.yml677
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-D473899264974dca9db9-template.yml677
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0/pgstreams.json26
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_VOLTE.yaml37
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_vCPE.yaml37
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_vPCI.yaml40
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vDNS.yaml64
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml72
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0/policy_vService.yaml135
46 files changed, 10195 insertions, 0 deletions
diff --git a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/CompilerExceptionTest.java b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/CompilerExceptionTest.java
new file mode 100644
index 000000000..ef3a68233
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/CompilerExceptionTest.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications 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.controlloop.compiler;
+
+import org.junit.Test;
+import org.onap.policy.common.utils.test.ExceptionsTester;
+
+public class CompilerExceptionTest extends ExceptionsTester {
+
+ @Test
+ public void test() throws Exception {
+ test(CompilerException.class);
+ }
+
+}
diff --git a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopCompilerTest.java b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopCompilerTest.java
new file mode 100644
index 000000000..1028bde0f
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopCompilerTest.java
@@ -0,0 +1,221 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * policy-yaml unit test
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications 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.controlloop.compiler;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.policy.controlloop.policy.ControlLoopPolicy;
+import org.onap.policy.controlloop.policy.FinalResult;
+
+public class ControlLoopCompilerTest {
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Test
+ public void testTest() throws Exception {
+ List<String> expectedOnErrorMessages = new ArrayList<>();
+ expectedOnErrorMessages.add("Operational Policy has an bad ID");
+ expectedOnErrorMessages.add("Policy id is set to a PolicyResult SUCCESS");
+ expectedOnErrorMessages.add("Policy id is set to a FinalResult FINAL_SUCCESS");
+ expectedOnErrorMessages.add("Policy actor is null");
+ expectedOnErrorMessages.add("Policy actor is invalid");
+ expectedOnErrorMessages.add("Policy recipe is null");
+ expectedOnErrorMessages.add("Policy recipe is invalid");
+ expectedOnErrorMessages.add("Policy recipe is invalid");
+ expectedOnErrorMessages.add("Policy recipe is invalid");
+ expectedOnErrorMessages.add("Policy target is null");
+ expectedOnErrorMessages.add("Policy target is invalid");
+ expectedOnErrorMessages.add("Policy success is neither another policy nor FINAL_SUCCESS");
+ expectedOnErrorMessages.add("Policy failure is neither another policy nor FINAL_FAILURE");
+ expectedOnErrorMessages.add("Policy failure retries is neither another policy nor FINAL_FAILURE_RETRIES");
+ expectedOnErrorMessages.add("Policy failure timeout is neither another policy nor FINAL_FAILURE_TIMEOUT");
+ expectedOnErrorMessages.add("Policy failure exception is neither another policy nor FINAL_FAILURE_EXCEPTION");
+ expectedOnErrorMessages.add("Policy failure guard is neither another policy nor FINAL_FAILURE_GUARD");
+ expectedOnErrorMessages.add("Unsupported version for this compiler");
+ expectedOnErrorMessages.add("controlLoop overall timeout is less than the sum of operational policy timeouts.");
+
+ TestControlLoopCompilerCallback testControlLoopCompilerCallback =
+ new TestControlLoopCompilerCallback(expectedOnErrorMessages);
+ ControlLoopPolicy controlLoopPolicy = this.test("src/test/resources/v1.0.0/test.yaml",
+ testControlLoopCompilerCallback);
+ assertEquals(22, controlLoopPolicy.getPolicies().size());
+ assertTrue(testControlLoopCompilerCallback.areAllExpectedOnErrorsReceived());
+ }
+
+ @Test
+ public void testSuccessConnectedToUnknownPolicy() throws Exception {
+ expectedException.expect(CompilerException.class);
+ expectedException.expectMessage(
+ "Operation Policy unique-policy-id-1-restart is connected to unknown policy unknown-policy");
+ this.test("src/test/resources/v1.0.0/bad_policy_success_connected_to_unknown_policy.yaml");
+ }
+
+ @Test
+ public void testFailureConnectedToUnknownPolicy() throws Exception {
+ expectedException.expect(CompilerException.class);
+ expectedException.expectMessage(
+ "Operation Policy unique-policy-id-1-restart is connected to unknown policy unknown-policy");
+ this.test("src/test/resources/v1.0.0/bad_policy_failure_connected_to_unknown_policy.yaml");
+ }
+
+ @Test
+ public void testFailureTimeoutToUnknownPolicy() throws Exception {
+ expectedException.expect(CompilerException.class);
+ expectedException.expectMessage(
+ "Operation Policy unique-policy-id-1-restart is connected to unknown policy unknown-policy");
+ this.test("src/test/resources/v1.0.0/bad_policy_failure_timeout_connected_to_unknown_policy.yaml");
+ }
+
+ @Test
+ public void testFailureRetriesToUnknownPolicy() throws Exception {
+ expectedException.expect(CompilerException.class);
+ expectedException.expectMessage(
+ "Operation Policy unique-policy-id-1-restart is connected to unknown policy unknown-policy");
+ this.test("src/test/resources/v1.0.0/bad_policy_failure_retries_connected_to_unknown_policy.yaml");
+ }
+
+ @Test
+ public void testFailureExceptionToUnknownPolicy() throws Exception {
+ expectedException.expect(CompilerException.class);
+ expectedException.expectMessage(
+ "Operation Policy unique-policy-id-1-restart is connected to unknown policy unknown-policy");
+ this.test("src/test/resources/v1.0.0/bad_policy_failure_exception_connected_to_unknown_policy.yaml");
+ }
+
+ @Test
+ public void testFailureGuardToUnknownPolicy() throws Exception {
+ expectedException.expect(CompilerException.class);
+ expectedException.expectMessage(
+ "Operation Policy unique-policy-id-1-restart is connected to unknown policy unknown-policy");
+ this.test("src/test/resources/v1.0.0/bad_policy_failure_guard_connected_to_unknown_policy.yaml");
+ }
+
+ @Test
+ public void testInvalidTriggerPolicyId() throws Exception {
+ expectedException.expect(CompilerException.class);
+ expectedException.expectMessage(
+ "Unexpected value for trigger_policy, should only be "
+ + FinalResult.FINAL_OPENLOOP.toString() + " or a valid Policy ID");
+ this.test("src/test/resources/v1.0.0/bad_trigger_1.yaml");
+ }
+
+ @Test
+ public void testNoTriggerPolicyId() throws Exception {
+ expectedException.expect(CompilerException.class);
+ this.test("src/test/resources/v1.0.0/bad_trigger_no_trigger_id.yaml");
+ }
+
+ @Test
+ public void testNoControlLoopName() throws Exception {
+ List<String> expectedOnErrorMessages = new ArrayList<>();
+ expectedOnErrorMessages.add("Missing controlLoopName");
+ expectedOnErrorMessages.add("Unsupported version for this compiler");
+ TestControlLoopCompilerCallback testControlLoopCompilerCallback =
+ new TestControlLoopCompilerCallback(expectedOnErrorMessages);
+ this.test("src/test/resources/v1.0.0/bad_control_loop_no_control_loop_name.yaml",
+ testControlLoopCompilerCallback);
+ assertTrue(testControlLoopCompilerCallback.areAllExpectedOnErrorsReceived());
+ }
+
+ @Test
+ public void testInvalidFinalResult() throws Exception {
+ expectedException.expect(CompilerException.class);
+ expectedException.expectMessage(
+ "Unexpected Final Result for trigger_policy, should only be FINAL_OPENLOOP or a valid Policy ID");
+ this.test("src/test/resources/v1.0.0/bad_trigger_2.yaml");
+ }
+
+ @Test
+ public void testCompileEmptyFile() throws Exception {
+ expectedException.expect(CompilerException.class);
+ expectedException.expectMessage("Could not parse yaml specification.");
+ this.test("src/test/resources/v1.0.0/empty.yaml");
+ }
+
+ public ControlLoopPolicy test(String testFile) throws Exception {
+ return test(testFile, null);
+ }
+
+ /**
+ * Does the actual test.
+ *
+ * @param testFile test file
+ * @param controlLoopCompilerCallback callback method
+ * @return the policy object
+ * @throws Exception exception
+ */
+ public ControlLoopPolicy test(String testFile,
+ ControlLoopCompilerCallback controlLoopCompilerCallback) throws Exception {
+ try (InputStream is = new FileInputStream(new File(testFile))) {
+ return ControlLoopCompiler.compile(is, controlLoopCompilerCallback);
+ } catch (FileNotFoundException e) {
+ fail(e.getMessage());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ } catch (Exception e) {
+ throw e;
+ }
+ return null;
+ }
+
+ class TestControlLoopCompilerCallback implements ControlLoopCompilerCallback {
+
+ private List<String> expectedOnErrorMessages;
+
+ public TestControlLoopCompilerCallback(List<String> expectedOnErrorMessages) {
+ this.expectedOnErrorMessages = expectedOnErrorMessages;
+ }
+
+ @Override
+ public boolean onWarning(String message) {
+ return true;
+ }
+
+ @Override
+ public boolean onError(String message) {
+ if (!expectedOnErrorMessages.remove(message)) {
+ fail("Unexpected onError message: " + message);
+ }
+ return true;
+ }
+
+ public boolean areAllExpectedOnErrorsReceived() {
+ return expectedOnErrorMessages.size() == 0;
+ }
+
+ }
+
+}
diff --git a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopGuardCompilerTest.java b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopGuardCompilerTest.java
new file mode 100644
index 000000000..850a4a374
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopGuardCompilerTest.java
@@ -0,0 +1,110 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * policy-yaml unit test
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications 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.controlloop.compiler;
+
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.junit.Test;
+
+import org.onap.policy.controlloop.guard.compiler.ControlLoopGuardCompiler;
+
+public class ControlLoopGuardCompilerTest {
+
+ @Test
+ public void testTest1() {
+ try {
+ this.test("src/test/resources/v2.0.0-guard/policy_guard_ONAP_demo_vDNS.yaml");
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testTest2() {
+ try {
+ this.test("src/test/resources/v2.0.0-guard/policy_guard_appc_restart.yaml");
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testBad1() {
+ try {
+ this.test("src/test/resources/v2.0.0-guard/no_guard_policy.yaml");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testBad2() {
+ try {
+ this.test("src/test/resources/v2.0.0-guard/duplicate_guard_policy.yaml");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testBad3() {
+ try {
+ this.test("src/test/resources/v2.0.0-guard/no_guard_constraint.yaml");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testBad4() {
+ try {
+ this.test("src/test/resources/v2.0.0-guard/duplicate_guard_constraint.yaml");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Does the actual test.
+ *
+ * @param testFile input test file
+ * @throws Exception exception thrown
+ */
+ public void test(String testFile) throws Exception {
+ try (InputStream is = new FileInputStream(new File(testFile))) {
+ ControlLoopGuardCompiler.compile(is, null);
+ } catch (FileNotFoundException e) {
+ fail(e.getMessage());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ } catch (Exception e) {
+ throw e;
+ }
+ }
+
+}
diff --git a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java
new file mode 100644
index 000000000..b95d0e007
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java
@@ -0,0 +1,947 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * policy-yaml unit test
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications 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.controlloop.policy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.UUID;
+
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.policy.aai.Pnf;
+import org.onap.policy.aai.PnfType;
+import org.onap.policy.controlloop.policy.builder.BuilderException;
+import org.onap.policy.controlloop.policy.builder.ControlLoopPolicyBuilder;
+import org.onap.policy.controlloop.policy.builder.Message;
+import org.onap.policy.controlloop.policy.builder.MessageLevel;
+import org.onap.policy.controlloop.policy.builder.Results;
+import org.onap.policy.sdc.Resource;
+import org.onap.policy.sdc.ResourceType;
+import org.onap.policy.sdc.Service;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.constructor.Constructor;
+import org.yaml.snakeyaml.error.YAMLException;
+
+
+public class ControlLoopPolicyBuilderTest {
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Test
+ public void testControlLoop() {
+ try {
+ //
+ // Create a builder for our policy
+ //
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ //
+ // Test add services
+ //
+ Service scp = new Service("vSCP");
+ Service usp = new Service("vUSP");
+ Service trinity = new Service("Trinity");
+ builder = builder.addService(scp, usp, trinity);
+ assertTrue(builder.getControlLoop().getServices().size() == 3);
+ //
+ // Test remove services
+ //
+ builder = builder.removeService(scp);
+ assertTrue(builder.getControlLoop().getServices().size() == 2);
+ builder = builder.removeAllServices();
+ assertTrue(builder.getControlLoop().getServices().size() == 0);
+ //
+ // Test add resources
+ //
+ Resource cts = new Resource("vCTS", ResourceType.VF);
+ Resource com = new Resource("vCTS", ResourceType.VF);
+ Resource rar = new Resource("vCTS", ResourceType.VF);
+ builder = builder.addResource(cts, com, rar);
+ assertTrue(builder.getControlLoop().getResources().size() == 3);
+ //
+ // Test remove resources
+ //
+ builder = builder.removeResource(cts);
+ assertTrue(builder.getControlLoop().getResources().size() == 2);
+ builder = builder.removeAllResources();
+ assertTrue(builder.getControlLoop().getResources().size() == 0);
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testAddNullService() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("Service must not be null");
+ builder.addService((Service) null);
+ }
+
+ @Test
+ public void testAddInvalidService() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("Invalid service - need either a serviceUUID or serviceName");
+ builder.addService(new Service());
+ }
+
+ @Test
+ public void testAddServiceWithUuid() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ UUID uuid = UUID.randomUUID();
+ Service serviceWithUuid = new Service(uuid);
+ builder.addService(serviceWithUuid);
+ assertTrue(builder.getControlLoop().getServices().size() == 1);
+ }
+
+ @Test
+ public void testAddNullResource() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("Resource must not be null");
+ builder.addResource((Resource) null);
+ }
+
+
+ @Test
+ public void testAddInvalidResource() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("Invalid resource - need either resourceUUID or resourceName");
+ builder.addResource(new Resource());
+ }
+
+ @Test
+ public void testAddAndRemoveResourceWithUuid() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ UUID uuid = UUID.randomUUID();
+ Resource resourceWithUuid = new Resource(uuid);
+ builder.addResource(resourceWithUuid);
+ assertTrue(builder.getControlLoop().getResources().size() == 1);
+
+ builder.removeResource(resourceWithUuid);
+ assertTrue(builder.getControlLoop().getResources().size() == 0);
+ }
+
+ @Test
+ public void testRemoveNullResource() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ Resource resource = new Resource("resource1", ResourceType.VF);
+ builder.addResource(resource);
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("Resource must not be null");
+ builder.removeResource((Resource) null);
+ }
+
+ @Test
+ public void testRemoveResourceNoExistingResources() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("No existing resources to remove");
+ builder.removeResource(new Resource("resource1", ResourceType.VF));
+ }
+
+ @Test
+ public void testRemoveInvalidResource() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ Resource resource = new Resource("resource1", ResourceType.VF);
+ builder.addResource(resource);
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("Invalid resource - need either a resourceUUID or resourceName");
+ builder.removeResource(new Resource());
+ }
+
+ @Test
+ public void testRemoveUnknownResource() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ Resource resource = new Resource("resource1", ResourceType.VF);
+ builder.addResource(resource);
+ final String unknownResourceName = "reource2";
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("Unknown resource " + unknownResourceName);
+ builder.removeResource(new Resource(unknownResourceName, ResourceType.VF));
+ }
+
+ @Test
+ public void testControlLoopWithInitialResourceAndServices() {
+ try {
+ Resource cts = new Resource("vCTS", ResourceType.VF);
+ Service scp = new Service("vSCP");
+ Service usp = new Service("vUSP");
+ ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory
+ .buildControlLoop(UUID.randomUUID().toString(), 2400, cts, scp, usp);
+ assertTrue(builder.getControlLoop().getResources().size() == 1);
+ assertTrue(builder.getControlLoop().getServices().size() == 2);
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testControlLoopWithInitialResourcesAndService() {
+ try {
+ Resource cts = new Resource("vCTS", ResourceType.VF);
+ Resource com = new Resource("vCTS", ResourceType.VF);
+ Service scp = new Service("vSCP");
+ ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory
+ .buildControlLoop(UUID.randomUUID().toString(), 2400, scp, cts, com);
+ assertTrue(builder.getControlLoop().getServices().size() == 1);
+ assertTrue(builder.getControlLoop().getResources().size() == 2);
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ @Ignore
+ // I'VE MARKED THIS TEST CASE AS IGNORE BECAUSE THE TEST CASE FAILS
+ // This test case fails because builder.getControlLoop() returns an instance of ControlLoop
+ // copied using
+ // the ControlLoop(ControlLoop controlLoop) constructor.
+ // This constructor does not copy the value of pnf into the newly created object
+ // On the face of it, this looks like a bug, but perhaps there is a reason for this
+ // PLEASE ADVISE IF THE BEHAVIOUR IS INCORRECT OR THE TEST CASE IS INVALID
+ public void testControlLoopForPnf() {
+ try {
+ Pnf pnf = new Pnf();
+ pnf.setPnfType(PnfType.ENODEB);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400, pnf);
+ assertEquals(pnf, builder.getControlLoop().getPnf());
+
+ builder.removePNF();
+ assertNull(builder.getControlLoop().getPnf());
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ @Ignore
+ // Fails for the same reason as the above test case
+ public void testSetAndRemovePnf() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ assertNull(builder.getControlLoop().getPnf());
+
+ Pnf pnf = new Pnf();
+ pnf.setPnfType(PnfType.ENODEB);
+ builder.setPNF(pnf);
+ assertEquals(pnf, builder.getControlLoop().getPnf());
+
+ builder.removePNF();
+ assertNull(builder.getControlLoop().getPnf());
+ }
+
+ @Test
+ public void testSetNullPnf() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("PNF must not be null");
+ builder.setPNF(null);
+ }
+
+ @Test
+ public void testSetInvalidPnf() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("Invalid PNF - need either pnfName or pnfType");
+ builder.setPNF(new Pnf());
+ }
+
+ @Test
+ public void testSetAbatement() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ assertFalse(builder.getControlLoop().getAbatement());
+ builder = builder.setAbatement(true);
+ assertTrue(builder.getControlLoop().getAbatement());
+ }
+
+ @Test
+ public void testSetNullAbatement() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("abatement must not be null");
+ builder = builder.setAbatement(null);
+ }
+
+ @Test
+ public void testTimeout() {
+ try {
+ //
+ // Create a builder for our policy
+ //
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ //
+ // Test setTimeout
+ //
+ assertTrue(builder.getControlLoop().getTimeout() == 2400);
+ builder = builder.setTimeout(800);
+ assertTrue(builder.getControlLoop().getTimeout() == 800);
+ //
+ // Test calculateTimeout
+ //
+ Policy trigger =
+ builder.setTriggerPolicy(PolicyParam.builder().id(UUID.randomUUID().toString())
+ .name("Restart the VM")
+ .description("Upon getting the trigger event, restart the VM")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("Restart")
+ .payload(null)
+ .retries(2)
+ .timeout(300).build());
+ @SuppressWarnings("unused")
+ Policy onRestartFailurePolicy = builder.setPolicyForPolicyResult(
+ PolicyParam.builder()
+ .name("Rebuild VM")
+ .description("If the restart fails, rebuild it")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("Rebuild")
+ .payload(null)
+ .retries(1)
+ .timeout(600)
+ .id(trigger.getId()).build(),
+ PolicyResult.FAILURE,
+ PolicyResult.FAILURE_RETRIES,
+ PolicyResult.FAILURE_TIMEOUT);
+ assertTrue(builder.calculateTimeout().equals(new Integer(300 + 600)));
+ //
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testTriggerPolicyMethods() {
+ try {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ //
+ // Test isOpenLoop
+ //
+ assertTrue(builder.isOpenLoop());
+ //
+ // Test set initial trigger policy
+ //
+ Policy triggerPolicy1 =
+ builder.setTriggerPolicy(
+ PolicyParam.builder().id(UUID.randomUUID().toString())
+ .name("Restart the VM")
+ .description("Upon getting the trigger event, restart the VM")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("Restart")
+ .payload(null)
+ .retries(2)
+ .timeout(300).build());
+ assertTrue(builder.isOpenLoop() == false);
+ assertTrue(builder.getControlLoop().getTrigger_policy().equals(triggerPolicy1.getId()));
+ //
+ // Set trigger policy to a new policy
+ //
+ @SuppressWarnings("unused")
+ Policy triggerPolicy2 =
+ builder.setTriggerPolicy(
+ PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name("Rebuild the VM")
+ .description("Upon getting the trigger event, rebuild the VM")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("Rebuild")
+ .payload(null)
+ .retries(2)
+ .timeout(300).build());
+ //
+ // Test set trigger policy to another existing policy
+ //
+ @SuppressWarnings("unused")
+ ControlLoop cl = builder.setExistingTriggerPolicy(triggerPolicy1.getId());
+ assertTrue(builder.getControlLoop().getTrigger_policy().equals(triggerPolicy1.getId()));
+ //
+ // Test get trigger policy
+ //
+ assertTrue(builder.getTriggerPolicy().equals(triggerPolicy1));
+ //
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSetTriggerPolicyNullPolicyId() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("Id must not be null");
+ builder.setExistingTriggerPolicy(null);
+ }
+
+ @Test
+ public void testSetTriggerPolicyNoPoliciesExist() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ final String unknownPolicyId = "100";
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("Unknown policy " + unknownPolicyId);
+ builder.setExistingTriggerPolicy(unknownPolicyId);
+ }
+
+ @Test
+ public void testSetTriggerPolicyUnknownPolicy() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ builder.setTriggerPolicy(
+ PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name("Restart the VM")
+ .description("Upon getting the trigger event, restart the VM")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("Restart")
+ .payload(null)
+ .retries(2)
+ .timeout(300).build());
+ final String unknownPolicyId = "100";
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("Unknown policy " + unknownPolicyId);
+ builder.setExistingTriggerPolicy(unknownPolicyId);
+ }
+
+ @Test
+ public void testAddRemovePolicies() {
+ try {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ Policy triggerPolicy =
+ builder.setTriggerPolicy(
+ PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name("Restart the VM")
+ .description("Upon getting the trigger event, restart the VM")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("Restart")
+ .payload(null)
+ .retries(2)
+ .timeout(300).build());
+ //
+ // Test create a policy and chain it to the results of trigger policy
+ //
+ Policy onRestartFailurePolicy1 = builder.setPolicyForPolicyResult(
+ PolicyParam.builder()
+ .name("Rebuild VM")
+ .description("If the restart fails, rebuild it.")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("Rebuild")
+ .payload(null)
+ .retries(1)
+ .timeout(600)
+ .id(triggerPolicy.getId()).build(),
+ PolicyResult.FAILURE,
+ PolicyResult.FAILURE_EXCEPTION,
+ PolicyResult.FAILURE_RETRIES,
+ PolicyResult.FAILURE_TIMEOUT,
+ PolicyResult.FAILURE_GUARD);
+ //
+ assertTrue(builder.getTriggerPolicy().getFailure().equals(onRestartFailurePolicy1.getId()));
+ assertTrue(builder.getTriggerPolicy().getFailure_exception().equals(onRestartFailurePolicy1.getId()));
+ assertTrue(builder.getTriggerPolicy().getFailure_retries().equals(onRestartFailurePolicy1.getId()));
+ assertTrue(builder.getTriggerPolicy().getFailure_timeout().equals(onRestartFailurePolicy1.getId()));
+ assertTrue(builder.getTriggerPolicy().getFailure_guard().equals(onRestartFailurePolicy1.getId()));
+
+ //
+ // Test create a policy and chain it to the results of trigger policy success
+ //
+ Policy onSuccessPolicy1 = builder.setPolicyForPolicyResult(
+ PolicyParam.builder()
+ .name("Do something")
+ .description("If the restart succeeds, do something else.")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("SomethingElse")
+ .payload(null)
+ .retries(1)
+ .timeout(600)
+ .id(triggerPolicy.getId()).build(),
+ PolicyResult.SUCCESS);
+ //
+ assertTrue(builder.getTriggerPolicy().getSuccess().equals(onSuccessPolicy1.getId()));
+
+ //
+ // Test remove policy
+ //
+ boolean removed = builder.removePolicy(onRestartFailurePolicy1.getId());
+ assertTrue(removed);
+ assertTrue(builder.getTriggerPolicy().getFailure().equals(FinalResult.FINAL_FAILURE.toString()));
+ assertTrue(builder.getTriggerPolicy().getFailure_retries()
+ .equals(FinalResult.FINAL_FAILURE_RETRIES.toString()));
+ assertTrue(builder.getTriggerPolicy().getFailure_timeout()
+ .equals(FinalResult.FINAL_FAILURE_TIMEOUT.toString()));
+ assertTrue(
+ builder.getTriggerPolicy().getFailure_guard().equals(FinalResult.FINAL_FAILURE_GUARD.toString()));
+ //
+ // Create another policy and chain it to the results of trigger policy
+ //
+ final Policy onRestartFailurePolicy2 =
+ builder.setPolicyForPolicyResult(
+ PolicyParam.builder()
+ .name("Rebuild VM")
+ .description("If the restart fails, rebuild it.")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("Rebuild")
+ .payload(null)
+ .retries(2)
+ .timeout(600)
+ .id(triggerPolicy.getId()).build(),
+ PolicyResult.FAILURE,
+ PolicyResult.FAILURE_RETRIES,
+ PolicyResult.FAILURE_TIMEOUT);
+ //
+ // Test reset policy results
+ //
+ triggerPolicy = builder.resetPolicyResults(triggerPolicy.getId());
+ assertTrue(builder.getTriggerPolicy().getFailure().equals(FinalResult.FINAL_FAILURE.toString()));
+ assertTrue(builder.getTriggerPolicy().getFailure_retries()
+ .equals(FinalResult.FINAL_FAILURE_RETRIES.toString()));
+ assertTrue(builder.getTriggerPolicy().getFailure_timeout()
+ .equals(FinalResult.FINAL_FAILURE_TIMEOUT.toString()));
+ //
+ // Test set the policy results to an existing operational policy
+ //
+ Policy onRestartFailurePolicy3 =
+ builder.setPolicyForPolicyResult(onRestartFailurePolicy2.getId(), triggerPolicy.getId(),
+ PolicyResult.FAILURE, PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT);
+ assertTrue(builder.getTriggerPolicy().getFailure().equals(onRestartFailurePolicy3.getId()));
+ assertTrue(builder.getTriggerPolicy().getFailure_retries().equals(onRestartFailurePolicy3.getId()));
+ assertTrue(builder.getTriggerPolicy().getFailure_timeout().equals(onRestartFailurePolicy3.getId()));
+ //
+ // Test set the policy result for success to an existing operational policy
+ //
+ Policy onRestartFailurePolicy4 =
+ builder.setPolicyForPolicyResult(onRestartFailurePolicy2.getId(), triggerPolicy.getId(),
+ PolicyResult.FAILURE, PolicyResult.FAILURE_EXCEPTION, PolicyResult.FAILURE_GUARD,
+ PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT, PolicyResult.SUCCESS);
+ assertTrue(builder.getTriggerPolicy().getFailure().equals(onRestartFailurePolicy4.getId()));
+ assertTrue(builder.getTriggerPolicy().getFailure_exception().equals(onRestartFailurePolicy4.getId()));
+ assertTrue(builder.getTriggerPolicy().getFailure_guard().equals(onRestartFailurePolicy4.getId()));
+ assertTrue(builder.getTriggerPolicy().getFailure_retries().equals(onRestartFailurePolicy4.getId()));
+ assertTrue(builder.getTriggerPolicy().getFailure_timeout().equals(onRestartFailurePolicy4.getId()));
+ assertTrue(builder.getTriggerPolicy().getSuccess().equals(onRestartFailurePolicy4.getId()));
+
+ //
+ // Test remove all existing operational policies
+ //
+ builder = builder.removeAllPolicies();
+ assertTrue(builder.getControlLoop().getTrigger_policy().equals(FinalResult.FINAL_OPENLOOP.toString()));
+ //
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testAddToUnknownPolicy() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ final String policyId = "100";
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("Unknown policy " + policyId);
+
+ builder.setPolicyForPolicyResult(
+ PolicyParam.builder()
+ .name("Rebuild VM")
+ .description("If the restart fails, rebuild it.")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("Rebuild")
+ .payload(null)
+ .retries(1)
+ .timeout(600)
+ .id(policyId).build(),
+ PolicyResult.FAILURE,
+ PolicyResult.FAILURE_RETRIES,
+ PolicyResult.FAILURE_TIMEOUT,
+ PolicyResult.FAILURE_GUARD);
+ }
+
+ @Test
+ public void testAddExistingPolicyToUnknownPolicy() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ Policy triggerPolicy =
+ builder.setTriggerPolicy(
+ PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name("Restart the VM")
+ .description("Upon getting the trigger event, restart the VM")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("Restart")
+ .payload(null)
+ .retries(2)
+ .timeout(300).build());
+
+
+ Policy onRestartFailurePolicy = builder.setPolicyForPolicyResult(
+ PolicyParam.builder()
+ .name("Rebuild VM")
+ .description("If the restart fails, rebuild it.")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("Rebuild")
+ .payload(null)
+ .retries(1)
+ .timeout(600)
+ .id(triggerPolicy.getId()).build(),
+ PolicyResult.FAILURE);
+
+ final String unknownPolicyId = "100";
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage(unknownPolicyId + " does not exist");
+
+ builder.setPolicyForPolicyResult(onRestartFailurePolicy.getId(), unknownPolicyId, PolicyResult.FAILURE);
+ }
+
+ @Test
+ public void testAddUnknownExistingPolicyToPolicy() throws BuilderException {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ Policy triggerPolicy =
+ builder.setTriggerPolicy(
+ PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name("Restart the VM")
+ .description("Upon getting the trigger event, restart the VM")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("Restart")
+ .payload(null)
+ .retries(2)
+ .timeout(300).build());
+
+ final String unknownPolicyId = "100";
+ expectedException.expect(BuilderException.class);
+ expectedException.expectMessage("Operational policy " + unknownPolicyId + " does not exist");
+
+ builder.setPolicyForPolicyResult(unknownPolicyId, triggerPolicy.getId(), PolicyResult.FAILURE);
+ }
+
+ @Test
+ public void testAddOperationsAccumulateParams() {
+ try {
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ Policy triggerPolicy =
+ builder.setTriggerPolicy(
+ PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name("Restart the eNodeB")
+ .description("Upon getting the trigger event, restart the eNodeB")
+ .actor("RANController")
+ .target(new Target(TargetType.PNF))
+ .recipe("Restart")
+ .payload(null)
+ .retries(2)
+ .timeout(300).build());
+ //
+ // Add the operationsAccumulateParams
+ //
+ triggerPolicy = builder.addOperationsAccumulateParams(triggerPolicy.getId(),
+ new OperationsAccumulateParams("15m", 5));
+ assertNotNull(builder.getTriggerPolicy().getOperationsAccumulateParams());
+ assertTrue(builder.getTriggerPolicy().getOperationsAccumulateParams().getPeriod().equals("15m"));
+ assertTrue(builder.getTriggerPolicy().getOperationsAccumulateParams().getLimit() == 5);
+ //
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+
+ @Test
+ public void testBuildSpecification() {
+ try {
+ //
+ // Create the builder
+ //
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 800);
+ //
+ // Set the first invalid trigger policy
+ //
+ final Policy policy1 = builder.setTriggerPolicy(
+ PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name("Restart the VM")
+ .description("Upon getting the trigger event, restart the VM")
+ .actor(null)
+ .target(null)
+ .recipe("Instantiate")
+ .payload(null)
+ .retries(2)
+ .timeout(300).build());
+ Results results = builder.buildSpecification();
+ //
+ // Check that ERRORs are in results for invalid policy arguments
+ //
+ boolean invalidActor = false;
+ boolean invalidRecipe = false;
+ boolean invalidTarget = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage().equals("Policy actor is null") && m.getLevel() == MessageLevel.ERROR) {
+ invalidActor = true;
+ }
+ if (m.getMessage().equals("Policy recipe is invalid") && m.getLevel() == MessageLevel.ERROR) {
+ invalidRecipe = true;
+ }
+ if (m.getMessage().equals("Policy target is null") && m.getLevel() == MessageLevel.ERROR) {
+ invalidTarget = true;
+ }
+ }
+ //
+ assertTrue(invalidActor);
+ assertTrue(invalidRecipe);
+ assertTrue(invalidTarget);
+ //
+ // Remove the invalid policy
+ //
+ // @SuppressWarnings("unused")
+ boolean removed = builder.removePolicy(policy1.getId());
+ assertTrue(removed);
+ assertTrue(builder.getTriggerPolicy() == null);
+ //
+ // Set a valid trigger policy
+ //
+ Policy policy1a = builder.setTriggerPolicy(
+ PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name("Rebuild VM")
+ .description("If the restart fails, rebuild it.")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("Rebuild")
+ .payload(null)
+ .retries(1)
+ .timeout(600).build());
+ //
+ // Set a second valid trigger policy
+ //
+ final Policy policy2 =
+ builder.setTriggerPolicy(
+ PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name("Restart the VM")
+ .description("Upon getting the trigger event, restart the VM")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("Restart")
+ .payload(null)
+ .retries(2)
+ .timeout(300).build());
+ //
+ // Now, we have policy1 unreachable
+ //
+ results = builder.buildSpecification();
+ boolean unreachable = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage().equals("Policy " + policy1a.getId() + " is not reachable.")
+ && m.getLevel() == MessageLevel.WARNING) {
+ unreachable = true;
+ break;
+ }
+ }
+ assertTrue(unreachable);
+ //
+ // Set policy1a for the failure results of policy2
+ //
+ policy1a = builder.setPolicyForPolicyResult(policy1a.getId(), policy2.getId(), PolicyResult.FAILURE,
+ PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT);
+ results = builder.buildSpecification();
+ boolean invalidTimeout = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage()
+ .equals("controlLoop overall timeout is less than the sum of operational policy timeouts.")
+ && m.getLevel() == MessageLevel.ERROR) {
+ invalidTimeout = true;
+ break;
+ }
+ }
+ assertTrue(invalidTimeout);
+ //
+ // Remove policy2 (revert controlLoop back to open loop)
+ //
+ removed = builder.removePolicy(policy2.getId());
+ //
+ // ControlLoop is open loop now, but it still has policies (policy1)
+ //
+ results = builder.buildSpecification();
+ unreachable = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage().equals("Open Loop policy contains policies. The policies will never be invoked.")
+ && m.getLevel() == MessageLevel.WARNING) {
+ unreachable = true;
+ break;
+ }
+ }
+ assertTrue(unreachable);
+ //
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+
+ @Test
+ public void test1() {
+ this.test("src/test/resources/v1.0.0/policy_Test.yaml");
+ }
+
+ @Test
+ public void testEvilYaml() {
+ try (InputStream is = new FileInputStream(new File("src/test/resources/v1.0.0/test_evil.yaml"))) {
+ //
+ // Read the yaml into our Java Object
+ //
+ Yaml yaml = new Yaml(new Constructor(ControlLoopPolicy.class));
+ yaml.load(is);
+ } catch (FileNotFoundException e) {
+ fail(e.getLocalizedMessage());
+ } catch (IOException e) {
+ fail(e.getLocalizedMessage());
+ } catch (YAMLException e) {
+ //
+ // Should have this
+ //
+ }
+ }
+
+ /**
+ * Does the actual test.
+ *
+ * @param testFile input file
+ */
+ public void test(String testFile) {
+ try (InputStream is = new FileInputStream(new File(testFile))) {
+ //
+ // Read the yaml into our Java Object
+ //
+ Yaml yaml = new Yaml(new Constructor(ControlLoopPolicy.class));
+ Object obj = yaml.load(is);
+ assertNotNull(obj);
+ assertTrue(obj instanceof ControlLoopPolicy);
+ ControlLoopPolicy policyTobuild = (ControlLoopPolicy) obj;
+ //
+ // Now we're going to try to use the builder to build this.
+ //
+ ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(
+ policyTobuild.getControlLoop().getControlLoopName(), policyTobuild.getControlLoop().getTimeout());
+ //
+ // Add services
+ //
+ if (policyTobuild.getControlLoop().getServices() != null) {
+ builder = builder.addService(policyTobuild.getControlLoop().getServices()
+ .toArray(new Service[policyTobuild.getControlLoop().getServices().size()]));
+ }
+ //
+ // Add resources
+ //
+ if (policyTobuild.getControlLoop().getResources() != null) {
+ builder = builder.addResource(policyTobuild.getControlLoop().getResources()
+ .toArray(new Resource[policyTobuild.getControlLoop().getResources().size()]));
+ }
+ //
+ // Set pnf
+ //
+ if (policyTobuild.getControlLoop().getPnf() != null) {
+ builder = builder.setPNF(policyTobuild.getControlLoop().getPnf());
+ }
+ //
+ // Add the policies and be sure to set the trigger policy
+ //
+ if (policyTobuild.getPolicies() != null) {
+ for (Policy policy : policyTobuild.getPolicies()) {
+ if (policy.getId() == policyTobuild.getControlLoop().getTrigger_policy()) {
+ builder.setTriggerPolicy(
+ PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name(policy.getName())
+ .description(policy.getDescription())
+ .actor(policy.getActor())
+ .target(policy.getTarget())
+ .recipe(policy.getRecipe())
+ .payload(null)
+ .retries(policy.getRetry())
+ .timeout(policy.getTimeout()).build());
+ }
+ }
+ }
+
+ // Question : how to change policy ID and results by using builder ??
+
+ @SuppressWarnings("unused")
+ Results results = builder.buildSpecification();
+
+ } catch (FileNotFoundException e) {
+ fail(e.getLocalizedMessage());
+ } catch (IOException e) {
+ fail(e.getLocalizedMessage());
+ } catch (BuilderException e) {
+ fail(e.getLocalizedMessage());
+ }
+
+ }
+
+}
diff --git a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyTest.java b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyTest.java
new file mode 100644
index 000000000..9c92b7573
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyTest.java
@@ -0,0 +1,141 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * policy-yaml unit test
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications 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.controlloop.policy;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.junit.Test;
+import org.onap.policy.common.utils.io.Serializer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.yaml.snakeyaml.DumperOptions;
+import org.yaml.snakeyaml.DumperOptions.FlowStyle;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.constructor.Constructor;
+
+
+public class ControlLoopPolicyTest {
+ private static final Logger logger = LoggerFactory.getLogger(ControlLoopPolicyTest.class);
+
+ @Test
+ public void test1() {
+ this.test("src/test/resources/v1.0.0/policy_Test.yaml");
+ }
+
+ @Test
+ public void testvService1() {
+ this.test("src/test/resources/v1.0.0/policy_vService.yaml");
+ }
+
+ @Test
+ public void testOpenLoop() {
+ this.test("src/test/resources/v1.0.0/policy_OpenLoop.yaml");
+ }
+
+ @Test
+ public void testvdns() {
+ this.test("src/test/resources/v2.0.0/policy_ONAP_demo_vDNS.yaml");
+ }
+
+ @Test
+ public void testvFirewall() {
+ // Chenfei to fix this.
+ // this.test("src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml");
+ }
+
+ @Test
+ public void testvcpe() {
+ this.test("src/test/resources/v2.0.0/policy_ONAP_UseCase_vCPE.yaml");
+ }
+
+ @Test
+ public void testvpci() {
+ this.test("src/test/resources/v2.0.0/policy_ONAP_UseCase_vPCI.yaml");
+ }
+
+ @Test
+ public void testvolte() {
+ this.test("src/test/resources/v2.0.0/policy_ONAP_UseCase_VOLTE.yaml");
+ }
+
+ /**
+ * Does the actual test.
+ *
+ * @param testFile input file
+ */
+ public void test(String testFile) {
+ try (InputStream is = new FileInputStream(new File(testFile))) {
+ //
+ // Read the yaml into our Java Object
+ //
+ Yaml yaml = new Yaml(new Constructor(ControlLoopPolicy.class));
+ Object obj = yaml.load(is);
+ assertNotNull(obj);
+ assertTrue(obj instanceof ControlLoopPolicy);
+ dump(obj);
+ //
+ // Now dump it to a yaml string
+ //
+ DumperOptions options = new DumperOptions();
+ options.setDefaultFlowStyle(FlowStyle.BLOCK);
+ options.setPrettyFlow(true);
+ yaml = new Yaml(options);
+ String dumpedYaml = yaml.dump(obj);
+ logger.debug(dumpedYaml);
+ //
+ // Read that string back into our java object
+ //
+ Object newObject = yaml.load(dumpedYaml);
+ dump(newObject);
+ assertNotNull(newObject);
+ assertTrue(newObject instanceof ControlLoopPolicy);
+ //
+ // Have to comment it out tentatively since it causes junit to fail.
+ // Seems we cannot use assertEquals here. Need advice.
+ //
+ //assertEquals(newObject, obj);
+
+ // test serialization
+ ControlLoopPolicy policy = (ControlLoopPolicy) obj;
+ ControlLoopPolicy policy2 = Serializer.roundTrip(policy);
+ assertTrue(policy.equals(policy2));
+
+ } catch (FileNotFoundException e) {
+ fail(e.getLocalizedMessage());
+ } catch (IOException e) {
+ fail(e.getLocalizedMessage());
+ }
+ }
+
+ public void dump(Object obj) {
+ logger.debug("Dumping ", obj.getClass().getCanonicalName());
+ logger.debug("{}", obj);
+ }
+}
diff --git a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopTest.java b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopTest.java
new file mode 100644
index 000000000..142b51b18
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopTest.java
@@ -0,0 +1,183 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications 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.controlloop.policy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.onap.policy.aai.Pnf;
+import org.onap.policy.common.utils.io.Serializer;
+import org.onap.policy.sdc.Resource;
+import org.onap.policy.sdc.ResourceType;
+import org.onap.policy.sdc.Service;
+
+public class ControlLoopTest {
+
+ private String controlLoopName = "control loop 1";
+ private String version = "1.0.1";
+ private String triggerPolicy = FinalResult.FINAL_OPENLOOP.toString();
+ private Integer timeout = 100;
+ private Boolean abatement = false;
+
+ @Test
+ public void testEqualsSameInstance() {
+ ControlLoop controlLoop1 = new ControlLoop();
+ assertTrue(controlLoop1.equals(controlLoop1));
+ }
+
+ @Test
+ public void testEqualsNull() {
+ ControlLoop controlLoop1 = new ControlLoop();
+ assertFalse(controlLoop1.equals(null));
+ }
+
+ @Test
+ public void testEqualsInstanceOfDiffClass() {
+ ControlLoop controlLoop1 = new ControlLoop();
+ assertFalse(controlLoop1.equals(""));
+ }
+
+ @Test
+ public void testEqualsNoServicesAndResourcesOrTimeout() {
+ final Pnf pnf = new Pnf();
+ pnf.setPnfName("pnf 1");
+
+ ControlLoop controlLoop1 = new ControlLoop();
+ controlLoop1.setControlLoopName(controlLoopName);
+ controlLoop1.setVersion(version);
+ controlLoop1.setPnf(pnf);
+ controlLoop1.setTrigger_policy(triggerPolicy);
+ controlLoop1.setAbatement(abatement);
+
+ ControlLoop controlLoop2 = new ControlLoop();
+ controlLoop2.setControlLoopName(controlLoopName);
+ controlLoop2.setVersion(version);
+ controlLoop2.setPnf(pnf);
+ controlLoop2.setTrigger_policy(triggerPolicy);
+ controlLoop2.setAbatement(abatement);
+
+ assertTrue(controlLoop1.equals(controlLoop2));
+ }
+
+ @Test
+ public void testEquals() throws IOException {
+ final Pnf pnf = new Pnf();
+ pnf.setPnfName("pnf 1");
+
+ ControlLoop controlLoop1 = new ControlLoop();
+ controlLoop1.setControlLoopName(controlLoopName);
+ controlLoop1.setVersion(version);
+ Service service1 = new Service("service1");
+ Service service2 = new Service("service2");
+ List<Service> services = new ArrayList<>();
+ services.add(service1);
+ services.add(service2);
+ controlLoop1.setServices(services);
+ Resource resource1 = new Resource("resource1", ResourceType.VF);
+ Resource resource2 = new Resource("resource2", ResourceType.VFC);
+ List<Resource> resources = new ArrayList<>();
+ resources.add(resource1);
+ resources.add(resource2);
+ controlLoop1.setResources(resources);
+ controlLoop1.setPnf(pnf);
+ controlLoop1.setTrigger_policy(triggerPolicy);
+ controlLoop1.setTimeout(timeout);
+ controlLoop1.setAbatement(abatement);
+
+ ControlLoop controlLoop2 = new ControlLoop();
+ controlLoop2.setControlLoopName(controlLoopName);
+ controlLoop2.setVersion(version);
+ Service controlLoop2Service1 = new Service("service1");
+ Service controlLoop2Service2 = new Service("service2");
+ List<Service> controlLoop2Services = new ArrayList<>();
+ controlLoop2Services.add(controlLoop2Service1);
+ controlLoop2Services.add(controlLoop2Service2);
+ controlLoop2.setServices(controlLoop2Services);
+ Resource controlLoop2Resource1 = new Resource("resource1", ResourceType.VF);
+ Resource controlLoop2Resource2 = new Resource("resource2", ResourceType.VFC);
+ List<Resource> controlLoop2Resources = new ArrayList<>();
+ controlLoop2Resources.add(controlLoop2Resource1);
+ controlLoop2Resources.add(controlLoop2Resource2);
+ controlLoop2.setResources(controlLoop2Resources);
+ controlLoop2.setPnf(pnf);
+ controlLoop2.setTrigger_policy(triggerPolicy);
+ controlLoop2.setTimeout(timeout);
+ controlLoop1.setAbatement(abatement);
+
+ assertTrue(controlLoop1.equals(controlLoop2));
+ assertEquals(controlLoop1.hashCode(), controlLoop2.hashCode());
+
+ controlLoop2 = Serializer.roundTrip(controlLoop1);
+ assertTrue(controlLoop1.equals(controlLoop2));
+ assertEquals(controlLoop1.hashCode(), controlLoop2.hashCode());
+ }
+
+ @Test
+ @Ignore
+ // I'VE MARKED THIS TEST CASE AS IGNORE BECAUSE THE TEST CASE FAILS
+ // This test case fails because the ControlLoop(ControlLoop controlLoop) constructor.
+ // does not copy the value of pnf and version into the newly created object
+ // PLEASE ADVISE IF THE EXISTING BEHAVIOUR IS CORRECT
+ public void testControlLoop() {
+ final Pnf pnf = new Pnf();
+ pnf.setPnfName("pnf 1");
+
+ ControlLoop controlLoop1 = new ControlLoop();
+ controlLoop1.setControlLoopName(controlLoopName);
+ controlLoop1.setVersion(version);
+ Service service1 = new Service("service1");
+ Service service2 = new Service("service2");
+ List<Service> services = new ArrayList<>();
+ services.add(service1);
+ services.add(service2);
+ controlLoop1.setServices(services);
+ Resource resource1 = new Resource("resource1", ResourceType.VF);
+ Resource resource2 = new Resource("resource2", ResourceType.VFC);
+ List<Resource> resources = new ArrayList<>();
+ resources.add(resource1);
+ resources.add(resource2);
+ controlLoop1.setResources(resources);
+ controlLoop1.setPnf(pnf);
+ controlLoop1.setTrigger_policy(triggerPolicy);
+ controlLoop1.setAbatement(abatement);
+
+ ControlLoop controlLoop2 = new ControlLoop(controlLoop1);
+
+ assertEquals(controlLoop1.getControlLoopName(), controlLoop2.getControlLoopName());
+ assertEquals(controlLoop1.getVersion(), controlLoop2.getVersion());
+ assertEquals(controlLoop1.getServices(), controlLoop2.getServices());
+ assertEquals(controlLoop1.getResources(), controlLoop2.getResources());
+ assertEquals(controlLoop1.getPnf(), controlLoop2.getPnf());
+ assertEquals(controlLoop1.getTrigger_policy(), controlLoop2.getTrigger_policy());
+ assertEquals(controlLoop1.getAbatement(), controlLoop2.getAbatement());
+
+ assertTrue(controlLoop1.equals(controlLoop2));
+ }
+
+}
diff --git a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/OperationsAccumulateParamsTest.java b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/OperationsAccumulateParamsTest.java
new file mode 100644
index 000000000..d06f3c010
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/OperationsAccumulateParamsTest.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications 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.controlloop.policy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class OperationsAccumulateParamsTest {
+
+ @Test
+ public void testConstructor() {
+ OperationsAccumulateParams operationsAccumulateParams = new OperationsAccumulateParams();
+ assertNull(operationsAccumulateParams.getPeriod());
+ assertNull(operationsAccumulateParams.getLimit());
+ }
+
+ @Test
+ public void testConstructorOperationsAccumulateParams() {
+ String period = "15m";
+ Integer limit = 10;
+ OperationsAccumulateParams operationsAccumulateParams1 =
+ new OperationsAccumulateParams(period, limit);
+ OperationsAccumulateParams operationsAccumulateParams2 =
+ new OperationsAccumulateParams(operationsAccumulateParams1);
+ assertEquals(period, operationsAccumulateParams1.getPeriod());
+ assertEquals(limit, operationsAccumulateParams2.getLimit());
+ }
+
+ @Test
+ public void testOperationsAccumulateParamsStringInteger() {
+ String period = "15m";
+ Integer limit = 10;
+ OperationsAccumulateParams operationsAccumulateParams = new OperationsAccumulateParams(period, limit);
+ assertEquals(period, operationsAccumulateParams.getPeriod());
+ assertEquals(limit, operationsAccumulateParams.getLimit());
+ }
+
+ @Test
+ public void testSetAndGetPeriod() {
+ String period = "15m";
+ OperationsAccumulateParams operationsAccumulateParams = new OperationsAccumulateParams();
+ operationsAccumulateParams.setPeriod(period);
+ assertEquals(period, operationsAccumulateParams.getPeriod());
+ }
+
+ @Test
+ public void testSetLimit() {
+ Integer limit = 10;
+ OperationsAccumulateParams operationsAccumulateParams = new OperationsAccumulateParams();
+ operationsAccumulateParams.setLimit(limit);
+ assertEquals(limit, operationsAccumulateParams.getLimit());
+ }
+
+ @Test
+ public void testToString() {
+ String period = "15m";
+ Integer limit = 10;
+ OperationsAccumulateParams operationsAccumulateParams = new OperationsAccumulateParams(period, limit);
+ assertEquals("OperationsAccumulateParams [period=15m, limit=10]", operationsAccumulateParams.toString());
+ }
+
+ @Test
+ public void testEqualsAndHashCode() {
+ final String period = "15m";
+ final Integer limit = 10;
+ OperationsAccumulateParams operationsAccumulateParams1 = new OperationsAccumulateParams();
+ OperationsAccumulateParams operationsAccumulateParams2 = new OperationsAccumulateParams();
+
+ assertTrue(operationsAccumulateParams1.equals(operationsAccumulateParams2));
+
+ operationsAccumulateParams1.setPeriod(period);
+ assertFalse(operationsAccumulateParams1.equals(operationsAccumulateParams2));
+ operationsAccumulateParams2.setPeriod(period);
+ assertTrue(operationsAccumulateParams1.equals(operationsAccumulateParams2));
+ assertEquals(operationsAccumulateParams1.hashCode(), operationsAccumulateParams2.hashCode());
+
+ operationsAccumulateParams1.setLimit(limit);;
+ assertFalse(operationsAccumulateParams1.equals(operationsAccumulateParams2));
+ operationsAccumulateParams2.setLimit(limit);
+ assertTrue(operationsAccumulateParams1.equals(operationsAccumulateParams2));
+ assertEquals(operationsAccumulateParams1.hashCode(), operationsAccumulateParams2.hashCode());
+ }
+
+
+ @Test
+ public void testEqualsSameObject() {
+ OperationsAccumulateParams operationsAccumulateParams = new OperationsAccumulateParams();
+ assertTrue(operationsAccumulateParams.equals(operationsAccumulateParams));
+ }
+
+ @Test
+ public void testEqualsNull() {
+ OperationsAccumulateParams operationsAccumulateParams = new OperationsAccumulateParams();
+ assertFalse(operationsAccumulateParams.equals(null));
+ }
+
+ @Test
+ public void testEqualsInstanceOfDiffClass() {
+ OperationsAccumulateParams operationsAccumulateParams = new OperationsAccumulateParams();
+ assertFalse(operationsAccumulateParams.equals(""));
+ }
+
+}
diff --git a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/PolicyTest.java b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/PolicyTest.java
new file mode 100644
index 000000000..e87a421c4
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/PolicyTest.java
@@ -0,0 +1,221 @@
+/*
+ * ============LICENSE_START=======================================================
+ * policy-yaml unit test
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications 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.controlloop.policy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.TreeMap;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.common.utils.io.Serializer;
+
+public class PolicyTest {
+ private Policy policy;
+
+ @Before
+ public void setUp() {
+ policy = new Policy();
+ }
+
+ @Test
+ public void testHashCode() {
+ assertTrue(policy.hashCode() != 0);
+
+ policy.setActor("a");
+ int hc1 = policy.hashCode();
+
+ policy.setActor("b");
+ assertTrue(hc1 != policy.hashCode());
+ }
+
+ @Test
+ public void test() throws IOException {
+ OperationsAccumulateParams operationsAccumulateParams = new OperationsAccumulateParams();
+ operationsAccumulateParams.setLimit(10);
+
+ Map<String, String> payload = new TreeMap<>();
+ payload.put("mykey", "myvalue");
+
+ Target target = new Target();
+ target.setResourceID("myresource");
+
+ policy.setActor("act");
+ policy.setDescription("desc");
+ policy.setFailure("fail");
+ policy.setFailure_exception("failex");
+ policy.setFailure_guard("failguard");
+ policy.setFailure_retries("failretry");
+ policy.setFailure_timeout("failtimeout");
+ policy.setId("myid");
+ policy.setName("myname");
+ policy.setOperationsAccumulateParams(operationsAccumulateParams);
+ policy.setPayload(payload);
+ policy.setRecipe("myrecipe");
+ policy.setRetry(20);
+ policy.setSuccess("succ");
+ policy.setTarget(target);
+ policy.setTimeout(30);
+
+ assertEquals("act", policy.getActor());
+ assertEquals("desc", policy.getDescription());
+ assertEquals("fail", policy.getFailure());
+ assertEquals("failex", policy.getFailure_exception());
+ assertEquals("failguard", policy.getFailure_guard());
+ assertEquals("failretry", policy.getFailure_retries());
+ assertEquals("failtimeout", policy.getFailure_timeout());
+ assertEquals("myid", policy.getId());
+ assertEquals("myname", policy.getName());
+ assertEquals(operationsAccumulateParams, policy.getOperationsAccumulateParams());
+ assertEquals(payload, policy.getPayload());
+ assertEquals("myrecipe", policy.getRecipe());
+ assertEquals(20, policy.getRetry().intValue());
+ assertEquals("succ", policy.getSuccess());
+ assertEquals(target, policy.getTarget());
+ assertEquals(30, policy.getTimeout().intValue());
+
+ assertTrue(policy.equals(policy));
+ assertTrue(policy.hashCode() != new Policy().hashCode());
+ assertFalse(policy.equals(new Policy()));
+
+ Policy policy2 = Serializer.roundTrip(policy);
+ assertTrue(policy.equals(policy2));
+ assertEquals(policy.hashCode(), policy2.hashCode());
+
+ policy2 = new Policy(policy);
+ assertTrue(policy.equals(policy2));
+ assertEquals(policy.hashCode(), policy2.hashCode());
+ }
+
+ @Test
+ public void testPolicyString() {
+ policy = new Policy("justId");
+ assertEquals("justId", policy.getId());
+ }
+
+ @Test
+ public void testPolicyStringStringStringMapOfStringStringTarget() {
+ Map<String, String> payload = new TreeMap<>();
+ payload.put("mykeyB", "myvalueB");
+
+ Target target = new Target();
+ target.setResourceID("myresourceB");
+
+ policy = new Policy("nameB", "actorB", "recipeB", payload, target);
+ assertEquals("nameB", policy.getName());
+ assertEquals("actorB", policy.getActor());
+ assertEquals("recipeB", policy.getRecipe());
+ assertEquals(payload, policy.getPayload());
+ assertEquals(target, policy.getTarget());
+
+ assertTrue(policy.hashCode() != new Policy().hashCode());
+ }
+
+ @Test
+ public void testPolicyStringStringStringMapOfStringStringTargetIntegerInteger() {
+ Map<String, String> payload = new TreeMap<>();
+ payload.put("mykeyC", "myvalueC");
+
+ Target target = new Target();
+ target.setResourceID("myresourceC");
+
+ policy = new Policy("nameC", "actorC", "recipeC", payload, target, 201, 202);
+ assertEquals("nameC", policy.getName());
+ assertEquals("actorC", policy.getActor());
+ assertEquals("recipeC", policy.getRecipe());
+ assertEquals(payload, policy.getPayload());
+ assertEquals(target, policy.getTarget());
+ assertEquals(201, policy.getRetry().intValue());
+ assertEquals(202, policy.getTimeout().intValue());
+
+ assertTrue(policy.hashCode() != new Policy().hashCode());
+ }
+
+ @Test
+ public void testPolicyStringStringStringStringMapOfStringStringTargetStringIntegerInteger() {
+ Map<String, String> payload = new TreeMap<>();
+ payload.put("mykeyD", "myvalueD");
+
+ Target target = new Target();
+ target.setResourceID("myresourceD");
+
+ policy = new Policy(
+ PolicyParam.builder().id("idD")
+ .name("nameD")
+ .description("descD")
+ .actor("actorD")
+ .payload(payload)
+ .target(target)
+ .recipe("recipeD")
+ .retries(301)
+ .timeout(302)
+ .build());
+ assertEquals("idD", policy.getId());
+ assertEquals("nameD", policy.getName());
+ assertEquals("descD", policy.getDescription());
+ assertEquals("actorD", policy.getActor());
+ assertEquals(payload, policy.getPayload());
+ assertEquals(target, policy.getTarget());
+ assertEquals("recipeD", policy.getRecipe());
+ assertEquals(301, policy.getRetry().intValue());
+ assertEquals(302, policy.getTimeout().intValue());
+
+ assertTrue(policy.hashCode() != new Policy().hashCode());
+ }
+
+ @Test
+ public void testIsValid() {
+ assertFalse(policy.isValid());
+
+ Target target = new Target();
+ target.setResourceID("myresourceV");
+
+ policy = new Policy("nameV", "actorV", "recipeV", null, target);
+ assertEquals(null, policy.getPayload());
+ assertTrue(policy.isValid());
+ }
+
+ @Test
+ public void testToString() {
+ assertNotNull(policy.toString());
+ }
+
+ @Test
+ public void testEqualsObject() {
+ assertTrue(policy.equals(policy));
+
+ policy.setId("idE");
+ assertFalse(policy.equals(new Policy()));
+
+ Policy policy2 = new Policy();
+ policy2.setId(policy.getId());
+ assertTrue(policy.equals(policy2));
+
+ policy2.setId("idX");
+ assertFalse(policy.equals(policy2));
+ }
+
+}
diff --git a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ConstraintTest.java b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ConstraintTest.java
new file mode 100644
index 000000000..0c8901ffb
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ConstraintTest.java
@@ -0,0 +1,256 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications 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.controlloop.policy.guard;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class ConstraintTest {
+
+ @Test
+ public void testConstraint() {
+ Constraint constraint = new Constraint();
+
+ assertNull(constraint.getFreq_limit_per_target());
+ assertNull(constraint.getTime_window());
+ assertNull(constraint.getActive_time_range());
+ assertNull(constraint.getBlacklist());
+ }
+
+ @Test
+ public void testGetAndSetFreq_limit_per_target() {
+ Integer freqLimitPerTarget = 10;
+ Constraint constraint = new Constraint();
+ constraint.setFreq_limit_per_target(freqLimitPerTarget);
+ assertEquals(freqLimitPerTarget, constraint.getFreq_limit_per_target());
+ }
+
+ @Test
+ public void testGetAndSetTime_window() {
+ Map<String, String> timeWindow = new HashMap<>();
+ timeWindow.put("timeWindowKey", "timeWindowValue");
+ Constraint constraint = new Constraint();
+ constraint.setTime_window(timeWindow);
+ assertEquals(timeWindow, constraint.getTime_window());
+ }
+
+ @Test
+ public void testGetAndSetActive_time_range() {
+ Map<String, String> activeTimeRange = new HashMap<>();
+ activeTimeRange.put("timeWindowKey", "timeWindowValue");
+ Constraint constraint = new Constraint();
+ constraint.setActive_time_range(activeTimeRange);;
+ assertEquals(activeTimeRange, constraint.getActive_time_range());
+ }
+
+ @Test
+ public void testGetAndSetBlacklist() {
+ List<String> blacklist = new ArrayList<>();
+ blacklist.add("blacklist item");
+ Constraint constraint = new Constraint();
+ constraint.setBlacklist(blacklist);
+ assertEquals(blacklist, constraint.getBlacklist());
+ }
+
+ @Test
+ public void testConstraintIntegerMapOfStringString() {
+ Integer freqLimitPerTarget = 10;
+ Map<String, String> timeWindow = new HashMap<>();
+
+ Constraint constraint = new Constraint(freqLimitPerTarget, timeWindow);
+
+ assertEquals(freqLimitPerTarget, constraint.getFreq_limit_per_target());
+ assertEquals(timeWindow, constraint.getTime_window());
+ assertNull(constraint.getActive_time_range());
+ assertNull(constraint.getBlacklist());
+ }
+
+ @Test
+ public void testConstraintListOfString() {
+ List<String> blacklist = new ArrayList<>();
+ blacklist.add("blacklist item");
+ Constraint constraint = new Constraint(blacklist);
+
+ assertNull(constraint.getFreq_limit_per_target());
+ assertNull(constraint.getTime_window());
+ assertNull(constraint.getActive_time_range());
+ assertEquals(blacklist, constraint.getBlacklist());
+ }
+
+ @Test
+ public void testConstraintIntegerMapOfStringStringListOfString() {
+ Integer freqLimitPerTarget = 10;
+ Map<String, String> timeWindow = new HashMap<>();
+ List<String> blacklist = new ArrayList<>();
+ blacklist.add("blacklist item");
+ Constraint constraint = new Constraint(freqLimitPerTarget, timeWindow, blacklist);
+
+ assertEquals(freqLimitPerTarget, constraint.getFreq_limit_per_target());
+ assertEquals(timeWindow, constraint.getTime_window());
+ assertNull(constraint.getActive_time_range());
+ assertEquals(blacklist, constraint.getBlacklist());
+ }
+
+ @Test
+ public void testConstraintIntegerMapOfStringStringMapOfStringString() {
+ Integer freqLimitPerTarget = 10;
+ Map<String, String> timeWindow = new HashMap<>();
+ Map<String, String> activeTimeRange = new HashMap<>();
+ activeTimeRange.put("timeWindowKey", "timeWindowValue");
+ Constraint constraint = new Constraint(freqLimitPerTarget, timeWindow, activeTimeRange);
+
+ assertEquals(freqLimitPerTarget, constraint.getFreq_limit_per_target());
+ assertEquals(timeWindow, constraint.getTime_window());
+ assertEquals(activeTimeRange, constraint.getActive_time_range());
+ assertNull(constraint.getBlacklist());
+
+ }
+
+ @Test
+ public void testConstraintIntegerMapOfStringStringMapOfStringStringListOfString() {
+ Integer freqLimitPerTarget = 10;
+ Map<String, String> timeWindow = new HashMap<>();
+ Map<String, String> activeTimeRange = new HashMap<>();
+ activeTimeRange.put("timeWindowKey", "timeWindowValue");
+ List<String> blacklist = new ArrayList<>();
+ blacklist.add("blacklist item");
+ Constraint constraint = new Constraint(freqLimitPerTarget, timeWindow, activeTimeRange, blacklist);
+
+ assertEquals(freqLimitPerTarget, constraint.getFreq_limit_per_target());
+ assertEquals(timeWindow, constraint.getTime_window());
+ assertEquals(activeTimeRange, constraint.getActive_time_range());
+ assertEquals(blacklist, constraint.getBlacklist());
+ }
+
+ @Test
+ public void testConstraintConstraint() {
+ Integer freqLimitPerTarget = 10;
+ Map<String, String> timeWindow = new HashMap<>();
+ Map<String, String> activeTimeRange = new HashMap<>();
+ activeTimeRange.put("timeWindowKey", "timeWindowValue");
+ List<String> blacklist = new ArrayList<>();
+ blacklist.add("blacklist item");
+ Constraint constraint1 = new Constraint(freqLimitPerTarget, timeWindow, activeTimeRange, blacklist);
+ Constraint constraint2 = new Constraint(constraint1);
+
+ assertEquals(freqLimitPerTarget, constraint2.getFreq_limit_per_target());
+ assertEquals(timeWindow, constraint2.getTime_window());
+ assertEquals(activeTimeRange, constraint2.getActive_time_range());
+ assertEquals(blacklist, constraint2.getBlacklist());
+ }
+
+ @Test
+ public void testIsValid() {
+ Integer freqLimitPerTarget = 10;
+ final Map<String, String> timeWindow = new HashMap<>();
+
+ Constraint constraint = new Constraint();
+ assertTrue(constraint.isValid());
+
+ constraint.setFreq_limit_per_target(freqLimitPerTarget);
+ assertFalse(constraint.isValid());
+
+ constraint.setTime_window(timeWindow);
+ assertTrue(constraint.isValid());
+
+ constraint.setFreq_limit_per_target(null);
+ assertFalse(constraint.isValid());
+ }
+
+ @Test
+ public void testToString() {
+ Integer freqLimitPerTarget = 10;
+ Map<String, String> timeWindow = new HashMap<>();
+ Map<String, String> activeTimeRange = new HashMap<>();
+ activeTimeRange.put("timeWindowKey", "timeWindowValue");
+ List<String> blacklist = new ArrayList<>();
+ blacklist.add("blacklist item");
+ Constraint constraint = new Constraint(freqLimitPerTarget, timeWindow, activeTimeRange, blacklist);
+
+ assertEquals(constraint.toString(), "Constraint [freq_limit_per_target=" + freqLimitPerTarget + ", time_window="
+ + timeWindow + ", active_time_range=" + activeTimeRange + ", blacklist=" + blacklist + "]");
+ }
+
+ @Test
+ public void testEquals() {
+ Integer freqLimitPerTarget = 10;
+ final Map<String, String> timeWindow = new HashMap<>();
+ final Map<String, String> activeTimeRange = new HashMap<>();
+ List<String> blacklist = new ArrayList<>();
+ blacklist.add("blacklist item");
+
+ Constraint constraint1 = new Constraint();
+ Constraint constraint2 = new Constraint();
+ assertTrue(constraint1.equals(constraint2));
+
+ constraint1.setFreq_limit_per_target(freqLimitPerTarget);
+ assertFalse(constraint1.equals(constraint2));
+ constraint2.setFreq_limit_per_target(freqLimitPerTarget);
+ assertTrue(constraint1.equals(constraint2));
+ assertEquals(constraint1.hashCode(), constraint2.hashCode());
+
+ constraint1.setTime_window(timeWindow);
+ assertFalse(constraint1.equals(constraint2));
+ constraint2.setTime_window(timeWindow);
+ assertTrue(constraint1.equals(constraint2));
+ assertEquals(constraint1.hashCode(), constraint2.hashCode());
+
+ constraint1.setActive_time_range(activeTimeRange);
+ assertFalse(constraint1.equals(constraint2));
+ constraint2.setActive_time_range(activeTimeRange);
+ assertTrue(constraint1.equals(constraint2));
+ assertEquals(constraint1.hashCode(), constraint2.hashCode());
+
+ constraint1.setBlacklist(blacklist);
+ assertFalse(constraint1.equals(constraint2));
+ constraint2.setBlacklist(blacklist);
+ assertTrue(constraint1.equals(constraint2));
+ assertEquals(constraint1.hashCode(), constraint2.hashCode());
+ }
+
+ @Test
+ public void testEqualsSameObject() {
+ Constraint constraint = new Constraint();
+ assertTrue(constraint.equals(constraint));
+ }
+
+ @Test
+ public void testEqualsNull() {
+ Constraint constraint = new Constraint();
+ assertFalse(constraint.equals(null));
+ }
+
+ @Test
+ public void testEqualsInstanceOfDiffClass() {
+ Constraint constraint = new Constraint();
+ assertFalse(constraint.equals(""));
+ }
+
+}
diff --git a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuardBuilderTest.java b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuardBuilderTest.java
new file mode 100644
index 000000000..f289d931f
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuardBuilderTest.java
@@ -0,0 +1,218 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * policy-yaml unit test
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications 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.controlloop.policy.guard;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+import org.onap.policy.controlloop.policy.builder.BuilderException;
+import org.onap.policy.controlloop.policy.builder.Message;
+import org.onap.policy.controlloop.policy.builder.MessageLevel;
+import org.onap.policy.controlloop.policy.builder.Results;
+import org.onap.policy.controlloop.policy.guard.builder.ControlLoopGuardBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.constructor.Constructor;
+
+public class ControlLoopGuardBuilderTest {
+ private static final Logger logger = LoggerFactory.getLogger(ControlLoopGuardBuilderTest.class);
+
+ @Test
+ public void testControlLoopGuard() {
+ try {
+ //
+ // Create a builder
+ //
+ ControlLoopGuardBuilder builder = ControlLoopGuardBuilder.Factory.buildControlLoopGuard(new Guard());
+ //
+ // Assert there is no guard policies yet
+ //
+ Results results = builder.buildSpecification();
+ boolean noGuardPolicies = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage().equals("ControlLoop Guard should have at least one guard policies")
+ && m.getLevel() == MessageLevel.ERROR) {
+ noGuardPolicies = true;
+ break;
+ }
+ }
+ assertTrue(noGuardPolicies);
+ //
+ // Add a guard policy without limit constraint
+ //
+ String clname = "CL_vUSP123";
+ LinkedList<String> targets = new LinkedList<String>();
+ targets.add("s1");
+ targets.add("s2");
+ targets.add("s3");
+ MatchParameters matchParameters = new MatchParameters(clname, "APPC", "Restart", targets);
+ GuardPolicy policy1 = new GuardPolicy("id123", "guardpolicy1", "description aaa", matchParameters);
+ builder = builder.addGuardPolicy(policy1);
+ //
+ // Assert there is no limit constraint associated with the only guard policy
+ //
+ results = builder.buildSpecification();
+ boolean noConstraint = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage().equals("Guard policy guardpolicy1 does not have any limit constraint")
+ && m.getLevel() == MessageLevel.ERROR) {
+ noConstraint = true;
+ break;
+ }
+ }
+ assertTrue(noConstraint);
+ //
+ // Add a constraint to policy1
+ //
+ Map<String, String> activeTimeRange = new HashMap<String, String>();
+ activeTimeRange.put("start", "00:00:00-05:00");
+ activeTimeRange.put("end", "23:59:59-05:00");
+ List<String> blacklist = new LinkedList<String>();
+ blacklist.add("eNodeB_common_id1");
+ blacklist.add("eNodeB_common_id2");
+ Map<String, String> timeWindow = new HashMap<String, String>();
+ timeWindow.put("value", "10");
+ timeWindow.put("units", "minute");
+ Constraint cons = new Constraint(5, timeWindow, activeTimeRange, blacklist);
+ builder = builder.addLimitConstraint(policy1.getId(), cons);
+ //
+ // Add a duplicate constraint to policy1
+ //
+ builder = builder.addLimitConstraint(policy1.getId(), cons);
+ //
+ // Assert there are duplicate constraints associated with the only guard policy
+ //
+ results = builder.buildSpecification();
+ boolean duplicateConstraint = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage().equals("Guard policy guardpolicy1 has duplicate limit constraints")
+ && m.getLevel() == MessageLevel.WARNING) {
+ duplicateConstraint = true;
+ break;
+ }
+ }
+ assertTrue(duplicateConstraint);
+ //
+ // Remove the duplicate constraint
+ //
+ builder = builder.removeLimitConstraint(policy1.getId(), cons);
+ //
+ // Add a duplicate guard policy
+ //
+ builder = builder.addGuardPolicy(policy1);
+ builder = builder.addLimitConstraint(policy1.getId(), cons);
+ //
+ // Assert there are duplicate guard policies
+ //
+ results = builder.buildSpecification();
+ boolean duplicateGuardPolicy = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage().equals("There are duplicate guard policies")
+ && m.getLevel() == MessageLevel.WARNING) {
+ duplicateGuardPolicy = true;
+ break;
+ }
+ }
+ assertTrue(duplicateGuardPolicy);
+ //
+ // Remove the duplicate guard policy
+ //
+ builder = builder.removeGuardPolicy(policy1);
+ //
+ // Assert there are no Error/Warning message
+ //
+ results = builder.buildSpecification();
+ assertTrue(results.getMessages().size() == 1);
+ //
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void test1() {
+ this.test("src/test/resources/v2.0.0-guard/policy_guard_ONAP_demo_vDNS.yaml");
+ }
+
+ @Test
+ public void test2() {
+ this.test("src/test/resources/v2.0.0-guard/policy_guard_appc_restart.yaml");
+ }
+
+ /**
+ * Do the actual test.
+ *
+ * @param testFile input test file
+ */
+ public void test(String testFile) {
+ try (InputStream is = new FileInputStream(new File(testFile))) {
+ //
+ // Read the yaml into our Java Object
+ //
+ Yaml yaml = new Yaml(new Constructor(ControlLoopGuard.class));
+ Object obj = yaml.load(is);
+ assertNotNull(obj);
+ assertTrue(obj instanceof ControlLoopGuard);
+ ControlLoopGuard guardTobuild = (ControlLoopGuard) obj;
+ //
+ // Now we're going to try to use the builder to build this.
+ //
+ ControlLoopGuardBuilder builder =
+ ControlLoopGuardBuilder.Factory.buildControlLoopGuard(guardTobuild.getGuard());
+ //
+ // Add guard policy
+ //
+ if (guardTobuild.getGuards() != null) {
+ builder = builder.addGuardPolicy(guardTobuild.getGuards().toArray(
+ new GuardPolicy[guardTobuild.getGuards().size()]));
+ }
+ //
+ // Build the specification
+ //
+ Results results = builder.buildSpecification();
+ //
+ // Print out the specification
+ //
+ logger.debug(results.getSpecification());
+ //
+ } catch (FileNotFoundException e) {
+ fail(e.getLocalizedMessage());
+ } catch (IOException e) {
+ fail(e.getLocalizedMessage());
+ } catch (BuilderException e) {
+ fail(e.getLocalizedMessage());
+ }
+ }
+}
diff --git a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuardTest.java b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuardTest.java
new file mode 100644
index 000000000..01d6eb1fe
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuardTest.java
@@ -0,0 +1,170 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * policy-yaml unit test
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications 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.controlloop.policy.guard;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.LinkedList;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.yaml.snakeyaml.DumperOptions;
+import org.yaml.snakeyaml.DumperOptions.FlowStyle;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.constructor.Constructor;
+
+
+public class ControlLoopGuardTest {
+ private static final Logger logger = LoggerFactory.getLogger(ControlLoopGuardTest.class);
+
+ @Test
+ public void testGuardvdns() {
+ this.test("src/test/resources/v2.0.0-guard/policy_guard_ONAP_demo_vDNS.yaml");
+ }
+
+ @Test
+ public void testGuardvusp() {
+ this.test("src/test/resources/v2.0.0-guard/policy_guard_appc_restart.yaml");
+ }
+
+ @Test
+ public void testConstructorControlLoopGuard() {
+ Guard guard1 = new Guard();
+ GuardPolicy guardPolicy1 = new GuardPolicy();
+ GuardPolicy guardPolicy2 = new GuardPolicy();
+ LinkedList<GuardPolicy> guardPolicies = new LinkedList<>();
+ guardPolicies.add(guardPolicy1);
+ guardPolicies.add(guardPolicy2);
+
+ ControlLoopGuard controlLoopGuard1 = new ControlLoopGuard();
+ controlLoopGuard1.setGuard(guard1);
+ controlLoopGuard1.setGuards(guardPolicies);
+ ControlLoopGuard controlLoopGuard2 = new ControlLoopGuard(controlLoopGuard1);
+
+ assertEquals(guard1, controlLoopGuard2.getGuard());
+ assertEquals(guardPolicies, controlLoopGuard2.getGuards());
+ }
+
+ @Test
+ public void testEqualsAndHashCode() {
+ final Guard guard1 = new Guard();
+ GuardPolicy guardPolicy1 = new GuardPolicy();
+ GuardPolicy guardPolicy2 = new GuardPolicy();
+ LinkedList<GuardPolicy> guardPolicies = new LinkedList<>();
+ guardPolicies.add(guardPolicy1);
+ guardPolicies.add(guardPolicy2);
+
+ ControlLoopGuard controlLoopGuard1 = new ControlLoopGuard();
+ ControlLoopGuard controlLoopGuard2 = new ControlLoopGuard();
+
+ assertTrue(controlLoopGuard1.equals(controlLoopGuard2));
+ assertEquals(controlLoopGuard1.hashCode(), controlLoopGuard2.hashCode());
+
+ controlLoopGuard1.setGuard(guard1);
+ assertFalse(controlLoopGuard1.equals(controlLoopGuard2));
+ controlLoopGuard2.setGuard(guard1);
+ assertTrue(controlLoopGuard1.equals(controlLoopGuard2));
+ assertEquals(controlLoopGuard1.hashCode(), controlLoopGuard2.hashCode());
+
+ controlLoopGuard1.setGuards(guardPolicies);
+ assertFalse(controlLoopGuard1.equals(controlLoopGuard2));
+ controlLoopGuard2.setGuards(guardPolicies);
+ assertTrue(controlLoopGuard1.equals(controlLoopGuard2));
+ assertEquals(controlLoopGuard1.hashCode(), controlLoopGuard2.hashCode());
+ }
+
+ @Test
+ public void testEqualsSameObject() {
+ ControlLoopGuard controlLoopGuard = new ControlLoopGuard();
+ assertTrue(controlLoopGuard.equals(controlLoopGuard));
+ }
+
+ @Test
+ public void testEqualsNull() {
+ ControlLoopGuard controlLoopGuard = new ControlLoopGuard();
+ assertFalse(controlLoopGuard.equals(null));
+ }
+
+ @Test
+ public void testEqualsInstanceOfDiffClass() {
+ ControlLoopGuard controlLoopGuard = new ControlLoopGuard();
+ assertFalse(controlLoopGuard.equals(""));
+ }
+
+ /**
+ * Does the actual test.
+ *
+ * @param testFile input file
+ */
+ public void test(String testFile) {
+ try (InputStream is = new FileInputStream(new File(testFile))) {
+ //
+ // Read the yaml into our Java Object
+ //
+ Yaml yaml = new Yaml(new Constructor(ControlLoopGuard.class));
+ Object obj = yaml.load(is);
+ assertNotNull(obj);
+ assertTrue(obj instanceof ControlLoopGuard);
+ dump(obj);
+ //
+ // Now dump it to a yaml string
+ //
+ DumperOptions options = new DumperOptions();
+ options.setDefaultFlowStyle(FlowStyle.BLOCK);
+ options.setPrettyFlow(true);
+ yaml = new Yaml(options);
+ String dumpedYaml = yaml.dump(obj);
+ logger.debug(dumpedYaml);
+ //
+ // Read that string back into our java object
+ //
+ Object newObject = yaml.load(dumpedYaml);
+ dump(newObject);
+ assertNotNull(newObject);
+ assertTrue(newObject instanceof ControlLoopGuard);
+ //
+ // Have to comment it out tentatively since it causes junit to fail.
+ // Seems we cannot use assertEquals here. Need advice.
+ //
+ //assertEquals(newObject, obj);
+ } catch (FileNotFoundException e) {
+ fail(e.getLocalizedMessage());
+ } catch (IOException e) {
+ fail(e.getLocalizedMessage());
+ }
+ }
+
+ public void dump(Object obj) {
+ logger.debug("Dumping {}", obj.getClass().getCanonicalName());
+ logger.debug("{}", obj);
+ }
+}
diff --git a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/GuardPolicyTest.java b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/GuardPolicyTest.java
new file mode 100644
index 000000000..a8d183c8c
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/GuardPolicyTest.java
@@ -0,0 +1,271 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications 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.controlloop.policy.guard;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.junit.Test;
+
+public class GuardPolicyTest {
+
+ @Test
+ public void testConstructor() {
+ GuardPolicy guardPolicy = new GuardPolicy();
+
+ assertNotNull(guardPolicy.getId());
+ assertNull(guardPolicy.getName());
+ assertNull(guardPolicy.getDescription());
+ assertNull(guardPolicy.getMatch_parameters());
+ assertNull(guardPolicy.getLimit_constraints());
+ }
+
+ @Test
+ public void testConstructorString() {
+ String id = "guard id";
+ GuardPolicy guardPolicy = new GuardPolicy(id);
+
+ assertEquals(id, guardPolicy.getId());
+ assertNull(guardPolicy.getName());
+ assertNull(guardPolicy.getDescription());
+ assertNull(guardPolicy.getMatch_parameters());
+ assertNull(guardPolicy.getLimit_constraints());
+ }
+
+ @Test
+ public void testConstructorStringStringStringMatchParameters() {
+ String id = "guard id";
+ String name = "guard name";
+ String description = "guard description";
+ MatchParameters matchParameters = new MatchParameters();
+ List<Constraint> limitConstraints = new LinkedList<>();
+ limitConstraints.add(new Constraint());
+ GuardPolicy guardPolicy = new GuardPolicy(id, name, description, matchParameters);
+
+ assertNotNull(guardPolicy.getId());
+ assertEquals(name, guardPolicy.getName());
+ assertEquals(description, guardPolicy.getDescription());
+ assertEquals(matchParameters, guardPolicy.getMatch_parameters());
+ assertNull(guardPolicy.getLimit_constraints());
+ }
+
+ @Test
+ public void testConstructorStringMatchParametersList() {
+ String name = "guard name";
+ MatchParameters matchParameters = new MatchParameters();
+ List<Constraint> limitConstraints = new LinkedList<>();
+ limitConstraints.add(new Constraint());
+ GuardPolicy guardPolicy = new GuardPolicy(name, matchParameters, limitConstraints);
+
+ assertNotNull(guardPolicy.getId());
+ assertEquals(name, guardPolicy.getName());
+ assertNull(guardPolicy.getDescription());
+ assertEquals(matchParameters, guardPolicy.getMatch_parameters());
+ assertEquals(limitConstraints, guardPolicy.getLimit_constraints());
+ }
+
+ @Test
+ public void testConstructorStringStringMatchParametersList() {
+ String name = "guard name";
+ String description = "guard description";
+ MatchParameters matchParameters = new MatchParameters();
+ List<Constraint> limitConstraints = new LinkedList<>();
+ limitConstraints.add(new Constraint());
+ GuardPolicy guardPolicy = new GuardPolicy(name, description, matchParameters, limitConstraints);
+
+ assertNotNull(guardPolicy.getId());
+ assertEquals(name, guardPolicy.getName());
+ assertEquals(description, guardPolicy.getDescription());
+ assertEquals(matchParameters, guardPolicy.getMatch_parameters());
+ assertEquals(limitConstraints, guardPolicy.getLimit_constraints());
+ }
+
+ @Test
+ public void testConstructorStringStringStringMatchParametersList() {
+ String id = "guard id";
+ String name = "guard name";
+ String description = "guard description";
+ MatchParameters matchParameters = new MatchParameters();
+ List<Constraint> limitConstraints = new LinkedList<>();
+ limitConstraints.add(new Constraint());
+ GuardPolicy guardPolicy = new GuardPolicy(id, name, description, matchParameters, limitConstraints);
+
+ assertEquals(id, guardPolicy.getId());
+ assertEquals(name, guardPolicy.getName());
+ assertEquals(description, guardPolicy.getDescription());
+ assertEquals(matchParameters, guardPolicy.getMatch_parameters());
+ assertEquals(limitConstraints, guardPolicy.getLimit_constraints());
+ }
+
+ @Test
+ public void testConstructorGuardPolicy() {
+ String id = "guard id";
+ String name = "guard name";
+ String description = "guard description";
+ MatchParameters matchParameters = new MatchParameters();
+ List<Constraint> limitConstraints = new LinkedList<>();
+ limitConstraints.add(new Constraint());
+ GuardPolicy guardPolicy1 = new GuardPolicy(id, name, description, matchParameters, limitConstraints);
+
+ GuardPolicy guardPolicy2 = new GuardPolicy(guardPolicy1);
+
+
+ assertEquals(id, guardPolicy2.getId());
+ assertEquals(name, guardPolicy2.getName());
+ assertEquals(description, guardPolicy2.getDescription());
+ assertEquals(matchParameters, guardPolicy2.getMatch_parameters());
+ assertEquals(limitConstraints, guardPolicy2.getLimit_constraints());
+ }
+
+ @Test
+ public void testSetAndGetId() {
+ String id = "guard id";
+ GuardPolicy guardPolicy = new GuardPolicy();
+ guardPolicy.setId(id);
+ assertEquals(id, guardPolicy.getId());
+ }
+
+ @Test
+ public void testSetAndGetName() {
+ String name = "guard name";
+ GuardPolicy guardPolicy = new GuardPolicy();
+ guardPolicy.setName(name);
+ assertEquals(name, guardPolicy.getName());
+ }
+
+ @Test
+ public void testSetAndGetDescription() {
+ String description = "guard description";
+ GuardPolicy guardPolicy = new GuardPolicy();
+ guardPolicy.setDescription(description);
+ assertEquals(description, guardPolicy.getDescription());
+ }
+
+ @Test
+ public void testSetAndGetMatchParameters() {
+ MatchParameters matchParameters = new MatchParameters();
+ GuardPolicy guardPolicy = new GuardPolicy();
+ guardPolicy.setMatch_parameters(matchParameters);
+ assertEquals(matchParameters, guardPolicy.getMatch_parameters());
+ }
+
+ @Test
+ public void testSetAndGetLimitConstraints() {
+ LinkedList<Constraint> limitConstraints = new LinkedList<>();
+ limitConstraints.add(new Constraint());
+ GuardPolicy guardPolicy = new GuardPolicy();
+ guardPolicy.setLimit_constraints(limitConstraints);
+ assertEquals(limitConstraints, guardPolicy.getLimit_constraints());
+ }
+
+ @Test
+ public void testIsValid() {
+ GuardPolicy guardPolicy = new GuardPolicy();
+ assertFalse(guardPolicy.isValid());
+
+ guardPolicy.setName("guard name");
+ assertTrue(guardPolicy.isValid());
+
+ guardPolicy.setId(null);
+ assertFalse(guardPolicy.isValid());
+ }
+
+ @Test
+ public void testToString() {
+ String id = "guard id";
+ String name = "guard name";
+ String description = "guard description";
+ MatchParameters matchParameters = new MatchParameters();
+ List<Constraint> limitConstraints = new LinkedList<>();
+ limitConstraints.add(new Constraint());
+ GuardPolicy guardPolicy = new GuardPolicy(id, name, description, matchParameters, limitConstraints);
+
+ assertEquals(guardPolicy.toString(), "Policy [id=guard id, name=guard name, description=guard description, "
+ + "match_parameters=MatchParameters [controlLoopName=null, actor=null, recipe=null, targets=null], "
+ + "limitConstraints=[Constraint [freq_limit_per_target=null, time_window=null, active_time_range=null,"
+ + " blacklist=null]]]", guardPolicy.toString());
+ }
+
+ @Test
+ public void testEquals() {
+ final String id = "guard id";
+ final String name = "guard name";
+ final String description = "guard description";
+ GuardPolicy guardPolicy1 = new GuardPolicy(id);
+ GuardPolicy guardPolicy2 = new GuardPolicy();
+ assertFalse(guardPolicy1.equals(guardPolicy2));
+
+ guardPolicy2.setId(id);
+ assertTrue(guardPolicy1.equals(guardPolicy2));
+ assertEquals(guardPolicy1.hashCode(), guardPolicy2.hashCode());
+
+ guardPolicy1.setName(name);
+ assertFalse(guardPolicy1.equals(guardPolicy2));
+ guardPolicy2.setName(name);
+ assertTrue(guardPolicy1.equals(guardPolicy2));
+ assertEquals(guardPolicy1.hashCode(), guardPolicy2.hashCode());
+
+ guardPolicy1.setDescription(description);
+ assertFalse(guardPolicy1.equals(guardPolicy2));
+ guardPolicy2.setDescription(description);
+ assertTrue(guardPolicy1.equals(guardPolicy2));
+ assertEquals(guardPolicy1.hashCode(), guardPolicy2.hashCode());
+
+ MatchParameters matchParameters = new MatchParameters();
+ guardPolicy1.setMatch_parameters(matchParameters);
+ assertFalse(guardPolicy1.equals(guardPolicy2));
+ guardPolicy2.setMatch_parameters(matchParameters);
+ assertTrue(guardPolicy1.equals(guardPolicy2));
+ assertEquals(guardPolicy1.hashCode(), guardPolicy2.hashCode());
+
+ LinkedList<Constraint> limitConstraints = new LinkedList<>();
+ limitConstraints.add(new Constraint());
+ guardPolicy1.setLimit_constraints(limitConstraints);
+ assertFalse(guardPolicy1.equals(guardPolicy2));
+ guardPolicy2.setLimit_constraints(limitConstraints);
+ assertTrue(guardPolicy1.equals(guardPolicy2));
+ assertEquals(guardPolicy1.hashCode(), guardPolicy2.hashCode());
+ }
+
+ @Test
+ public void testEqualsSameObject() {
+ GuardPolicy guardPolicy = new GuardPolicy();
+ assertTrue(guardPolicy.equals(guardPolicy));
+ }
+
+ @Test
+ public void testEqualsNull() {
+ GuardPolicy guardPolicy = new GuardPolicy();
+ assertFalse(guardPolicy.equals(null));
+ }
+
+ @Test
+ public void testEqualsInstanceOfDiffClass() {
+ GuardPolicy guardPolicy = new GuardPolicy();
+ assertFalse(guardPolicy.equals(""));
+ }
+}
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_control_loop_no_control_loop_name.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_control_loop_no_control_loop_name.yaml
new file mode 100644
index 000000000..768545307
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_control_loop_no_control_loop_name.yaml
@@ -0,0 +1,37 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ controlLoopName:
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_connected_to_unknown_policy.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_connected_to_unknown_policy.yaml
new file mode 100644
index 000000000..cc4d0996f
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_connected_to_unknown_policy.yaml
@@ -0,0 +1,37 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure: unknown-policy
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_exception_connected_to_unknown_policy.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_exception_connected_to_unknown_policy.yaml
new file mode 100644
index 000000000..c25cf707c
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_exception_connected_to_unknown_policy.yaml
@@ -0,0 +1,37 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_exception: unknown-policy
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_guard_connected_to_unknown_policy.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_guard_connected_to_unknown_policy.yaml
new file mode 100644
index 000000000..50ab0cf0a
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_guard_connected_to_unknown_policy.yaml
@@ -0,0 +1,37 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_guard: unknown-policy
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_retries_connected_to_unknown_policy.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_retries_connected_to_unknown_policy.yaml
new file mode 100644
index 000000000..eb8f08458
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_retries_connected_to_unknown_policy.yaml
@@ -0,0 +1,37 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_retries: unknown-policy
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_timeout_connected_to_unknown_policy.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_timeout_connected_to_unknown_policy.yaml
new file mode 100644
index 000000000..77c296363
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_timeout_connected_to_unknown_policy.yaml
@@ -0,0 +1,37 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_timeout: unknown-policy
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_success_connected_to_unknown_policy.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_success_connected_to_unknown_policy.yaml
new file mode 100644
index 000000000..ee2ee7f92
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_success_connected_to_unknown_policy.yaml
@@ -0,0 +1,37 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: unknown-policy
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_trigger_1.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_trigger_1.yaml
new file mode 100644
index 000000000..ad5736b86
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_trigger_1.yaml
@@ -0,0 +1,109 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: FOO
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target: VM
+ retry: 2
+ timeout: 300
+ success: unique-policy-id-2-healthcheck-restart
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-2-healthcheck-restart
+ name: HealthCheck Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-3-rebuild
+ name: Rebuild Policy
+ description:
+ actor: APPC
+ recipe: Rebuild
+ target: VM
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-4-healthcheck-rebuild
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-4-healthcheck-rebuild
+ name: HealthCheck the Rebuild Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-5-migrate
+ name: Migrate Policy
+ description:
+ actor: APPC
+ recipe: Migrate
+ target: VM
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-6-healthcheck-migrate
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-6-healthcheck-migrate
+ name: Healthcheck the Migrate Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_trigger_2.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_trigger_2.yaml
new file mode 100644
index 000000000..c04e0ba71
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_trigger_2.yaml
@@ -0,0 +1,109 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: FINAL_SUCCESS
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target: VM
+ retry: 2
+ timeout: 300
+ success: unique-policy-id-2-healthcheck-restart
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-2-healthcheck-restart
+ name: HealthCheck Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-3-rebuild
+ name: Rebuild Policy
+ description:
+ actor: APPC
+ recipe: Rebuild
+ target: VM
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-4-healthcheck-rebuild
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-4-healthcheck-rebuild
+ name: HealthCheck the Rebuild Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-5-migrate
+ name: Migrate Policy
+ description:
+ actor: APPC
+ recipe: Migrate
+ target: VM
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-6-healthcheck-migrate
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-6-healthcheck-migrate
+ name: Healthcheck the Migrate Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_trigger_no_trigger_id.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_trigger_no_trigger_id.yaml
new file mode 100644
index 000000000..e5ee3fe4a
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_trigger_no_trigger_id.yaml
@@ -0,0 +1,35 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy:
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target: VM
+ retry: 2
+ timeout: 300
+
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/empty.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/empty.yaml
new file mode 100644
index 000000000..5337f9cc7
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/empty.yaml
@@ -0,0 +1,14 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_OpenLoop.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_OpenLoop.yaml
new file mode 100644
index 000000000..20ae46e19
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_OpenLoop.yaml
@@ -0,0 +1,26 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ version: 1.0.0
+ controlLoopName: ControlLoop-Open-fac4ae3d-c3f5-4bab-8e54-0a8581ede132
+ services:
+ - serviceName: Service
+ resources:
+ - resourceType: VF
+ resourceName: Example
+ trigger_policy: final_openloop
+ timeout: 0
+
+policies:
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_Test.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_Test.yaml
new file mode 100644
index 000000000..73486b08b
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_Test.yaml
@@ -0,0 +1,109 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target: VM
+ retry: 2
+ timeout: 300
+ success: unique-policy-id-2-healthcheck-restart
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-2-healthcheck-restart
+ name: HealthCheck Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-3-rebuild
+ name: Rebuild Policy
+ description:
+ actor: APPC
+ recipe: Rebuild
+ target: VM
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-4-healthcheck-rebuild
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-4-healthcheck-rebuild
+ name: HealthCheck the Rebuild Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-5-migrate
+ name: Migrate Policy
+ description:
+ actor: APPC
+ recipe: Migrate
+ target: VM
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-6-healthcheck-migrate
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-6-healthcheck-migrate
+ name: Healthcheck the Migrate Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_vService.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_vService.yaml
new file mode 100644
index 000000000..009a49c19
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_vService.yaml
@@ -0,0 +1,75 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ version: 1.0.0
+ controlLoopName: ControlLoop-vUSP-vCTS-cbed919f-2212-4ef7-8051-fe6308da1bda
+ services:
+ - serviceName: vUSP
+ resources:
+ - resourceName: vCTS
+ resourceType: VF
+ - resourceName: vCOM
+ resourceType: VF
+ - resourceName: vRAR
+ resourceType: VF
+ - resourceName: vLCS
+ resourceType: VF
+ - resourceName: v3CB
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy
+ description:
+ actor: APPC
+ recipe: Restart
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: unique-policy-id-2-rebuild
+ failure_timeout: unique-policy-id-2-rebuild
+ failure_retries: unique-policy-id-2-rebuild
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-2-rebuild
+ name: Rebuild Policy
+ description:
+ actor: APPC
+ recipe: Rebuild
+ target: VM
+ retry: 0
+ timeout: 600
+ success: final_success
+ failure: unique-policy-id-3-migrate
+ failure_timeout: unique-policy-id-3-migrate
+ failure_retries: unique-policy-id-3-migrate
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-3-migrate
+ name: Migrate Policy
+ description:
+ actor: APPC
+ recipe: Migrate
+ target: VM
+ retry: 0
+ timeout: 600
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/test.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/test.yaml
new file mode 100644
index 000000000..440e7b309
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/test.yaml
@@ -0,0 +1,318 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: unique-policy-id-2-modifyconfig
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: unique-policy-id-7-modifyconfig-for-failure
+ failure_guard: unique-policy-id-7-modifyconfig-for-failure
+
+ - id: unique-policy-id-2-modifyconfig
+ name: ModifyConfig Policy
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: FINAL_FAILURE_EXCEPTION
+
+ - id: unique-policy-id-3-rebuild
+ name: Rebuild Policy
+ description:
+ actor: APPC
+ recipe: Rebuild
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-4-modifyconfig
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: FINAL_FAILURE_EXCEPTION
+
+ - id: unique-policy-id-4-modifyconfig
+ name: HealthCheck the Rebuild Policy
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: FINAL_FAILURE_EXCEPTION
+
+ - id: unique-policy-id-5-migrate
+ name: Migrate Policy
+ description:
+ actor: APPC
+ recipe: Migrate
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-6-modifyconfig
+ failure: FINAL_FAILURE
+ failure_timeout: FINAL_FAILURE_TIMEOUT
+ failure_retries: FINAL_FAILURE_RETRIES
+ failure_exception: FINAL_FAILURE_EXCEPTION
+
+ - id: unique-policy-id-6-modifyconfig
+ name: ModifyConfig after Migrate Policy
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+ failure: FINAL_FAILURE
+ failure_timeout: FINAL_FAILURE_TIMEOUT
+ failure_retries: FINAL_FAILURE_RETRIES
+ failure_exception: FINAL_FAILURE_EXCEPTION
+
+ - id: unique-policy-id-7-modifyconfig-for-failure
+ name: ModifyConfig for Failure
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+ failure: FINAL_FAILURE
+ failure_timeout: FINAL_FAILURE_TIMEOUT
+ failure_retries: FINAL_FAILURE_RETRIES
+ failure_exception: FINAL_FAILURE_EXCEPTION
+
+ - id:
+ name: invalid policy - id is null
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: SUCCESS
+ name: invalid policy - id is a PolicyResult
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: FINAL_SUCCESS
+ name: invalid policy - id is a FinalResult
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: invalid-policy-null-actor
+ name: invalid policy - actor is null
+ description:
+ actor:
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: invalid-policy-unknown-actor
+ name: invalid policy - actor is unknown
+ description:
+ actor: UnknownActor
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: invalid-policy-null-receipe
+ name: invalid policy - receipe is null
+ description:
+ actor: APPC
+ recipe:
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: invalid-policy-unknown-receipe
+ name: invalid policy - unknown receipe
+ description:
+ actor: APPC
+ recipe: UnknownReceipe
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: invalid-policy-null-target
+ name: invalid policy - target is null
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: invalid-policy-null-target-type
+ name: invalid policy - target type is null
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type:
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: invalid-policy-invalid-success-policy
+ name: invalid policy - success policy is invalid
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_FAILURE
+
+ - id: invalid-policy-invalid-failure-policy
+ name: invalid policy - failure policy is invalid
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure: FINAL_FAILURE_TIMEOUT
+
+ - id: invalid-policy-invalid-failure-timeout-policy
+ name: invalid policy - failure timeout policy is invalid
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_timeout: FINAL_FAILURE_RETRIES
+
+ - id: invalid-policy-invalid-failure-retries-policy
+ name: invalid policy - failure retries policy is invalid
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_retries: FINAL_FAILURE_EXCEPTION
+
+ - id: invalid-policy-invalid-failure-exception-policy
+ name: invalid policy - failure exception policy is invalid
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_exception: FINAL_FAILURE_GUARD
+
+ - id: invalid-policy-invalid-failure-guard-policy
+ name: invalid policy - failure guard policy is invalid
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_guard: FINAL_SUCCESS
+
+
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/test_evil.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/test_evil.yaml
new file mode 100644
index 000000000..d6127fe96
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/test_evil.yaml
@@ -0,0 +1,39 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: MSO
+ recipe: Instantiate
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_failure_exception
+ failure: final_success
+ failure_timeout: final_success
+ failure_retries: final_success
+ failure_exception: final_failure_exception
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/duplicate_guard_constraint.yaml b/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/duplicate_guard_constraint.yaml
new file mode 100644
index 000000000..b6f92e718
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/duplicate_guard_constraint.yaml
@@ -0,0 +1,35 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+guard:
+ version: 2.0.0
+
+guards:
+ - id: unique_guard_vUSP_1
+ name: APPC 5 Restart
+ description:
+ We only allow 5 restarts over 15 minute window during the day time hours (i.e. avoid midnight to 5am)
+ actor: APPC
+ recipe: Restart
+ limit_constraints:
+ #
+ - num: 5
+ time_in_range:
+ arg2: PT5H
+ arg3: PT24H
+ #
+ - num: 5
+ time_in_range:
+ arg2: PT5H
+ arg3: PT24H \ No newline at end of file
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/duplicate_guard_policy.yaml b/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/duplicate_guard_policy.yaml
new file mode 100644
index 000000000..a510340b1
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/duplicate_guard_policy.yaml
@@ -0,0 +1,41 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+guard:
+ version: 2.0.0
+
+guards:
+ - id: unique_guard_vUSP_1
+ name: APPC 5 Restart
+ description:
+ We only allow 5 restarts over 15 minute window during the day time hours (i.e. avoid midnight to 5am)
+ actor: APPC
+ recipe: Restart
+ limit_constraints:
+ - num: 5
+ time_in_range:
+ arg2: PT5H
+ arg3: PT24H
+ #
+ - id: unique_guard_vUSP_1
+ name: APPC 5 Restart
+ description:
+ We only allow 5 restarts over 15 minute window during the day time hours (i.e. avoid midnight to 5am)
+ actor: APPC
+ recipe: Restart
+ limit_constraints:
+ - num: 5
+ time_in_range:
+ arg2: PT5H
+ arg3: PT24H \ No newline at end of file
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/no_guard_constraint.yaml b/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/no_guard_constraint.yaml
new file mode 100644
index 000000000..6f986e14f
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/no_guard_constraint.yaml
@@ -0,0 +1,25 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+guard:
+ version: 2.0.0
+
+guards:
+ - id: unique_guard_vUSP_1
+ name: APPC 5 Restart
+ description:
+ We only allow 5 restarts over 15 minute window during the day time hours (i.e. avoid midnight to 5am)
+ actor: APPC
+ recipe: Restart
+ \ No newline at end of file
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/no_guard_policy.yaml b/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/no_guard_policy.yaml
new file mode 100644
index 000000000..a5afca265
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/no_guard_policy.yaml
@@ -0,0 +1,16 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+guard:
+ version: 2.0.0
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/policy_guard_ONAP_demo_vDNS.yaml b/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/policy_guard_ONAP_demo_vDNS.yaml
new file mode 100644
index 000000000..c71caab2d
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/policy_guard_ONAP_demo_vDNS.yaml
@@ -0,0 +1,33 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+guard:
+ version: 2.0.0
+
+guards:
+ - id: unique_guard_ONAP_vDNS_1
+ name: MSO Spinup
+ description: We only spin up 1 instance over a 10 minute window
+ match_parameters:
+ actor: MSO
+ recipe: VF Module Create
+ limit_constraints:
+ - freq_limit_per_target: 1
+ #
+ # https://www.w3.org/TR/xmlschema-2/#duration
+ #
+ time_window:
+ value: 10
+ units: hour
+ \ No newline at end of file
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/policy_guard_appc_restart.yaml b/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/policy_guard_appc_restart.yaml
new file mode 100644
index 000000000..df682d107
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/policy_guard_appc_restart.yaml
@@ -0,0 +1,38 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+guard:
+ version: 2.0.0
+
+guards:
+ - id: unique_guard_1
+ name: APPC 5 Restart
+ description:
+ We only allow 5 restarts over 15 minute window during the day time hours (i.e. avoid midnight to 5am)
+ match_parameters:
+ controlLoopName: CL_NAME_ABC_123
+ actor: APPC
+ recipe: Restart
+ targets:
+ - s1
+ s2
+ s3
+ limit_constraints:
+ - freq_limit_per_target: 5
+ time_window:
+ value: 15
+ units: minute
+ active_time_range:
+ start: 00:00:00-05:00
+ end: 23:59:59-05:00 \ No newline at end of file
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/policy_guard_blacklist.yaml b/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/policy_guard_blacklist.yaml
new file mode 100644
index 000000000..a835aefcf
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/policy_guard_blacklist.yaml
@@ -0,0 +1,31 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+guard:
+ version: 2.0.0
+
+guards:
+ - id: unique_guard_vService_blacklist
+ name: APPC Restart Blacklist
+ description: |
+ We deny restart of the blacklisted targets (avoid midnight to 5am)
+ actor: APPC
+ recipe: Restart
+ limit_constraints:
+ - blacklist:
+ - TargetName1
+ - TargetName2
+ time_in_range:
+ arg2: 00:00:00-05:00
+ arg3: 23:59:59-05:00 \ No newline at end of file
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-59a2ee3fB58045feB5a1-template.yml b/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-59a2ee3fB58045feB5a1-template.yml
new file mode 100644
index 000000000..4b501953c
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-59a2ee3fB58045feB5a1-template.yml
@@ -0,0 +1,1698 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+metadata:
+ invariantUUID: 4b8d4018-068b-4c33-b9bb-d980798e52c2
+ UUID: d7d28881-b24d-4512-bfee-1e2eb335591f
+ name: 59a2ee3f-b580-45fe-b5a1
+ description: vendor software product
+ type: VF
+ category: Generic
+ subcategory: Abstract
+ resourceVendor: 185c637a-3885-463e-8fd0
+ resourceVendorRelease: '1.0'
+imports:
+- NeutronNet:
+ file: resource-Neutronnet-template.yml
+- NeutronPort:
+ file: resource-Neutronport-template.yml
+- 59a2ee3fB58045feB5a1.nodes.heat.vlb:
+ file: resource-59a2ee3fb58045feb5a1NodesHeatVlb-template.yml
+- 59a2ee3fB58045feB5a1.nodes.heat.vdns:
+ file: resource-59a2ee3fb58045feb5a1NodesHeatVdns-template.yml
+topology_template:
+ inputs:
+ vf_module_id:
+ type: string
+ description: The vLoadBalancer Module ID is provided by ONAP
+ onap_private_subnet_id:
+ type: string
+ description: Private sub-network that connects ONAP component and the VNF
+ repo_url_blob:
+ type: string
+ description: URL of the repository that hosts the demo packages
+ vlb_private_net_cidr:
+ type: string
+ description: The CIDR of the vLoadBalancer private network
+ vlb_private_net_id:
+ type: string
+ description: Private network that connects vLoadBalancer with vDNSs
+ public_net_id:
+ type: string
+ default: 00000000-0000-0000-0000-000000000000
+ description: Public network that enables remote connection to VNF
+ demo_artifacts_version:
+ type: string
+ description: Artifacts (jar, tar.gz) version used in demo vnfs
+ onap_private_net_id:
+ type: string
+ description: Private network that connects ONAP component and the VNF
+ pub_key:
+ type: string
+ description: Public key to be installed on the compute instance
+ vlb_private_ip_1:
+ type: string
+ description: Private IP address that is assigned to the vLoadBalancer to communicate with ONAP components
+ key_name:
+ type: string
+ description: Public/Private key pair name
+ vdns_name_0:
+ type: string
+ description: Name of the vDNS
+ repo_url_artifacts:
+ type: string
+ description: URL of the repository that hosts the demo packages
+ vlb_name_0:
+ type: string
+ description: Name of the vLoadBalancer
+ vdns_private_ip_0:
+ type: string
+ description: Private IP address that is assigned to the vDNS to communicate with the vLoadBalancer
+ vnf_id:
+ type: string
+ description: The VNF ID is provided by ONAP
+ dcae_collector_ip:
+ type: string
+ description: IP address of the DCAE collector
+ vdns_private_ip_1:
+ type: string
+ description: Private IP address that is assigned to the vDNS to communicate with ONAP components
+ dcae_collector_port:
+ type: string
+ description: Port of the DCAE collector
+ vlb_image_name:
+ type: string
+ default: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
+ description: Image to be used for compute instance
+ vlb_flavor_name:
+ type: string
+ default: 4 GB General Purpose v1
+ description: Type of instance (flavor) to be used
+ vlb_private_ip_0:
+ type: string
+ description: Private IP address that is assigned to the vLoadBalancer to communicate with the vDNSs
+ onap_private_net_cidr:
+ type: string
+ description: The CIDR of the protected private network
+ node_templates:
+ vdns_private_1_port:
+ type: org.onap.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet:
+ get_input: onap_private_subnet_id
+ ip_address:
+ get_input: vdns_private_ip_1
+ network:
+ get_input: onap_private_net_id
+ requirements:
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vdns_0
+ relationship: tosca.relationships.network.BindsTo
+ vlb_private_network:
+ type: org.onap.resource.vl.nodes.heat.network.neutron.Net
+ metadata:
+ invariantUUID: 2870cc3a-d6cd-4423-b7f6-2d63619b0eeb
+ UUID: b7e764ba-17f9-4f0a-ad29-29877766ef21
+ version: '1.0'
+ name: NeutronNet
+ description: Represents a network service with optional subnets and advanced configurations.
+ type: VL
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ network_name:
+ get_input: vlb_private_net_id
+ subnets:
+ vlb_private_subnet:
+ name:
+ get_input: vlb_private_net_id
+ cidr:
+ get_input: vlb_private_net_cidr
+ vlb_private_1_port:
+ type: org.onap.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet:
+ get_input: onap_private_subnet_id
+ ip_address:
+ get_input: vlb_private_ip_1
+ network:
+ get_input: onap_private_net_id
+ requirements:
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vlb_0
+ relationship: tosca.relationships.network.BindsTo
+ vdns_0:
+ type: org.onap.resource.vfc.59a2ee3fB58045feB5a1.abstact.nodes.heat.vdns
+ metadata:
+ invariantUUID: ee585c30-127b-492e-b2c1-871dc61d1dde
+ UUID: d816cb01-b5d0-4bbb-b614-f7c3e230ab19
+ version: '1.0'
+ name: 59a2ee3fB58045feB5a1.nodes.heat.vdns
+ description: Not reusable inner VFC
+ type: VFC
+ category: Generic
+ subcategory: Abstract
+ properties:
+ key_name: UNSUPPORTED_RESOURCE_my_keypair
+ flavor:
+ get_input: vlb_flavor_name
+ image:
+ get_input: vlb_image_name
+ metadata:
+ vf_module_id:
+ get_input: vf_module_id
+ vnf_id:
+ get_input: vnf_id
+ user_data_format: RAW
+ name:
+ get_input: vdns_name_0
+ vlb_private_0_port:
+ type: org.onap.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet: vlb_private_network
+ ip_address:
+ get_input: vlb_private_ip_0
+ network: vlb_private_network
+ requirements:
+ - link:
+ capability: tosca.capabilities.network.Linkable
+ node: vlb_private_network
+ relationship: tosca.relationships.network.LinksTo
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vlb_0
+ relationship: tosca.relationships.network.BindsTo
+ vdns_private_0_port:
+ type: org.onap.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet:
+ get_input: vlb_private_net_id
+ ip_address:
+ get_input: vdns_private_ip_0
+ network:
+ get_input: vlb_private_net_id
+ requirements:
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vdns_0
+ relationship: tosca.relationships.network.BindsTo
+ vlb_0:
+ type: org.onap.resource.vfc.59a2ee3fB58045feB5a1.abstact.nodes.heat.vlb
+ metadata:
+ invariantUUID: f7f1d745-cfb1-4aa9-83fc-31280d0ce513
+ UUID: 1821f13e-411f-4b29-87a5-ae935897b2e1
+ version: '1.0'
+ name: 59a2ee3fB58045feB5a1.nodes.heat.vlb
+ description: Not reusable inner VFC
+ type: VFC
+ category: Generic
+ subcategory: Abstract
+ properties:
+ key_name: UNSUPPORTED_RESOURCE_my_keypair
+ flavor:
+ get_input: vlb_flavor_name
+ image:
+ get_input: vlb_image_name
+ metadata:
+ vf_module_id:
+ get_input: vf_module_id
+ vnf_id:
+ get_input: vnf_id
+ user_data_format: RAW
+ name:
+ get_input: vlb_name_0
+ groups:
+ base_vlb:
+ type: org.onap.groups.heat.HeatStack
+ members:
+ - vdns_private_1_port
+ - vlb_private_network
+ - vlb_private_1_port
+ - vdns_0
+ - vlb_private_0_port
+ - vdns_private_0_port
+ - vlb_0
+ metadata:
+ invariantUUID: 097f71b3-90a1-4064-bc83-f76bf30195fe
+ UUID: 4daf7600-0a06-4515-859a-c45ec11abd29
+ version: '1'
+ name: base_vlb
+ 59a2ee3fB58045feB5a1..dnsscaling..module-1:
+ type: org.onap.groups.VfModule
+ members:
+ - vdns_private_1_port
+ - vdns_0
+ - vdns_private_0_port
+ metadata:
+ vfModuleModelName: 59a2ee3fB58045feB5a1..dnsscaling..module-1
+ vfModuleModelInvariantUUID: 395d61a9-309b-4c0f-a442-ca47903e231e
+ vfModuleModelUUID: 40846490-abf4-4e1d-8f1a-2286968fa231
+ vfModuleModelVersion: '1'
+ properties:
+ vf_module_type: Expansion
+ vf_module_description:
+ volume_group: false
+ 59a2ee3fB58045feB5a1..base_vlb..module-0:
+ type: org.onap.groups.VfModule
+ members:
+ - vdns_private_1_port
+ - vlb_private_network
+ - vlb_private_1_port
+ - vdns_0
+ - vlb_private_0_port
+ - vdns_private_0_port
+ - vlb_0
+ metadata:
+ vfModuleModelName: 59a2ee3fB58045feB5a1..base_vlb..module-0
+ vfModuleModelInvariantUUID: 5ae76f74-6324-4835-a86c-0c96d16afd38
+ vfModuleModelUUID: 17c4f752-a3da-4f3d-9cc5-1c4d28e5442d
+ vfModuleModelVersion: '1'
+ properties:
+ vf_module_type: Base
+ vf_module_description:
+ volume_group: false
+ dnsscaling:
+ type: org.onap.groups.heat.HeatStack
+ members:
+ - vdns_private_1_port
+ - vdns_0
+ - vdns_private_0_port
+ metadata:
+ invariantUUID: 7c2971fa-9369-4fed-a449-a5e21c022f97
+ UUID: ae8c3b79-77d3-425a-8bab-6558007f8392
+ version: '1'
+ name: dnsscaling
+ substitution_mappings:
+ node_type: org.onap.resource.vf.59a2ee3fB58045feB5a1
+ capabilities:
+ vdns_0.memory:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM allocated to the instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.memory.resident:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance on the physical machine
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.resident
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.cpu:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: CPU time used
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Cumulative
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vdns_private_0_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vdns_0.host:
+ type: tosca.capabilities.Container
+ occurrences:
+ - 1
+ - UNBOUNDED
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ properties:
+ num_cpus:
+ type: integer
+ required: false
+ disk_size:
+ type: scalar-unit.size
+ required: false
+ cpu_frequency:
+ type: scalar-unit.frequency
+ required: false
+ mem_size:
+ type: scalar-unit.size
+ required: false
+ vdns_0.endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ port_name:
+ type: string
+ required: false
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ secure:
+ type: boolean
+ default: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ url_path:
+ type: string
+ required: false
+ vlb_private_1_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vlb_0.memory:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM allocated to the instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_private_1_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vlb_0.scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ max_instances:
+ type: integer
+ default: 1
+ min_instances:
+ type: integer
+ default: 1
+ default_instances:
+ type: integer
+ vlb_0.binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ vlb_0.vcpus:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Average disk latency
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ms
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: vcpus
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_0.instance:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Existence of instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ distribution:
+ type: string
+ required: false
+ type:
+ type: string
+ required: false
+ version:
+ type: version
+ required: false
+ architecture:
+ type: string
+ required: false
+ vlb_private_0_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vlb_private_1_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vlb_0.cpu:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: CPU time used
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Cumulative
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.cpu.delta:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: CPU time used since previous datapoint
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Delta
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu.delta
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_0.memory.resident:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance on the physical machine
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.resident
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.vcpus:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Average disk latency
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ms
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: vcpus
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.memory.usage:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.usage
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_0.cpu.delta:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: CPU time used since previous datapoint
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Delta
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu.delta
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.instance:type:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Existence of instance <type> (OpenStack types)
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance:type
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_0.os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ distribution:
+ type: string
+ required: false
+ type:
+ type: string
+ required: false
+ version:
+ type: version
+ required: false
+ architecture:
+ type: string
+ required: false
+ vlb_private_0_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vlb_0.host:
+ type: tosca.capabilities.Container
+ occurrences:
+ - 1
+ - UNBOUNDED
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ properties:
+ num_cpus:
+ type: integer
+ required: false
+ disk_size:
+ type: scalar-unit.size
+ required: false
+ cpu_frequency:
+ type: scalar-unit.frequency
+ required: false
+ mem_size:
+ type: scalar-unit.size
+ required: false
+ vlb_0.instance:type:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Existence of instance <type> (OpenStack types)
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance:type
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_private_network.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vdns_0.binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ vlb_private_network.link:
+ type: tosca.capabilities.network.Linkable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ vlb_0.cpu_util:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Average CPU utilization
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: '%'
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu_util
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_0.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vdns_private_0_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vdns_0.cpu_util:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Average CPU utilization
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: '%'
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu_util
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.instance:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Existence of instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_private_network.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vdns_0.scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ max_instances:
+ type: integer
+ default: 1
+ min_instances:
+ type: integer
+ default: 1
+ default_instances:
+ type: integer
+ vdns_private_1_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vlb_0.memory.usage:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.usage
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_0.endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ port_name:
+ type: string
+ required: false
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ secure:
+ type: boolean
+ default: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ url_path:
+ type: string
+ required: false
+ requirements:
+ vdns_0.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vlb_private_1_port.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
+ vlb_private_0_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vdns_private_0_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vlb_0.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vdns_private_0_port.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
+ vdns_0.local_storage:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ vlb_private_1_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vlb_private_network.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vlb_0.local_storage:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ vdns_private_1_port.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
+ vdns_private_1_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-Eace933104d443b496b8-template.yml b/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-Eace933104d443b496b8-template.yml
new file mode 100644
index 000000000..c0f4f4d39
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-Eace933104d443b496b8-template.yml
@@ -0,0 +1,2525 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+metadata:
+ invariantUUID: 06fe411e-d006-4ac3-8b0e-fb4f13cd78d3
+ UUID: 172ce7c5-c2e4-4f8d-b66c-edb49e8e548a
+ name: eace9331-04d4-43b4-96b8
+ description: vendor software product
+ type: VF
+ category: Generic
+ subcategory: Abstract
+ resourceVendor: 31125954-23a0-4d41-95e5
+ resourceVendorRelease: '1.0'
+imports:
+- NeutronPort:
+ file: resource-Neutronport-template.yml
+- Eace933104d443b496b8.nodes.heat.vfw:
+ file: resource-Eace933104d443b496b8NodesHeatVfw-template.yml
+- Eace933104d443b496b8.nodes.heat.vpg:
+ file: resource-Eace933104d443b496b8NodesHeatVpg-template.yml
+- NeutronNet:
+ file: resource-Neutronnet-template.yml
+- Eace933104d443b496b8.nodes.heat.vsn:
+ file: resource-Eace933104d443b496b8NodesHeatVsn-template.yml
+topology_template:
+ inputs:
+ vf_module_id:
+ type: string
+ description: The vFirewall Module ID is provided by onap
+ repo_url_blob:
+ type: string
+ description: URL of the repository that hosts the demo packages
+ public_net_id:
+ type: string
+ default: 00000000-0000-0000-0000-000000000000
+ description: Public network that enables remote connection to VNF
+ vfw_private_ip_1:
+ type: string
+ description: Private IP address that is assigned to the vFirewall to communicate with the vSink
+ vfw_private_ip_0:
+ type: string
+ description: Private IP address that is assigned to the vFirewall to communicate with the vPacketGenerator
+ vfw_private_ip_2:
+ type: string
+ description: Private IP address that is assigned to the vFirewall to communicate with ONAP components
+ vfw_name_0:
+ type: string
+ description: Name of the vFirewall
+ vnf_id:
+ type: string
+ description: The VNF ID is provided by onap
+ dcae_collector_ip:
+ type: string
+ description: IP address of the DCAE collector
+ dcae_collector_port:
+ type: string
+ description: Port of the DCAE collector
+ vpg_private_ip_1:
+ type: string
+ description: Private IP address that is assigned to the vPacketGenerator to communicate with ONAP components
+ vsn_private_ip_0:
+ type: string
+ description: Private IP address that is assigned to the vSink to communicate with the vFirewall
+ vpg_name_0:
+ type: string
+ description: Name of the vPacketGenerator
+ vpg_private_ip_0:
+ type: string
+ description: Private IP address that is assigned to the vPacketGenerator to communicate with the vFirewall
+ vsn_private_ip_1:
+ type: string
+ description: Private IP address that is assigned to the vSink to communicate with ONAP components
+ protected_private_net_cidr:
+ type: string
+ description: The CIDR of the protected private network
+ onap_private_net_cidr:
+ type: string
+ description: The CIDR of the protected private network
+ unprotected_private_net_cidr:
+ type: string
+ description: The CIDR of the unprotected private network
+ onap_private_subnet_id:
+ type: string
+ description: Private sub-network that connects ONAP component and the VNF
+ vsn_name_0:
+ type: string
+ description: Name of the vSink
+ unprotected_private_net_id:
+ type: string
+ description: Private network that connects vPacketGenerator with vFirewall
+ vfw_flavor_name:
+ type: string
+ default: 4 GB General Purpose v1
+ description: Type of instance (flavor) to be used
+ demo_artifacts_version:
+ type: string
+ description: Artifacts (jar, tar.gz) version used in demo vnfs
+ onap_private_net_id:
+ type: string
+ description: Private network that connects ONAP component and the VNF
+ pub_key:
+ type: string
+ description: Public key to be installed on the compute instance
+ key_name:
+ type: string
+ description: Public/Private key pair name
+ repo_url_artifacts:
+ type: string
+ description: URL of the repository that hosts the demo packages
+ vfw_image_name:
+ type: string
+ default: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
+ description: Image to be used for compute instance
+ protected_private_net_id:
+ type: string
+ description: Private network that connects vFirewall with vSink
+ node_templates:
+ vfw_private_0_port:
+ type: org.onap.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet: unprotected_private_network
+ ip_address:
+ get_input: vfw_private_ip_0
+ network: unprotected_private_network
+ requirements:
+ - link:
+ capability: tosca.capabilities.network.Linkable
+ node: unprotected_private_network
+ relationship: tosca.relationships.network.LinksTo
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vfw_0
+ relationship: tosca.relationships.network.BindsTo
+ vsn_private_1_port:
+ type: org.onap.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet:
+ get_input: onap_private_subnet_id
+ ip_address:
+ get_input: vsn_private_ip_1
+ network:
+ get_input: onap_private_net_id
+ requirements:
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vsn_0
+ relationship: tosca.relationships.network.BindsTo
+ unprotected_private_network:
+ type: org.onap.resource.vl.nodes.heat.network.neutron.Net
+ metadata:
+ invariantUUID: 2870cc3a-d6cd-4423-b7f6-2d63619b0eeb
+ UUID: b7e764ba-17f9-4f0a-ad29-29877766ef21
+ version: '1.0'
+ name: NeutronNet
+ description: Represents a network service with optional subnets and advanced configurations.
+ type: VL
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ network_name:
+ get_input: unprotected_private_net_id
+ subnets:
+ unprotected_private_subnet:
+ cidr:
+ get_input: unprotected_private_net_cidr
+ vpg_private_1_port:
+ type: org.onap.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet:
+ get_input: onap_private_subnet_id
+ ip_address:
+ get_input: vpg_private_ip_1
+ network:
+ get_input: onap_private_net_id
+ requirements:
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vpg_0
+ relationship: tosca.relationships.network.BindsTo
+ vfw_0:
+ type: org.onap.resource.vfc.Eace933104d443b496b8.abstact.nodes.heat.vfw
+ metadata:
+ invariantUUID: 0129e34c-d9fa-442d-bb2c-f925d018000a
+ UUID: 7fa1f6c7-c6bd-4444-8db2-63334a5aed1b
+ version: '1.0'
+ name: Eace933104d443b496b8.nodes.heat.vfw
+ description: Not reusable inner VFC
+ type: VFC
+ category: Generic
+ subcategory: Abstract
+ properties:
+ key_name: UNSUPPORTED_RESOURCE_my_keypair
+ flavor:
+ get_input: vfw_flavor_name
+ image:
+ get_input: vfw_image_name
+ metadata:
+ vf_module_id:
+ get_input: vf_module_id
+ vnf_id:
+ get_input: vnf_id
+ user_data_format: RAW
+ name:
+ get_input: vfw_name_0
+ vsn_0:
+ type: org.onap.resource.vfc.Eace933104d443b496b8.abstact.nodes.heat.vsn
+ metadata:
+ invariantUUID: b19f6643-3db0-4d73-b280-94d6f21caa71
+ UUID: 6dca6eb9-330c-4090-a542-7aca5f446e21
+ version: '1.0'
+ name: Eace933104d443b496b8.nodes.heat.vsn
+ description: Not reusable inner VFC
+ type: VFC
+ category: Generic
+ subcategory: Abstract
+ properties:
+ key_name: UNSUPPORTED_RESOURCE_my_keypair
+ flavor:
+ get_input: vfw_flavor_name
+ image:
+ get_input: vfw_image_name
+ metadata:
+ vf_module_id:
+ get_input: vf_module_id
+ vnf_id:
+ get_input: vnf_id
+ user_data_format: RAW
+ name:
+ get_input: vsn_name_0
+ vpg_private_0_port:
+ type: org.onap.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet: unprotected_private_network
+ ip_address:
+ get_input: vpg_private_ip_0
+ network: unprotected_private_network
+ requirements:
+ - link:
+ capability: tosca.capabilities.network.Linkable
+ node: unprotected_private_network
+ relationship: tosca.relationships.network.LinksTo
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vpg_0
+ relationship: tosca.relationships.network.BindsTo
+ vsn_private_0_port:
+ type: org.onap.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet: protected_private_network
+ ip_address:
+ get_input: vsn_private_ip_0
+ network: protected_private_network
+ requirements:
+ - link:
+ capability: tosca.capabilities.network.Linkable
+ node: protected_private_network
+ relationship: tosca.relationships.network.LinksTo
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vsn_0
+ relationship: tosca.relationships.network.BindsTo
+ vfw_private_1_port:
+ type: org.onap.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet: protected_private_network
+ ip_address:
+ get_input: vfw_private_ip_1
+ network: protected_private_network
+ requirements:
+ - link:
+ capability: tosca.capabilities.network.Linkable
+ node: protected_private_network
+ relationship: tosca.relationships.network.LinksTo
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vfw_0
+ relationship: tosca.relationships.network.BindsTo
+ vfw_private_2_port:
+ type: org.onap.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet:
+ get_input: onap_private_subnet_id
+ ip_address:
+ get_input: vfw_private_ip_2
+ network:
+ get_input: onap_private_net_id
+ requirements:
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vfw_0
+ relationship: tosca.relationships.network.BindsTo
+ vpg_0:
+ type: org.onap.resource.vfc.Eace933104d443b496b8.abstact.nodes.heat.vpg
+ metadata:
+ invariantUUID: 7654ae14-4e98-45bc-a8c0-2c43e1805bb4
+ UUID: 5267d6dd-f676-4f98-abec-6387ce6beaf2
+ version: '1.0'
+ name: Eace933104d443b496b8.nodes.heat.vpg
+ description: Not reusable inner VFC
+ type: VFC
+ category: Generic
+ subcategory: Abstract
+ properties:
+ key_name: UNSUPPORTED_RESOURCE_my_keypair
+ flavor:
+ get_input: vfw_flavor_name
+ image:
+ get_input: vfw_image_name
+ metadata:
+ vf_module_id:
+ get_input: vf_module_id
+ vnf_id:
+ get_input: vnf_id
+ user_data_format: RAW
+ name:
+ get_input: vpg_name_0
+ protected_private_network:
+ type: org.onap.resource.vl.nodes.heat.network.neutron.Net
+ metadata:
+ invariantUUID: 2870cc3a-d6cd-4423-b7f6-2d63619b0eeb
+ UUID: b7e764ba-17f9-4f0a-ad29-29877766ef21
+ version: '1.0'
+ name: NeutronNet
+ description: Represents a network service with optional subnets and advanced configurations.
+ type: VL
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ network_name:
+ get_input: protected_private_net_id
+ subnets:
+ protected_private_subnet:
+ cidr:
+ get_input: protected_private_net_cidr
+ groups:
+ base_vfw:
+ type: org.onap.groups.heat.HeatStack
+ members:
+ - vfw_private_0_port
+ - vsn_private_1_port
+ - unprotected_private_network
+ - vpg_private_1_port
+ - vfw_0
+ - vsn_0
+ - vpg_private_0_port
+ - vsn_private_0_port
+ - vfw_private_1_port
+ - vfw_private_2_port
+ - vpg_0
+ - protected_private_network
+ metadata:
+ invariantUUID: 44b0c172-7b61-49b5-a68a-810042087e1f
+ UUID: 24cb02f0-1d72-441f-a327-22d80180deaa
+ version: '1'
+ name: base_vfw
+ Eace933104d443b496b8..base_vfw..module-0:
+ type: org.onap.groups.VfModule
+ members:
+ - vfw_private_0_port
+ - vsn_private_1_port
+ - unprotected_private_network
+ - vpg_private_1_port
+ - vfw_0
+ - vsn_0
+ - vpg_private_0_port
+ - vsn_private_0_port
+ - vfw_private_1_port
+ - vfw_private_2_port
+ - vpg_0
+ - protected_private_network
+ metadata:
+ vfModuleModelName: Eace933104d443b496b8..base_vfw..module-0
+ vfModuleModelInvariantUUID: 58c105fd-9c12-4fb7-8a3e-a5ec280183fb
+ vfModuleModelUUID: ab251d24-4001-4926-aa5c-c01736b36c68
+ vfModuleModelVersion: '1'
+ properties:
+ vf_module_type: Base
+ vf_module_description:
+ volume_group: false
+ substitution_mappings:
+ node_type: org.onap.resource.vf.Eace933104d443b496b8
+ capabilities:
+ vfw_0.instance:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Existence of instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vfw_0.scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ max_instances:
+ type: integer
+ default: 1
+ min_instances:
+ type: integer
+ default: 1
+ default_instances:
+ type: integer
+ vfw_0.instance:type:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Existence of instance <type> (OpenStack types)
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance:type
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ protected_private_network.link:
+ type: tosca.capabilities.network.Linkable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ vsn_0.cpu:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: CPU time used
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Cumulative
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.instance:type:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Existence of instance <type> (OpenStack types)
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance:type
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ unprotected_private_network.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_0.memory:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM allocated to the instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.cpu_util:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Average CPU utilization
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: '%'
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu_util
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ port_name:
+ type: string
+ required: false
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ secure:
+ type: boolean
+ default: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ url_path:
+ type: string
+ required: false
+ vpg_private_0_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_private_1_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_private_0_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vpg_0.cpu:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: CPU time used
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Cumulative
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_private_1_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vsn_0.vcpus:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Average disk latency
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ms
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: vcpus
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.cpu.delta:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: CPU time used since previous datapoint
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Delta
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu.delta
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vsn_private_1_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vsn_0.cpu_util:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Average CPU utilization
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: '%'
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu_util
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.instance:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Existence of instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vpg_0.scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ max_instances:
+ type: integer
+ default: 1
+ min_instances:
+ type: integer
+ default: 1
+ default_instances:
+ type: integer
+ vpg_0.memory:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM allocated to the instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vfw_private_2_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vsn_0.os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ distribution:
+ type: string
+ required: false
+ type:
+ type: string
+ required: false
+ version:
+ type: version
+ required: false
+ architecture:
+ type: string
+ required: false
+ vfw_0.memory.resident:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance on the physical machine
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.resident
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vsn_0.scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ max_instances:
+ type: integer
+ default: 1
+ min_instances:
+ type: integer
+ default: 1
+ default_instances:
+ type: integer
+ vsn_0.instance:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Existence of instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vfw_0.endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ port_name:
+ type: string
+ required: false
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ secure:
+ type: boolean
+ default: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ url_path:
+ type: string
+ required: false
+ vsn_0.cpu.delta:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: CPU time used since previous datapoint
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Delta
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu.delta
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vfw_0.os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ distribution:
+ type: string
+ required: false
+ type:
+ type: string
+ required: false
+ version:
+ type: version
+ required: false
+ architecture:
+ type: string
+ required: false
+ vsn_private_1_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vsn_private_0_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_0.memory.usage:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.usage
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vsn_0.host:
+ type: tosca.capabilities.Container
+ occurrences:
+ - 1
+ - UNBOUNDED
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ properties:
+ num_cpus:
+ type: integer
+ required: false
+ disk_size:
+ type: scalar-unit.size
+ required: false
+ cpu_frequency:
+ type: scalar-unit.frequency
+ required: false
+ mem_size:
+ type: scalar-unit.size
+ required: false
+ vsn_0.memory:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM allocated to the instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ unprotected_private_network.link:
+ type: tosca.capabilities.network.Linkable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ vfw_0.host:
+ type: tosca.capabilities.Container
+ occurrences:
+ - 1
+ - UNBOUNDED
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ properties:
+ num_cpus:
+ type: integer
+ required: false
+ disk_size:
+ type: scalar-unit.size
+ required: false
+ cpu_frequency:
+ type: scalar-unit.frequency
+ required: false
+ mem_size:
+ type: scalar-unit.size
+ required: false
+ vsn_private_0_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_private_2_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ unprotected_private_network.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vpg_0.vcpus:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Average disk latency
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ms
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: vcpus
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ vpg_0.host:
+ type: tosca.capabilities.Container
+ occurrences:
+ - 1
+ - UNBOUNDED
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ properties:
+ num_cpus:
+ type: integer
+ required: false
+ disk_size:
+ type: scalar-unit.size
+ required: false
+ cpu_frequency:
+ type: scalar-unit.frequency
+ required: false
+ mem_size:
+ type: scalar-unit.size
+ required: false
+ vsn_0.binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ protected_private_network.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_0.binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ vpg_0.memory.usage:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.usage
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vfw_private_0_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vsn_0.endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ port_name:
+ type: string
+ required: false
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ secure:
+ type: boolean
+ default: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ url_path:
+ type: string
+ required: false
+ vfw_0.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ protected_private_network.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_0.cpu:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: CPU time used
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Cumulative
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vsn_0.instance:type:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Existence of instance <type> (OpenStack types)
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance:type
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ distribution:
+ type: string
+ required: false
+ type:
+ type: string
+ required: false
+ version:
+ type: version
+ required: false
+ architecture:
+ type: string
+ required: false
+ vsn_0.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_0.vcpus:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Average disk latency
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ms
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: vcpus
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vfw_0.cpu.delta:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: CPU time used since previous datapoint
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Delta
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu.delta
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vsn_0.memory.resident:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance on the physical machine
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.resident
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vsn_0.memory.usage:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.usage
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vfw_private_1_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_0.cpu_util:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Average CPU utilization
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: '%'
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu_util
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.memory.resident:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance on the physical machine
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.resident
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_private_0_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vpg_private_1_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ requirements:
+ vsn_private_1_port.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
+ vfw_0.local_storage:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ vfw_private_1_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vpg_private_1_port.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
+ vsn_0.local_storage:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ protected_private_network.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vfw_private_2_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vfw_private_2_port.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
+ unprotected_private_network.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vsn_private_0_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vpg_0.local_storage:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ vsn_private_1_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vfw_0.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vpg_0.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vpg_private_1_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vsn_0.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vpg_private_0_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vfw_private_0_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-57e66ea70ed645c7970f-template.yml b/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-57e66ea70ed645c7970f-template.yml
new file mode 100644
index 000000000..4bfd629e9
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-57e66ea70ed645c7970f-template.yml
@@ -0,0 +1,677 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+metadata:
+ invariantUUID: 5cfe6f4a-41bc-4247-8674-ebd4b98e35cc
+ UUID: 0f40bba5-986e-4b3c-803f-ddd1b7b25f24
+ name: 57e66ea7-0ed6-45c7-970f
+ description: catalog service description
+ type: Service
+ category: Network L1-3
+ serviceOnapNaming: false
+ serviceHoming: false
+imports:
+- eace9331-04d4-43b4-96b8:
+ file: resource-Eace933104d443b496b8-template.yml
+topology_template:
+ node_templates:
+ eace9331-04d4-43b4-96b8 1:
+ type: org.onap.resource.vf.Eace933104d443b496b8
+ metadata:
+ invariantUUID: 06fe411e-d006-4ac3-8b0e-fb4f13cd78d3
+ UUID: 172ce7c5-c2e4-4f8d-b66c-edb49e8e548a
+ version: '1.0'
+ name: eace9331-04d4-43b4-96b8
+ description: vendor software product
+ type: VF
+ category: Generic
+ subcategory: Abstract
+ substitution_mappings:
+ node_type: org.onap.service.57e66ea70ed645c7970f
+ capabilities:
+ eace9331-04d4-43b4-96b8 1.memory.resident:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance on the physical machine
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.resident
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ distribution:
+ type: string
+ required: false
+ type:
+ type: string
+ required: false
+ version:
+ type: version
+ required: false
+ architecture:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ eace9331-04d4-43b4-96b8 1.host:
+ type: tosca.capabilities.Container
+ occurrences:
+ - 1
+ - UNBOUNDED
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ properties:
+ num_cpus:
+ type: integer
+ required: false
+ disk_size:
+ type: scalar-unit.size
+ required: false
+ cpu_frequency:
+ type: scalar-unit.frequency
+ required: false
+ mem_size:
+ type: scalar-unit.size
+ required: false
+ eace9331-04d4-43b4-96b8 1.instance:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Existence of instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ max_instances:
+ type: integer
+ default: 1
+ min_instances:
+ type: integer
+ default: 1
+ default_instances:
+ type: integer
+ eace9331-04d4-43b4-96b8 1.memory:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM allocated to the instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ eace9331-04d4-43b4-96b8 1.vcpus:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Average disk latency
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ms
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: vcpus
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.cpu_util:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Average CPU utilization
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: '%'
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu_util
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.cpu.delta:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: CPU time used since previous datapoint
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Delta
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu.delta
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ eace9331-04d4-43b4-96b8 1.cpu:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: CPU time used
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Cumulative
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.instance:type:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Existence of instance <type> (OpenStack types)
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance:type
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.link:
+ type: tosca.capabilities.network.Linkable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ eace9331-04d4-43b4-96b8 1.memory.usage:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.usage
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ port_name:
+ type: string
+ required: false
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ secure:
+ type: boolean
+ default: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ url_path:
+ type: string
+ required: false
+ requirements:
+ eace9331-04d4-43b4-96b8 1.local_storage:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ eace9331-04d4-43b4-96b8 1.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ eace9331-04d4-43b4-96b8 1.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-D473899264974dca9db9-template.yml b/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-D473899264974dca9db9-template.yml
new file mode 100644
index 000000000..2293b3aca
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-D473899264974dca9db9-template.yml
@@ -0,0 +1,677 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+metadata:
+ invariantUUID: dc112d6e-7e73-4777-9c6f-1a7fb5fd1b6f
+ UUID: 2eea06c6-e1d3-4c3a-b9c4-478c506eeedf
+ name: d4738992-6497-4dca-9db9
+ description: catalog service description
+ type: Service
+ category: Network L1-3
+ serviceOnapNaming: false
+ serviceHoming: false
+imports:
+- 59a2ee3f-b580-45fe-b5a1:
+ file: resource-59a2ee3fB58045feB5a1-template.yml
+topology_template:
+ node_templates:
+ 59a2ee3f-b580-45fe-b5a1 1:
+ type: org.onap.resource.vf.59a2ee3fB58045feB5a1
+ metadata:
+ invariantUUID: 4b8d4018-068b-4c33-b9bb-d980798e52c2
+ UUID: d7d28881-b24d-4512-bfee-1e2eb335591f
+ version: '1.0'
+ name: 59a2ee3f-b580-45fe-b5a1
+ description: vendor software product
+ type: VF
+ category: Generic
+ subcategory: Abstract
+ substitution_mappings:
+ node_type: org.onap.service.D473899264974dca9db9
+ capabilities:
+ 59a2ee3f-b580-45fe-b5a1 1.memory.resident:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance on the physical machine
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.resident
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ port_name:
+ type: string
+ required: false
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ secure:
+ type: boolean
+ default: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ 59a2ee3f-b580-45fe-b5a1 1.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ 59a2ee3f-b580-45fe-b5a1 1.binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ 59a2ee3f-b580-45fe-b5a1 1.vcpus:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Average disk latency
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ms
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: vcpus
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.host:
+ type: tosca.capabilities.Container
+ occurrences:
+ - 1
+ - UNBOUNDED
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ properties:
+ num_cpus:
+ type: integer
+ required: false
+ disk_size:
+ type: scalar-unit.size
+ required: false
+ cpu_frequency:
+ type: scalar-unit.frequency
+ required: false
+ mem_size:
+ type: scalar-unit.size
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.memory.usage:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.usage
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.instance:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Existence of instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ max_instances:
+ type: integer
+ default: 1
+ min_instances:
+ type: integer
+ default: 1
+ default_instances:
+ type: integer
+ 59a2ee3f-b580-45fe-b5a1 1.cpu_util:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Average CPU utilization
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: '%'
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu_util
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.instance:type:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Existence of instance <type> (OpenStack types)
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance:type
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.cpu.delta:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: CPU time used since previous datapoint
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Delta
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu.delta
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.memory:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: Volume of RAM allocated to the instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.link:
+ type: tosca.capabilities.network.Linkable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ 59a2ee3f-b580-45fe-b5a1 1.cpu:
+ type: org.onap.capabilities.metric.Ceilometer
+ description: CPU time used
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Cumulative
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ distribution:
+ type: string
+ required: false
+ type:
+ type: string
+ required: false
+ version:
+ type: version
+ required: false
+ architecture:
+ type: string
+ required: false
+ requirements:
+ 59a2ee3f-b580-45fe-b5a1 1.local_storage:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ 59a2ee3f-b580-45fe-b5a1 1.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ 59a2ee3f-b580-45fe-b5a1 1.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0/pgstreams.json b/models-interactions/model-yaml/src/test/resources/v2.0.0/pgstreams.json
new file mode 100644
index 000000000..4d118afa1
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0/pgstreams.json
@@ -0,0 +1,26 @@
+{
+ "pg-streams": {
+ "pg-stream": [
+ {
+ "id": "fw_udp1",
+ "is-enabled": "true"
+ },
+ {
+ "id": "fw_udp2",
+ "is-enabled": "true"
+ },
+ {
+ "id": "fw_udp3",
+ "is-enabled": "true"
+ },
+ {
+ "id": "fw_udp4",
+ "is-enabled": "true"
+ },
+ {
+ "id": "fw_udp5",
+ "is-enabled": "true"
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_VOLTE.yaml b/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_VOLTE.yaml
new file mode 100644
index 000000000..f001e9f2a
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_VOLTE.yaml
@@ -0,0 +1,37 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ version: 2.0.0
+ controlLoopName: ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b
+
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 3600
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart the VM
+ description:
+ actor: VFC
+ 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
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_vCPE.yaml b/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_vCPE.yaml
new file mode 100644
index 000000000..e1c9b071e
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_vCPE.yaml
@@ -0,0 +1,37 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ version: 2.0.0
+ controlLoopName: ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 3600
+
+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
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_vPCI.yaml b/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_vPCI.yaml
new file mode 100644
index 000000000..b5c028b7e
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_vPCI.yaml
@@ -0,0 +1,40 @@
+# Copyright 2018 Wipro Limited Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ version: 3.0.0
+ controlLoopName: ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459
+ trigger_policy: unique-policy-id-123-modifyconfig
+ timeout: 1200
+ abatement: false
+
+policies:
+ - id: unique-policy-id-123-modifyconfig
+ name: modify PCI config
+ description:
+ actor: SDNR
+ recipe: ModifyConfig
+ target:
+ # These fields are not used
+ 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
+
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vDNS.yaml b/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vDNS.yaml
new file mode 100644
index 000000000..4341eb9ff
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vDNS.yaml
@@ -0,0 +1,64 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ version: 2.0.0
+ controlLoopName: ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ services:
+ - serviceName: d4738992-6497-4dca-9db9
+ serviceInvariantUUID: dc112d6e-7e73-4777-9c6f-1a7fb5fd1b6f
+ serviceUUID: 2eea06c6-e1d3-4c3a-b9c4-478c506eeedf
+#
+# OPTIONAL to specify the exact resource VF and/or VFC(s)
+#
+# resources:
+# - resourceInvariantUUID: 4b8d4018-068b-4c33-b9bb-d980798e52c2
+# resourceUUID: d7d28881-b24d-4512-bfee-1e2eb335591f
+# resourceVersion: '1.0'
+# resourceName: 59a2ee3f-b580-45fe-b5a1
+# resourceType: VF
+#
+# resources:
+# - resourceInvariantUUID: ee585c30-127b-492e-b2c1-871dc61d1dde
+# resourceUUID: d816cb01-b5d0-4bbb-b614-f7c3e230ab19
+# resourceVersion: '1.0'
+# resourceName: 59a2ee3fB58045feB5a1.nodes.heat.vdns
+# resourceType: VFC
+# - resourceInvariantUUID: f7f1d745-cfb1-4aa9-83fc-31280d0ce513
+# resourceUUID: 1821f13e-411f-4b29-87a5-ae935897b2e1
+# resourceVersion: '1.0'
+# resourceName: 59a2ee3fB58045feB5a1.nodes.heat.vlb
+# resourceType: VFC
+ trigger_policy: unique-policy-id-1-scale-up
+ timeout: 1200
+
+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
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml b/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml
new file mode 100644
index 000000000..caf3babbc
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml
@@ -0,0 +1,72 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ version: 2.0.0
+ controlLoopName: ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ services:
+ - serviceInvariantUUID: 5cfe6f4a-41bc-4247-8674-ebd4b98e35cc
+ serviceUUID: 0f40bba5-986e-4b3c-803f-ddd1b7b25f24
+ serviceName: 57e66ea7-0ed6-45c7-970f
+#
+# OPTIONAL
+#
+# IF they want this CL restricted to a particular VFC(s)
+#
+#resources:
+# - resourceInvariantUUID: 06fe411e-d006-4ac3-8b0e-fb4f13cd78d3
+# resourceUUID: 172ce7c5-c2e4-4f8d-b66c-edb49e8e548a
+# resourceVersion: '1.0'
+# resourceName: eace9331-04d4-43b4-96b8
+# resourceType: VF
+
+# resources:
+# - resourceType: VFC
+# resourceInvariantUUID: b19f6643-3db0-4d73-b280-94d6f21caa71
+# resourceUUID: 6dca6eb9-330c-4090-a542-7aca5f446e21
+# resourceVersion: '1.0'
+# resourceName: Eace933104d443b496b8.nodes.heat.vsn
+# - resourceName: vFW
+# resourceType: VFC
+# resourceInvariantUUID: 0129e34c-d9fa-442d-bb2c-f925d018000a
+# resourceUUID: 7fa1f6c7-c6bd-4444-8db2-63334a5aed1b
+# resourceVersion: '1.0'
+# resourceName: Eace933104d443b496b8.nodes.heat.vfw
+# - resourceType: VFC
+# resourceInvariantUUID: 7654ae14-4e98-45bc-a8c0-2c43e1805bb4
+# resourceUUID: 5267d6dd-f676-4f98-abec-6387ce6beaf2
+# resourceVersion: '1.0'
+# resourceName: Eace933104d443b496b8.nodes.heat.vpg
+ trigger_policy: unique-policy-id-1-modifyConfig
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-modifyConfig
+ name: Change the Load Balancer
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ resourceID: Eace933104d443b496b8.nodes.heat.vpg
+ payload:
+ generic-vnf.vnf-id: {generic-vnf.vnf-id}
+ ref$: pgstreams.json
+ 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
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_vService.yaml b/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_vService.yaml
new file mode 100644
index 000000000..2344ab9c8
--- /dev/null
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_vService.yaml
@@ -0,0 +1,135 @@
+# Copyright 2018 AT&T Intellectual Property. All rights reserved
+# Modifications 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.
+controlLoop:
+ version: 2.0.0
+ controlLoopName: ControlLoop-GENERIC-64cdc9fa-6601-4989-9de7-8f47134aa043
+ #
+ # Example of how someone can fine-grain this
+ # policy for a specific service and/or resources
+ # contained within the service.
+ #
+ services:
+ - serviceName: vFooService
+
+ resources:
+ - resourceName: vVNF1
+ resourceType: VFC
+ - resourceName: vVNF2
+ resourceType: VFC
+ - resourceName: vVNF3
+ resourceType: VFC
+ - resourceName: vVNF4
+ resourceType: VFC
+
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+ #
+ # Example of case where an abatement isn't possible
+ # from DCAE to Policy. So Policy should NOT expect
+ #
+ abatement: false
+
+policies:
+
+ - id: unique-policy-id-1-restart
+ name: Restart Policy
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ retry: 2
+ timeout: 300
+ success: unique-policy-id-1-healthdiagnostic
+ failure: unique-policy-id-2-rebuild
+ failure_timeout: unique-policy-id-2-rebuild
+ failure_retries: unique-policy-id-2-rebuild
+ failure_exception: final_failure_exception
+ failure_guard: unique-policy-id-2-rebuild
+
+
+ - id: unique-policy-id-2-rebuild
+ name: Rebuild Policy
+ description:
+ actor: APPC
+ recipe: Rebuild
+ target:
+ type: VM
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-2-healthdiagnostic
+ failure: unique-policy-id-3-migrate
+ failure_timeout: unique-policy-id-3-migrate
+ failure_retries: unique-policy-id-3-migrate
+ failure_exception: final_failure_exception
+ failure_guard: unique-policy-id-3-migrate
+
+ - id: unique-policy-id-3-migrate
+ name: Migrate Policy
+ description:
+ actor: APPC
+ recipe: Migrate
+ target:
+ type: VM
+ retry: 0
+ timeout: 600
+ 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
+
+ - id: unique-policy-id-1-healthdiagnostic
+ name: Do A Health Diagnostic
+ description:
+ actor: APPC
+ recipe: health-diagnostic
+ # Example of a payload
+ payload:
+ health-diagnostic-code: HC01234
+ health-diagnostic-code-parameters: "{\"Junk\":\"--version\",\"Junk2\":\"--help\"}"
+ target:
+ type: VM
+ retry: 0
+ timeout: 600
+ success: final_success
+ failure: unique-policy-id-2-rebuild
+ failure_timeout: unique-policy-id-2-rebuild
+ failure_retries: unique-policy-id-2-rebuild
+ failure_exception: final_failure_exception
+ failure_guard: unique-policy-id-2-rebuild
+
+
+ - id: unique-policy-id-2-healthdiagnostic
+ name: Do Health Diagnostic
+ description:
+ actor: APPC
+ recipe: health-diagnostic
+ payload:
+ health-diagnostic-code: HC01234
+ health-diagnostic-code-parameters: "{\"Junk\":\"--version\",\"Junk2\":\"--help\"}"
+ target:
+ type: VM
+ retry: 0
+ timeout: 600
+ 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
+
+