diff options
author | 2018-01-11 10:24:32 -0700 | |
---|---|---|
committer | 2018-01-11 12:00:23 -0700 | |
commit | 97cee572f017696415b212024fc28c85b892b0cd (patch) | |
tree | cbc2bafe602f31b8c19d890ab43e90165de10874 /snaps/openstack/tests/heat | |
parent | c0aee4c0d7620a32f5314ca938e4aca10c27adda (diff) |
Fixed vm instance instantiation from Heat when using nested resources
* Simplified the configuration of file resources
* Added integration test
JIRA: SNAPS-255
Change-Id: I1065d9352865d7a9f946a5d9947e32e7340f20bc
Signed-off-by: spisarski <s.pisarski@cablelabs.com>
Diffstat (limited to 'snaps/openstack/tests/heat')
-rw-r--r-- | snaps/openstack/tests/heat/agent-group.yaml | 115 | ||||
-rw-r--r-- | snaps/openstack/tests/heat/agent.yaml | 110 |
2 files changed, 225 insertions, 0 deletions
diff --git a/snaps/openstack/tests/heat/agent-group.yaml b/snaps/openstack/tests/heat/agent-group.yaml new file mode 100644 index 0000000..540ea93 --- /dev/null +++ b/snaps/openstack/tests/heat/agent-group.yaml @@ -0,0 +1,115 @@ +############################################################################## +# Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs") +# and others. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## +heat_template_version: 2013-05-23 + +parameters: + public_network: + type: string + constraints: + - custom_constraint: neutron.network + agent_flavor: + type: string + agent_image: + type: string + volume_size: + type: number + description: Size of the volume to be created. + default: 1 + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + agent_count: + type: number + default: 1 + constraints: + - range: { min: 1, max: 512 } + description: must be between 1 and 512 agents. + availability_zone: + type: string + default: nova + +resources: + slaves: + type: OS::Heat::ResourceGroup + depends_on: [subnet, network_router_interface, + open_security_group, key_pair] + properties: + count: {get_param: agent_count} + resource_def: { + type: "agent.yaml", + properties: { + public_network: {get_param: public_network}, + agent_network: {get_resource: network}, + flavor: {get_param: agent_flavor}, + image: {get_param: agent_image}, + availability_zone: {get_param: availability_zone}, + open_security_group: {get_resource: open_security_group}, + key_name: {get_resource: key_pair}, + volume_size: {get_param: volume_size} + } + } + + network: + type: OS::Neutron::Net + properties: + name: network + + subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: network } + cidr: 172.16.0.0/16 + gateway_ip: 172.16.0.1 + + network_router: + type: OS::Neutron::Router + properties: + external_gateway_info: + network: { get_param: public_network } + + network_router_interface: + type: OS::Neutron::RouterInterface + properties: + router_id: { get_resource: network_router } + subnet_id: { get_resource: subnet } + + key_pair: + type: OS::Nova::KeyPair + properties: + save_private_key: true + name: agent_keypair + + open_security_group: + type: OS::Neutron::SecurityGroup + properties: + description: An open security group to allow all access to the slaves + rules: + - remote_ip_prefix: 0.0.0.0/0 + protocol: tcp + port_range_min: 22 + port_range_max: 22 + - remote_ip_prefix: 0.0.0.0/0 + protocol: icmp + +outputs: + slave_ips: { + description: "Slave addresses", + value: { get_attr: [ slaves, agent_ip] } + } + private_key: + description: "SSH Private Key" + value: { get_attr: [ key_pair, private_key ]} diff --git a/snaps/openstack/tests/heat/agent.yaml b/snaps/openstack/tests/heat/agent.yaml new file mode 100644 index 0000000..014b14f --- /dev/null +++ b/snaps/openstack/tests/heat/agent.yaml @@ -0,0 +1,110 @@ +############################################################################## +# Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs") +# and others. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################## +heat_template_version: 2013-05-23 + +parameters: + flavor: + type: string + default: test + image: + type: string + default: 'Ubuntu 16.04' + key_name: + type: string + default: test_key + username: + type: string + default: test_user + open_security_group: + type: string + volume_size: + type: number + description: Size of the volume to be created. + default: 1 + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + agent_network: + type: string + constraints: + - custom_constraint: neutron.network + public_network: + type: string + constraints: + - custom_constraint: neutron.network + availability_zone: + type: string + default: nova + +resources: + agent: + type: "OS::Nova::Server" + properties: + name: agent + image: { get_param: image } + flavor: { get_param: flavor } + key_name: { get_param: key_name } + networks: + - port: { get_resource: agent_port } + user_data: { get_resource: agent_config } + user_data_format: RAW + availability_zone: { get_param: availability_zone} + + agent_config: + type: "OS::Heat::CloudConfig" + properties: + cloud_config: + users: + - name: { get_param: username } + groups: users + shell: /bin/bash + sudo: "ALL=(ALL) NOPASSWD:ALL" + ssh_authorized_keys: + - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEbnDiqZ8RjQJJzJPf074J41XlYED+zYBzaUZ5UkkUquXzymyUmoWaFBXJP+XPu4Ns44U/S8614+JxGk96tjUdJlIjL0Ag8HP6KLtTNCabucKcEASpgJIVWqJvE3E9upZLIEiTGsF8I8S67T2qq1J1uvtxyeZmyjm7NMamjyFXE53dhR2EHqSutyKK1CK74NkRY9wr3qWUIt35kLdKSVSfrr4gOOicDALbIRu77skHIvrjt+wK1VWphBdMg6ytuq5mIE6pjWAU3Gwl4aTxOU0z43ARzCLq8HVf8s/dKjYMj8plNqaIfceMbaEUqpNHv/xbvtGNG7N0aB/a4pkUQL07 + - default + package_update: false + package_upgrade: false + manage_etc_hosts: localhost + + agent_port: + type: "OS::Neutron::Port" + properties: + network_id: { get_param: agent_network } + security_groups: + - { get_param: open_security_group } + + floating_ip: + type: OS::Neutron::FloatingIP + properties: + floating_network_id: { get_param: public_network } + port_id: { get_resource: agent_port } + + agent_volume: + type: OS::Cinder::Volume + properties: + size: { get_param: volume_size } + + agent_volume_att: + type: OS::Cinder::VolumeAttachment + properties: + instance_uuid: { get_resource: agent } + volume_id: { get_resource: agent_volume} + +outputs: + agent_ip: + description: The floating IP address of the agent on the public network + value: { get_attr: [ floating_ip, floating_ip_address ] } |