From 4cc47ac3abe00eda7c04b9955e56dafc819e2657 Mon Sep 17 00:00:00 2001 From: "katy.rotman" Date: Wed, 21 Feb 2018 10:18:53 +0200 Subject: Heat Resource Validator code +tests Change-Id: Ic1e10c15fbbc01580311057e71edf05506bd9e8f Issue-ID: SDC-994 Signed-off-by: katy.rotman --- .../org/openecomp/sdc/common/errors/Messages.java | 19 +-- .../impl/util/HeatValidationService.java | 50 +++--- .../VirtualMachineInterfaceValidator.java | 98 ++++++----- .../VirtualMachineInterfaceValidatorTest.java | 43 +++-- .../negative_refs_missing/input/nested.yml | 1 - .../vlan_mixed/negative_test/input/MANIFEST.json | 17 -- .../vlan_mixed/negative_test/input/main.yml | 187 --------------------- .../vlan_mixed/negative_test/input/nested.yml | 74 -------- .../negative_test/input/main.yml | 78 +-------- 9 files changed, 105 insertions(+), 462 deletions(-) delete mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_mixed/negative_test/input/MANIFEST.json delete mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_mixed/negative_test/input/main.yml delete mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_mixed/negative_test/input/nested.yml (limited to 'openecomp-be') diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java index 150783c0e8..21636690f7 100644 --- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java +++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java @@ -1,23 +1,20 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2018 European Support Limited + * * 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.openecomp.sdc.common.errors; @@ -124,10 +121,6 @@ public enum Messages { "Wrong value assigned to a ResourceGroup index_var property (functions are not allowed" + " but only strings), Resource ID [%s]"), CONTRAIL_2_IN_USE("Contrail 2.x deprecated resource is in use, Resource ID [%s]"), - VLAN_SUBINTERFACE_MORE_THAN_ONE_PORT("More than one parent port found, there should be only one parent port for a VLAN sub-interface ID [%s]"), - VLAN_SUBINTERFACE_MISSING_TAG_PROPERTY("VLAN Tag property " + - "virtual_machine_interface_properties_sub_interface_vlan_tag is missing in VLAN Resource ID [%s]"), - VLAN_SUBINTERFACE_MISSING_REFS_PROPERTY("Parent port property virtual_machine_interface_refs is missing in VLAN Resource ID [%s]"), /* warnings */ REFERENCED_RESOURCE_NOT_FOUND("Referenced resource - %s not found"), diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java index dbd13ed8e0..e9a265d7bc 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2017 European Support Limited + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -326,44 +326,40 @@ public class HeatValidationService { } /** - * + * This method verifies whether the propertyValue contains a single parent port * @param fileName on which the validation is currently run - * @param globalContext gloabl validation context + * @param globalContext global validation context * @param heatResourceValidationContext heat resource validation context * @param propertyValue the value which is examined * @return whether the vlan has single parent port */ public static boolean hasSingleParentPort(String fileName, GlobalValidationContext globalContext, - HeatResourceValidationContext heatResourceValidationContext, - Object propertyValue) { - boolean hasSingleParentPort; - if (propertyValue instanceof List && ((List) propertyValue).size() == 1) { - final Object listValue = ((List) propertyValue).get(0); - - final Set getParamValues = - HeatStructureUtil.getReferencedValuesByFunctionName(fileName, "get_param", - listValue, globalContext); - hasSingleParentPort = getParamValues.isEmpty() || (getParamValues.size() == 1) && - validateGetParamValueOfType(getParamValues, heatResourceValidationContext, - DefinedHeatParameterTypes.STRING.getType()); - } else { - hasSingleParentPort = false; + HeatResourceValidationContext heatResourceValidationContext, + Object propertyValue) { + final boolean isList = propertyValue instanceof List; + if (!isList || ((List) propertyValue).size() != 1) { + return false; } - return hasSingleParentPort; + + final Object listValue = ((List) propertyValue).get(0); + + final Set getParamValues = + HeatStructureUtil.getReferencedValuesByFunctionName(fileName, "get_param", + listValue, globalContext); + + return getParamValues.isEmpty() || (getParamValues.size() == 1) && + validateGetParamValueOfType(getParamValues, heatResourceValidationContext, + DefinedHeatParameterTypes.STRING.getType()); + } + private static boolean validateGetParamValueOfType(Set values, HeatResourceValidationContext - heatResourceValidationContext,String type) { - Optional value = values.stream().findAny(); - boolean isString = false; - if (value.isPresent()) { - isString = - Objects.equals(heatResourceValidationContext.getHeatOrchestrationTemplate - ().getParameters().get(value.get()).getType(), type); - } + heatResourceValidationContext, String type) { - return isString; + return values.stream().anyMatch(e -> Objects.equals( + heatResourceValidationContext.getHeatOrchestrationTemplate().getParameters().get(e).getType(), type)); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidator.java index b5fa80e381..fc817c467d 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidator.java @@ -21,20 +21,16 @@ import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder; import org.openecomp.core.validation.types.GlobalValidationContext; import org.openecomp.sdc.common.togglz.ToggleableFeature; import org.openecomp.sdc.datatypes.error.ErrorLevel; -import org.openecomp.sdc.heat.datatypes.DefinedHeatParameterTypes; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.heat.services.HeatConstants; -import org.openecomp.sdc.heat.services.HeatStructureUtil; import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.impl.util.HeatValidationService; import org.openecomp.sdc.validation.type.HeatResourceValidationContext; -import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; -import java.util.Set; public class VirtualMachineInterfaceValidator implements ResourceValidator { private static final ErrorMessageCode ERROR_CODE_VLAN1 = new ErrorMessageCode("VLAN1"); @@ -47,14 +43,55 @@ public class VirtualMachineInterfaceValidator implements ResourceValidator { if (ToggleableFeature.VLAN_TAGGING.isActive()) { HeatResourceValidationContext heatResourceValidationContext = (HeatResourceValidationContext) validationContext; - Optional tagPropertyValue = getVlanTagPropertyValue(resourceEntry.getValue()); + final ValidityStatus status = calculateValidityStatus(resourceEntry.getValue()); + + switch (status) { + case BOTH_PROPERTIES_PRESENT: + validateHasSingleParentPort(fileName, resourceEntry, globalContext, + heatResourceValidationContext); + break; + case REFS_PROPERTY_MISSING: + globalContext + .addMessage(fileName, ErrorLevel.WARNING, + ErrorMessagesFormatBuilder + .getErrorWithParameters( + ERROR_CODE_VLAN2, + Messages.VLAN_SUBINTERFACE_MISSING_REFS_PROPERTY.getErrorMessage(), + resourceEntry.getKey())); + break; + case VLAN_TAG_PROPERTY_MISSING: + globalContext + .addMessage(fileName, ErrorLevel.WARNING, + ErrorMessagesFormatBuilder + .getErrorWithParameters( + ERROR_CODE_VLAN2, + Messages.VLAN_SUBINTERFACE_MISSING_TAG_PROPERTY.getErrorMessage(), + resourceEntry.getKey())); + validateHasSingleParentPort(fileName, resourceEntry, globalContext, + heatResourceValidationContext); + break; + case BOTH_PROPERTIES_MISSING: + // this is a port and not a VLAN, no further validation required + break; + default : + throw new IllegalArgumentException("Received a value for which no handling is " + + "available " + status); + } + } + } - tagPropertyValue - .ifPresent(o -> validateHasSingleParentPort(fileName, resourceEntry, globalContext, - heatResourceValidationContext)); - validateHasTwoProperties(fileName, resourceEntry, globalContext); + private ValidityStatus calculateValidityStatus(Resource resource) { + Optional refsPropertyValue = getRefsPropertyValue(resource); + Optional tagPropertyValue = getVlanTagPropertyValue(resource); + if (refsPropertyValue.isPresent() && tagPropertyValue.isPresent()) { + return ValidityStatus.BOTH_PROPERTIES_PRESENT; } + if (!refsPropertyValue.isPresent() && !tagPropertyValue.isPresent()) { + return ValidityStatus.BOTH_PROPERTIES_MISSING; + } + return refsPropertyValue.map(o -> ValidityStatus.VLAN_TAG_PROPERTY_MISSING) + .orElse(ValidityStatus.REFS_PROPERTY_MISSING); } @@ -67,9 +104,9 @@ public class VirtualMachineInterfaceValidator implements ResourceValidator { if (Objects.isNull(refsPropertyValue)) { return; } - boolean hasSingleParentPort= HeatValidationService.hasSingleParentPort(fileName, globalContext, + boolean hasSingleParentPort = HeatValidationService.hasSingleParentPort(fileName, globalContext, heatResourceValidationContext, - refsPropertyValue); + refsPropertyValue); if (!hasSingleParentPort) { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_VLAN1, @@ -81,37 +118,6 @@ public class VirtualMachineInterfaceValidator implements ResourceValidator { } - private void validateHasTwoProperties(String fileName, Map.Entry resourceEntry, - GlobalValidationContext globalContext) { - - Optional refsPropertyValue = getRefsPropertyValue(resourceEntry.getValue()); - Optional tagPropertyValue = getVlanTagPropertyValue(resourceEntry.getValue()); - - - if (refsPropertyValue.isPresent() && !tagPropertyValue.isPresent()) { - globalContext - .addMessage(fileName, ErrorLevel.WARNING, - ErrorMessagesFormatBuilder - .getErrorWithParameters( - ERROR_CODE_VLAN2, - Messages.VLAN_SUBINTERFACE_MISSING_TAG_PROPERTY.getErrorMessage(), - resourceEntry.getKey()) - ); - - } else if (!refsPropertyValue.isPresent() && tagPropertyValue.isPresent()) { - globalContext - .addMessage(fileName, ErrorLevel.WARNING, - ErrorMessagesFormatBuilder - .getErrorWithParameters( - ERROR_CODE_VLAN2, - Messages.VLAN_SUBINTERFACE_MISSING_REFS_PROPERTY.getErrorMessage(), - resourceEntry.getKey())); - - } - - } - - private Optional getVlanTagPropertyValue(Resource resource) { Object vmiProperties = resource.getProperties() .get(HeatConstants.VMI_PROPERTIES_PROPERTY_NAME); @@ -130,6 +136,14 @@ public class VirtualMachineInterfaceValidator implements ResourceValidator { } + private enum ValidityStatus { + BOTH_PROPERTIES_MISSING, + BOTH_PROPERTIES_PRESENT, + REFS_PROPERTY_MISSING, + VLAN_TAG_PROPERTY_MISSING + + } + private enum Messages { VLAN_SUBINTERFACE_MORE_THAN_ONE_PORT( "More than one parent port found, there should be only one parent port for a VLAN sub-interface ID [%s]"), diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java index c82271e1c7..d9b5f6815d 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java @@ -1,3 +1,19 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.validation.impl.validators.heatresource; import org.openecomp.core.validation.types.MessageContainer; @@ -69,7 +85,7 @@ public class VirtualMachineInterfaceValidatorTest { @Test - public void hasBothPropertiesMissingTagNegative() { + public void hasBothPropertiesNegativeMissingVlanTag() { HeatResourceValidator baseValidator = new HeatResourceValidator(); VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); Map messages = ValidationTestUtil.testValidator(baseValidator, @@ -89,7 +105,7 @@ public class VirtualMachineInterfaceValidatorTest { } @Test - public void hasBothPropertiesMissingRefsNegative() { + public void hasBothPropertiesNegativeMissingRefs() { HeatResourceValidator baseValidator = new HeatResourceValidator(); VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); Map messages = ValidationTestUtil.testValidator(baseValidator, @@ -108,7 +124,7 @@ public class VirtualMachineInterfaceValidatorTest { } @Test - public void hasBothPropertiesBothMissingPositiveNotVLAN() { + public void hasBothPropertiesBothMissingWhichMeansPositive() { HeatResourceValidator baseValidator = new HeatResourceValidator(); VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); Map messages = ValidationTestUtil.testValidator(baseValidator, @@ -137,27 +153,6 @@ public class VirtualMachineInterfaceValidatorTest { } - @Test - public void hasSingleParentPortNegativeHasBothPropertiesNegative() { - HeatResourceValidator baseValidator = new HeatResourceValidator(); - VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, - resourceValidator, - HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), - PATH + "vlan_mixed/negative_test/input"); - - Assert.assertNotNull(messages); - Assert.assertEquals(messages.size(), 1); - - - Assert.assertEquals(messages.get("nested.yml").getErrorMessageList().size(), 1); - Assert.assertEquals( - messages.get("nested.yml").getErrorMessageList().get(0).getMessage(), - "WARNING: [VLAN2]: VLAN Tag property " + - "virtual_machine_interface_properties_sub_interface_vlan_tag is missing in " + - "VLAN Resource ID [template_Vlan_2]"); - - } } \ 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/heat_validator/vlan_resource_validation/vlan_has_two_properties/negative_refs_missing/input/nested.yml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_has_two_properties/negative_refs_missing/input/nested.yml index 5e838ec62c..6abf25882a 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_has_two_properties/negative_refs_missing/input/nested.yml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_has_two_properties/negative_refs_missing/input/nested.yml @@ -69,5 +69,4 @@ resources: } ] } - virtual_network_refs: [{ get_param: net2 }] diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_mixed/negative_test/input/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_mixed/negative_test/input/MANIFEST.json deleted file mode 100644 index aca75b5055..0000000000 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_mixed/negative_test/input/MANIFEST.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "vMME_Small", - "description": "HOT template to create 2 cinder volume attachment", - "version": "2013-05-23", - "data": [ - { - "file": "main.yml", - "type": "HEAT", - "isBase": "true" - }, - { - "file": "nested.yml", - "type": "HEAT", - "isBase": "false" - } - ] -} diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_mixed/negative_test/input/main.yml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_mixed/negative_test/input/main.yml deleted file mode 100644 index 8bdc627afc..0000000000 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_mixed/negative_test/input/main.yml +++ /dev/null @@ -1,187 +0,0 @@ -heat_template_version: 2013-05-23 - -description: > - Version 2.0 02-09-2016 (Authors: John Doe, user PROD) - -parameters: - jsa_net_name: - type: string - description: network name of jsa log network - security_group_name: - type: comma_delimited_list - description: CMAUI1, CMAUI2 server names - cmaui_names: - type: comma_delimited_list - description: CMAUI1, CMAUI2 server names - cmaui_image: - type: string - description: Image for CMAUI server - availability_zone_0: - type: string - label: availabilityzone name - description: availabilityzone name - cmaui_flavor: - type: string - description: Flavor for CMAUI server - cmaui_oam_ips: - type: string - oam_sec_group_name: - type: string - lb_st_interface_type_oam: - type: string - template_PortTuple_LB1: - type: string - lb_st_vlan_type_oam: - description: dummy - type: string - mac_address: - type: string - virtual_ip_address: - type: string - virtual_ipv6_address: - type: string - vlan_ids: - type: string -resources: - test_net1: - type: OS::Neutron::Net - properties: - name: {get_param: jsa_net_name} - shared: True - test_net2: - type: OS::Neutron::Net - properties: - name: {get_param: jsa_net_name} - shared: True - - server_cmaui_nova: - type: OS::Nova::Server - properties: - name: { get_param: [cmaui_names, 0]} - image: { get_param: cmaui_image } - availability_zone: { get_param: availability_zone_0 } - flavor: { get_param: cmaui_flavor } - networks: - - port: { get_resource: template_VMInt_OAM_lb_1 } - - port: { get_resource: cmaui_port_2 } - - template_VMInt_OAM_lb_1: - type: OS::ContrailV2::VirtualMachineInterface - properties: - virtual_machine_interface_properties: - { - virtual_machine_interface_properties_service_interface_type: { get_param: lb_st_interface_type_oam }, - } - virtual_network_refs: [{ get_resource: test_net1 }] - port_tuple_refs: [{ get_param: template_PortTuple_LB1 }] - security_group_refs: [{ get_param: oam_sec_group_name}] - - cmaui_port_2: - type: OS::Neutron::Port - properties: - network: { get_resource: test_net1 } - fixed_ips: [{"ip_address": {get_param: [cmaui_oam_ips, 0]}}] - security_groups: [{get_param: security_group_name}] - replacement_policy: AUTO - - test_Vlan1: - type: OS::ContrailV2::VirtualMachineInterface - properties: - name: vlan - virtual_machine_interface_properties: - { - virtual_machine_interface_properties_sub_interface_vlan_tag: { get_param: lb_st_vlan_type_oam } - } - virtual_machine_interface_mac_addresses: - { - virtual_machine_interface_mac_addresses_mac_address: [{ get_param: mac_address }], - } - virtual_machine_interface_allowed_address_pairs: - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair: [ - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_address_mode: active-standby, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_mac: { get_param: mac_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip: - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix: { get_param: virtual_ip_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix_len: 32 - } - }, - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_address_mode: active-standby, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_mac: { get_param: mac_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip: - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix: { get_param: virtual_ipv6_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix_len: 128 - } - } - ] - } - virtual_network_refs: [{ get_resource: test_net1 }] - virtual_machine_interface_refs: [{ get_resource: test_Vlan2 }] - - test_Vlan2: - type: OS::ContrailV2::VirtualMachineInterface - properties: - name: vlan - virtual_machine_interface_properties: - { - virtual_machine_interface_properties_sub_interface_vlan_tag: { get_param: lb_st_vlan_type_oam } - } - virtual_machine_interface_mac_addresses: - { - virtual_machine_interface_mac_addresses_mac_address: [{ get_param: mac_address }], - } - virtual_machine_interface_allowed_address_pairs: - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair: [ - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_address_mode: active-standby, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_mac: { get_param: mac_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip: - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix: { get_param: virtual_ip_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix_len: 32 - } - }, - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_address_mode: active-standby, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_mac: { get_param: mac_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip: - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix: { get_param: virtual_ipv6_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix_len: 128 - } - } - ] - } - virtual_network_refs: [{ get_resource: test_net1 }] - virtual_machine_interface_refs: [{ get_resource: template_VMInt_OAM_lb_1 }] - - test_nested: - type: nested.yml - properties: - p1: { get_resource: template_VMInt_OAM_lb_1} - p2: { get_resource: cmaui_port_2} - net1: { get_resource: test_net1} - net2: { get_resource: test_net2} - - test_resourceGroup: - type: OS::Heat::ResourceGroup - properties: - count: 9 - resource_def: - type: nested.yml - properties: - p1: { get_resource: template_VMInt_OAM_lb_1} - p2: { get_resource: cmaui_port_2} - net1: { get_resource: test_net1} - net2: { get_resource: test_net2} - - test_nested_invalidConnection: - type: nested.yml - properties: - p1: { get_resource: test_Vlan1} - p2: { get_resource: server_cmaui_nova} diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_mixed/negative_test/input/nested.yml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_mixed/negative_test/input/nested.yml deleted file mode 100644 index 29f8c20209..0000000000 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_mixed/negative_test/input/nested.yml +++ /dev/null @@ -1,74 +0,0 @@ -heat_template_version: 2013-05-23 - -description: cmaui server template for vMMSC - -parameters: - p1: - type: string - p2: - type: string - net1: - type: string - net2: - type: string - lb_st_vlan_type_oam: - description: dummy - type: string - mac_address: - type: string - virtual_ip_address: - type: string - virtual_ipv6_address: - type: string - vlan_ids: - type: string - subinterface_name_prefix: - type: string - subinterface_instance_index: - type: number -resources: - - - template_Vlan_2: - type: OS::ContrailV2::VirtualMachineInterface - properties: - name: - str_replace: - template: $NAME$VLAN - params: - $NAME: { get_param: subinterface_name_prefix } - $VLAN: { get_param: [ vlan_ids, { get_param: subinterface_instance_index } ] } - virtual_machine_interface_properties: - { - } - virtual_machine_interface_mac_addresses: - { - virtual_machine_interface_mac_addresses_mac_address: [{ get_param: mac_address }], - } - virtual_machine_interface_allowed_address_pairs: - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair: [ - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_address_mode: active-standby, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_mac: { get_param: mac_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip: - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix: { get_param: virtual_ip_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix_len: 32 - } - }, - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_address_mode: active-standby, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_mac: { get_param: mac_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip: - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix: { get_param: virtual_ipv6_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix_len: 128 - } - } - ] - } - virtual_network_refs: [{ get_param: net2 },{ get_param: net1 }] - virtual_machine_interface_refs: [{ get_param: p2 }, { get_param: p1 }] - - diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_multiple_parent_ports/negative_test/input/main.yml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_multiple_parent_ports/negative_test/input/main.yml index 8bdc627afc..2fc1d1614c 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_multiple_parent_ports/negative_test/input/main.yml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_multiple_parent_ports/negative_test/input/main.yml @@ -65,7 +65,7 @@ resources: - port: { get_resource: template_VMInt_OAM_lb_1 } - port: { get_resource: cmaui_port_2 } - template_VMInt_OAM_lb_1: + type: OS::ContrailV2::VirtualMachineInterface properties: virtual_machine_interface_properties: @@ -84,82 +84,6 @@ resources: security_groups: [{get_param: security_group_name}] replacement_policy: AUTO - test_Vlan1: - type: OS::ContrailV2::VirtualMachineInterface - properties: - name: vlan - virtual_machine_interface_properties: - { - virtual_machine_interface_properties_sub_interface_vlan_tag: { get_param: lb_st_vlan_type_oam } - } - virtual_machine_interface_mac_addresses: - { - virtual_machine_interface_mac_addresses_mac_address: [{ get_param: mac_address }], - } - virtual_machine_interface_allowed_address_pairs: - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair: [ - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_address_mode: active-standby, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_mac: { get_param: mac_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip: - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix: { get_param: virtual_ip_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix_len: 32 - } - }, - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_address_mode: active-standby, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_mac: { get_param: mac_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip: - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix: { get_param: virtual_ipv6_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix_len: 128 - } - } - ] - } - virtual_network_refs: [{ get_resource: test_net1 }] - virtual_machine_interface_refs: [{ get_resource: test_Vlan2 }] - - test_Vlan2: - type: OS::ContrailV2::VirtualMachineInterface - properties: - name: vlan - virtual_machine_interface_properties: - { - virtual_machine_interface_properties_sub_interface_vlan_tag: { get_param: lb_st_vlan_type_oam } - } - virtual_machine_interface_mac_addresses: - { - virtual_machine_interface_mac_addresses_mac_address: [{ get_param: mac_address }], - } - virtual_machine_interface_allowed_address_pairs: - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair: [ - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_address_mode: active-standby, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_mac: { get_param: mac_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip: - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix: { get_param: virtual_ip_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix_len: 32 - } - }, - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_address_mode: active-standby, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_mac: { get_param: mac_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip: - { - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix: { get_param: virtual_ipv6_address }, - virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix_len: 128 - } - } - ] - } - virtual_network_refs: [{ get_resource: test_net1 }] - virtual_machine_interface_refs: [{ get_resource: template_VMInt_OAM_lb_1 }] - test_nested: type: nested.yml properties: -- cgit 1.2.3-korg