diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib')
4 files changed, 12 insertions, 19 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java index 78c01cfdfc..b3d346177b 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java @@ -58,7 +58,7 @@ public class NeutronPortNamingConventionValidator implements ResourceValidator { if (MapUtils.isEmpty(heatOrchestrationTemplate.getResources())) { return; } - String[] regexList = new String[]{".*_net_id", ".*_net_name", ".*_net_fqdn"}; + String[] regexList = {".*_net_id", ".*_net_name", ".*_net_fqdn"}; heatOrchestrationTemplate .getResources() @@ -97,9 +97,9 @@ public class NeutronPortNamingConventionValidator implements ResourceValidator { private void checkNeutronPortFixedIpsName(String fileName, Map.Entry<String, Resource> resourceEntry, GlobalValidationContext globalContext) { - String[] regexList = - new String[]{"[^_]+_[^_]+_ips", "[^_]+_[^_]+_v6_ips", "[^_]+_[^_]+_ip_(\\d+)", - "[^_]+_[^_]+_v6_ip_(\\d+)"}; + String[] regexList = {"[^_]+_[^_]+_ips", "[^_]+_[^_]+_v6_ips", "[^_]+_[^_]+_ip_(\\d+)", + "[^_]+_[^_]+_v6_ip_(\\d+)", "[^_]+_[^_]+_[^_]+_ips", "[^_]+_[^_]+_[^_]+_v6_ips", + "[^_]+_[^_]+_[^_]+_ip_(\\d+)", "[^_]+_[^_]+_[^_]+_v6_ip_(\\d+)"}; if (MapUtils.isEmpty(resourceEntry.getValue().getProperties())) { return; @@ -128,13 +128,9 @@ public class NeutronPortNamingConventionValidator implements ResourceValidator { String fixedIpsName = ValidationUtil .getWantedNameFromPropertyValueGetParam(fixedIpsEntry.getValue()); - if (nonNull(fixedIpsName) && !ValidationUtil - .evalPattern(fixedIpsName, regexList)) { - globalContext.addMessage( - fileName, - ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters( - ERROR_CODE_NNP1, - Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES.getErrorMessage(), + + if (nonNull(fixedIpsName) && !ValidationUtil.evalPattern(fixedIpsName, regexList)) { + globalContext.addMessage(fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters(ERROR_CODE_NNP1, Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES.getErrorMessage(), "Port", "Fixed_IPS", fixedIpsName, resourceEntry.getKey())); } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java index 4f640dff29..b1a8fe254d 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java @@ -192,15 +192,15 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal }else if (network instanceof List){ role = getNetworkRole((String)((List) network).get(0)); } - if (role != null && uniqueResourcePortNetworkRole.containsKey(role)) { + if (role != null && (uniqueResourcePortNetworkRole.containsKey(role))) { globalValidationContext.addMessage( fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters( ERROR_CODE_NNS12, Messages.RESOURCE_CONNECTED_TO_TWO_EXTERNAL_NETWORKS_WITH_SAME_ROLE - .getErrorMessage(), resourceId, role)); + .getErrorMessage(), role, resourceId)); } else { - uniqueResourcePortNetworkRole.put(role, portResourceId); + uniqueResourcePortNetworkRole.put(role, resourceId); } } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java index de047b8fee..00f95ef383 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java @@ -64,7 +64,7 @@ public class NeutronPortNamingConventionValidatorTest { PATH + "negativeFixedIP/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); - Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 4); + Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 3); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), "WARNING: [NNP1]: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_net_v6_ip_a], Resource ID [port_resource_0]. As a result, VF/VFC Profile may miss this information"); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(1).getMessage(), @@ -72,9 +72,6 @@ public class NeutronPortNamingConventionValidatorTest { Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(2).getMessage(), "WARNING: [NNP1]: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_net_ipz], Resource ID [port_resource_2]. As a result, VF/VFC Profile may miss this information"); - - Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(3).getMessage(), - "WARNING: [NNP1]: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_net_v0_ip_3], Resource ID [port_resource_2]. As a result, VF/VFC Profile may miss this information"); } @Test 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 759b376b97..01750c5f54 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 @@ -118,7 +118,7 @@ public class NovaServerNamingConventionGuideLineValidatorTest { 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: [NNS12]: 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 [Internal1], Resource ID [FSB2]"); } @Test |