// VMware vRealize Orchestrator action sample // // Starting with a Virtual Machine: this sample determines the Reservation it is associated with // Then it gets the names of the Networks selected in the Reservation. // // For vRO/vRA 7.0+ // // Action Inputs: // vcacVm - vCAC:VirtualMachine vCAC Virtual Machine // // Return type: Array/string - The networks selected in the reservation. var networkNames = []; var vmEntity = vcacVm.getEntity(); var host = Server.findForType("vCAC:VCACHost",vmEntity.hostId); var hostReservationEntity = vmEntity.getLink(host,"HostReservation")[0]; var hostNicToReservations = hostReservationEntity.getLink(host,"HostNicToReservations"); System.log("Number of Networks selected in Reservation: "+hostNicToReservations.length); for each (var nicMapping in hostNicToReservations) { var hostNicEntity = nicMapping.getLink(host,"HostNic")[0]; var networkName = hostNicEntity.getProperty("NetworkName"); networkNames.push(networkName); System.log(" "+networkName); } return networkNames;