module TestLab::Network::Status
Public Instance Methods
broadcast()
click to toggle source
Returns the broadcast address
# File lib/testlab/network/status.rb, line 60 def broadcast TestLab::Utility.broadcast(self.address) end
cidr()
click to toggle source
Network
CIDR
Returns the CIDR of the network bridge.
@return [Integer] The network bridge CIDR address.
# File lib/testlab/network/status.rb, line 45 def cidr TestLab::Utility.cidr(self.address) end
def_tag()
click to toggle source
Debian Network
'interfaces' Start Definition Tag
# File lib/testlab/network/status.rb, line 22 def def_tag "#TESTLAB-DEF-#{self.bridge.to_s.upcase}" end
end_tag()
click to toggle source
Debian Network
'interfaces' End Definition Tag
# File lib/testlab/network/status.rb, line 27 def end_tag "#TESTLAB-END-#{self.bridge.to_s.upcase}" end
ip()
click to toggle source
Network
IP
Returns the IP of the network bridge.
@return [String] The network bridge IP address.
# File lib/testlab/network/status.rb, line 36 def ip TestLab::Utility.ip(self.address) end
netmask()
click to toggle source
Returns the network mask
# File lib/testlab/network/status.rb, line 50 def netmask TestLab::Utility.netmask(self.address) end
network()
click to toggle source
Returns the network address
# File lib/testlab/network/status.rb, line 55 def network TestLab::Utility.network(self.address) end
state()
click to toggle source
Network
Bridge State
# File lib/testlab/network/status.rb, line 65 def state if self.node.dead? :unknown else exit_code = self.node.exec(%(sudo brctl show #{self.bridge} 2>&1 | grep -i 'No such device'), :ignore_exit_status => true).exit_code if (exit_code == 0) :not_created else output = self.node.exec(%(sudo ifconfig #{self.bridge} 2>&1 | grep 'MTU'), :ignore_exit_status => true).output if ((output =~ /UP/) || (output =~ /RUNNING/)) :running else :stopped end end end end
status()
click to toggle source
Network
status
# File lib/testlab/network/status.rb, line 7 def status interface = "#{bridge}:#{self.address}" { :id => self.id, :node_id => self.node.id, :state => self.state, :interface => interface, :broadcast => self.broadcast, :network => self.network, :netmask => self.netmask, :provisioners => self.provisioners.map(&:to_s).collect{ |p| p.split('::').last }.join(','), } end