Class OpenNebula::VirtualNetwork

  1. OpenNebula/VirtualNetwork.rb
Pool VirtualNetworkPool ClusterPool ImagePool VirtualMachinePool HostPool UserPool XMLElement PoolElement XMLPool User VirtualNetwork Cluster Image VirtualMachine Host Enumerable Client ImageRepository Error OpenNebula dot/f_0.png

Methods

public class

  1. build_xml
  2. new

public instance

  1. allocate
  2. delete
  3. info
  4. publish
  5. unpublish

Constants

VN_METHODS = { :info => "vn.info", :allocate => "vn.allocate", :publish => "vn.publish", :delete => "vn.delete" }  

Constants and Class Methods


Public class methods

build_xml (pe_id=nil)

Creates a VirtualNetwork description with just its identifier this method should be used to create plain VirtualNetwork objects. id the id of the network

Example:

vnet = VirtualNetwork.new(VirtualNetwork.build_xml(3),rpc_client)
[show source]
    # File OpenNebula/VirtualNetwork.rb, line 22
22:         def VirtualNetwork.build_xml(pe_id=nil)
23:             if pe_id
24:                 vn_xml = "<VNET><ID>#{pe_id}</ID></VNET>"
25:             else
26:                 vn_xml = "<VNET></VNET>"
27:             end
28: 
29:             XMLElement.build_xml(vn_xml, 'VNET')
30:         end
new (xml, client)

Class constructor

[show source]
    # File OpenNebula/VirtualNetwork.rb, line 33
33:         def initialize(xml, client)
34:             super(xml,client)
35: 
36:             @client = client
37:         end

Public instance methods

allocate (description)

Allocates a new VirtualNetwork in OpenNebula

description A string containing the template of the VirtualNetwork.

[show source]
    # File OpenNebula/VirtualNetwork.rb, line 51
51:         def allocate(description)
52:             super(VN_METHODS[:allocate],description)
53:         end
delete ()

Deletes the VirtualNetwork

[show source]
    # File OpenNebula/VirtualNetwork.rb, line 66
66:         def delete()
67:             super(VN_METHODS[:delete])
68:         end
info ()

Retrieves the information of the given VirtualNetwork.

[show source]
    # File OpenNebula/VirtualNetwork.rb, line 44
44:         def info()
45:             super(VN_METHODS[:info], 'VNET')
46:         end
publish ()

Publishes the VirtualNetwork, to be used by other users

[show source]
    # File OpenNebula/VirtualNetwork.rb, line 56
56:         def publish
57:             set_publish(true)
58:         end
unpublish ()

Unplubishes the VirtualNetwork

[show source]
    # File OpenNebula/VirtualNetwork.rb, line 61
61:         def unpublish
62:             set_publish(false)
63:         end