After several hours and searches in the vSphere API and Onyx I realized that there isn´t any direct method for that :(
So I test the illogical things and enhanced the defaultPortConfig attribute about the vlan attribute... and what should I say: There was an atribute!
After testing if the attribute is part of the VcVmwareDistributedVirtualSwitchVlanIdSpec I was able to check the vlan :)
for(i in dvSwitch.portgroup){
System.debug(dvSwitch.portgroup[i].config.defaultPortConfig.vlan);
if(dvSwitch.portgroup[i].config.defaultPortConfig.vlan instanceof VcVmwareDistributedVirtualSwitchVlanIdSpec){
System.debug(dvSwitch.portgroup[i].config.defaultPortConfig.vlan.vlanId);
}
}
This looks like the following screen in the end:
So I hope this helps! By the way, I never had so many failed runs in a row :)