Class: Dcmgr::Models::MacLease
- Defined in:
- lib/dcmgr/models/mac_lease.rb
Overview
MAC address lease information
Constant Summary
Constants inherited from BaseNew
Class Method Summary collapse
-
.lease(vendor_id = '00ff01') ⇒ Object
dynamically assign new MAC address.
Methods inherited from BaseNew
Proxy, dataset, default_row_lock_mode=, install_data, install_data_hooks, lock!, unlock!, #with_timestamps?
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 |