Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

vMX Heat Templates for Contrail

Heat templates define vMX instances and topologies on contrail. Read this topic to understand how to create vMX instances that can be used with a topology template to define interconnection of vMX instances.

vMX Heat Templates

Heat templates define vMX instances and topologies on Contrail. The vmx_contrail.yaml template defines a vMX instance, including the VCP, the VFP, and the bridge between them. It also defines any WAN ports and bridges. A topology template can have multiple vMX instances interconnected by bridges. Heat templates get their input parameters from the corresponding environment file.

You can download the vMX software package from the vMX page and uncompress the package for sample templates. Starting in Junos OS Release 17.4R1 for Contrail 4.0, use the v2 version of the Heat templates.

vMX Instance Template

You can customize the vmx_contrail.yaml or vmx_contrail_sriov.yaml templates to create vMX instances. The Heat template obtains its input parameters from the corresponding environment file.

In the vMX instance template, you modify these resources:

  • OS::Networking::VmxPort—Defines the WAN port of the FPC for virtio interfaces as either ge-x/x/x or xe/0/0/0. The input parameters obtained from the environment file are the network ID of the network on which the WAN port is added (vnetwork_id) and the name of the port (pname). The stack_name does not change.

  • OS::Networking::VmxContrailSriovPort—Defines the WAN port of the FPC for SR-IOV interfaces as either ge-x/x/x or xe/0/0/0. The input parameters obtained from the environment file are the network ID of the network on which the WAN port is added (vnetwork_id) and the name of the port (pname). The stack_name does not change.

You can find the sample instance templates at package-location/openstack. Starting in Junos OS Release 17.4R1 for Contrail 4.0, use the v2 file for the Heat templates.

vMX Topology Template

You can customize the vmx_contrail.yaml template to create vMX instances that can be used with a topology file to define how to interconnect vMX instances. The Heat template obtains its input parameters from the corresponding environment file.

In the topology template, you modify these resources:

  • OS::Networking::VmxNetContrail—Defines the OVS bridge instance. The input parameters obtained from the environment file are the CIDR of the network (net_cidr) and the name of the bridge (bname). The stack_name is always set to get_param: 'OS::stack_name'.

  • OS::Nova::VmxContrail—Defines the vMX instance. The input parameters obtained from the environment file are the network ID of the bridge (net_id1) and the stack_name.

You can find the sample instance templates at package-location/openstack/vmx-topologies/contrail-topologies.

Environment File

The Heat template obtains its input parameters from the corresponding environment file.

The environment file for the vMX instance has the net_id1 parameter:

where net_id1 is the network ID of the existing neutron network with a given VLAN ID used for the WAN port.

The environment file for the topology has the n1 parameter, which is the instance name.

The environment file has these parameter defaults:

where

  • public_network—Network ID of the existing neutron network used for the management (fxp0) port.

  • fpc_img—Name of the glance image for the VFP that was created by the script to install vMX images.

  • fpc_flav—Name of the nova flavor for the VFP that was created by the script to create OpenStack flavors.

  • junos_flav—Name of the nova flavor for the VCP that was created by the script to create OpenStack flavors.

  • junos_img—Name of the glance image for the VCP that was created by the script to install vMX images.

  • project_name—Any project name. All resources will use this name as the prefix.

  • gateway_ip—Gateway IP address.

Modifying the Ports in a Heat Template for an Instance

You can modify the vMX instance template to add or delete ports. For example, the package-location/openstack/1vmx_contrail.yaml file creates a single instance.

