vnf_name:
type: string
description: Unique name for this VNF instance
- ex_image_name:
- type: string
- label: Image name or ID
- description: Image to be used for compute instance
- ex_key:
- type: string
- label: key pair
- description: Name of the key apir the nova server will use
- ex_vm_name:
- type: string
- description: Name of the VM
ex1_vm_names:
type: comma_delimited_list
description: Name of the VM
ex1_flavor_name:
type: string
label: Flavor
- description: Type of instance (flavor) to be used
- ex1_key:
- type: string
- label: key pair
- description: Name of the key apir the nova server will use
- ex1_server_index:
- type: number
- label: server index
- description: Index of server
- constraint:
- - range: { min: 1, max: 100 }
+ description: Type of instance (flavor) to be used
+ #ex1_key:
+ # type: string
+ # label: key pair
+ # description: Name of the key apir the nova server will use
resources:
- ex_software_config_0:
- type: OS::Heat::SoftwareConfig
- properties:
- group: ungrouped
- config:
- params:
- $stack_name: { get_param: 'OS::stack_name' }
-
- ex_nova_server_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: ex_vm_name }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex_image_name }
- flavor: { get_param: ex_flavor_name }
- key_name: { get_param: ex_key }
- user_data:
- get_resource: ex_software_config_0
ex1_nova_server_0:
type: OS::Nova::Server
properties:
name: { get_param: [ ex1_vm_names, 0 ] }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- project_id: { get_param: "OS::project_id" }
- image: { get_param: ex1_image_name }
- flavor: { get_param: ex1_flavor_name }
- key_name: { get_param: ex1_key }
-
- ex1_nova_server_1:
- type: OS::Nova::Server
- properties:
- name: { get_param: [ ex1_vm_names, { get_param: ex1_server_index } ] }
metadata:
vnf_id: { get_param: vnf_id }
vf_module_id: { get_param: vf_module_id }
vnf_name:
type: string
description: Unique name for this VNF instance
- ex_image_name:
- type: string
- label: Image name or ID
- description: Image to be used for compute instance
- ex_flavor_name:
- type: string
- label: Flavor
- description: Type of instance (flavor) to be used
- ex_key:
- type: string
- label: key pair
- description: Name of the key apir the nova server will use
- ex_vm_name:
- type: string
- description: Name of the VM
ex1_vm_names:
type: comma_delimited_list
description: Name of the VM
description: Name of the key apir the nova server will use
resources:
- ex_software_config_0:
- type: OS::Heat::SoftwareConfig
- properties:
- group: ungrouped
- config:
- params:
- $stack_name: { get_param: 'OS::stack_name' }
-
- ex_nova_server_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: ex_vm_name }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex_image_name }
- flavor: { get_param: ex_flavor_name }
- key_name: { get_param: ex_key }
- user_data:
- get_resource: ex_software_config_0
ex1_nova_server_0:
type: OS::Nova::Server
vnf_id: { get_param: vnf_id }
vf_module_id: { get_param: vf_module_id }
vnf_name: { get_param: vnf_name }
- metering.stack: { get_param: "OS::stack_id" }
image: { get_param: ex1_image_name}
flavor: { get_param: ex1_flavor_name }
key_name: { get_param: ex1_key }
-
- ex1_nova_server_1:
- type: OS::Nova::Server
- properties:
- name: { get_param: [ ex1_vm_names, { get_param: ex1_server_index } ] }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex1_image_name}
- flavor: { get_param: ex1_flavor_name }
- key_name: { get_param: ex1_key }
\ No newline at end of file
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+
+# VERSION = '1.0.0'
+
---
resources:
vm_type_b_server_0:
type: OS::Nova::Server
properties:
- availability_zone: { str_replace: availability_zone_0 }
+ availability_zone: { not_str_replace: availability_zone_0 }
name: { get_param: vm_type_b_name_0 }
flavor: { get_param: vm_type_b_flavor_name}
image: { get_param: vm_type_b_image_name}
vnf_id: { get_param: vnf_id }
vf_module_id: { get_param: vf_module_id }
key_name: { get_param: vm_type_b_key_name }
+
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the License);
+# under the Apache License, Version 2.0 (the "License");
# you may not use this software except in compliance with the License.
# You may obtain a copy of the License at
#
#
#
# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the License);
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
# you may not use this documentation except in compliance with the License.
# You may obtain a copy of the License at
#
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the License);
+# under the Apache License, Version 2.0 (the "License");
# you may not use this software except in compliance with the License.
# You may obtain a copy of the License at
#
#
#
# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the License);
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
# you may not use this documentation except in compliance with the License.
# You may obtain a copy of the License at
#
--- /dev/null
+heat_template_version: 2015-04-30
+
+description: fdsafsfsa
+
+parameters:
+
+ my_nested_parameter:
+ type: number
+ description: sdfnklafd
+ #constraints:
+ # - range: { min: 100, max: 400 }
+
+resources:
+
+ my_nested_resource2:
+ type: test
+ properties:
+ my_nested_parameter: {get_param: my_nested_parameter}
+
+outputs:
+ test_value:
+ value: { get_param: my_nested_parameter }
\ No newline at end of file
--- /dev/null
+parameters:
+
+ fw_oam_route_prefixes: nsaflj
+
+ myvm_net_fqdn: nasfln
+
+ vnf_id: sadfadf
+
+ vf_module_id: sadfadf
+
+ vf_module_name: sadfadf
+
+ vnf_name: sadfadf
+
+ starkdb_name: bghbhjb
+
+ STARKDB_name: bghbhjb
+
+ #STARKDB_image_name: sadfadf
+
+ #STARKDB_flavor_dvdfg: sadfadf
+
+ TESTDB_name: bghbhjb
+
+
+ #TESTDB_image_name: sadfadf
+
+ #TESTDB_flavor_name: sadfadf
+
+ stark_vol1_id: sanfkl
+
+ param_X: sadnfklsadnfl
+
+ priv_net_id: 123214
+
+ priv_sub2net_id: 123123
+
+ int_priv_net_id: sndfj
+
+ workload_context: asdfsadfs
+
+ environment_context: asdfsadfs
+
+ availability_zone_0: sadnfjk
+
+ STARKDB_private_v6_ips: ansdfj
+
+ int_priv_subnet_name: safbdjk
+
+ STARKDB_crazy_floating_ip: safd
+
+ crazy_net_id: safd
+
+ crazy_subnet_id: asfd
+
+ STARKDB_crazy_ip_0: sadf
+
+ STARKDB_crazy_ip_1: fsad
+
+ TESTDB_name2: asnjkv
--- /dev/null
+heat_template_version: 2015-04-30
+
+description: fdsafsfsa
+
+parameters:
+
+ fw_oam_route_prefixes:
+ type: string
+ description: nsjalfdn
+
+ myvm_net_fqdn:
+ type: string
+ description: nasfln
+
+ STARKDB_private_v6_ips:
+ type: comma_delimited_list
+ description: ndsajlfn
+
+ workload_context:
+ type: string
+ description: Unique ID for this VNF instance
+
+ availability_zone_0:
+ type: json
+ description: Unique ID for this VNF instance
+
+ environment_context:
+ type: string
+ description: Unique ID for this VNF instance
+
+ vnf_id:
+ type: string
+ description: Unique ID for this VNF instance
+
+ vf_module_id:
+ type: json
+ description: Unique ID for this VNF module instance
+
+ vnf_name:
+ type: string
+ description: Unique name for this VNF instance
+
+ starkdb_name:
+ type: string
+ description: fdhsfbsakdjnfjdsank
+
+ STARKDB_name:
+ type: json
+ description: fdhsfbsakdjnfjdsank
+
+ STARKDB_image_name:
+ type: string
+ description: fdhsfbsakdjnfjdsank
+
+ STARKDB_flavor_dvdfg:
+ type: string
+ description: fdhsfbsakdjnfjdsank
+
+
+ TESTDB_name:
+ type: string
+ description: fdhsfbsakdjnfjdsank
+
+ TESTDB_name2:
+ type: string
+ description: fdhsfbsakdjnfjdsank
+
+ TESTDB_image_name:
+ type: string
+ description: fdhsfbsakdjnfjdsank
+
+ TESTDB_flavor_name:
+ type: string
+ description: fdhsfbsakdjnfjdsank
+
+ stark_vol1_id:
+ type: number
+ description: myvolume
+ constraints:
+ - range: { min: 100, max: 400 }
+
+ param_X:
+ type: string
+ description: fdafsda
+
+ priv_net_id:
+ type: string
+ description: external network
+
+ #priv_sub2net_id:
+ # type: json
+ # description: external subnetwork
+
+ int_priv_subnet_name:
+ type: string
+ description: sadnfjls
+
+ int_priv_net_id:
+ type: string
+ description: internal network name
+
+ STARKDB_crazy_floating_ip:
+ type: string
+ description: asnfjl
+
+ crazy_net_id:
+ type: string
+ description: ansfkld
+
+ crazy_subnet_id:
+ type: string
+ description: asdfnkal
+
+ STARKDB_crazy_ip_0:
+ type: string
+ description: nsalfd
+
+ STARKDB_crazy_ip_1:
+ type: string
+ description: nsalfd
+
+ stark_rg_count:
+ type: string
+ description: nafs
+
+resources:
+
+ STARKDB_cinder_attach:
+ type: OS::Cinder::VolumeAttachment
+ properties:
+ server: { get_resource: STARKDB_server_0 }
+ volume: { get_param: stark_vol1_id }
+
+ STARKDB_server_0:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: STARKDB_image_name }
+ flavor: { get_param: STARKDB_flavor_dvdfg }
+ name: { get_param: starkdb_name }
+ metadata:
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id }
+ vnf_name: { get_param: vnf_name }
+ #int_network_id: { get_resource: int_priv_network }
+ workload_context: { get_param: workload_context }
+ environment_context: { get_param: environment_context }
+ networks:
+ - port: { get_resource: STARKDB_0_int_priv_port_0 }
+ - port: { get_resource: STARKDB_0_PRIV_port_1}
+ - port: { get_resource: STARKDB_0_crazy_port_0 }
+ - network: { get_param: int_priv_net_id }
+ user_data: { get_file: deep-nested.file }
+
+
+ STARKDB_server_1:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: STARKDB_image_name }
+ flavor: { get_param: STARKDB_flavor_dvdfg }
+ name: { get_param: STARKDB_name }
+ metadata:
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id }
+ vnf_name: { get_param: vnf_name }
+ #int_network_id: { get_resource: int_priv_network }
+ workload_context: { get_param: workload_context }
+ environment_context: { get_param: environment_context }
+ networks:
+ - port: {get_resource: STARKDB_1_int_priv_port_0}
+ - port: {get_resource: STARKDB_1_crazy_port_0}
+ - network: { get_param: int_priv_net_id }
+
+ TESTDB_server_0:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: TESTDB_image_name }
+ flavor: { get_param: TESTDB_flavor_name }
+ name: { get_param: TESTDB_name }
+ metadata:
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id }
+ vnf_name: { get_param: vnf_name }
+ #int_network_id: { get_resource: int_priv_network }
+ workload_context: { get_param: workload_context }
+ environment_context: { get_param: environment_context }
+ networks:
+ - port: {get_resource: TESTDB_0_int_priv_port_0}
+ - network: { get_param: int_priv_net_id }
+
+ availability_zone: { get_param: availability_zone_0 }
+
+ TESTDB_server_1:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: TESTDB_image_name }
+ flavor: { get_param: TESTDB_flavor_name }
+ name: { get_param: TESTDB_name2 }
+ metadata:
+ test_fqdn: { get_param: myvm_net_fqdn }
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id }
+ vnf_name: { get_param: vnf_name }
+ #int_network_id: { get_resource: int_priv_network }
+ workload_context: { get_param: workload_context }
+ environment_context: { get_param: environment_context }
+ networks:
+ - port: {get_resource: TESTDB_0_int_priv_port_0}
+ - network: { get_param: int_priv_net_id }
+
+ vol_attachment:
+ type: OS::Cinder::VolumeAttachment
+ properties:
+ volume_id: { get_param: stark_vol1_id }
+ server: { get_resource: STARKDB_server_0 }
+
+ int_private_net_id:
+ type: OS::Neutron::Net
+ properties:
+ name: { get_param: int_priv_net_id }
+
+ priv_network:
+ type: OS::Neutron::Net
+ properties:
+ fnsdf: nksldfnkl
+
+ stark_nested_resource:
+ type: STARKDB-nested.yaml
+ properties:
+ my_nested_parame: { get_param: vnf_id }
+
+ int_priv_subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ name: { get_param: int_priv_subnet_name}
+ network_id: { get_resource: int_private_net_id }
+
+ STARKDB_0_int_priv_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: int_private_net_id }
+ fixed_ips:
+ - subnet_id: { get_resource: int_priv_subnet }
+ - ip_address: { get_param: STARKDB_private_v6_ips }
+
+
+ STARKDB_0_crazy_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: crazy_net_id }
+ fixed_ips:
+ - subnet_id: { get_param: crazy_subnet_id }
+ - ip_address: { get_param: STARKDB_crazy_ip_0 }
+ allowed_address_pairs: [ { "ip_address": {get_param:
+ STARKDB_crazy_floating_ip}}]
+
+
+ STARKDB_1_crazy_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: crazy_net_id }
+ fixed_ips:
+ - subnet_id: { get_param: crazy_subnet_id }
+ - ip_address: { get_param: STARKDB_crazy_ip_1 }
+ allowed_address_pairs: [ { "ip_address": {get_param:
+ STARKDB_crazy_floating_ip}}]
+
+ STARKDB_1_int_priv_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: int_private_net_id }
+
+
+ TESTDB_0_int_priv_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: int_priv_net_id }
+
+ STARKDB_0_PRIV_port_1:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: priv_net_id }
+
+ STARKDB_cloud_config:
+ type: OS::Heat::CloudConfig
+
+
+ myrouteprefix:
+ type: OS::ContrailV2::InterfaceRouteTable
+ properties:
+ name:
+ str_replace:
+ template: VNF_NAME_interface_route_table
+ params:
+ VNF_NAME: { get_param: vnf_name }
+ interface_route_table_routes:
+ interface_route_table_routes_route: { get_param: fw_oam_route_prefixes }
+ test: safd
+
+ stark_rg:
+ type: OS::Heat::ResourceGroup
+ properties:
+ count: { get_param: stark_rg_count }
+ resource_def:
+ type: STARKDB-nested.yaml
+ properties:
+ my_nested_parameter: 4
+
+outputs:
+ test_output:
+ value: { list_join: [',', [ { get_param: param_X }, { get_param: stark_vol1_id } ] ] }
+
+ int_priv_su2bnet_id:
+ value: { get_resource: int_priv_subnet }
+
+ int_priv_net_id:
+ value: { get_resource: int_private_net_id }
+
+ STARKDB_crazy_floating_ip:
+ value: { get_param: STARKDB_crazy_floating_ip }
+
+ crazy_subnet_id:
+ value: { get_param: crazy_subnet_id }
+
+ crazy_net_id:
+ value: { get_param: crazy_net_id }
--- /dev/null
+heat_template_version: 2015-04-30
+
+description: fdsafsfsa
+
+parameters:
+
+ my_nested_parameter:
+ type: number
+ description: sdfnklafd
+ #constraints:
+ # - range: { min: 100, max: 400 }
+
+resources:
+
+ my_nested_resource2:
+ type: test
+ properties:
+ my_nested_parameter: {get_param: my_nested_parameter}
+
+outputs:
+ test_value:
+ value: { get_param: my_nested_parameter }
\ No newline at end of file
--- /dev/null
+parameters:
+
+ #fw_oam_route_prefixes: nsaflj
+
+ #myvm_net_fqdn: nasfln
+
+ #vnf_id: sadfadf
+
+ #vf_module_id: sadfadf
+
+ #vnf_name: sadfadf
+
+ #starkdb_name: bghbhjb
+
+ #STARKDB_name: bghbhjb
+
+ STARKDB_image_name: sadfadf
+
+ STARKDB_flavor_dvdfg: sadfadf
+
+ #TESTDB_name: bghbhjb
+
+ TESTDB_avail_hosts: test
+
+ TESTDB_image_name: sadfadf
+
+ TESTDB_flavor_name: sadfadf
+
+ stark_vol1_id: sanfkl
+
+ param_X: sadnfklsadnfl
+
+ priv_net_id: 123214
+
+ #priv_sub2net_id: 123123
+
+ #int_priv_net_id: sndfj
+
+ #workload_context: asdfsadfs
+
+ #environment_context: asdfsadfs
+
+ #availability_zone_0: sadnfjk
+
+ #STARKDB_private_v6_ips: ansdfj
+
+ #int_priv_subnet_name: safbdjk
+
+ #STARKDB_crazy_floating_ip: safd
+
+ crazy_net_id: safd
+
+ #crazy_subnet_id: asfd
+
+ #STARKDB_crazy_ip_0: sadf
+
+ #STARKDB_crazy_ip_1: fsad
+
+ #TESTDB_name2: asnjkv
+
+ stark_rg_count: najsf
+
+ my_nested_parameter: nasjlf
\ No newline at end of file
--- /dev/null
+heat_template_version: 2015-04-30
+
+description: fdsafsfsa
+
+parameters:
+
+ fw_oam_route_prefixes:
+ type: string
+ description: nsjalfdn
+
+ myvm_net_fqdn:
+ type: string
+ description: nasfln
+
+ TESTDB_avail_hosts:
+ type: string
+ description: nsfadl
+
+ STARKDB_private_v6_ips:
+ type: comma_delimited_list
+ description: ndsajlfn
+
+ workload_context:
+ type: string
+ description: Unique ID for this VNF instance
+
+ availability_zone_0:
+ type: json
+ description: Unique ID for this VNF instance
+
+ environment_context:
+ type: string
+ description: Unique ID for this VNF instance
+
+ vnf_id:
+ type: string
+ description: Unique ID for this VNF instance
+
+ vf_module_id:
+ type: json
+ description: Unique ID for this VNF module instance
+
+ vnf_name:
+ type: string
+ description: Unique name for this VNF instance
+
+ starkdb_name:
+ type: string
+ description: fdhsfbsakdjnfjdsank
+
+ STARKDB_name:
+ type: json
+ description: fdhsfbsakdjnfjdsank
+
+ STARKDB_image_name:
+ type: string
+ description: fdhsfbsakdjnfjdsank
+
+ STARKDB_flavor_dvdfg:
+ type: string
+ description: fdhsfbsakdjnfjdsank
+
+
+ TESTDB_name:
+ type: string
+ description: fdhsfbsakdjnfjdsank
+
+ TESTDB_name2:
+ type: string
+ description: fdhsfbsakdjnfjdsank
+
+ TESTDB_image_name:
+ type: string
+ description: fdhsfbsakdjnfjdsank
+
+ TESTDB_flavor_name:
+ type: string
+ description: fdhsfbsakdjnfjdsank
+
+ stark_vol1_id:
+ type: number
+ description: myvolume
+ constraints:
+ - range: { min: 100, max: 400 }
+
+ param_X:
+ type: string
+ description: fdafsda
+
+ priv_net_id:
+ type: string
+ description: external network
+
+ #priv_sub2net_id:
+ # type: json
+ # description: external subnetwork
+
+ int_priv_subnet_name:
+ type: string
+ description: sadnfjls
+
+ int_priv_net_id:
+ type: string
+ description: internal network name
+
+ STARKDB_crazy_floating_ip:
+ type: string
+ description: asnfjl
+
+ crazy_net_id:
+ type: string
+ description: ansfkld
+
+ crazy_subnet_id:
+ type: string
+ description: asdfnkal
+
+ STARKDB_crazy_ip_0:
+ type: string
+ description: nsalfd
+
+ STARKDB_crazy_ip_1:
+ type: string
+ description: nsalfd
+
+ stark_rg_count:
+ type: string
+ description: njlasd
+
+ my_nested_parameter:
+ type: string
+ description: naskl
+
+resources:
+
+ STARKDB_cinder_attach:
+ type: OS::Cinder::VolumeAttachment
+ properties:
+ server: { get_resource: STARKDB_server_0 }
+ volume: { get_param: stark_vol1_id }
+
+ STARKDB_server_0:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: STARKDB_image_name }
+ flavor: { get_param: STARKDB_flavor_dvdfg }
+ name: { get_param: starkdb_name }
+ metadata:
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id }
+ vnf_name: { get_param: vnf_name }
+ workload_context: { get_param: workload_context }
+ environment_context: { get_param: environment_context }
+ networks:
+ - port: { get_resource: STARKDB_0_int_priv_port_0 }
+ - port: { get_resource: STARKDB_0_PRIV_port_1}
+ - port: { get_resource: STARKDB_0_crazy_port_0 }
+
+
+ STARKDB_server_1:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: STARKDB_image_name }
+ flavor: { get_param: STARKDB_flavor_dvdfg }
+ name: { get_param: STARKDB_name }
+ metadata:
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id }
+ vnf_name: { get_param: vnf_name }
+ #int_network_id: { get_resource: int_priv_network }
+ workload_context: { get_param: workload_context }
+ environment_context: { get_param: environment_context }
+ networks:
+ - port: {get_resource: STARKDB_1_int_priv_port_0}
+ - port: {get_resource: STARKDB_1_crazy_port_0}
+
+ TESTDB_server_0:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: TESTDB_image_name }
+ flavor: { get_param: TESTDB_flavor_name }
+ name: { get_param: TESTDB_name }
+ metadata:
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id }
+ vnf_name: { get_param: vnf_name }
+ #int_network_id: { get_resource: int_priv_network }
+ workload_context: { get_param: workload_context }
+ environment_context: { get_param: environment_context }
+ networks:
+ - port: {get_resource: TESTDB_0_int_priv_port_0}
+ availability_zone: { get_param: availability_zone_0 }
+
+ TESTDB_server_1:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: TESTDB_image_name }
+ flavor: { get_param: TESTDB_flavor_name }
+ name: { get_param: TESTDB_name2 }
+ metadata:
+ test_fqdn: { get_param: myvm_net_fqdn }
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id }
+ vnf_name: { get_param: vnf_name }
+ #int_network_id: { get_resource: int_priv_network }
+ workload_context: { get_param: workload_context }
+ environment_context: { get_param: environment_context }
+ networks:
+ - port: {get_resource: TESTDB_0_int_priv_port_0}
+ availability_zone: { get_param: [ TESTDB_avail_hosts, 0 ] }
+
+
+ vol_attachment:
+ type: OS::Cinder::VolumeAttachment
+ properties:
+ volume_id: { get_param: stark_vol1_id }
+ server: { get_resource: STARKDB_server_0 }
+
+ int_private_net_id:
+ type: OS::Neutron::Net
+ properties:
+ name: { get_param: int_priv_net_id }
+
+ priv_network:
+ type: OS::Neutron::Net
+ properties:
+ fnsdf: nksldfnkl
+
+ int_priv_subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ name: { get_param: int_priv_subnet_name}
+ network_id: { get_resource: int_private_net_id }
+
+ STARKDB_0_int_priv_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: int_private_net_id }
+ fixed_ips:
+ - subnet_id: { get_resource: int_priv_subnet }
+ - ip_address: { get_param: STARKDB_private_v6_ips }
+
+
+ STARKDB_0_crazy_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: crazy_net_id }
+ fixed_ips:
+ - subnet_id: { get_param: crazy_subnet_id }
+ - ip_address: { get_param: STARKDB_crazy_ip_0 }
+ allowed_address_pairs: [ { "ip_address": {get_param:
+ STARKDB_crazy_floating_ip}}]
+
+
+ STARKDB_1_crazy_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: crazy_net_id }
+ fixed_ips:
+ - subnet_id: { get_param: crazy_subnet_id }
+ - ip_address: { get_param: STARKDB_crazy_ip_1 }
+ allowed_address_pairs: [ { "ip_address": {get_param:
+ STARKDB_crazy_floating_ip}}]
+
+ STARKDB_1_int_priv_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: int_private_net_id }
+
+
+ TESTDB_0_int_priv_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: int_priv_net_id }
+
+ STARKDB_0_PRIV_port_1:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: priv_net_id }
+
+ STARKDB_cloud_config:
+ type: OS::Heat::CloudConfig
+
+
+ myrouteprefix:
+ type: OS::ContrailV2::InterfaceRouteTable
+ properties:
+ name:
+ str_replace:
+ template: VNF_NAME_interface_route_table
+ params:
+ VNF_NAME: { get_param: vnf_name }
+ interface_route_table_routes:
+ interface_route_table_routes_route: { get_param: fw_oam_route_prefixes }
+ test: safd
+
+ stark_rg:
+ type: OS::Heat::ResourceGroup
+ properties:
+ count: { get_param: stark_rg_count }
+ resource_def:
+ type: STARKDB-nested.yaml
+ properties:
+ my_nested_parameter: {get_param: my_nested_parameter}
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+
+# VERSION = '1.0.0'
+
---
parameters:
- a!:
+ a$:
type: string
label: human-readable name of the parameter
description: description of the parameter
- allowed_pattern: "[A-Z]+[a-zA-Z0-9]*"
description: User name must start with an uppercase character
immutable: true
+
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+
+# VERSION = '1.0.0'
+
---
parameters:
- a!:
+ a$:
type: string
label: human-readable name of the parameter
description: description of the parameter
description: User name must start with an uppercase character
immutable: true
dummy_key: "dummy_key"
+
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+---
+ a: 1
+ b:
+ c: 3
+ d: 4
+ e:
+ f: 4
+ g:
+ h:
+ test: test
+ k: g
+basdnafdlsnsakdlfsdaf
+ test: out
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+---
+ a: 1
+ b:
+ c: 3
+ d: 4
+ e:
+ f: 4
+ g:
+ h:
+ test: test
+ k: g
+
+ test: out
\ No newline at end of file
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+
+# VERSION = '1.0.0'
+
---
-nested_template_description: base
+description: base
parameters:
vm_type_volume_name_0:
server_0:
type: nested_template_1.yaml
properties:
- name: {get_param: server_name_0}
+ name: { get_param: server_name_0 }
my_resource_group_1:
- type: OS::Nova::Server
+ type: OS::Heat::ResourceGroup
properties:
count: 5
- resource_def: { type: nested_template_2.yaml }
+ resource_def: { type: nested_template_bad.yaml }
outputs:
vm_type_volume_id_0:
- value: {get_resource: vm_type_volume_0}
\ No newline at end of file
+ value: {get_resource: vm_type_volume_0}
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+
+# VERSION = '1.0.0'
+
---
heat_template_version: 2013-05-23
type: OS::Nova::Server
properties:
image: myimage
- flavor: m1.small
\ No newline at end of file
+ flavor: m1.small
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+# VERSION = '1.0.0'
+
+---
+heat_template_version: 2013-05-23
+
+resources:
+ volume:
+ type: OS::Cinder::Volume
+ properties:
+ size: 1
+
+ volume_attachment:
+ type: OS::Cinder::VolumeAttachment
+ properties:
+ volume_id: { get_resource: volume }
+ instance_uuid: { get_resource: instance }
+
+ instance:
+ type: OS::Nova::Server
+ properties:
+ image: myimage
+ flavor: m1.small
+
+parameters:
+ admin_volume_size_0:
+ type: number
+ description: Size of the volume to be created.
+ constraints:
+ - range: { min: 1, max: 1024 }
+ description: nested templates MAY NOT have constraints.
+
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+
+# VERSION = '1.0.0'
+
---
+description: base
+
+parameters:
+ vm_type_volume_name_0:
+ type: string
+ vm_type_volume_size_0:
+ type: number
+
resources:
server_0:
type: nested_template_1.yaml
type: OS::Heat::ResourceGroup
properties:
count: 5
- resource_def: { type: nested_template_2.yaml }
\ No newline at end of file
+ resource_def: { type: nested_template_good.yaml }
+
+outputs:
+ vm_type_volume_id_0:
+ value: {get_resource: vm_type_volume_0}
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+
+# VERSION = '1.0.0'
+
---
heat_template_version: 2013-05-23
type: OS::Nova::Server
properties:
image: myimage
- flavor: m1.small
\ No newline at end of file
+ flavor: m1.small
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+# VERSION = '1.0.0'
+
+---
+heat_template_version: 2013-05-23
+
+resources:
+ volume:
+ type: OS::Cinder::Volume
+ properties:
+ size: 1
+
+ volume_attachment:
+ type: OS::Cinder::VolumeAttachment
+ properties:
+ volume_id: { get_resource: volume }
+ instance_uuid: { get_resource: instance }
+
+ instance:
+ type: OS::Nova::Server
+ properties:
+ image: myimage
+ flavor: m1.small
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+# VERSION = '1.0.0'
+
+# resource of type "OS::Nova::Server" has metadata
+# which references parameter "environment_context" of type "string".
+# FAIL: no "environment_context"
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [vm_type_a_names, 0] }
+ flavor: { get_param: vm_type_a_flavor_name}
+ image: { get_param: vm_type_a_image_name}
+ metadata:
+ my_attribute: {get_param: environment_context}
+
+parameters:
+ environment_Kontext:
+ type: string
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+# VERSION = '1.0.0'
+
+# resource of type "OS::Nova::Server" has metadata
+# which references parameter "environment_context" of type "string".
+# FAIL: "environment_context" not type "string"
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [vm_type_a_names, 0] }
+ flavor: { get_param: vm_type_a_flavor_name}
+ image: { get_param: vm_type_a_image_name}
+ metadata:
+ my_attribute: {get_param: environment_context}
+
+parameters:
+ environment_context:
+ type: number
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+# VERSION = '1.0.0'
+
+# resource of type "OS::Nova::Server" has metadata
+# which references parameter "environment_context" of type "string".
+
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [vm_type_a_names, 0] }
+ flavor: { get_param: vm_type_a_flavor_name}
+ image: { get_param: vm_type_a_image_name}
+ metadata:
+ my_attribute: {get_param: environment_context}
+
+parameters:
+ environment_context:
+ type: string
flavor: { get_param: vm_type_b_flavor_name}
image: { get_param: vm_type_b_image_name}
- VM_TYPE_B_SERVER_1:
+ vm_type_b_server_1:
type: OS::Nova::Server
properties:
name: { get_param: vm_type_b_name_1 }
name: { get_param: vm_type_b_name_1 }
flavor: { get_param: vm_type_b_flavor_name}
image: { get_param: vm_type_b_image_name}
-
\ No newline at end of file
+ networks:
+ - port: { get_resource: vm_type_b_0_int_vm_type_b_port_0 }
+
+ int_vm_type_b_net_id:
+ type: OS::Neutron::Net
+ properties:
+ fnsdf: nksldfnkl
+
+ vm_type_b_0_int_vm_type_b_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: int_vm_type_b_net_id }
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+# VERSION = '1.0.0'
+
+# resource of type "OS::Nova::Server" has metadata
+# which references parameter "workload_context" of type "string".
+# FAIL: no "workload_context"
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [vm_type_a_names, 0] }
+ flavor: { get_param: vm_type_a_flavor_name}
+ image: { get_param: vm_type_a_image_name}
+ metadata:
+ my_attribute: {get_param: workload_context}
+
+parameters:
+ workload_Kontext:
+ type: string
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+# VERSION = '1.0.0'
+
+# resource of type "OS::Nova::Server" has metadata
+# which references parameter "workload_context" of type "string".
+# FAIL: "workload_context" not type "string"
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [vm_type_a_names, 0] }
+ flavor: { get_param: vm_type_a_flavor_name}
+ image: { get_param: vm_type_a_image_name}
+ metadata:
+ my_attribute: {get_param: workload_context}
+
+parameters:
+ workload_context:
+ type: number
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+# VERSION = '1.0.0'
+
+# resource of type "OS::Nova::Server" has metadata
+# which references parameter "workload_context" of type "string".
+
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [vm_type_a_names, 0] }
+ flavor: { get_param: vm_type_a_flavor_name}
+ image: { get_param: vm_type_a_image_name}
+ metadata:
+ my_attribute: {get_param: workload_context}
+
+parameters:
+ workload_context:
+ type: string
int_vpnnet_net_id:
type: string
- description: network id for the internal network vpnnet
+ description: network id for the internal network vpnnet
int_oam_net_name:
type: string
description: name for the OAM network to be created in the resources section
+++ /dev/null
-# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
-# org.onap.vvp/validation-scripts
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the "License");
-# you may not use this software 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.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# 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============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
----
-heat_template_version: 2013-05-23
-
-description: Simple template to deploy a single compute instance
-
-parameters:
- vnf_id:
- description: Unique ID for this VNF
- type: string
- vf_module_id:
- description: Unique ID for this VF module
- type: string
- vnf_name:
- type: string
- description: Unique name for this VNF instance
- ex_image_name:
- type: string
- label: Image name or ID
- description: Image to be used for compute instance
- ex_flavor_name:
- type: string
- label: Flavor
- description: Type of instance (flavor) to be used
- ex_key:
- type: string
- label: key pair
- description: Name of the key apir the nova server will use
- ex_vm_name:
- type: string
- description: Name of the VM
- ex1_vm_names:
- type: comma_delimited_list
- description: Name of the VM
- ex1_image_name:
- type: string
- label: Image name or ID
- description: Image to be used for compute instance
- ex1_flavor_name:
- type: string
- label: Flavor
- description: Type of instance (flavor) to be used
- ex1_key:
- type: string
- label: key pair
- description: Name of the key apir the nova server will use
- ex1_server_index:
- type: number
- label: server index
- description: Index of server
- constraint:
- - range: { min: 1, max: 100 }
-
-resources:
- ex_software_config_0:
- type: OS::Heat::SoftwareConfig
- properties:
- group: ungrouped
- config:
- params:
- $stack_name: { get_param: 'OS::stack_name' }
-
- ex_nova_server_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: ex_vm_name }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex_image_name }
- flavor: { get_param: ex_flavor_name }
- key_name: { get_param: ex_key }
- networks:
- - network: { get_param: int_network_net_id }
- user_data:
- get_resource: ex_software_config_0
-
- ex1_nova_server_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: [ ex1_vm_names, 0 ] }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex1_image_name}
- flavor: { get_param: ex1_flavor_name }
- key_name: { get_param: ex1_key }
-
- ex1_nova_server_1:
- type: OS::Nova::Server
- properties:
- name: { get_param: [ ex1_vm_names, { get_param: ex1_server_index } ] }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex1_image_name}
- flavor: { get_param: ex1_flavor_name }
- key_name: { get_param: ex1_key }
\ No newline at end of file
+++ /dev/null
-heat_template_version: 2013-05-23
-
-description: Simple template to deploy a single compute instance
-
-parameters:
- vnf_id:
- description: Unique ID for this VNF
- type: string
- vf_module_id:
- description: Unique ID for this VF module
- type: string
- vnf_name:
- type: string
- description: Unique name for this VNF instance
- ex_image_name:
- type: string
- label: Image name or ID
- description: Image to be used for compute instance
- ex_flavor_name:
- type: string
- label: Flavor
- description: Type of instance (flavor) to be used
- ex_key:
- type: string
- label: key pair
- description: Name of the key apir the nova server will use
- ex_vm_name:
- type: string
- description: Name of the VM
- ex1_vm_names:
- type: comma_delimited_list
- description: Name of the VM
- ex1_image_name:
- type: string
- label: Image name or ID
- description: Image to be used for compute instance
- ex1_flavor_name:
- type: string
- label: Flavor
- description: Type of instance (flavor) to be used
- ex1_key:
- type: string
- label: key pair
- description: Name of the key apir the nova server will use
- int_network_net_id:
- type: string
- label: Network name
- description: Name of the network the nova server will connect to
- ex1_server_index:
- type: number
- label: server index
- description: Index of server
- constraint:
- - range: { min: 1, max: 100 }
- availability_zone_0:
- type: string
- description: availabilityzone name
-
-
-resources:
- ex_software_config_0:
- type: OS::Heat::SoftwareConfig
- properties:
- group: ungrouped
- config:
- params:
- $stack_name: { get_param: 'OS::stack_name' }
-
- ex_nova_serverGroup:
- type: OS::Nova::ServerGroup
- properties:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- availability_zones: { list_join: [',', [ { get_param: availability_zone_0 }, { get_param: availability_zone_1 } ] ] }
-
- ex_nova_server_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: ex_vm_name }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex_image_name }
- flavor: { get_param: ex_flavor_name }
- key_name: { get_param: ex_key }
- networks:
- - network: { get_param: int_network_net_id }
- user_data:
- get_resource: ex_software_config_0
-
- ex1_nova_server_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: [ ex1_vm_names, 0 ] }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex1_image_name}
- flavor: { get_param: ex1_flavor_name }
- key_name: { get_param: ex1_key }
-
- ex1_nova_server_1:
- type: OS::Nova::Server
- properties:
- name: { get_param: [ ex1_vm_names, { get_param: ex1_server_index } ] }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex1_image_name}
- flavor: { get_param: ex1_flavor_name }
- key_name: { get_param: ex1_key }
+++ /dev/null
-heat_template_version: 2013-05-23
-
-description: Simple template to deploy a single compute instance
-
-parameters:
- vnf_id:
- description: Unique ID for this VNF
- type: string
- vf_module_id:
- description: Unique ID for this VF module
- type: string
- vnf_name:
- type: string
- description: Unique name for this VNF instance
- ex_image_name:
- type: string
- label: Image name or ID
- description: Image to be used for compute instance
- ex_flavor_name:
- type: string
- label: Flavor
- description: Type of instance (flavor) to be used
- ex_key:
- type: string
- label: key pair
- description: Name of the key apir the nova server will use
- ex_vm_name:
- type: string
- description: Name of the VM
- ex1_vm_names:
- type: comma_delimited_list
- description: Name of the VM
- ex1_image_name:
- type: string
- label: Image name or ID
- description: Image to be used for compute instance
- ex1_flavor_name:
- type: string
- label: Flavor
- description: Type of instance (flavor) to be used
- ex1_key:
- type: string
- label: key pair
- description: Name of the key apir the nova server will use
- int_network_net_id:
- type: string
- label: Network name
- description: Name of the network the nova server will connect to
- ex1_server_index:
- type: number
- label: server index
- description: Index of server
- constraint:
- - range: { min: 1, max: 100 }
- availability_zone_0:
- type: string
- description: availabilityzone name
- availability_zone_1:
- type: string
- description: availabilityzone name
- availability_zone_2:
- type: string
- description: availabilityzone name
-
-resources:
- ex_software_config_0:
- type: OS::Heat::SoftwareConfig
- properties:
- group: ungrouped
- config:
- params:
- $stack_name: { get_param: 'OS::stack_name' }
-
- ex_nova_serverGroup:
- type: OS::Nova::ServerGroup
- properties:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- availability_zones: { list_join: [',', [ { get_param: availability_zone_0 }, { get_param: availability_zone_2 } ] ] }
-
- ex_nova_server_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: ex_vm_name }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex_image_name }
- flavor: { get_param: ex_flavor_name }
- key_name: { get_param: ex_key }
- networks:
- - network: { get_param: int_network_net_id }
- user_data:
- get_resource: ex_software_config_0
-
- ex1_nova_server_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: [ ex1_vm_names, 0 ] }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex1_image_name}
- flavor: { get_param: ex1_flavor_name }
- key_name: { get_param: ex1_key }
-
- ex1_nova_server_1:
- type: OS::Nova::Server
- properties:
- name: { get_param: [ ex1_vm_names, { get_param: ex1_server_index } ] }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex1_image_name}
- flavor: { get_param: ex1_flavor_name }
- key_name: { get_param: ex1_key }
+++ /dev/null
-# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
-# org.onap.vvp/validation-scripts
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the "License");
-# you may not use this software 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.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# 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============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
----
-heat_template_version: 2013-05-23
-
-description: Simple template to deploy a single compute instance
-
-parameters:
- vnf_id:
- description: Unique ID for this VNF
- type: string
- vf_module_id:
- description: Unique ID for this VF module
- type: string
- vnf_name:
- type: string
- description: Unique name for this VNF instance
- ex_image_name:
- type: string
- label: Image name or ID
- description: Image to be used for compute instance
- ex_flavor_name:
- type: string
- label: Flavor
- description: Type of instance (flavor) to be used
- ex_key:
- type: string
- label: key pair
- description: Name of the key apir the nova server will use
- ex_vm_name:
- type: string
- description: Name of the VM
- ex1_vm_names:
- type: comma_delimited_list
- description: Name of the VM
- ex1_image_name:
- type: string
- label: Image name or ID
- description: Image to be used for compute instance
- ex1_flavor_name:
- type: string
- label: Flavor
- description: Type of instance (flavor) to be used
- ex1_key:
- type: string
- label: key pair
- description: Name of the key apir the nova server will use
- ex1_server_index_0:
- type: number
- label: server index
- description: Index of server
- constraint:
- - range: { min: 1, max: 100 }
- ex1_server_info:
- type: json
- label: Json containing server index
- description: Json containing the index of server
-
-resources:
- ex_software_config_0:
- type: OS::Heat::SoftwareConfig
- properties:
- group: ungrouped
- config:
- params:
- $stack_name: { get_param: 'OS::stack_name' }
-
- ex_nova_server_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: ex_vm_name }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- metering.stack: { get_param: "OS::stack_id" }
- project_id: { get_param: "OS::project_id" }
- image: { get_param: ex_image_name }
- flavor: { get_param: ex_flavor_name }
- key_name: { get_param: ex_key }
- user_data:
- get_resource: ex_software_config_0
-
- ex1_nova_server_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: [ ex1_vm_names, 0 ] }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex1_image_name}
- flavor: { get_param: ex1_flavor_name }
- key_name: { get_param: ex1_key }
-
- ex1_nova_server_1:
- type: OS::Nova::Server
- properties:
- name: { get_param: [ ex1_vm_names, { get_param: ex1_server_index_0 } ] }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex1_image_name}
- flavor: { get_param: ex1_flavor_name }
- key_name: { get_param: ex1_key }
- ex1_nova_server_2:
- type: OS::Nova::Server
- properties:
- name:
- get_param:
- - ex1_vm_names
- - get_param:
- - ex1_server_info
- - ex1_server_metadata
- - ex1_server_index_1
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex1_image_name}
- flavor: { get_param: ex1_flavor_name }
- key_name: { get_param: ex1_key }
\ No newline at end of file
+++ /dev/null
-# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
-# org.onap.vvp/validation-scripts
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the "License");
-# you may not use this software 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.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# 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============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
----
-heat_template_version: 2013-05-23
-
-description: Simple template to deploy a single compute instance
-
-parameters:
- vnf_id:
- description: Unique ID for this VNF
- type: string
- vf_module_id:
- description: Unique ID for this VF module
- type: string
- vnf_name:
- type: string
- description: Unique name for this VNF instance
- ex_image_name:
- type: string
- label: Image name or ID
- description: Image to be used for compute instance
- ex_flavor_name:
- type: string
- label: Flavor
- description: Type of instance (flavor) to be used
- ex_key:
- type: string
- label: key pair
- description: Name of the key apir the nova server will use
- ex_vm_name:
- type: string
- description: Name of the VM
- ex1_vm_names:
- type: comma_delimited_list
- description: Name of the VM
- ex1_image_name:
- type: string
- label: Image name or ID
- description: Image to be used for compute instance
- ex1_flavor_name:
- type: string
- label: Flavor
- description: Type of instance (flavor) to be used
- ex1_key:
- type: string
- label: key pair
- description: Name of the key apir the nova server will use
- int_network_net_id:
- type: string
- label: Network name
- description: Name of the network the nova server will connect to
- ex1_server_index:
- type: number
- label: server index
- description: Index of server
- constraint:
- - range: { min: 1, max: 100 }
- availability_zone_0:
- type: string
- description: availabilityzone name
- availability_zone_1:
- type: string
- description: availabilityzone name
-
-resources:
- ex_software_config_0:
- type: OS::Heat::SoftwareConfig
- properties:
- group: ungrouped
- config:
- params:
- $stack_name: { get_param: 'OS::stack_name' }
-
- ex_nova_serverGroup:
- type: OS::Nova::ServerGroup
- properties:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- availability_zones: { list_join: [',', [ { get_param: availability_zone_0 }, { get_param: availability_zone_1 } ] ] }
-
- ex_nova_server_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: ex_vm_name }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex_image_name }
- flavor: { get_param: ex_flavor_name }
- key_name: { get_param: ex_key }
- networks:
- - network: { get_param: int_network_net_id }
- user_data:
- get_resource: ex_software_config_0
-
- ex1_nova_server_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: [ ex1_vm_names, 0 ] }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex1_image_name}
- flavor: { get_param: ex1_flavor_name }
- key_name: { get_param: ex1_key }
-
- ex1_nova_server_1:
- type: OS::Nova::Server
- properties:
- name: { get_param: [ ex1_vm_names, { get_param: ex1_server_index } ] }
- metadata:
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
- vnf_name: { get_param: vnf_name }
- image: { get_param: ex1_image_name}
- flavor: { get_param: ex1_flavor_name }
- key_name: { get_param: ex1_key }
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+# VERSION = '1.0.0'
+
+---
+
+resources:
+ vm_type_b_server_0:
+ type: OS::Nova::Server
+ properties:
+ availability_zone: { get_param: availability_zone_a }
+ name: { get_param: vm_type_b_name_0 }
+ flavor: { get_param: vm_type_b_flavor_name}
+ image: { get_param: vm_type_b_image_name}
+ metadata:
+ vnf_name: { get_param: vnf_name }
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id }
+ key_name: { get_param: vm_type_b_key_name }
+ conditions:
+ condition1: True
+
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+# VERSION = '1.0.0'
+
+---
+
+resources:
+ vm_type_b_server_0:
+ type: OS::Nova::Server
+ properties:
+ availability_zone: { get_param: availability_zone_a }
+ name: { get_param: vm_type_b_name_0 }
+ flavor: { get_param: vm_type_b_flavor_name}
+ image: { get_param: vm_type_b_image_name}
+ metadata:
+ vnf_name: { get_param: vnf_name }
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id }
+ key_name: { get_param: vm_type_b_key_name }
+
volume_1:
type: OS::Cinder::Volume
properties:
- name:
- str_replace:
- template: VF_NAME_STACK_NAME_oam_volume
- params:
- VNF_NAME: {get_param: vnf_module_id }
+ name: test_name
+
volume_1:
type: OS::Cinder::Volume
properties:
- name:
- str_replace:
- template: VF_NAME_STACK_NAME_oam_volume
- params:
- VNF_NAME: {get_param: vnf_name }
- STACK_NAME: { get_param: 'OS::stack_name' }
+ name: test_name
import re
import pytest
-import yaml
+from tests import cached_yaml as yaml
from .helpers import validates
-VERSION = "1.1.0"
+VERSION = '1.1.0'
-@validates("R-98450")
+@validates('R-98450')
def test_availability_zone_naming(heat_template):
- """
+ '''
Make sure all availability zones are properly formatted
- """
+ '''
with open(heat_template) as fh:
yml = yaml.load(fh)
invalid_availability_zones = set()
- for v1 in yml["resources"].values():
+ for k1, v1 in yml["resources"].items():
if not isinstance(v1, dict):
continue
if "properties" not in v1:
if v1["type"] == "OS::Nova::Server":
for k2, v2 in v1["properties"].items():
- if k2 != "availability_zone":
+ if k2 != 'availability_zone':
continue
- if "str_replace" in v2:
+ if 'str_replace' in v2:
continue
- if not re.match(r"availability_zone_\d+", v2["get_param"]):
+ if "get_param" not in v2:
+ invalid_availability_zones.add(k1)
+ elif not re.match(r'availability_zone_\d+', v2["get_param"]):
invalid_availability_zones.add(v2["get_param"])
- assert not invalid_availability_zones, "invalid availability zones %s" % list(
- invalid_availability_zones
- )
+ assert not invalid_availability_zones, (
+ 'invalid availability zones %s' % list(
+ invalid_availability_zones))
+
if check_basename_ending('volume', filename):
continue
- if RE_BASE.search(filename):
+ if RE_BASE.search(filename.lower()):
base_template_count += 1
- msg = 'must be 1 "*_base_*" in %s not %d' % (filenames, base_template_count)
- assert base_template_count == 1, msg
+ assert base_template_count == 1, (
+ 'must be 1 "*_base_*" in %s not %d' % (
+ filenames,
+ base_template_count))
+
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-"""
+'''
A VNF's Heat Orchestration Template's Resource ``OS::Heat::CloudConfig``
Resource ID **MUST** contain the ``{vm-type}``.
-"""
+'''
import pytest
from .helpers import validates
from .utils import vm_types
-VERSION = "1.0.0"
+VERSION = '1.0.0'
-@validates("R-04747")
+@validates('R-04747')
def test_cloud_config(heat_template):
- """validate resource ids
- """
+ '''validate resource ids
+ '''
h = Heat(filepath=heat_template)
if not h.resources:
- pytest.skip("No resources in this template")
+ pytest.skip('No resources in this template')
cloud_configs = get_cloud_configs(h)
if not cloud_configs:
- pytest.skip("No CloudConfig resources in this template")
+ pytest.skip('No CloudConfig resources in this template')
resource_vm_types = vm_types.get_vm_types(h.resources)
if not resource_vm_types:
- pytest.skip("No resources with {vm-type} in this template")
+ pytest.skip('No resources with {vm-type} in this template')
bad = set()
for rid in cloud_configs:
break
else:
bad.add(rid)
- assert not bad, "CloudConfigs %s have {vm-type} not in %s" % (
+ assert not bad, 'CloudConfigs %s have {vm-type} not in %s' % (
list(bad),
- list(resource_vm_types),
- )
+ list(resource_vm_types))
def get_cloud_configs(heat):
"""Return list of resource_id whose type is OS::Heat::CloudConfig.
"""
- return [
- rid
- for rid, resource in heat.resources.items()
- if heat.nested_get(resource, "type") == "OS::Heat::CloudConfig"
- ]
+ return [rid for rid, resource in heat.resources.items()
+ if heat.nested_get(resource, 'type') == 'OS::Heat::CloudConfig']
+
#
from .helpers import validates
-"""test_env_and_yaml_same_name
-"""
+'''test_env_and_yaml_same_name
+'''
from os import listdir
from os import path
-VERSION = "1.0.0"
+VERSION = '1.0.0'
-@validates("R-67205", "R-35727", "R-22656")
+@validates('R-38474', 'R-81725', 'R-53433')
def test_env_and_yaml_same_name(template_dir):
- """
+ '''
Check that all environment template filenames are identical to an
associated Heat template filenames. Log the result of the check and add the
filename of any environment file that is badly named.
- """
+ '''
files = listdir(template_dir)
- env_files = [f for f in files if path.splitext(f)[-1] == ".env"]
- yaml_files = [f for f in files if path.splitext(f)[-1] in [".yml", ".yaml"]]
+ env_files = [f for f in files
+ if path.splitext(f)[-1] == ".env"]
+ yaml_files = [f for f in files
+ if path.splitext(f)[-1] in ['.yml', '.yaml']]
unmatched = []
for filename in env_files:
basename = path.splitext(filename)[0]
- if basename + ".yaml" not in yaml_files and basename + ".yml" not in yaml_files:
+ if (basename + '.yaml' not in yaml_files
+ and basename + '.yml' not in yaml_files):
unmatched.append(filename)
- assert not unmatched, "files with no corresponding .y[a]ml %s" % unmatched
+ assert not unmatched, (
+ 'files with no corresponding .y[a]ml %s' % unmatched)
+
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-import yaml
+'''test env file has no resource_registry
+'''
+
+from tests import cached_yaml as yaml
from .helpers import validates
-VERSION = "1.0.0"
+VERSION = '1.0.0'
-@validates("R-67231")
+@validates('R-67231')
def test_env_no_resource_registry(env_files):
- """
+ '''
A VNF's Heat Orchestration template's Environment File's
**MUST NOT** contain the "resource_registry:" section.
- """
+ '''
for filename in env_files:
with open(filename) as fi:
yml = yaml.load(fi)
- assert "resource_registry" not in yml, (
- '%s contains "resource_registry"' % filename
- )
+ assert 'resource_registry' not in yml, (
+ '%s contains "resource_registry"' % filename)
+
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+""" environment file structure
+"""
+import re
+import pytest
+
+from .helpers import validates, get_environment_pair
+
+
+VERSION = '1.0.0'
+
+# pylint: disable=invalid-name
+
+
+def check_parameter_exists(pattern, parameters):
+ if not parameters:
+ return False
+
+ for param in parameters:
+ if pattern.search(param):
+ return True
+
+ return False
+
+
+def check_param_in_env_file(environment_pair, param, DESIRED):
+
+ if not environment_pair:
+ pytest.skip("No heat/env pair could be identified")
+
+ env_file = environment_pair.get("eyml")
+
+ pattern = re.compile(r'^{}$'.format(param))
+
+ if "parameters" not in env_file:
+ pytest.skip("No parameters specified in the environment file")
+
+ return check_parameter_exists(pattern,
+ env_file.get("parameters", {})
+ ) is not DESIRED
+
+
+"""
+This function supports this structure, deviations
+may or may not work without enhancement
+
+resource_id:
+ type: <resource_type>
+ properties:
+ prop0: { get_param: parameter_0 }
+ prop1: # this is a list of dicts
+ - nested_prop_0: { get_param: parameter_1 }
+ - nested_prop_1: { get_param: [parameter_2, {index}] }
+ prop2: # this is a dict of dicts
+ nested_prop_0: { get_param: parameter_1 }
+"""
+
+
+def check_resource_parameter(environment_pair,
+ prop,
+ DESIRED,
+ resource_type,
+ resource_type_inverse=False,
+ nested_prop='',
+ exclude_resource=''):
+
+ if not environment_pair:
+ pytest.skip("No heat/env pair could be identified")
+
+ env_file = environment_pair.get("eyml")
+ template_file = environment_pair.get("yyml")
+
+ if "parameters" not in env_file:
+ pytest.skip("No parameters specified in the environment file")
+
+ invalid_parameters = []
+
+ if template_file:
+ for resource, resource_prop in template_file.get("resources", {}).items():
+
+ if exclude_resource and re.match(exclude_resource, resource):
+ continue
+
+ if resource_prop.get("type") == resource_type or \
+ (resource_prop.get("type") != resource_type
+ and resource_type_inverse):
+
+ pattern = False
+
+ if not resource_prop.get("properties"):
+ continue
+
+ resource_parameter = resource_prop.get("properties").get(prop)
+
+ if not resource_parameter:
+ continue
+
+ if isinstance(resource_parameter, list) and nested_prop:
+ for param in resource_parameter:
+
+ nested_param = param.get(nested_prop)
+ if not nested_param:
+ continue
+
+ pattern = nested_param.get("get_param")
+
+ if not pattern:
+ continue
+
+ if isinstance(pattern, list):
+ pattern = pattern[0]
+
+ elif isinstance(resource_parameter, dict):
+
+ if nested_prop and nested_prop in resource_parameter:
+ resource_parameter = resource_parameter.get(nested_prop)
+
+ pattern = resource_parameter.get("get_param")
+
+ else:
+ continue
+
+ if not pattern:
+ continue
+
+ if check_param_in_env_file(environment_pair, pattern, DESIRED):
+ invalid_parameters.append(pattern)
+
+ return set(invalid_parameters)
+
+
+@validates('R-91125')
+def test_nova_server_image_parameter_exists_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "image"
+ DESIRED = True
+ resource_type = "OS::Nova::Server"
+
+ invalid_parameters = check_resource_parameter(environment_pair,
+ prop,
+ DESIRED,
+ resource_type)
+
+ assert not invalid_parameters, ("OS::Nova::Server {} parameters not"
+ " found in {} environment file {}"
+ .format(prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-69431')
+def test_nova_server_flavor_parameter_exists_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "flavor"
+ DESIRED = True
+ resource_type = "OS::Nova::Server"
+
+ invalid_parameters = check_resource_parameter(environment_pair,
+ prop,
+ DESIRED,
+ resource_type)
+
+ assert not invalid_parameters, ("OS::Nova::Server {} parameters not"
+ " found in {} environment file {}"
+ .format(prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-22838')
+def test_nova_server_name_parameter_doesnt_exist_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "name"
+ DESIRED = False
+ resource_type = "OS::Nova::Server"
+
+ invalid_parameters = check_resource_parameter(environment_pair,
+ prop,
+ DESIRED,
+ resource_type)
+
+ assert not invalid_parameters, ("OS::Nova::Server {} parameters"
+ " found in {} environment file {}"
+ .format(prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-59568')
+def test_nova_server_az_parameter_doesnt_exist_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "availability_zone"
+ DESIRED = False
+ resource_type = "OS::Nova::Server"
+
+ invalid_parameters = check_resource_parameter(environment_pair,
+ prop,
+ DESIRED,
+ resource_type)
+
+ assert not invalid_parameters, ("OS::Nova::Server {} parameters"
+ " found in {} environment file {}"
+ .format(prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-20856')
+def test_nova_server_vnf_id_parameter_doesnt_exist_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "vnf_id"
+ DESIRED = False
+
+ invalid_parameters = check_param_in_env_file(environment_pair,
+ prop,
+ DESIRED)
+
+ assert not invalid_parameters, ("{} parameters"
+ " found in {} environment file {}"
+ .format(prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-72871')
+def test_nova_server_vf_module_id_parameter_doesnt_exist_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "vf_module_id"
+ DESIRED = False
+
+ invalid_parameters = check_param_in_env_file(environment_pair,
+ prop,
+ DESIRED)
+
+ assert not invalid_parameters, ("{} parameters"
+ " found in {} environment file {}"
+ .format(prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-36542')
+def test_nova_server_vnf_name_parameter_doesnt_exist_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "vnf_name"
+ DESIRED = False
+
+ invalid_parameters = check_param_in_env_file(environment_pair,
+ prop,
+ DESIRED)
+
+ assert not invalid_parameters, ("{} parameters"
+ " found in {} environment file {}"
+ .format(prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-80374')
+def test_nova_server_vf_module_name_parameter_doesnt_exist_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "vf_module_name"
+ DESIRED = False
+
+ invalid_parameters = check_param_in_env_file(environment_pair,
+ prop,
+ DESIRED)
+
+ assert not invalid_parameters, ("{} parameters"
+ " found in {} environment file {}"
+ .format(prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-02691')
+def test_nova_server_workload_context_parameter_doesnt_exist_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "workload_context"
+ DESIRED = False
+
+ invalid_parameters = check_param_in_env_file(environment_pair,
+ prop,
+ DESIRED)
+
+ assert not invalid_parameters, ("{} parameters"
+ " found in {} environment file {}"
+ .format(prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-13194')
+def test_nova_server_environment_context_parameter_doesnt_exist_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "environment_context"
+ DESIRED = False
+
+ invalid_parameters = check_param_in_env_file(environment_pair,
+ prop,
+ DESIRED)
+
+ assert not invalid_parameters, ("{} parameters"
+ " found in {} environment file {}"
+ .format(prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-29872')
+def test_nova_server_network_parameter_doesnt_exist_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "networks"
+ nested_prop = "network"
+ DESIRED = False
+ resource_type = "OS::Nova::Server"
+
+ invalid_parameters = check_resource_parameter(environment_pair,
+ prop,
+ DESIRED,
+ resource_type,
+ nested_prop=nested_prop)
+
+ assert not invalid_parameters, ("{} {} parameters"
+ " found in {} environment file {}"
+ .format(resource_type,
+ nested_prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-39841',
+ 'R-87123',
+ 'R-28795',
+ 'R-97201',
+ 'R-62590',
+ 'R-93496',
+ 'R-98905',
+ 'R-93030',
+ 'R-90206',
+ 'R-98569',
+ 'R-62590',
+ 'R-93496')
+def test_neutron_port_fixedips_ipaddress_parameter_doesnt_exist_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "fixed_ips"
+ nested_prop = "ip_address"
+ DESIRED = False
+ resource_type = "OS::Neutron::Port"
+
+ invalid_parameters = check_resource_parameter(environment_pair,
+ prop,
+ DESIRED,
+ resource_type,
+ nested_prop=nested_prop)
+
+ assert not invalid_parameters, ("{} {} parameters"
+ " found in {} environment file {}"
+ .format(resource_type,
+ nested_prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-83677',
+ 'R-80829',
+ 'R-69634',
+ 'R-22288')
+def test_neutron_port_fixedips_subnet_parameter_doesnt_exist_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "fixed_ips"
+ nested_prop = "subnet_id"
+ DESIRED = False
+ resource_type = "OS::Neutron::Port"
+
+ invalid_parameters = check_resource_parameter(environment_pair,
+ prop,
+ DESIRED,
+ resource_type,
+ nested_prop=nested_prop)
+
+ assert not invalid_parameters, ("{} {} parameters"
+ " found in {} environment file {}"
+ .format(resource_type,
+ nested_prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-83412',
+ 'R-83418')
+def test_neutron_port_aap_ip_parameter_doesnt_exist_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "allowed_address_pairs"
+ nested_prop = "ip_address"
+ DESIRED = False
+ resource_type = "OS::Neutron::Port"
+
+ invalid_parameters = check_resource_parameter(environment_pair,
+ prop,
+ DESIRED,
+ resource_type,
+ nested_prop=nested_prop)
+
+ assert not invalid_parameters, ("{} {} parameters"
+ " found in {} environment file {}"
+ .format(resource_type,
+ nested_prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-99812')
+def test_non_nova_server_name_parameter_doesnt_exist_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "name"
+ DESIRED = False
+ resource_type = "OS::Nova::Server"
+
+ invalid_parameters = check_resource_parameter(environment_pair,
+ prop,
+ DESIRED,
+ resource_type,
+ resource_type_inverse=True)
+
+ assert not invalid_parameters, ("non-{} {} parameters"
+ " found in {} environment file {}"
+ .format(resource_type,
+ prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-92193')
+def test_network_fqdn_parameter_doesnt_exist_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = r'^(.+?)_net_fqdn$'
+ DESIRED = False
+
+ invalid_parameters = check_param_in_env_file(environment_pair,
+ prop,
+ DESIRED)
+
+ assert not invalid_parameters, ("{} parameters"
+ " found in {} environment file {}"
+ .format(prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-76682')
+def test_contrail_route_prefixes_parameter_doesnt_exist_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "interface_route_table_routes"
+ nested_prop = "interface_route_table_routes_route"
+ DESIRED = False
+ resource_type = "OS::ContrailV2::InterfaceRouteTable"
+
+ invalid_parameters = check_resource_parameter(environment_pair,
+ prop,
+ DESIRED,
+ resource_type,
+ nested_prop=nested_prop)
+
+ assert not invalid_parameters, ("{} {} parameters"
+ " found in {} environment file {}"
+ .format(resource_type,
+ nested_prop,
+ environment_pair.get("name"),
+ invalid_parameters))
+
+
+@validates('R-50011')
+def test_heat_rg_count_parameter_exists_in_environment_file(heat_template):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "count"
+ DESIRED = True
+ resource_type = "OS::Heat::ResourceGroup"
+ exclude_resource = re.compile(r'^(.+?)_subint_(.+?)_port_(.+?)_subinterfaces$')
+
+ invalid_parameters = check_resource_parameter(environment_pair,
+ prop,
+ DESIRED,
+ resource_type,
+ exclude_resource=exclude_resource)
+
+ assert not invalid_parameters, ("{} {} parameters not"
+ " found in {} environment file {}"
+ .format(resource_type,
+ prop,
+ environment_pair.get("name"),
+ invalid_parameters))
""" environment file structure
"""
-import yaml
-import pytest
+from tests import cached_yaml as yaml
from .helpers import validates
-VERSION = "1.0.0"
+VERSION = '1.0.0'
# pylint: disable=invalid-name
-def test_environment_structure(env_file):
- """
- Check that all environments files only have the allowed sections
- """
- key_values = [
- "parameters",
- "event_sinks",
- "encrypted_parameters",
- "parameter_merge_strategies",
- ]
-
- with open(env_file) as fh:
- yml = yaml.load(fh)
- assert [k for k in key_values if k in yml], "%s missing any of %s" % (
- env_file,
- key_values,
- )
-
-
-@validates("R-03324")
+@validates('R-03324')
def test_environment_file_contains_required_sections(env_file):
- """
+ '''
Check that all environments files only have the allowed sections
- """
+ '''
required_keys = ["parameters"]
with open(env_file) as fh:
yml = yaml.load(fh)
missing_keys = [v for v in required_keys if v not in yml]
- assert not missing_keys, "%s missing %s" % (env_file, missing_keys)
-
-
-def test_environment_file_sections_have_the_right_format(env_file):
- """
- Check that all environment files have sections of the right format.
- Do note that it only tests for dicts or not dicts currently.
- """
- dict_keys = ["parameters", "encrypted_parameters", "parameter_merge_strategies"]
- not_dict_keys = ["event_sinks"]
-
- with open(env_file) as fh:
- yml = yaml.load(fh)
-
- if not [k for k in dict_keys + not_dict_keys if k in yml]:
- pytest.skip("The fixture is not applicable for this test")
-
- bad_dict_keys = [k for k in dict_keys if k in yml and not isinstance(yml[k], dict)]
- bad_not_dict_keys = [
- k for k in not_dict_keys if k in yml and isinstance(yml[k], dict)
- ]
- errors = []
- if bad_dict_keys:
- errors.append("must be dict %s" % bad_dict_keys)
- if bad_not_dict_keys:
- errors.append("must not be dict %s" % bad_not_dict_keys)
- assert not errors, "%s errors:\n %s" % (env_file, "\n ".join(errors))
+ assert not missing_keys, '%s missing %s' % (env_file, missing_keys)
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+import re
from os import sep
+
import pytest
-import re
-import yaml
-from .utils.nested_iterables import find_all_get_file_in_yml
+from tests import cached_yaml as yaml
+
from .helpers import validates
+from .utils.nested_iterables import find_all_get_file_in_yml
@validates('R-99646')
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-from .helpers import validates
+
import pytest
-import yaml
+from tests import cached_yaml as yaml
+
+from .helpers import validates
@validates('R-88863')
-def test_numeric_parameter(yaml_file):
+def test_numeric_parameter(heat_template):
'''
Make sure all numeric parameters has either `range` or `allowed_values`
specified
key_values = ["range", "allowed_values"]
missing_constraints = []
- with open(yaml_file) as fh:
+ with open(heat_template) as fh:
yml = yaml.load(fh)
# skip if parameters are not defined
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-from .helpers import validates
+
from os import path
+from .helpers import validates
+
@validates('R-86285', 'R-38474', 'R-81725', 'R-53433', 'R-56438',
'R-74304', 'R-91342', 'R-94509', 'R-31141')
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-from .helpers import validates
-import pytest
-import re
-import yaml
-
-# one or more (alphanumeric or underscore)
-RE_VALID_PARAMETER_NAME = re.compile(r"[\w_]+$")
+"""parameters
+"""
-def test_parameter_valid_keys(yaml_file):
- """
- Make sure each parameter is a dict and only contain
- valid keys
- """
- key_values = ["type", "label", "description", "hidden", "constraints", "immutable"]
+import re
- with open(yaml_file) as fh:
- yml = yaml.load(fh)
+import pytest
+from tests import cached_yaml as yaml
- # skip if parameters are not defined
- if "parameters" not in yml:
- pytest.skip("No parameters specified in the heat template")
+from .helpers import validates
- invalid_params = []
- for v1 in yml["parameters"].values():
- if not isinstance(v1, dict):
- continue
- detected_keys = set(v1) & set(key_values)
- if set(v1) != set(detected_keys):
- invalid_params.append(str(v1))
+VERSION = '1.0.0'
- assert not set(invalid_params)
+# one or more (alphanumeric or underscore)
+RE_VALID_PARAMETER_NAME = re.compile(r'[\w_]+$')
-@validates("R-90526")
+@validates('R-90526')
def test_default_values(yaml_file):
- """
+ '''
Make sure no default values are set for any parameter.
- """
+ '''
with open(yaml_file) as fh:
yml = yaml.load(fh)
for v1 in yml["parameters"].values():
if not isinstance(v1, dict):
continue
- if any(k == "default" for k in v1):
+ if any(k == 'default' for k in v1):
invalid_params.append(str(v1))
assert not set(invalid_params)
-@validates("R-25877")
+@validates('R-25877')
def test_parameter_names(yaml_file):
- """
+ '''
A VNF's Heat Orchestration Template's parameter name
(i.e., <param name>) **MUST** contain only alphanumeric
characters and underscores ('_').
- """
+ '''
with open(yaml_file) as fh:
yml = yaml.load(fh)
if "parameters" not in yml:
pytest.skip("No parameters specified in the heat template")
- for key in yml["parameters"]:
- assert RE_VALID_PARAMETER_NAME.match(
- key
- ), '%s parameter "%s" not alphanumeric or underscore' % (yaml_file, key)
+ for key in yml['parameters']:
+ assert RE_VALID_PARAMETER_NAME.match(key), (
+ '%s parameter "%s" not alphanumeric or underscore' % (
+ yaml_file,
+ key))
+
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-from .helpers import validates
-import yaml
+
import pytest
+from tests import cached_yaml as yaml
+
+from .helpers import validates
@validates('R-36772', 'R-44001')
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+
+"""Test heat template structure
+"""
+
+from tests import cached_yaml as yaml
from .helpers import validates
-import yaml
+
+VERSION = '1.2.0'
+
+# pylint: disable=invalid-name
-def test_heat_template_structure(yaml_file):
+@validates('R-27078')
+def test_heat_template_structure_contains_heat_template_version(yaml_file):
'''
- Check that all heat templates only have the allowed sections
+ Check that all heat templates have the required sections
'''
- key_values = ["heat_template_version", "description",
- "parameter_groups", "parameters", "resources",
- "outputs", "conditions"]
+ required_key_values = ["heat_template_version"]
with open(yaml_file) as fh:
yml = yaml.load(fh)
- assert all([k in key_values for k in yml])
+ assert all([k in yml for k in required_key_values]), (
+ "{} doesn't contain the {} section, but it is required"
+ .format(yaml_file, required_key_values[0]))
-@validates('R-27078', 'R-39402', 'R-35414')
-def test_heat_template_structure_contains_required_sections(yaml_file):
+@validates('R-39402')
+def test_heat_template_structure_contains_description(yaml_file):
'''
Check that all heat templates have the required sections
'''
- required_key_values = ["heat_template_version", "description",
- "parameters", "resources"]
+ required_key_values = ["description"]
with open(yaml_file) as fh:
yml = yaml.load(fh)
- assert all([k in yml for k in required_key_values])
+ assert all([k in yml for k in required_key_values]), (
+ "{} doesn't contain the {} section, but it is required"
+ .format(yaml_file, required_key_values[0]))
-def test_heat_template_structure_sections_have_the_right_format(yaml_file):
+@validates('R-35414')
+def test_heat_template_structure_contains_parameters(yaml_file):
'''
- Check that all heat templates have sections of the right format.
- Do note that it only tests for dicts or not dicts currently.
+ Check that all heat templates have the required sections
'''
- key_values = ["heat_template_version", "description",
- "parameter_groups", "parameters", "resources",
- "outputs", "conditions"]
- key_values_not_dicts = ["heat_template_version", "description"]
+ required_key_values = ["parameters"]
with open(yaml_file) as fh:
yml = yaml.load(fh)
+ assert all([k in yml for k in required_key_values]), (
+ "{} doesn't contain the {} section, but it is required"
+ .format(yaml_file, required_key_values[0]))
+
- is_dict = 0
- should_be_dict = 0
- is_not_dict = 0
- should_not_be_dict = 0
- for key_value in key_values:
- if key_value in yml:
- if isinstance(yml[key_value], dict):
- is_dict += 1
- if key_value not in key_values_not_dicts:
- should_be_dict += 1
- elif not isinstance(yml[key_value], list):
- is_not_dict += 1
- if key_value in key_values_not_dicts:
- should_not_be_dict += 1
- assert (is_dict == should_be_dict and
- is_not_dict == should_not_be_dict)
+@validates('R-23664')
+def test_heat_template_structure_contains_resources(heat_template):
+ '''
+ Check that all heat templates have the required sections
+ '''
+ required_key_values = ["resources"]
+
+ with open(heat_template) as fh:
+ yml = yaml.load(fh)
+ assert all([k in yml for k in required_key_values]), (
+ "{} doesn't contain the {} section, but it is required"
+ .format(heat_template, required_key_values[0]))
@validates('R-11441')
def test_parameter_type(yaml_file):
- types = [
- 'string',
- 'number',
- 'json',
- 'comma_delimited_list',
- 'boolean',
- ]
+ '''A VNF's Heat Orchestration Template's parameter type **MUST**
+ be one of the following values:
+ '''
+ types = ['string',
+ 'number',
+ 'json',
+ 'comma_delimited_list',
+ 'boolean']
with open(yaml_file) as fh:
yml = yaml.load(fh)
for key, param in yml.get('parameters', {}).items():
yaml_file,
key,
typ)
+
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+from os import path
+
+import pytest
+from tests import cached_yaml as yaml
+
+from .helpers import validates
+from yamllint.config import YamlLintConfig
+from yamllint import linter
+from .utils.nested_files import check_for_invalid_nesting
+from .utils.nested_iterables import find_all_get_resource_in_yml
+from .utils.nested_iterables import find_all_get_param_in_yml
+
+"""
+Order tests by number so they execute in order for base tests
+"""
+
+
+@pytest.mark.base
+@validates('R-95303')
+def test_00_valid_yaml(filename):
+ '''
+ Read in each .yaml or .env file. If it is successfully parsed as yaml, save
+ contents, else add filename to list of bad yaml files. Log the result of
+ parse attempt.
+ '''
+ conf = YamlLintConfig('rules: {}')
+
+ if path.splitext(filename)[-1] in [".yml", ".yaml", ".env"]:
+ gen = linter.run(open(filename), conf)
+ errors = list(gen)
+
+ assert not errors, "Error parsing file {} with error {}".format(filename, errors)
+ else:
+ pytest.skip("The file does not have any of the extensions .yml,\
+ .yaml, or .env")
+
+
+@pytest.mark.base
+def test_02_all_referenced_resources_exists(yaml_file):
+ '''
+ Check that all resources referenced by get_resource
+ actually exists in all yaml files
+ '''
+ with open(yaml_file) as fh:
+ yml = yaml.load(fh)
+
+ # skip if resources are not defined
+ if "resources" not in yml:
+ pytest.skip("No resources specified in the yaml file")
+
+ resource_ids = yml['resources'].keys()
+ referenced_resource_ids = find_all_get_resource_in_yml(yml)
+
+ missing_referenced_resources = set()
+ for referenced_resource_id in referenced_resource_ids:
+ if referenced_resource_id not in resource_ids:
+ missing_referenced_resources.add(referenced_resource_id)
+
+ assert not missing_referenced_resources, (
+ 'missing referenced resources %s' % list(
+ missing_referenced_resources))
+
+
+@pytest.mark.base
+def test_01_valid_nesting(yaml_file):
+ '''
+ Check that the nesting is following the proper format and
+ that all nested files exists and are parsable
+ '''
+ invalid_nesting = []
+
+ with open(yaml_file) as fh:
+ yml = yaml.load(fh)
+ if "resources" in yml:
+ try:
+ invalid_nesting.extend(check_for_invalid_nesting(
+ yml["resources"],
+ yaml_file,
+ path.dirname(yaml_file)))
+ except Exception:
+ invalid_nesting.append(yaml_file)
+
+ assert not invalid_nesting, \
+ "invalid nested file detected in file {}\n\n".format(invalid_nesting)
+
+
+@pytest.mark.base
+def test_03_all_get_param_have_defined_parameter(yaml_file):
+ '''
+ Check that all referenced parameters are actually defined
+ as parameters
+ '''
+ invalid_get_params = []
+ with open(yaml_file) as fh:
+ yml = yaml.load(fh)
+
+ resource_params = find_all_get_param_in_yml(yml)
+
+ parameters = set(yml.get('parameters', {}).keys())
+ if not parameters:
+ pytest.skip("no parameters detected")
+
+ for rp in resource_params:
+ if rp not in parameters:
+ invalid_get_params.append(rp)
+
+ assert not invalid_get_params, (
+ "get_param reference detected without corresponding parameter defined {}"
+ .format(invalid_get_params))
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-"""
+'''
A VNF's Heat Orchestration Template's Resource ``OS::Heat::MultipartMime``
Resource ID **MUST** contain the ``{vm-type}``.
-"""
+'''
import pytest
from .helpers import validates
from .utils import vm_types
-VERSION = "1.0.1"
+VERSION = '1.0.1'
-@validates("R-30804")
+@validates('R-30804')
def test_multipart_mime(heat_template):
- """validate resource ids
- """
+ '''validate resource ids
+ '''
h = Heat(filepath=heat_template)
if not h.resources:
- pytest.skip("No resources in this template")
+ pytest.skip('No resources in this template')
multipart_mimes = get_multipart_mimes(h)
if not multipart_mimes:
- pytest.skip("No MultipartMime resources in this template")
+ pytest.skip('No MultipartMime resources in this template')
resource_vm_types = vm_types.get_vm_types(h.resources)
if not resource_vm_types:
- pytest.skip("No resources with {vm-type} in this template")
+ pytest.skip('No resources with {vm-type} in this template')
bad = set()
for rid in multipart_mimes:
break
else:
bad.add(rid)
- assert not bad, "MultipartMime %s have {vm-type} not in %s" % (
+ assert not bad, 'MultipartMime %s have {vm-type} not in %s' % (
list(bad),
- list(resource_vm_types),
- )
+ list(resource_vm_types))
def get_multipart_mimes(heat):
"""Return list of resource_id whose type is OS::Heat::MultipartMime.
"""
- return [
- rid
- for rid, resource in heat.resources.items()
- if heat.nested_get(resource, "type") == "OS::Heat::MultipartMime"
- ]
+ return [rid for rid, resource in heat.resources.items()
+ if heat.nested_get(resource, 'type') == 'OS::Heat::MultipartMime']
+
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+"""heat parameters
+"""
+
+import os
+
+import pytest
+from tests import cached_yaml as yaml
+
+from .helpers import validates
+from .utils.nested_files import get_list_of_nested_files
+
+VERSION = '1.0.0'
+
+
+@validates('R-00011')
+def test_nested_parameter(yaml_file):
+ '''
+ A VNF's Heat Orchestration Template's Nested YAML file's
+ parameter's **MUST NOT** have a parameter constraint defined.
+
+ '''
+ with open(yaml_file) as fh:
+ yml = yaml.load(fh)
+ dirname = os.path.dirname(yaml_file)
+ nested_files = get_list_of_nested_files(yml, dirname)
+ if nested_files:
+ for filename in nested_files:
+ with open(filename) as fh:
+ template = yaml.load(fh)
+ parameters = template.get('parameters')
+ if parameters and isinstance(parameters, dict):
+ for param, value in parameters.items():
+ if isinstance(value, dict):
+ assert 'constraints' not in value, (
+ '%s parameter "%s" has "constraints"' % (
+ filename,
+ param))
+ else:
+ pytest.skip('No nested files')
+
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-from .helpers import validates
import pytest
-import yaml
-from .utils.network_roles import get_network_role_from_port, property_uses_get_resource
+from tests import cached_yaml as yaml
+
+from .helpers import validates
+from .utils.network_roles import get_network_role_from_port, \
+ property_uses_get_resource
@validates('R-62983', 'R-86182')
#
import pytest
-import yaml
+from tests import cached_yaml as yaml
+from .helpers import validates
+
+@validates('R-93177')
def test_network_format_use_get_param_or_get_resource(heat_template):
'''
Make sure all network properties only use get_param
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-import yaml
+from tests import cached_yaml as yaml
import pytest
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+'''environment context
+'''
+
+import pytest
+from tests import cached_yaml as yaml
+
+from .helpers import validates
+
+VERSION = '1.0.0'
+
+
+@validates('R-20308')
+def test_environment_context(heat_template):
+ '''
+ A VNF's Heat Orchestration Template's OS::Nova::Server Resource
+ metadata map value parameter 'environment_context' **MUST**
+ be declared as type: 'string'.
+ '''
+ with open(heat_template) as fh:
+ yml = yaml.load(fh)
+
+ if "parameters" not in yml:
+ pytest.skip("No parameters specified in the heat template")
+ if "resources" not in yml:
+ pytest.skip("No resources specified in the heat template")
+
+ for resource, v in yml["resources"].items():
+ if (not isinstance(v, dict)
+ or v.get('type') != 'OS::Nova::Server'
+ or 'properties' not in v):
+ continue
+ metadata = v['properties'].get('metadata')
+ if not isinstance(metadata, dict):
+ continue
+ error = validate_metadata(metadata, yml['parameters'])
+ if error:
+ assert False, '%s resource "%s" %s' % (
+ heat_template,
+ resource,
+ error)
+
+
+def validate_metadata(metadata, parameters):
+ '''validate metatdata.
+ Ensure metadata references parameter environment_context
+ is a string.
+ Return error message string or None if no errors.
+ '''
+ for value in metadata.values():
+ if isinstance(value, dict):
+ if 'get_param' in value:
+ if value['get_param'] == 'environment_context':
+ wc = parameters.get('environment_context', {})
+ if wc.get('type') == 'string':
+ break
+ else:
+ return ('must have parameter "environment_context"'
+ ' of type "string"')
+ break
+ else:
+ return None
+
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-"""
+'''
Ensure that if a resource_id has an {index}, then all resources of
the same vm-type have an index, the indices are consecutive and start
with 0.
-"""
+'''
import collections
import re
from .helpers import validates
from .utils import vm_types
-VERSION = "1.1.0"
+VERSION = '1.1.0'
-RE_INDEXED_RESOURCE_ID = re.compile(r"\w+_(?P<index>\d+)$")
+RE_INDEXED_RESOURCE_ID = re.compile(r'\w+_(?P<index>\d+)$')
-@validates("R-11690")
+@validates('R-11690')
def test_indices(heat_templates):
- """validate indices
- """
+ '''validate indices
+ '''
indexed_resource_ids = {}
resources = {}
for heat_template in heat_templates:
indexed_resource_ids.update(get_indexed_resource_ids(h.resources))
resources.update(h.resources)
if not resources:
- pytest.skip("No resources found")
+ pytest.skip('No resources found')
if not indexed_resource_ids:
- pytest.skip("No resources with {index} found")
+ pytest.skip('No resources with {index} found')
types = get_types(resources, indexed_resource_ids)
if not types:
- pytest.skip("No resources with {vm-type} found")
+ pytest.skip('No resources with {vm-type} found')
indices = collections.defaultdict(list)
for resource_id, vm_type in types.items():
bad[vm_type] = index_list
break
assert not bad, (
- "vm-type indices must be consecutive, unique,"
- " and start at 0.\n %s"
- % (
- "\n ".join(
- [
- "Resource ID %s: VM Type: %s" % (x, y)
- for x, y in types.items()
- if y in bad
- ]
- )
- )
- )
+ 'vm-type indices must be consecutive, unique,'
+ ' and start at 0.\n %s' % (
+ '\n '.join(['Resource ID %s: VM Type: %s' % (x, y)
+ for x, y in types.items() if y in bad])))
def get_indexed_resource_ids(resources):
for resource in resources:
match = RE_INDEXED_RESOURCE_ID.match(resource)
if match:
- indexed_resource_ids[resource] = int(match.groupdict()["index"])
+ indexed_resource_ids[resource] = int(match.groupdict()['index'])
return indexed_resource_ids
if x and len(x) == 1:
all_vm_types[rid] = list(x)[0] # x is a set.
return all_vm_types
+
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
#
import pytest
-import yaml
+from tests import cached_yaml as yaml
+
from .helpers import validates
from .utils.vm_types import get_vm_type_for_nova_server
-@validates("R-01455", "R-48067", "R-00977")
-def test_nova_servers_valid_resource_ids(heat_template):
- """
+@validates('R-40499',
+ 'R-57282')
+def test_nova_servers_valid_resource_ids(yaml_file):
+ '''
Make sure all nova servers have valid resource ids
- """
+ '''
- with open(heat_template) as fh:
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
# skip if resources are not defined
vm_type = get_vm_type_for_nova_server(v1)
if not vm_type:
- continue
- vm_type = vm_type.lower()
-
- if vm_type + "_" not in k1.lower():
- invalid_nova_servers.append(k1)
+ # could not determine vm_type
+ invalid_nova_servers.append({"resource": k1, "vm_type": "none found"})
+ else:
+ k1_split = k1.split("_server_")
+ k1_prefix = k1_split[0]
+ if k1_prefix != vm_type:
+ # vm_type on server doesn't match
+ invalid_nova_servers.append({"resource": k1, "vm_type": vm_type})
+ else:
+ if len(k1_split) == 2:
+ k1_suffix = k1_split[1]
+ try:
+ int(k1_suffix)
+ except ValueError:
+ # vm_type_index is not an integer
+ invalid_nova_servers.append({"resource": k1, "vm_type": vm_type, "vm_type_index": k1_suffix})
+ else:
+ # vm_type_index not found
+ invalid_nova_servers.append({"resource": k1, "vm_type": vm_type, "vm_type_index": "none found"})
- assert not set(invalid_nova_servers)
+ assert not invalid_nova_servers, \
+ "Invalid OS::Nova::Server resource ids detected {}\n" \
+ "OS::Nova::Server resource ids must be in the form " \
+ "<vm_type>_server_<vm_type_index> \n" \
+ "<vm_type> is derived from flavor, image and name properties " \
+ "".format(invalid_nova_servers)
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-from .helpers import validates
import pytest
-import yaml
+import re
+
+from tests import cached_yaml as yaml
+
+from .helpers import validates
+
from .utils.vm_types import get_vm_types_for_resource
+from .utils.vm_types import get_vm_types
+
+from .utils.network_roles import get_network_roles
-@validates('R-57282', 'R-40499')
+@validates('R-57282')
def test_vm_type_consistent_on_nova_servers(heat_template):
'''
Make sure all nova servers have properly formatted properties
if len(vm_types) != 1:
invalid_nova_servers.append(k)
- assert not set(invalid_nova_servers)
+ assert not set(invalid_nova_servers), \
+ "vm_types not consistant on the following resources {}" \
+ .format(invalid_nova_servers)
+
+
+@validates('R-48067',
+ 'R-00977')
+def test_vm_type_network_role_collision(yaml_file):
+ with open(yaml_file) as fh:
+ yml = yaml.load(fh)
+
+ # skip if resources are not defined
+ if "resources" not in yml:
+ pytest.skip("No resources specified in the heat template")
+
+ resources = yml["resources"]
+
+ vm_types = get_vm_types(resources)
+ network_roles = get_network_roles(resources)
+
+ collisions = []
+ for nr in network_roles:
+ for vt in vm_types:
+ if vt in nr or nr in vt:
+ collisions.append({"vm_type": vt, "network_role": nr})
+
+ assert not collisions, \
+ "vm_type and network_role should not be substrings {}" .format(collisions)
+
+
+@validates('R-50436',
+ 'R-45188',
+ 'R-40499')
+def test_nova_server_flavor_parameter(yaml_file):
+
+ prop = "flavor"
+ check_nova_parameter_format(prop, yaml_file)
+
+
+@validates('R-51430',
+ 'R-54171',
+ 'R-87817')
+def test_nova_server_name_parameter(yaml_file):
+
+ prop = "name"
+ check_nova_parameter_format(prop, yaml_file)
+
+
+@validates('R-71152',
+ 'R-45188',
+ 'R-57282')
+def test_nova_server_image_parameter(yaml_file):
+
+ prop = "image"
+ check_nova_parameter_format(prop, yaml_file)
+
+
+def check_nova_parameter_format(prop, yaml_file):
+
+ formats = {
+ "string": {
+ "name": re.compile(r'(.+?)_name_\d+$'),
+ "flavor": re.compile(r'(.+?)_flavor_name$'),
+ "image": re.compile(r'(.+?)_image_name$')
+ },
+ "comma_delimited_list": {
+ "name": re.compile(r'(.+?)_names$')
+ }
+ }
+
+ with open(yaml_file) as fh:
+ yml = yaml.load(fh)
+
+ # skip if resources are not defined
+ if "resources" not in yml:
+ pytest.skip("No resources specified in the heat template")
+
+ # skip if resources are not defined
+ if "parameters" not in yml:
+ pytest.skip("No parameters specified in the heat template")
+
+ invalid_parameters = []
+
+ for k, v in yml["resources"].items():
+ if not isinstance(v, dict):
+ continue
+ if v.get('type') != 'OS::Nova::Server':
+ continue
+
+ prop_param = v.get("properties", {}) \
+ .get(prop, {}) \
+ .get("get_param")
+
+ if not prop_param:
+ pytest.skip("{} doesn't have property {}".format(k, prop))
+ elif isinstance(prop_param, list):
+ prop_param = prop_param[0]
+
+ template_param_type = yml.get("parameters", {}) \
+ .get(prop_param, {}) \
+ .get("type")
+
+ if not template_param_type:
+ pytest.skip("could not determine param type for {}".format(prop_param))
+
+ format_match = formats.get(template_param_type, {}) \
+ .get(prop)
+
+ if not format_match or not format_match.match(prop_param):
+ invalid_parameters.append(prop_param)
+
+ assert not set(invalid_parameters), \
+ "invalid {} parameters detected {}" \
+ .format(prop, invalid_parameters)
#
import pytest
-import yaml
+from tests import cached_yaml as yaml
def test_vm_type_assignments_on_nova_servers_only_use_get_param(heat_template):
--- /dev/null
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+
+'''workload context
+'''
+
+import pytest
+from tests import cached_yaml as yaml
+
+from .helpers import validates
+
+VERSION = '1.0.0'
+
+
+@validates('R-74978')
+def test_workload_context(heat_template):
+ '''
+ A VNF's Heat Orchestration Template's OS::Nova::Server Resource
+ metadata map value parameter 'workload_context' **MUST**
+ be declared as type: 'string'.
+ '''
+ with open(heat_template) as fh:
+ yml = yaml.load(fh)
+
+ if "parameters" not in yml:
+ pytest.skip("No parameters specified in the heat template")
+ if "resources" not in yml:
+ pytest.skip("No resources specified in the heat template")
+
+ for resource, v in yml["resources"].items():
+ if (not isinstance(v, dict)
+ or v.get('type') != 'OS::Nova::Server'
+ or 'properties' not in v):
+ continue
+ metadata = v['properties'].get('metadata')
+ if not isinstance(metadata, dict):
+ continue
+ error = validate_metadata(metadata, yml['parameters'])
+ if error:
+ assert False, '%s resource "%s" %s' % (
+ heat_template,
+ resource,
+ error)
+
+
+def validate_metadata(metadata, parameters):
+ '''validate metatdata.
+ Ensure metadata references parameter workload_context
+ is a string.
+ Return error message string or None if no errors.
+ '''
+ for value in metadata.values():
+ if isinstance(value, dict):
+ if 'get_param' in value:
+ if value['get_param'] == 'workload_context':
+ wc = parameters.get('workload_context', {})
+ if wc.get('type') == 'string':
+ break
+ else:
+ return ('must have parameter "workload_context"'
+ ' of type "string"')
+ break
+ else:
+ return None
+
#
import re
+
import pytest
-import yaml
+from tests import cached_yaml as yaml
+
from .helpers import validates
+from .utils.network_roles import get_network_role_from_port, \
+ get_network_type_from_port, \
+ property_uses_get_resource
from .utils.vm_types import get_vm_type_for_nova_server
-from .utils.network_roles import (
- get_network_role_from_port,
- get_network_type_from_port,
- property_uses_get_resource,
-)
-
-
-@validates(
- "R-29865",
- "R-69014",
- "R-05201",
- "R-68936",
- "R-32025",
- "R-11168",
- "R-84322",
- "R-96983",
- "R-26506",
- "R-20453",
- "R-26351",
-)
+
+
+@validates('R-69014',
+ 'R-05201',
+ 'R-68936',
+ 'R-32025',
+ 'R-11168',
+ 'R-84322',
+ 'R-96983',
+ 'R-26506',
+ 'R-20453',
+ 'R-26351')
def test_port_resource_ids(heat_template):
- """
+ '''
Check that all resource ids for ports follow the right
naming convention to include the {vm_type} of the
nova server it is associated to and also contains the
{network_role} of the network it is associated with
- """
+ '''
with open(heat_template) as fh:
yml = yaml.load(fh)
if "resources" not in yml:
pytest.skip("No resources specified in the heat template")
- port_patterns = {
- "internal": re.compile(r"(.+?)_\d+_int_(.+?)_port_\d+"),
- "external": re.compile(r"(.+?)_\d+_(.+?)_port_\d+"),
- }
- resources = yml["resources"]
+ port_patterns = {'internal': re.compile(r'(.+?)_\d+_int_(.+?)_port_\d+'),
+ 'external': re.compile(r'(.+?)_\d+_(.+?)_port_\d+')}
+ resources = yml['resources']
invalid_ports = []
for k, v in resources.items():
if not isinstance(v, dict):
continue
- if "type" not in v:
+ if 'type' not in v:
continue
- if v["type"] not in "OS::Nova::Server":
+ if v['type'] not in 'OS::Nova::Server':
continue
- if "properties" not in v:
+ if 'properties' not in v:
continue
- if "networks" not in v["properties"]:
+ if 'networks' not in v['properties']:
continue
has_vm_type = False
vm_type = vm_type.lower()
# get all ports associated with the nova server
- properties = v["properties"]
- for v2 in properties["networks"]:
+ properties = v['properties']
+ for v2 in properties['networks']:
for k3, v3 in v2.items():
- if k3 != "port":
+ if k3 != 'port':
continue
if not isinstance(v3, dict):
continue
- if "get_param" in v3:
+ if 'get_param' in v3:
continue
- elif "get_resource" in v3:
- port_id = v3["get_resource"]
+ elif 'get_resource' in v3:
+ port_id = v3['get_resource']
if not resources[port_id]:
continue
port_resource = resources[port_id]
else:
# match the assumed naming convention for ports
# if the specified port is provided via get_param
- network_type = "external"
+ network_type = 'external'
if "int_" in port_id:
- network_type = "internal"
+ network_type = 'internal'
if port_patterns[network_type].match(port_id):
has_network_role = True
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-from .helpers import validates
import pytest
-import yaml
+from tests import cached_yaml as yaml
+
+from .helpers import validates
@validates('R-55218', 'R-98374', 'R-44318')
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
#
import pytest
-import yaml
+from tests import cached_yaml as yaml
def test_required_parameters_provided_in_heat_template(heat_template):
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-from .helpers import validates
-import yaml
-import pytest
+
import re
+import pytest
+from tests import cached_yaml as yaml
+
+from .helpers import validates
+
@validates('R-75141')
def test_alphanumeric_resource_ids_only(yaml_file):
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-import yaml
+from tests import cached_yaml as yaml
import pytest
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-from .helpers import validates
-import yaml
import pytest
+from tests import cached_yaml as yaml
+
+from .helpers import validates
@validates('R-37437', 'R-71493', 'R-72483')
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-from .helpers import validates
-import yaml
+
import pytest
+from tests import cached_yaml as yaml
+
+from .helpers import validates
@validates('R-97199')
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-import pytest
-import yaml
-from .utils.network_roles import get_network_role_from_port, property_uses_get_resource
import re
+import pytest
+from tests import cached_yaml as yaml
+
+from .utils.network_roles import get_network_role_from_port, \
+ property_uses_get_resource
+
def test_subnet_format(heat_template):
- """
+ '''
Make sure all subnet properties follow the allowed naming
conventions
- """
+ '''
formats = [
- ["subnet_id", "string", "internal", re.compile(r"int_(.+?)_subnet_id")],
- ["subnet_id", "string", "internal", re.compile(r"int_(.+?)_v6_subnet_id")],
- ["subnet_id", "string", "external", re.compile(r"(.+?)_subnet_id")],
- ["subnet_id", "string", "external", re.compile(r"(.+?)_v6_subnet_id")],
- ]
+ ["subnet_id", "string", "internal",
+ re.compile(r'int_(.+?)_subnet_id')],
+ ["subnet_id", "string", "internal",
+ re.compile(r'int_(.+?)_v6_subnet_id')],
+ ["subnet_id", "string", "external",
+ re.compile(r'(.+?)_subnet_id')],
+ ["subnet_id", "string", "external",
+ re.compile(r'(.+?)_v6_subnet_id')]]
with open(heat_template) as fh:
yml = yaml.load(fh)
continue
# define the network_type
- network_type = "external"
- if network_param.startswith("int_"):
- network_type = "internal"
+ network_type = 'external'
+ if network_param.startswith('int_'):
+ network_type = 'internal'
for k2, v2 in v1["properties"].items():
if k2 != "fixed_ips":
#
import pytest
-import yaml
+from tests import cached_yaml as yaml
def test_subnet_format_use_get_param_or_get_resource(heat_template):
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-from .helpers import validates
-import yaml
+from tests import cached_yaml as yaml
import pytest
+from .helpers import validates
+
@validates('R-40899')
def test_unique_name_resources(yaml_files):
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-import yaml
+from tests import cached_yaml as yaml
import pytest
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-import yaml
+from tests import cached_yaml as yaml
import pytest
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-from .helpers import validates
-import yaml
+
import collections
+from tests import cached_yaml as yaml
+
+from .helpers import validates
+
@validates('R-16447')
def test_unique_resources_across_all_yaml_files(yaml_files):
try:
with open(yaml_file) as fh:
- yml = yaml.load(fh)
+ yaml.load(fh)
# Assert yaml file dont have resources
- assert len(yml["resources"]) != 0
+ # assert len(yml["resources"]) != 0
except ConstructorError as ce:
print(ce)
for rid in h.resources:
lower_rid = rid.lower()
for vm_type, lower_vm_type in vm_types.items():
- if lower_rid.startswith(lower_vm_type) and not rid.startswith(vm_type):
- bad[rid] = vm_type
+ if (lower_rid.startswith(lower_vm_type)
+ and not rid.startswith(vm_type)):
+ bad[rid] = vm_type
assert not bad, 'resource_id which do not match their vm-type %s' % bad
+
pytest.skip("No resources")
t = set()
t.update(*[vm_types.get_vm_types_for_resource(r)
- for r in v.resources.values()])
+ for r in v.resources.values()])
bad = [x for x in t if not RE_VM_TYPE.match(x) or RE_VM_TYPE_NG.match(x)]
assert not bad, 'bad vm-types %s' % bad
+
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-from .helpers import validates
-import yaml
+from tests import cached_yaml as yaml
import pytest
-@validates('R-79531')
def test_volume_format_outputs(volume_template):
'''
Check that the values are properly provided to the outputs section
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+import glob
+import os
+
+import pytest
+from tests import cached_yaml as yaml
+
from .helpers import validates
-@validates('R-11200', 'R-89913', 'R-07443')
-def test_volume_outputs_consumed(heat_volume_pair):
- '''
+def expected_template_module_pair(volume_path):
+ """Returns the path to the expected base or incremental module for a given volume"""
+ base_dir, filename = os.path.split(volume_path)
+ return os.path.join(base_dir, filename.replace("_volume", ""))
+
+
+@validates("R-82732")
+def test_volume_module_name_matches_incremental_or_base_module(volume_template):
+ expected_template_name = expected_template_module_pair(volume_template)
+ assert os.path.exists(
+ expected_template_name
+ ), "Could not find corresponding module ({}) for volume module ({}".format(
+ expected_template_name, volume_template
+ )
+
+
+@validates("R-11200", "R-07443")
+def test_volume_outputs_consumed(template_dir, volume_template):
+ """
Check that all outputs in a volume template is consumed
by the corresponding heat template
- '''
- outputs = heat_volume_pair["vyml"]["outputs"].keys()
- parameters = heat_volume_pair["yyml"]["parameters"].keys()
- assert set(outputs) <= set(parameters)
+ """
+ pair_template = expected_template_module_pair(volume_template)
+
+ # Make sure all the output parameters in the volume module are
+ # consumed by the expected base or incremental module
+ if not os.path.exists(pair_template):
+ pytest.skip("Expected pair module not found")
+ with open(volume_template, "r") as f:
+ volume = yaml.load(f)
+ with open(pair_template, "r") as f:
+ pair = yaml.load(f)
+ outputs = set(volume.get("outputs", {}).keys())
+ parameters = set(pair.get("parameters", {}).keys())
+ missing_output_parameters = outputs.difference(parameters)
+ assert not missing_output_parameters, (
+ "The output parameters ({}) in {} were not all "
+ "used by the expected module {}".format(
+ ",".join(missing_output_parameters), volume_template, pair_template
+ )
+ )
+
+ # Now make sure that none of the output parameters appear in any other
+ # template
+ template_files = set(glob.glob("*.yaml"))
+ errors = {}
+ for template_path in template_files:
+ if template_path in (pair_template, volume_template):
+ continue # Skip these files since we already checked this pair
+ with open(template_path, "r") as f:
+ template = yaml.load(f)
+ parameters = set(template.get("parameters", {}).keys())
+ misused_outputs = outputs.intersection(parameters)
+ if misused_outputs:
+ errors[template_path] = misused_outputs
+ message = ", ".join(
+ "{} ({})".format(path, ", ".join(params)) for path, params in errors.items()
+ )
+ assert not errors, "Volume output parameters detected in unexpected modules: " + \
+ message
#
import re
+
import pytest
-import yaml
+from tests import cached_yaml as yaml
+
from .utils.vm_types import get_vm_type_for_nova_server
def test_volume_resource_ids(heat_template):
- """
+ '''
Check that all resource ids for cinder volumes follow the right
naming convention to include the {vm_type} of the
nova server it is associated to
- """
+ '''
with open(heat_template) as fh:
yml = yaml.load(fh)
if "resources" not in yml:
pytest.skip("No resources specified in the heat template")
- volume_pattern = re.compile(r"(.+?)_volume_id_\d+")
- resources = yml["resources"]
+ volume_pattern = re.compile(r'(.+?)_volume_id_\d+')
+ resources = yml['resources']
invalid_volumes = []
for k, v in resources.items():
if not isinstance(v, dict):
continue
- if "type" not in v:
+ if 'type' not in v:
continue
- if v["type"] not in ["OS::Nova::Server", "OS::Cinder::VolumeAttachment"]:
+ if v['type'] not in ['OS::Nova::Server',
+ 'OS::Cinder::VolumeAttachment']:
continue
- if v["type"] == "OS::Nova::Server":
+ if v['type'] == 'OS::Nova::Server':
# check block_device_mapping and make sure the right
# {vm_type} is used
- if "properties" not in v:
+ if 'properties' not in v:
continue
- if "block_device_mapping" not in v["properties"]:
+ if 'block_device_mapping' not in v['properties']:
continue
vm_type = get_vm_type_for_nova_server(v)
vm_type = vm_type.lower()
# get the volume_id from the block_device_mapping
- properties = v["properties"]
- for v2 in properties["block_device_mapping"]:
+ properties = v['properties']
+ for v2 in properties['block_device_mapping']:
for k3, v3 in v2.items():
- if k3 != "volume_id":
+ if k3 != 'volume_id':
continue
if not isinstance(v3, dict):
continue
- volume_id = v3.get("get_param") or v3.get("get_resource")
+ volume_id = (
+ v3.get('get_param') or
+ v3.get('get_resource'))
if not volume_id:
continue
if isinstance(volume_id, list):
if vm_type + "_" not in volume_id:
invalid_volumes.append(volume_id)
- elif v["type"] == "OS::Cinder::VolumeAttachment":
+ elif v['type'] == 'OS::Cinder::VolumeAttachment':
# check the volume attachment and the {vm_type}
# of the corresponding nova server
- if "properties" not in v:
+ if 'properties' not in v:
continue
- if "volume_id" not in v["properties"]:
+ if 'volume_id' not in v['properties']:
continue
- if "instance_uuid" not in v["properties"]:
+ if 'instance_uuid' not in v['properties']:
continue
- properties = v["properties"]
+ properties = v['properties']
# get the instance_uuid and when applicable
# the nova server instance
instance_uuid = None
nova_server = None
- if "get_param" in properties["instance_uuid"]:
+ if 'get_param' in properties['instance_uuid']:
continue
- elif "get_resource" in properties["instance_uuid"]:
- instance_uuid = properties["instance_uuid"]["get_resource"]
+ elif 'get_resource' in properties['instance_uuid']:
+ instance_uuid = properties['instance_uuid']['get_resource']
if not resources[instance_uuid]:
continue
nova_server = resources[instance_uuid]
# get the volume_id
volume_id = None
- volume_id = properties["volume_id"].get("get_param") or properties[
- "volume_id"
- ].get("get_resource")
+ volume_id = (
+ properties['volume_id'].get('get_param') or
+ properties['volume_id'].get('get_resource'))
if not volume_id:
continue
if isinstance(volume_id, list):
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-import yaml
+from tests import cached_yaml as yaml
import pytest
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-import yaml
+from tests import cached_yaml as yaml
def test_volume_templates_contains_outputs(volume_template):
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed