Sha256: 1d8f702ab33e4a49d4fa8644941823947bf932f234685a0550a2bc2e27604423

Contents?: true

Size: 886 Bytes

Versions: 18

Compression:

Stored size: 886 Bytes

Contents

class TestLab

  # Interface Error Class
  class InterfaceError < TestLabError; end

  # Interface Class
  #
  # @author Zachary Patten <zachary AT jovelabs DOT com>
  class Interface < ZTK::DSL::Base

    # Associations and Attributes
    belongs_to  :container,  :class_name => 'TestLab::Container'
    belongs_to  :network,    :class_name => 'TestLab::Network'

    attribute   :address
    attribute   :mac
    attribute   :name

    attribute   :primary,    :default => false

    def initialize(*args)
      @ui = TestLab.ui

      super(*args)

      @ui.logger.info { "Interface '#{self.id}' Loaded" }
    end

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

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

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

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

  end

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
testlab-1.3.1 lib/testlab/interface.rb
testlab-1.3.0 lib/testlab/interface.rb
testlab-1.2.3 lib/testlab/interface.rb
testlab-1.2.2 lib/testlab/interface.rb
testlab-1.2.1 lib/testlab/interface.rb
testlab-1.2.0 lib/testlab/interface.rb
testlab-1.1.0 lib/testlab/interface.rb
testlab-1.0.1 lib/testlab/interface.rb
testlab-1.0.0 lib/testlab/interface.rb
testlab-0.9.1 lib/testlab/interface.rb
testlab-0.9.0 lib/testlab/interface.rb
testlab-0.8.6 lib/testlab/interface.rb
testlab-0.8.5 lib/testlab/interface.rb
testlab-0.8.4 lib/testlab/interface.rb
testlab-0.8.3 lib/testlab/interface.rb
testlab-0.8.2 lib/testlab/interface.rb
testlab-0.8.1 lib/testlab/interface.rb
testlab-0.8.0 lib/testlab/interface.rb