Method: Puppet::Provider::Comware::Interface#netdev_res_exists?

Defined in:
lib/puppet/provider/comware/comware_interface.rb

#netdev_res_exists?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/puppet/provider/comware/comware_interface.rb', line 23

def netdev_res_exists?

  return false unless (ifd = init_resource)

  @ndev_res[:description] = ifd.xpath('Description').text.chomp
  @ndev_res[:admin] = ((admin_status = ifd.xpath('AdminStatus').text.to_i) == 1) ? :up : :down
  @ndev_res[:mtu] = (mtu = ifd.xpath('ConfigMTU')[0]).nil? ? 1500 : mtu.text.to_i

  @ndev_res[:duplex] = case duplex_options = ifd.xpath('ConfigDuplex').text.chomp.to_i
                         when 1 then
                           :full
                         when 2 then
                           :half
                         when 3 then
                           :auto
                       end

  if speed = ifd.xpath('ConfigSpeed')[0]
    @ndev_res[:speed] = speed_from_comware(speed.text.to_i)
  else
    @ndev_res[:speed] = :auto
  end

  @ndev_res[:portlayer] = portlayer_from_comware((portLayer = ifd.xpath('PortLayer').text.to_i))

  @ndev_res[:linktype] = linktype_from_comware((linkType = ifd.xpath('LinkType').text.to_i))
  return true
end