Getting vRA business group networks in reservation

I was asked the other day on how to get network information that has been put in a reservation.

Here is a script that I wrote:

// Create custom query filter
var props = {"GroupID " : bg.groupID};
var model = "ManagementModelEntities.svc"
var entity = vCACEntityManager.readModelEntitiesByCustomFilter(vcacHost.id, model, "ProvisioningGroups", props, null);

var hostReservations = entity[0].getLink(vcacHost, "HostReservations");

for each (v in hostReservations){

	var nicReservations = v.getLink(vcacHost, "HostNicToReservations");
	
	for each (nicReservation in nicReservations){
	
	var hostNics = nicReservation.getLink(vcacHost, "HostNic");
	
		for each (hostNic in hostNics){

			System.log("Network profile in BG is: " + hostNic.getProperty("NetworkName"));

		}
	}
}

These are the input parameters you need to provide, or you could determine these dynamically.

Screen Shot 2015-02-17 at 21.50.43

We are using the readModelEntitiesByCustomFilter method which is known as a CRUD operation. There are other methods available on the vCACEntityManager. Here is a screen shot showing them:

Screen Shot 2015-03-08 at 20.24.11

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s