I find the below hook file is used to create vswitch / port group on ESXi hosts under vCenter Server:
The following line set VLAN ID which obtain from template or set to 0:
- vlan_id = template[“VLAN_ID”] || template[“AUTOMATIC_VLAN_ID”] || 0
If I create network with specific VLAN ID, it works. That means no problem for template[“VLAN_ID”] .
If I select Automatic VLAN I, the output will be 0 (no VLAN ID). I believe vlan_id is set to 0 instead of template[“AUTOMATIC_VLAN_ID”].
I had edit the hook as below but it will result into error:
vlan_id = template[“AUTOMATIC_VLAN_ID”]
VCENTER_NET_ERROR : A port group with name TestPG could not be created. Reason: InvalidRequest: Required property vlanId is missing from data object of type HostPortGroupSpec while parsing serialized DataObject of type vim.host.PortGroup.Specification at line 1, column 265 while parsing call information for method AddPortGroup at line 1, column 177 while parsing SOAP body at line 1, column 167 while parsing SOAP envelope at line 1, column 0 while parsing HTTP request for method addPortGroup on object of type vim.host.NetworkSystem at line 1, column 0
It is seems have problem on template[“AUTOMATIC_VLAN_ID”] .