VirtualRouter (OpenNebula Cloud API)
Description: declaration: package: org.opennebula.client.vrouter, class: VirtualRouter

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(Node xmlElement, Client client)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static OneResponse`
  `allocate(Client client, String description)`
  Allocates a new VirtualRouter in OpenNebula.
  `OneResponse`
  `chgrp(int gid)`
  Changes the group
  `OneResponse`
  `chmod(int octet)`
  Changes the permissions
  `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
  `OneResponse`
  `chmod(String octet)`
  Changes the permissions
  `static OneResponse`
  `chmod(Client client, int id, int octet)`
  Changes the permissions
  `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
  `static OneResponse`
  `chmod(Client client, int id, String octet)`
  Changes the permissions
  `OneResponse`
  `chown(int uid)`
  Changes the owner
  `OneResponse`
  `chown(int uid, int gid)`
  Changes the owner/group
  `static OneResponse`
  `chown(Client client, int id, int uid, int gid)`
  Changes the owner/group
  `OneResponse`
  `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, String name, boolean onHold, String template)`
  Creates VM instances from a VM Template.
  `static OneResponse`
  `instantiate(Client client, int id, int nVMs, int templateId, String name, boolean onHold, String template)`
  Creates VM instances from a VM Template.
  `OneResponse`
  `lock(int level)`
  Lock this virtual router
  `static OneResponse`
  `lock(Client client, int id, int level)`
  lock this virtual router
  `OneResponse`
  `nicAttach(String nicTemplate)`
  Attaches a NIC to this VirtualRouter, and each one of its VMs
  `static OneResponse`
  `nicAttach(Client client, int id, String nicTemplate)`
  Attaches a NIC to this VirtualRouter, and each one of its VMs
  `OneResponse`
  `nicDetach(int nicId)`
  Detaches a NIC from this VirtualRouter, and each one of its VMs
  `static OneResponse`
  `nicDetach(Client client, int id, int nicId)`
  Detaches a NIC from this VirtualRouter, and each one of its VMs
  `OneResponse`
  `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(String name)`
  Renames this VirtualRouter
  `static OneResponse`
  `rename(Client client, int id, String name)`
  Renames this VirtualRouter
  `OneResponse`
  `unlock()`
  Unlock this virtual router
  `static OneResponse`
  `unlock(Client client, int id)`
  Unlock this virtual router
  `OneResponse`
  `unpublish()`
  Unpublishes the VirtualRouter.
  `OneResponse`
  `update(String new_template)`
  Replaces the VirtualRouter contents.
  `OneResponse`
  `update(String new_template, boolean append)`
  Replaces the template contents.
  `static OneResponse`
  `update(Client client, int id, String new_template, boolean append)`
  Replaces the template contents.

  ### Methods inherited from class org.opennebula.client.PoolElement

  `chmod, chmod, chmod, getId, getName, gid, id, processInfo, state, uid, xpath`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### VirtualRouter

    public VirtualRouter(int id, Client client)
    Creates a new VirtualRouter representation.
    Parameters:
      `id` - The VirtualRouter id.
      `client` - XML-RPC Client.

  - ### VirtualRouter

    protected VirtualRouter(Node xmlElement, Client client)
    See Also:
      - `PoolElement`

- ## Method Details

  - ### allocate

    public static OneResponse allocate(Client client, 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 from
      `decrypt` - 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, String name, boolean onHold, 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 instantiate
      `templateId` - VM Template id to instantiate
      `name` - 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 hold
      `template` - 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, 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 change
      `owner_m` - 1 to allow, 0 deny, -1 do not change
      `owner_a` - 1 to allow, 0 deny, -1 do not change
      `group_u` - 1 to allow, 0 deny, -1 do not change
      `group_m` - 1 to allow, 0 deny, -1 do not change
      `group_a` - 1 to allow, 0 deny, -1 do not change
      `other_u` - 1 to allow, 0 deny, -1 do not change
      `other_m` - 1 to allow, 0 deny, -1 do not change
      `other_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, 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, 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, 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(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(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 change
      `owner_m` - 1 to allow, 0 deny, -1 do not change
      `owner_a` - 1 to allow, 0 deny, -1 do not change
      `group_u` - 1 to allow, 0 deny, -1 do not change
      `group_m` - 1 to allow, 0 deny, -1 do not change
      `group_a` - 1 to allow, 0 deny, -1 do not change
      `other_u` - 1 to allow, 0 deny, -1 do not change
      `other_m` - 1 to allow, 0 deny, -1 do not change
      `other_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(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, String name, boolean onHold, 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 instantiate
      `templateId` - VM Template id to instantiate
      `name` - 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 hold
      `template` - 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 instantiate
      `templateId` - VM Template id to instantiate
    Returns:
      If an error occurs the error message contains the reason.

  - ### rename

    public OneResponse rename(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(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.