Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Using the Contrail Heat Template

Heat is the orchestration engine of the OpenStack program. Heat enables launching multiple cloud applications based on templates that are comprised of text files.

Introduction to Heat

A Heat template describes the infrastructure for a cloud application, such as networks, servers, floating IP addresses, and the like, and can be used to manage the entire life cycle of that application.

When the application infrastructure changes, the Heat templates can be modified to automatically reflect those changes. Heat can also delete all application resources if the system is finished with an application.

Heat templates can record the relationships between resources, for example, which networks are connected by means of policy enforcements, and consequently call OpenStack REST APIs that create the necessary infrastructure, in the correct order, needed to launch the application managed by the Heat template.

Heat Architecture

Heat is implemented by means of Python applications, including the following:

  • heat-client—The CLI tool that communicates with the heat-api application to run Heat APIs.

  • heat-api—Provides an OpenStack native REST API that processes API requests by sending them to the Heat engine over remote procedure calls (RPCs).

  • heat-engine—Responsible for orchestrating the launch of templates and providing events back to the API consumer.

Support for Heat Version 2 Resources

Starting with Contrail Release 3.0.2, Contrail Heat resources and templates are autogenerated from the Contrail schema, using Heat Version 2 resources. Contrail Release 3.0.2 is the minimum required version for using Heat with Contrail in 3.x releases. The Contrail Heat Version 2 resources are of the following hierarchy: OS::ContrailV2::<ResourceName>.

The generated resources and templates are part of the Contrail Python package, and are located in the following directory in the target installation:

/usr/lib/python2.7/dist-packages/vnc_api/gen/heat/

The heat/ directory has the following subdirectories:

  • resources/—Contains all the resources for the contrail-heat plugin, which runs in the context of the Heat engine service.

  • templates/—Contains sample templates for each resource. Each sample template presents every possible parameter in the schema. Use the sample templates as a reference when you build up more complex templates for your network design.

  • env/—Contains the environment for input to each template.

The following contains a list of all the generated plug-in resources that are supported by contrail-heat :

https://github.com/tungstenfabric/tf-heat-plugin/tree/master/contrail_heat/new_templates

Deprecation of Heat Version 1 Resources

Heat Version 1 resources within the hierarchy OS::Contrail::<ResourceName> are being deprecated, and you should not create new service templates using the Heat Version 1 templates.

Heat Version 2 with Service Templates and Port Tuple Sample Workflow

With Contrail service templates Version 2, the user can create ports and bind them to a virtual machine (VM)-based service instance, by means of a port-tuple object. All objects created with the Version 2 service template are directly visible to the Contrail Heat engine, and are directly managed by Heat.

The following shows the basic workflow steps for creating a port tuple and service instance that will be managed by Heat:

  1. Create a service template. Select 2 in the Version field.

  2. Create a service instance for the service template just created.

  3. Create a port-tuple object.

  4. Create ports, using Nova VM launch or without a VM launch.

  5. Label each port as left, right, mgmt, and so on, and add the ports to the port-tuple object.

    Use a unique label for each of the ports in a single port tuple. The labels named left and right are used for forwarding.

  6. Link the port tuple to a service instance.

  7. Launch the service instance.

Example: Creating a Service Template Using Heat

The following is an example of how to create a service template using Heat.

  1. Define a template to create the service template.

  2. Create an environment file to define the values to put in the variables in the template file.

  3. Create the Heat stack by launching the template and the environment file, using the following command:

    OR use this command for recent versions of OpenStack