Class VirtualNetworkTemplate


  • public class VirtualNetworkTemplate
    extends PoolElement
    This class represents an OpenNebula Virtual Network template. It also offers static XML-RPC call wrappers.
    • Constructor Detail

      • VirtualNetworkTemplate

        public VirtualNetworkTemplate​(int id,
                                      Client client)
        Creates a new VNTemplate representation.
        Parameters:
        id - The VNtemplate id.
        client - XML-RPC Client.
      • VirtualNetworkTemplate

        protected VirtualNetworkTemplate​(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 VNTemplate in OpenNebula.
        Parameters:
        client - XML-RPC Client.
        description - A string containing the template of the vntemplate.
        Returns:
        If successful the message contains the associated id generated for this VNTemplate.
      • info

        public static OneResponse info​(Client client,
                                       int id)
        Retrieves the information of the given VNTemplate.
        Parameters:
        client - XML-RPC Client.
        id - The VNtemplate id for the VNtemplate 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 VNTemplate.
        Parameters:
        client - XML-RPC Client.
        id - The VNtemplate id for the VNtemplate 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.
      • delete

        public static OneResponse delete​(Client client,
                                         int id)
        Deletes a VNTemplate from OpenNebula.
        Parameters:
        client - XML-RPC Client.
        id - The vntemplate id of the target vntemplate 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 VNTemplate contents.
        Parameters:
        client - XML-RPC Client.
        id - The vntemplate id of the target vntemplate we want to modify.
        new_template - New vntemplate contents.
        append - True to append new attributes instead of replace the whole vntemplate
        Returns:
        If successful the message contains the vntemplate id.
      • publish

        public static OneResponse publish​(Client client,
                                          int id,
                                          boolean publish)
        Publishes or unpublishes a VNTemplate.
        Parameters:
        client - XML-RPC Client.
        id - The vntemplate id of the target vntemplate we want to modify.
        publish - True for publishing, false for unpublishing.
        Returns:
        If successful the message contains the vntemplate 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 vntemplate id of the target vntemplate 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 vntemplate permissions
        Parameters:
        client - XML-RPC Client.
        id - The vntemplate id of the target vntemplate.
        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,
                                        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.
      • instantiate

        public static OneResponse instantiate​(Client client,
                                              int id,
                                              java.lang.String name,
                                              java.lang.String template)
        Creates a VNET instance from a VNTemplate
        Parameters:
        client - XML-RPC Client.
        id - The vntemplate id of the target vntemplate.
        name - A string containing the name of the VM instance, can be empty.
        template - User provided VNTemplate to merge with the one being instantiated
        Returns:
        If successful the message contains the VM Instance ID.
      • clone

        public static OneResponse clone​(Client client,
                                        int id,
                                        java.lang.String name)
        Clones this vntemplate into a new one
        Parameters:
        client - XML-RPC Client.
        id - The vntemplate id of the target vntemplate.
        name - Name for the new vntemplate.
        Returns:
        If successful the message contains the new vntemplate ID.
      • rename

        public static OneResponse rename​(Client client,
                                         int id,
                                         java.lang.String name)
        Renames this VNTemplate
        Parameters:
        client - XML-RPC Client.
        id - The VNTemplate id of the target VNTemplate.
        name - New name for the VNTemplate.
        Returns:
        If an error occurs the error message contains the reason.
      • lock

        public static OneResponse lock​(Client client,
                                       int id,
                                       int level)
        lock this VNtemplate
        Parameters:
        client - XML-RPC Client.
        id - The vntemplate 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 vntemplate
        Parameters:
        client - XML-RPC Client.
        id - The vntemplate id.
        Returns:
        If an error occurs the error message contains the reason.
      • info

        public OneResponse info()
        Retrieves the information of the VNTemplate.
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • info

        public OneResponse info​(boolean extended)
        Retrieves the information of the given VNTemplate.
        Parameters:
        extended - optional flag to process the vntemplate and include extended information, such as the SIZE for each DISK
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • delete

        public OneResponse delete()
        Deletes the vntemplate from OpenNebula.
        Returns:
        A encapsulated response.
      • update

        public OneResponse update​(java.lang.String new_template)
        Replaces the vntemplate contents.
        Parameters:
        new_template - New VNtemplate contents.
        Returns:
        If successful the message contains the vntemplate id.
      • update

        public OneResponse update​(java.lang.String new_template,
                                  boolean append)
        Replaces the vntemplate contents.
        Parameters:
        new_template - New vntemplate contents.
        append - True to append new attributes instead of replace the whole vntemplate
        Returns:
        If successful the message contains the vntemplate id.
      • publish

        public OneResponse publish​(boolean publish)
        Publishes or unpublishes the vntemplate.
        Parameters:
        publish - True for publishing, false for unpublishing.
        Returns:
        If successful the message contains the vntemplate id.
      • publish

        public OneResponse publish()
        Publishes the vntemplate.
        Returns:
        If successful the message contains the vntemplate id.
      • unpublish

        public OneResponse unpublish()
        Unpublishes the vntemplate.
        Returns:
        If successful the message contains the vntemplate 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 vntemplate 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​(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​(java.lang.String name,
                                       java.lang.String template)
        Creates a VNET instance from a VNTemplate
        Parameters:
        name - A string containing the name of the VM instance, can be empty.
        template - User provided Template to merge with the one being instantiated
        Returns:
        If successful the message contains the VM Instance ID.
      • instantiate

        public OneResponse instantiate​(java.lang.String name)
        Creates a VM instance from a VNTemplate
        Parameters:
        name - A string containing the name of the VM instance, can be empty.
        Returns:
        If successful the message contains the VM Instance ID.
      • instantiate

        public OneResponse instantiate()
        Creates a VM instance from a VNTemplate
        Returns:
        If successful the message contains the VM Instance ID.
      • clone

        public OneResponse clone​(java.lang.String name)
        Clones this vntemplate into a new one
        Parameters:
        name - Name for the new vntemplate.
        Returns:
        If successful the message contains the new vntemplate ID.
      • rename

        public OneResponse rename​(java.lang.String name)
        Renames this VNTemplate
        Parameters:
        name - New name for the VNTemplate.
        Returns:
        If an error occurs the error message contains the reason.
      • lock

        public OneResponse lock​(int level)
        Lock this VNtemplate
        Parameters:
        level - Lock level.
        Returns:
        If an error occurs the error message contains the reason.
      • unlock

        public OneResponse unlock()
        Unlock this VNtemplate
        Returns:
        If an error occurs the error message contains the reason.