Sha256: 149ecfe07d336240b5cecdad0d6efa0054bf42831793620488ef490b35bfd550

Contents?: true

Size: 894 Bytes

Versions: 16

Compression:

Stored size: 894 Bytes

Contents

require 'mkit/status'
require 'mkit/utils'
require 'mkit/exceptions'
require 'mkit/app/helpers/interface_helper'

module MKIt
  class Interface
    def self.ip
      main_pool = Pool.find_by_name(MKIt::Utils.me)
      main_pool.ip
    end

    def self.up
      main_pool = Pool.find_by_name(MKIt::Utils.me)
      interface_name = "#{main_pool.name}0"
      interface_type = "tap"
      ip = main_pool.ip
      mask = main_pool.netmask
      MKIt::InterfaceHelper.create(name: interface_name, ctype: interface_type)
      MKIt::InterfaceHelper.up(name: interface_name, ip: ip, mask: mask)
    end

    def self.down
      main_pool = Pool.find_by_name(MKIt::Utils.me)
      interface_name = "#{main_pool.name}0"
      interface_type = "tap"
      MKIt::InterfaceHelper.down(name: interface_name)
      MKIt::InterfaceHelper.remove(name: interface_name, ctype: interface_type)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mkit-0.9.0 lib/mkit/mkit_interface.rb
mkit-0.8.0 lib/mkit/mkit_interface.rb
mkit-0.7.2 lib/mkit/mkit_interface.rb
mkit-0.7.1 lib/mkit/mkit_interface.rb
mkit-0.7.0 lib/mkit/mkit_interface.rb
mkit-0.6.3 lib/mkit/mkit_interface.rb
mkit-0.6.2 lib/mkit/mkit_interface.rb
mkit-0.6.1 lib/mkit/mkit_interface.rb
mkit-0.6.0 lib/mkit/mkit_interface.rb
mkit-0.5.0 lib/mkit/mkit_interface.rb
mkit-0.4.3 lib/mkit/mkit_interface.rb
mkit-0.4.2 lib/mkit/mkit_interface.rb
mkit-0.4.1 lib/mkit/mkit_interface.rb
mkit-0.4.0 lib/mkit/mkit_interface.rb
mkit-0.3.0 lib/mkit/mkit_interface.rb
mkit-0.2.0 lib/mkit/mkit_interface.rb