summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java
diff options
context:
space:
mode:
authormojahidi <mojahidul.islam@amdocs.com>2017-11-20 19:26:57 +0530
committermojahidi <mojahidul.islam@amdocs.com>2017-11-20 19:27:21 +0530
commit746d3c490eaf8c92ca6125be97371720f4c8f7c9 (patch)
tree5c4c26ee4d23bf6efeab487c13cd03afde9762a3 /openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java
parentb6843f237e6ef2dfa25d0d9b4ca58a18634966a0 (diff)
NovaServer NamingConventionGuideLineValidator
This task is about updating error messages with error codes for NovaServerNamingConventionGuideLineValidator Change-Id: I7217ef464bc4f674fdb9480d76cb059f20da7411 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/java')
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java140
1 files changed, 98 insertions, 42 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/NovaServerNamingConventionGuideLineValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java
index 0284ebcbf2..fea0b7f5e2 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java
@@ -18,137 +18,193 @@ public class NovaServerNamingConventionGuideLineValidatorTest {
NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator();
NovaServerNamingConventionGuideLineValidator resourceValidator = new
NovaServerNamingConventionGuideLineValidator();
-
+ private static final String PATH = "/org/openecomp/validation/validators/guideLineValidator/novaserverValidation/";
@Test
public void testHeatNovaServerMetaDataValidation() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/positive/");
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "heatNovaServerMetaDataValidation/positive/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerMetaDataValidation/negative/");
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "heatNovaServerMetaDataValidation/negative/");
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: Missing VNF_ID in Metadata property, Resource ID [FSB2]");
+ "WARNING: [NNS1]: Missing Nova Server Metadata property, Resource ID [FSB2]");
}
@Test
public void testNovaServerAvailabilityZoneName() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/positive");
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "heatNovaServerAvailabilityZoneName/positive");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerAvailabilityZoneName/negative");
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "heatNovaServerAvailabilityZoneName/negative");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 3);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
- "WARNING: Server 'Availability Zone' Parameter Name not aligned with Guidelines, Parameter Name [availability_zone_a], Resource ID [FSB2]. As a result, VF/VFC Profile may miss this information");
+ "WARNING: [NNS5]: Server 'Availability Zone' Parameter Name not aligned with Guidelines, Parameter Name [availability_zone_a], Resource ID [FSB2]. As a result, VF/VFC Profile may miss this information");
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(1).getMessage(),
- "WARNING: Server 'Availability Zone' Parameter Name not aligned with Guidelines, Parameter Name [availability_zone], Resource ID [FSB3]. As a result, VF/VFC Profile may miss this information");
+ "WARNING: [NNS5]: Server 'Availability Zone' Parameter Name not aligned with Guidelines, Parameter Name [availability_zone], Resource ID [FSB3]. As a result, VF/VFC Profile may miss this information");
}
@Test
public void testNovaImageAndFlavorNames() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/positive");
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "heatNovaServerImageAndFlavor/positive");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerImageAndFlavor/negative");
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "heatNovaServerImageAndFlavor/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: Server 'flavor' Parameter Name not aligned with Guidelines, Parameter Name [fsb2-flavor], Resource ID [FSB2]. As a result, VF/VFC Profile may miss this information");
+ "WARNING: [NNS13]: Server 'flavor' Parameter Name not aligned with Guidelines, Parameter Name [fsb2-flavor], Resource ID [FSB2]. As a result, VF/VFC Profile may miss this information");
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(1).getMessage(),
- "WARNING: Server 'image' Parameter Name not aligned with Guidelines, Parameter Name [fsb2-image], Resource ID [FSB3]. As a result, VF/VFC Profile may miss this information");
+ "WARNING: [NNS13]: Server 'image' Parameter Name not aligned with Guidelines, Parameter Name [fsb2-image], Resource ID [FSB3]. As a result, VF/VFC Profile may miss this information");
}
@Test
public void testNovaResourceNetworkUniqueRole() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/positive/");
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "heatNovaNetworkUniqueRoleConvention/positive/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
-
messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/heatNovaNetworkUniqueRoleConvention/negative/");
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "heatNovaNetworkUniqueRoleConvention/negative/");
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: A resource is connected twice to the same network role, Network Role [FSB2], Resource ID [Internal1]");
+ "WARNING: [NNS12]: A resource is connected twice to the same network role, Network Role [FSB2], Resource ID [Internal1]");
}
@Test
public void testNovaServerName() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/positive");
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "heatNovaServerNameValidation/positive");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/heatNovaServerNameValidation/negative/");
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "heatNovaServerNameValidation/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: Server 'name' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_pps_server_4], Resource ID [FSB2]. As a result, VF/VFC Profile may miss this information");
+ "WARNING: [NNS10]: Server 'name' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_pps_server_4], Resource ID [FSB2]. As a result, VF/VFC Profile may miss this information");
}
@Test
public void testVMNameSyncInNova() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
- "/org/openecomp/validation/validators/guideLineValidator/novaVMNameSync/input");
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "input");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 4);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
- "WARNING: Server 'name' Parameter Name not aligned with Guidelines, Parameter Name [CE_server_name], Resource ID [FSB2_legal_2]. As a result, VF/VFC Profile may miss this information");
+ "WARNING: [NNS10]: Server 'name' Parameter Name not aligned with Guidelines, Parameter Name [CE_server_name], Resource ID [FSB2_legal_2]. As a result, VF/VFC Profile may miss this information");
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(1).getMessage(),
- "WARNING: Server 'flavor' Parameter Name not aligned with Guidelines, Parameter Name [fsb_flavor_names], Resource ID [FSB2_legal_3]. As a result, VF/VFC Profile may miss this information");
+ "WARNING: [NNS13]: Server 'flavor' Parameter Name not aligned with Guidelines, Parameter Name [fsb_flavor_names], Resource ID [FSB2_legal_3]. As a result, VF/VFC Profile may miss this information");
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(2).getMessage(),
- "WARNING: Nova Server naming convention in image, flavor and name properties is not consistent, Resource ID [FSB2_illegal_1]");
+ "WARNING: [NNS11]: Nova Server naming convention in image, flavor and name properties is not consistent, Resource ID [FSB2_illegal_1]");
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(3).getMessage(),
- "WARNING: Nova Server naming convention in image, flavor and name properties is not consistent, Resource ID [FSB2_illegal_2]");
-
+ "WARNING: [NNS11]: Nova Server naming convention in image, flavor and name properties is not consistent, Resource ID [FSB2_illegal_2]");
}
@Test
public void testAvailabilityZoneName() throws IOException {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
- "/org/openecomp/validation/validators/naming_convention/availability_zone_name/input");
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "availability_zone_name/input");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().size(), 2);
Assert.assertEquals(
- messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().get(0).getMessage(),
- "WARNING: Server 'Availability Zone' Parameter Name not aligned with Guidelines, Parameter Name [availability_zone_name], Resource ID [availability_zone_illegal_name_1]. As a result, VF/VFC Profile may miss this information");
+ messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().get(0).getMessage(),
+ "WARNING: [NNS5]: Server 'Availability Zone' Parameter Name not aligned with Guidelines, Parameter Name [availability_zone_name], Resource ID [availability_zone_illegal_name_1]. As a result, VF/VFC Profile may miss this information");
Assert.assertEquals(
- messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().get(1).getMessage(),
- "WARNING: Server 'Availability Zone' Parameter Name not aligned with Guidelines, Parameter Name [availability_zone], Resource ID [availability_zone_illegal_name_2]. As a result, VF/VFC Profile may miss this information");
+ messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().get(1).getMessage(),
+ "WARNING: [NNS5]: Server 'Availability Zone' Parameter Name not aligned with Guidelines, Parameter Name [availability_zone], Resource ID [availability_zone_illegal_name_2]. As a result, VF/VFC Profile may miss this information");
+ }
+
+ @Test
+ public void testHeatNovaServerVnfIDValidation() {
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ "/org/openecomp/validation/validators/guideLineValidator/novaserverValidation/heatNovaServerMetaDataValidation/negativemissingvnfid/");
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
+ "WARNING: [NNS3]: Missing VNF_ID in Metadata property, Resource ID [FSB2]");
+ }
+
+ @Test
+ public void testHeatNovaServerVfModuleValidation() {
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ "/org/openecomp/validation/validators/guideLineValidator/novaserverValidation/heatNovaServerMetaDataValidation/negativemisningvfmodule/");
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
+ "WARNING: [NNS2]: Missing VF_MODULE_ID in Metadata property, Resource id [FSB2]");
+ }
+
+ @Test
+ public void testMissingParam() {
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "heatNovaNetworkUniqueRoleConvention/missingportNetwork/");
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 4);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
+ "WARNING: [NNS4]: Missing get_param in network or network_id, Resource Id [FSB2]");
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(1).getMessage(),
+ "WARNING: [NNS6]: Missing get_param in availability_zone, Resource Id [FSB2]");
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(2).getMessage(),
+ "WARNING: [NNS7]: Missing get_param in nova server name, Resource Id [FSB2]");
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(3).getMessage(),
+ "WARNING: [NNS8]: Missing get_param in flavor, Resource Id [FSB2]");
+ }
+
+ @Test
+ public void testNovaResource() {
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "heatNovaNetworkUniqueRoleConvention/invalidresource/");
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
+ "ERROR: [NNS14]: invalid get_resource syntax is in use - 1234 , get_resource function should get the resource id of the referenced resource");
+ }
+
+ @Test
+ public void testEnvFileContent() {
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "heatNovaNetworkUniqueRoleConvention/input/");
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().get(1).getMessage(),
+ "WARNING: [NNS9]: Server 'Name' Parameter Name not aligned with Guidelines, Parameter Name [{key=value}], Resource ID [server_1]. As a result, VF/VFC Profile may miss this information");
}
}