Hi All -
We're using LabManager's SOAP API to power an automated test harness.
One of the tests we are required to implement for the customer requires the simulation of a network outage between two of the guest virtual machines.
I would like to be able to programmatically down a Guest Host's NIC via either the LM API or the VI SDK (or the VI Java API).
After searching through a lot of docs, this community and Internet searches, the closet things I can find are:
1) Delete and Re-add the NIC via something like RemoveVirtualNIC/AddVirtualNIC. Not sure what this will do to the guest's OS - probably cause a bit of trouble.
2) Reconfigure the Virtual NIC with a whacked-out, non-routable IP using UpdateVirtualNIC, then change it back to the "real" IP.
Is there a specific API call to just disable/enable a NIC on a VM?
Thanks In Advance,
John
I also wrote an article for TechTarget in December of last year that
showed how to do just this:
http://searchvmware.techtarget.com/tip/0,289483,sid179_gci1284661,00.html.
Here is the VS project mentioned in the article.
On Thu, Aug 28, 2008 at 6:14 PM, c_shanklin
It's doable using the ReconfigVM_Task method. I wouldn't accuse it of being very easy though. You might want to have a look at the VMReconfig.java sample within the SDK.
Alternatively if you're not really committed to a particular development platform you might want to consider the VI Toolkit (for Windows).Once you have that up and running you can disconnect using this code
get-vm vmToModify | get-networkadapter | set-networkadapter -connected:$false
I also wrote an article for TechTarget in December of last year that
showed how to do just this:
http://searchvmware.techtarget.com/tip/0,289483,sid179_gci1284661,00.html.
Here is the VS project mentioned in the article.
On Thu, Aug 28, 2008 at 6:14 PM, c_shanklin
Thanks - you guys rock. I'll be cranking this up in Java/Axis early next week, and will post my code.
BTW, I forgot to mention that development is being done on MacOS and deployment on RHEL 5, FWIW.