diff options
author | katy.rotman <katy.rotman@amdocs.com> | 2018-02-21 10:18:53 +0200 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2018-02-21 14:00:36 +0000 |
commit | 4cc47ac3abe00eda7c04b9955e56dafc819e2657 (patch) | |
tree | 884ceaf250ec3b39879a28607107d6b4c46291d5 /openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test | |
parent | 71331569b6e5fe1de2d2b964014f0e980364bcd0 (diff) |
Heat Resource Validator code +tests
Change-Id: Ic1e10c15fbbc01580311057e71edf05506bd9e8f
Issue-ID: SDC-994
Signed-off-by: katy.rotman <katy.rotman@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test')
6 files changed, 20 insertions, 380 deletions
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<String, MessageContainer> 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<String, MessageContainer> 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<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, @@ -137,27 +153,6 @@ public class VirtualMachineInterfaceValidatorTest { } - @Test - public void hasSingleParentPortNegativeHasBothPropertiesNegative() { - HeatResourceValidator baseValidator = new HeatResourceValidator(); - VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); - Map<String, MessageContainer> 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: |