I have a Bluprint with entitlements for several Business Groups.
I've created a Custom Property Definition for VirtualMachine.Network0.Name, Display as Dropdown with external values and set the script 'com.vmware.vra.networks/getApplicableNetworks'. This works fine for users belonging to only one Business Group.
But if a User belongs to two Business Groups and each of those has different networks in the reservation, then the user can see ALL networks in the Request Form.
How do I limit the networks considering the Business Groups?
I've researched a little bit and I found that the only Context Variables I can use in an Action called by a Property Definition are:
__asd_composition_blueprintId
__blueprintId
__asd_composition_componentId
__requestedForUserId
__tenantId
__asd_requestedBy
__asd_requestedFor
__asd_tenantRef
__componentId
And none of these points to the Business Group (Subtenant) or Reservation. So I've started to think that this is not possible.
Please help?
Thanks a lot,
D.
I'm going to assume that we're talking about vRA 7.2 and that you're not worried about Reservation Policies.
At first I thought that this would be easy as I've done it before with 7.0. Previously though, I used a vCACEntityManager.readModelEntitiesBySystemQuery call that might not be future proof, so I thought I'd look at the action you mentioned. Out of the box, no it won't work. Instead, I created a slightly adjusted version of the action that you can find in the attached package.
To make it work, you'll need to add a custom property to each of your business groups in vRA (for example):
Call the property whatever you want, just make the value the same as your business group name and make sure that it doesn't show in the request.
You'll need to setup a property definition for the property, whatever you called it:
And then add it to the same property group as for VirtualMachine.Network0.Name:
With that Property Group added to your blueprint, the final step is to do the property definition for VirtualMachine.Network0.Name. Bind the businessGroup input on the action to the custom property that you created above:
I haven't tested it extensively, but it seems to work ok for me in my lab. I hope that helps you out 🙂
Michael
I'm going to assume that we're talking about vRA 7.2 and that you're not worried about Reservation Policies.
At first I thought that this would be easy as I've done it before with 7.0. Previously though, I used a vCACEntityManager.readModelEntitiesBySystemQuery call that might not be future proof, so I thought I'd look at the action you mentioned. Out of the box, no it won't work. Instead, I created a slightly adjusted version of the action that you can find in the attached package.
To make it work, you'll need to add a custom property to each of your business groups in vRA (for example):
Call the property whatever you want, just make the value the same as your business group name and make sure that it doesn't show in the request.
You'll need to setup a property definition for the property, whatever you called it:
And then add it to the same property group as for VirtualMachine.Network0.Name:
With that Property Group added to your blueprint, the final step is to do the property definition for VirtualMachine.Network0.Name. Bind the businessGroup input on the action to the custom property that you created above:
I haven't tested it extensively, but it seems to work ok for me in my lab. I hope that helps you out 🙂
Michael
Hi bdamian
You're absolutely right and we're already in contact with VMware on this issue, this is not only related to business groups but also to tenants.
I have proposed a workaround for it:
GitHub - swisscom/vmware-network-profiles-patch: VMware vRA networkprofiles multi-tenancy patch
Unfortunately this cannot be solved within a vRO action, yet.
Cheers
Daniele
Thanks poorem, this is a very good workaround until VMware fix this issue.
As we have all business group creation automated, it is not difficult to add the new custom property.
Thanks a lot,
D.
Hello Thanks for this, is it possible to get the Network Profile name dynamically generated in the dropbox ? in place of network name.
Also if i pass a Network Profile name "VirtualMachine.Network0.ProfileName" during the VM provisioning in place of "VirtualMachine.Network0.Name" will it work ?
Of course, you need to modify this portion of the "getApplicableNetworks":
for each(var res in reservations) {
var extensionData = res.getExtensionData();
if(extensionData) {
var networks = extensionData.get("reservationNetworks");
if(networks) {
for each(var network in networks.getValue()) {
var path = network.getValue().get("networkPath");
applicableNetworks.put(path.label, path.label);
}
}
}
}
For this
for each(var res in reservations) {
var extensionData = res.getExtensionData();
if(extensionData) {
var networks = extensionData.get("reservationNetworks");
if(networks) {
for each(var network in networks.getValue()) {
var path = network.getValue().get("networkPath");
var profile = network.getValue().get("networkProfile");
var netLabel = (profile==null)?path.label:profile.label; // because you can have a Net without profile
applicableNetworks.put(path.label, netLabel);
}
}
}
}
This works for me.
D.