Class: Dcmgr::Models::MacLease

Inherits:
BaseNew
  • Object
show all
Defined in:
lib/dcmgr/models/mac_lease.rb

Overview

MAC address lease information

Constant Summary

Constants inherited from BaseNew

BaseNew::LOCK_TABLES_KEY

Class Method Summary collapse

Methods inherited from BaseNew

Proxy, dataset, install_data, install_data_hooks, lock!, unlock!

Class Method Details

.lease(vendor_id = '00ff01') ⇒ Object

dynamically assign new MAC address.



15
16
17
18
19
20
# File 'lib/dcmgr/models/mac_lease.rb', line 15

def self.lease(vendor_id='00ff01')
  begin
    m = vendor_id + ("%02x%02x%02x" % [rand(0xff),rand(0xff),rand(0xff)])
  end while self.find(:mac_addr=> m)
  create(:mac_addr=>m)
end