Adding HEAT_HOT_template_02 Test case into the HEAT Test suite.

Change-Id: Iddeabffce7df3422d89e53b00ec2157d7722bb7e
This commit is contained in:
fhernan2 2019-03-08 09:03:46 -06:00 committed by Cristopher Lemus
parent 6d00b20e72
commit 3eb1755f84
1 changed files with 217 additions and 26 deletions

View File

@ -3,7 +3,6 @@ HOT Template
============ ============
.. contents:: .. contents::
:local: :local:
:depth: 1 :depth: 1
@ -29,7 +28,7 @@ Test Pre-Conditions
a) An image with the name of cirros available a) An image with the name of cirros available
:: .. code:: bash
Export openstack_helm authentication - go to [0] for details. Export openstack_helm authentication - go to [0] for details.
@ -43,11 +42,11 @@ Test Steps
1. Create Heat stack using <cinder_volume.yaml> 1. Create Heat stack using <cinder_volume.yaml>
:: .. code:: bash
$ openstack stack create <Volume_name> -t cinder_volume.yaml $ openstack stack create <Volume_name> -t cinder_volume.yaml
:: .. code:: bash
i.e. i.e.
+---------------------+--------------------------------------+ +---------------------+--------------------------------------+
@ -62,9 +61,9 @@ Test Steps
2.Delete the stack 2.Delete the stack
:: .. code:: bash
$ openstack stack delete <Volume_name> $ openstack stack delete <Volume_name>
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
Expected Behavior Expected Behavior
@ -72,11 +71,11 @@ Expected Behavior
1. Verify 1GB cinder volume is successfully created. 1. Verify 1GB cinder volume is successfully created.
:: .. code:: bash
$ openstack stack show <volume_name> $ openstack stack show <volume_name>
:: .. code:: bash
i.e. i.e.
$ openstack stack show Volumefer $ openstack stack show Volumefer
@ -99,13 +98,13 @@ Expected Behavior
2. Verify the STACK and the resources is deleted Openstack stack list (STACK 2. Verify the STACK and the resources is deleted Openstack stack list (STACK
should not be there in the list) should not be there in the list)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
<cinder_volume.yaml> cinder_volume.yaml
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
:: .. code:: yaml
heat_template_version: 2015-10-15 heat_template_version: 2015-10-15
description: Launch a cinder volume cirros image. description: Launch a cinder volume cirros image.
resources: resources:
volume: volume:
@ -121,6 +120,195 @@ Expected Behavior
description: Volume description: Volume
value: { get_attr: [volume, size ] } value: { get_attr: [volume, size ] }
--------------------
HEAT_HOT_template_02
--------------------
:Test ID: HEAT_HOT_Template_02
:Test Title: Heat resource creation for Cinder Volume Attachment.
:Tags: HOT_template
~~~~~~~~~~~~~~
Test Objective
~~~~~~~~~~~~~~
This test case verify that `OS::Cinder::VolumeAttachment` resource for
associate an existing volume to an existing instance.
~~~~~~~~~~~~~~~~~~~
Test Pre-Conditions
~~~~~~~~~~~~~~~~~~~
a) A Nova Server Instance already created. Check [2] for creation.
b) A volume already created. Check [3] for creation.
c) Create the "cinder_volume_attachment.yaml" yaml file in your
controller.
.. code:: bash
controller-0:~$ touch cinder_volume_attachment.yaml
d) Export Instance id in your current session.
.. code:: bash
controller-0:~$ export Instance_ID=$(openstack server list | awk '/stack_demo*/ {print $2}')
e) Export Volume id in your current session.
.. code:: bash
controller-0:~$ export Volume_ID=$(openstack volume list | awk '/Vol_demo*/ {print $2}')
~~~~~~~~~~
Test Steps
~~~~~~~~~~
1. Associate a volume to an instance by typing:
.. code:: bash
controller-0:~$ openstack stack create -t cinder_volume_attachment.yaml Vol_attach_Instance --parameter "Volume_ID=$Volume_ID;Instance_ID=$Instance_ID"
.. code:: bash
+---------------------+----------------------------------------------------------+
| Field | Value |
+---------------------+----------------------------------------------------------+
| id | 45c92f19-b543-4216-bce5-136b140c74e8 |
| stack_name | Vol_attach_Instance |
| description | this is a template that attached a volume to an instance |
| creation_time | 2019-03-07T16:00:19Z |
| updated_time | None |
| stack_status | CREATE_IN_PROGRESS |
| stack_status_reason | Stack CREATE started |
+---------------------+----------------------------------------------------------+
2. List your stacks and make sure the volume was associated to the instance.
.. code:: bash
controller-0:~$ openstack stack list
3. Delete the stack Vol_attach_Instance and make sure the stack and the resources are deleted.
.. code:: bash
controller-0:~$ openstack stack delete
~~~~~~~~~~~~~~~~~
Expected Behavior
~~~~~~~~~~~~~~~~~
1. Volume was associated to the instance successfully.
2. Vol_attach_Instance listed successfully.
.. code:: bash
+--------------------------------------+---------------------+----------------------------------+-----------------+----------------------+--------------+
| ID | Stack Name | Project | Stack Status | Creation Time | Updated Time |
+--------------------------------------+---------------------+----------------------------------+-----------------+----------------------+--------------+
| 45c92f19-b543-4216-bce5-136b140c74e8 | Vol_attach_Instance | 86ab4e9a23d644d5a378e9b637dc5f5e | CREATE_COMPLETE | 2019-03-07T16:00:19Z | None |
| 229be306-6e5d-4b4c-93cc-a22b75f677c9 | Volume_demo_stack | 86ab4e9a23d644d5a378e9b637dc5f5e | CREATE_COMPLETE | 2019-03-07T15:38:40Z | None |
| 1f18959c-2d04-4def-8323-b2497bb3b745 | stack_demo | 86ab4e9a23d644d5a378e9b637dc5f5e | CREATE_COMPLETE | 2019-03-07T15:27:58Z | None |
+--------------------------------------+---------------------+----------------------------------+-----------------+----------------------+--------------+
3. STACK and resources were deleted successfully
.. code:: bash
controller-0:~$ openstack stack list
~~~~~~~~~
Templates
~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cinder_volume_attachment.yaml
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: yaml
heat_template_version: 2015-04-30
description: this is a template that attached a volume to an instance
parameters:
Instance_ID:
type: string
description: Instance ID to attach to the corresponding volume
Volume_ID:
type: string
description: Volume ID to where the instance is attached
resources:
the_resource:
type: OS::Cinder::VolumeAttachment
properties:
instance_uuid: { get_param: Instance_ID }
volume_id: { get_param: Volume_ID }
~~~~~~~~~~~~~~~~~~
cinder_volume.yaml
~~~~~~~~~~~~~~~~~~
.. code:: yaml
heat_template_version: 2015-10-15
description: Launch a cinder volume cirros image.
resources:
volume:
type: OS::Cinder::Volume
properties:
description: Cinder volume create
image: cirros
name: Vol_demo
size: 1
outputs:
volume_size:
description: Volume
value: { get_attr: [volume, size ] }
~~~~~~~~~~~~~~~~
nova_server.yaml
~~~~~~~~~~~~~~~~
.. code:: yaml
heat_template_version: 2015-10-15
description: Launch a basic instance with CirrOS image using the
``demo1.tiny`` flavor, ``mykey`` key, and one network.
parameters:
NetID:
type: string
description: Network ID to use for the instance.
resources:
server:
type: OS::Nova::Server
properties:
image: cirros
flavor: demo1.tiny
key_name:
networks:
- network: { get_param: NetID }
outputs:
instance_name:
description: Name of the instance
value: { get_attr: [ server, name ] }
instance_ip:
description: IP address of the instance.
value: { get_attr: [ server, first_address ] }
-------------------- --------------------
HEAT_HOT_Template_12 HEAT_HOT_Template_12
-------------------- --------------------
@ -142,7 +330,7 @@ Test Pre-Conditions
a) An image with the name of cirros available a) An image with the name of cirros available
:: .. code:: bash
i.e. i.e.
Export openstack_helm authentication Export openstack_helm authentication
@ -155,7 +343,7 @@ a) An image with the name of cirros available
b) A flavor with the name flavor_name.type available. b) A flavor with the name flavor_name.type available.
:: .. code:: bash
i.e. i.e.
$ openstack flavor create --public --id 1 --ram 512 --vcpus 1 --disk 4 flavor_name.type $ openstack flavor create --public --id 1 --ram 512 --vcpus 1 --disk 4 flavor_name.type
@ -163,7 +351,7 @@ b) A flavor with the name flavor_name.type available.
c) A network available c) A network available
:: .. code:: bash
i.e. i.e.
$ openstack network create net $ openstack network create net
@ -172,24 +360,23 @@ c) A network available
d) Execute the following command to take the network id d) Execute the following command to take the network id
:: .. code:: bash
$ export NET_ID=$(openstack network list | awk '/ net / { print $2 }') $ export NET_ID=$(openstack network list | awk '/ net / { print $2 }')
~~~~~~~~~~ ~~~~~~~~~~
Test Steps Test Steps
~~~~~~~~~~ ~~~~~~~~~~
1. Create Heat stack using nova_server.yaml by typing: 1. Create Heat stack using nova_server.yaml by typing:
:: .. code:: bash
$ openstack stack create --template nova_server.yaml stack_demo --parameter "NetID=$NET_ID" $ openstack stack create --template nova_server.yaml stack_demo --parameter "NetID=$NET_ID"
2. Delete the stack 2. Delete the stack
:: .. code:: bash
$ openstack stack delete stack_demo $ openstack stack delete stack_demo
@ -199,11 +386,11 @@ Expected Behavior
1. Verify Stack is successfully created and new nova instance is created. 1. Verify Stack is successfully created and new nova instance is created.
:: .. code:: bash
$ openstack stack list $ openstack stack list
:: .. code:: bash
i.e. i.e.
+--------------------------------------+------------+----------------------------------+-----------------+----------------------+----------------------+ +--------------------------------------+------------+----------------------------------+-----------------+----------------------+----------------------+
@ -218,7 +405,7 @@ Expected Behavior
<nova_server.yaml> <nova_server.yaml>
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
:: .. code:: yaml
heat_template_version: 2015-10-15 heat_template_version: 2015-10-15
description: Launch a basic instance with CirrOS image using the ``demo1.tiny`` flavor, ``mykey`` key, and one network. description: Launch a basic instance with CirrOS image using the ``demo1.tiny`` flavor, ``mykey`` key, and one network.
@ -251,3 +438,7 @@ References:
[0] - [https://wiki.openstack.org/wiki/StarlingX/Containers/Installation] [0] - [https://wiki.openstack.org/wiki/StarlingX/Containers/Installation]
[1] - [https://docs.openstack.org/nova/pike/admin/flavors2.html] [1] - [https://docs.openstack.org/nova/pike/admin/flavors2.html]
[2] - HEAT_HOT_Template_12 Test Case
[3] - HEAT_HOT_Template_01 Test Case