Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

How to get network related information from VC:VirtualMachine

$
0
0

Hello, I am working on modifying the vcenter clone workflow to automate network related information assignment, such as: ip, network address, gateway, DNS server, DomainName etc. I need to get it directly from vCenter API, not vCloud API; assuming that customer who is going to use this workflow, has no vCloud Director, just vCenter.

 

The only way I found out so far is to pre-create a customization spec with these default network information using vSphere Customization Manager, and using these during clone workflow. Please see my scripts below.

 

My question is: Is there any other way to get these network information directly from VC:VirtualMachine?

 

Thanks,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

var custspec = new VcCustomizationSpec();
var con = vm.sdkConnection;
var cms = con.customizationSpecManager;
var customSpecExists = cms.doesCustomizationSpecExist(specName);

if (customSpecExists) {
     var customSpecItem = cms.getCustomizationSpec(specName);
    custspec = customSpecItem.spec;
    var name = customSpecItem.info.name;
    } else throw "customspec not found";

 

var ip = custspec.nicSettingMap[0].adapter.ip.ipAddress;

var dnsServerList = custspec.nicSettingMap[0].adapter.dnsServerList;
dnsDomain = custspec.nicSettingMap[0].adapter.dnsDomain;
netmask = custspec.nicSettingMap[0].adapter.subnetMask;
gateway = custspec.nicSettingMap[0].adapter.gateway;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Viewing all articles
Browse latest Browse all 6251

Trending Articles



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