Class: OpenNebula::VirtualNetwork
- Inherits:
-
Object
- Object
- OpenNebula::VirtualNetwork
- Defined in:
- service/objects/vn.rb
Overview
Extensions for OpenNebula::VirtualNetwork
Instance Method Summary collapse
-
#ar_pool ⇒ Array<Hash>
Returns Address Range pool.
-
#ar_record(ar_id, per) ⇒ String|Symbol, Float
Calculate amount of Public Addresses and bill them with `PUBLIC_IP_COST`.
-
#type ⇒ String
Returns Network Type: Private or Public.
Instance Method Details
#ar_pool ⇒ Array<Hash>
Returns Address Range pool
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'service/objects/vn.rb', line 39 def ar_pool info! pool = to_hash['VNET']['AR_POOL']['AR'] if pool.class == Hash then return [pool] elsif pool.nil? then return [] else return pool end rescue return [] end |
#ar_record(ar_id, per) ⇒ String|Symbol, Float
Calculate amount of Public Addresses and bill them with `PUBLIC_IP_COST`
57 58 59 60 61 62 63 64 65 66 67 |
# File 'service/objects/vn.rb', line 57 def ar_record(ar_id, per) info! ar = ar_pool.select { |o| o['AR_ID'].to_i == ar_id.to_i }.first if ar.nil? && per > 0 then return :deleted_ip, per * IONe::Settings['PUBLIC_IP_COST'] elsif ar.nil? then return :trash, 0 else return ar['IP'], per * IONe::Settings['PUBLIC_IP_COST'] end end |
#type ⇒ String
Returns Network Type: Private or Public
30 31 32 |
# File 'service/objects/vn.rb', line 30 def type info! || self['TEMPLATE/TYPE'] end |