Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Using the Juniper Networks Heat Template with Contrail

    Heat is the orchestration engine of the OpenStack Orchestration 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 IPs, 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 also can delete all application resources if the system is finished with an application.

    Heat templates can also 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, that is 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 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 (RPC).
    • heat-engine ---Responsible for orchestrating the launch of templates and providing events back to the API consumer.

    Juniper Heat Plugin

    The Juniper Heat plugin enables the use of some resources not currently included in the OpenStack Heat orchestration engine, including network policy, service template, and service instances. The heat plugin resources are loaded into the /usr/lib/heat/resources directory by the heat-engine service as it starts up. The names of the resource types in the Juniper Heat plugin include:

    • OS::Contrail::NetworkPolicy
    • OS::Contrail::ServiceTemplate
    • OS::Contrail::AttachPolicy
    • OS::Contrail::ServiceInstance

    Example: Creating a Service Template Using Heat

    The following is an example of creating a service template using Heat.

    1. Define a template to create the service template.
      service_template.yaml
      heat_template_version:  2013-¬‐05-¬‐23
      description: >
      HOT template to create a service template
      parameters:
      name:  
      type: string
      description: Name of service template     
              mode:
      type: string
      description: service mode
              type:
      type: string   
      description: service type
               image:
      type: string
      description: Name of the image
               flavor:
      type: string     
      description: Flavor
              service_interface_type_list:
      type: string
      description: List of interface types
              shared_ip_list:
      type: string
      description: List of shared ip enabled-¬‐disabled
              static_routes_list:
      type: string
      description: List of static routes enabled-¬‐disabled
       
           resources:
         service_template:
         type: OS::Contrail::ServiceTemplate
               properties:
      name: { get_param: name }
      service_mode: { get_param: mode }
      service_type: { get_param: type }
      image_name: { get_param: image }  
      flavor: { get_param: flavor }
      service_interface_type_list: { "Fn::Split" : [ ",", Ref: service_interface_type_list ] }
      shared_ip_list: { "Fn::Split" : [ ",", Ref: shared_ip_list ] }
      static_routes_list: { "Fn::Split" : [ ",", Ref: static_routes_list ] }
           outputs:
      service_template_fq_name:
         description: FQ name of the service template
         value: { get_attr: [ service_template, fq_name] }
      
      }
    2. Define an environment file to give input to the heat template.
      service_template.env
      
      parameters:
      
         name: contrail_svc_temp
      
         mode: transparent
      
         type: firewall
      
         image: cirros
      
         flavor: m1.tiny
      
         service_interface_type_list: management,left,right,other
      
         shared_ip_list: True,True,False,False     
      
         static_routes_list: False,True,False,False
    3. Create the heat stack using the following command:
      heat stack-­‐create stack1 –f service_template.yaml –e service_template.env

    Modified: 2015-09-02