Sha256: c7ec9433cad3bae6ad2c1a23891a7c769d501d30a0dfc08b8ced13ea8dce7ee0
Contents?: true
Size: 1008 Bytes
Versions: 11
Compression:
Stored size: 1008 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 get_mtu_of(name) "cat /sys/class/net/#{name}/mtu" 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
11 entries across 11 versions & 1 rubygems