{{- $host := .BuildHost }}
{{- $time := .BuildTime }}
{{- $source := .BuildSource }}
{{range $devname, $netdev := .NetDevs -}}
{{- $filename := print "ifcfg-" $devname ".xml" }}
{{- file $filename }}
<!--
This file is autogenerated by warewulf
Host:   {{ $host }}
Time:   {{ $time }}
Source: {{ $source }}
-->
<interface origin="static generated warewulf config">
  <name>{{$netdev.Device}}</name>
  {{ if $netdev.Type -}}
  <link-type>{{ $netdev.Type }}</link-type>
  {{ end -}}
  {{ if $netdev.MTU -}}
  <mtu>{{ $netdev.MTU }}</mtu>
  {{ end -}}
  <control>
    <mode>boot</mode>
  </control>
  <firewall/>
  <link/>
  <ipv4>
    <enabled>true</enabled>
    <arp-verify>true</arp-verify>
  </ipv4>
  <ipv4:static>
    <address>
      <local>{{$netdev.IpCIDR}}</local>
    </address>
{{ if $netdev.Gateway -}}
    <route>
      <nexthop>
        <gateway>{{$netdev.Gateway}}</gateway>
      </nexthop>
    </route>
{{ end -}}
  </ipv4:static>
  <ipv6>
    <enabled>true</enabled>
    <privacy>prefer-public</privacy>
    <accept-redirects>false</accept-redirects>
  </ipv6>
{{ if $netdev.Ipaddr6 -}}
  <ipv6:static>
    <address>
      <local>{{ $netdev.Ipaddr6 }}</local>
    </address>
  </ipv6:static>
{{ end -}}
</interface>
{{ end -}}
