Quantcast
Viewing all articles
Browse latest Browse all 185574

Re: Get VM external IP from vCloud

Hello Christophe

Thank you for this code example.  I have used to to get the external IP address of a VM in a vApp.

 

Here is my final javascipt code that inside a larger workflow that clones a vApp and then returns the IP address of the VMs.

IPaddresses = [];
internalVAppChildren = internalVapp.getChildrenVms();
internalVAppChildrenNumber = internalVAppChildren.length;
System.log("Number of VMs in VApp: "  + internalVAppChildrenNumber);
for (var i=0; i < internalVAppChildren.length; i++) {  System.log("i: "+ i);  internalTheVM = internalVAppChildren[i];     System.log("VM: " +internalTheVM);  System.log("VM name: " +internalTheVM.name);  System.log("VM description: " +internalTheVM.description);  var networkConnectionSection = System.getModule("com.vmware.library.vCloud.operation").getNetworkConnectionSectionVM(internalTheVM);    System.log("networkConnectionSection: "+ networkConnectionSection);  System.log("networkConnectionSection.length: "+ networkConnectionSection.length);  var networkConnections = networkConnectionSection.networkConnection.enumerate();    for each (var networkConnection in networkConnections) {    var externalIp = networkConnection.externalIpAddress;       if (externalIp != null) {    IPaddresses.push(externalIp);  System.log("externalIp "+ externalIp);    }    }//For each (var networkConnection in networkConnections) 
}//for (var i=0; i < internalVAppChildren.length; i++)

Viewing all articles
Browse latest Browse all 185574

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>