Last active
April 3, 2018 13:14
-
-
Save kclinden/2ec49e2f6d003ed977ab207d2c90fac6 to your computer and use it in GitHub Desktop.
Get vCAC Network Profiles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Name: getNetworkProfiles | |
| //Description: Used to get all network profiles from a given vCAC IaaS Host | |
| //Inputs: vcacHost [vCAC:VCACHost] | |
| //Initialize Array or JSON | |
| var networkProfiles = []; | |
| var netProfiles = System.getModule("com.vmware.library.vcac").getEntitiesBySystemFilter(vcacHost,"ManagementModelEntities.svc","StaticIPv4NetworkProfiles",null,null,null,null,null,null); | |
| for each (netProfile in netProfiles){ | |
| //Create JSON Object | |
| var networkProfile = {}; | |
| networkProfile["name"] = netProfile.getProperties().get("StaticIPv4NetworkProfileName"); | |
| networkProfile["profileId"] = netProfile.getProperties().get("ID"); | |
| networkProfile["dnsSuffix"] = netProfile.getProperties().get("DnsSearchSuffix"); | |
| networkProfile["profileType"] = netProfile.getProperties().get("ProfileType"); | |
| networkProfile["subnetMask"] = netProfile.getProperties().get("SubnetMaskIPv4"); | |
| networkProfile["primaryDns"] = netProfile.getProperties().get("PrimaryDNSIPv4Address"); | |
| networkProfile["secondaryDns"] = netProfile.getProperties().get("SecondaryDNSIPv4Address"); | |
| networkProfile["gateway"] = netProfile.getProperties().get("GatewayIPv4Address"); | |
| networkProfiles.push(networkProfile); | |
| } | |
| return JSON.stringify(networkProfiles,null,4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment