Ribbon provides a set of Heat template examples to assist you in developing a template to instantiate the type of deployment that fits your needs and environment. Beyond the required SBC parameters, these reference templates provide examples of deployment variations that are common in SBC deployments. The use cases described in this section are not specific to the SBC, they are based on standard OpenStack concepts and parameters. Refer to OpenStack documentation, or documentation from your OpenStack provider, for more information on implementing SR-IOV or VLANs in your deployment.  

Enabling SR-IOV Interfaces

The heatRgNoDhcp.yaml reference template includes the statements required to enable single root input/output virtualization (SR-IOV) in the section where virtual NICs (ports) are defined. In the reference template, these lines are commented out for all of the interfaces and therefore does not enable SR-IOV until you edit it. Use the following procedure to modify the sample template file to enable SR-IOV support for one or more interfaces.  

To enable SR-IOV on an interface:

  1. Locate the section in the template that define the characteristics of a specified interface by executing a search for the string: <interfaceName> EDIT 
    Where <interfaceName> is one of the following: pkt0 | pkt1 | mgt0 | ha0
    This search takes you to the section of the template file where the interface definition is specified.
  2. For the specified interface, uncomment the following line by removing the leading # character: binding:vnic_type: direct
  3. Repeat the previous steps for other interfaces on which you want to enable SR-IOV.

Implementing VLANs on virt-io Interfaces

The heatRgActiveVlanProviderNetworkNoDhcpTemplate.yaml reference template includes statements to set up virtual local area networks (VLANs) on the provider (pkt) networks. 

To support using VLANs on virt-io vNICs in OpenStack you must create three types of neutron ports:

  • Parent port - a single port that is attached to the instance
  • Sub-ports - one or more VLAN ports that reference the MAC address of the parent port
  • Trunk-ports - a single port that bridges a parent port with its sub-ports

The following excerpts from the template show statements to define the resources required for the deployment, including the ports. In the final two lines of the excerpt, notice that the statements attaching the pkt0 and pkt1 ports use get_attr rather than get_resource because the parent ports were created earlier in the resources section..

resources:

  parent_port_pkt0:
    type: OS::Neutron::Port
    properties:
      network: { get_param : private_network_pkt0 }

  sub_port_pkt0:
    type: OS::Neutron::Port
    properties:
      network: { get_param : provider_vlan_network_pkt0 }
      mac_address: { get_attr: [parent_port_pkt0, mac_address] }
      fixed_ips:
        - ip_address: { get_param: pkt0VlanIPAddress }
      security_groups:
        - { get_param: security_group }

  trunk_port_pkt0:
    type: OS::Neutron::Trunk
    properties:
      port: { get_resource: parent_port_pkt0 }
      sub_ports:
        - { port: { get_resource: sub_port_pkt0 },
          segmentation_type: vlan,
          segmentation_id: {get_param: pkt0VlanId } }

  parent_port_pkt1:
    type: OS::Neutron::Port
    properties:
      network: { get_param : private_network_pkt1 }

  sub_port_pkt1:
    type: OS::Neutron::Port
    properties:
      network: { get_param : provider_vlan_network_pkt1 }
      mac_address: { get_attr: [parent_port_pkt1, mac_address] }
      fixed_ips:
        - ip_address: { get_param: pkt1VlanIPAddress }
      security_groups:
        - { get_param: security_group }

  trunk_port_pkt1:
    type: OS::Neutron::Trunk
    properties:
      port: { get_resource: parent_port_pkt1 }
      sub_ports:
        - { port: { get_resource: sub_port_pkt1 },
          segmentation_type: vlan,
          segmentation_id: {get_param: pkt1VlanId } }


  # Create active vSBC instance
  vSBC_ACTIVE:
    type: OS::Nova::Server
    properties:
      name: { get_param: "OS::stack_name" }
      image: { get_param: image }
      flavor: { get_param: flavor }
      config_drive: True
      availability_zone: {get_param: availability_zone}

      # Attach previously created network ports to the instance networks:
        - port: { get_resource: mgt0_port1 }
        - port: { get_resource: ha0_port1 }
        - { port: { get_attr: [trunk_port_pkt0, port_id] } }
        - { port: { get_attr: [trunk_port_pkt1, port_id] } }

Later in the template the VLAN IDs and IP addresses are provided as input in the metadata section, as shown in the following excerpt.

        IF_PKT0_V01:
            str_replace:
                template: |
                  { "VlanId": "$vlan_id",
                    "Port": "$port_name",
                    "DHCP": "False",
                    "GW$ip_version": "$gateway_ip", 
                    "IP$ip_version": "$ip_address"
                  }
                params:
                  $port_name:  "Pkt0"
                  $vlan_id:    { get_param: pkt0VlanID }
                  $ip_version: { get_param: pkt0VlanIpVersion }
                  $ip_address: { list_join: ['/', [ { get_param: pkt0VlanIPAddress }, { get_param: pkt0VlanSubnetPrefix}]] }
                  $gateway_ip: { get_param: pkt0VlanGateway }

        IF_PKT1_V01:
            str_replace:
                template: |
                  { "VlanId": "$vlan_id",
                    "Port": "$port_name",
                    "DHCP": "False",
                    "GW$ip_version": "$gateway_ip", 
                    "IP$ip_version": "$ip_address"
                  }
                params:
                  $port_name:  "Pkt1"
                  $vlan_id:    { get_param: pkt1VlanID }
                  $ip_version: { get_param: pkt1VlanIpVersion }
                  $ip_address: { list_join: ['/', [ { get_param: pkt1VlanIPAddress }, { get_param: pkt1VlanSubnetPrefix}]] }
                  $gateway_ip: { get_param: pkt1VlanGateway }

For more information on using VLANs in Openstack, refer to the following:

https://specs.openstack.org/openstack/neutron-specs/specs/newton/vlan-aware-vms.html

https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/13/html/networking_guide/sec-trunk-vlan