VMware Cloud Community
sagar_shahir
Contributor
Contributor

Network Configure event not returning network details

Hi,

I have a simple cloud template with vm and 1 nic attached to it. Network Profiles are selected based on constraints. I am trying to get network details (ip, dns, domain and gateway) during provision.

I have subscribed to 'Network Configure' event but my vRO workflow is not getting all network details in inputProperties. I am getting input data similar to 'Compute Allocation'.

Am I missing something?

Thanks

0 Kudos
2 Replies
Ankush11s
VMware Employee
VMware Employee

Can you share how does your workflow will look like 

0 Kudos
rwk1982
Enthusiast
Enthusiast

Hello!

You only get the "networkSelectionIds" and must get the Details with an API request. Since you only have one VM with one NIC attached this should work for you:

var val2return = new Properties
var vra_netid = inputProperties.networkSelectionIds[0][0][0]
var vra_uri = "/iaas/api/fabric-networks-vsphere/" + vra_netid

var vra_user = "your_user"
var vra_pass = "your_pass"
var vra_url = "https://your_vra.fq.dn"

var vra_host = VraHostManager.createHost({
    name: "dummy",
    vraHost: vra_url,
    user: vra_user,
    password: vra_pass,
    connectionType: "vra-onprem",
    sessionMode: "Shared Session"
})


var vra_rest = vra_host.createRestClient()
var vra_request = vra_rest.createRequest("GET", vra_uri, null);

var vra_response = vra_rest.execute(vra_request)

val2return = JSON.parse(vra_response.contentAsString)

vra_host.destroy()

return val2return

 

Regards,

Robert

Drink coffee.. Do stupid things faster with more energy...
0 Kudos