require 'puppetx/l23_network_scheme'

Puppet::Parser::Functions::newfunction(:get_physdev_mtu, :type => :rvalue, :arity => 1, :doc => <<-EOS
    Returns MTU of a physical interface, including cases where it's a bond
    EOS
  ) do |argv|
  physdev = argv[0]

  cfg = L23network::Scheme.get_config(lookupvar('l3_fqdn_hostname'))
  transformations = cfg[:transformations]
  interfaces = cfg[:interfaces]

  transformations.each do |transform|
    if (transform[:action] == 'add-bond') && (transform[:name] == physdev)
      mtu = transform[:mtu]
      return mtu if mtu
    end
  end

  if interfaces[physdev.to_sym]
    mtu = interfaces[physdev.to_sym][:mtu]
    return mtu if mtu
  end
end
require 'puppetx/l23_network_scheme'

Puppet::Parser::Functions::newfunction(:get_physdev_mtu, :type => :rvalue, :arity => 1, :doc => <<-EOS
    Returns MTU of a physical interface, including cases where it's a bond
    EOS
  ) do |argv|
  physdev = argv[0]

  cfg = L23network::Scheme.get_config(lookupvar('l3_fqdn_hostname'))
  transformations = cfg[:transformations]
  interfaces = cfg[:interfaces]

  transformations.each do |transform|
    if transform[:name] == physdev
      mtu = transform[:mtu]
      return mtu if mtu
    end
  end

  if interfaces[physdev.to_sym]
    mtu = interfaces[physdev.to_sym][:mtu]
    return mtu if mtu
  end
end
Fix function that get mtu for vhost0
Fix function that get mtu for vhost0

On dpdk computes function get_physdev_mtu dont get right mtu
because we override action for bond0 to noop.

[DE271493]

Change-Id: I12d317df777cf503408aa28152634206d11c1e5a
