Package org.opennebula.client.vnet
Class VirtualNetwork
java.lang.Object
org.opennebula.client.PoolElement
org.opennebula.client.vnet.VirtualNetwork
This class represents an OpenNebula virtual network.
It also offers static XML-RPC call wrappers.
-
Field Summary
Fields inherited from class org.opennebula.client.PoolElement
client, id, xml, xpath
-
Constructor Summary
ConstructorsModifierConstructorDescriptionVirtualNetwork
(int id, Client client) Creates a new virtual network representation.protected
VirtualNetwork
(Node xmlElement, Client client) -
Method Summary
Modifier and TypeMethodDescriptionAdds an Address Range to the VirtualNetworkstatic OneResponse
Adds an Address Range to the VirtualNetworkstatic OneResponse
Allocates a new virtual network in OpenNebula.static OneResponse
Allocates a new virtual network in OpenNebula.chgrp
(int gid) Changes the groupchmod
(int octet) Changes the permissionschmod
(int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a) Changes the VirtualNetwork permissionsChanges the permissionsstatic OneResponse
Changes the permissionsstatic OneResponse
chmod
(Client client, int id, int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a) Changes the VirtualNetwork permissionsstatic OneResponse
Changes the permissionschown
(int uid) Changes the ownerchown
(int uid, int gid) Changes the owner/groupstatic OneResponse
Changes the owner/groupdelete()
Deletes the network from OpenNebula.static OneResponse
Deletes a network from OpenNebula.free
(int arId) Removes an Address Range from the VirtualNetworkstatic OneResponse
Removes an Address Range from the VirtualNetworkHolds a VirtualNetwork lease, marking it as usedHolds a VirtualNetwork lease, marking it as usedstatic OneResponse
Holds a VirtualNetwork lease, marking it as usedinfo()
Loads the xml representation of the virtual network.static OneResponse
Retrieves the information of the given virtual networkstatic OneResponse
Retrieves the information of the given Virtual Network.lock
(int level) Lock this virtual networkstatic OneResponse
lock this virtual networkpublish()
Publishes the virtual network.publish
(boolean publish) Publishes or unpublishes the virtual network.static OneResponse
Publishes or unpublishes a virtual network.recover
(int operation) Recovers a stuck Virtual Network.static OneResponse
Recovers a stuck Virtual Network.Releases a VirtualNetwork lease on holdReleases a VirtualNetwork lease on holdstatic OneResponse
Releases a VirtualNetwork lease on holdRenames this VirtualNetworkstatic OneResponse
Renames this VirtualNetworkReserve a set of addresses from this virtual networkstatic OneResponse
Reserve a set of addresses from this virtual networkrmAr
(int arId) Removes an Address Range from the VirtualNetworkstatic OneResponse
Removes an Address Range from the VirtualNetworkReturns the short string state of the Virtual Network.Returns the state of the Virtual Network.unlock()
Unlock this virtual networkstatic OneResponse
Unlock this virtual networkUnpublishes the virtual network.Replaces the VirtualNetwork template contents.Replaces the VirtualNetwork template contents.static OneResponse
Replaces the VirtualNetwork template contents.Upates an Address Range from the VirtualNetworkstatic OneResponse
Upates an Address Range from the VirtualNetwork
-
Constructor Details
-
VirtualNetwork
Creates a new virtual network representation.- Parameters:
id
- The virtual network id (nid) .client
- XML-RPC Client.
-
VirtualNetwork
- See Also:
-
-
Method Details
-
allocate
Allocates a new virtual network in OpenNebula.- Parameters:
client
- XML-RPC Client.description
- A string containing the template of the virtual network.clusterId
- The cluster ID. If it is -1, this virtual network won't be added to any cluster.- Returns:
- If successful the message contains the associated id generated for this virtual network.
-
allocate
Allocates a new virtual network in OpenNebula.- Parameters:
client
- XML-RPC Client.description
- A string containing the template of the virtual network.- Returns:
- If successful the message contains the associated id generated for this virtual network.
-
info
Retrieves the information of the given virtual network- Parameters:
client
- XML-RPC Client.id
- the virtual network id (nid) for the network to retrieve the information from.- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
info
Retrieves the information of the given Virtual Network.- Parameters:
client
- XML-RPC Client.id
- The Virtual Network id for the Virtual Network to retrieve the information fromdecrypt
- If true decrypt sensitive attributes- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
delete
Deletes a network from OpenNebula.- Parameters:
client
- XML-RPC Client.id
- The virtual network id (nid) of the target network.- Returns:
- A encapsulated response.
-
publish
Publishes or unpublishes a virtual network.- Parameters:
client
- XML-RPC Client.id
- The virtual network id (nid) of the target network.publish
- True for publishing, false for unpublishing.- Returns:
- If successful the message contains the image id.
-
addAr
Adds an Address Range to the VirtualNetwork- Parameters:
client
- XML-RPC Client.id
- The virtual network id (nid) of the target network.template
- AR to add, example: AR = [ TYPE = IP4, IP = 192.168.0.5, SIZE = 10 ]- Returns:
- A encapsulated response.
-
rmAr
Removes an Address Range from the VirtualNetwork- Parameters:
client
- XML-RPC Client.id
- The virtual network id (nid) of the target network.arId
- Id of the Address Range to remove- Returns:
- A encapsulated response.
-
updateAr
Upates an Address Range from the VirtualNetwork- Parameters:
client
- XML-RPC Client.id
- The virtual network id (nid) of the target network.template
- AR to update, example: AR = [ AR_ID = 3, TYPE = IP4, IP = 192.168.0.5, SIZE = 10 ]- Returns:
- A encapsulated response.
-
hold
Holds a VirtualNetwork lease, marking it as used- Parameters:
client
- XML-RPC Client.id
- The virtual network id (nid) of the target network.template
- Address to hold, examples:LEASES = [ IP = 192.168.0.5 ] LEASES = [ MAC = 02:00:0a:00:00:96 ] LEASES = [ IP = 192.168.0.5, AR_ID = 3 ]
- Returns:
- A encapsulated response.
-
release
Releases a VirtualNetwork lease on hold- Parameters:
client
- XML-RPC Client.id
- The virtual network id (nid) of the target network.template
- Address to release, examples:LEASES = [ IP = 192.168.0.5 ] LEASES = [ MAC = 02:00:0a:00:00:96 ] LEASES = [ IP = 192.168.0.5, AR_ID = 3 ]
- Returns:
- A encapsulated response.
-
chown
Changes the owner/group- Parameters:
client
- XML-RPC Client.id
- The virtual network id (nid) of the target network.uid
- The new owner user ID. Set it to -1 to leave the current one.gid
- The new group ID. Set it to -1 to leave the current one.- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public static OneResponse chmod(Client client, int id, int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a) Changes the VirtualNetwork permissions- Parameters:
client
- XML-RPC Client.id
- The virtual network id (nid) of the target network.owner_u
- 1 to allow, 0 deny, -1 do not changeowner_m
- 1 to allow, 0 deny, -1 do not changeowner_a
- 1 to allow, 0 deny, -1 do not changegroup_u
- 1 to allow, 0 deny, -1 do not changegroup_m
- 1 to allow, 0 deny, -1 do not changegroup_a
- 1 to allow, 0 deny, -1 do not changeother_u
- 1 to allow, 0 deny, -1 do not changeother_m
- 1 to allow, 0 deny, -1 do not changeother_a
- 1 to allow, 0 deny, -1 do not change- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
client
- XML-RPC Client.id
- The id of the target object.octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
client
- XML-RPC Client.id
- The id of the target object.octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
update
Replaces the VirtualNetwork template contents.- Parameters:
client
- XML-RPC Client.id
- The vnet id of the target vnet we want to modify.new_template
- New template contents.append
- True to append new attributes instead of replace the whole template- Returns:
- If successful the message contains the vnet id.
-
rename
Renames this VirtualNetwork- Parameters:
client
- XML-RPC Client.id
- The VirtualNetwork id of the target VirtualNetwork.name
- New name for the VirtualNetwork.- Returns:
- If an error occurs the error message contains the reason.
-
reserve
Reserve a set of addresses from this virtual network- Parameters:
client
- XML-RPC Client.id
- The virtual network id (nid) of the target network.template
- of the reservation. Examples:SIZE = 10 SIZE = 10 AR_ID = 3 NAME = "new_network" SIZE = 10 IP = 192.168.10.50 NETWORK_ID = 9
- Returns:
- A encapsulated response.
-
free
Removes an Address Range from the VirtualNetwork- Parameters:
client
- XML-RPC Client.id
- The virtual network id (nid) of the target network.arId
- Id of the Address Range to remove- Returns:
- A encapsulated response.
-
lock
lock this virtual network- Parameters:
client
- XML-RPC Client.id
- The virtual network id (nid)level
- Lock level.- Returns:
- If an error occurs the error message contains the reason.
-
unlock
Unlock this virtual network- Parameters:
client
- XML-RPC Client.id
- The virtual network id (nid)- Returns:
- If an error occurs the error message contains the reason.
-
recover
Recovers a stuck Virtual Network.- Parameters:
client
- XML-RPC Client.id
- The Virtual Network ID of the target instance.operation
- to recover the VM: (0) failure, (1) success, (2) delete, (3) retry- Returns:
- If an error occurs the error message contains the reason.
-
info
Loads the xml representation of the virtual network. The info is also stored internally.- See Also:
-
delete
Deletes the network from OpenNebula.- Returns:
- A encapsulated response.
-
publish
Publishes or unpublishes the virtual network.- Parameters:
publish
- True for publishing, false for unpublishing.- Returns:
- If successful the message contains the image id.
-
publish
Publishes the virtual network.- Returns:
- If successful the message contains the image id.
-
unpublish
Unpublishes the virtual network.- Returns:
- If successful the message contains the image id.
-
addAr
Adds an Address Range to the VirtualNetwork- Parameters:
template
- AR to add, example:AR = [ TYPE = IP4, IP = 192.168.0.5, SIZE = 10 ]
- Returns:
- A encapsulated response.
-
rmAr
Removes an Address Range from the VirtualNetwork- Parameters:
arId
- Id of the Address Range to remove- Returns:
- A encapsulated response.
-
updateAr
Upates an Address Range from the VirtualNetwork- Parameters:
template
- AR to update, example:AR = [ AR_ID = 3, TYPE = IP4, IP = 192.168.0.5, SIZE = 10 ]
- Returns:
- A encapsulated response.
-
hold
Holds a VirtualNetwork lease, marking it as used- Parameters:
ip
- IP or MAC to hold, e.g. "192.168.0.5", "02:00:0a:00:00:96"- Returns:
- A encapsulated response.
-
hold
Holds a VirtualNetwork lease, marking it as used- Parameters:
ip
- IP or MAC to hold, e.g. "192.168.0.5", "02:00:0a:00:00:96"arId
- Id of the Address Range to hold the lease from- Returns:
- A encapsulated response.
-
release
Releases a VirtualNetwork lease on hold- Parameters:
ip
- IP or MAC to hold, e.g. "192.168.0.5", "02:00:0a:00:00:96"- Returns:
- A encapsulated response.
-
release
Releases a VirtualNetwork lease on hold- Parameters:
ip
- IP or MAC to hold, e.g. "192.168.0.5", "02:00:0a:00:00:96"arId
- Id of the Address Range to release the lease from- Returns:
- A encapsulated response.
-
chown
Changes the owner/group- Parameters:
uid
- The new owner user ID. Set it to -1 to leave the current one.gid
- The new group ID. Set it to -1 to leave the current one.- Returns:
- If an error occurs the error message contains the reason.
-
chown
Changes the owner- Parameters:
uid
- The new owner user ID.- Returns:
- If an error occurs the error message contains the reason.
-
chgrp
Changes the group- Parameters:
gid
- The new group ID.- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public OneResponse chmod(int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a) Changes the VirtualNetwork permissions- Parameters:
owner_u
- 1 to allow, 0 deny, -1 do not changeowner_m
- 1 to allow, 0 deny, -1 do not changeowner_a
- 1 to allow, 0 deny, -1 do not changegroup_u
- 1 to allow, 0 deny, -1 do not changegroup_m
- 1 to allow, 0 deny, -1 do not changegroup_a
- 1 to allow, 0 deny, -1 do not changeother_u
- 1 to allow, 0 deny, -1 do not changeother_m
- 1 to allow, 0 deny, -1 do not changeother_a
- 1 to allow, 0 deny, -1 do not change- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
update
Replaces the VirtualNetwork template contents.- Parameters:
new_template
- New template contents.- Returns:
- If successful the message contains the vnet id.
-
update
Replaces the VirtualNetwork template contents.- Parameters:
new_template
- New template contents.append
- True to append new attributes instead of replace the whole template- Returns:
- If successful the message contains the vnet id.
-
rename
Renames this VirtualNetwork- Parameters:
name
- New name for the VirtualNetwork.- Returns:
- If an error occurs the error message contains the reason.
-
reserve
Reserve a set of addresses from this virtual network- Parameters:
template
- of the reservation. Examples:SIZE = 10 SIZE = 10 AR_ID = 3 NAME = "new_network" SIZE = 10 IP = 192.168.10.50 NETWORK_ID = 9
- Returns:
- A encapsulated response.
-
free
Removes an Address Range from the VirtualNetwork- Parameters:
arId
- Id of the Address Range to remove- Returns:
- A encapsulated response.
-
lock
Lock this virtual network- Parameters:
level
- Lock level.- Returns:
- If an error occurs the error message contains the reason.
-
unlock
Unlock this virtual network- Returns:
- If an error occurs the error message contains the reason.
-
recover
Recovers a stuck Virtual Network.- Parameters:
operation
- to recover the VM: (0) failure, (1) success, (2) delete, (3) retry- Returns:
- If an error occurs the error message contains the reason.
-
stateString
Returns the state of the Virtual Network.
The methodinfo()
must be called before.- Returns:
- The state of the Virtual Network.
-
shortStateStr
Returns the short string state of the Virtual Network.
The methodinfo()
must be called before.- Returns:
- The short string state of the Virtual Network.
-