summaryrefslogtreecommitdiffstats
path: root/models-interactions
diff options
context:
space:
mode:
Diffstat (limited to 'models-interactions')
-rw-r--r--models-interactions/model-impl/pom.xml1
-rw-r--r--models-interactions/model-impl/sdc/checkstyle-suppressions.xml30
-rw-r--r--models-interactions/model-impl/sdc/pom.xml83
-rw-r--r--models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java81
-rw-r--r--models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java65
-rw-r--r--models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java32
-rw-r--r--models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java80
-rw-r--r--models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java67
-rw-r--r--models-interactions/model-impl/sdc/src/main/resources/definitions.yaml90
-rw-r--r--models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java159
-rw-r--r--models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java154
-rw-r--r--models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java175
-rw-r--r--models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java139
-rw-r--r--models-interactions/model-impl/sdc/src/test/resources/service_trinity.yaml17
-rw-r--r--models-interactions/model-impl/sdc/src/test/resources/service_vSCP.yaml16
-rw-r--r--models-interactions/model-impl/sdc/src/test/resources/service_vUSP.yaml16
-rw-r--r--models-interactions/model-yaml/README-guard-v2.0.0.md188
-rw-r--r--models-interactions/model-yaml/README-v1.0.0.md264
-rw-r--r--models-interactions/model-yaml/README-v2.0.0.md355
-rw-r--r--models-interactions/model-yaml/checkstyle-suppressions.xml31
-rw-r--r--models-interactions/model-yaml/pom.xml140
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/compiler/CompilerException.java47
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/compiler/ControlLoopCompiler.java695
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/compiler/ControlLoopCompilerCallback.java30
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/guard/compiler/ControlLoopGuardCompiler.java156
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/ControlLoop.java189
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/ControlLoopPolicy.java93
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/FinalResult.java108
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/OperationsAccumulateParams.java106
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/Policy.java344
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/PolicyParam.java133
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/PolicyResult.java90
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/Target.java160
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/TargetType.java44
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/BuilderException.java32
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java315
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/Message.java30
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/MessageLevel.java29
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/Results.java34
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java538
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/MessageImpl.java47
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ResultsImpl.java56
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/Constraint.java256
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuard.java102
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/Guard.java76
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/GuardPolicy.java187
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/MatchParameters.java151
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/builder/ControlLoopGuardBuilder.java129
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/builder/impl/ControlLoopGuardBuilderImpl.java252
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/CompilerExceptionTest.java33
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopCompilerTest.java197
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopGuardCompilerTest.java82
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java912
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyTest.java115
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopTest.java186
-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.java259
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuardBuilderTest.java203
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuardTest.java160
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/GuardPolicyTest.java274
-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.yaml115
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/policy_vService.yaml78
-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/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
-rw-r--r--models-interactions/pom.xml1
95 files changed, 0 insertions, 16663 deletions
diff --git a/models-interactions/model-impl/pom.xml b/models-interactions/model-impl/pom.xml
index 33231ecb9..912e8f022 100644
--- a/models-interactions/model-impl/pom.xml
+++ b/models-interactions/model-impl/pom.xml
@@ -45,7 +45,6 @@
<module>events</module>
<module>guard</module>
<module>rest</module>
- <module>sdc</module>
<module>sdnc</module>
<module>sdnr</module>
<module>so</module>
diff --git a/models-interactions/model-impl/sdc/checkstyle-suppressions.xml b/models-interactions/model-impl/sdc/checkstyle-suppressions.xml
deleted file mode 100644
index fd73d24e3..000000000
--- a/models-interactions/model-impl/sdc/checkstyle-suppressions.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- Copyright (C) 2018 AT&T Technologies. All rights reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- SPDX-License-Identifier: Apache-2.0
- ============LICENSE_END=========================================================
--->
-
-<!DOCTYPE suppressions PUBLIC
- "-//Puppy Crawl//DTD Suppressions 1.0//EN"
- "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
-
-<suppressions>
- <suppress checks="AbbreviationAsWordInName"
- files="ResourceInstance.java|ServiceInstance.java|Service.java"
- lines="1-9999"/>
-</suppressions>
diff --git a/models-interactions/model-impl/sdc/pom.xml b/models-interactions/model-impl/sdc/pom.xml
deleted file mode 100644
index 2cf04bfd9..000000000
--- a/models-interactions/model-impl/sdc/pom.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- sdc
- ================================================================================
- Copyright (C) 2017-2020 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=========================================================
- -->
-
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
- <artifactId>model-impl</artifactId>
- <version>2.3.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>sdc</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <executions>
- <execution>
- <id>onap-java-style</id>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>process-sources</phase>
- <configuration>
- <!-- Use Google Java Style Guide:
- https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
- with minor changes -->
- <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
- <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
- <sourceDirectories>${project.build.sourceDirectory}</sourceDirectories>
- <includeResources>true</includeResources>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
- <includeTestResources>true</includeTestResources>
- <excludes>
- </excludes>
- <suppressionsLocation>${project.basedir}/checkstyle-suppressions.xml</suppressionsLocation>
- <consoleOutput>true</consoleOutput>
- <failsOnViolation>true</failsOnViolation>
- <violationSeverity>warning</violationSeverity>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.onap.oparent</groupId>
- <artifactId>checkstyle</artifactId>
- <version>${oparent.version}</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java
deleted file mode 100644
index 79f8161d3..000000000
--- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * sdc
- * ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2020 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.sdc;
-
-import java.io.Serializable;
-import java.util.UUID;
-import lombok.Data;
-
-@Data
-public class Resource implements Serializable {
-
- private static final long serialVersionUID = -913729158733348027L;
-
- private UUID resourceUuid;
- private UUID resourceInvariantUuid;
- private String resourceName;
- private String resourceVersion;
- private String resourceType;
-
- public Resource() {
- // Empty Constructor
- }
-
- /**
- * Constructor.
- *
- * @param resource copy object
- */
- public Resource(Resource resource) {
- this.resourceUuid = resource.resourceUuid;
- this.resourceInvariantUuid = resource.resourceInvariantUuid;
- this.resourceName = resource.resourceName;
- this.resourceVersion = resource.resourceVersion;
- this.resourceType = resource.resourceType;
- }
-
- public Resource(UUID uuid) {
- this.resourceUuid = uuid;
- }
-
- public Resource(String name, String type) {
- this.resourceName = name;
- this.resourceType = type;
- }
-
- /**
- * Constructor.
- *
- * @param uuid uuid
- * @param invariantUuid invariant uuid
- * @param name name
- * @param version version
- * @param type type
- */
- public Resource(UUID uuid, UUID invariantUuid, String name, String version, String type) {
- this.resourceUuid = uuid;
- this.resourceInvariantUuid = invariantUuid;
- this.resourceName = name;
- this.resourceVersion = version;
- this.resourceType = type;
- }
-}
diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java
deleted file mode 100644
index 4fbafcae0..000000000
--- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * sdc
- * ================================================================================
- * Copyright (C) 2017-2019 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.sdc;
-
-import com.google.gson.annotations.SerializedName;
-import java.io.Serializable;
-import java.util.UUID;
-import lombok.Data;
-
-@Data
-public class ResourceInstance implements Serializable {
-
- private static final long serialVersionUID = -5506162340393802424L;
-
- @SerializedName("ResourceUUID")
- private UUID resourceUuid;
-
- private String resourceInstanceName;
- private String resourceName;
- private String resourceVersion;
- private String resourceType;
-
- @SerializedName("ResourceInvariantUUID")
- private UUID resourceInvariantUuid;
-
- public ResourceInstance() {
- // Empty Constructor
- }
-
- /**
- * Constructor.
- *
- * @param instance copy object
- */
- public ResourceInstance(ResourceInstance instance) {
- if (instance == null) {
- return;
- }
- this.resourceInstanceName = instance.resourceInstanceName;
- this.resourceName = instance.resourceName;
- this.resourceInvariantUuid = instance.resourceInvariantUuid;
- this.resourceVersion = instance.resourceVersion;
- this.resourceType = instance.resourceType;
- this.resourceUuid = instance.resourceUuid;
- }
-}
diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java
deleted file mode 100644
index 34cefa1ab..000000000
--- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * sdc
- * ================================================================================
- * Copyright (C) 2017-2019 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.sdc;
-
-public class ResourceType {
- public static final String VF = "VF";
- public static final String VFC = "VFC";
- public static final String VL = "VL";
- public static final String CP = "CP";
-
- private ResourceType() {
- }
-}
diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java
deleted file mode 100644
index 3327b78b0..000000000
--- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * sdc
- * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2020 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.sdc;
-
-import java.io.Serializable;
-import java.util.UUID;
-import lombok.Data;
-
-@Data
-public class Service implements Serializable {
-
- private static final long serialVersionUID = -1249276698549996806L;
-
- /*
- * Note the field names ending in "UUID" may not be changed without breaking the
- * interface, due to limitations in the YAML encoder/decoder.
- */
- private UUID serviceUUID;
- private UUID serviceInvariantUUID;
- private String serviceName;
- private String serviceVersion;
-
- public Service() {
- // Empty Constructor
- }
-
- public Service(UUID uuid) {
- this.serviceUUID = uuid;
- }
-
- public Service(String name) {
- this.serviceName = name;
- }
-
- /**
- * Constructor.
- *
- * @param uuid service id
- * @param invariantUuid service invariant id
- * @param name name
- * @param version version
- */
- public Service(UUID uuid, UUID invariantUuid, String name, String version) {
- this.serviceUUID = uuid;
- this.serviceInvariantUUID = invariantUuid;
- this.serviceName = name;
- this.serviceVersion = version;
- }
-
- /**
- * Constructor.
- *
- * @param service copy object
- */
- public Service(Service service) {
- this.serviceUUID = service.serviceUUID;
- this.serviceInvariantUUID = service.serviceInvariantUUID;
- this.serviceName = service.serviceName;
- this.serviceVersion = service.serviceVersion;
- }
-}
diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java
deleted file mode 100644
index 6eac319fd..000000000
--- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * sdc
- * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2020 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.sdc;
-
-import java.io.Serializable;
-import java.util.UUID;
-import lombok.Data;
-
-@Data
-public class ServiceInstance implements Serializable {
-
- private static final long serialVersionUID = 6285260780966679625L;
-
- /*
- * Note the field names ending in "UUID" may not be changed without breaking the
- * interface, due to limitations in the YAML encoder/decoder.
- */
- private UUID personaModelUUID;
- private UUID serviceUUID;
- private UUID serviceInstanceUUID;
- private UUID widgetModelUUID;
-
- private String widgetModelVersion;
- private String serviceName;
- private String serviceInstanceName;
-
- public ServiceInstance() {
- // Empty Constructor
- }
-
- /**
- * Constructor.
- *
- * @param instance copy object
- */
- public ServiceInstance(ServiceInstance instance) {
- if (instance == null) {
- return;
- }
- this.personaModelUUID = instance.personaModelUUID;
- this.serviceUUID = instance.serviceUUID;
- this.serviceInstanceUUID = instance.serviceInstanceUUID;
- this.widgetModelUUID = instance.widgetModelUUID;
- this.widgetModelVersion = instance.widgetModelVersion;
- this.serviceName = instance.serviceName;
- this.serviceInstanceName = instance.serviceInstanceName;
- }
-}
diff --git a/models-interactions/model-impl/sdc/src/main/resources/definitions.yaml b/models-interactions/model-impl/sdc/src/main/resources/definitions.yaml
deleted file mode 100644
index 16fff309c..000000000
--- a/models-interactions/model-impl/sdc/src/main/resources/definitions.yaml
+++ /dev/null
@@ -1,90 +0,0 @@
-# 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.
-Service:
- type: Object
- properties:
- serviceUUID:
- type: string
- pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
- serviceInvariantUUID:
- type: string
- pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
- serviceName:
- type: string
- serviceVersion:
- type: string
-Resource:
- type: Object
- properties:
- resourceUUID:
- type: string
- pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
- resourceInvariantUUID:
- type: string
- pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
- resourceName:
- type: string
- resourceVersion:
- type: string
- resourceType:
- type: string
- valid_values:
- - VF
- - VFC
- - CP
- - VL
-ServiceInstance:
- type: Object
- properties:
- personaModelUUID:
- type: string
- pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
- serviceUUID:
- type: string
- pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
- serviceInstanceUUID:
- type: string
- pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
- widgetModelUUID:
- type: string
- pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
- widgetModelVersion:
- type: string
- serviceName:
- type: string
- serviceInstanceName:
- type: string
-ResourceInstance:
- type: object
- properties:
- resourceInstanceName:
- type: string
- resourceName:
- type: string
- resourceInvariantUUID:
- type: string
- pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
- resourceVersion:
- type: string
- resourceType:
- type: string
- valid_values:
- - VF
- - VFC
- - CP
- - VL
- resourceUUID:
- type: string
- pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java
deleted file mode 100644
index fd05affb5..000000000
--- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * sdc
- * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2020 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.sdc;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.UUID;
-import org.junit.Test;
-
-public class ResourceInstanceTest {
-
- private static final String RESOURCE = "resource";
- private static final String INSTANCE = "instance";
- private static final String VERSION_000 = "0.0.0";
-
- @Test
- public void testConstructors() {
- ResourceInstance ri = new ResourceInstance();
- assertEquals(null, ri.getResourceInstanceName());
- assertEquals(null, ri.getResourceUuid());
- assertEquals(null, ri.getResourceInvariantUuid());
- assertEquals(null, ri.getResourceName());
- assertEquals(null, ri.getResourceType());
- assertEquals(null, ri.getResourceVersion());
-
- ResourceInstance ri2 = new ResourceInstance((ResourceInstance) null);
- assertEquals(null, ri2.getResourceInstanceName());
- assertEquals(null, ri2.getResourceUuid());
- assertEquals(null, ri2.getResourceInvariantUuid());
- assertEquals(null, ri2.getResourceName());
- assertEquals(null, ri2.getResourceType());
- assertEquals(null, ri2.getResourceVersion());
-
- ri2 = new ResourceInstance(ri);
- assertEquals(ri2.getResourceInstanceName(), ri.getResourceInstanceName());
- assertEquals(ri2.getResourceUuid(), ri.getResourceUuid());
- assertEquals(ri2.getResourceInvariantUuid(), ri.getResourceInvariantUuid());
- assertEquals(ri2.getResourceName(), ri.getResourceName());
- assertEquals(ri2.getResourceType(), ri.getResourceType());
- assertEquals(ri2.getResourceVersion(), ri.getResourceVersion());
- }
-
- @Test
- public void testInstanceName() {
- ResourceInstance ri = new ResourceInstance();
- String name = "nameTestInstance";
- ri.setResourceInstanceName(name);
- ;
- assertEquals(name, ri.getResourceInstanceName());
- }
-
- @Test
- public void testUuid() {
- ResourceInstance ri = new ResourceInstance();
- UUID uuid = UUID.randomUUID();
- ri.setResourceUuid(uuid);
- assertEquals(uuid, ri.getResourceUuid());
- }
-
- @Test
- public void testInvariantUuid() {
- ResourceInstance ri = new ResourceInstance();
- UUID uuid = UUID.randomUUID();
- ri.setResourceInvariantUuid(uuid);
- assertEquals(uuid, ri.getResourceInvariantUuid());
- }
-
- @Test
- public void testName() {
- ResourceInstance ri = new ResourceInstance();
- String name = "nameTest";
- ri.setResourceName(name);
- assertEquals(name, ri.getResourceName());
- }
-
- @Test
- public void testVersion() {
- ResourceInstance ri = new ResourceInstance();
- String version = "versionTest";
- ri.setResourceVersion(version);
- assertEquals(version, ri.getResourceVersion());
- }
-
- @Test
- public void testType() {
- ResourceInstance ri = new ResourceInstance();
- ri.setResourceType(ResourceType.CP);
- assertEquals(ResourceType.CP, ri.getResourceType());
- }
-
- @Test
- public void testEquals() {
- ResourceInstance ri1 = new ResourceInstance();
- ResourceInstance ri2 = new ResourceInstance(ri1);
- assertEquals(ri1, ri2);
- assertEquals(ri2, ri1);
-
- ri1.setResourceInstanceName(INSTANCE);
- ri1.setResourceName(RESOURCE);
- ri1.setResourceInvariantUuid(UUID.randomUUID());
- ri1.setResourceInvariantUuid(UUID.randomUUID());
- ri1.setResourceVersion(VERSION_000);
- ri1.setResourceType(ResourceType.VL);
- ri2 = new ResourceInstance(ri1);
- assertEquals(ri1, ri2);
- assertEquals(ri2, ri1);
- }
-
- @Test
- public void testToString() {
- ResourceInstance ri1 = new ResourceInstance();
- ResourceInstance ri2 = new ResourceInstance(ri1);
- assertEquals(ri1.toString(), ri2.toString());
-
- ri1.setResourceInstanceName(INSTANCE);
- ri1.setResourceName(RESOURCE);
- ri1.setResourceInvariantUuid(UUID.randomUUID());
- ri1.setResourceInvariantUuid(UUID.randomUUID());
- ri1.setResourceVersion(VERSION_000);
- ri1.setResourceType(ResourceType.VL);
- ri2 = new ResourceInstance(ri1);
- assertEquals(ri1.toString(), ri2.toString());
- }
-
- @Test
- public void testHashCode() {
- ResourceInstance ri1 = new ResourceInstance();
- ResourceInstance ri2 = new ResourceInstance(ri1);
- assertEquals(ri1.hashCode(), ri2.hashCode());
-
- ri1.setResourceInstanceName(INSTANCE);
- ri1.setResourceName(RESOURCE);
- ri1.setResourceInvariantUuid(UUID.randomUUID());
- ri1.setResourceInvariantUuid(UUID.randomUUID());
- ri1.setResourceVersion(VERSION_000);
- ri1.setResourceType(ResourceType.VL);
- ri2 = new ResourceInstance(ri1);
- assertEquals(ri1.hashCode(), ri2.hashCode());
- }
-}
diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java
deleted file mode 100644
index 10e26bd9c..000000000
--- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * sdc
- * ================================================================================
- * Copyright (C) 2017-2020 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.sdc;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.UUID;
-import org.junit.Test;
-
-public class ResourceTest {
-
- private static final String EQUALS_TEST = "equalsTest";
- private static final String VERSION_111 = "1.1.1";
-
- @Test
- public void testConstructors() {
- Resource res = new Resource();
- assertEquals(null, res.getResourceUuid());
- assertEquals(null, res.getResourceInvariantUuid());
- assertEquals(null, res.getResourceName());
- assertEquals(null, res.getResourceType());
- assertEquals(null, res.getResourceVersion());
-
- UUID uuid = UUID.randomUUID();
- res = new Resource(uuid);
- assertEquals(uuid, res.getResourceUuid());
- assertEquals(null, res.getResourceInvariantUuid());
- assertEquals(null, res.getResourceName());
- assertEquals(null, res.getResourceType());
- assertEquals(null, res.getResourceVersion());
-
- String name = "constTest";
- res = new Resource(name, ResourceType.CP);
- assertEquals(null, res.getResourceUuid());
- assertEquals(name, res.getResourceName());
- assertEquals(ResourceType.CP, res.getResourceType());
- assertEquals(null, res.getResourceInvariantUuid());
- assertEquals(null, res.getResourceVersion());
-
- uuid = UUID.randomUUID();
- UUID uuidInvariant = UUID.randomUUID();
- name = "constTestUUID";
- String version = "0.0.1";
- res = new Resource(uuid, uuidInvariant, name, version, ResourceType.VF);
- assertEquals(uuid, res.getResourceUuid());
- assertEquals(uuidInvariant, res.getResourceInvariantUuid());
- assertEquals(name, res.getResourceName());
- assertEquals(ResourceType.VF, res.getResourceType());
- assertEquals(version, res.getResourceVersion());
-
- Resource r2 = new Resource(res);
- assertEquals(uuid, r2.getResourceUuid());
- assertEquals(uuidInvariant, r2.getResourceInvariantUuid());
- assertEquals(name, r2.getResourceName());
- assertEquals(ResourceType.VF, r2.getResourceType());
- assertEquals(version, r2.getResourceVersion());
- }
-
- @Test
- public void testUuid() {
- Resource res = new Resource();
- UUID uuid = UUID.randomUUID();
- res.setResourceUuid(uuid);
- assertEquals(uuid, res.getResourceUuid());
- }
-
- @Test
- public void testInvariantUuid() {
- Resource res = new Resource();
- UUID uuid = UUID.randomUUID();
- res.setResourceInvariantUuid(uuid);
- assertEquals(uuid, res.getResourceInvariantUuid());
- }
-
- @Test
- public void testName() {
- Resource res = new Resource();
- String name = "nameTest";
- res.setResourceName(name);
- assertEquals(name, res.getResourceName());
- }
-
- @Test
- public void testVersion() {
- Resource res = new Resource();
- String version = "versionTest";
- res.setResourceVersion(version);
- assertEquals(version, res.getResourceVersion());
- }
-
- @Test
- public void testType() {
- Resource res = new Resource();
- res.setResourceType(ResourceType.CP);
- assertEquals(ResourceType.CP, res.getResourceType());
- }
-
- @Test
- public void testEquals() {
- Resource r1 = new Resource();
- Resource r2 = new Resource(r1);
- assertEquals(r1, r2);
- assertEquals(r2, r1);
-
- r1 = new Resource(UUID.randomUUID(), UUID.randomUUID(), EQUALS_TEST, VERSION_111,
- ResourceType.VFC);
- r2 = new Resource(r1);
- assertEquals(r1, r2);
- assertEquals(r2, r1);
- }
-
- @Test
- public void testToString() {
- Resource r1 = new Resource();
- Resource r2 = new Resource(r1);
- assertEquals(r1.toString(), r2.toString());
-
- r1 = new Resource(UUID.randomUUID(), UUID.randomUUID(), EQUALS_TEST, VERSION_111,
- ResourceType.VFC);
- r2 = new Resource(r1);
- assertEquals(r1.toString(), r2.toString());
- }
-
- @Test
- public void testHashCode() {
- Resource r1 = new Resource();
- Resource r2 = new Resource(r1);
- assertEquals(r1.hashCode(), r2.hashCode());
-
- r1 = new Resource(UUID.randomUUID(), UUID.randomUUID(), EQUALS_TEST, VERSION_111,
- ResourceType.VFC);
- r2 = new Resource(r1);
- assertEquals(r1.hashCode(), r2.hashCode());
- }
-}
diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java
deleted file mode 100644
index ecd0bb323..000000000
--- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * sdc
- * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2020 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.sdc;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.UUID;
-import org.junit.Test;
-
-public class ServiceInstanceTest {
-
- private static final String SERVICE = "service";
- private static final String INSTANCE = "instance";
- private static final String VERSION_333 = "3.3.3";
-
- @Test
- public void testConstructors() {
- ServiceInstance si = new ServiceInstance();
- assertEquals(null, si.getServiceInstanceName());
- assertEquals(null, si.getServiceUUID());
- assertEquals(null, si.getServiceInstanceUUID());
- assertEquals(null, si.getServiceName());
- assertEquals(null, si.getPersonaModelUUID());
- assertEquals(null, si.getWidgetModelUUID());
- assertEquals(null, si.getWidgetModelVersion());
-
- ServiceInstance si2 = new ServiceInstance((ServiceInstance) null);
- assertEquals(null, si2.getServiceInstanceName());
- assertEquals(null, si2.getServiceUUID());
- assertEquals(null, si2.getServiceInstanceUUID());
- assertEquals(null, si2.getServiceName());
- assertEquals(null, si2.getPersonaModelUUID());
- assertEquals(null, si2.getWidgetModelUUID());
- assertEquals(null, si2.getWidgetModelVersion());
-
- si2 = new ServiceInstance(si);
- assertEquals(si2.getServiceInstanceName(), si.getServiceInstanceName());
- assertEquals(si2.getServiceUUID(), si.getServiceUUID());
- assertEquals(si2.getServiceInstanceUUID(), si.getServiceInstanceUUID());
- assertEquals(si2.getServiceName(), si.getServiceName());
- assertEquals(si2.getPersonaModelUUID(), si.getPersonaModelUUID());
- assertEquals(si2.getWidgetModelUUID(), si.getWidgetModelUUID());
- assertEquals(si2.getWidgetModelVersion(), si.getWidgetModelVersion());
- }
-
- @Test
- public void testInstanceName() {
- ServiceInstance si = new ServiceInstance();
- String name = "nameTestInstance";
- si.setServiceInstanceName(name);
- ;
- assertEquals(name, si.getServiceInstanceName());
- }
-
- @Test
- public void testUuid() {
- ServiceInstance si = new ServiceInstance();
- UUID uuid = UUID.randomUUID();
- si.setServiceUUID(uuid);
- assertEquals(uuid, si.getServiceUUID());
- }
-
- @Test
- public void testInstanceUuid() {
- ServiceInstance si = new ServiceInstance();
- UUID uuid = UUID.randomUUID();
- si.setServiceInstanceUUID(uuid);
- assertEquals(uuid, si.getServiceInstanceUUID());
- }
-
- @Test
- public void testName() {
- ServiceInstance si = new ServiceInstance();
- String name = "nameTest";
- si.setServiceName(name);
- assertEquals(name, si.getServiceName());
- }
-
- @Test
- public void testPersonaModelUuid() {
- ServiceInstance si = new ServiceInstance();
- UUID uuid = UUID.randomUUID();
- si.setPersonaModelUUID(uuid);
- assertEquals(uuid, si.getPersonaModelUUID());
- }
-
- @Test
- public void testWidgetModelUuid() {
- ServiceInstance si = new ServiceInstance();
- UUID uuid = UUID.randomUUID();
- si.setWidgetModelUUID(uuid);
- assertEquals(uuid, si.getWidgetModelUUID());
- }
-
- @Test
- public void testWidgetModelVersion() {
- ServiceInstance si = new ServiceInstance();
- String version = "2.2.2";
- si.setWidgetModelVersion(version);
- ;
- assertEquals(version, si.getWidgetModelVersion());
- }
-
- @Test
- public void testEquals() {
- ServiceInstance si1 = new ServiceInstance();
- ServiceInstance si2 = new ServiceInstance(si1);
- assertEquals(si1, si2);
- assertEquals(si2, si1);
-
- si1.setServiceInstanceName(INSTANCE);
- si1.setServiceName(SERVICE);
- si1.setServiceInstanceUUID(UUID.randomUUID());
- si1.setServiceUUID(UUID.randomUUID());
- si1.setPersonaModelUUID(UUID.randomUUID());
- si1.setWidgetModelUUID(UUID.randomUUID());
- si1.setWidgetModelVersion(VERSION_333);
- si2 = new ServiceInstance(si1);
- assertEquals(si1, si2);
- assertEquals(si2, si1);
- }
-
- @Test
- public void testToString() {
- ServiceInstance si1 = new ServiceInstance();
- ServiceInstance si2 = new ServiceInstance(si1);
- assertEquals(si1.toString(), si2.toString());
-
- si1.setServiceInstanceName(INSTANCE);
- si1.setServiceName(SERVICE);
- si1.setServiceInstanceUUID(UUID.randomUUID());
- si1.setServiceUUID(UUID.randomUUID());
- si1.setPersonaModelUUID(UUID.randomUUID());
- si1.setWidgetModelUUID(UUID.randomUUID());
- si1.setWidgetModelVersion(VERSION_333);
- si2 = new ServiceInstance(si1);
- assertEquals(si1.toString(), si2.toString());
- }
-
- @Test
- public void testHashCode() {
- ServiceInstance si1 = new ServiceInstance();
- ServiceInstance si2 = new ServiceInstance(si1);
- assertEquals(si1.hashCode(), si2.hashCode());
-
- si1.setServiceInstanceName(INSTANCE);
- si1.setServiceName(SERVICE);
- si1.setServiceInstanceUUID(UUID.randomUUID());
- si1.setServiceUUID(UUID.randomUUID());
- si1.setPersonaModelUUID(UUID.randomUUID());
- si1.setWidgetModelUUID(UUID.randomUUID());
- si1.setWidgetModelVersion(VERSION_333);
- si2 = new ServiceInstance(si1);
- assertEquals(si1.hashCode(), si2.hashCode());
- }
-}
diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java
deleted file mode 100644
index 1e6c6f917..000000000
--- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * sdc
- * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2020 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.sdc;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.UUID;
-import org.junit.Test;
-
-public class ServiceTest {
-
- private static final String EQUALS_TEST = "equalsTest";
- private static final String VERSION_111 = "1.1.1";
-
- @Test
- public void testConstructors() {
- Service svc = new Service();
- assertEquals(null, svc.getServiceUUID());
- assertEquals(null, svc.getServiceInvariantUUID());
- assertEquals(null, svc.getServiceName());
- assertEquals(null, svc.getServiceVersion());
-
- UUID uuid = UUID.randomUUID();
- svc = new Service(uuid);
- assertEquals(uuid, svc.getServiceUUID());
- assertEquals(null, svc.getServiceInvariantUUID());
- assertEquals(null, svc.getServiceName());
- assertEquals(null, svc.getServiceVersion());
-
- String name = "constTest";
- svc = new Service(name);
- assertEquals(null, svc.getServiceUUID());
- assertEquals(name, svc.getServiceName());
- assertEquals(null, svc.getServiceInvariantUUID());
- assertEquals(null, svc.getServiceVersion());
-
- uuid = UUID.randomUUID();
- UUID uuidInvariant = UUID.randomUUID();
- name = "constTestUUID";
- String version = "0.0.1";
- svc = new Service(uuid, uuidInvariant, name, version);
- assertEquals(uuid, svc.getServiceUUID());
- assertEquals(uuidInvariant, svc.getServiceInvariantUUID());
- assertEquals(name, svc.getServiceName());
- assertEquals(version, svc.getServiceVersion());
-
- Service s2 = new Service(svc);
- assertEquals(uuid, s2.getServiceUUID());
- assertEquals(uuidInvariant, s2.getServiceInvariantUUID());
- assertEquals(name, s2.getServiceName());
- assertEquals(version, s2.getServiceVersion());
- }
-
- @Test
- public void testUuid() {
- Service svc = new Service();
- UUID uuid = UUID.randomUUID();
- svc.setServiceUUID(uuid);
- assertEquals(uuid, svc.getServiceUUID());
- }
-
- @Test
- public void testInvariantUuid() {
- Service svc = new Service();
- UUID uuid = UUID.randomUUID();
- svc.setServiceInvariantUUID(uuid);
- assertEquals(uuid, svc.getServiceInvariantUUID());
- }
-
- @Test
- public void testName() {
- Service svc = new Service();
- String name = "nameTest";
- svc.setServiceName(name);
- assertEquals(name, svc.getServiceName());
- }
-
- @Test
- public void testVersion() {
- Service svc = new Service();
- String version = "versionTest";
- svc.setServiceVersion(version);
- assertEquals(version, svc.getServiceVersion());
- }
-
- @Test
- public void testEquals() {
- Service s1 = new Service();
- Service s2 = new Service(s1);
- assertEquals(s1, s2);
- assertEquals(s2, s1);
-
- s1 = new Service(UUID.randomUUID(), UUID.randomUUID(), EQUALS_TEST, VERSION_111);
- s2 = new Service(s1);
- assertEquals(s1, s2);
- assertEquals(s2, s1);
- }
-
- @Test
- public void testToString() {
- Service s1 = new Service();
- Service s2 = new Service(s1);
- assertEquals(s1.toString(), s2.toString());
-
- s1 = new Service(UUID.randomUUID(), UUID.randomUUID(), EQUALS_TEST, VERSION_111);
- s2 = new Service(s1);
- assertEquals(s1.toString(), s2.toString());
- }
-
- @Test
- public void testHashCode() {
- Service s1 = new Service();
- Service s2 = new Service(s1);
- assertEquals(s1.hashCode(), s2.hashCode());
-
- s1 = new Service(UUID.randomUUID(), UUID.randomUUID(), EQUALS_TEST, VERSION_111);
- s2 = new Service(s1);
- assertEquals(s1.hashCode(), s2.hashCode());
- }
-}
diff --git a/models-interactions/model-impl/sdc/src/test/resources/service_trinity.yaml b/models-interactions/model-impl/sdc/src/test/resources/service_trinity.yaml
deleted file mode 100644
index 391dc0328..000000000
--- a/models-interactions/model-impl/sdc/src/test/resources/service_trinity.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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.
-Service:
- serviceName: trinity
- \ No newline at end of file
diff --git a/models-interactions/model-impl/sdc/src/test/resources/service_vSCP.yaml b/models-interactions/model-impl/sdc/src/test/resources/service_vSCP.yaml
deleted file mode 100644
index 1c377c9c5..000000000
--- a/models-interactions/model-impl/sdc/src/test/resources/service_vSCP.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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.
-Service:
- serviceName: vSCP \ No newline at end of file
diff --git a/models-interactions/model-impl/sdc/src/test/resources/service_vUSP.yaml b/models-interactions/model-impl/sdc/src/test/resources/service_vUSP.yaml
deleted file mode 100644
index 6d6f9f1e1..000000000
--- a/models-interactions/model-impl/sdc/src/test/resources/service_vUSP.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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.
-Service:
- serviceName: vUSP
diff --git a/models-interactions/model-yaml/README-guard-v2.0.0.md b/models-interactions/model-yaml/README-guard-v2.0.0.md
deleted file mode 100644
index 7f373b1c9..000000000
--- a/models-interactions/model-yaml/README-guard-v2.0.0.md
+++ /dev/null
@@ -1,188 +0,0 @@
-Copyright 2018 AT&T Intellectual Property. All rights reserved.
-Modifications Copyright (C) 2019 Nordix Foundation.
-This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
-Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
-
-ONAP Control Loop Guard
-
-A control loop guard is a YAML specification for creating policy guard for ControlLoop.
-
-ONAP Control Loop Guard Features:
-
-* The Control Loop Guard can specify the frequency limiter and the blacklist of target entities but not both in the same Guard.
-* Two parts are incorporated. One is the common guard header including guard version while the other part is a set of guard policies.
-* The Control Loop Guard should contain at least one guard policies.
-* Each guard policy is bound to a specific Actor and Recipe.
-* Each guard policy should have at least one limit constraints which define how the guard policy should be enforced.
-* Supported Actors are APPC and SO.
-
-This SDK helps build the YAML specification for ONAP Control Loop Guard.
-
-# Create Builder Object
-
-To begin with, the ControlLoopGuardBuilder.Factory class has static methods that one should use to begin building a Control Loop Guard. It will return a [ControlLoopGuardBuilder object](src/main/java/org/onap/policy/controlloop/policy/guard/builder/ControlLoopGuardBuilder.java) that can then be used to continue to build and define the Control Loop Guard.
-
-```java
- ControlLoopGuardBuilder builder = ControlLoopGuardBuilder.Factory.buildControlLoopGuard(new Guard());
-```
-
-# Add Guard Policy
-
-After a guard builder has been created, the next step would be to add a guard policy to the newly created Control Loop Guard via the builder. To add a guard policy, use the addGuardPolicy() method.
-
-```java
- GuardPolicy policy = new GuardPolicy(
- "unique_guard_vUSP_1",
- "APPC 5 Restart",
- "We only allow 5 restarts over 15 minute window during the day time hours (i.e. avoid midnight to 5am)",
- "APPC",
- "Restart");
- builder = builder.addGuardPolicy(policy);
-```
-
-# Add Limit Constraint to a Guard Policy
-
-The limit constraint defines the details of how to enforce the guard policy. Each limit constraint can contain two types of constraints - frequency limiter and black list. At least one type of constraints should be specified, otherwise the limit constraint will be counted as invalid. To add a limit constraint to an existing guard policy, use the addLimitConstraint() method.
-
-```java
- Map<String, String> time_in_range = new HashMap<String, String>();
- time_in_range.put("arg2", "PT5H");
- time_in_range.put("arg3", "PT24H");
- List<String> blacklist = new LinkedList<String>();
- blacklist.add("vm_name_1");
- blacklist.add("vm_name_2");
- Constraint cons = new Constraint(5, "PT15M", time_in_range, blacklist);
- builder = builder.addLimitConstraint(policy.id, cons);
-```
-
-
-# Build the YAML Specification
-
-When finished defining the Guard Policies, build the specification and analyze the [Results.java](src/main/java/org/onap/policy/controlloop/policy/builder/Results.java)
-
-```java
- Results results = builder.buildSpecification();
- if (results.isValid()) {
- System.out.println(results.getSpecification());
- } else {
- System.err.println("Builder failed");
- for (Message message : results.getMessages()) {
- System.err.println(message.getMessage());
- }
- }
-```
-
-
-# Use the YAML Specification to Generate the XACML Guard Policies
-
-Now that you have a valid YAML specification, call the method in [PolicyGuardYamlToXacml.java](guard/src/main/java/org/onap/policy/guard/PolicyGuardYamlToXacml.java) to generate the XACML Guard Policies.
-
-
-# YAML Specification
-
-The YAML specification has 2 sections to it: [guard](#guard-object) and [guards](#guards-array). The [guard section](#guard-object) section is simply a header defining the version of this guard. The [guards section](#guards-array) is simply an array of [GuardPolicy objects](#guardpolicy-object).
-
-## guard Object
-
-| Field Name | Type | Required | Description |
-| ------------- |:-------------:| -----------| ------------:|
-| version | string | required | Value for this release if 2.0.0 |
-
-
-## guards array
-
-The guards section is an array of [GuardPolicy objects](#guardpolicy-object).
-
-### GuardPolicy Object
-
-| Field Name | Type | Required | Description |
-| ------------- |:-------------:| -----------| ------------:|
-| id | string | required | Unique ID for the policy. |
-| name | string | required | Policy name |
-| description | string | optional | Policy description |
-| actor | string | required | Name of the actor for this operation: Example: APPC |
-| recipe | string | required | Name of recipe to be performed. Example "Restart" |
-| limit_constraints | array of [constraint](#constraint-object) object | required | Constraints used to enforce the guard policy |
-
-The guard policy is bound to a specific recipe performed by the actor. When the Control Loop tries to perform the recipe operation by the actor, this guard policy should be evaluated against all the specified constraints. If any of the constraints will be violated, the operation should be abandoned.
-
-#### constraint Object
-
-| Field Name | Type | Required | Description |
-| ------------- |:-------------:| -----------| ------------:|
-| num | integer | required if blacklist is not specified | The limited number of the same operations |
-| duration | string | required if blacklist is not specified | Time window for counting the same operations |
-| time_in_range | map<string, string> | optional | Valid time spans for enforcing the guard policy |
-| blacklist | array of string | required if num and duration are not specified | A list of the entity names that should not be touched by the Control Loop |
-
-The first three attributes define the frequency limiter which means that only a limited number of the same operations can be allowed within each valid time window. The last attribute defines a blacklist of the target entities on which the Control Loop should not perform the operation.
-
-The "duration" parameter should have one of the following values: [5min, 10min, 30min, 1h, 12h, 1d, 5d, 1w, 1mon].
-
-
-## Examples of YAML Control Loop Guards
-
-[vService-Frequency-Limiter-Guard](src/test/resources/v2.0.0-guard/policy_guard_appc_restart.yaml)
-[vService-Blacklist-Guard](src/test/resources/v2.0.0-guard/policy_guard_blacklist.yaml)
-[ONAP-vDNS-Guard](src/test/resources/v2.0.0-guard/policy_guard_ONAP_demo_vDNS.yaml)
-
-
-### vService Frequency Limiter Guard
-```
-guard:
- version: 2.0.0
-
-guards:
- - id: unique_guard_vService_frequency_limiter
- 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
- duration: PT15M
- time_in_range:
- arg2: PT5H
- arg3: PT24H
-```
-
-
-### vService Blacklist Guard
-```
-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
-```
-
-
-### ONAP vDNS Guard
-```
-guard:
- version: 2.0.0
-
-guards:
- - id: unique_guard_ONAP_vDNS_1
- name: SO Spinup
- description: We only spin up 1 instance over a 10 minute window
- actor: SO
- recipe: VF Module Create
- limit_constraints:
- - num: 1
- duration: PT10M
-```
-
diff --git a/models-interactions/model-yaml/README-v1.0.0.md b/models-interactions/model-yaml/README-v1.0.0.md
deleted file mode 100644
index eea1cad99..000000000
--- a/models-interactions/model-yaml/README-v1.0.0.md
+++ /dev/null
@@ -1,264 +0,0 @@
-Copyright 2018 AT&T Intellectual Property. All rights reserved.
-Modifications Copyright (C) 2019 Nordix Foundation.
-This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
-Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
-
-ONAP Control Loop Policy v1.0.0
-
-A control loop policy is a YAML specification for creating and chaining policies for ControlLoop.
-
-Features of ONAP Control Loop Policy v1.0.0:
-
-* A single DCAE Closed Loop Event is the trigger for the overall Control Loop Policy
-* APPC is the only Actor that Policy will interact with. The operations available are: RESTART, REBUILD, MIGRATE.
-* An overall timeout for the Control Loop Policy must be provided
-* The Control Loop Policy can contain zero or more Operational Policies each chained together via outcomes of each policy.
-* If there are zero Operational Policies, i.e. no automated action is to be taken, then the policy is an Open Loop policy.
-* Operational Policies can have retries and timeout's given to control how they are processed.
-
-This SDK helps build the YAML specification for ONAP Control Loop Policy v1.0.0.
-
-# Create Builder Object
-
-To begin with, the ControlLoopPolicyBuilder.Factory class has static methods that one should use to begin building a Control Loop Policy. It will return a [ControlLoopPolicyBuilder object](src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java) that can then be used to continue to build and define the Control Loop Policy.
-
-```java
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(
- UUID.randomUUID().toString(),
- 2400,
- new Resource("sampleResource", ResourceType.VF),
- new Service("sampleService")
- );
-```
-
-# Define the Trigger Policy
-
-After the name of the Control Loop and the resource and services have been defined, the next step would be to define the Operation Policy that is first to respond to an incoming DCAE Closed Loop Event. Use the setTriggerPolicy() method to do so.
-
-```java
- Policy triggerPolicy = builder.setTriggerPolicy(
- "Restart the VM",
- "Upon getting the trigger event, restart the VM",
- Actor.APPC,
- Target.VM,
- "Restart",
- 2,
- 300);
-```
-
-# Chain Operational Policies Together Using Operational Results
-
-Operational Policies are chained together using the results of each Operational Policy. The results are defined in [PolicyResult.java](src/main/java/org/onap/policy/controlloop/policy/PolicyResult.java). To create an Operational Policy that is tied to the result of another, use the
-setPolicyForPolicyResult() method.
-
-```java
- Policy onRestartFailurePolicy = builder.setPolicyForPolicyResult(
- "Rebuild VM",
- "If the restart fails, rebuild it.",
- Actor.APPC,
- Target.VM,
- "Rebuild",
- 1,
- 600,
- triggerPolicy.id,
- PolicyResult.FAILURE,
- PolicyResult.FAILURE_RETRIES,
- PolicyResult.FAILURE_TIMEOUT);
-```
-
-An Operational Policy MUST have place to go for every one of its results. By default, each result type goes to a Final Result. Optionally, using the setPolicyForPolicyResult() method is what allows the chaining of policies. Be aware of creating loops and set the overall Control Loop timeout to reasonable value. All paths MUST lead to a Final Result.
-
-# Build the YAML Specification
-
-When finished defining the Policies, build the specification and analyze the [Results.java](src/main/java/org/onap/policy/controlloop/policy/builder/Results.java)
-
-```java
- Results results = builder.buildSpecification();
- if (results.isValid()) {
- System.out.println(results.getSpecification());
- } else {
- System.err.println("Builder failed");
- for (Message message : results.getMessages()) {
- System.err.println(message.getMessage());
- }
- }
-```
-
-
-# Use the YAML Specification to call the Create Policy API
-
-Now that you have a valid YAML specification, call the createPolicy API via the ONAP Policy Platform API.
-
-# YAML Specification
-
-The YAML specification has 2 sections to it: [controlLoop](#controlloop-object) and [policies](#policies-array). The [controlLoop section](#controlloop-object) section is simply a header defining the Control Loop Policy, what services its for, which resource its for, or if its for a pnf, the overall timeout, and which Operational Policy is triggered upon receiving the event. The [policies section](#policies-array) is simply an array of [Policy Objects](#policy-object).
-
-## controlLoop Object
-
-| Field Name | Type | Required | Description |
-| ------------- |:-------------:| -----------| ------------:|
-| controlLoopName | string | required | Unique ID for the control Loop |
-| version | string | required | Value for this release if 1.0.0 |
-| services | array of [service](#service-object) objects | optional | Zero or more services associated with this Control Loop |
-| resources | array of [resource](#resource-object) object | required (If NOT a pnf control loop) | The resource's associated with this Control Loop. |
-| pnf | [pnf](#pnf-object) object | required (If NOT a resource control loop) | The physical network function associated with this Control Loop. |
-| trigger_policy | string | required | Either this is the ID of an Operation Policy (see policy object), or "Final_OpenLoop" indicating an Open Loop |
-| timeout | int | required | This is the overall timeout for the Control Loop Policy. It can be 0 for an Open Loop, but otherwise should total more than the timeouts specified in any Operational Policies |
-
-### resource Object
-
-This object was derived via SDC Catalog API and SDC Data Dictionary (POC) in an attempt to use common naming conventions.
-
-| Field Name | Type | Required | Description |
-| ------------- |:-------------:| -----------| ------------:|
-| resourceInvariantUUID | string - UUID | optional | via SDC, the unique ID for the resource version |
-| resourceName | string | required if NO resourceUUID available | Name of the resource, ideally from SDC catalog. But if not available, use well-known name. |
-| resourceType | string | optional | Use values defined by SDC: VF, VFC, VL, CP. |
-| resourceUUID | string - UUID | required IF available, else populate resourceName | Unique ID for the resource as assigned via SDC.
-| resourceVersion | string | optional | string version of the resource via SDC catalog
-
-SDC catalog is not fully available and resources have not been defined yet, use resourceName. Eg. vFW
-
-### service Object
-
-This object was derived via SDC Catalog API and SDC Data Dictionary (POC) in an attempt to use common naming conventions.
-
-| Field Name | Type | Required | Description |
-| ------------- |:-------------:| -----------| ------------:|
-| serviceInvariantUUID | string - UUID | optional | via SDC catalog, the unique ID for the service version |
-| serviceName | string | required if NO serviceUUID available | Name of the service, ideally from SDC catalog. But if not available, use well-known name. |
-| serviceUUID | string - UUID | required IF available, else populate serviceName | Unique ID fort he service as assigned via SDC
-| serviceVersion | string | optional | string version of the service via SDC catalog
-
-SDC catalog is not fully available and some services have not been defined yet, use serviceName. Eg. vLB.
-
-### pnf Object
-
-This object is used for a physical network function. Expect this object to change in the future when ONAP Policy fully integrates with A&AI.
-
-| Field Name | Type | Required | Description |
-| ------------- |:-------------:| -----------| ------------:|
-| PNFName | string | required | Name of the PNF. Should be supplied via A&AI. If not available use a well-known name. |
-| PNFType | string | optional | Type of PNF if available. |
-
-
-## policies array
-
-The policies section is an array of [Policy objects](#policy-object).
-
-### Policy Object
-
-This is an Operation Policy. It is used to instruct an actor (eg. APPC) to invoke a recipe (eg. "Restart") on a target entity (eg. a "VM"). An operation is simply defined as performing a recipe (or operation) on an actor.
-
-| Field Name | Type | Required | Description |
-| ------------- |:-------------:| -----------| ------------:|
-| id | string | required | Unique ID for the policy.
-| name | string | required | Policy name |
-| description | string | optional | Policy description |
-| actor | string | required | Name of the actor for this operation: Example: APPC |
-| recipe | string | required | Name of recipe to be performed. Example "Restart" |
-| target | string | required | Entity being targeted. Example: VM |
-| timeout | int | required | Timeout for the actor to perform the recipe. |
-| retry | int | optional | Optional number of retries for ONAP Policy to invoke the recipe on the actor. |
-| success | string | required | By default, this value should be FINAL_SUCCESS. Otherwise this can be the ID of the operational Policy (included in this specification) to invoke upon successfully completing the recipe on the actor.
-| failure | string | required | By default, this value should be FINAL_FAILURE. Otherwise this can be the ID of the operational Policy (included in this specification) to invoke upon failure to perform the operation. |
-| failure_exception | string | required | By default, this value should be FINAL_FAILURE_EXCEPTION. Otherwise this can be the ID of an Operational Policy (included in this specification) to invoke upon an exception occurring while attempting to perform the operation. |
-| failure_retries | string | required | By default, this value should be the FINAL_FAILURE_RETRIES. Otherwise this can be the ID of an Operational Policy (included in this specification) to invoke upon maxing out on retries while attempting to perform the operation. |
-| failure_timeout | string | required | By default, this value should be FINAL_FAILURE_TIMEOUT. Otherwise this can be the ID of the operational Policy (included in this specification) to invoke upon a timeout occuring while performing an operation. |
-
-Every Operational Policy MUST have a place to go for every possible result (success, failure, failure_retries, failure_timeout, failure_exception). By default, all the results are final results.
-
-## Examples of YAML Control Loops v1.0.0
-
-[vService](src/test/resources/v1.0.0/policy_vService.yaml)
-[Open-Loop](src/test/resources/v1.0.0/policy_OpenLoop.yaml)
-
-
-### vService
-```
-controlLoop:
- version: 1.0.0
- controlLoopName: ControlLoop-vService-cbed919f-2212-4ef7-8051-fe6308da1bda
- services:
- - serviceName: service1
- resources:
- - resourceName: resource1
- resourceType: VF
- - resourceName: resource2
- resourceType: VF
- - resourceName: resource3
- resourceType: VF
- - resourceName: resource4
- resourceType: VF
- - resourceName: resource5
- 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
-
-```
-
-### Open Loop
-```
-controlLoop:
- version: 1.0.0
- controlLoopName: ControlLoop-Open-fac4ae3d-c3f5-4bab-8e54-0a8581ede132
- services:
- - serviceName: service1
- resources:
- - resourceType: VF
- resourceName: resource1
- trigger_policy: final_openloop
- timeout: 0
-
-policies:
-```
-
-
-
-# Control Loop Final Results Explained
-
-A Control Loop Policy has the following set of final results, as defined in [FinalResult.java](src/main/java/org/onap/policy/controlloop/policy/FinalResult.java). A final result indicates when a Control Loop Policy has finished execution and is finished processing a Closed Loop Event. All paths must lead to a Final Result.
-
diff --git a/models-interactions/model-yaml/README-v2.0.0.md b/models-interactions/model-yaml/README-v2.0.0.md
deleted file mode 100644
index bb72cc03e..000000000
--- a/models-interactions/model-yaml/README-v2.0.0.md
+++ /dev/null
@@ -1,355 +0,0 @@
-Copyright 2018-2019 AT&T Intellectual Property. All rights reserved.
-Modifications Copyright (C) 2019 Nordix Foundation.
-This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
-Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
-
-ONAP Control Loop Policy v2.0.0
-
-A control loop policy is a YAML specification for creating and chaining policies for ControlLoop.
-
-Features of ONAP Control Loop Policy v2.0.0:
-
-* Backward compatible with ONAP Control Loop Policy v1.0.0
-* A single DCAE Closed Loop Event is the trigger for the overall Control Loop Policy.
-* An overall timeout for the Control Loop Policy must be provided.
-* An abatement flag indicating whether Policy will receive abatement event for the Control Loop could be provided.
-* The Control Loop Policy can contain zero or more Operational Policies each chained together via outcomes of each policy.
-* If there are zero Operational Policies, i.e. no automated action is to be taken, then the policy is an Open Loop policy.
-* Operational policies can have target, retries and timeout's given to control how they are processed.
-* Type and resourceID of the target could be provided to support the target in operational policies.
-* Payload could be provided to support the recipe.
-* Multiple actors along with their supported recipes can be specified in operational policies that Policy will interact with. The following table summarizes the supported actors and recipes.
-
-| Actor | Recipe | Target | Payload |
-| -------------|:---------------------------:| ---------| ------------:|
-| APPC | Restart | VM | CloudVServerSelfLink, CloudIdentity |
-| APPC | Rebuild | VM | CloudVServerSelfLink, CloudIdentity |
-| APPC | Migrate | VM | CloudVServerSelfLink, CloudIdentity |
-| APPC | ModifyConfig | VNF | generic-vnf.vnf-id |
-| SO | VF Module Create | VFC | optional |
-
-
-This SDK helps build the YAML specification for ONAP Control Loop Policy v2.0.0.
-
-# Create Builder Object
-
-To begin with, the ControlLoopPolicyBuilder.Factory class has static methods that one should use to begin building a Control Loop Policy. It will return a [ControlLoopPolicyBuilder object](src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java) that can then be used to continue to build and define the Control Loop Policy.
-
-```java
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(
- UUID.randomUUID().toString(),
- 2400,
- new Resource("sampleResource", ResourceType.VF),
- new Service("sampleService")
- );
-```
-
-# Define the Trigger Policy
-
-After the name of the Control Loop and the resource and services have been defined, the next step would be to define the Operation Policy that is first to respond to an incoming DCAE Closed Loop Event. Use the setTriggerPolicy() method to do so.
-
-```java
- Policy triggerPolicy = builder.setTriggerPolicy(
- "Restart the VM",
- "Upon getting the trigger event, restart the VM",
- "APPC",
- new Target(TargetType.VM),
- "Restart",
- null,
- 2,
- 300);
-```
-
-# Set the Abatement Flag for the Control Loop
-
-After the trigger policy, the name, the resource(s) and services of the Control Loop have been defined, the next optional step would be to set the abatement flag that indicates whether DCAE will send Policy the abatement event for this Control Loop. If the abatement is not explicitly set, it is assumed that Policy will not receive the abatement event. Use the setAbatement() method to do so.
-
-```java
- builder = builder.setAbatement(false);
-```
-
-# Chain Operational Policies Together Using Operational Results
-
-Operational Policies are chained together using the results of each Operational Policy. The results are defined in [PolicyResult.java](src/main/java/org/onap/policy/controlloop/policy/PolicyResult.java). To create an Operational Policy that is tied to the result of another, use the
-setPolicyForPolicyResult() method.
-
-```java
- Policy onRestartFailurePolicy = builder.setPolicyForPolicyResult(
- "Rebuild VM",
- "If the restart fails, rebuild it.",
- "APPC",
- new Target(TargetType.VM),
- "Rebuild",
- null,
- 1,
- 600,
- triggerPolicy.id,
- PolicyResult.FAILURE,
- PolicyResult.FAILURE_RETRIES,
- PolicyResult.FAILURE_TIMEOUT,
- PolicyResult.FAILURE_GUARD);
-```
-
-An Operational Policy MUST have place to go for every one of its results. By default, each result type goes to a Final Result. Optionally, using the setPolicyForPolicyResult() method is what allows the chaining of policies. Be aware of creating loops and set the overall Control Loop timeout to reasonable value. All paths MUST lead to a Final Result.
-
-
-
-# Build the YAML Specification
-
-When finished defining the Policies, build the specification and analyze the [Results.java](src/main/java/org/onap/policy/controlloop/policy/builder/Results.java)
-
-```java
- Results results = builder.buildSpecification();
- if (results.isValid()) {
- System.out.println(results.getSpecification());
- } else {
- System.err.println("Builder failed");
- for (Message message : results.getMessages()) {
- System.err.println(message.getMessage());
- }
- }
-```
-
-
-# Use the YAML Specification to call the Create Policy API
-
-Now that you have a valid YAML specification, call the createPolicy API via the ONAP Policy Platform API.
-
-
-# YAML Specification
-
-The YAML specification has 2 sections to it: [controlLoop](#controlloop-object) and [policies](#policies-array). The [controlLoop section](#controlloop-object) section is simply a header defining the Control Loop Policy, what services its for, which resource its for, or if its for a pnf, the overall timeout, the abatement flag, and which Operational Policy is triggered upon receiving the event. The [policies section](#policies-array) is simply an array of [Policy Objects](#policy-object).
-
-## controlLoop Object
-
-| Field Name | Type | Required | Description |
-| ------------- |:-------------:| -----------| ------------:|
-| controlLoopName | string | required | Unique ID for the control Loop |
-| version | string | required | Value for this release if 1.0.0 |
-| services | array of [service](#service-object) objects | optional | Zero or more services associated with this Control Loop |
-| resources | array of [resource](#resource-object) object | required (If NOT a pnf control loop) | The resource's associated with this Control Loop. |
-| pnf | [pnf](#pnf-object) object | required (If NOT a resource control loop) | The physical network function associated with this Control Loop. |
-| trigger_policy | string | required | Either this is the ID of an Operation Policy (see policy object), or "Final_OpenLoop" indicating an Open Loop |
-| timeout | int | required | This is the overall timeout for the Control Loop Policy. It can be 0 for an Open Loop, but otherwise should total more than the timeouts specified in any Operational Policies |
-| abatement | boolean | optional | This is an abatement flag indicating if DCAE will send abatement event to Policy for this Control Loop |
-
-### resource Object
-
-This object was derived via SDC Catalog API and SDC Data Dictionary (POC) in an attempt to use common naming conventions.
-
-| Field Name | Type | Required | Description |
-| ------------- |:-------------:| -----------| ------------:|
-| resourceInvariantUUID | string - UUID | optional | via SDC, the unique ID for the resource version |
-| resourceName | string | required if NO resourceUUID available | Name of the resource, ideally from SDC catalog. But if not available, use well-known name. |
-| resourceType | string | optional | Use values defined by SDC: VF, VFC, VL, CP. |
-| resourceUUID | string - UUID | required IF available, else populate resourceName | Unique ID for the resource as assigned via SDC.
-| resourceVersion | string | optional | string version of the resource via SDC catalog
-
-
-### service Object
-
-This object was derived via SDC Catalog API and SDC Data Dictionary (POC) in an attempt to use common naming conventions.
-
-| Field Name | Type | Required | Description |
-| ---------------:| -------------:| ----------:| ------------:|
-| serviceInvariantUUID | string - UUID | optional | via SDC catalog, the unique ID for the service version |
-| serviceName | string | required if NO serviceUUID available | Name of the service, ideally from SDC catalog. But if not available, use well-known name. |
-| serviceUUID | string - UUID | required IF available, else populate serviceName | Unique ID fort he service as assigned via SDC
-| serviceVersion | string | optional | string version of the service via SDC catalog
-
-
-### pnf Object
-
-This object is used for a physical network function. Expect this object to change in the future when ONAP Policy fully integrates with A&AI.
-
-| Field Name | Type | Required | Description |
-| ------------- |:-------------:| -----------| ------------:|
-| PNFName | string | required | Name of the PNF. Should be supplied via A&AI. If not available use a well-known name. |
-| PNFType | string | optional | Type of PNF if available. |
-
-
-## policies array
-
-The policies section is an array of [Policy objects](#policy-object).
-
-### Policy Object
-
-This is an Operation Policy. It is used to instruct an actor (eg. APPC) to invoke a recipe (eg. "Restart") on a target entity (eg. a "VM"). An operation is simply defined as performing a recipe (or operation) on an actor.
-
-| Field Name | Type | Required | Description |
-| ------------- |:-------------:| -----------| ------------:|
-| id | string | required | Unique ID for the policy.
-| name | string | required | Policy name |
-| description | string | optional | Policy description |
-| actor | string | required | Name of the actor for this operation: Example: APPC |
-| recipe | string | required | Name of recipe to be performed. Example "Restart" |
-| target | [target](#target-object) object | required | Entity being targeted. Example: VM |
-| timeout | int | required | Timeout for the actor to perform the recipe. |
-| retry | int | optional | Optional number of retries for ONAP Policy to invoke the recipe on the actor. |
-| success | string | required | By default, this value should be FINAL_SUCCESS. Otherwise this can be the ID of the operational Policy (included in this specification) to invoke upon successfully completing the recipe on the actor.
-| failure | string | required | By default, this value should be FINAL_FAILURE. Otherwise this can be the ID of the operational Policy (included in this specification) to invoke upon failure to perform the operation. |
-| failure_exception | string | required | By default, this value should be FINAL_FAILURE_EXCEPTION. Otherwise this can be the ID of an Operational Policy (included in this specification) to invoke upon an exception occurring while attempting to perform the operation. |
-| failure_retries | string | required | By default, this value should be the FINAL_FAILURE_RETRIES. Otherwise this can be the ID of an Operational Policy (included in this specification) to invoke upon maxing out on retries while attempting to perform the operation. |
-| failure_timeout | string | required | By default, this value should be FINAL_FAILURE_TIMEOUT. Otherwise this can be the ID of the operational Policy (included in this specification) to invoke upon a timeout occuring while performing an operation. |
-| failure_guard | string | required | By default, this value should be FINAL_FAILURE_GUARD. Otherwise this can be the ID of the operational Policy (included in this specification) to invoke upon Guard denies this operation. |
-
-Every Operational Policy MUST have a place to go for every possible result (success, failure, failure_retries, failure_timeout, failure_exception, failure_guard). By default, all the results are final results.
-
-#### target Object
-
-This object is used for defining a target entity of a recipe.
-
-| Field Name | Type | Required | Description |
-| ------------- |:-------------:| -----------| ------------:|
-| type | enums of VM, PNF and VNC | required | Type of the target. |
-| resourceID | string | optional | Resource ID of the target. Should be supplied via SDC Catalog. |
-
-
-## Examples of YAML Control Loops v2.0.0
-
-[vService](src/test/resources/v2.0.0/policy_vService.yaml)
-[ONAP-vFirewall](src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml)
-[ONAP-vDNS](src/test/resources/v2.0.0/policy_ONAP_demo_vDNS.yaml)
-
-### vService
-```
-controlLoop:
- version: 2.0.0
- controlLoopName: ControlLoop-vService-cbed919f-2212-4ef7-8051-fe6308da1bda
- services:
- - serviceName: service1
- resources:
- - resourceName: resource1
- resourceType: VFC
- - resourceName: resource2
- resourceType: VFC
- - resourceName: resource3
- resourceType: VFC
- - resourceName: resource4
- resourceType: VFC
- - resourceName: resource5
- resourceType: VFC
- trigger_policy: unique-policy-id-1-restart
- timeout: 1200
- 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: 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-rebuild
- name: Rebuild Policy
- description:
- actor: APPC
- recipe: Rebuild
- target:
- type: 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
- 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
-```
-
-
-
-### ONAP vFirewall
-```
-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
- 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}
- streams: '{"active-streams":5}'
- 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
-```
-
-### ONAP vDNS
-```
-controlLoop:
- version: 2.0.0
- controlLoopName: ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
- trigger_policy: unique-policy-id-1-scale-up
- timeout: 1200
- abatement: false
-
-policies:
- - id: unique-policy-id-1-scale-up
- name: Create a new VF Module
- description:
- actor: SO
- recipe: VF Module Create
- target:
- type: VNF
- payload:
- requestParameters: '{"usePreload":true,"userParams":[]}'
- configurationParameters: '[{"ip-addr":"$.vf-module-topology.vf-module-parameters.param[9]","oam-ip-addr":"$.vf-module-topology.vf-module-parameters.param[16]","enabled":"$.vf-module-topology.vf-module-parameters.param[23]"}]'
- retry: 0
- timeout: 1200
- success: final_success
- failure: final_failure
- failure_timeout: final_failure_timeout
- failure_retries: final_failure_retries
- failure_exception: final_failure_exception
- failure_guard: final_failure_guard
-```
-
-
-# Control Loop Final Results Explained
-
-A Control Loop Policy has the following set of final results, as defined in [FinalResult.java](src/main/java/org/onap/policy/controlloop/policy/FinalResult.java). A final result indicates when a Control Loop Policy has finished execution and is finished processing a Closed Loop Event. All paths must lead to a Final Result.
-
diff --git a/models-interactions/model-yaml/checkstyle-suppressions.xml b/models-interactions/model-yaml/checkstyle-suppressions.xml
deleted file mode 100644
index eda812fdb..000000000
--- a/models-interactions/model-yaml/checkstyle-suppressions.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- Copyright (C) 2018 AT&T Technologies. 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.
-
- SPDX-License-Identifier: Apache-2.0
- ============LICENSE_END=========================================================
--->
-
-<!DOCTYPE suppressions PUBLIC
- "-//Puppy Crawl//DTD Suppressions 1.0//EN"
- "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
-
-<suppressions>
- <suppress checks="AbbreviationAsWordInName"
- files="Target.java|ControlLoopPolicyBuilder.java"
- lines="1-9999"/>
-</suppressions>
diff --git a/models-interactions/model-yaml/pom.xml b/models-interactions/model-yaml/pom.xml
deleted file mode 100644
index 438b29ce8..000000000
--- a/models-interactions/model-yaml/pom.xml
+++ /dev/null
@@ -1,140 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- ONAP
- ================================================================================
- Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019-2020 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=========================================================
- -->
-
-<project
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.policy.models</groupId>
- <artifactId>policy-models-interactions</artifactId>
- <version>2.3.1-SNAPSHOT</version>
- </parent>
-
- <groupId>org.onap.policy.models.policy-models-interactions</groupId>
- <artifactId>model-yaml</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jgrapht</groupId>
- <artifactId>jgrapht-core</artifactId>
- <version>1.2.0</version>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
- <artifactId>sdc</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
- <artifactId>aai</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>utils-test</artifactId>
- <version>${policy.common.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <!--
- Without this defined here, the checkstyle plugin just simply fails outright. This needs to be investigated
- further as there was no real debugging details as to why or any configuration issue detected.
- NOTE: I had to append src/main/java to the sourceDirectory.
- Is it a reactor ordering issue? I'm wondering why it is being compiled after aai, in between the sub-modules
- in model-impl. Dependency ordering?? Circular dependency??
- -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <executions>
- <execution>
- <id>onap-java-style</id>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>process-sources</phase>
- <configuration>
- <!-- Use Google Java Style Guide:
- https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
- with minor changes -->
- <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
- <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
- <sourceDirectories>${project.build.sourceDirectory}</sourceDirectories>
- <includeResources>true</includeResources>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
- <includeTestResources>true</includeTestResources>
- <excludes>
- </excludes>
- <suppressionsLocation>${project.basedir}/checkstyle-suppressions.xml</suppressionsLocation>
- <consoleOutput>true</consoleOutput>
- <failsOnViolation>true</failsOnViolation>
- <violationSeverity>warning</violationSeverity>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.onap.oparent</groupId>
- <artifactId>checkstyle</artifactId>
- <version>${oparent.version}</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/compiler/CompilerException.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/compiler/CompilerException.java
deleted file mode 100644
index e064750a4..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/compiler/CompilerException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * Copyright (C) 2017 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;
-
-public class CompilerException extends Exception {
-
- private static final long serialVersionUID = -7262217239867898601L;
-
- public CompilerException() {
- }
-
- public CompilerException(String message) {
- super(message);
- }
-
- public CompilerException(Throwable cause) {
- super(cause);
- }
-
- public CompilerException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public CompilerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
- super(message, cause, enableSuppression, writableStackTrace);
- }
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/compiler/ControlLoopCompiler.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/compiler/ControlLoopCompiler.java
deleted file mode 100644
index 5204a1b7f..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/compiler/ControlLoopCompiler.java
+++ /dev/null
@@ -1,695 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * Copyright (C) 2017-2019 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 java.io.InputStream;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import org.apache.commons.lang3.StringUtils;
-import org.jgrapht.Graph;
-import org.jgrapht.graph.ClassBasedEdgeFactory;
-import org.jgrapht.graph.DefaultEdge;
-import org.jgrapht.graph.DirectedMultigraph;
-import org.onap.policy.controlloop.policy.ControlLoop;
-import org.onap.policy.controlloop.policy.ControlLoopPolicy;
-import org.onap.policy.controlloop.policy.FinalResult;
-import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.controlloop.policy.PolicyResult;
-import org.onap.policy.controlloop.policy.TargetType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.constructor.Constructor;
-
-
-public class ControlLoopCompiler implements Serializable {
- private static final String OPERATION_POLICY = "Operation Policy ";
- private static final long serialVersionUID = 1L;
- private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopCompiler.class.getName());
-
- /**
- * Compiles the policy from an object.
- */
- public static ControlLoopPolicy compile(ControlLoopPolicy policy,
- ControlLoopCompilerCallback callback) throws CompilerException {
- //
- // Ensure the control loop is sane
- //
- validateControlLoop(policy.getControlLoop(), callback);
- //
- // Validate the policies
- //
- validatePolicies(policy, callback);
-
- return policy;
- }
-
- /**
- * Compiles the policy from an input stream.
- *
- * @param yamlSpecification the yaml input stream
- * @param callback method to callback during compilation
- * @return Control Loop object
- * @throws CompilerException throws any compile exception found
- */
- public static ControlLoopPolicy compile(InputStream yamlSpecification,
- ControlLoopCompilerCallback callback) throws CompilerException {
- Yaml yaml = new Yaml(new Constructor(ControlLoopPolicy.class));
- Object obj = yaml.load(yamlSpecification);
- if (obj == null) {
- throw new CompilerException("Could not parse yaml specification.");
- }
- if (! (obj instanceof ControlLoopPolicy)) {
- throw new CompilerException("Yaml could not parse specification into required ControlLoopPolicy object");
- }
- return ControlLoopCompiler.compile((ControlLoopPolicy) obj, callback);
- }
-
- private static void validateControlLoop(ControlLoop controlLoop,
- ControlLoopCompilerCallback callback) throws CompilerException {
- if (controlLoop == null && callback != null) {
- callback.onError("controlLoop cannot be null");
- }
- if (controlLoop != null) {
- if (StringUtils.isEmpty(controlLoop.getControlLoopName()) && callback != null) {
- callback.onError("Missing controlLoopName");
- }
- if ((!controlLoop.getVersion().contentEquals(ControlLoop.getCompilerVersion())) && callback != null) {
- callback.onError("Unsupported version for this compiler");
- }
- if (StringUtils.isEmpty(controlLoop.getTrigger_policy())) {
- throw new CompilerException("trigger_policy is not valid");
- }
- }
- }
-
- private static void validatePolicies(ControlLoopPolicy policy,
- ControlLoopCompilerCallback callback) throws CompilerException {
- if (policy == null) {
- throw new CompilerException("policy cannot be null");
- }
- if (policy.getPolicies() == null) {
- callback.onWarning("controlLoop is an open loop.");
- } else {
- //
- // For this version we can use a directed multigraph, in the future we may not be able to
- //
- Graph<NodeWrapper, LabeledEdge> graph =
- new DirectedMultigraph<>(new ClassBasedEdgeFactory<NodeWrapper,
- LabeledEdge>(LabeledEdge.class));
- //
- // Check to see if the trigger Event is for OpenLoop, we do so by
- // attempting to create a FinalResult object from it. If its a policy id, this should
- // return null.
- //
- FinalResult triggerResult = FinalResult.toResult(policy.getControlLoop().getTrigger_policy());
- TriggerNodeWrapper triggerNode;
- //
- // Did this turn into a FinalResult object?
- //
- if (triggerResult != null) {
- validateOpenLoopPolicy(policy, triggerResult, callback);
- return;
- //
- } else {
- validatePoliciesContainTriggerPolicyAndCombinedTimeoutIsOk(policy, callback);
- triggerNode = new TriggerNodeWrapper(policy.getControlLoop().getControlLoopName());
- }
- //
- // Add in the trigger node
- //
- graph.addVertex(triggerNode);
- //
- // Add in our Final Result nodes. All paths should end to these nodes.
- //
- FinalResultNodeWrapper finalSuccess = new FinalResultNodeWrapper(FinalResult.FINAL_SUCCESS);
- FinalResultNodeWrapper finalFailure = new FinalResultNodeWrapper(FinalResult.FINAL_FAILURE);
- FinalResultNodeWrapper finalFailureTimeout = new FinalResultNodeWrapper(FinalResult.FINAL_FAILURE_TIMEOUT);
- FinalResultNodeWrapper finalFailureRetries = new FinalResultNodeWrapper(FinalResult.FINAL_FAILURE_RETRIES);
- FinalResultNodeWrapper finalFailureException =
- new FinalResultNodeWrapper(FinalResult.FINAL_FAILURE_EXCEPTION);
- FinalResultNodeWrapper finalFailureGuard = new FinalResultNodeWrapper(FinalResult.FINAL_FAILURE_GUARD);
- graph.addVertex(finalSuccess);
- graph.addVertex(finalFailure);
- graph.addVertex(finalFailureTimeout);
- graph.addVertex(finalFailureRetries);
- graph.addVertex(finalFailureException);
- graph.addVertex(finalFailureGuard);
- //
- // Work through the policies and add them in as nodes.
- //
- Map<Policy, PolicyNodeWrapper> mapNodes = addPoliciesAsNodes(policy, graph, triggerNode, callback);
- //
- // last sweep to connect remaining edges for policy results
- //
- for (Policy operPolicy : policy.getPolicies()) {
- PolicyNodeWrapper node = mapNodes.get(operPolicy);
- //
- // Just ensure this has something
- //
- if (node == null) {
- continue;
- }
- addEdge(graph, mapNodes, operPolicy.getId(), operPolicy.getSuccess(), finalSuccess,
- PolicyResult.SUCCESS, node);
- addEdge(graph, mapNodes, operPolicy.getId(), operPolicy.getFailure(), finalFailure,
- PolicyResult.FAILURE, node);
- addEdge(graph, mapNodes, operPolicy.getId(), operPolicy.getFailure_timeout(), finalFailureTimeout,
- PolicyResult.FAILURE_TIMEOUT, node);
- addEdge(graph, mapNodes, operPolicy.getId(), operPolicy.getFailure_retries(), finalFailureRetries,
- PolicyResult.FAILURE_RETRIES, node);
- addEdge(graph, mapNodes, operPolicy.getId(), operPolicy.getFailure_exception(), finalFailureException,
- PolicyResult.FAILURE_EXCEPTION, node);
- addEdge(graph, mapNodes, operPolicy.getId(), operPolicy.getFailure_guard(), finalFailureGuard,
- PolicyResult.FAILURE_GUARD, node);
- }
- validateNodesAndEdges(graph, callback);
- }
- }
-
- private static void validateOpenLoopPolicy(ControlLoopPolicy policy, FinalResult triggerResult,
- ControlLoopCompilerCallback callback) throws CompilerException {
- //
- // Ensure they didn't use some other FinalResult code
- //
- if (triggerResult != FinalResult.FINAL_OPENLOOP) {
- throw new CompilerException("Unexpected Final Result for trigger_policy, should only be "
- + FinalResult.FINAL_OPENLOOP.toString() + " or a valid Policy ID");
- }
- //
- // They really shouldn't have any policies attached.
- //
- if ((policy.getPolicies() != null || policy.getPolicies().isEmpty()) && callback != null) {
- callback.onWarning("Open Loop policy contains policies. The policies will never be invoked.");
- }
- }
-
- private static void validatePoliciesContainTriggerPolicyAndCombinedTimeoutIsOk(ControlLoopPolicy policy,
- ControlLoopCompilerCallback callback) throws CompilerException {
- int sum = 0;
- boolean triggerPolicyFound = false;
- for (Policy operPolicy : policy.getPolicies()) {
- sum += operPolicy.getTimeout().intValue();
- if (policy.getControlLoop().getTrigger_policy().equals(operPolicy.getId())) {
- triggerPolicyFound = true;
- }
- }
- if (policy.getControlLoop().getTimeout().intValue() < sum && callback != null) {
- callback.onError("controlLoop overall timeout is less than the sum of operational policy timeouts.");
- }
-
- if (!triggerPolicyFound) {
- throw new CompilerException("Unexpected value for trigger_policy, should only be "
- + FinalResult.FINAL_OPENLOOP.toString() + " or a valid Policy ID");
- }
- }
-
- private static Map<Policy, PolicyNodeWrapper> addPoliciesAsNodes(ControlLoopPolicy policy,
- Graph<NodeWrapper, LabeledEdge> graph, TriggerNodeWrapper triggerNode,
- ControlLoopCompilerCallback callback) {
- Map<Policy, PolicyNodeWrapper> mapNodes = new HashMap<>();
- for (Policy operPolicy : policy.getPolicies()) {
- //
- // Is it still ok to add?
- //
- if (!okToAdd(operPolicy, callback)) {
- //
- // Do not add it in
- //
- continue;
- }
- //
- // Create wrapper policy node and save it into our map so we can
- // easily retrieve it.
- //
- PolicyNodeWrapper node = new PolicyNodeWrapper(operPolicy);
- mapNodes.put(operPolicy, node);
- graph.addVertex(node);
- //
- // Is this the trigger policy?
- //
- if (operPolicy.getId().equals(policy.getControlLoop().getTrigger_policy())) {
- //
- // Yes add an edge from our trigger event node to this policy
- //
- graph.addEdge(triggerNode, node, new LabeledEdge(triggerNode, node, new TriggerEdgeWrapper("ONSET")));
- }
- }
- return mapNodes;
- }
-
- private static void addEdge(Graph<NodeWrapper, LabeledEdge> graph, Map<Policy, PolicyNodeWrapper> mapNodes,
- String policyId, String connectedPolicy,
- FinalResultNodeWrapper finalResultNodeWrapper,
- PolicyResult policyResult, NodeWrapper node) throws CompilerException {
- FinalResult finalResult = FinalResult.toResult(finalResultNodeWrapper.getId());
- if (FinalResult.isResult(connectedPolicy, finalResult)) {
- graph.addEdge(node, finalResultNodeWrapper, new LabeledEdge(node, finalResultNodeWrapper,
- new FinalResultEdgeWrapper(finalResult)));
- } else {
- PolicyNodeWrapper toNode = findPolicyNode(mapNodes, connectedPolicy);
- if (toNode == null) {
- throw new CompilerException(OPERATION_POLICY + policyId + " is connected to unknown policy "
- + connectedPolicy);
- } else {
- graph.addEdge(node, toNode, new LabeledEdge(node, toNode, new PolicyResultEdgeWrapper(policyResult)));
- }
- }
- }
-
- private static void validateNodesAndEdges(Graph<NodeWrapper, LabeledEdge> graph,
- ControlLoopCompilerCallback callback) throws CompilerException {
- for (NodeWrapper node : graph.vertexSet()) {
- if (node instanceof TriggerNodeWrapper) {
- validateTriggerNodeWrapper(graph, node);
- } else if (node instanceof FinalResultNodeWrapper) {
- validateFinalResultNodeWrapper(graph, node);
- } else if (node instanceof PolicyNodeWrapper) {
- validatePolicyNodeWrapper(graph, node, callback);
- }
- for (LabeledEdge edge : graph.outgoingEdgesOf(node)) {
- LOGGER.info("{} invokes {} upon {}", edge.from.getId(), edge.to.getId(), edge.edge.getId());
- }
- }
- }
-
- private static void validateTriggerNodeWrapper(Graph<NodeWrapper, LabeledEdge> graph,
- NodeWrapper node) throws CompilerException {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.info("Trigger Node {}", node);
- }
- if (graph.inDegreeOf(node) > 0) {
- //
- // Really should NEVER get here unless someone messed up the code above.
- //
- throw new CompilerException("No inputs to event trigger");
- }
- //
- // Should always be 1, except in the future we may support multiple events
- //
- if (graph.outDegreeOf(node) > 1) {
- throw new CompilerException("The event trigger should only go to ONE node");
- }
- }
-
- private static void validateFinalResultNodeWrapper(Graph<NodeWrapper, LabeledEdge> graph,
- NodeWrapper node) throws CompilerException {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.info("FinalResult Node {}", node);
- }
- //
- // FinalResult nodes should NEVER have an out edge
- //
- if (graph.outDegreeOf(node) > 0) {
- throw new CompilerException("FinalResult nodes should never have any out edges.");
- }
- }
-
- private static void validatePolicyNodeWrapper(Graph<NodeWrapper, LabeledEdge> graph,
- NodeWrapper node, ControlLoopCompilerCallback callback) throws CompilerException {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.info("Policy Node {}", node);
- }
- //
- // All Policy Nodes should have the 5 out degrees defined.
- //
- if (graph.outDegreeOf(node) != 6) {
- throw new CompilerException("Policy node should ALWAYS have 6 out degrees.");
- }
- //
- // All Policy Nodes should have at least 1 in degrees
- //
- if (graph.inDegreeOf(node) == 0 && callback != null) {
- callback.onWarning("Policy " + node.getId() + " is not reachable.");
- }
- }
-
- private static boolean okToAdd(Policy operPolicy, ControlLoopCompilerCallback callback) {
- boolean isOk = isPolicyIdOk(operPolicy, callback);
- if (! isActorOk(operPolicy, callback)) {
- isOk = false;
- }
- if (! isRecipeOk(operPolicy, callback)) {
- isOk = false;
- }
- if (! isTargetOk(operPolicy, callback)) {
- isOk = false;
- }
- if (! arePolicyResultsOk(operPolicy, callback)) {
- isOk = false;
- }
- return isOk;
- }
-
- private static boolean isPolicyIdOk(Policy operPolicy, ControlLoopCompilerCallback callback) {
- boolean isOk = true;
- if (operPolicy.getId() == null || operPolicy.getId().length() < 1) {
- if (callback != null) {
- callback.onError("Operational Policy has an bad ID");
- }
- isOk = false;
- } else {
- //
- // Check if they decided to make the ID a result object
- //
- if (PolicyResult.toResult(operPolicy.getId()) != null) {
- if (callback != null) {
- callback.onError("Policy id is set to a PolicyResult " + operPolicy.getId());
- }
- isOk = false;
- }
- if (FinalResult.toResult(operPolicy.getId()) != null) {
- if (callback != null) {
- callback.onError("Policy id is set to a FinalResult " + operPolicy.getId());
- }
- isOk = false;
- }
- }
- return isOk;
- }
-
- private static boolean isActorOk(Policy operPolicy, ControlLoopCompilerCallback callback) {
- if (StringUtils.isBlank(operPolicy.getActor())) {
- if (callback != null) {
- callback.onError("Policy actor is null");
- }
- return false;
- }
- return true;
- }
-
- private static boolean isRecipeOk(Policy operPolicy, ControlLoopCompilerCallback callback) {
- if (StringUtils.isBlank(operPolicy.getRecipe())) {
- if (callback != null) {
- callback.onError("Policy recipe is null");
- }
- return false;
- }
- return true;
- }
-
- private static boolean isTargetOk(Policy operPolicy, ControlLoopCompilerCallback callback) {
- boolean isOk = true;
- if (operPolicy.getTarget() == null) {
- if (callback != null) {
- callback.onError("Policy target is null");
- }
- isOk = false;
- }
- if (operPolicy.getTarget() != null
- && operPolicy.getTarget().getType() != TargetType.VM
- && operPolicy.getTarget().getType() != TargetType.VFC
- && operPolicy.getTarget().getType() != TargetType.PNF) {
- if (callback != null) {
- callback.onError("Policy target is invalid");
- }
- isOk = false;
- }
- return isOk;
- }
-
- private static boolean arePolicyResultsOk(Policy operPolicy, ControlLoopCompilerCallback callback) {
- //
- // Check that policy results are connected to either default final * or another policy
- //
- boolean isOk = isSuccessPolicyResultOk(operPolicy, callback);
- if (! isFailurePolicyResultOk(operPolicy, callback)) {
- isOk = false;
- }
- if (! isFailureRetriesPolicyResultOk(operPolicy, callback)) {
- isOk = false;
- }
- if (! isFailureTimeoutPolicyResultOk(operPolicy, callback)) {
- isOk = false;
- }
- if (! isFailureExceptionPolicyResultOk(operPolicy, callback)) {
- isOk = false;
- }
- if (! isFailureGuardPolicyResultOk(operPolicy, callback)) {
- isOk = false;
- }
- return isOk;
- }
-
- private static boolean isSuccessPolicyResultOk(Policy operPolicy, ControlLoopCompilerCallback callback) {
- if (FinalResult.toResult(operPolicy.getSuccess()) != null
- && !operPolicy.getSuccess().equals(FinalResult.FINAL_SUCCESS.toString())) {
- if (callback != null) {
- callback.onError("Policy success is neither another policy nor FINAL_SUCCESS");
- }
- return false;
- }
- return true;
- }
-
- private static boolean isFailurePolicyResultOk(Policy operPolicy, ControlLoopCompilerCallback callback) {
- if (FinalResult.toResult(operPolicy.getFailure()) != null
- && !operPolicy.getFailure().equals(FinalResult.FINAL_FAILURE.toString())) {
- if (callback != null) {
- callback.onError("Policy failure is neither another policy nor FINAL_FAILURE");
- }
- return false;
- }
- return true;
- }
-
- private static boolean isFailureRetriesPolicyResultOk(Policy operPolicy, ControlLoopCompilerCallback callback) {
- if (FinalResult.toResult(operPolicy.getFailure_retries()) != null
- && !operPolicy.getFailure_retries().equals(FinalResult.FINAL_FAILURE_RETRIES.toString())) {
- if (callback != null) {
- callback.onError("Policy failure retries is neither another policy nor FINAL_FAILURE_RETRIES");
- }
- return false;
- }
- return true;
- }
-
- private static boolean isFailureTimeoutPolicyResultOk(Policy operPolicy, ControlLoopCompilerCallback callback) {
- if (FinalResult.toResult(operPolicy.getFailure_timeout()) != null
- && !operPolicy.getFailure_timeout().equals(FinalResult.FINAL_FAILURE_TIMEOUT.toString())) {
- if (callback != null) {
- callback.onError("Policy failure timeout is neither another policy nor FINAL_FAILURE_TIMEOUT");
- }
- return false;
- }
- return true;
- }
-
- private static boolean isFailureExceptionPolicyResultOk(Policy operPolicy, ControlLoopCompilerCallback callback) {
- if (FinalResult.toResult(operPolicy.getFailure_exception()) != null
- && !operPolicy.getFailure_exception().equals(FinalResult.FINAL_FAILURE_EXCEPTION.toString())) {
- if (callback != null) {
- callback.onError("Policy failure exception is neither another policy nor FINAL_FAILURE_EXCEPTION");
- }
- return false;
- }
- return true;
- }
-
- private static boolean isFailureGuardPolicyResultOk(Policy operPolicy, ControlLoopCompilerCallback callback) {
- if (FinalResult.toResult(operPolicy.getFailure_guard()) != null
- && !operPolicy.getFailure_guard().equals(FinalResult.FINAL_FAILURE_GUARD.toString())) {
- if (callback != null) {
- callback.onError("Policy failure guard is neither another policy nor FINAL_FAILURE_GUARD");
- }
- return false;
- }
- return true;
- }
-
- private static PolicyNodeWrapper findPolicyNode(Map<Policy, PolicyNodeWrapper> mapNodes, String id) {
- for (Entry<Policy, PolicyNodeWrapper> entry : mapNodes.entrySet()) {
- if (entry.getKey().getId().equals(id)) {
- return entry.getValue();
- }
- }
- return null;
- }
-
- @FunctionalInterface
- private interface NodeWrapper extends Serializable {
- public String getId();
- }
-
- private static class TriggerNodeWrapper implements NodeWrapper {
- private static final long serialVersionUID = -187644087811478349L;
- private String closedLoopControlName;
-
- public TriggerNodeWrapper(String closedLoopControlName) {
- this.closedLoopControlName = closedLoopControlName;
- }
-
- @Override
- public String toString() {
- return "TriggerNodeWrapper [closedLoopControlName=" + closedLoopControlName + "]";
- }
-
- @Override
- public String getId() {
- return closedLoopControlName;
- }
-
- }
-
- private static class FinalResultNodeWrapper implements NodeWrapper {
- private static final long serialVersionUID = 8540008796302474613L;
- private FinalResult result;
-
- public FinalResultNodeWrapper(FinalResult result) {
- this.result = result;
- }
-
- @Override
- public String toString() {
- return "FinalResultNodeWrapper [result=" + result + "]";
- }
-
- @Override
- public String getId() {
- return result.toString();
- }
- }
-
- private static class PolicyNodeWrapper implements NodeWrapper {
- private static final long serialVersionUID = 8170162175653823082L;
- private transient Policy policy;
-
- public PolicyNodeWrapper(Policy operPolicy) {
- this.policy = operPolicy;
- }
-
- @Override
- public String toString() {
- return "PolicyNodeWrapper [policy=" + policy + "]";
- }
-
- @Override
- public String getId() {
- return policy.getId();
- }
- }
-
- @FunctionalInterface
- private interface EdgeWrapper extends Serializable {
- public String getId();
-
- }
-
- private static class TriggerEdgeWrapper implements EdgeWrapper {
- private static final long serialVersionUID = 2678151552623278863L;
- private String trigger;
-
- public TriggerEdgeWrapper(String trigger) {
- this.trigger = trigger;
- }
-
- @Override
- public String getId() {
- return trigger;
- }
-
- @Override
- public String toString() {
- return "TriggerEdgeWrapper [trigger=" + trigger + "]";
- }
-
- }
-
- private static class PolicyResultEdgeWrapper implements EdgeWrapper {
- private static final long serialVersionUID = 6078569477021558310L;
- private PolicyResult policyResult;
-
- public PolicyResultEdgeWrapper(PolicyResult policyResult) {
- super();
- this.policyResult = policyResult;
- }
-
- @Override
- public String toString() {
- return "PolicyResultEdgeWrapper [policyResult=" + policyResult + "]";
- }
-
- @Override
- public String getId() {
- return policyResult.toString();
- }
-
-
- }
-
- private static class FinalResultEdgeWrapper implements EdgeWrapper {
- private static final long serialVersionUID = -1486381946896779840L;
- private FinalResult finalResult;
-
- public FinalResultEdgeWrapper(FinalResult result) {
- this.finalResult = result;
- }
-
- @Override
- public String toString() {
- return "FinalResultEdgeWrapper [finalResult=" + finalResult + "]";
- }
-
- @Override
- public String getId() {
- return finalResult.toString();
- }
- }
-
-
- private static class LabeledEdge extends DefaultEdge {
- private static final long serialVersionUID = 579384429573385524L;
-
- private NodeWrapper from;
- private NodeWrapper to;
- private EdgeWrapper edge;
-
- public LabeledEdge(NodeWrapper from, NodeWrapper to, EdgeWrapper edge) {
- this.from = from;
- this.to = to;
- this.edge = edge;
- }
-
- @SuppressWarnings("unused")
- public NodeWrapper from() {
- return from;
- }
-
- @SuppressWarnings("unused")
- public NodeWrapper to() {
- return to;
- }
-
- @SuppressWarnings("unused")
- public EdgeWrapper edge() {
- return edge;
- }
-
- @Override
- public String toString() {
- return "LabeledEdge [from=" + from + ", to=" + to + ", edge=" + edge + "]";
- }
- }
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/compiler/ControlLoopCompilerCallback.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/compiler/ControlLoopCompilerCallback.java
deleted file mode 100644
index e59ce3460..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/compiler/ControlLoopCompilerCallback.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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;
-
-public interface ControlLoopCompilerCallback {
-
- public boolean onWarning(String message);
-
- public boolean onError(String message);
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/guard/compiler/ControlLoopGuardCompiler.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/guard/compiler/ControlLoopGuardCompiler.java
deleted file mode 100644
index 6f49f6a44..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/guard/compiler/ControlLoopGuardCompiler.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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.guard.compiler;
-
-import java.io.InputStream;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.onap.policy.controlloop.compiler.CompilerException;
-import org.onap.policy.controlloop.compiler.ControlLoopCompilerCallback;
-import org.onap.policy.controlloop.policy.guard.Constraint;
-import org.onap.policy.controlloop.policy.guard.ControlLoopGuard;
-import org.onap.policy.controlloop.policy.guard.GuardPolicy;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.constructor.Constructor;
-
-public class ControlLoopGuardCompiler {
-
- private static final String GUARD_POLICIES_SHOULD_NOT_BE_NULL = "Guard policies should not be null";
- private static final String GUARD_POLICY = "Guard policy ";
-
- private ControlLoopGuardCompiler(){
- // Private Constructor
- }
-
- /**
- * Compile the control loop guard.
- *
- * @param clGuard the guard
- * @param callback callback routine
- * @return the guard object
- * @throws CompilerException compilation exception
- */
- public static ControlLoopGuard compile(ControlLoopGuard clGuard,
- ControlLoopCompilerCallback callback) throws CompilerException {
- //
- // Ensure ControlLoopGuard has at least one guard policies
- //
- validateControlLoopGuard(clGuard, callback);
- //
- // Ensure each guard policy has at least one constraints and all guard policies are unique
- //
- validateGuardPolicies(clGuard.getGuards(), callback);
- //
- // Ensure constraints for each guard policy are unique
- //
- validateConstraints(clGuard.getGuards(), callback);
-
- return clGuard;
- }
-
- /**
- * Compile the control loop guard.
- *
- * @param yamlSpecification yaml specification as a stream
- * @param callback callback method
- * @return guard object
- * @throws CompilerException throws compile exception
- */
- public static ControlLoopGuard compile(InputStream yamlSpecification,
- ControlLoopCompilerCallback callback) throws CompilerException {
- Yaml yaml = new Yaml(new Constructor(ControlLoopGuard.class));
- Object obj = yaml.load(yamlSpecification);
- if (obj == null) {
- throw new CompilerException("Could not parse yaml specification.");
- }
- if (! (obj instanceof ControlLoopGuard)) {
- throw new CompilerException("Yaml could not parse specification into required ControlLoopGuard object");
- }
- return ControlLoopGuardCompiler.compile((ControlLoopGuard) obj, callback);
- }
-
- private static void validateControlLoopGuard(ControlLoopGuard clGuard,
- ControlLoopCompilerCallback callback) throws CompilerException {
- if (clGuard == null) {
- if (callback != null) {
- callback.onError("ControlLoop Guard cannot be null");
- }
- throw new CompilerException("ControlLoop Guard cannot be null");
- }
- if (clGuard.getGuard() == null && callback != null) {
- callback.onError("Guard version cannot be null");
- }
- if (clGuard.getGuards() == null) {
- if (callback != null) {
- callback.onError("ControlLoop Guard should have at least one guard policies");
- }
- } else if (clGuard.getGuards().isEmpty() && callback != null) {
- callback.onError("ControlLoop Guard should have at least one guard policies");
- }
- }
-
- private static void validateGuardPolicies(List<GuardPolicy> policies,
- ControlLoopCompilerCallback callback) throws CompilerException {
- if (policies == null) {
- if (callback != null) {
- callback.onError(GUARD_POLICIES_SHOULD_NOT_BE_NULL);
- }
- throw new CompilerException(GUARD_POLICIES_SHOULD_NOT_BE_NULL);
- }
- //
- // Ensure all guard policies are unique
- //
- Set<GuardPolicy> newSet = new HashSet<>(policies);
- if (newSet.size() != policies.size() && callback != null) {
- callback.onWarning("There are duplicate guard policies");
- }
- //
- // Ensure each guard policy has at least one constraints
- //
- for (GuardPolicy policy : policies) {
- if (policy.getLimit_constraints() == null || policy.getLimit_constraints().isEmpty()) {
- if (callback != null) {
- callback.onError(GUARD_POLICY + policy.getName() + " does not have any limit constraint");
- }
- throw new CompilerException(GUARD_POLICY + policy.getName() + " does not have any limit constraint");
- }
- }
- }
-
- private static void validateConstraints(List<GuardPolicy> policies,
- ControlLoopCompilerCallback callback) throws CompilerException {
- if (policies == null) {
- if (callback != null) {
- callback.onError(GUARD_POLICIES_SHOULD_NOT_BE_NULL);
- }
- throw new CompilerException(GUARD_POLICIES_SHOULD_NOT_BE_NULL);
- }
- for (GuardPolicy policy : policies) {
- Set<Constraint> newSet = new HashSet<>(policy.getLimit_constraints());
- if (newSet.size() != policy.getLimit_constraints().size() && callback != null) {
- callback.onWarning(GUARD_POLICY + policy.getName() + " has duplicate limit constraints");
- }
- }
- }
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/ControlLoop.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/ControlLoop.java
deleted file mode 100644
index 256f8be4e..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/ControlLoop.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * Copyright (C) 2017-2019 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 java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-import org.onap.aai.domain.yang.Pnf;
-import org.onap.policy.sdc.Resource;
-import org.onap.policy.sdc.Service;
-
-public class ControlLoop implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private static final String COMPILER_VERSION = "2.0.0";
-
- private String controlLoopName;
- private String version = COMPILER_VERSION;
- private List<Service> services;
- private List<Resource> resources;
- private Pnf pnf;
- private String triggerPolicy = FinalResult.FINAL_OPENLOOP.toString();
- private Integer timeout;
- private Boolean abatement = false;
-
- public ControlLoop() {
- // Empty Constructor.
- }
-
- /**
- * Constructor.
- *
- * @param controlLoop copy object
- */
- public ControlLoop(ControlLoop controlLoop) {
- this.controlLoopName = controlLoop.controlLoopName;
- this.services = new LinkedList<>();
- if (controlLoop.services != null) {
- for (Service service : controlLoop.services) {
- this.services.add(service);
- }
- }
- this.resources = new LinkedList<>();
- if (controlLoop.resources != null) {
- for (Resource resource : controlLoop.resources) {
- this.resources.add(resource);
- }
- }
- this.triggerPolicy = controlLoop.triggerPolicy;
- this.timeout = controlLoop.timeout;
- this.abatement = controlLoop.abatement;
- }
-
- public static String getCompilerVersion() {
- return ControlLoop.COMPILER_VERSION;
- }
-
- public String getControlLoopName() {
- return controlLoopName;
- }
-
- public void setControlLoopName(String controlLoopName) {
- this.controlLoopName = controlLoopName;
- }
-
- public List<Service> getServices() {
- return services;
- }
-
- public void setServices(List<Service> services) {
- this.services = services;
- }
-
- public List<Resource> getResources() {
- return resources;
- }
-
- public void setResources(List<Resource> resources) {
- this.resources = resources;
- }
-
- public String getTrigger_policy() {
- return triggerPolicy;
- }
-
- public void setTrigger_policy(String triggerPolicy) {
- this.triggerPolicy = triggerPolicy;
- }
-
- public Integer getTimeout() {
- return timeout;
- }
-
- public void setTimeout(Integer timeout) {
- this.timeout = timeout;
- }
-
- public Boolean getAbatement() {
- return abatement;
- }
-
- public void setAbatement(Boolean abatement) {
- this.abatement = abatement;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public Pnf getPnf() {
- return pnf;
- }
-
- public void setPnf(Pnf pnf) {
- this.pnf = pnf;
- }
-
- @Override
- public String toString() {
- return "ControlLoop [controlLoopName=" + controlLoopName + ", version=" + version + ", services=" + services
- + ", resources=" + resources + ", trigger_policy=" + triggerPolicy + ", timeout=" + timeout
- + ", abatement=" + abatement + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((controlLoopName == null) ? 0 : controlLoopName.hashCode());
- result = prime * result + ((resources == null) ? 0 : resources.hashCode());
- result = prime * result + ((services == null) ? 0 : services.hashCode());
- result = prime * result + ((timeout == null) ? 0 : timeout.hashCode());
- result = prime * result + ((triggerPolicy == null) ? 0 : triggerPolicy.hashCode());
- result = prime * result + ((version == null) ? 0 : version.hashCode());
- result = prime * result + ((abatement == null) ? 0 : abatement.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ControlLoop other = (ControlLoop) obj;
-
- boolean isEq = equalsMayBeNull(controlLoopName, other.controlLoopName)
- && equalsMayBeNull(resources, other.resources) && equalsMayBeNull(services, other.services);
- isEq = isEq && equalsMayBeNull(timeout, other.timeout) && equalsMayBeNull(triggerPolicy, other.triggerPolicy)
- && equalsMayBeNull(version, other.version);
- return (isEq && equalsMayBeNull(abatement, other.abatement));
- }
-
- private boolean equalsMayBeNull(final Object obj1, final Object obj2) {
- if (obj1 == null) {
- return obj2 == null;
- }
- return obj1.equals(obj2);
- }
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/ControlLoopPolicy.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/ControlLoopPolicy.java
deleted file mode 100644
index e90182d58..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/ControlLoopPolicy.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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 java.io.Serializable;
-import java.util.List;
-
-public class ControlLoopPolicy implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private ControlLoop controlLoop;
-
- private List<Policy> policies;
-
- public ControlLoop getControlLoop() {
- return controlLoop;
- }
-
- public void setControlLoop(ControlLoop controlLoop) {
- this.controlLoop = controlLoop;
- }
-
- public List<Policy> getPolicies() {
- return policies;
- }
-
- public void setPolicies(List<Policy> policies) {
- this.policies = policies;
- }
-
- @Override
- public String toString() {
- return "ControlLoopPolicy [controlLoop=" + controlLoop + ", policies=" + policies + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((controlLoop == null) ? 0 : controlLoop.hashCode());
- result = prime * result + ((policies == null) ? 0 : policies.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ControlLoopPolicy other = (ControlLoopPolicy) obj;
- if (controlLoop == null) {
- if (other.controlLoop != null) {
- return false;
- }
- } else if (!controlLoop.equals(other.controlLoop)) {
- return false;
- }
- if (policies == null) {
- if (other.policies != null) {
- return false;
- }
- } else if (!policies.equals(other.policies)) {
- return false;
- }
- return true;
- }
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/FinalResult.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/FinalResult.java
deleted file mode 100644
index bd49484bd..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/FinalResult.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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;
-
-public enum FinalResult {
- /**
- * The Control Loop Policy successfully completed its Operations.
- */
- FINAL_SUCCESS("Final_Success"),
- /**
- * The Control Loop Policy was an Open Loop and is finished.
- */
- FINAL_OPENLOOP("Final_OpenLoop"),
- /**
- * The Control Loop Policy failed in its last Operation Policy.
- * NOTE: Previous Operation Policies may have been successful.
- */
- FINAL_FAILURE("Final_Failure"),
- /**
- * The Control Loop Policy failed because the overall timeout was met.
- */
- FINAL_FAILURE_TIMEOUT("Final_Failure_Timeout"),
- /**
- * The Control Loop Policy failed because an Operation Policy met its retry limit.
- */
- FINAL_FAILURE_RETRIES("Final_Failure_Retries"),
- /**
- * The Control Loop Policy failed due to an exception.
- */
- FINAL_FAILURE_EXCEPTION("Final_Failure_Exception"),
- /**
- * The Control Loop Policy failed due to guard denied.
- */
- FINAL_FAILURE_GUARD("Final_Failure_Guard")
- ;
-
- String result;
-
- private FinalResult(String result) {
- this.result = result;
- }
-
- /**
- * Converts to a result object.
- *
- * @param result input string
- * @return result object
- */
- public static FinalResult toResult(String result) {
- if (result.equalsIgnoreCase(FINAL_SUCCESS.toString())) {
- return FINAL_SUCCESS;
- }
- if (result.equalsIgnoreCase(FINAL_OPENLOOP.toString())) {
- return FINAL_OPENLOOP;
- }
- if (result.equalsIgnoreCase(FINAL_FAILURE.toString())) {
- return FINAL_FAILURE;
- }
- if (result.equalsIgnoreCase(FINAL_FAILURE_TIMEOUT.toString())) {
- return FINAL_FAILURE_TIMEOUT;
- }
- if (result.equalsIgnoreCase(FINAL_FAILURE_RETRIES.toString())) {
- return FINAL_FAILURE_RETRIES;
- }
- if (result.equalsIgnoreCase(FINAL_FAILURE_EXCEPTION.toString())) {
- return FINAL_FAILURE_EXCEPTION;
- }
- if (result.equalsIgnoreCase(FINAL_FAILURE_GUARD.toString())) {
- return FINAL_FAILURE_GUARD;
- }
- return null;
- }
-
- /**
- * Check if the result really is a result.
- *
- * @param result string
- * @param finalResult result object
- * @return true if a result
- */
- public static boolean isResult(String result, FinalResult finalResult) {
- FinalResult toResult = FinalResult.toResult(result);
- if (toResult == null) {
- return false;
- }
- return toResult.equals(finalResult);
- }
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/OperationsAccumulateParams.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/OperationsAccumulateParams.java
deleted file mode 100644
index 07312db07..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/OperationsAccumulateParams.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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 java.io.Serializable;
-
-public class OperationsAccumulateParams implements Serializable {
-
- private static final long serialVersionUID = -3597358159130168247L;
-
- private String period;
- private Integer limit;
-
- public OperationsAccumulateParams() {
- // Does Nothing
- }
-
- public OperationsAccumulateParams(OperationsAccumulateParams ops) {
- this.period = ops.period;
- this.limit = ops.limit;
- }
-
- public OperationsAccumulateParams(String period, Integer limit) {
- this.period = period;
- this.limit = limit;
- }
-
- public String getPeriod() {
- return period;
- }
-
- public void setPeriod(String period) {
- this.period = period;
- }
-
- public Integer getLimit() {
- return limit;
- }
-
- public void setLimit(Integer limit) {
- this.limit = limit;
- }
-
- @Override
- public String toString() {
- return "OperationsAccumulateParams [period=" + period + ", limit=" + limit + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((period == null) ? 0 : period.hashCode());
- result = prime * result + ((limit == null) ? 0 : limit.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- OperationsAccumulateParams other = (OperationsAccumulateParams) obj;
- if (period == null) {
- if (other.period != null) {
- return false;
- }
- } else if (!period.equals(other.period)) {
- return false;
- }
- if (limit == null) {
- if (other.limit != null) {
- return false;
- }
- } else if (!limit.equals(other.limit)) {
- return false;
- }
- return true;
- }
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/Policy.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/Policy.java
deleted file mode 100644
index 7a64f2fae..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/Policy.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * Copyright (C) 2017-2019 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 java.io.Serializable;
-import java.util.Collections;
-import java.util.Map;
-import java.util.UUID;
-
-public class Policy implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private String id = UUID.randomUUID().toString();
- private String name;
- private String description;
- private String actor;
- private String recipe;
- private Map<String, String> payload;
- private Target target;
- private OperationsAccumulateParams operationsAccumulateParams;
- private Integer retry = 0;
- private Integer timeout = 300;
- private String success = FinalResult.FINAL_SUCCESS.toString();
- private String failure = FinalResult.FINAL_FAILURE.toString();
- private String failureRetries = FinalResult.FINAL_FAILURE_RETRIES.toString();
- private String failureTimeout = FinalResult.FINAL_FAILURE_TIMEOUT.toString();
- private String failureException = FinalResult.FINAL_FAILURE_EXCEPTION.toString();
- private String failureGuard = FinalResult.FINAL_FAILURE_GUARD.toString();
-
-
- public Policy() {
- //Does Nothing Empty Constructor
- }
-
- public Policy(String id) {
- this.id = id;
- }
-
- /**
- * Constructor.
- *
- * @param name name
- * @param actor actor
- * @param recipe recipe
- * @param payload payload
- * @param target target
- */
- public Policy(String name, String actor, String recipe, Map<String, String> payload, Target target) {
- this.name = name;
- this.actor = actor;
- this.recipe = recipe;
- this.target = target;
- if (payload != null) {
- this.payload = Collections.unmodifiableMap(payload);
- }
- }
-
- /**
- * Constructor.
- *
- * @param name name
- * @param actor actor
- * @param recipe recipe
- * @param payload payload
- * @param target target
- * @param retries retries
- * @param timeout timeout
- */
- public Policy(String name, String actor, String recipe, Map<String, String> payload, Target target,
- Integer retries, Integer timeout) {
- this(name, actor, recipe, payload, target);
- this.retry = retries;
- this.timeout = timeout;
- }
-
- /**
- * Constructor.
- *
- * @param policyParam provide parameter object
- */
- public Policy(PolicyParam policyParam) {
- this(policyParam.getName(), policyParam.getActor(), policyParam.getRecipe(), policyParam.getPayload(),
- policyParam.getTarget(), policyParam.getRetries(), policyParam.getTimeout());
- this.id = policyParam.getId();
- this.description = policyParam.getDescription();
- }
-
- /**
- * Constructor.
- *
- * @param policy copy object
- */
- public Policy(Policy policy) {
- this.id = policy.id;
- this.name = policy.name;
- this.description = policy.description;
- this.actor = policy.actor;
- this.recipe = policy.recipe;
- if (policy.payload != null) {
- this.payload = Collections.unmodifiableMap(policy.payload);
- }
- this.target = policy.target;
- this.operationsAccumulateParams = policy.operationsAccumulateParams;
- this.retry = policy.retry;
- this.timeout = policy.timeout;
- this.success = policy.success;
- this.failure = policy.failure;
- this.failureException = policy.failureException;
- this.failureGuard = policy.failureGuard;
- this.failureRetries = policy.failureRetries;
- this.failureTimeout = policy.failureTimeout;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getActor() {
- return actor;
- }
-
- public void setActor(String actor) {
- this.actor = actor;
- }
-
- public String getRecipe() {
- return recipe;
- }
-
- public void setRecipe(String recipe) {
- this.recipe = recipe;
- }
-
- public Map<String, String> getPayload() {
- return payload;
- }
-
- public void setPayload(Map<String, String> payload) {
- this.payload = payload;
- }
-
- public Target getTarget() {
- return target;
- }
-
- public void setTarget(Target target) {
- this.target = target;
- }
-
- public OperationsAccumulateParams getOperationsAccumulateParams() {
- return operationsAccumulateParams;
- }
-
- public void setOperationsAccumulateParams(OperationsAccumulateParams operationsAccumulateParams) {
- this.operationsAccumulateParams = operationsAccumulateParams;
- }
-
- public Integer getRetry() {
- return retry;
- }
-
- public void setRetry(Integer retry) {
- this.retry = retry;
- }
-
- public Integer getTimeout() {
- return timeout;
- }
-
- public void setTimeout(Integer timeout) {
- this.timeout = timeout;
- }
-
- public String getSuccess() {
- return success;
- }
-
- public void setSuccess(String success) {
- this.success = success;
- }
-
- public String getFailure() {
- return failure;
- }
-
- public void setFailure(String failure) {
- this.failure = failure;
- }
-
- public String getFailure_retries() {
- return failureRetries;
- }
-
- public void setFailure_retries(String failureRetries) {
- this.failureRetries = failureRetries;
- }
-
- public String getFailure_timeout() {
- return failureTimeout;
- }
-
- public void setFailure_timeout(String failureTimeout) {
- this.failureTimeout = failureTimeout;
- }
-
- public String getFailure_exception() {
- return failureException;
- }
-
- public void setFailure_exception(String failureException) {
- this.failureException = failureException;
- }
-
- public String getFailure_guard() {
- return failureGuard;
- }
-
- public void setFailure_guard(String failureGuard) {
- this.failureGuard = failureGuard;
- }
-
- public boolean isValid() {
- boolean isValid = id != null && name != null && actor != null;
- return isValid && recipe != null && target != null;
- }
-
- @Override
- public String toString() {
- return "Policy [id=" + id + ", name=" + name + ", description=" + description + ", actor=" + actor + ", recipe="
- + recipe + ", payload=" + payload + ", target=" + target + ", operationsAccumulateParams="
- + operationsAccumulateParams + ", retry=" + retry + ", timeout=" + timeout
- + ", success=" + success + ", failure=" + failure + ", failure_retries=" + failureRetries
- + ", failure_timeout=" + failureTimeout + ", failure_exception=" + failureException
- + ", failure_guard=" + failureGuard + "]";
- }
-
- @Override
- public int hashCode() {
- int result = 1;
- result = addHashCodeForField(result, actor);
- result = addHashCodeForField(result, description);
- result = addHashCodeForField(result, failure);
- result = addHashCodeForField(result, failureException);
- result = addHashCodeForField(result, failureGuard);
- result = addHashCodeForField(result, failureRetries);
- result = addHashCodeForField(result, failureTimeout);
- result = addHashCodeForField(result, id);
- result = addHashCodeForField(result, name);
- result = addHashCodeForField(result, payload);
- result = addHashCodeForField(result, recipe);
- result = addHashCodeForField(result, retry);
- result = addHashCodeForField(result, success);
- result = addHashCodeForField(result, target);
- result = addHashCodeForField(result, operationsAccumulateParams);
- result = addHashCodeForField(result, timeout);
- return result;
- }
-
- private int addHashCodeForField(int hashCode, Object field) {
- final int prime = 31;
- return prime * hashCode + ((field == null) ? 0 : field.hashCode());
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Policy other = (Policy) obj;
- boolean isEq = equalsMayBeNull(actor, other.actor)
- && equalsMayBeNull(description, other.description)
- && equalsMayBeNull(failure, other.failure);
- isEq = isEq
- && equalsMayBeNull(failureException, other.failureException)
- && equalsMayBeNull(failureGuard, other.failureGuard);
- isEq = isEq
- && equalsMayBeNull(failureRetries, other.failureRetries)
- && equalsMayBeNull(id, other.id);
- isEq = isEq
- && equalsMayBeNull(name, other.name)
- && equalsMayBeNull(payload, other.payload);
- isEq = isEq
- && equalsMayBeNull(recipe, other.recipe)
- && equalsMayBeNull(retry, other.retry);
- isEq = isEq
- && equalsMayBeNull(success, other.success)
- && equalsMayBeNull(operationsAccumulateParams, other.operationsAccumulateParams);
- return isEq
- && equalsMayBeNull(target, other.target)
- && equalsMayBeNull(timeout, other.timeout);
- }
-
- private boolean equalsMayBeNull(final Object obj1, final Object obj2) {
- if (obj1 == null) {
- return obj2 == null;
- }
- return obj1.equals(obj2);
- }
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/PolicyParam.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/PolicyParam.java
deleted file mode 100644
index ab4e7f895..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/PolicyParam.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * policy-endpoints
- * ================================================================================
- * Copyright (C) 2018 Samsung Electronics Co., Ltd. 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 java.util.Map;
-
-public class PolicyParam {
- private String id;
- private String name;
- private String description;
- private String actor;
- private Map<String, String> payload;
- private Target target;
- private String recipe;
- private Integer retries;
- private Integer timeout;
-
- public static PolicyParamBuilder builder() {
- return new PolicyParamBuilder();
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getActor() {
- return actor;
- }
-
- public Map<String, String> getPayload() {
- return payload;
- }
-
- public Target getTarget() {
- return target;
- }
-
- public String getRecipe() {
- return recipe;
- }
-
- public Integer getRetries() {
- return retries;
- }
-
- public Integer getTimeout() {
- return timeout;
- }
-
- public static class PolicyParamBuilder {
-
- PolicyParam policyParm = new PolicyParam();
-
- private PolicyParamBuilder() {
- }
-
- public PolicyParam build() {
- return policyParm;
- }
-
- public PolicyParamBuilder id(String id) {
- policyParm.id = id;
- return this;
- }
-
- public PolicyParamBuilder name(String name) {
- policyParm.name = name;
- return this;
- }
-
- public PolicyParamBuilder description(String description) {
- policyParm.description = description;
- return this;
- }
-
- public PolicyParamBuilder actor(String actor) {
- policyParm.actor = actor;
- return this;
- }
-
- public PolicyParamBuilder payload(Map<String, String> payload) {
- policyParm.payload = payload;
- return this;
- }
-
- public PolicyParamBuilder target(Target target) {
- policyParm.target = target;
- return this;
- }
-
- public PolicyParamBuilder recipe(String recipe) {
- policyParm.recipe = recipe;
- return this;
- }
-
- public PolicyParamBuilder retries(Integer retries) {
- policyParm.retries = retries;
- return this;
- }
-
- public PolicyParamBuilder timeout(Integer timeout) {
- policyParm.timeout = timeout;
- return this;
- }
- }
-} \ No newline at end of file
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/PolicyResult.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/PolicyResult.java
deleted file mode 100644
index 80a68248a..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/PolicyResult.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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;
-
-public enum PolicyResult {
- /**
- * Operation was successful.
- */
- SUCCESS("Success"),
- /**
- * Operation failed.
- */
- FAILURE("Failure"),
- /**
- * Operation failed due to maximum retries being met.
- */
- FAILURE_RETRIES("Failure_Retries"),
- /**
- * Operation failed due to timeout occurring.
- */
- FAILURE_TIMEOUT("Failure_Timeout"),
- /**
- * Operation failed due to an exception.
- */
- FAILURE_EXCEPTION("Failure_Exception"),
- /**
- * Operation failed since Guard did not permit.
- */
- FAILURE_GUARD("Failure_Guard")
- ;
-
- private String result;
-
- private PolicyResult(String result) {
- this.result = result;
- }
-
- @Override
- public String toString() {
- return this.result;
- }
-
- /**
- * Convert to a result.
- *
- * @param result result string
- * @return Result object
- */
- public static PolicyResult toResult(String result) {
- if (result.equalsIgnoreCase(SUCCESS.toString())) {
- return SUCCESS;
- }
- if (result.equalsIgnoreCase(FAILURE.toString())) {
- return FAILURE;
- }
- if (result.equalsIgnoreCase(FAILURE_RETRIES.toString())) {
- return FAILURE_RETRIES;
- }
- if (result.equalsIgnoreCase(FAILURE_TIMEOUT.toString())) {
- return FAILURE_TIMEOUT;
- }
- if (result.equalsIgnoreCase(FAILURE_EXCEPTION.toString())) {
- return FAILURE_EXCEPTION;
- }
- if (result.equalsIgnoreCase(FAILURE_GUARD.toString())) {
- return FAILURE_GUARD;
- }
- return null;
- }
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/Target.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/Target.java
deleted file mode 100644
index bc99975f8..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/Target.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*-
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Tech Mahindra
- * ================================================================================
- * 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 java.io.Serializable;
-
-public class Target implements Serializable {
-
- private static final long serialVersionUID = 2180988443264988319L;
-
- private String resourceId;
- private TargetType type;
-
- private String modelInvariantId;
- private String modelVersionId;
- private String modelName;
- private String modelVersion;
- private String modelCustomizationId;
-
- public Target() {
- //Does Nothing Empty Constructor
- }
-
- public Target(TargetType type) {
- this.type = type;
- }
-
- public Target(String resourceId) {
- this.resourceId = resourceId;
- }
-
- public Target(TargetType type, String resourceId) {
- this.type = type;
- this.resourceId = resourceId;
- }
-
- public Target(Target target) {
- this.type = target.type;
- this.resourceId = target.resourceId;
- }
-
- public String getModelInvariantId() {
- return modelInvariantId;
- }
-
- public void setModelInvariantId(String modelInvariantId) {
- this.modelInvariantId = modelInvariantId;
- }
-
- public String getModelVersionId() {
- return modelVersionId;
- }
-
- public void setModelVersionId(String modelVersionId) {
- this.modelVersionId = modelVersionId;
- }
-
- public String getModelName() {
- return modelName;
- }
-
- public void setModelName(String modelName) {
- this.modelName = modelName;
- }
-
- public String getModelVersion() {
- return modelVersion;
- }
-
- public void setModelVersion(String modelVersion) {
- this.modelVersion = modelVersion;
- }
-
- public String getModelCustomizationId() {
- return modelCustomizationId;
- }
-
- public void setModelCustomizationId(String modelCustomizationId) {
- this.modelCustomizationId = modelCustomizationId;
- } //techm
-
- public String getResourceID() {
- return resourceId;
- }
-
- public void setResourceID(String resourceId) {
- this.resourceId = resourceId;
- }
-
- public TargetType getType() {
- return type;
- }
-
- public void setType(TargetType type) {
- this.type = type;
- }
-
- @Override
- public String toString() {
- return "Target [type=" + type + ", resourceId=" + resourceId + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((type == null) ? 0 : type.hashCode());
- result = prime * result + ((resourceId == null) ? 0 : resourceId.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Target other = (Target) obj;
- if (type == null) {
- if (other.type != null) {
- return false;
- }
- } else if (!type.equals(other.type)) {
- return false;
- }
- if (resourceId == null) {
- if (other.resourceId != null) {
- return false;
- }
- } else if (!resourceId.equals(other.resourceId)) {
- return false;
- }
- return true;
- }
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/TargetType.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/TargetType.java
deleted file mode 100644
index 4bf1dbea4..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/TargetType.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 Tech Mahindra
- * ================================================================================
- * 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;
-
-public enum TargetType {
- VM("VM"),
- PNF("PNF"),
- VFC("VFC"),
- VNF("VNF"),
- VFMODULE("VFMODULE")
- ;
-
- private String target;
-
- private TargetType(String targetType) {
- this.target = targetType;
- }
-
- @Override
- public String toString() {
- return this.target;
- }
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/BuilderException.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/BuilderException.java
deleted file mode 100644
index 3d086d00f..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/BuilderException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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.builder;
-
-public class BuilderException extends Exception {
-
- private static final long serialVersionUID = 610064813684337895L;
-
- public BuilderException(String string) {
- super(string);
- }
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java
deleted file mode 100644
index 1c96b2b90..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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.builder;
-
-import org.onap.aai.domain.yang.Pnf;
-import org.onap.policy.controlloop.policy.ControlLoop;
-import org.onap.policy.controlloop.policy.OperationsAccumulateParams;
-import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.controlloop.policy.PolicyParam;
-import org.onap.policy.controlloop.policy.PolicyResult;
-import org.onap.policy.controlloop.policy.builder.impl.ControlLoopPolicyBuilderImpl;
-import org.onap.policy.sdc.Resource;
-import org.onap.policy.sdc.Service;
-
-public interface ControlLoopPolicyBuilder {
-
- /**
- * Adds one or more services to the ControlLoop.
- *
- * @param services service to add
- * @return builder object
- * @throws BuilderException builder exception
- */
- public ControlLoopPolicyBuilder addService(Service... services) throws BuilderException;
-
- /**
- * Remove service.
- *
- * @param services to remove
- * @return builder object
- * @throws BuilderException builder exception
- */
- public ControlLoopPolicyBuilder removeService(Service... services) throws BuilderException;
-
- /**
- * Remove all the services.
- *
- * @return builder object
- * @throws BuilderException builder exception
- */
- public ControlLoopPolicyBuilder removeAllServices() throws BuilderException;
-
- /**
- * Adds one or more resources to the ControlLoop.
- *
- * @return builder object
- * @throws BuilderException builder exception
- */
- public ControlLoopPolicyBuilder addResource(Resource... resources) throws BuilderException;
-
- /**
- * Remove the resources.
- *
- * @param resources resources to be removed
- * @return object
- * @throws BuilderException builder exception
- */
- public ControlLoopPolicyBuilder removeResource(Resource... resources) throws BuilderException;
-
- /**
- * Remove all resources.
- *
- * @return object
- * @throws BuilderException builder exception
- */
- public ControlLoopPolicyBuilder removeAllResources() throws BuilderException;
-
- /**
- * Set the PNF.
- *
- * @param pnf input pnf
- * @return builder object
- * @throws BuilderException builder exception
- */
- public ControlLoopPolicyBuilder setPnf(Pnf pnf) throws BuilderException;
-
- /**
- * Remove PNF.
- *
- * @return the object
- * @throws BuilderException builder exception
- */
- public ControlLoopPolicyBuilder removePnf() throws BuilderException;
-
- /**
- * Set the abatement.
- *
- * @param abatement whether abatement is possible
- * @return object
- * @throws BuilderException builder exception
- */
- public ControlLoopPolicyBuilder setAbatement(Boolean abatement) throws BuilderException;
-
-
- /**
- * Sets the overall timeout value for the Control Loop. If any operational policies have retries
- * and timeouts, then this overall timeout value should exceed all those values.
- *
- * @param timeout timeout value
- * @return control loop policy builder
- * @throws BuilderException builder exception
- */
- public ControlLoopPolicyBuilder setTimeout(Integer timeout) throws BuilderException;
-
- /**
- * Scans the operational policies and calculate an minimum overall timeout for the Control Loop.
- *
- *
- * @return Integer
- */
- public Integer calculateTimeout();
-
- /**
- * Sets the initial trigger policy when a DCAE Closed Loop Event arrives in the ONAP Policy
- * Platform.
- *
- *
- * @param policy Policy parameters object
- * @return Policy object
- * @throws BuilderException builder exception
- */
- public Policy setTriggerPolicy(PolicyParam policy) throws BuilderException;
-
- /**
- * Changes the trigger policy to point to another existing Policy.
- *
- * @param id the id
- * @return ControlLoop object
- * @throws BuilderException build exception
- */
- public ControlLoop setExistingTriggerPolicy(String id) throws BuilderException;
-
- /**
- * Is an open loop.
- *
- * @return true or false
- */
- public boolean isOpenLoop();
-
- /**
- * Get the trigger policy.
- *
- * @return the policy object
- * @throws BuilderException if there is a builder exception
- */
- public Policy getTriggerPolicy() throws BuilderException;
-
- /**
- * Simply returns a copy of the ControlLoop information.
- *
- *
- * @return ControlLoop
- */
- public ControlLoop getControlLoop();
-
- /**
- * Creates a policy that is chained to the result of another Policy.
- *
- * @param policyParam policy parameters object
- * @param results results
- * @return Policy that was set
- * @throws BuilderException builder exception
- */
- public Policy setPolicyForPolicyResult(PolicyParam policyParam, PolicyResult... results)
- throws BuilderException;
-
-
- /**
- * Sets the policy result(s) to an existing Operational Policy.
- *
- * @param policyResultId result ID
- * @param policyId id
- * @param results results
- * @return Policy that was set
- * @throws BuilderException builder exception
- */
- public Policy setPolicyForPolicyResult(String policyResultId, String policyId, PolicyResult... results)
- throws BuilderException;
-
- /**
- * Removes an Operational Policy. Be mindful that if any other Operational Policies have results
- * that point to this policy, any policies that have results pointing to this policy will have
- * their result reset to the appropriate default FINAL_* result.
- *
- *
- * @param policyID id for the policy
- * @return true if removed else false
- * @throws BuilderException builder exception
- */
- public boolean removePolicy(String policyID) throws BuilderException;
-
- /**
- * Resets a policy's results to defualt FINAL_* codes.
- *
- * @return Policy object
- * @throws BuilderException - Policy does not exist
- */
- public Policy resetPolicyResults(String policyID) throws BuilderException;
-
- /**
- * Removes all existing Operational Policies and reverts back to an Open Loop.
- *
- * @return Policy builder object
- */
- public ControlLoopPolicyBuilder removeAllPolicies();
-
- /**
- * Adds an operationsAccumulateParams to an existing operational policy.
- *
- * @return Policy
- * @throws BuilderException - Policy does not exist
- */
- public Policy addOperationsAccumulateParams(String policyID, OperationsAccumulateParams operationsAccumulateParams)
- throws BuilderException;
-
- /**
- * This will compile and build the YAML specification for the Control Loop Policy. Please
- * iterate the Results object for details. The Results object will contains warnings and errors.
- * If the specification compiled successfully, you will be able to retrieve the YAML.
- *
- * @return Results
- */
- public Results buildSpecification();
-
- /**
- * The Factory is used to build a ControlLoopPolicyBuilder implementation.
- *
- * @author pameladragosh
- *
- */
- public static class Factory {
- private Factory() {
- // Private Constructor.
- }
-
- /**
- * Builds a basic Control Loop with an overall timeout. Use this method if you wish to
- * create an OpenLoop, or if you want to interactively build a Closed Loop.
- *
- * @param controlLoopName - Per Closed Loop AID v1.0, unique string for the closed loop.
- * @param timeout - Overall timeout for the Closed Loop to execute.
- * @return ControlLoopPolicyBuilder object
- */
- public static ControlLoopPolicyBuilder buildControlLoop(String controlLoopName, Integer timeout) {
- return new ControlLoopPolicyBuilderImpl(controlLoopName, timeout);
- }
-
- /**
- * Build a Control Loop for a resource and services associated with the resource.
- *
- * @param controlLoopName - Per Closed Loop AID v1.0, unique string for the closed loop.
- * @param timeout - Overall timeout for the Closed Loop to execute.
- * @param resource - Resource this closed loop is for. Should come from ASDC, but if not
- * available use resourceName to distinguish.
- * @param services - Zero or more services associated with this resource. Should come from
- * ASDC, but if not available use serviceName to distinguish.
- * @return ControlLoopPolicyBuilder object
- * @throws BuilderException builder exception
- */
- public static ControlLoopPolicyBuilder buildControlLoop(String controlLoopName, Integer timeout,
- Resource resource, Service... services) throws BuilderException {
- return new ControlLoopPolicyBuilderImpl(controlLoopName, timeout, resource, services);
- }
-
- /**
- * Build the control loop.
- *
- * @param controlLoopName control loop id
- * @param timeout timeout
- * @param service service
- * @param resources resources
- * @return builder object
- * @throws BuilderException builder exception
- */
- public static ControlLoopPolicyBuilder buildControlLoop(String controlLoopName, Integer timeout,
- Service service, Resource... resources) throws BuilderException {
- return new ControlLoopPolicyBuilderImpl(controlLoopName, timeout, service, resources);
- }
-
- /**
- * Build control loop.
- *
- * @param controlLoopName - Per Closed Loop AID v1.0, unique string for the closed loop.
- * @param timeout - Overall timeout for the Closed Loop to execute.
- * @param pnf - Physical Network Function. Should come from AIC, but if not available use
- * well-known name to distinguish. Eg. eNodeB
- * @return ControlLoopPolicyBuilder object
- * @throws BuilderException builder exception
- */
- public static ControlLoopPolicyBuilder buildControlLoop(String controlLoopName, Integer timeout, Pnf pnf)
- throws BuilderException {
- return new ControlLoopPolicyBuilderImpl(controlLoopName, timeout, pnf);
- }
- }
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/Message.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/Message.java
deleted file mode 100644
index 4e34a777a..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/Message.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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.builder;
-
-public interface Message {
-
- public String getMessage();
-
- public MessageLevel getLevel();
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/MessageLevel.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/MessageLevel.java
deleted file mode 100644
index cca9e2c0a..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/MessageLevel.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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.builder;
-
-public enum MessageLevel {
- INFO,
- WARNING,
- ERROR,
- EXCEPTION;
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/Results.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/Results.java
deleted file mode 100644
index 37f619b65..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/Results.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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.builder;
-
-import java.util.List;
-
-public interface Results {
-
- public List<Message> getMessages();
-
- public String getSpecification();
-
- public boolean isValid();
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java
deleted file mode 100644
index c4b2cd4ca..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java
+++ /dev/null
@@ -1,538 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2020 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.builder.impl;
-
-import com.google.common.base.Strings;
-import java.util.LinkedList;
-import java.util.UUID;
-import org.onap.aai.domain.yang.Pnf;
-import org.onap.policy.controlloop.compiler.CompilerException;
-import org.onap.policy.controlloop.compiler.ControlLoopCompiler;
-import org.onap.policy.controlloop.compiler.ControlLoopCompilerCallback;
-import org.onap.policy.controlloop.policy.ControlLoop;
-import org.onap.policy.controlloop.policy.ControlLoopPolicy;
-import org.onap.policy.controlloop.policy.FinalResult;
-import org.onap.policy.controlloop.policy.OperationsAccumulateParams;
-import org.onap.policy.controlloop.policy.Policy;
-import org.onap.policy.controlloop.policy.PolicyParam;
-import org.onap.policy.controlloop.policy.PolicyResult;
-import org.onap.policy.controlloop.policy.builder.BuilderException;
-import org.onap.policy.controlloop.policy.builder.ControlLoopPolicyBuilder;
-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.Service;
-import org.yaml.snakeyaml.DumperOptions;
-import org.yaml.snakeyaml.DumperOptions.FlowStyle;
-import org.yaml.snakeyaml.Yaml;
-
-public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
- private static final String UNKNOWN_POLICY = "Unknown policy ";
- private ControlLoopPolicy controlLoopPolicy;
-
- /**
- * Constructor.
- *
- * @param controlLoopName control loop id
- * @param timeout timeout value
- */
- public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout) {
- controlLoopPolicy = new ControlLoopPolicy();
- ControlLoop controlLoop = new ControlLoop();
- controlLoop.setControlLoopName(controlLoopName);
- controlLoop.setTimeout(timeout);
- controlLoopPolicy.setControlLoop(controlLoop);
- }
-
- /**
- * Constructor.
- *
- * @param controlLoopName control loop id
- * @param timeout timeout value
- * @param resource resource
- * @param services services
- * @throws BuilderException builder exception
- */
- public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, Resource resource,
- Service... services) throws BuilderException {
- this(controlLoopName, timeout);
- this.addResource(resource);
- this.addService(services);
- }
-
- public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, Pnf pnf) throws BuilderException {
- this(controlLoopName, timeout);
- this.setPnf(pnf);
- }
-
- /**
- * Constructor.
- *
- * @param controlLoopName control loop id
- * @param timeout timeout
- * @param service service
- * @param resources resources
- * @throws BuilderException builder exception
- */
- public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, Service service,
- Resource[] resources) throws BuilderException {
- this(controlLoopName, timeout);
- this.addService(service);
- this.addResource(resources);
- }
-
- @Override
- public ControlLoopPolicyBuilder removePnf() throws BuilderException {
- controlLoopPolicy.getControlLoop().setPnf(null);
- return this;
- }
-
- @Override
- public ControlLoopPolicyBuilder addService(Service... services) throws BuilderException {
- for (Service service : services) {
- if (service == null) {
- throw new BuilderException("Service must not be null");
- }
- if (service.getServiceUUID() == null && Strings.isNullOrEmpty(service.getServiceName())) {
- throw new BuilderException("Invalid service - need either a serviceUUID or serviceName");
- }
- if (controlLoopPolicy.getControlLoop().getServices() == null) {
- controlLoopPolicy.getControlLoop().setServices(new LinkedList<>());
- }
- controlLoopPolicy.getControlLoop().getServices().add(service);
- }
- return this;
- }
-
- @Override
- public ControlLoopPolicyBuilder removeService(Service... services) throws BuilderException {
- if (controlLoopPolicy.getControlLoop().getServices() == null) {
- throw new BuilderException("No existing services to remove");
- }
- for (Service service : services) {
- if (service == null) {
- throw new BuilderException("Service must not be null");
- }
- if (service.getServiceUUID() == null && Strings.isNullOrEmpty(service.getServiceName())) {
- throw new BuilderException("Invalid service - need either a serviceUUID or serviceName");
- }
- boolean removed = controlLoopPolicy.getControlLoop().getServices().remove(service);
- if (!removed) {
- throw new BuilderException("Unknown service " + service.getServiceName());
- }
- }
- return this;
- }
-
- @Override
- public ControlLoopPolicyBuilder removeAllServices() throws BuilderException {
- controlLoopPolicy.getControlLoop().getServices().clear();
- return this;
- }
-
- @Override
- public ControlLoopPolicyBuilder addResource(Resource... resources) throws BuilderException {
- for (Resource resource : resources) {
- if (resource == null) {
- throw new BuilderException("Resource must not be null");
- }
- if (resource.getResourceUuid() == null && Strings.isNullOrEmpty(resource.getResourceName())) {
- throw new BuilderException("Invalid resource - need either resourceUUID or resourceName");
- }
- if (controlLoopPolicy.getControlLoop().getResources() == null) {
- controlLoopPolicy.getControlLoop().setResources(new LinkedList<>());
- }
- controlLoopPolicy.getControlLoop().getResources().add(resource);
- }
- return this;
- }
-
- @Override
- public ControlLoopPolicyBuilder setPnf(Pnf pnf) throws BuilderException {
- if (pnf == null) {
- throw new BuilderException("PNF must not be null");
- }
- if (pnf.getPnfName() == null && pnf.getEquipType() == null) {
- throw new BuilderException("Invalid PNF - need either pnfName or pnfType");
- }
- controlLoopPolicy.getControlLoop().setPnf(pnf);
- return this;
- }
-
- @Override
- public ControlLoopPolicyBuilder setAbatement(Boolean abatement) throws BuilderException {
- if (abatement == null) {
- throw new BuilderException("abatement must not be null");
- }
- controlLoopPolicy.getControlLoop().setAbatement(abatement);
- return this;
- }
-
- @Override
- public ControlLoopPolicyBuilder setTimeout(Integer timeout) {
- controlLoopPolicy.getControlLoop().setTimeout(timeout);
- return this;
- }
-
- @Override
- public Policy setTriggerPolicy(PolicyParam policyParam) throws BuilderException {
-
- Policy trigger = new Policy(policyParam);
-
- controlLoopPolicy.getControlLoop().setTrigger_policy(trigger.getId());
-
- this.addNewPolicy(trigger);
- //
- // Return a copy of the policy
- //
- return new Policy(trigger);
- }
-
- @Override
- public ControlLoop setExistingTriggerPolicy(String id) throws BuilderException {
- if (id == null) {
- throw new BuilderException("Id must not be null");
- }
- Policy trigger = this.findPolicy(id);
- if (trigger == null) {
- throw new BuilderException(UNKNOWN_POLICY + id);
- } else {
- this.controlLoopPolicy.getControlLoop().setTrigger_policy(id);
- }
- return new ControlLoop(this.controlLoopPolicy.getControlLoop());
- }
-
- @Override
- public Policy setPolicyForPolicyResult(PolicyParam policyParam, PolicyResult... results) throws BuilderException {
- //
- // Find the existing policy
- //
- Policy existingPolicy = this.findPolicy(policyParam.getId());
- if (existingPolicy == null) {
- throw new BuilderException(UNKNOWN_POLICY + policyParam.getId());
- }
- //
- // Create the new Policy
- //
- // @formatter:off
- Policy newPolicy = new Policy(PolicyParam.builder()
- .id(UUID.randomUUID().toString())
- .name(policyParam.getName())
- .description(policyParam.getDescription())
- .actor(policyParam.getActor())
- .payload(policyParam.getPayload())
- .target(policyParam.getTarget())
- .recipe(policyParam.getRecipe())
- .retries(policyParam.getRetries())
- .timeout(policyParam.getTimeout())
- .build());
- // @formatter:on
- //
- // Connect the results
- //
- for (PolicyResult result : results) {
- switch (result) {
- case FAILURE:
- existingPolicy.setFailure(newPolicy.getId());
- break;
- case FAILURE_EXCEPTION:
- existingPolicy.setFailure_exception(newPolicy.getId());
- break;
- case FAILURE_RETRIES:
- existingPolicy.setFailure_retries(newPolicy.getId());
- break;
- case FAILURE_TIMEOUT:
- existingPolicy.setFailure_timeout(newPolicy.getId());
- break;
- case FAILURE_GUARD:
- existingPolicy.setFailure_guard(newPolicy.getId());
- break;
- case SUCCESS:
- existingPolicy.setSuccess(newPolicy.getId());
- break;
- default:
- throw new BuilderException("Invalid PolicyResult " + result);
- }
- }
- //
- // Add it to our list
- //
- this.controlLoopPolicy.getPolicies().add(newPolicy);
- //
- // Return a policy to them
- //
- return new Policy(newPolicy);
- }
-
- @Override
- public Policy setPolicyForPolicyResult(String policyResultId, String policyId, PolicyResult... results)
- throws BuilderException {
- //
- // Find the existing policy
- //
- Policy existingPolicy = this.findPolicy(policyId);
- if (existingPolicy == null) {
- throw new BuilderException(policyId + " does not exist");
- }
- if (this.findPolicy(policyResultId) == null) {
- throw new BuilderException("Operational policy " + policyResultId + " does not exist");
- }
- //
- // Connect the results
- //
- for (PolicyResult result : results) {
- switch (result) {
- case FAILURE:
- existingPolicy.setFailure(policyResultId);
- break;
- case FAILURE_EXCEPTION:
- existingPolicy.setFailure_exception(policyResultId);
- break;
- case FAILURE_RETRIES:
- existingPolicy.setFailure_retries(policyResultId);
- break;
- case FAILURE_TIMEOUT:
- existingPolicy.setFailure_timeout(policyResultId);
- break;
- case FAILURE_GUARD:
- existingPolicy.setFailure_guard(policyResultId);
- break;
- case SUCCESS:
- existingPolicy.setSuccess(policyResultId);
- break;
- default:
- throw new BuilderException("Invalid PolicyResult " + result);
- }
- }
- return new Policy(this.findPolicy(policyResultId));
- }
-
- private class BuilderCompilerCallback implements ControlLoopCompilerCallback {
-
- private ResultsImpl results = new ResultsImpl();
-
- @Override
- public boolean onWarning(String message) {
- results.addMessage(new MessageImpl(message, MessageLevel.WARNING));
- return false;
- }
-
- @Override
- public boolean onError(String message) {
- results.addMessage(new MessageImpl(message, MessageLevel.ERROR));
- return false;
- }
- }
-
- @Override
- public Results buildSpecification() {
- //
- // Dump the specification
- //
- DumperOptions options = new DumperOptions();
- options.setDefaultFlowStyle(FlowStyle.BLOCK);
- options.setPrettyFlow(true);
- Yaml yaml = new Yaml(options);
- String dumpedYaml = yaml.dump(controlLoopPolicy);
- //
- // This is our callback class for our compiler
- //
- BuilderCompilerCallback callback = new BuilderCompilerCallback();
- //
- // Compile it
- //
- try {
- ControlLoopCompiler.compile(controlLoopPolicy, callback);
- } catch (CompilerException e) {
- callback.results.addMessage(new MessageImpl(e.getMessage(), MessageLevel.EXCEPTION));
- }
- //
- // Save the spec
- //
- callback.results.setSpecification(dumpedYaml);
- return callback.results;
- }
-
- private void addNewPolicy(Policy policy) {
- if (this.controlLoopPolicy.getPolicies() == null) {
- this.controlLoopPolicy.setPolicies(new LinkedList<>());
- }
- this.controlLoopPolicy.getPolicies().add(policy);
- }
-
- private Policy findPolicy(String id) {
- if (this.controlLoopPolicy.getPolicies() != null) {
- for (Policy policy : this.controlLoopPolicy.getPolicies()) {
- if (policy.getId().equals(id)) {
- return policy;
- }
- }
- }
- return null;
- }
-
- @Override
- public ControlLoopPolicyBuilder removeResource(Resource... resources) throws BuilderException {
- if (controlLoopPolicy.getControlLoop().getResources() == null) {
- throw new BuilderException("No existing resources to remove");
- }
- for (Resource resource : resources) {
- if (resource == null) {
- throw new BuilderException("Resource must not be null");
- }
- if (resource.getResourceUuid() == null && Strings.isNullOrEmpty(resource.getResourceName())) {
- throw new BuilderException("Invalid resource - need either a resourceUUID or resourceName");
- }
- boolean removed = controlLoopPolicy.getControlLoop().getResources().remove(resource);
- if (!removed) {
- throw new BuilderException("Unknown resource " + resource.getResourceName());
- }
- }
- return this;
- }
-
- @Override
- public ControlLoopPolicyBuilder removeAllResources() throws BuilderException {
- controlLoopPolicy.getControlLoop().getResources().clear();
- return this;
- }
-
- @Override
- public Integer calculateTimeout() {
- int sum = 0;
- for (Policy policy : this.controlLoopPolicy.getPolicies()) {
- sum += policy.getTimeout().intValue();
- }
- return Integer.valueOf(sum);
- }
-
- @Override
- public boolean isOpenLoop() {
- return this.controlLoopPolicy.getControlLoop().getTrigger_policy()
- .equals(FinalResult.FINAL_OPENLOOP.toString());
- }
-
- @Override
- public Policy getTriggerPolicy() throws BuilderException {
- if (this.controlLoopPolicy.getControlLoop().getTrigger_policy().equals(FinalResult.FINAL_OPENLOOP.toString())) {
- return null;
- } else {
- return new Policy(this.findPolicy(this.controlLoopPolicy.getControlLoop().getTrigger_policy()));
- }
- }
-
- @Override
- public ControlLoop getControlLoop() {
- return new ControlLoop(this.controlLoopPolicy.getControlLoop());
- }
-
- @Override
- public boolean removePolicy(String policyId) throws BuilderException {
- Policy existingPolicy = this.findPolicy(policyId);
- if (existingPolicy == null) {
- throw new BuilderException(UNKNOWN_POLICY + policyId);
- }
- //
- // Check if the policy to remove is trigger_policy
- //
- if (this.controlLoopPolicy.getControlLoop().getTrigger_policy().equals(policyId)) {
- this.controlLoopPolicy.getControlLoop().setTrigger_policy(FinalResult.FINAL_OPENLOOP.toString());
- } else {
- updateChainedPoliciesForPolicyRemoval(policyId);
- }
- //
- // remove the policy
- //
- return this.controlLoopPolicy.getPolicies().remove(existingPolicy);
- }
-
- private void updateChainedPoliciesForPolicyRemoval(String idOfPolicyBeingRemoved) {
- for (Policy policy : this.controlLoopPolicy.getPolicies()) {
- final int index = this.controlLoopPolicy.getPolicies().indexOf(policy);
- if (policy.getSuccess().equals(idOfPolicyBeingRemoved)) {
- policy.setSuccess(FinalResult.FINAL_SUCCESS.toString());
- }
- if (policy.getFailure().equals(idOfPolicyBeingRemoved)) {
- policy.setFailure(FinalResult.FINAL_FAILURE.toString());
- }
- if (policy.getFailure_retries().equals(idOfPolicyBeingRemoved)) {
- policy.setFailure_retries(FinalResult.FINAL_FAILURE_RETRIES.toString());
- }
- if (policy.getFailure_timeout().equals(idOfPolicyBeingRemoved)) {
- policy.setFailure_timeout(FinalResult.FINAL_FAILURE_TIMEOUT.toString());
- }
- if (policy.getFailure_exception().equals(idOfPolicyBeingRemoved)) {
- policy.setFailure_exception(FinalResult.FINAL_FAILURE_EXCEPTION.toString());
- }
- if (policy.getFailure_guard().equals(idOfPolicyBeingRemoved)) {
- policy.setFailure_guard(FinalResult.FINAL_FAILURE_GUARD.toString());
- }
- this.controlLoopPolicy.getPolicies().set(index, policy);
- }
- }
-
- @Override
- public Policy resetPolicyResults(String policyId) throws BuilderException {
- Policy existingPolicy = this.findPolicy(policyId);
- if (existingPolicy == null) {
- throw new BuilderException(UNKNOWN_POLICY + policyId);
- }
- //
- // reset policy results
- //
- existingPolicy.setSuccess(FinalResult.FINAL_SUCCESS.toString());
- existingPolicy.setFailure(FinalResult.FINAL_FAILURE.toString());
- existingPolicy.setFailure_retries(FinalResult.FINAL_FAILURE_RETRIES.toString());
- existingPolicy.setFailure_timeout(FinalResult.FINAL_FAILURE_TIMEOUT.toString());
- existingPolicy.setFailure_exception(FinalResult.FINAL_FAILURE_EXCEPTION.toString());
- existingPolicy.setFailure_guard(FinalResult.FINAL_FAILURE_GUARD.toString());
- return new Policy(existingPolicy);
- }
-
- @Override
- public ControlLoopPolicyBuilder removeAllPolicies() {
- //
- // Remove all existing operational policies
- //
- this.controlLoopPolicy.getPolicies().clear();
- //
- // Revert controlLoop back to an open loop
- //
- this.controlLoopPolicy.getControlLoop().setTrigger_policy(FinalResult.FINAL_OPENLOOP.toString());
- return this;
- }
-
- @Override
- public Policy addOperationsAccumulateParams(String policyId, OperationsAccumulateParams operationsAccumulateParams)
- throws BuilderException {
- Policy existingPolicy = this.findPolicy(policyId);
- if (existingPolicy == null) {
- throw new BuilderException(UNKNOWN_POLICY + policyId);
- }
- //
- // Add operationsAccumulateParams to existingPolicy
- //
- existingPolicy.setOperationsAccumulateParams(operationsAccumulateParams);
- return new Policy(existingPolicy);
- }
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/MessageImpl.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/MessageImpl.java
deleted file mode 100644
index 1a03f6d7a..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/MessageImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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.builder.impl;
-
-import org.onap.policy.controlloop.policy.builder.Message;
-import org.onap.policy.controlloop.policy.builder.MessageLevel;
-
-public class MessageImpl implements Message {
-
- private String message;
- private MessageLevel level;
-
- public MessageImpl(String message, MessageLevel level) {
- this.message = message;
- this.level = level;
- }
-
- @Override
- public String getMessage() {
- return message;
- }
-
- @Override
- public MessageLevel getLevel() {
- return level;
- }
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ResultsImpl.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ResultsImpl.java
deleted file mode 100644
index aac4b068f..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ResultsImpl.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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.builder.impl;
-
-import java.util.LinkedList;
-import java.util.List;
-import org.onap.policy.controlloop.policy.builder.Message;
-import org.onap.policy.controlloop.policy.builder.Results;
-
-public class ResultsImpl implements Results {
-
- private String specification;
- private List<Message> messages = new LinkedList<>();
-
- @Override
- public List<Message> getMessages() {
- return messages;
- }
-
- @Override
- public String getSpecification() {
- return specification;
- }
-
- @Override
- public boolean isValid() {
- return (this.specification != null);
- }
-
- public void addMessage(Message message) {
- this.messages.add(message);
- }
-
- public void setSpecification(String spec) {
- this.specification = spec;
- }
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/Constraint.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/Constraint.java
deleted file mode 100644
index ab87b16eb..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/Constraint.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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 java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-public class Constraint {
-
- private Integer freqLimitPerTarget;
- private Map<String, String> timeWindow;
- private Map<String, String> activeTimeRange;
- private Integer minVnfCount;
- private Integer maxVnfCount;
-
- private List<String> blacklist;
-
- public Constraint() {
- // Do Nothing empty constructor.
- }
-
- /**
- * Constructor.
- *
- * @param freqLimitPerTarget frequency limit
- * @param timeWindow time window
- */
- public Constraint(Integer freqLimitPerTarget, Map<String, String> timeWindow) {
- this.freqLimitPerTarget = freqLimitPerTarget;
- if (timeWindow != null) {
- this.timeWindow = Collections.unmodifiableMap(timeWindow);
- }
- }
-
- /**
- * Constructor.
- *
- * @param minVnfCount minimum VNF count
- * @param maxVnfCount maximum VNF count
- * @param activeTimeRange active time range
- */
- public Constraint(Integer minVnfCount, Integer maxVnfCount, Map<String, String> activeTimeRange) {
- this.minVnfCount = minVnfCount;
- this.maxVnfCount = maxVnfCount;
-
- if (activeTimeRange != null) {
- this.activeTimeRange = Collections.unmodifiableMap(activeTimeRange);
- }
- }
-
- public Constraint(List<String> blacklist) {
- this.blacklist = new LinkedList<>(blacklist);
- }
-
- /**
- * Constructor.
- *
- * @param freqLimitPerTarget frequency limit
- * @param timeWindow time window
- * @param blacklist blacklist
- */
- public Constraint(Integer freqLimitPerTarget, Map<String, String> timeWindow, List<String> blacklist) {
- this.freqLimitPerTarget = freqLimitPerTarget;
- this.timeWindow = Collections.unmodifiableMap(timeWindow);
- this.blacklist = new LinkedList<>(blacklist);
- }
-
- /**
- * Constructor.
- *
- * @param freqLimitPerTarget frequency limit
- * @param timeWindow time window
- * @param activeTimeRange active time range
- */
- public Constraint(Integer freqLimitPerTarget, Map<String, String> timeWindow, Map<String, String> activeTimeRange) {
- this(freqLimitPerTarget, timeWindow);
- if (activeTimeRange != null) {
- this.activeTimeRange = Collections.unmodifiableMap(activeTimeRange);
- }
- }
-
- /**
- * Constructor.
- *
- * @param freqLimitPerTarget frequency limit
- * @param timeWindow the time window
- * @param activeTimeRange active time range
- * @param blacklist incoming blacklist
- */
- public Constraint(Integer freqLimitPerTarget, Map<String, String> timeWindow, Map<String, String> activeTimeRange,
- List<String> blacklist) {
- this(freqLimitPerTarget, timeWindow);
- if (activeTimeRange != null) {
- this.activeTimeRange = Collections.unmodifiableMap(activeTimeRange);
- }
- if (blacklist != null) {
- this.blacklist = new LinkedList<>(blacklist);
- }
- }
-
- /**
- * Constructor.
- *
- * @param constraint objec to copy
- */
- public Constraint(Constraint constraint) {
- this.freqLimitPerTarget = constraint.freqLimitPerTarget;
- this.timeWindow = constraint.timeWindow;
- if (constraint.activeTimeRange != null) {
- this.activeTimeRange = Collections.unmodifiableMap(constraint.activeTimeRange);
- }
- this.blacklist = new LinkedList<>(constraint.blacklist);
- }
-
- public Integer getFreq_limit_per_target() {
- return freqLimitPerTarget;
- }
-
-
- public void setFreq_limit_per_target(Integer freqLimitPerTarget) {
- this.freqLimitPerTarget = freqLimitPerTarget;
- }
-
-
- public Map<String, String> getTime_window() {
- return timeWindow;
- }
-
-
- public void setTime_window(Map<String, String> timeWindow) {
- this.timeWindow = timeWindow;
- }
-
-
- public Map<String, String> getActive_time_range() {
- return activeTimeRange;
- }
-
-
- public void setActive_time_range(Map<String, String> activeTimeRange) {
- this.activeTimeRange = activeTimeRange;
- }
-
-
- public List<String> getBlacklist() {
- return blacklist;
- }
-
-
- public void setBlacklist(List<String> blacklist) {
- this.blacklist = blacklist;
- }
-
-
- public Integer getMinVnfCount() {
- return minVnfCount;
- }
-
-
- public void setMinVnfCount(Integer minVnfCount) {
- this.minVnfCount = minVnfCount;
- }
-
-
- public Integer getMaxVnfCount() {
- return maxVnfCount;
- }
-
-
- public void setMaxVnfCount(Integer maxVnfCount) {
- this.maxVnfCount = maxVnfCount;
- }
-
- /**
- * Check if these constraint values are valid.
- *
- * @return true if valid
- */
- public boolean isValid() {
- //
- // Sonar likes these statements combined as well as not use
- // boolean literals.
- //
- // If the freqLimitPerTarget is null AND the timeWindow is NOT null
- // OR
- // timeWindow is null AND the freqLimitPerTarget is NOT null
- //
- // then we want to return false (hence the preceding !)
- //
- return ! ((freqLimitPerTarget == null && timeWindow != null)
- || (timeWindow == null && freqLimitPerTarget != null));
- }
-
- @Override
- public String toString() {
- return "Constraint [freq_limit_per_target=" + freqLimitPerTarget + ", time_window="
- + timeWindow + ", active_time_range=" + activeTimeRange + ", blacklist=" + blacklist + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((freqLimitPerTarget == null) ? 0 : freqLimitPerTarget.hashCode());
- result = prime * result + ((timeWindow == null) ? 0 : timeWindow.hashCode());
- result = prime * result + ((activeTimeRange == null) ? 0 : activeTimeRange.hashCode());
- result = prime * result + ((blacklist == null) ? 0 : blacklist.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Constraint other = (Constraint) obj;
- return equalsMayBeNull(freqLimitPerTarget, other.freqLimitPerTarget)
- && equalsMayBeNull(timeWindow, other.timeWindow)
- && equalsMayBeNull(activeTimeRange, other.activeTimeRange)
- && equalsMayBeNull(blacklist, other.blacklist);
- }
-
- private boolean equalsMayBeNull(final Object obj1, final Object obj2) {
- if (obj1 == null) {
- return obj2 == null;
- }
- return obj1.equals(obj2);
- }
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuard.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuard.java
deleted file mode 100644
index 7144fe363..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuard.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * Copyright (C) 2017-2019 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 java.util.LinkedList;
-import java.util.List;
-
-public class ControlLoopGuard {
-
- private Guard guard;
-
- private List<GuardPolicy> guards;
-
- public ControlLoopGuard() {
- //DO Nothing Empty Constructor
- }
-
- public ControlLoopGuard(ControlLoopGuard clGuard) {
- this.guard = new Guard();
- this.guards = new LinkedList<>(clGuard.guards);
- }
-
- public Guard getGuard() {
- return guard;
- }
-
- public void setGuard(Guard guard) {
- this.guard = guard;
- }
-
- public List<GuardPolicy> getGuards() {
- return guards;
- }
-
- public void setGuards(List<GuardPolicy> guards) {
- this.guards = guards;
- }
-
- @Override
- public String toString() {
- return "Guard [guard=" + guard + ", GuardPolicies=" + guards + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((guard == null) ? 0 : guard.hashCode());
- result = prime * result + ((guards == null) ? 0 : guards.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ControlLoopGuard other = (ControlLoopGuard) obj;
- if (guard == null) {
- if (other.guard != null) {
- return false;
- }
- } else if (!guard.equals(other.guard)) {
- return false;
- }
- if (guards == null) {
- if (other.guards != null) {
- return false;
- }
- } else if (!guards.equals(other.guards)) {
- return false;
- }
- return true;
- }
-
-
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/Guard.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/Guard.java
deleted file mode 100644
index 163cf0643..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/Guard.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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;
-
-public class Guard {
-
- private static final String DEFAULTVERSION = "2.0.0";
-
- private String version = DEFAULTVERSION;
-
- public Guard() {
- //DO Nothing empty Constructor.
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- @Override
- public String toString() {
- return "Guard [version=" + version + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((version == null) ? 0 : version.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Guard other = (Guard) obj;
- if (version == null) {
- if (other.version != null) {
- return false;
- }
- } else if (!version.equals(other.version)) {
- return false;
- }
- return true;
- }
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/GuardPolicy.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/GuardPolicy.java
deleted file mode 100644
index 5ad052b3b..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/GuardPolicy.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * Copyright (C) 2017-2019 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 java.util.List;
-import java.util.UUID;
-
-public class GuardPolicy {
-
- private String id = UUID.randomUUID().toString();
- private String name;
- private String description;
- private MatchParameters matchParameters;
- private List<Constraint> limitConstraints;
-
- public GuardPolicy() {
- //Do Nothing Empty Constructor.
- }
-
- public GuardPolicy(String id) {
- this.id = id;
- }
-
- public GuardPolicy(String name, MatchParameters matchParameters) {
- this.name = name;
- this.matchParameters = matchParameters;
- }
-
- /**
- * Constructor.
- *
- * @param id id
- * @param name name
- * @param description description
- * @param matchParameters match parameters
- */
- public GuardPolicy(String id, String name, String description, MatchParameters matchParameters) {
- this(name, matchParameters);
- this.id = id;
- this.description = description;
- }
-
- /**
- * Constructor.
- *
- * @param name name
- * @param matchParameters match parameters
- * @param limitConstraints limit constraints
- */
- public GuardPolicy(String name, MatchParameters matchParameters, List<Constraint> limitConstraints) {
- this(name, matchParameters);
- this.limitConstraints = limitConstraints;
- }
-
- public GuardPolicy(String name, String description, MatchParameters matchParameters,
- List<Constraint> limitConstraints) {
- this(name, matchParameters, limitConstraints);
- this.description = description;
- }
-
- public GuardPolicy(String id, String name, String description, MatchParameters matchParameters,
- List<Constraint> limitConstraints) {
- this(name, description, matchParameters, limitConstraints);
- this.id = id;
- }
-
- /**
- * Constructor.
- *
- * @param policy copy object
- */
- public GuardPolicy(GuardPolicy policy) {
- this.id = policy.id;
- this.name = policy.name;
- this.description = policy.description;
- this.matchParameters = new MatchParameters(policy.matchParameters);
- this.limitConstraints = policy.limitConstraints;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public MatchParameters getMatch_parameters() {
- return matchParameters;
- }
-
- public void setMatch_parameters(MatchParameters matchParameters) {
- this.matchParameters = matchParameters;
- }
-
- public List<Constraint> getLimit_constraints() {
- return limitConstraints;
- }
-
- public void setLimit_constraints(List<Constraint> limitConstraints) {
- this.limitConstraints = limitConstraints;
- }
-
- public boolean isValid() {
- return (id != null && name != null);
- }
-
- @Override
- public String toString() {
- return "Policy [id=" + id + ", name=" + name + ", description=" + description + ", match_parameters="
- + matchParameters + ", limitConstraints=" + limitConstraints + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((description == null) ? 0 : description.hashCode());
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((limitConstraints == null) ? 0 : limitConstraints.hashCode());
- result = prime * result + ((matchParameters == null) ? 0 : matchParameters.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- GuardPolicy other = (GuardPolicy) obj;
- boolean isEq = equalsMayBeNull(description, other.description)
- && equalsMayBeNull(id, other.id)
- && equalsMayBeNull(name, other.name);
- return isEq
- && equalsMayBeNull(limitConstraints, other.limitConstraints)
- && equalsMayBeNull(matchParameters, other.matchParameters);
- }
-
- private boolean equalsMayBeNull(final Object obj1, final Object obj2) {
- if (obj1 == null) {
- return obj2 == null;
- }
- return obj1.equals(obj2);
- }
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/MatchParameters.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/MatchParameters.java
deleted file mode 100644
index e0457e797..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/MatchParameters.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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 java.util.LinkedList;
-import java.util.List;
-
-
-public class MatchParameters {
- private String controlLoopName;
- private String actor;
- private String recipe;
- private List<String> targets;
-
- public MatchParameters() {
- // Do Nothing Empty Constructor.
- }
-
- public MatchParameters(String actor, String recipe) {
- this.actor = actor;
- this.recipe = recipe;
- }
-
- /**
- * Constructor.
- *
- * @param actor actor
- * @param recipe recipe
- * @param targets targets
- */
- public MatchParameters(String actor, String recipe, List<String> targets) {
- this(actor, recipe);
- if (targets != null) {
- this.targets = new LinkedList<>(targets);
- }
- }
-
- public MatchParameters(String controlLoopName, String actor, String recipe, List<String> targets) {
- this(actor, recipe, targets);
- this.controlLoopName = controlLoopName;
- }
-
- /**
- * Constructor.
- *
- * @param matchParameters match parameters
- */
- public MatchParameters(MatchParameters matchParameters) {
-
- this.controlLoopName = matchParameters.controlLoopName;
- this.actor = matchParameters.actor;
- this.recipe = matchParameters.recipe;
- if (matchParameters.targets != null) {
- this.targets = new LinkedList<>(matchParameters.targets);
- }
- }
-
- public String getControlLoopName() {
- return controlLoopName;
- }
-
- public void setControlLoopName(String controlLoopName) {
- this.controlLoopName = controlLoopName;
- }
-
- public String getActor() {
- return actor;
- }
-
- public void setActor(String actor) {
- this.actor = actor;
- }
-
- public String getRecipe() {
- return recipe;
- }
-
- public void setRecipe(String recipe) {
- this.recipe = recipe;
- }
-
- public List<String> getTargets() {
- return targets;
- }
-
- public void setTargets(List<String> targets) {
- this.targets = targets;
- }
-
- @Override
- public String toString() {
- return "MatchParameters [controlLoopName=" + controlLoopName + ", actor=" + actor + ", recipe=" + recipe
- + ", targets=" + targets + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((actor == null) ? 0 : actor.hashCode());
- result = prime * result + ((controlLoopName == null) ? 0 : controlLoopName.hashCode());
- result = prime * result + ((recipe == null) ? 0 : recipe.hashCode());
- result = prime * result + ((targets == null) ? 0 : targets.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- MatchParameters other = (MatchParameters) obj;
-
- return equalsMayBeNull(actor, other.actor)
- && equalsMayBeNull(controlLoopName, other.controlLoopName)
- && equalsMayBeNull(recipe, other.recipe)
- && equalsMayBeNull(targets, other.targets);
- }
-
- private boolean equalsMayBeNull(final Object obj1, final Object obj2) {
- if (obj1 == null) {
- return obj2 == null;
- }
- return obj1.equals(obj2);
- }
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/builder/ControlLoopGuardBuilder.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/builder/ControlLoopGuardBuilder.java
deleted file mode 100644
index a6c92ee1a..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/builder/ControlLoopGuardBuilder.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * 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.builder;
-
-import org.onap.policy.controlloop.policy.builder.BuilderException;
-import org.onap.policy.controlloop.policy.builder.Results;
-import org.onap.policy.controlloop.policy.guard.Constraint;
-import org.onap.policy.controlloop.policy.guard.ControlLoopGuard;
-import org.onap.policy.controlloop.policy.guard.Guard;
-import org.onap.policy.controlloop.policy.guard.GuardPolicy;
-import org.onap.policy.controlloop.policy.guard.builder.impl.ControlLoopGuardBuilderImpl;
-
-public interface ControlLoopGuardBuilder {
-
- /**
- * Adds one or more guard policies to the Control Loop Guard.
- *
- * @param policies policies to add
- * @return builder object
- * @throws BuilderException builder exception
- */
- public ControlLoopGuardBuilder addGuardPolicy(GuardPolicy... policies) throws BuilderException;
-
- /**
- * Removes one or more guard policies from the Control Loop Guard.
- *
- * @param policies policies to add
- * @return builder object
- * @throws BuilderException builder exception
- */
- public ControlLoopGuardBuilder removeGuardPolicy(GuardPolicy... policies) throws BuilderException;
-
- /**
- * Removes all guard policies from the Control Loop Guard.
- *
- * @return builder object
- * @throws BuilderException builder exception
- */
- public ControlLoopGuardBuilder removeAllGuardPolicies() throws BuilderException;
-
- /**
- * Adds one or more time limit constraints to the guard policy.
- *
- * @param id (guard policy id)
- * @param constraints the constraints to add
- * @return builder object
- * @throws BuilderException builder exception
- */
- public ControlLoopGuardBuilder addLimitConstraint(String id, Constraint... constraints) throws BuilderException;
-
- /**
- * Removes one or more time limit constraints from the guard policy.
- *
- * @param id (guard policy id)
- * @param constraints constraints to remove
- * @return builder object
- * @throws BuilderException builder exception
- */
- public ControlLoopGuardBuilder removeLimitConstraint(String id, Constraint... constraints) throws BuilderException;
-
- /**
- * Removes all time limit constraints from the guard policy.
- *
- * @param id (guard policy id)
- * @return builder object
- * @throws BuilderException builder exception
- */
- public ControlLoopGuardBuilder removeAllLimitConstraints(String id) throws BuilderException;
-
- /**
- * Simply return a copy of control loop guard.
- *
- * @return ControlLoopGuard
- */
- public ControlLoopGuard getControlLoopGuard();
-
- /**
- * This will compile and build the YAML specification for the Control Loop Guard.
- * Please iterate the Results object for details.
- * The Results object will contains warnings and errors.
- * If the specification compiled successfully, you will be able to retrieve the
- * YAML.
- *
- * @return Results
- */
- public Results buildSpecification();
-
- /**
- * The Factory is used to build a ControlLoopGuardBuilder implementation.
- *
- */
- public static class Factory {
-
- private Factory(){
- //Do Nothing Private Constructor.
- }
- /**
- * Build the control loop guard.
- *
- * @param guard the guard
- * @return ControlLoopGuardBuilder object
- */
-
- public static ControlLoopGuardBuilder buildControlLoopGuard(Guard guard) {
-
- return new ControlLoopGuardBuilderImpl(guard);
-
- }
- }
-}
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/builder/impl/ControlLoopGuardBuilderImpl.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/builder/impl/ControlLoopGuardBuilderImpl.java
deleted file mode 100644
index 50f5086aa..000000000
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/builder/impl/ControlLoopGuardBuilderImpl.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml
- * ================================================================================
- * Copyright (C) 2017-2019 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.builder.impl;
-
-import java.util.LinkedList;
-import org.onap.policy.controlloop.compiler.CompilerException;
-import org.onap.policy.controlloop.compiler.ControlLoopCompilerCallback;
-import org.onap.policy.controlloop.guard.compiler.ControlLoopGuardCompiler;
-import org.onap.policy.controlloop.policy.builder.BuilderException;
-import org.onap.policy.controlloop.policy.builder.MessageLevel;
-import org.onap.policy.controlloop.policy.builder.Results;
-import org.onap.policy.controlloop.policy.builder.impl.MessageImpl;
-import org.onap.policy.controlloop.policy.builder.impl.ResultsImpl;
-import org.onap.policy.controlloop.policy.guard.Constraint;
-import org.onap.policy.controlloop.policy.guard.ControlLoopGuard;
-import org.onap.policy.controlloop.policy.guard.Guard;
-import org.onap.policy.controlloop.policy.guard.GuardPolicy;
-import org.onap.policy.controlloop.policy.guard.builder.ControlLoopGuardBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.yaml.snakeyaml.DumperOptions;
-import org.yaml.snakeyaml.DumperOptions.FlowStyle;
-import org.yaml.snakeyaml.Yaml;
-
-public class ControlLoopGuardBuilderImpl implements ControlLoopGuardBuilder {
- private static final String NO_EXISTING_GUARD_POLICY_MATCHING_THE_ID = "No existing guard policy matching the id: ";
- private static final String THE_ID_OF_TARGET_GUARD_POLICY_MUST_NOT_BE_NULL =
- "The id of target guard policy must not be null";
- private static Logger logger = LoggerFactory.getLogger(ControlLoopGuardBuilderImpl.class.getName());
- private ControlLoopGuard clGuard;
-
- public ControlLoopGuardBuilderImpl(Guard guard) {
- clGuard = new ControlLoopGuard();
- clGuard.setGuard(guard);
- }
-
- @Override
- public ControlLoopGuardBuilder addGuardPolicy(GuardPolicy... policies) throws BuilderException {
- if (policies == null) {
- throw new BuilderException("GuardPolicy must not be null");
- }
- for (GuardPolicy policy : policies) {
- if (!policy.isValid()) {
- throw new BuilderException("Invalid guard policy - some required fields are missing");
- }
- if (clGuard.getGuards() == null) {
- clGuard.setGuards(new LinkedList<>());
- }
- clGuard.getGuards().add(policy);
- }
- return this;
- }
-
- @Override
- public ControlLoopGuardBuilder removeGuardPolicy(GuardPolicy... policies) throws BuilderException {
- if (policies == null) {
- throw new BuilderException("GuardPolicy must not be null");
- }
- if (clGuard.getGuards() == null) {
- throw new BuilderException("No existing guard policies to remove");
- }
- for (GuardPolicy policy : policies) {
- if (!policy.isValid()) {
- throw new BuilderException("Invalid guard policy - some required fields are missing");
- }
- boolean removed = clGuard.getGuards().remove(policy);
- if (!removed) {
- throw new BuilderException("Unknown guard policy: " + policy.getName());
- }
- }
- return this;
- }
-
- @Override
- public ControlLoopGuardBuilder removeAllGuardPolicies() throws BuilderException {
- clGuard.getGuards().clear();
- return this;
- }
-
- @Override
- public ControlLoopGuardBuilder addLimitConstraint(String id, Constraint... constraints) throws BuilderException {
- if (id == null) {
- throw new BuilderException(THE_ID_OF_TARGET_GUARD_POLICY_MUST_NOT_BE_NULL);
- }
- if (constraints == null) {
- throw new BuilderException("Constraint much not be null");
- }
- if (!addLimitConstraints(id, constraints)) {
- throw new BuilderException(NO_EXISTING_GUARD_POLICY_MATCHING_THE_ID + id);
- }
- return this;
- }
-
- private boolean addLimitConstraints(String id, Constraint... constraints) throws BuilderException {
- for (GuardPolicy policy: clGuard.getGuards()) {
- //
- // We could have only one guard policy matching the id
- //
- if (policy.getId().equals(id)) {
- addConstraints(policy, constraints);
- return true;
- }
- }
- return false;
- }
-
- private void addConstraints(GuardPolicy policy, Constraint... constraints) throws BuilderException {
- for (Constraint cons: constraints) {
- if (!cons.isValid()) {
- throw new BuilderException("Invalid guard constraint - some required fields are missing");
- }
- if (policy.getLimit_constraints() == null) {
- policy.setLimit_constraints(new LinkedList<>());
- }
- policy.getLimit_constraints().add(cons);
- }
- }
-
- @Override
- public ControlLoopGuardBuilder removeLimitConstraint(String id, Constraint... constraints) throws BuilderException {
- if (id == null) {
- throw new BuilderException(THE_ID_OF_TARGET_GUARD_POLICY_MUST_NOT_BE_NULL);
- }
- if (constraints == null) {
- throw new BuilderException("Constraint much not be null");
- }
- if (!removeConstraints(id, constraints)) {
- throw new BuilderException(NO_EXISTING_GUARD_POLICY_MATCHING_THE_ID + id);
- }
- return this;
- }
-
- private boolean removeConstraints(String id, Constraint... constraints) throws BuilderException {
- for (GuardPolicy policy: clGuard.getGuards()) {
- //
- // We could have only one guard policy matching the id
- //
- if (policy.getId().equals(id)) {
- removeConstraints(policy, constraints);
- return true;
- }
- }
- return false;
- }
-
- private void removeConstraints(GuardPolicy policy, Constraint... constraints) throws BuilderException {
- for (Constraint cons: constraints) {
- if (!cons.isValid()) {
- throw new BuilderException("Invalid guard constraint - some required fields are missing");
- }
- boolean removed = policy.getLimit_constraints().remove(cons);
- if (!removed) {
- throw new BuilderException("Unknown guard constraint: " + cons);
- }
- }
- }
-
- @Override
- public ControlLoopGuardBuilder removeAllLimitConstraints(String id) throws BuilderException {
- if (clGuard.getGuards() == null || clGuard.getGuards().isEmpty()) {
- throw new BuilderException("No guard policies exist");
- }
- if (id == null) {
- throw new BuilderException(THE_ID_OF_TARGET_GUARD_POLICY_MUST_NOT_BE_NULL);
- }
- boolean exist = false;
- for (GuardPolicy policy: clGuard.getGuards()) {
- if (policy.getId().equals(id)) {
- exist = true;
- policy.getLimit_constraints().clear();
- }
- }
- if (!exist) {
- throw new BuilderException(NO_EXISTING_GUARD_POLICY_MATCHING_THE_ID + id);
- }
- return this;
- }
-
-
- private class BuilderCompilerCallback implements ControlLoopCompilerCallback {
-
- private ResultsImpl results = new ResultsImpl();
-
- @Override
- public boolean onWarning(String message) {
- results.addMessage(new MessageImpl(message, MessageLevel.WARNING));
- return false;
- }
-
- @Override
- public boolean onError(String message) {
- results.addMessage(new MessageImpl(message, MessageLevel.ERROR));
- return false;
- }
- }
-
- @Override
- public ControlLoopGuard getControlLoopGuard() {
- return new ControlLoopGuard(this.clGuard);
- }
-
-
- @Override
- public Results buildSpecification() {
- //
- // Dump the specification
- //
- DumperOptions options = new DumperOptions();
- options.setDefaultFlowStyle(FlowStyle.BLOCK);
- options.setPrettyFlow(true);
- Yaml yaml = new Yaml(options);
- String dumpedYaml = yaml.dump(clGuard);
- //
- // This is our callback class for our compiler
- //
- BuilderCompilerCallback callback = new BuilderCompilerCallback();
- //
- // Compile it
- //
- try {
- ControlLoopGuardCompiler.compile(clGuard, callback);
- } catch (CompilerException e) {
- logger.error("Build specification threw ", e);
- callback.results.addMessage(new MessageImpl(e.getMessage(), MessageLevel.EXCEPTION));
- }
- //
- // Save the spec
- //
- callback.results.setSpecification(dumpedYaml);
- return callback.results;
- }
-
-}
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
deleted file mode 100644
index e3ab76b6b..000000000
--- a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/CompilerExceptionTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.controlloop.compiler;
-
-import org.junit.Test;
-import org.onap.policy.common.utils.test.ExceptionsTester;
-
-public class CompilerExceptionTest extends ExceptionsTester {
-
- @Test
- public void test() {
- 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
deleted file mode 100644
index 71d67f07b..000000000
--- a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopCompilerTest.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml unit test
- * ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2020 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.assertj.core.api.Assertions.assertThatThrownBy;
-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.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Test;
-import org.onap.policy.controlloop.policy.ControlLoopPolicy;
-import org.onap.policy.controlloop.policy.FinalResult;
-
-public class ControlLoopCompilerTest {
- private static final String RESTART_UNKNOWN_POLICY =
- "Operation Policy unique-policy-id-1-restart is connected to unknown policy unknown-policy";
-
- @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 recipe is null");
- 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 {
- assertThatThrownBy(() -> {
- this.test("src/test/resources/v1.0.0/bad_policy_success_connected_to_unknown_policy.yaml");
- }).isInstanceOf(CompilerException.class).hasMessage(RESTART_UNKNOWN_POLICY);
- }
-
- @Test
- public void testFailureConnectedToUnknownPolicy() throws Exception {
- assertThatThrownBy(() -> {
- this.test("src/test/resources/v1.0.0/bad_policy_failure_connected_to_unknown_policy.yaml");
- }).isInstanceOf(CompilerException.class).hasMessage(RESTART_UNKNOWN_POLICY);
- }
-
- @Test
- public void testFailureTimeoutToUnknownPolicy() throws Exception {
- assertThatThrownBy(() -> {
- this.test("src/test/resources/v1.0.0/bad_policy_failure_timeout_connected_to_unknown_policy.yaml");
- }).isInstanceOf(CompilerException.class).hasMessage(RESTART_UNKNOWN_POLICY);
- }
-
- @Test
- public void testFailureRetriesToUnknownPolicy() throws Exception {
- assertThatThrownBy(() -> {
- this.test("src/test/resources/v1.0.0/bad_policy_failure_retries_connected_to_unknown_policy.yaml");
- }).isInstanceOf(CompilerException.class).hasMessage(RESTART_UNKNOWN_POLICY);
- }
-
- @Test
- public void testFailureExceptionToUnknownPolicy() throws Exception {
- assertThatThrownBy(() -> {
- this.test("src/test/resources/v1.0.0/bad_policy_failure_exception_connected_to_unknown_policy.yaml");
- }).isInstanceOf(CompilerException.class).hasMessage(RESTART_UNKNOWN_POLICY);
- }
-
- @Test
- public void testFailureGuardToUnknownPolicy() throws Exception {
- assertThatThrownBy(() -> {
- this.test("src/test/resources/v1.0.0/bad_policy_failure_guard_connected_to_unknown_policy.yaml");
- }).isInstanceOf(CompilerException.class).hasMessage(RESTART_UNKNOWN_POLICY);
- }
-
- @Test
- public void testInvalidTriggerPolicyId() throws Exception {
- assertThatThrownBy(() -> {
- this.test("src/test/resources/v1.0.0/bad_trigger_1.yaml");
- }).isInstanceOf(CompilerException.class).hasMessage("Unexpected value for trigger_policy, should only be "
- + FinalResult.FINAL_OPENLOOP.toString() + " or a valid Policy ID");
- }
-
- @Test
- public void testNoTriggerPolicyId() throws Exception {
- assertThatThrownBy(() -> {
- this.test("src/test/resources/v1.0.0/bad_trigger_no_trigger_id.yaml");
- }).isInstanceOf(CompilerException.class);
- }
-
- @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 {
- assertThatThrownBy(() -> {
- this.test("src/test/resources/v1.0.0/bad_trigger_2.yaml");
- }).isInstanceOf(CompilerException.class).hasMessage(
- "Unexpected Final Result for trigger_policy, should only be FINAL_OPENLOOP or a valid Policy ID");
- }
-
- @Test
- public void testCompileEmptyFile() throws Exception {
- assertThatThrownBy(() -> {
- this.test("src/test/resources/v1.0.0/empty.yaml");
- }).isInstanceOf(CompilerException.class).hasMessage("Could not parse yaml specification.");
- }
-
- 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);
- }
- }
-
- 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.isEmpty();
- }
- }
-}
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
deleted file mode 100644
index b963a830d..000000000
--- a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopGuardCompilerTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml unit test
- * ================================================================================
- * Copyright (C) 2017-2019 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.assertj.core.api.Assertions.assertThatThrownBy;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import org.junit.Test;
-import org.onap.policy.controlloop.guard.compiler.ControlLoopGuardCompiler;
-
-public class ControlLoopGuardCompilerTest {
-
- private static final String ACTOR_ERROR = "Unable to find property 'actor'";
-
- @Test
- public void testTest1() throws Exception {
- this.test("src/test/resources/v2.0.0-guard/policy_guard_ONAP_demo_vDNS.yaml");
- }
-
- @Test
- public void testTest2() throws Exception {
- this.test("src/test/resources/v2.0.0-guard/policy_guard_appc_restart.yaml");
- }
-
- @Test
- public void testBad1() {
- assertThatThrownBy(() -> this.test("src/test/resources/v2.0.0-guard/no_guard_policy.yaml"))
- .hasMessage("Guard policies should not be null");
- }
-
- @Test
- public void testBad2() {
- assertThatThrownBy(() -> this.test("src/test/resources/v2.0.0-guard/duplicate_guard_policy.yaml"))
- .hasMessageContaining(ACTOR_ERROR);
- }
-
- @Test
- public void testBad3() {
- assertThatThrownBy(() -> this.test("src/test/resources/v2.0.0-guard/no_guard_constraint.yaml"))
- .hasMessageContaining(ACTOR_ERROR);
- }
-
- @Test
- public void testBad4() {
- assertThatThrownBy(() -> this.test("src/test/resources/v2.0.0-guard/duplicate_guard_constraint.yaml"))
- .hasMessageContaining(ACTOR_ERROR);
- }
-
- /**
- * 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);
- }
- }
-
-}
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
deleted file mode 100644
index 86823400c..000000000
--- a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java
+++ /dev/null
@@ -1,912 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml unit test
- * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2020 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.assertj.core.api.Assertions.assertThatThrownBy;
-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.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.util.UUID;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.onap.aai.domain.yang.Pnf;
-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 {
-
- private static final String RESOURCE1 = "resource1";
- private static final String TRIGGER_RESTART = "Upon getting the trigger event, restart the VM";
- private static final String UNKNOWN_POLICY = "Unknown policy ";
- private static final String RESTART = "Restart";
- private static final String RESTART_VM = "Restart the VM";
- private static final String REBUILD = "Rebuild";
- private static final String REBUILD_VM = "Rebuild VM";
- private static final String REBUILD_RESTART = "If the restart fails, rebuild it.";
-
- @Test
- public void testControlLoop() throws BuilderException {
- //
- // 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().isEmpty());
- //
- // 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().isEmpty());
- }
-
- @Test
- public void testAddNullService() throws BuilderException {
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
-
- assertThatThrownBy(() -> {
- builder.addService((Service) null);
- }).isInstanceOf(BuilderException.class).hasMessage("Service must not be null");
- }
-
- @Test
- public void testAddInvalidService() throws BuilderException {
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
-
- assertThatThrownBy(() -> {
- builder.addService(new Service());
- }).isInstanceOf(BuilderException.class)
- .hasMessage("Invalid service - need either a serviceUUID or serviceName");
- }
-
- @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);
-
- assertThatThrownBy(() -> {
- builder.addResource((Resource) null);
- }).isInstanceOf(BuilderException.class).hasMessage("Resource must not be null");
- }
-
- @Test
- public void testAddInvalidResource() throws BuilderException {
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
-
- assertThatThrownBy(() -> {
- builder.addResource(new Resource());
- }).isInstanceOf(BuilderException.class)
- .hasMessage("Invalid resource - need either resourceUUID or resourceName");
- }
-
- @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().isEmpty());
- }
-
- @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);
-
- assertThatThrownBy(() -> {
- builder.removeResource((Resource) null);
- }).isInstanceOf(BuilderException.class).hasMessage("Resource must not be null");
- }
-
- @Test
- public void testRemoveResourceNoExistingResources() throws BuilderException {
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
-
- assertThatThrownBy(() -> {
- builder.removeResource(new Resource(RESOURCE1, ResourceType.VF));
- }).isInstanceOf(BuilderException.class).hasMessage("No existing resources to remove");
- }
-
- @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);
-
- assertThatThrownBy(() -> {
- builder.removeResource(new Resource());
- }).isInstanceOf(BuilderException.class)
- .hasMessage("Invalid resource - need either a resourceUUID or resourceName");
- }
-
- @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";
-
- assertThatThrownBy(() -> {
- builder.removeResource(new Resource(unknownResourceName, ResourceType.VF));
- }).isInstanceOf(BuilderException.class).hasMessage("Unknown resource " + unknownResourceName);
- }
-
- @Test
- public void testControlLoopWithInitialResourceAndServices() throws BuilderException {
- 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);
- }
-
- @Test
- public void testControlLoopWithInitialResourcesAndService() throws BuilderException {
- 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);
- }
-
- @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() throws BuilderException {
- 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());
- }
-
- @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);
-
- assertThatThrownBy(() -> {
- builder.setPnf(null);
- }).isInstanceOf(BuilderException.class).hasMessage("PNF must not be null");
- }
-
- @Test
- public void testSetInvalidPnf() throws BuilderException {
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
-
- assertThatThrownBy(() -> {
- builder.setPnf(new Pnf());
- }).isInstanceOf(BuilderException.class).hasMessage("Invalid PNF - need either pnfName or pnfType");
- }
-
- @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 {
- assertThatThrownBy(() -> {
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
-
- builder = builder.setAbatement(null);
- }).isInstanceOf(BuilderException.class).hasMessage("abatement must not be null");
- }
-
- @Test
- public void testTimeout() throws BuilderException {
- //
- // 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
- //
- // @formatter:off
- Policy trigger = builder.setTriggerPolicy(PolicyParam.builder().id(UUID.randomUUID().toString())
- .name(RESTART_VM)
- .description(TRIGGER_RESTART)
- .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);
- assertEquals(Integer.valueOf(300 + 600), builder.calculateTimeout());
- // @formatter:on
- }
-
- @Test
- public void testTriggerPolicyMethods() throws BuilderException {
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- //
- // Test isOpenLoop
- //
- assertTrue(builder.isOpenLoop());
- //
- // Test set initial trigger policy
- //
- // @formatter:off
- Policy triggerPolicy1 = builder.setTriggerPolicy(PolicyParam.builder().id(UUID.randomUUID().toString())
- .name(RESTART_VM)
- .description(TRIGGER_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(RESTART)
- .payload(null)
- .retries(2)
- .timeout(300)
- .build());
- assertFalse(builder.isOpenLoop());
- assertEquals(builder.getControlLoop().getTrigger_policy(), 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());
- // @formatter:on
- //
- // 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));
- }
-
- @Test
- public void testSetTriggerPolicyNullPolicyId() throws BuilderException {
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
-
- assertThatThrownBy(() -> {
- builder.setExistingTriggerPolicy(null);
- }).isInstanceOf(BuilderException.class).hasMessage("Id must not be null");
- }
-
- @Test
- public void testSetTriggerPolicyNoPoliciesExist() throws BuilderException {
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- final String unknownPolicyId = "100";
-
- assertThatThrownBy(() -> {
- builder.setExistingTriggerPolicy(unknownPolicyId);
- }).isInstanceOf(BuilderException.class).hasMessage(UNKNOWN_POLICY + unknownPolicyId);
- }
-
- @Test
- public void testSetTriggerPolicyUnknownPolicy() throws BuilderException {
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- // @formatter:off
- builder.setTriggerPolicy(PolicyParam.builder().id(UUID.randomUUID().toString())
- .name(RESTART_VM)
- .description(TRIGGER_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(RESTART)
- .payload(null)
- .retries(2)
- .timeout(300)
- .build());
- // @formatter:on
- final String unknownPolicyId = "100";
-
- assertThatThrownBy(() -> {
- builder.setExistingTriggerPolicy(unknownPolicyId);
- }).isInstanceOf(BuilderException.class).hasMessage(UNKNOWN_POLICY + unknownPolicyId);
- }
-
- @Test
- public void testAddRemovePolicies() throws BuilderException {
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- // @formatter:off
- Policy triggerPolicy = builder.setTriggerPolicy(PolicyParam.builder().id(UUID.randomUUID().toString())
- .name(RESTART_VM)
- .description(TRIGGER_RESTART)
- .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(REBUILD_RESTART)
- .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);
- //
- // @formatter:on
- 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
- //
- // @formatter:off
- final Policy onRestartFailurePolicy2 = builder.setPolicyForPolicyResult(
- PolicyParam.builder()
- .name(REBUILD_VM)
- .description(REBUILD_RESTART)
- .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);
- // @formatter:on
- //
- // 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()));
- }
-
- @Test
- public void testAddToUnknownPolicy() throws BuilderException {
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- final String policyId = "100";
-
- assertThatThrownBy(() -> {
- // @formatter:off
- builder.setPolicyForPolicyResult(
- PolicyParam.builder()
- .name(REBUILD_VM)
- .description(REBUILD_RESTART)
- .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);
- // @formatter:on
- }).isInstanceOf(BuilderException.class).hasMessage(UNKNOWN_POLICY + policyId);
-
- }
-
- @Test
- public void testAddExistingPolicyToUnknownPolicy() throws BuilderException {
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- // @formatter:off
- Policy triggerPolicy = builder.setTriggerPolicy(PolicyParam.builder()
- .id(UUID.randomUUID().toString())
- .name(RESTART_VM)
- .description(TRIGGER_RESTART)
- .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(REBUILD_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(REBUILD)
- .payload(null)
- .retries(1)
- .timeout(600)
- .id(triggerPolicy.getId())
- .build(),
- PolicyResult.FAILURE);
-
- // @formatter:on
- final String unknownPolicyId = "100";
-
- assertThatThrownBy(() -> {
- builder.setPolicyForPolicyResult(onRestartFailurePolicy.getId(), unknownPolicyId, PolicyResult.FAILURE);
- }).isInstanceOf(BuilderException.class).hasMessage(unknownPolicyId + " does not exist");
-
- }
-
- @Test
- public void testAddUnknownExistingPolicyToPolicy() throws BuilderException {
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- // @formatter:off
- Policy triggerPolicy = builder.setTriggerPolicy(PolicyParam.builder()
- .id(UUID.randomUUID().toString())
- .name(RESTART_VM)
- .description(TRIGGER_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(RESTART)
- .payload(null)
- .retries(2)
- .timeout(300)
- .build());
- // @formatter:on
-
- final String unknownPolicyId = "100";
-
- assertThatThrownBy(() -> {
- builder.setPolicyForPolicyResult(unknownPolicyId, triggerPolicy.getId(), PolicyResult.FAILURE);
- }).isInstanceOf(BuilderException.class).hasMessage("Operational policy " + unknownPolicyId + " does not exist");
-
- }
-
- @Test
- public void testAddOperationsAccumulateParams() throws BuilderException {
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- // @formatter:off
- 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());
- // @formatter:on
- //
- // Add the operationsAccumulateParams
- //
- triggerPolicy =
- builder.addOperationsAccumulateParams(triggerPolicy.getId(), new OperationsAccumulateParams("15m", 5));
- assertNotNull(builder.getTriggerPolicy().getOperationsAccumulateParams());
- assertEquals("15m", builder.getTriggerPolicy().getOperationsAccumulateParams().getPeriod());
- assertTrue(builder.getTriggerPolicy().getOperationsAccumulateParams().getLimit() == 5);
- }
-
- @Test
- public void testBuildSpecification() throws BuilderException {
- //
- // Create the builder
- //
- ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 800);
- //
- // Set the first invalid trigger policy
- //
- // @formatter:off
- final Policy policy1 = builder.setTriggerPolicy(
- PolicyParam.builder()
- .id(UUID.randomUUID().toString())
- .name(RESTART_VM)
- .description(TRIGGER_RESTART)
- .actor(null)
- .target(null)
- .recipe(null)
- .payload(null)
- .retries(2)
- .timeout(300)
- .build());
- Results results = builder.buildSpecification();
- // @formatter:on
- //
- // 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 ("Policy actor is null".equals(m.getMessage()) && m.getLevel() == MessageLevel.ERROR) {
- invalidActor = true;
- }
- if ("Policy recipe is null".equals(m.getMessage()) && m.getLevel() == MessageLevel.ERROR) {
- invalidRecipe = true;
- }
- if ("Policy target is null".equals(m.getMessage()) && 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
- //
- // @formatter:off
- Policy policy1a = builder.setTriggerPolicy(PolicyParam.builder()
- .id(UUID.randomUUID().toString())
- .name(REBUILD_VM)
- .description(REBUILD_RESTART)
- .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_VM)
- .description(TRIGGER_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(RESTART)
- .payload(null)
- .retries(2)
- .timeout(300)
- .build());
- // @formatter:on
- //
- // 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 ("controlLoop overall timeout is less than the sum of operational policy timeouts."
- .equals(m.getMessage()) && 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 ("Open Loop policy contains policies. The policies will never be invoked.".equals(m.getMessage())
- && m.getLevel() == MessageLevel.WARNING) {
- unreachable = true;
- break;
- }
- }
- assertTrue(unreachable);
- }
-
- @Test
- public void test1() throws Exception {
- this.test("src/test/resources/v1.0.0/policy_Test.yaml");
- }
-
- @Test
- public void testEvilYaml() throws Exception {
- try (InputStream is = new FileInputStream(new File("src/test/resources/v1.0.0/test_evil.yaml"))) {
- //
- // Attempt to read the yaml into our Java Object
- //
- Yaml yaml = new Yaml(new Constructor(ControlLoopPolicy.class));
- assertThatThrownBy(() -> yaml.load(is)).isInstanceOf(YAMLException.class);
- }
- }
-
- /**
- * Does the actual test.
- *
- * @param testFile input file
- * @throws Exception if an error occurs
- */
- public void test(String testFile) throws Exception {
- 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) {
- setTriggerPolicies(policyTobuild, builder);
- }
-
- // Question : how to change policy ID and results by using builder ??
-
- @SuppressWarnings("unused")
- Results results = builder.buildSpecification();
- }
-
- }
-
- private void setTriggerPolicies(ControlLoopPolicy policyTobuild, ControlLoopPolicyBuilder builder)
- throws BuilderException {
- for (Policy policy : policyTobuild.getPolicies()) {
- if (policy.getId() == policyTobuild.getControlLoop().getTrigger_policy()) {
- // @formatter:off
- 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());
- // @formatter:on
- }
- }
- }
-}
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
deleted file mode 100644
index 71a80dbf7..000000000
--- a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml unit test
- * ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2020 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.assertNotNull;
-
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
-import org.junit.Test;
-import org.onap.policy.common.utils.coder.YamlJsonTranslator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ControlLoopPolicyTest {
- private static final Logger logger = LoggerFactory.getLogger(ControlLoopPolicyTest.class);
-
- @Test
- public void test1() throws Exception {
- this.test("src/test/resources/v1.0.0/policy_Test.yaml");
- }
-
- @Test
- public void testvService1() throws Exception {
- this.test("src/test/resources/v1.0.0/policy_vService.yaml");
- }
-
- @Test
- public void testOpenLoop() throws Exception {
- this.test("src/test/resources/v1.0.0/policy_OpenLoop.yaml");
- }
-
- @Test
- public void testvdns() throws Exception {
- this.test("src/test/resources/v2.0.0/policy_ONAP_demo_vDNS.yaml");
- }
-
- @Test
- public void testvFirewall() throws Exception {
- this.test("src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml");
- }
-
- @Test
- public void testvcpe() throws Exception {
- this.test("src/test/resources/v2.0.0/policy_ONAP_UseCase_vCPE.yaml");
- }
-
- @Test
- public void testvpci() throws Exception {
- this.test("src/test/resources/v2.0.0/policy_ONAP_UseCase_vPCI.yaml");
- }
-
- @Test
- public void testvolte() throws Exception {
- this.test("src/test/resources/v2.0.0/policy_ONAP_UseCase_VOLTE.yaml");
- }
-
- /**
- * Does the actual test.
- *
- * @param testFile input file
- * @throws Exception if an error occurs
- */
- public void test(String testFile) throws Exception {
- try (InputStreamReader fileInputStream = new InputStreamReader(new FileInputStream(testFile))) {
- //
- // Read the yaml into our Java Object
- //
- ControlLoopPolicy controlLoopPolicy1 =
- new YamlJsonTranslator().fromYaml(fileInputStream, ControlLoopPolicy.class);
- assertNotNull(controlLoopPolicy1);
- dump(controlLoopPolicy1);
-
- //
- // Now dump it to a yaml string
- //
- String dumpedYaml = new YamlJsonTranslator().toYaml(controlLoopPolicy1);
- logger.debug(dumpedYaml);
- //
- // Read that string back into our java object
- //
- ControlLoopPolicy controlLoopPolicy2 =
- new YamlJsonTranslator().fromYaml(dumpedYaml, ControlLoopPolicy.class);
- assertNotNull(controlLoopPolicy2);
- dump(controlLoopPolicy2);
-
- // test serialization
- assertEquals(controlLoopPolicy1, controlLoopPolicy2);
- }
- }
-
- public void dump(Object obj) {
- logger.debug("Dumping ", obj.getClass().getName());
- 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
deleted file mode 100644
index f247baa0c..000000000
--- a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopTest.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2018-2019 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.aai.domain.yang.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 static final String SERVICE2 = "service2";
- private static final String SERVICE1 = "service1";
- private static final String RESOURCE2 = "resource2";
- private static final String RESOURCE1 = "resource1";
- private static final String PNF1 = "pnf 1";
- 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(PNF1);
-
- 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(PNF1);
-
- 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(PNF1);
-
- 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
deleted file mode 100644
index d06f3c010..000000000
--- a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/OperationsAccumulateParamsTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*-
- * ============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
deleted file mode 100644
index e87a421c4..000000000
--- a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/PolicyTest.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * ============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
deleted file mode 100644
index 973caf9b4..000000000
--- a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ConstraintTest.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2018-2019 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 {
-
- private static final String TIME_WINDOW_VALUE = "timeWindowValue";
- private static final String TIME_WINDOW_KEY = "timeWindowKey";
- private static final String BLACKLIST_ITEM = "blacklist item";
-
- @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(TIME_WINDOW_KEY, TIME_WINDOW_VALUE);
- 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(TIME_WINDOW_KEY, TIME_WINDOW_VALUE);
- 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(TIME_WINDOW_KEY, TIME_WINDOW_VALUE);
- 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(TIME_WINDOW_KEY, TIME_WINDOW_VALUE);
- 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(TIME_WINDOW_KEY, TIME_WINDOW_VALUE);
- 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(TIME_WINDOW_KEY, TIME_WINDOW_VALUE);
- 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
deleted file mode 100644
index a2148120b..000000000
--- a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuardBuilderTest.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml unit test
- * ================================================================================
- * Copyright (C) 2017-2019 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 java.io.File;
-import java.io.FileInputStream;
-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() throws BuilderException {
- //
- // 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 ("ControlLoop Guard should have at least one guard policies".equals(m.getMessage())
- && m.getLevel() == MessageLevel.ERROR) {
- noGuardPolicies = true;
- break;
- }
- }
- assertTrue(noGuardPolicies);
- //
- // Add a guard policy without limit constraint
- //
- String clname = "CL_vUSP123";
- List<String> targets = new LinkedList<>();
- 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 ("Guard policy guardpolicy1 does not have any limit constraint".equals(m.getMessage())
- && m.getLevel() == MessageLevel.ERROR) {
- noConstraint = true;
- break;
- }
- }
- assertTrue(noConstraint);
- //
- // Add a constraint to policy1
- //
- Map<String, String> activeTimeRange = new HashMap<>();
- activeTimeRange.put("start", "00:00:00-05:00");
- activeTimeRange.put("end", "23:59:59-05:00");
- List<String> blacklist = new LinkedList<>();
- blacklist.add("eNodeB_common_id1");
- blacklist.add("eNodeB_common_id2");
- Map<String, String> timeWindow = new HashMap<>();
- 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 ("Guard policy guardpolicy1 has duplicate limit constraints".equals(m.getMessage())
- && 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 ("There are duplicate guard policies".equals(m.getMessage())
- && 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);
- }
-
- @Test
- public void test1() throws Exception {
- this.test("src/test/resources/v2.0.0-guard/policy_guard_ONAP_demo_vDNS.yaml");
- }
-
- @Test
- public void test2() throws Exception {
- this.test("src/test/resources/v2.0.0-guard/policy_guard_appc_restart.yaml");
- }
-
- /**
- * Do the actual test.
- *
- * @param testFile input test file
- * @throws Exception if an error occurs
- */
- public void test(String testFile) throws Exception {
- 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());
- }
- }
-}
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
deleted file mode 100644
index 3d4cb37dd..000000000
--- a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuardTest.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-yaml unit test
- * ================================================================================
- * Copyright (C) 2017-2019 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 java.io.File;
-import java.io.FileInputStream;
-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() throws Exception {
- this.test("src/test/resources/v2.0.0-guard/policy_guard_ONAP_demo_vDNS.yaml");
- }
-
- @Test
- public void testGuardvusp() throws Exception {
- 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
- * @throws Exception if an error occurs
- */
- public void test(String testFile) throws Exception {
- 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);
-
- assertEquals(obj, newObject);
- }
- }
-
- public void dump(Object obj) {
- logger.debug("Dumping {}", obj.getClass().getName());
- 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
deleted file mode 100644
index 9bdcd6062..000000000
--- a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/guard/GuardPolicyTest.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2018-2019 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 {
-
- private static final String GUARD_DESCRIPTION = "guard description";
- private static final String GUARD_ID = "guard id";
- private static final String GUARD_NAME = "guard name";
-
- @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
deleted file mode 100644
index 768545307..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_control_loop_no_control_loop_name.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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
deleted file mode 100644
index cc4d0996f..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_connected_to_unknown_policy.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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
deleted file mode 100644
index c25cf707c..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_exception_connected_to_unknown_policy.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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
deleted file mode 100644
index 50ab0cf0a..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_guard_connected_to_unknown_policy.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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
deleted file mode 100644
index eb8f08458..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_retries_connected_to_unknown_policy.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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
deleted file mode 100644
index 77c296363..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_failure_timeout_connected_to_unknown_policy.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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
deleted file mode 100644
index ee2ee7f92..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_policy_success_connected_to_unknown_policy.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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
deleted file mode 100644
index ad5736b86..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_trigger_1.yaml
+++ /dev/null
@@ -1,109 +0,0 @@
-# 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
deleted file mode 100644
index c04e0ba71..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_trigger_2.yaml
+++ /dev/null
@@ -1,109 +0,0 @@
-# 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
deleted file mode 100644
index e5ee3fe4a..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/bad_trigger_no_trigger_id.yaml
+++ /dev/null
@@ -1,35 +0,0 @@
-# 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
deleted file mode 100644
index 5337f9cc7..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/empty.yaml
+++ /dev/null
@@ -1,14 +0,0 @@
-# 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
deleted file mode 100644
index 20ae46e19..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_OpenLoop.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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
deleted file mode 100644
index de2590c15..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_Test.yaml
+++ /dev/null
@@ -1,115 +0,0 @@
-# Copyright 2018 AT&T Intellectual Property. All rights reserved
-# Modifications Copyright (C) 2019-2020 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
- 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:
- type: 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:
- type: 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:
- type: 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:
- type: 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:
- type: 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
deleted file mode 100644
index 44c081cb7..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_vService.yaml
+++ /dev/null
@@ -1,78 +0,0 @@
-# Copyright 2018 AT&T Intellectual Property. All rights reserved
-# Modifications Copyright (C) 2019-2020 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:
- type: 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:
- type: 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:
- 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
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
deleted file mode 100644
index 440e7b309..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/test.yaml
+++ /dev/null
@@ -1,318 +0,0 @@
-# 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
deleted file mode 100644
index 499f2ca28..000000000
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/test_evil.yaml
+++ /dev/null
@@ -1,39 +0,0 @@
-# Copyright 2018-2019 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: NOT_A_NUMBER
-
-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
deleted file mode 100644
index b6f92e718..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/duplicate_guard_constraint.yaml
+++ /dev/null
@@ -1,35 +0,0 @@
-# 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
deleted file mode 100644
index a510340b1..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/duplicate_guard_policy.yaml
+++ /dev/null
@@ -1,41 +0,0 @@
-# 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
deleted file mode 100644
index 6f986e14f..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/no_guard_constraint.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
-# 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
deleted file mode 100644
index a5afca265..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/no_guard_policy.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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
deleted file mode 100644
index c71caab2d..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/policy_guard_ONAP_demo_vDNS.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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
deleted file mode 100644
index df682d107..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/policy_guard_appc_restart.yaml
+++ /dev/null
@@ -1,38 +0,0 @@
-# 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
deleted file mode 100644
index a835aefcf..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0-guard/policy_guard_blacklist.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
-# 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
deleted file mode 100644
index 4b501953c..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-59a2ee3fB58045feB5a1-template.yml
+++ /dev/null
@@ -1,1698 +0,0 @@
-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
deleted file mode 100644
index c0f4f4d39..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-Eace933104d443b496b8-template.yml
+++ /dev/null
@@ -1,2525 +0,0 @@
-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
deleted file mode 100644
index 4bfd629e9..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-57e66ea70ed645c7970f-template.yml
+++ /dev/null
@@ -1,677 +0,0 @@
-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
deleted file mode 100644
index 2293b3aca..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-D473899264974dca9db9-template.yml
+++ /dev/null
@@ -1,677 +0,0 @@
-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/policy_ONAP_UseCase_VOLTE.yaml b/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_VOLTE.yaml
deleted file mode 100644
index f001e9f2a..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_VOLTE.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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
deleted file mode 100644
index e1c9b071e..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_vCPE.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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
deleted file mode 100644
index b5c028b7e..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_UseCase_vPCI.yaml
+++ /dev/null
@@ -1,40 +0,0 @@
-# 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
deleted file mode 100644
index 4341eb9ff..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vDNS.yaml
+++ /dev/null
@@ -1,64 +0,0 @@
-# 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
deleted file mode 100644
index feaba64cf..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml
+++ /dev/null
@@ -1,72 +0,0 @@
-# Copyright 2018-2019 AT&T Intellectual Property. All rights reserved
-# Modifications Copyright (C) 2019-2020 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}'
- streams: '{"active-streams":5}'
- 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
deleted file mode 100644
index 2344ab9c8..000000000
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_vService.yaml
+++ /dev/null
@@ -1,135 +0,0 @@
-# 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
-
-
diff --git a/models-interactions/pom.xml b/models-interactions/pom.xml
index 4583b9341..50999c08a 100644
--- a/models-interactions/pom.xml
+++ b/models-interactions/pom.xml
@@ -36,7 +36,6 @@
<modules>
<module>model-simulators</module>
- <module>model-yaml</module>
<module>model-impl</module>
<module>model-actors</module>
</modules>