Class: Lease

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/mkit/app/model/lease.rb

Instance Method Summary collapse

Instance Method Details

#confirmObject



11
12
13
# File 'lib/mkit/app/model/lease.rb', line 11

def confirm
  self.status = MKIt::PoolStatus::IN_USE
end

#downObject



21
22
23
24
25
# File 'lib/mkit/app/model/lease.rb', line 21

def down
  MKIt::InterfaceHelper.down(name: interface_name)
  MKIt::InterfaceHelper.remove(name: interface_name, ctype: interface_type)
  self.status = MKIt::PoolStatus::RESERVED
end

#upObject



15
16
17
18
19
# File 'lib/mkit/app/model/lease.rb', line 15

def up
  MKIt::InterfaceHelper.create(name: interface_name, ctype: interface_type)
  MKIt::InterfaceHelper.up(name: interface_name, ip: ip, mask: pool.netmask)
  self.status = MKIt::PoolStatus::IN_USE
end