Browse Source

Add network config for 2_linux_bonds_vlans

Add a config for traditional 2-linux-bonds-vlans network config; and add
the OVS DPDK specific config as well in its own template.

Depends-On: https://review.opendev.org/755646
Change-Id: I807f2e49482693735469f737a2459d3a559b2025
changes/78/755878/9
Emilien Macchi 2 years ago committed by Rabi Mishra
parent
commit
8418c6638a
  1. 78
      tripleo_ansible/roles/tripleo_network_config/templates/2_linux_bonds_vlans/2_linux_bonds_vlans.j2
  2. 72
      tripleo_ansible/roles/tripleo_network_config/templates/2_linux_bonds_vlans/2_linux_bonds_vlans_dpdk.j2

78
tripleo_ansible/roles/tripleo_network_config/templates/2_linux_bonds_vlans/2_linux_bonds_vlans.j2

@ -0,0 +1,78 @@
---
{% set mtu_ctlplane_list = [ctlplane_mtu] %}
{% set mtu_dataplane_list = [] %}
{% for network in role_networks %}
{# This block resolves the minimum viable MTU for interfaces connected to #}
{# the dataplane network(s), which start by "Tenant", and also bonds #}
{# and bridges that carry multiple VLANs. Each VLAN may have different MTU. #}
{# The bridge, bond or interface must have an MTU to allow the VLAN with the #}
{# largest MTU. #}
{% if network.startswith('Tenant') %}
{{ mtu_dataplane_list.append(lookup('vars', role_networks_lower[network] ~ '_mtu')) }}
{# This block resolves the minimum viable MTU for interfaces connected to #}
{# the control plane network(s) (don't start by "Tenant"), and also bonds #}
{# and bridges that carry multiple VLANs. Each VLAN may have different MTU. #}
{# The bridge, bond or interface must have an MTU to allow the VLAN with the #}
{# largest MTU. #}
{% else %}
{{ mtu_ctlplane_list.append(lookup('vars', role_networks_lower[network] ~ '_mtu')) }}
{%- endfor %}
{% set min_viable_mtu_ctlplane = mtu_ctlplane_list | max %}
{% set min_viable_mtu_dataplane = mtu_dataplane_list | max %}
network_config:
- type: interface
name: nic1
mtu: {{ ctlplane_mtu }}
use_dhcp: false
addresses:
- ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }}
routes: {{ ctlplane_host_routes }}
- type: linux_bond
name: bond_api
mtu: {{ min_viable_mtu_ctlplane }}
use_dhcp: false
bonding_options: {{ bound_interface_ovs_options }}
dns_servers: {{ ctlplane_dns_nameservers }}
domain: {{ dns_search_domains }}
members:
- type: interface
name: nic2
mtu: {{ min_viable_mtu_ctlplane }}
primary: true
- type: interface
name: nic3
mtu: {{ min_viable_mtu_ctlplane }}
{% for network in role_networks if not network.startswith('Tenant') %}
- type: vlan
device: bond_api
mtu: {{ lookup('vars', role_networks_lower[network] ~ '_mtu') }}
vlan_id: {{ lookup('vars', role_networks_lower[network] ~ '_vlan_id') }}
addresses:
- ip_netmask: {{ lookup('vars', role_networks_lower[network] ~ '_ip') }}/{{ lookup('vars', role_networks_lower[network] ~ '_cidr') }}
routes: {{ lookup('vars', role_networks_lower[network] ~ '_host_routes') }}
{% endfor %}
- type: ovs_bridge
name: {{ neutron_physical_bridge_name }}
dns_servers: {{ ctlplane_dns_nameservers }}
members:
- type: linux_bond
name: bond-data
mtu: {{ min_viable_mtu_dataplane }}
bonding_options: {{ bound_interface_ovs_options }}
members:
- type: interface
name: nic4
mtu: {{ min_viable_mtu_dataplane }}
primary: true
- type: interface
name: nic5
mtu: {{ min_viable_mtu_dataplane }}
{% for network in role_networks if network.startswith('Tenant') %}
- type: vlan
device: bond-data
mtu: {{ lookup('vars', role_networks_lower[network] ~ '_mtu') }}
vlan_id: {{ lookup('vars', role_networks_lower[network] ~ '_vlan_id') }}
addresses:
- ip_netmask: {{ lookup('vars', role_networks_lower[network] ~ '_ip') }}/{{ lookup('vars', role_networks_lower[network] ~ '_cidr') }}
routes: {{ lookup('vars', role_networks_lower[network] ~ '_host_routes') }}
{%- endfor %}

72
tripleo_ansible/roles/tripleo_network_config/templates/2_linux_bonds_vlans/2_linux_bonds_vlans_dpdk.j2

@ -0,0 +1,72 @@
---
{# This block resolves the minimum viable MTU for interfaces, bonds and #}
{# bridges that carry multiple VLANs. Each VLAN may have different MTU. The #}
{# bridge, bond or interface must have an MTU to allow the VLAN with the #}
{# largest MTU. #}
{% set mtu_list = [] %}
{{ mtu_list.append(lookup('vars', ctlplane_mtu)) }}
{% for network in role_networks %}
{{ mtu_list.append(lookup('vars', role_networks_lower[network] ~ '_mtu')) }}
{%- endfor %}
{% set min_viable_mtu = mtu_list | max %}
network_config:
- type: interface
name: nic1
mtu: {{ ctlplane_mtu }}
use_dhcp: false
addresses:
- ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }}
routes: {{ ctlplane_host_routes }}
- type: linux_bond
name: bond_api
mtu: {{ min_viable_mtu }}
use_dhcp: false
bonding_options: {{ bound_interface_ovs_options }}
dns_servers: {{ ctlplane_dns_nameservers }}
domain: {{ dns_search_domains }}
members:
- type: interface
name: nic2
mtu: {{ min_viable_mtu }}
primary: true
- type: interface
name: nic3
mtu: {{ min_viable_mtu }}
{% for network in role_networks if not network.startswith('Tenant') %}
- type: vlan
device: bond_api
mtu: {{ lookup('vars', role_networks_lower[network] ~ '_mtu') }}
vlan_id: {{ lookup('vars', role_networks_lower[network] ~ '_vlan_id') }}
addresses:
- ip_netmask: {{ lookup('vars', role_networks_lower[network] ~ '_ip') }}/{{ lookup('vars', role_networks_lower[network] ~ '_cidr') }}
routes: {{ lookup('vars', role_networks_lower[network] ~ '_host_routes') }}
{% endfor %}
{# Special config for OVS DPDK #}
- type: ovs_user_bridge
name: br-dpdk0
use_dhcp: false
{% for network in role_networks if network.startswith('Tenant') %}
ovs_extra: "set port br-dpdk0 tag={{ lookup('vars', role_networks_lower[network] ~ '_vlan_id') }}"
addresses:
- ip_netmask: {{ lookup('vars', role_networks_lower[network] ~ '_ip') }}/{{ lookup('vars', role_networks_lower[network] ~ '_cidr')}}
{% if default_route_networks and network in default_route_networks %}
routes: {{ lookup('vars', role_networks_lower[network] ~ '_host_routes') + [{'default': true, 'next_hop': lookup('vars', role_networks_lower[network] ~ '_gateway_ip')}] }}
{% else %}
routes: {{ lookup('vars', role_networks_lower[network] ~ '_host_routes') }}
{% endif %}
{%- endfor %}
members:
- type: ovs_dpdk_bond
name: dpdkbond0
rx_queue: {{ num_dpdk_interface_rx_queues }}
members:
- type: ovs_dpdk_port
name: dpdk0
members:
- type: interface
name: nic4
- type: ovs_dpdk_port
name: dpdk1
members:
- type: interface
name: nic5
Loading…
Cancel
Save