VMware

Sample to perform Netwoking related operations on VM NICs

VERSION 1 Published

Created on: Sep 14, 2009 1:58 PM by navadavuluri - Last Modified:  Sep 14, 2009 2:01 PM by navadavuluri

Usage:
java VMNetworkingOps <server> <username> <password> <vmName> <print|add|change> <portGroupName> <adpaterType|vmNicNames>

Case 1:
Print the VMNic details (name, and the port group it is connected to)

Input:
https://10.20.140.47/sdk root password vMATemplate_vMAClone1 print

Output:

VM Name: vMATemplate_vMAClone1
MOR Type : VirtualMachine
ObjectContent Length : 1
config.hardware : com.vmware.vim25.VirtualHardware@98f2c13f
*******************************************************
vmnic Info (Label) : Network adapter 1
vmnic Port Group: VM Network

vmnic Info (Label) : Network adapter 2
vmnic Port Group: VM Network

vmnic Info (Label) : Network adapter 3
vmnic Port Group: PGroup1

vmnic Info (Label) : Network adapter 4
vmnic Port Group: PGroup1

*******************************************************

################################################################################

Case 2:
Change the vmnic port group

Input:
https://10.20.140.47/sdk root password vMATemplate_vMAClone1 change "Network adapter 3,Network adapter 4" "VM Network"

Output:
VM Name: vMATemplate_vMAClone1
vmnic adapters: Network adapter 3
vmnic adapters: Network adapter 4
MOR Type : VirtualMachine
ObjectContent Length : 1
config.hardware : com.vmware.vim25.VirtualHardware@98f2c13f
vmnic Info (Label) : Network adapter 1
vmnic Info (Label) : Network adapter 2
vmnic Info (Label) : Network adapter 3
vmnic Info (Label) : Network adapter 4
Success: VM Reconfiguration
Successfully changed the portgroup for the vmnic adapters

################################################################################

Case 3:
Print the VMNic details (name, and the port group it is connected to)

Input:
https://10.20.140.47/sdk root password vMATemplate_vMAClone1 print

Output:

VM Name: vMATemplate_vMAClone1
MOR Type : VirtualMachine
ObjectContent Length : 1
config.hardware : com.vmware.vim25.VirtualHardware@54a1587f
*******************************************************
vmnic Info (Label) : Network adapter 1
vmnic Port Group: VM Network

vmnic Info (Label) : Network adapter 2
vmnic Port Group: VM Network

vmnic Info (Label) : Network adapter 3
vmnic Port Group: VM Network

vmnic Info (Label) : Network adapter 4
vmnic Port Group: VM Network

*******************************************************

################################################################################

Case 4:
Add vmnic to a VM, and assign it to the given port group

Input:
https://10.20.140.47/sdk root password vMATemplate_vMAClone1 add e1000 PGroup1

Output:

VM Name: vMATemplate_vMAClone1
MOR Type : VirtualMachine
Success: VM Reconfiguration
Successfully added a vmnic adapter to the VM

################################################################################

Case 5:
Print the VMNic details (name, and the port group it is connected to)

Input:
https://10.20.140.47/sdk root password vMATemplate_vMAClone1 print

Output:

VM Name: vMATemplate_vMAClone1
MOR Type : VirtualMachine
ObjectContent Length : 1
config.hardware : com.vmware.vim25.VirtualHardware@ee6e956
*******************************************************
vmnic Info (Label) : Network adapter 1
vmnic Port Group: VM Network

vmnic Info (Label) : Network adapter 2
vmnic Port Group: VM Network

vmnic Info (Label) : Network adapter 3
vmnic Port Group: VM Network

vmnic Info (Label) : Network adapter 4
vmnic Port Group: VM Network

vmnic Info (Label) : Network adapter 5
vmnic Port Group: PGroup1

*******************************************************

################################################################################

Case 6:
Remove vmnic from a VM

Input:
https://10.20.140.47/sdk root password vMATemplate_vMAClone1 remove "Network adapter 5"

Output:

VM Name: vMATemplate_vMAClone1
MOR Type : VirtualMachine
ObjectContent Length : 1
config.hardware : com.vmware.vim25.VirtualHardware@54a1587f
vmnic Info (Label) : Network adapter 1
vmnic Info (Label) : Network adapter 2
vmnic Info (Label) : Network adapter 3
vmnic Info (Label) : Network adapter 4

################################################################################

Case 7:
Print the VMNic details (name, and the port group it is connected to)

Input:
https://10.20.140.47/sdk root password vMATemplate_vMAClone1 print

Output:

VM Name: vMATemplate_vMAClone1
MOR Type : VirtualMachine
ObjectContent Length : 1
config.hardware : com.vmware.vim25.VirtualHardware@54a1587f
*******************************************************
vmnic Info (Label) : Network adapter 1
vmnic Port Group: VM Network

vmnic Info (Label) : Network adapter 2
vmnic Port Group: VM Network

vmnic Info (Label) : Network adapter 3
vmnic Port Group: VM Network

vmnic Info (Label) : Network adapter 4
vmnic Port Group: VM Network

*******************************************************

Attachments:
Average User Rating
(0 ratings)




Comments

There are no comments on this document

 

Developer Social Media

Communities