blob: d6ef4ea061cbaec2beb4b130f2aefe70cafff7ad [file] [log] [blame]
Wenqing Gu8d933be2019-04-10 15:14:32 +02001{%- set macaddress = item.key -%}
2{%- set device = item.value -%}
Vamsi Savaram13de6ca2019-08-07 09:09:42 +00003{%- for selected_net_name, selected_net in idf.net_config.items() if node.interfaces[selected_net.interface].mac_address == macaddress -%}
Wenqing Gu8d933be2019-04-10 15:14:32 +02004{%- set selected_inf = node.interfaces[selected_net.interface] -%}
5
6auto {{ device }}
7{% if selected_inf.address == "dhcp" %}
8iface {{ device }} inet dhcp
9{% if selected_net.gateway is defined %}
10up route add default gateway {{ selected_net.gateway | ipaddr('address') }}
Wenqing Guc05952c2019-03-05 15:36:44 +010011{% endif %}
Wenqing Gu8d933be2019-04-10 15:14:32 +020012{% elif selected_inf.address == "manual" %}
13iface {{ device }} inet manual
Wenqing Gua6e4f652019-03-04 06:37:40 -080014{% else %}
Wenqing Gu8d933be2019-04-10 15:14:32 +020015iface {{ device }} inet static
16address {{ selected_inf.address | ipaddr('address') }}
17netmask {{ (selected_net.network + "/" + (selected_net.mask | string)) | ipaddr('netmask') }}
18{% if selected_net.gateway is defined %}
19gateway {{ selected_net.gateway | ipaddr('address') }}
Wenqing Guc05952c2019-03-05 15:36:44 +010020{% endif %}
Fatih Degirmencibecbba02019-02-25 00:37:19 +000021{% endif %}
Wenqing Gu8d933be2019-04-10 15:14:32 +020022
Vamsi Savaram13de6ca2019-08-07 09:09:42 +000023{%- endfor -%}