VMware Cloud Community
Subnet88
Enthusiast
Enthusiast

Find External Network from Org Network

What is the best way to find the external network that a Org network is bound to?

I have tried the following code with no luck, and am now at a loss

OrganizationNetworkConfig = OrganizationNetwork.configuration
OrgNetworkParent = OrganizationNetworkConfig.parentNetwork
System.log("Its External Network is "+OrgNetworkParent.name);
System.log("It is of type "+OrgNetworkParent.type)
ExtNetwork = vcdHost.getEntityByReference("admin:network",OrgNetworkParent)

0 Kudos
1 Reply
cdecanini_
VMware Employee
VMware Employee

You are close. Try this (Unfortunately I cannot not test it ATM to check if it works).

var extNetworkRef = orgNetwork.toAdminObject().configuration.parentNetwork;
var extNetwork = orgNetwork.getHost().getEntityByReference(VclFinderType.PROVIDER_NETWORK, extNetworkRef);

Note that it is possible that the parent network is null. In this case your code will break so test for null.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos