summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl
diff options
context:
space:
mode:
authorAviZi <avi.ziv@amdocs.com>2017-06-09 02:39:56 +0300
committerAviZi <avi.ziv@amdocs.com>2017-06-09 02:39:56 +0300
commit280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch)
tree9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl
parentfd3821dad11780d33c5373d74c957c442489945e (diff)
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370 Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl')
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/pom.xml92
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/pom.xml.versionsBackup92
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttHeatResourceTypes.java53
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttLoggerErrorDescription.java9
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttLoggerTargetServiceName.java9
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttValetGroupTypeValues.java53
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/impl/validators/AttValetGroupAssignmentResourceValidator.java60
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/messages/Messages.java20
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/resources/config-merge-validaton.json18
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/java/com/att/sdc/validation/impl/validators/AttValetGroupAssignmentResourceValidatorTest.java61
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/MANIFEST.json27
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/first.env0
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/first.yaml22
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/second.yaml14
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/MANIFEST.json27
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/first.env0
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/first.yaml17
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/second.yaml14
18 files changed, 588 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/pom.xml
new file mode 100644
index 0000000000..4afac92088
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/pom.xml
@@ -0,0 +1,92 @@
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ 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>
+
+ <name>att-sdc-validation-impl</name>
+ <artifactId>att-sdc-validation-impl</artifactId>
+
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-datatypes-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>${logback.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-logging-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-logging-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-validation-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-validation-core</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-validation-impl</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-heat-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>${testng.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-validation-sdk</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${mvn.surefire.version}</version>
+ <configuration>
+ <useSystemClassLoader>false</useSystemClassLoader>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/pom.xml.versionsBackup
new file mode 100644
index 0000000000..b53f4159fc
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/pom.xml.versionsBackup
@@ -0,0 +1,92 @@
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ 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>
+
+ <name>att-sdc-validation-impl</name>
+ <artifactId>att-sdc-validation-impl</artifactId>
+
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-datatypes-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>${logback.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-logging-core</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-logging-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-validation-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-validation-core</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-validation-impl</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-heat-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>6.9.10</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-validation-sdk</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.19.1</version>
+ <configuration>
+ <useSystemClassLoader>false</useSystemClassLoader>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttHeatResourceTypes.java b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttHeatResourceTypes.java
new file mode 100644
index 0000000000..427fc9c84a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttHeatResourceTypes.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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 com.att.sdc.validation.datatypes;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum AttHeatResourceTypes {
+ ATT_VALET_GROUP_ASSIGNMENT("ATT::Valet::GroupAssignment");
+
+ private static Map<String, AttHeatResourceTypes> stringToAttRsourceMap;
+
+ static {
+ stringToAttRsourceMap = new HashMap<>();
+
+ for (AttHeatResourceTypes attHeatResourceType : AttHeatResourceTypes.values()) {
+ stringToAttRsourceMap.put(attHeatResourceType.type, attHeatResourceType);
+ }
+ }
+
+ private String type;
+
+
+ AttHeatResourceTypes(String type) {
+ this.type = type;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public static AttHeatResourceTypes findByResourceType(String type) {
+ return stringToAttRsourceMap.get(type);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttLoggerErrorDescription.java b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttLoggerErrorDescription.java
new file mode 100644
index 0000000000..c4f1d0a4b4
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttLoggerErrorDescription.java
@@ -0,0 +1,9 @@
+package com.att.sdc.validation.datatypes;
+
+/**
+ * Created by TALIO on 5/21/2017.
+ */
+public class AttLoggerErrorDescription {
+
+ public static final String ATT_VALET_IN_USE = "ATT Valet group type is in use";
+}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttLoggerTargetServiceName.java b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttLoggerTargetServiceName.java
new file mode 100644
index 0000000000..111a9873fc
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttLoggerTargetServiceName.java
@@ -0,0 +1,9 @@
+package com.att.sdc.validation.datatypes;
+
+/**
+ * Created by TALIO on 5/21/2017.
+ */
+public class AttLoggerTargetServiceName {
+
+ public static final String VALIDATE_ATT_VALET_TYPE = "Validate OPENECOMP Valet Group Resosurce Type";
+}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttValetGroupTypeValues.java b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttValetGroupTypeValues.java
new file mode 100644
index 0000000000..08647b18af
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/datatypes/AttValetGroupTypeValues.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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 com.att.sdc.validation.datatypes;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public enum AttValetGroupTypeValues {
+ EXCLUSIVITY("exclusivity"),
+ AFFINITY("affinity"),
+ DIVERSITY("diversity");
+
+ private static List<String> groupTypeAsStrings;
+
+ static {
+ groupTypeAsStrings = new ArrayList<>();
+ for (AttValetGroupTypeValues attGroupTypeValue : AttValetGroupTypeValues.values()) {
+ groupTypeAsStrings.add(attGroupTypeValue.groupTypeValue);
+ }
+ }
+
+ private String groupTypeValue;
+
+ AttValetGroupTypeValues(String groupTypeValue) {
+ this.groupTypeValue = groupTypeValue;
+ }
+
+ public static boolean isGroupTypeValid(Object groupType) {
+ if (groupType instanceof Map) {
+ return true;
+ }
+ return groupTypeAsStrings.contains(groupType);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/impl/validators/AttValetGroupAssignmentResourceValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/impl/validators/AttValetGroupAssignmentResourceValidator.java
new file mode 100644
index 0000000000..30b65f4b3e
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/impl/validators/AttValetGroupAssignmentResourceValidator.java
@@ -0,0 +1,60 @@
+package com.att.sdc.validation.impl.validators;
+
+import com.att.sdc.validation.datatypes.AttLoggerErrorDescription;
+import com.att.sdc.validation.datatypes.AttLoggerTargetServiceName;
+import com.att.sdc.validation.datatypes.AttValetGroupTypeValues;
+import com.att.sdc.validation.messages.Messages;
+import org.apache.commons.collections4.MapUtils;
+import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder;
+import org.openecomp.core.validation.types.GlobalValidationContext;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.heat.datatypes.model.Resource;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.validation.ResourceValidator;
+import org.openecomp.sdc.validation.ValidationContext;
+
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * Created by TALIO on 2/26/2017.
+ */
+public class AttValetGroupAssignmentResourceValidator implements ResourceValidator {
+ private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+
+ @Override
+ public void validate(String fileName, Map.Entry<String, Resource> resourceEntry,
+ GlobalValidationContext globalContext, ValidationContext validationContext) {
+ mdcDataDebugMessage.debugEntryMessage("file", fileName);
+
+ Resource resource = resourceEntry.getValue();
+
+ Map<String, Object> propertiesMap = resource.getProperties();
+ if (MapUtils.isEmpty(propertiesMap)) {
+ return;
+ }
+
+ Object groupTypeValue = propertiesMap.get("group_type");
+ if (Objects.isNull(groupTypeValue)) {
+ return;
+ }
+
+ validateGroupTypeValue(fileName, resourceEntry.getKey(), groupTypeValue, globalContext);
+ mdcDataDebugMessage.debugExitMessage("file", fileName);
+ }
+
+ private static void validateGroupTypeValue(String fileName, String resourceId,
+ Object groupTypeValue,
+ GlobalValidationContext globalContext) {
+ mdcDataDebugMessage.debugEntryMessage("file", fileName);
+
+ if (!AttValetGroupTypeValues.isGroupTypeValid(groupTypeValue)) {
+ globalContext.addMessage(fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder
+ .getErrorWithParameters(Messages.UNEXPECTED_GROUP_TYPE_ATT_VALET.getErrorMessage(),
+ resourceId), AttLoggerTargetServiceName.VALIDATE_ATT_VALET_TYPE,
+ AttLoggerErrorDescription.ATT_VALET_IN_USE);
+ }
+
+ mdcDataDebugMessage.debugExitMessage("file", fileName);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/messages/Messages.java b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/messages/Messages.java
new file mode 100644
index 0000000000..0b3274edf0
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/java/com/att/sdc/validation/messages/Messages.java
@@ -0,0 +1,20 @@
+package com.att.sdc.validation.messages;
+
+/**
+ * Created by TALIO on 5/17/2017.
+ */
+public enum Messages {
+
+ UNEXPECTED_GROUP_TYPE_ATT_VALET(
+ "Unexpected group_type for ATT::Valet::GroupAssignment, Resource ID [%s]");
+
+ private String errorMessage;
+
+ Messages(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/resources/config-merge-validaton.json b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/resources/config-merge-validaton.json
new file mode 100644
index 0000000000..179f13c344
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/main/resources/config-merge-validaton.json
@@ -0,0 +1,18 @@
+{
+ "validatorImplementations": {
+ "resourceHeatValidator": {
+ "properties": {
+ "resourceBaseValidator": {
+ "ATT::Valet::GroupAssignment": {
+ "enable": true,
+ "implementationClass": "com.att.sdc.validation.impl.validators.AttValetGroupAssignmentResourceValidator"
+ }
+ }
+ }
+ }
+ },
+ "_config": {
+ "namespace": "validation",
+ "mergeStrategy": "merge"
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/java/com/att/sdc/validation/impl/validators/AttValetGroupAssignmentResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/java/com/att/sdc/validation/impl/validators/AttValetGroupAssignmentResourceValidatorTest.java
new file mode 100644
index 0000000000..76e10215e3
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/java/com/att/sdc/validation/impl/validators/AttValetGroupAssignmentResourceValidatorTest.java
@@ -0,0 +1,61 @@
+package com.att.sdc.validation.impl.validators;
+
+import com.att.sdc.validation.datatypes.AttHeatResourceTypes;
+import com.att.sdc.validation.datatypes.AttValetGroupTypeValues;
+import org.openecomp.sdc.validation.Validator;
+import org.openecomp.core.validation.api.ValidationManager;
+import org.openecomp.core.validation.factory.ValidationManagerFactory;
+import org.openecomp.core.validation.types.GlobalValidationContext;
+import org.openecomp.core.validation.types.MessageContainer;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.validation.impl.validators.HeatResourceValidator;
+import org.openecomp.sdc.validation.util.ValidationTestUtil;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+
+public class AttValetGroupAssignmentResourceValidatorTest {
+
+ HeatResourceValidator baseValidator = new HeatResourceValidator();
+ AttValetGroupAssignmentResourceValidator resourceValidator = new
+ AttValetGroupAssignmentResourceValidator();
+
+ @Test
+ public void testATTValetGroupType() {
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ resourceValidator, AttHeatResourceTypes.ATT_VALET_GROUP_ASSIGNMENT.getType(),
+ "/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive");
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.size(), 0);
+
+ messages = ValidationTestUtil.testValidator(baseValidator,
+ resourceValidator, AttHeatResourceTypes.ATT_VALET_GROUP_ASSIGNMENT.getType(),
+ "/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative");
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.size(), 1);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 2);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
+ "WARNING: Unexpected group_type for ATT::Valet::GroupAssignment, Resource ID [valet_group_assignment_illegal_1]");
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(1).getMessage(),
+ "WARNING: Unexpected group_type for ATT::Valet::GroupAssignment, Resource ID [valet_group_assignment_illegal_2]");
+ }
+
+ @Test
+ public void testValidationWithFullFlowFromValidationFactory() throws IOException {
+ GlobalValidationContext globalContext = ValidationTestUtil.createGlobalContextFromPath(
+ "/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative");
+ ValidationManager validationManager = ValidationManagerFactory.getInstance().createInterface();
+ validationManager.updateGlobalContext(globalContext);
+ Map<String, List<ErrorMessage>> messages = validationManager.validate();
+
+ Assert.assertNotNull(messages);
+ ErrorMessage excpectedMessage = new ErrorMessage(ErrorLevel.WARNING,
+ "WARNING: Unexpected group_type for ATT::Valet::GroupAssignment, Resource ID [valet_group_assignment_illegal_1]");
+ Assert.assertTrue(messages.get("first.yaml").contains(excpectedMessage));
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/MANIFEST.json
new file mode 100644
index 0000000000..76ce6de6e6
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/MANIFEST.json
@@ -0,0 +1,27 @@
+{
+ "name": "validTest",
+ "description": "Valid Test",
+ "version": "1610",
+ "data": [
+ {
+ "file": "first.yaml",
+ "type": "HEAT",
+ "isBase": true,
+ "data": [
+ {
+ "file": "first.env",
+ "type": "HEAT_ENV"
+ },
+ {
+ "file": "firstVol.yaml",
+ "type": "HEAT_VOL"
+ }
+ ]
+ },
+ {
+ "file": "second.yaml",
+ "type": "HEAT",
+ "isBase": false
+ }
+ ]
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/first.env
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/first.env
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/first.yaml
new file mode 100644
index 0000000000..99e707e91d
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/first.yaml
@@ -0,0 +1,22 @@
+heat_template_version: 2013-05-23
+
+description: heat expose volume resource
+
+resources:
+ valet_group_assignment_illegal_1:
+ type: ATT::Valet::GroupAssignment
+ properties:
+ group_type: blabla
+
+ valet_group_assignment_illegal_2:
+ type: ATT::Valet::GroupAssignment
+ properties:
+ group_type: blabla
+
+ valet_group_assignment_legal:
+ type: ATT::Valet::GroupAssignment
+ properties:
+ group_type: diversity
+
+
+
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/second.yaml
new file mode 100644
index 0000000000..bb06b9d60a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/negative/second.yaml
@@ -0,0 +1,14 @@
+heat_template_version: 2013-05-23
+
+description: heat second
+
+resources:
+ network_expose:
+ type: OS::Neutron::Net
+
+outputs:
+ expose_resource_network_output:
+ description: the pcrf_server
+ value: { get_resource: network_expose }
+
+
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/MANIFEST.json
new file mode 100644
index 0000000000..76ce6de6e6
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/MANIFEST.json
@@ -0,0 +1,27 @@
+{
+ "name": "validTest",
+ "description": "Valid Test",
+ "version": "1610",
+ "data": [
+ {
+ "file": "first.yaml",
+ "type": "HEAT",
+ "isBase": true,
+ "data": [
+ {
+ "file": "first.env",
+ "type": "HEAT_ENV"
+ },
+ {
+ "file": "firstVol.yaml",
+ "type": "HEAT_VOL"
+ }
+ ]
+ },
+ {
+ "file": "second.yaml",
+ "type": "HEAT",
+ "isBase": false
+ }
+ ]
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/first.env
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/first.env
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/first.yaml
new file mode 100644
index 0000000000..14f8e7e550
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/first.yaml
@@ -0,0 +1,17 @@
+heat_template_version: 2013-05-23
+
+description: heat expose volume resource
+
+resources:
+ valet_group_assigment_legal_1:
+ type: ATT::Valet::GroupAssignment
+ properties:
+ group_type: affinity
+
+ valet_group_assigment_legal_2:
+ type: ATT::Valet::GroupAssignment
+ properties:
+ group_type: diversity
+
+
+
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/second.yaml
new file mode 100644
index 0000000000..bb06b9d60a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/resources/com/att/sdc/validation/impl/validators/att_heat_validator/att_valet_group_type/positive/second.yaml
@@ -0,0 +1,14 @@
+heat_template_version: 2013-05-23
+
+description: heat second
+
+resources:
+ network_expose:
+ type: OS::Neutron::Net
+
+outputs:
+ expose_resource_network_output:
+ description: the pcrf_server
+ value: { get_resource: network_expose }
+
+