VMware Cloud Community
pizzle85
Expert
Expert
Jump to solution

vRA 8 Enumerate Networks Matching Project Network Constraints

We act as a service provider for the University I work at. We provide pre-canned blueprints that allow our departmental colleges to deploy VMs. Each customer has access to generic shared subnets and can optionally have one or more departmental networks. 99% of our requests are via the GUI. Customers do not know the names of their subnets but can usually choose it if its presented in a list.

In vRA 7 we place all the networks each business group can deploy to in an IaaS reservation. When the catalog request form loads we grab the list of networks from the reservation and display them in a drop down list via a vRO external action.  We want to achieve a similar function in vRA 8. From what i see there is nothing in vRA that maps the networks to Projects, its just during the deployment process.

We already have a "CustomerName" tag that i use to tag the portgroups that each project can deploy to and use that tag in the network constraints for the projects. I am considering just using the vCenter VAPI to iterate through all the networks and check the tags on each one and return the matches. However in the past this has been pretty slow. Does anyone know if there is a better way to achieve what I'm trying to do?

Reply
0 Kudos
1 Solution

Accepted Solutions
pizzle85
Expert
Expert
Jump to solution

For my particular use case i was able tot use the vRA IaaS Network API.

var req = restHost.createRequest('GET''/iaas/api/fabric-networks-vsphere')
req.contentType = 'application/json'
req.setHeader("Authorization""Bearer " + iaasToken)
var resp = req.execute().contentAsString

var networks = new Array()

for each (net in JSON.parse(resp).content) {
    for each (tag in net.tags) {
        if (tag.value == projectName) {
            networks.push(net.name)
        }
    }
}

View solution in original post

Reply
0 Kudos
5 Replies
bdamian
Expert
Expert
Jump to solution

Hi pizzle85,

I guess your question is the same as mine (https://communities.vmware.com/t5/VMware-vRealize-Discussions/vRA-8-Available-networks-for-Project/m...).

I've solved this and I'm creating a Blog post explaining how to do it. I'll let you know when it's ready.

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
Reply
0 Kudos
pizzle85
Expert
Expert
Jump to solution

Heck yeah! Ping me when you get it written up.

I have the old clunky - get all PGs, for each get all tag ids, for each get the tag, compare the tag name to what I'm looking for, add it to an array, return array... Junk, It currently takes 8 seconds to do for one of my VCs.

Reply
0 Kudos
pizzle85
Expert
Expert
Jump to solution

For my particular use case i was able tot use the vRA IaaS Network API.

var req = restHost.createRequest('GET''/iaas/api/fabric-networks-vsphere')
req.contentType = 'application/json'
req.setHeader("Authorization""Bearer " + iaasToken)
var resp = req.execute().contentAsString

var networks = new Array()

for each (net in JSON.parse(resp).content) {
    for each (tag in net.tags) {
        if (tag.value == projectName) {
            networks.push(net.name)
        }
    }
}
Reply
0 Kudos
bdamian
Expert
Expert
Jump to solution

This is my solution to this problem: https://tecnologiaimasd.blogspot.com/2022/08/vra8-definir-redes-disponibles-por.html

 

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
pizzle85
Expert
Expert
Jump to solution

That's a good way of doing it.

In my case I have thousands of projects and thousands of networks on tens of vcenters. So for my purposes it needs to scale and using vsphere tags seemed like the better way for my needs as I can have multi vector constraints. IE: vcenter:a,datacenter:1,project:abc,team:sales,network:prod,etc:etc.

Kudos for your solution and well written guide!

Reply
0 Kudos