blob: a7cf3e575aa0701d80562c5b58e865ebff52e678 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
##############################################################################
# Copyright (c) 2018 Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
{%- macro linux_network_interfaces_nic(nics) -%}
{%- for nic in nics %}
{{ nic }}:
enabled: true
type: eth
proto: manual
mtu: ${_param:interface_mtu}
name: {{ nic }}
noifupdown: true
{%- endfor %}
{%- endmacro -%}
{%- macro linux_network_interfaces_vlan(vlans) -%}
{%- for vlan in vlans %}
{%- if vlan | int > 0 %}
{{ vlans[vlan] }}.{{ vlan }}:
enabled: true
proto: manual
mtu: ${_param:interface_mtu}
type: vlan
name: {{ vlans[vlan] }}.{{ vlan }}
use_interfaces:
- {{ vlans[vlan] }}
{%- endif %}
{%- endfor %}
{%- endmacro -%}
{%- macro interface_str(nic, vlan = 0) -%}
{{ nic }}{% if vlan | int > 0 %}.{{ vlan }}{% endif %}
{%- endmacro -%}
{%- macro vpp_interface_str(speed, pci_addr) -%}
{%- set p = pci_addr.replace('.', ':').split(':') -%}
{%- set s = 'GigabitEthernet%d/%d/%d' | format(p[-3] | int(0, 16),
p[-2] | int(0, 16),
p[-1] | int(0, 16)) -%}
{% if '40g' in speed %}Forty{% elif '10g' in speed %}Ten{% endif %}{{ s }}
{%- endmacro -%}
|