
Constants
VN_METHODS | = | { :info => "vn.info", :allocate => "vn.allocate", :publish => "vn.publish", :delete => "vn.delete" } |
Constants and Class Methods |
Public class methods
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)
# 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
Class constructor
# File OpenNebula/VirtualNetwork.rb, line 33 33: def initialize(xml, client) 34: super(xml,client) 35: 36: @client = client 37: end
Public instance methods
Allocates a new VirtualNetwork in OpenNebula
description A string containing the template of the VirtualNetwork.
# File OpenNebula/VirtualNetwork.rb, line 51 51: def allocate(description) 52: super(VN_METHODS[:allocate],description) 53: end
Deletes the VirtualNetwork
# File OpenNebula/VirtualNetwork.rb, line 66 66: def delete() 67: super(VN_METHODS[:delete]) 68: end
Retrieves the information of the given VirtualNetwork.
# File OpenNebula/VirtualNetwork.rb, line 44 44: def info() 45: super(VN_METHODS[:info], 'VNET') 46: end
Publishes the VirtualNetwork, to be used by other users
# File OpenNebula/VirtualNetwork.rb, line 56 56: def publish 57: set_publish(true) 58: end
Unplubishes the VirtualNetwork
# File OpenNebula/VirtualNetwork.rb, line 61 61: def unpublish 62: set_publish(false) 63: end