@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
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 [optional] : Name of the host
datacentername [optional] : Name of the datacenter
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] --datacentername [mydatacenter]
--portgroupname [myportgroup] --ipaddress [AAA.AAA.AAA.AAA]
Add VirtualNic to a PortGroup on a Virtual Switch without hostname
run.bat com.vmware.host.AddVirtualNic --url [webserviceurl]
--username [username] --password [password]
--datacentername [mydatacenter]
--portgroupname [myportgroup] --ipaddress [AAA.AAA.AAA.AAA]
Add VirtualNic to a PortGroup on a Virtual Switch without datacentername
run.bat com.vmware.host.AddVirtualNic --url [webserviceurl]
--username [username] --password [password]
--portgroupname [myportgroup] --ipaddress [AAA.AAA.AAA.AAA]
ConnectedVimServiceBase.ConnectionExceptionPROP_ME_NAME, SVC_INST_NAME| Constructor and Description |
|---|
AddVirtualNic() |
| Modifier and Type | Method and Description |
|---|---|
void |
run() |
void |
setDatacentername(java.lang.String datacentername) |
void |
setHostname(java.lang.String hostname) |
void |
setIpaddress(java.lang.String ipaddress) |
void |
setPortgroupname(java.lang.String portgroupname) |
basicConnectionFromConnection, connect, disconnect, getServiceInstanceReference, setConnection, setHostConnection@Option(name="portgroupname",
required=true,
description="Name of the port group")
public void setPortgroupname(java.lang.String portgroupname)
@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)
@Option(name="hostname",
required=false,
description="Name of the host")
public void setHostname(java.lang.String hostname)
@Option(name="datacentername",
required=false,
description="Name of the datacenter")
public void setDatacentername(java.lang.String datacentername)
@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
com.vmware.vim25.RuntimeFaultFaultMsgcom.vmware.vim25.AlreadyExistsFaultMsgcom.vmware.vim25.InvalidStateFaultMsgjava.lang.reflect.InvocationTargetExceptioncom.vmware.vim25.InvalidPropertyFaultMsgjava.lang.NoSuchMethodExceptionjava.lang.IllegalAccessExceptioncom.vmware.vim25.HostConfigFaultFaultMsg