Sha256: f387f8866fc26568ad4aabafdfc27dfd6abf74f70efbf25f28775865f5a26ab7

Contents?: true

Size: 1.19 KB

Versions: 30

Compression:

Stored size: 1.19 KB

Contents

class TestLab
  class Network

    module Status

      # Network status
      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
        }
      end

      def ip
        TestLab::Utility.ip(self.address)
      end

      def cidr
        TestLab::Utility.cidr(self.address)
      end

      # Returns the network mask
      def netmask
        TestLab::Utility.netmask(self.address)
      end

      # Returns the network address
      def network
        TestLab::Utility.network(self.address)
      end

      # Returns the broadcast address
      def broadcast
        TestLab::Utility.broadcast(self.address)
      end

      # Network Bridge State
      def state
        output = self.node.ssh.exec(%(sudo ifconfig #{self.bridge} | grep 'MTU'), :silence => true, :ignore_exit_status => true).output.strip
        if ((output =~ /UP/) && (output =~ /RUNNING/))
          :running
        else
          :stopped
        end
      end

    end

  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
testlab-0.6.5 lib/testlab/network/status.rb
testlab-0.6.4 lib/testlab/network/status.rb
testlab-0.6.3 lib/testlab/network/status.rb
testlab-0.6.2 lib/testlab/network/status.rb
testlab-0.6.1 lib/testlab/network/status.rb
testlab-0.6.0 lib/testlab/network/status.rb
testlab-0.5.4 lib/testlab/network/status.rb
testlab-0.5.3 lib/testlab/network/status.rb
testlab-0.5.2 lib/testlab/network/status.rb
testlab-0.5.1 lib/testlab/network/status.rb
testlab-0.5.0 lib/testlab/network/status.rb
testlab-0.4.16 lib/testlab/network/status.rb
testlab-0.4.15 lib/testlab/network/status.rb
testlab-0.4.14 lib/testlab/network/status.rb
testlab-0.4.13 lib/testlab/network/status.rb
testlab-0.4.12 lib/testlab/network/status.rb
testlab-0.4.11 lib/testlab/network/status.rb
testlab-0.4.10 lib/testlab/network/status.rb
testlab-0.4.9 lib/testlab/network/status.rb
testlab-0.4.8 lib/testlab/network/status.rb