blob: d6f472a9479a543b6cfcdd2e21fc24c1f3820aa5 [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] -%}
Vamsi Savaramf82b1a22019-09-20 11:16:46 +00005{%- set ifname = device if selected_inf.vlan == 'native' else device + '.' + selected_inf.vlan -%}
Wenqing Gu8d933be2019-04-10 15:14:32 +02006
Vamsi Savaramf82b1a22019-09-20 11:16:46 +00007auto {{ ifname }}
Wenqing Gu8d933be2019-04-10 15:14:32 +02008{% if selected_inf.address == "dhcp" %}
Vamsi Savaramf82b1a22019-09-20 11:16:46 +00009iface {{ ifname }} inet dhcp
Wenqing Gu8d933be2019-04-10 15:14:32 +020010{% if selected_net.gateway is defined %}
11up route add default gateway {{ selected_net.gateway | ipaddr('address') }}
Wenqing Guc05952c2019-03-05 15:36:44 +010012{% endif %}
Wenqing Gu8d933be2019-04-10 15:14:32 +020013{% elif selected_inf.address == "manual" %}
Vamsi Savaramf82b1a22019-09-20 11:16:46 +000014iface {{ ifname }} inet manual
Wenqing Gua6e4f652019-03-04 06:37:40 -080015{% else %}
Vamsi Savaramf82b1a22019-09-20 11:16:46 +000016iface {{ ifname }} inet static
Wenqing Gu8d933be2019-04-10 15:14:32 +020017address {{ selected_inf.address | ipaddr('address') }}
18netmask {{ (selected_net.network + "/" + (selected_net.mask | string)) | ipaddr('netmask') }}
19{% if selected_net.gateway is defined %}
20gateway {{ selected_net.gateway | ipaddr('address') }}
Wenqing Guc05952c2019-03-05 15:36:44 +010021{% endif %}
Fatih Degirmencibecbba02019-02-25 00:37:19 +000022{% endif %}
Wenqing Gu8d933be2019-04-10 15:14:32 +020023
Vamsi Savaram13de6ca2019-08-07 09:09:42 +000024{%- endfor -%}