# Define Network Options for this OS <% if @obj.nil? -%> os.<%= @name -%> do |net| <% else -%> os.<%= @name -%> do |net| <% end -%>

# The Name of the Network interface. This is mandatory, even though it is
# only useful for some Operating Systems.
<% if @obj.nil? || @obj.interface.nil? -%>
#net.interface = 'eth0'
<% else -%>
net.interface = '<%= @obj.interface -%>'
<% end  -%>

# The type of the Network. This can be a combination of the following. 
# PackerFiles::Core::Network::IPV4   => Specifies a IPV4   network.
# PackerFiles::Core::Network::IPV6   => Specifies a IPV6   network.
# PackerFiles::Core::Network::STATIC => Specifies a Static network.
<% if @obj.nil? || @obj.type.nil? -%>
#net.type = PackerFiles::Core::Network::IPV4
<% else -%>
<% value = '' -%>
<% if (@obj.type & PackerFiles::Core::Network::IPV4) > 0 -%>
   <% value += 'PackerFiles::Core::Network::IPV4' -%>
<% elsif (@obj.type & PackerFiles::Core::Network::IPV6) > 0 -%>
   <% value += 'PackerFiles::Core::Network::IPV6' -%>
<% end  -%>
<% if (@obj.type & PackerFiles::Core::Network::STATIC) > 0 -%>
   <% value += ' | PackerFiles::Core::Network::STATIC' -%>
<% end  -%>
net.type = <%= value %>
<% end  -%>

# Static IP address for the interface. Useful only of you set the type as Static.
<% if @obj.nil? || @obj.ip.nil? -%>
#net.ip = '10.10.10.10'
<% else -%>
net.ip = '<%= @obj.ip -%>'
<% end  -%>

# Static network mask for the interface. Useful only of you set the type as Static.
<% if @obj.nil? || @obj.mask.nil? -%>
#net.mask = '255.0.0.0'
<% else -%>
net.mask = '<%= @obj.mask -%>'
<% end  -%>

# Static Gateway address for the interface. Useful only of you set the type as Static.
<% if @obj.nil? || @obj.gateway.nil? -%>
#net.gateway = '10.10.10.11'
<% else -%>
net.gateway = '<%= @obj.gateway -%>'
<% end  -%>

# Static DNS servers for the interface. Useful only of you set the type as Static.
<% if @obj.nil? || @obj.dns.nil? -%>
#net.dns = ['10.10.10.10', '20.10.10.10']
<% else -%>
net.dns  = <%= @obj.dns.to_s %>
<% end  -%>

<% if @obj.nil? -%> end <% else -%> end <% end -%>