Package org.opennebula.client.vrouter
Class VirtualRouter
- java.lang.Object
-
- org.opennebula.client.PoolElement
-
- org.opennebula.client.vrouter.VirtualRouter
-
public class VirtualRouter extends PoolElement
This class represents an OpenNebula Virtual Router It also offers static XML-RPC call wrappers.
-
-
Field Summary
-
Fields inherited from class org.opennebula.client.PoolElement
client, id, xml, xpath
-
-
Constructor Summary
Constructors Modifier Constructor Description VirtualRouter(int id, Client client)
Creates a new VirtualRouter representation.protected
VirtualRouter(org.w3c.dom.Node xmlElement, Client client)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OneResponse
allocate(Client client, java.lang.String description)
Allocates a new VirtualRouter in OpenNebula.OneResponse
chgrp(int gid)
Changes the groupOneResponse
chmod(int octet)
Changes the permissionsOneResponse
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 VirtualRouter permissionsOneResponse
chmod(java.lang.String octet)
Changes the permissionsstatic OneResponse
chmod(Client client, int id, int octet)
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 VirtualRouter permissionsstatic OneResponse
chmod(Client client, int id, java.lang.String octet)
Changes the permissionsOneResponse
chown(int uid)
Changes the ownerOneResponse
chown(int uid, int gid)
Changes the owner/groupstatic OneResponse
chown(Client client, int id, int uid, int gid)
Changes the owner/groupOneResponse
delete()
Deletes the VirtualRouter from OpenNebula.static OneResponse
delete(Client client, int id)
Deletes a VirtualRouter from OpenNebula.OneResponse
info()
Retrieves the information of the VirtualRouter.static OneResponse
info(Client client, int id)
Retrieves the information of the given VirtualRouter.static OneResponse
info(Client client, int id, boolean decrypt)
Retrieves the information of the given VRouter.OneResponse
instantiate(int nVMs, int templateId)
Creates VM instances from a VM Template.OneResponse
instantiate(int nVMs, int templateId, java.lang.String name, boolean onHold, java.lang.String template)
Creates VM instances from a VM Template.static OneResponse
instantiate(Client client, int id, int nVMs, int templateId, java.lang.String name, boolean onHold, java.lang.String template)
Creates VM instances from a VM Template.OneResponse
lock(int level)
Lock this virtual routerstatic OneResponse
lock(Client client, int id, int level)
lock this virtual routerOneResponse
nicAttach(java.lang.String nicTemplate)
Attaches a NIC to this VirtualRouter, and each one of its VMsstatic OneResponse
nicAttach(Client client, int id, java.lang.String nicTemplate)
Attaches a NIC to this VirtualRouter, and each one of its VMsOneResponse
nicDetach(int nicId)
Detaches a NIC from this VirtualRouter, and each one of its VMsstatic OneResponse
nicDetach(Client client, int id, int nicId)
Detaches a NIC from this VirtualRouter, and each one of its VMsOneResponse
publish()
Publishes the VirtualRouter.OneResponse
publish(boolean publish)
Publishes or unpublishes the VirtualRouter.static OneResponse
publish(Client client, int id, boolean publish)
Publishes or unpublishes a VirtualRouter.OneResponse
rename(java.lang.String name)
Renames this VirtualRouterstatic OneResponse
rename(Client client, int id, java.lang.String name)
Renames this VirtualRouterOneResponse
unlock()
Unlock this virtual routerstatic OneResponse
unlock(Client client, int id)
Unlock this virtual routerOneResponse
unpublish()
Unpublishes the VirtualRouter.OneResponse
update(java.lang.String new_template)
Replaces the VirtualRouter contents.OneResponse
update(java.lang.String new_template, boolean append)
Replaces the template contents.static OneResponse
update(Client client, int id, java.lang.String new_template, boolean append)
Replaces the template contents.
-
-
-
Constructor Detail
-
VirtualRouter
public VirtualRouter(int id, Client client)
Creates a new VirtualRouter representation.- Parameters:
id
- The VirtualRouter id.client
- XML-RPC Client.
-
VirtualRouter
protected VirtualRouter(org.w3c.dom.Node xmlElement, Client client)
- See Also:
PoolElement
-
-
Method Detail
-
allocate
public static OneResponse allocate(Client client, java.lang.String description)
Allocates a new VirtualRouter in OpenNebula.- Parameters:
client
- XML-RPC Client.description
- A string containing the template of the VirtualRouter.- Returns:
- If successful the message contains the associated id generated for this VirtualRouter.
-
info
public static OneResponse info(Client client, int id)
Retrieves the information of the given VirtualRouter.- Parameters:
client
- XML-RPC Client.id
- The VirtualRouter id for the VirtualRouter to retrieve the information from- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
info
public static OneResponse info(Client client, int id, boolean decrypt)
Retrieves the information of the given VRouter.- Parameters:
client
- XML-RPC Client.id
- The VRouter id for the VRouter to retrieve the information fromdecrypt
- If true decrypt sensitive attributes- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
instantiate
public static OneResponse instantiate(Client client, int id, int nVMs, int templateId, java.lang.String name, boolean onHold, java.lang.String template)
Creates VM instances from a VM Template. New VMs will be associated to this Virtual Router, and its Virtual Networks- Parameters:
client
- XML-RPC Client.id
- The id of the target VirtualRouter.nVMs
- Number of VMs to instantiatetemplateId
- VM Template id to instantiatename
- Name for the VM instances. If it is an empty string OpenNebula will set a default name. Wildcard %i can be used.onHold
- False to create this VM in pending state, true on holdtemplate
- User provided Template to merge with the one being instantiated- Returns:
- If an error occurs the error message contains the reason.
-
delete
public static OneResponse delete(Client client, int id)
Deletes a VirtualRouter from OpenNebula.- Parameters:
client
- XML-RPC Client.id
- The id of the target VirtualRouter we want to delete.- Returns:
- A encapsulated response.
-
update
public static OneResponse update(Client client, int id, java.lang.String new_template, boolean append)
Replaces the template contents.- Parameters:
client
- XML-RPC Client.id
- The id of the target VirtualRouter 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 VirtualRouter id.
-
publish
public static OneResponse publish(Client client, int id, boolean publish)
Publishes or unpublishes a VirtualRouter.- Parameters:
client
- XML-RPC Client.id
- The id of the target VirtualRouter we want to modify.publish
- True for publishing, false for unpublishing.- Returns:
- If successful the message contains the VirtualRouter id.
-
chown
public static OneResponse chown(Client client, int id, int uid, int gid)
Changes the owner/group- Parameters:
client
- XML-RPC Client.id
- The id of the target VirtualRouter we want to modify.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 VirtualRouter permissions- Parameters:
client
- XML-RPC Client.id
- The id of the target VirtualRouter.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
public static OneResponse chmod(Client client, int id, java.lang.String octet)
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
public static OneResponse chmod(Client client, int id, int octet)
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.
-
rename
public static OneResponse rename(Client client, int id, java.lang.String name)
Renames this VirtualRouter- Parameters:
client
- XML-RPC Client.id
- The id of the target VirtualRouter.name
- New name for the VirtualRouter.- Returns:
- If an error occurs the error message contains the reason.
-
nicAttach
public static OneResponse nicAttach(Client client, int id, java.lang.String nicTemplate)
Attaches a NIC to this VirtualRouter, and each one of its VMs- Parameters:
client
- XML-RPC Client.id
- The id of the target VirtualRouter.nicTemplate
- Template containing the new NIC definition- Returns:
- If an error occurs the error message contains the reason.
-
nicDetach
public static OneResponse nicDetach(Client client, int id, int nicId)
Detaches a NIC from this VirtualRouter, and each one of its VMs- Parameters:
client
- XML-RPC Client.id
- The id of the target VirtualRouter.nicId
- The NIC_ID of the NIC to detach- Returns:
- If an error occurs the error message contains the reason.
-
lock
public static OneResponse lock(Client client, int id, int level)
lock this virtual router- Parameters:
client
- XML-RPC Client.id
- The virtual router id.level
- Lock level.- Returns:
- If an error occurs the error message contains the reason.
-
unlock
public static OneResponse unlock(Client client, int id)
Unlock this virtual router- Parameters:
client
- XML-RPC Client.id
- The virtual router id.- Returns:
- If an error occurs the error message contains the reason.
-
info
public OneResponse info()
Retrieves the information of the VirtualRouter.- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
delete
public OneResponse delete()
Deletes the VirtualRouter from OpenNebula.- Returns:
- A encapsulated response.
-
update
public OneResponse update(java.lang.String new_template)
Replaces the VirtualRouter contents.- Parameters:
new_template
- New template contents.- Returns:
- If successful the message contains the VirtualRouter id.
-
update
public OneResponse update(java.lang.String new_template, boolean append)
Replaces the 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 VirtualRouter id.
-
publish
public OneResponse publish(boolean publish)
Publishes or unpublishes the VirtualRouter.- Parameters:
publish
- True for publishing, false for unpublishing.- Returns:
- If successful the message contains the VirtualRouter id.
-
publish
public OneResponse publish()
Publishes the VirtualRouter.- Returns:
- If successful the message contains the VirtualRouter id.
-
unpublish
public OneResponse unpublish()
Unpublishes the VirtualRouter.- Returns:
- If successful the message contains the VirtualRouter id.
-
chown
public OneResponse chown(int uid, int gid)
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
public OneResponse chown(int uid)
Changes the owner- Parameters:
uid
- The new owner user ID.- Returns:
- If an error occurs the error message contains the reason.
-
chgrp
public OneResponse chgrp(int gid)
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 VirtualRouter 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
public OneResponse chmod(java.lang.String octet)
Changes the permissions- Parameters:
octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public OneResponse chmod(int octet)
Changes the permissions- Parameters:
octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
instantiate
public OneResponse instantiate(int nVMs, int templateId, java.lang.String name, boolean onHold, java.lang.String template)
Creates VM instances from a VM Template. New VMs will be associated to this Virtual Router, and its Virtual Networks- Parameters:
nVMs
- Number of VMs to instantiatetemplateId
- VM Template id to instantiatename
- Name for the VM instances. If it is an empty string OpenNebula will set a default name. Wildcard %i can be used.onHold
- False to create this VM in pending state, true on holdtemplate
- User provided Template to merge with the one being instantiated- Returns:
- If an error occurs the error message contains the reason.
-
instantiate
public OneResponse instantiate(int nVMs, int templateId)
Creates VM instances from a VM Template. New VMs will be associated to this Virtual Router, and its Virtual Networks- Parameters:
nVMs
- Number of VMs to instantiatetemplateId
- VM Template id to instantiate- Returns:
- If an error occurs the error message contains the reason.
-
rename
public OneResponse rename(java.lang.String name)
Renames this VirtualRouter- Parameters:
name
- New name for the VirtualRouter.- Returns:
- If an error occurs the error message contains the reason.
-
nicAttach
public OneResponse nicAttach(java.lang.String nicTemplate)
Attaches a NIC to this VirtualRouter, and each one of its VMs- Parameters:
nicTemplate
- Template containing the new NIC definition- Returns:
- If an error occurs the error message contains the reason.
-
nicDetach
public OneResponse nicDetach(int nicId)
Detaches a NIC from this VirtualRouter, and each one of its VMs- Parameters:
nicId
- The NIC_ID of the NIC to detach- Returns:
- If an error occurs the error message contains the reason.
-
lock
public OneResponse lock(int level)
Lock this virtual router- Parameters:
level
- Lock level.- Returns:
- If an error occurs the error message contains the reason.
-
unlock
public OneResponse unlock()
Unlock this virtual router- Returns:
- If an error occurs the error message contains the reason.
-
-