VMware Cloud Community
Wayne_sun
VMware Employee
VMware Employee

How to bind the ip address of second network card of machine component?

I have designed a blueprint which including a vsphere machine component and a software component on machine component. The machine component have two network cards, and now I want to refer to the ip address of second network card in software component, so I define a string property in software component and want to bind it.

Now machine component ID: vsphere_machine and one property of software component is ipaddress2. In design canvas I bind ipaddress2 with "vsphere_machine~nics[1]", but it doesn't work.

I am not sure how to bind ip address of second card of machine component?

Thanks a lot!

0 Kudos
2 Replies
daphnissov
Immortal
Immortal

I've been monkeying with this for about half the day and have not had any success. What I thought was most promising was to bind a string-type property to _resource~<Name_of_Machine_Component>~VirtualMachine.Network1.Address but this fails when the software component itself runs with the error

Internal error in processing component request: com.vmware.vcac.platform.content.exceptions.EvaluationException: No data for field segment: Current field-id [VirtualMachine.Network1.Address], current field path [VirtualMachine.Network1.Address], remaining field path: [null]

I've tried also binding to just the "ip_address" resource as well with a property of type string-array hoping it would output both addresses and from there I could parse out the one I want, but that only returns the address for Network0. I also tried specifying the custom property VIrtualMachine.Network1.Address at both the blueprint and machine component level with a value of null, but the request fails on allocation because of an invalid IP (which is as to be expected). So at this point, the only other option is very ugly and that is to extract the value of VirtualMachine.Network1.Address from the log file that contains the full payload. The log is stored at /opt/vmware-appdirector/agent/logs/agent_bootstrap.log. In this snippet, you can see the address which is output therein.

pastedImage_1.png

That's, like I said, a very nasty solution, but I can't seem to find another way if it's even possible.

If you find differently, please respond to this thread.

0 Kudos
daphnissov
Immortal
Immortal

I thought this was an interesting and valid use case, so I took some time to write up a solution which can be extended further to capture the value of any custom property included in the payload.

Using vRA Software Components and binding any custom property

0 Kudos