Created
May 12, 2018 01:02
-
-
Save trisharia/566f03679fbeca648d80f613b83f03be to your computer and use it in GitHub Desktop.
Get the network profiles of a vRA reservation (IaaS)
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
| // VMware vRealize Orchestrator action sample | |
| // | |
| // Get the network profiles of a vRA reservation (IaaS) | |
| // | |
| // For vRO/VRA 7.0+ | |
| // | |
| // Action Inputs: | |
| // vcacHost - vCAC:VCACHost - vRA IaaS Host | |
| // reservationEntity - vCAC:Entity - Reservation entity | |
| // | |
| // Return type: Array/vCAC:Entity - Network profile entities | |
| var networkProfileEntities = []; | |
| var entities = getNetworkProfiles(vcacHost); | |
| var linkEntities; | |
| var reservationEntityId = reservationEntity.entityKey.get("HostReservationID"); | |
| //System.log("Reservation Entity ID " + reservationEntityId); | |
| for each (var e in entities) { | |
| linkEntities = e.getLink(vcacHost, "HostNicToReservations"); | |
| for each (var n in linkEntities) { | |
| if (reservationEntityId === n.getProperty("HostReservationID")) { | |
| networkProfileEntities.push(e); | |
| break; | |
| } | |
| } | |
| } | |
| return networkProfileEntities; | |
| function getNetworkProfiles(host) { | |
| var model = "ManagementModelEntities.svc"; | |
| var entitySetName = "StaticIPv4NetworkProfiles"; | |
| var entities = vCACEntityManager.readModelEntitiesByCustomFilter(host.id, model, entitySetName, null, null); | |
| return entities; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment