Create common stack_create functional test helper

The same pattern for creating a stack, defaulting arguments,
setting cleanup, and waiting for status is repeated in all
tests, so move that logic to a common base-class helper.

Change-Id: Ibf4c2f61d1f1936816245178fd8cf794e347de8b
Fill test database from models description

Now Heat models are the same as the tables state in DB after migrations,
so we can use metadata.create_all() to fill a test database.
This will speed-up test database creation and reduce a necessity in DB
migrations on SQLite

Change-Id: Ib7b6ab2591c01e91d7a55f3384dae505fe1485a7
Add console_urls attribute to server resource

This is a composite attribute that returns a dict-like structure
lazily resolving the actual console URL based on key supplied or dict of
all available consoles if no key is provided.
Example of usage to get only 'novnc' console:

  outputs:
    console:
      value: { get_attr: [server, console_urls, novnc ] }

Change-Id: I27c0426f1a9100bb483f04c059fec87bb69b6340
Implements: blueprint vnc-console-attr
Co-Authored-By: Jun Jie Nan <nanjj@cn.ibm.com>
Consider invalid keywords a template validation error

This commit changes the exception type raised when an invalid
keyword is found in the resources and outputs sections of hot
templates from a KeyError to a StackValidationFailed. The
latter is better suited to be sent to heat-api to return to
clients, as oslo.messaging deserializes it to a more compact
exception that does not include the stack trace in the message
string.

Change-Id: I7c2da96fa07503b947c6c2c4a5f8ed3231dec9db
Closes-Bug: 1393831
Populate _template_classes global on first use

This change ensures that the _template_classes global variable is always
initialized when the first template is created. This was done when
instantiating the Template base class, but it was missed when creating an
instance of any of its subclasses.

Change-Id: I5edc9f06d6b48bb04e8ed41365823021ef133909
Closes-Bug: 1397468
Reduce Server update complexity to below 20

One of the goals to polish Heat code is to make sure the complexity is
below 20.  This patch refactors the Server resource implementation
regarding its update logic so that it meets this requirement.

This is a pure code refacto patch, so no test cases are modified.

Change-Id: I18c6ada4386c0a091ae1d369db91c6a3d6429f34
Add OS::Cinder::VolumeType resource

Add OS::Cinder::VolumeType resource, implement its
basic actions: creation, deletion, updation.

Change-Id: Id37f4a0b1c558caa83dbecf7b64f87241ea89cdd
Implements: blueprint cinder-volume-type
Always import heat.rpc.api as rpc_api

heat.rpc.api was being imported as rpc_api in some modules and engine_api
in other modules.  Always import heat.rpc.api as rpc_api for consistency.

Change-Id: Ic84ca7fbac7a95eace7f2019c08ee20fa1bc8e5e
ResourceGroup allow update of resource_def

Currently the group is replaced if the resource_def is updated,
but instead we should allow updates and update the underlying
nested stack instead.  This allows properties to be changed
such that non-replacement updates can be performed on the
resource-group members.

Change-Id: I471b7ebe71ed262a8b0e2c971a32afc7062699cb
Closes-Bug: #1396533
Closes-Bug: #1380612
Use the right log marker functions

According to [1] _LI() should be used for LOG.info(), _LE() for
LOG.exception() and LOG.error(), _LW() for LOG.warning().
The log marker functions must only be used when the message is
sent directly to the log.
Debug level log messages should not be translated.

[1] http://docs.openstack.org/developer/oslo.i18n/guidelines.html

Change-Id: Ib9f92ef6696b9a95ddae74f0d4a0a557c06ecc91
Add cinder volume custom constraint

Add cinder volume custom constraint to validate
the existent of the volume not wait creation.

Change-Id: Idf4b7139eff2532e71aff48ff4a965c9e52a0921
Implements: blueprint cinder-custom-constraints
Support better access to nested attributes

This makes it easier to get access to attributes  with in
a nested stack.

bp env-nested-usability
Change-Id: I047794906ae7eb3b72b6cc779c64a9ba6e73e68a
Add support for pass through references

To make template resources more transparent we now support
the user adding an output "OS::stack_id" to a nested stack. This
is then used by get_resource in the outer stack.

Note: it is expected to use this as follows:
outputs:
  OS::stack_id:
    value: {get_resource: my_server}

bp env-nested-usability
Change-Id: I6016699514e75bd88c27f9f8f7d871b39d31343d
Implement handle_check for Rackspace Cloud Servers

This allows Rackspace::Cloud::Server to perform a sanity check when
doing a stack.check()

Change-Id: I2300a3d1f5f83969a398e8ac11656e181bc744a6
Implements: blueprint stack-check
Use physical_resource_name to generate the resource ID

The SwiftSignalHandle URL can be too long for the database column,
resulting in an unhandled exception and failed stack.

Use the SwiftSignalHandle's physical_resource_name() method to generate
the resource ID and use FnGetRefId to fetch the handle URL instead.

Change-Id: Iee5fc684b1f2f64ed543022a9e51612c1f80bb1e
Closes-Bug: #1398927
Remove config check_uptodate test

Our gate is currently broken due to an oslo library release,
so remove this check while we move to removing the sample config
(which requires changes to devstack to use tox -egenconfig)

Change-Id: Id4a37e9a5be156fea05c96e385c23da016ea9e69
Remove heat.config.sample file

This file keeps breaking our gate, because libraries we depend on
release and the generated content changes.

The check has been disabled, but to avoid the sample config becoming
totally stale, remove it and replace with a README which says
how to generate the current sample config.

Change-Id: I1c43e5cf2a7ab6fa388b91fd420392996c368e72
Revert "Handle error with non existing template file"

This is causing the test_stack_update_provider_group functional test
to fail, so revert while we investigate.

This reverts commit 51390e8ba70cc22202e27f972455af66d3dbe779.

Change-Id: I271780f3ac02030dfde9ba9beb8921dc9211c06d
Merge "Remove config check_uptodate test"
Reduce V1.1 test fakes complexity to below 20

This patch reduces v1.1 fakes to below 20.

Change-Id: I7a51beda296a6d7f70d6f3b32695103ba162b3d1