VMware Cloud Community
pabloramos
Enthusiast
Enthusiast

Connect virtual machine NIC number to distributed virtual port group

I am using a copy of VOrch workflow called : "Connect virtual machine NIC number to distributed virtual port group" to change the Network setting on a vm from standard to a distributed switch. I would like to automate the assigning of the dvPortGroup by doing a lookup and getting back a list of all available distributed port groups and then matching on a string to get the value I need to pass on to dvPortGroup input. Our distributed switches port groups have a specific naming convention "dvPG_*" I am new to vOrch and JavaScript, so any help would be very appreciated.

Reply
0 Kudos
2 Replies
probo
Enthusiast
Enthusiast

Yep, I've done this before. This code is for an action that takes a string as input and returns an array of matching network objects.

https://github.com/nemski/vco-tools/blob/master/getNetworkForRegex.js

You'll need then get the returned object from that array.

pabloramos
Enthusiast
Enthusiast

This help me to narrow down the selection. However, I am getting an error when I run the code. I suspect the problem is that I am not passing the right object value to the VC:DistributedVirtualPortgroup variable type: [2014-11-05 17:55:51.715] [I] This is the regexp value for dvPG:/dvPG_650/ [2014-11-05 17:55:51.980] [I] this is the dvPG value:DynamicWrapper (Instance) : [VcDistributedVirtualPortgroup]-[class com.vmware.vmo.plugin.vi4.model.VimDistributedVirtualPortgroup] -- VALUE : DistributedVirtualPortgroup'dvPG_650_GeneralPurpose' [2014-11-05 17:55:51.980] [I] Workflow:LM Get Network from VLAN id / get dvPG from VLAN ID (item1) : ch.dunes.model.type.ConvertorException: Unable to convert object, '[Ljava.lang.Object;@37d42b13' plugin unexcepted exception : Bad type syntax 'Array'

Reply
0 Kudos