1 ##############################################################################
2 # Copyright (c) 2018 Mirantis Inc., Enea AB and others.
3 # All rights reserved. This program and the accompanying materials
4 # are made available under the terms of the Apache License, Version 2.0
5 # which accompanies this distribution, and is available at
6 # http://www.apache.org/licenses/LICENSE-2.0
7 ##############################################################################
8 {%- macro linux_network_interfaces_nic(nics, proto = 'manual') -%}
14 mtu: ${_param:interface_mtu}
20 {%- macro linux_network_interfaces_vlan(vlans, proto = 'manual') -%}
21 {%- for vlan in vlans %}
22 {%- if vlan | int > 0 %}
23 {{ vlans[vlan] }}.{{ vlan }}:
26 mtu: ${_param:interface_mtu}
28 name: {{ vlans[vlan] }}.{{ vlan }}
35 {%- macro interface_str(nic, vlan = 0) -%}
36 {{ nic }}{% if vlan | int > 0 %}.{{ vlan }}{% endif %}
39 {%- macro vpp_interface_str(speed, pci_addr, driver = '') -%}
40 {%- set p = pci_addr.replace('.', ':').split(':') -%}
41 {%- set s = 'Ethernet%d/%d/%d' | format(p[-3] | int(0, 16),
43 p[-1] | int(0, 16)) -%}
44 {%- if 'vfio' in driver -%}
45 VirtualFunction{{ s }}
47 {% if '40g' in speed %}Forty{% elif '10g' in speed %}Ten{% endif %}Gigabit{{ s }}