Sha256: 7a6962d8966c6bcb89ed163d73d33fbedea23cae3018f9d63213782e88a6388f

Contents?: true

Size: 935 Bytes

Versions: 35

Compression:

Stored size: 935 Bytes

Contents

class Specinfra::Command::Linux::Base::Interface < Specinfra::Command::Base::Interface
  class << self
    def check_exists(name)
      "ip link show #{name}"
    end

    def get_speed_of(name)
      "cat /sys/class/net/#{name}/speed"
    end

    def check_has_ipv4_address(interface, ip_address)
      ip_address = ip_address.dup
      if ip_address =~ /\/\d+$/
        ip_address << " "
      else
        ip_address << "/"
      end
      ip_address.gsub!(".", "\\.")
      "ip -4 addr show #{interface} | grep 'inet #{ip_address}'"
    end

    def check_has_ipv6_address(interface, ip_address)
      ip_address = ip_address.dup
      if ip_address =~ /\/\d+$/
        ip_address << " "
      else
        ip_address << "/"
      end
      ip_address.downcase!
      "ip -6 addr show #{interface} | grep 'inet6 #{ip_address}'"
    end

    def get_link_state(name)
      "cat /sys/class/net/#{name}/operstate"
    end
  end
end

Version data entries

35 entries across 35 versions & 3 rubygems

Version Path
specinfra-rb19-2.44.7 lib/specinfra/command/linux/base/interface.rb
specinfra-cisco-2.41.0 lib/specinfra/command/linux/base/interface.rb
specinfra-2.47.1 lib/specinfra/command/linux/base/interface.rb
specinfra-2.47.0 lib/specinfra/command/linux/base/interface.rb
specinfra-2.46.0 lib/specinfra/command/linux/base/interface.rb
specinfra-2.45.0 lib/specinfra/command/linux/base/interface.rb
specinfra-2.44.8 lib/specinfra/command/linux/base/interface.rb
specinfra-2.44.7 lib/specinfra/command/linux/base/interface.rb
specinfra-2.44.6 lib/specinfra/command/linux/base/interface.rb
specinfra-2.44.5 lib/specinfra/command/linux/base/interface.rb
specinfra-2.44.4 lib/specinfra/command/linux/base/interface.rb
specinfra-2.44.3 lib/specinfra/command/linux/base/interface.rb
specinfra-2.44.2 lib/specinfra/command/linux/base/interface.rb
specinfra-2.44.1 lib/specinfra/command/linux/base/interface.rb
specinfra-2.44.0 lib/specinfra/command/linux/base/interface.rb
specinfra-2.43.11 lib/specinfra/command/linux/base/interface.rb
specinfra-cisco-2.40.2 lib/specinfra/command/linux/base/interface.rb
specinfra-2.43.10 lib/specinfra/command/linux/base/interface.rb
specinfra-2.43.9 lib/specinfra/command/linux/base/interface.rb
specinfra-2.43.8 lib/specinfra/command/linux/base/interface.rb