To add a port to the template:

  1. Download the vMX KVM software package from the vMX page and uncompress the package.

    tar xvf package-name

  2. Change directory to the location of the files.

    cd package-location/openstack

  3. Edit the 1vmx_contrail.yaml file to modify the OS::Networking::VmxPort resource.

    To add a virtio port, add another OS::Networking::VmxPort entry but change the port number to the next number, the vnetwork_id parameter to net_id2, and the pname parameter to the name of the new port. For example:

    Note:

    If you are adding virtio port entries (OS::Networking::VmxPort resource), make sure you do not include SR-IOV port entries (OS::Networking::VmxContrailSriovPort resource) because mixed interfaces are not supported.

  4. Edit the 1vmx_contrail.yaml file to modify the OS::Networking::VmxContrailSriovPort resource.

    To add another SR-IOV port, add another OS::Networking::VmxContrailSriovPort entry but change the port number to the next number, the vnetwork_id parameter to the next number, and the pname parameter to the name of the new port. For example, if the template file already has two ports:

    Note:

    If you are adding SR-IOV port entries (OS::Networking::VmxContrailSriovPort resource), make sure you do not include virtio port entries (OS::Networking::VmxPort resource) because mixed interfaces are not supported.

  5. If you have more than one port, you must modify the package-location/openstack/vmx_contrail.yaml or package-location/openstack/vmx_contrail_sriov.yaml file to add another {get_attr: [fpc0_ge_port1, port]} entry (separated by a comma) in the fpc0 resources section under all_ports properties for each additional port and changing the port number to the next number. For example, this configuration has two ports.
  6. Add additional net_id parameters under the parameters section of the template file for each vnetwork_id that you added for the VmxPort or VmxContrailSriovPort resources.
  7. Add additional net_id parameters under the parameters section of the corresponding environment file for each vnetwork_id that you added for the VmxPort or VmxContrailSriovPort resources.
    Note:

    If you are adding SR-IOV interfaces, make sure you have prepared the controller and compute nodes properly. See Prepare vMX Installation on Contrail.

  8. Create the vMX instance with the heat stack-create –f heat-filename –e environment-filename vmx-name command.
  9. Verify that the vMX instance is created with the heat stack-list | grep vmx-name command.

To delete a port, remove all the lines you included to add a port.

Defining a Topology

You can create vMX instances that can be used with a topology template to define how to interconnect vMX instances. The Heat template obtains its input parameters from the corresponding environment file. The following examples demonstrate how to modify topologies.

Creating a vMX Instance in an Existing WAN Network

The package-location/openstack/vmx-topologies/contrail-topologies/1vmx1net_contrail.yaml file creates one vMX instance with virtio ports on an existing bridge.

To add a vMX instance to this template:

  1. Copy the sample topology template file and environment file to the top-level directory.
  2. Edit the 1vmx1net_contrail.yaml file to add another OS::Nova::VmxContrail entry but change the last stack_name parameter to the next number. For example:
  3. Make sure the net_id1 parameter is listed under the parameters section of the corresponding environment file for the vMX instance (in this case, 1vmx1net_contrail.env).
  4. Start the vMX instances with the heat stack-create –f heat-filename –e environment-filename stack-name command.
  5. Verify that the vMX instance is created with the heat stack-list | grep vmx-name command.

Connecting vMX Instances with vRouter

The package-location/openstack/vmx-topologies/contrail-topologies/2vmx1net_contrail_virt.yaml file creates two instances with one port each that share a bridge.

To add a bridge that connects a second port on each vMX instance:

  1. Copy the sample topology template file and environment file to the top-level directory.
  2. Edit the 2vmx1net_contrail_virt.yaml file to add another OS::Networking::VmxNetContrail entry but change the CIDR of the network (net_cidr) and the name of the bridge (bname) to the next number. For example:
  3. To each OS::Nova::VmxContrail entry, add the next bridge network ID. For example:
  4. Add the ge_cidr parameter under the parameters section for the port.
  5. Make sure the parameters section of the corresponding environment file for the vMX instance lists all the net_id parameters.
  6. Start the vMX instances with the heat stack-create –f heat-filename –e environment-filename stack-name command.
  7. Verify that the vMX instance is created with the heat stack-list | grep vmx-name command.
Release History Table
Release
Description
17.4R1
Starting in Junos OS Release 17.4R1 for Contrail 4.0, use the v2 version of the Heat templates.
17.4R1
Starting in Junos OS Release 17.4R1 for Contrail 4.0, use the v2 file for the Heat templates.