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
). Thestack_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
). Thestack_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
). Thestack_name
is always set toget_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 thestack_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:
parameters: net_id1:
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:
parameter_defaults: public_network: fpc_img: fpc_flav: junos_flav: junos_img: project_name: gateway_ip:
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:
To delete a port, remove all the lines you included to add a port.
See Also
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:
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: