Class AddVirtualNic


  • @Sample(name="add-virtual-nic",
            description="This sample is used to add a Virtual Nic to a PortGroup")
    public class AddVirtualNic
    extends ConnectedVimServiceBase
     AddVirtualNic
    
     This sample is used to add a Virtual Nic to a PortGroup or a DVPortGroup
    
     Parameters:
     url              [required] : url of the web service
     username         [required] : username for the authentication
     password         [required] : password for the authentication
     portgroupname    [required] : Name of the port group
     ipaddress        [optional] : ipaddress for the nic, if not set DHCP
                                   will be in affect for the nic
     hostname         [required] : Name of the host
    
     Command Line:
     Add VirtualNic to a PortGroup on a Virtual Switch
     run.bat com.vmware.host.AddVirtualNic --url [webserviceurl]
     --username [username] --password  [password]
     --hostname [hostname]
     --portgroupname [myportgroup] --ipaddress [AAA.AAA.AAA.AAA]
     
    • Constructor Detail

      • AddVirtualNic

        public AddVirtualNic()
    • Method Detail

      • setPortgroupname

        @Option(name="portgroupname",
                required=true,
                description="Name of the port group")
        public void setPortgroupname​(java.lang.String portgroupname)
      • setIpaddress

        @Option(name="ipaddress",
                required=false,
                description="ipaddress for the nic, if not set DHCP will be in affect for the nic")
        public void setIpaddress​(java.lang.String ipaddress)
      • setHostname

        @Option(name="hostname",
                required=false,
                description="Name of the host")
        public void setHostname​(java.lang.String hostname)
      • run

        @Action
        public void run()
                 throws com.vmware.vim25.RuntimeFaultFaultMsg,
                        com.vmware.vim25.AlreadyExistsFaultMsg,
                        com.vmware.vim25.InvalidStateFaultMsg,
                        java.lang.reflect.InvocationTargetException,
                        com.vmware.vim25.InvalidPropertyFaultMsg,
                        java.lang.NoSuchMethodException,
                        java.lang.IllegalAccessException,
                        com.vmware.vim25.HostConfigFaultFaultMsg
        Throws:
        com.vmware.vim25.RuntimeFaultFaultMsg
        com.vmware.vim25.AlreadyExistsFaultMsg
        com.vmware.vim25.InvalidStateFaultMsg
        java.lang.reflect.InvocationTargetException
        com.vmware.vim25.InvalidPropertyFaultMsg
        java.lang.NoSuchMethodException
        java.lang.IllegalAccessException
        com.vmware.vim25.HostConfigFaultFaultMsg