summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test
diff options
context:
space:
mode:
authormojahidi <mojahidul.islam@amdocs.com>2017-11-20 18:11:32 +0530
committermojahidi <mojahidul.islam@amdocs.com>2017-11-20 18:13:45 +0530
commit56d40d922c89b9837560c4ca739cafeef566287c (patch)
tree59f3982e8b28b3a41cd7a025269fce8b1ee5b15a /openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test
parent914f3a5f952e0799b6fb05788d30562464384a13 (diff)
Naming Convetion validators
This task is about updating error messages with error codes for ContrailServiceInstanceNamingConventionValidator validator Change-Id: Ibb113f809ad0d68f4a4104dd35ba14d32e262f0d Issue-ID:SDC-572 Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test')
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java24
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/missingparam/MANIFEST.json12
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/missingparam/first.yaml45
3 files changed, 75 insertions, 6 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java
index 7c07da98d7..2fb86f8556 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java
@@ -17,25 +17,37 @@ public class ContrailServiceInstanceNamingConventionValidatorTest {
HeatResourceValidator baseValidator = new HeatResourceValidator();
ContrailServiceInstanceNamingConventionValidator resourceValidator = new
ContrailServiceInstanceNamingConventionValidator();
+ private static final String PATH = "/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/";
@Test
public void testContrailServiceInstanceAvailabilityZoneNotAlignedWithNamingConvention() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_INSTANCE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/notaligned");
+ resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_INSTANCE.getHeatResource(),
+ PATH + "notaligned");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
- "WARNING: Service Instance 'Availability Zone' Parameter Name not aligned with Guidelines, Parameter Name [availability_zone_1a], Resource ID [service_instance_1]. As a result, VF/VFC Profile may miss this information");
+ "WARNING: [NSI1]: Service Instance 'Availability Zone' Parameter Name not aligned with Guidelines, Parameter Name [availability_zone_1a], Resource ID [service_instance_1]. As a result, VF/VFC Profile may miss this information");
}
@Test
public void testContrailServiceInstanceAvailabilityZoneAlignedWithNamingConvention() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_INSTANCE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/aligned");
+ resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_INSTANCE.getHeatResource(),
+ PATH + "aligned");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
}
-}
+ @Test
+ public void testContrailServiceInstanceAvailabilityZoneNotAlignedWithNamingConventionMissingParam() {
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_INSTANCE.getHeatResource(),
+ PATH + "missingparam");
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.size(), 1);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
+ "WARNING: [NSI2]: Missing get_param in availability_zone, Resource Id [service_instance_1]");
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/missingparam/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/missingparam/MANIFEST.json
new file mode 100644
index 0000000000..0e8bebb1d1
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/missingparam/MANIFEST.json
@@ -0,0 +1,12 @@
+{
+ "name": "validTest",
+ "description": "Valid Test",
+ "version": "1610",
+ "data": [
+ {
+ "file": "first.yaml",
+ "type": "HEAT",
+ "isBase": true
+ }
+ ]
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/missingparam/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/missingparam/first.yaml
new file mode 100644
index 0000000000..c4db7c71cf
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatcontrailserviceinstanceavailabilityzone/missingparam/first.yaml
@@ -0,0 +1,45 @@
+heat_template_version: 2013-05-23
+
+description: heat expose volume resource
+
+resources:
+ service_instance_1:
+ type: OS::Contrail::ServiceInstance
+ depends_on: [ hsl_ip_subnet]
+ properties:
+ name: { get_param: service_instance_name }
+ availability_zone: get_param
+ service_template: { get_resource: service_template_1 }
+ scale_out:
+ max_instances: {get_param: max_num_fw_instances}
+ interface_list: [
+ {
+ virtual_network: { get_param: oam_mgmt_net_0_id }
+ },
+ {
+ virtual_network: { get_param: Cricket_OCS_direct_net_id }
+ },
+ {
+ virtual_network: { get_resource: hsl_direct_net }
+ },
+ {
+ virtual_network: {get_param: oam_mgmt_net_1_id},
+ static_routes: [
+ { "prefix": {get_param: prefix_0} },
+ { "prefix": {get_param: prefix_1} },
+ { "prefix": {get_param: prefix_2} },
+ ],
+ }
+ ]
+ service_template_1:
+ type: OS::Contrail::ServiceTemplate
+ properties:
+ name: { get_param: st_name }
+ service_mode: { get_param: st_mode }
+ service_type: { get_param: st_type }
+ image_name: { get_param: st_image_name }
+ flavor: { get_param: st_flavor_name }
+ service_interface_type_list: { "Fn::Split" : [ ",", "management,left,right,other" ] }
+ shared_ip_list: { "Fn::Split" : [ ",", Ref: st_shared_ip_list ] }
+ static_routes_list: { "Fn::Split" : [ ",", Ref: st_static_routes_list ] }
+ service_scaling: { get_param: st_scaling } \ No newline at end of file