Class: Specinfra::Command::Linux::Base::Interface
- Inherits:
-
Base::Interface
- Object
- Base
- Base::Interface
- Specinfra::Command::Linux::Base::Interface
- Defined in:
- lib/specinfra/command/linux/base/interface.rb
Class Method Summary collapse
- .check_has_ipv4_address(interface, ip_address) ⇒ Object
- .check_has_ipv6_address(interface, ip_address) ⇒ Object
- .get_speed_of(name) ⇒ Object
Methods inherited from Base
Class Method Details
.check_has_ipv4_address(interface, ip_address) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/specinfra/command/linux/base/interface.rb', line 7 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 addr show #{interface} | grep 'inet #{ip_address}'" end |
.check_has_ipv6_address(interface, ip_address) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/specinfra/command/linux/base/interface.rb', line 18 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 addr show #{interface} | grep 'inet6 #{ip_address}'" end |
.get_speed_of(name) ⇒ Object
3 4 5 |
# File 'lib/specinfra/command/linux/base/interface.rb', line 3 def get_speed_of(name) "ethtool #{name} | grep Speed | gawk '{print gensub(/Speed: ([0-9]+)Mb\\\/s/,\"\\\\1\",\"\")}'" end |