// First create a DVSconfig spec.
VMwareDVSConfigSpec dvsSpec = new VMwareDVSConfigSpec();
// Next, add the required primary and secondary vlan config specs to the dvs config spec.
if (!vlanmap.containsKey(vid)) {
VMwareDVSPvlanConfigSpec ppvlanConfigSpec = createDVPortPvlanConfigSpec(vid, vid, PvlanType.promiscuous, PvlanOperation.add);
dvsSpec.getPvlanConfigSpec().add(ppvlanConfigSpec);
}
if ( !vid.equals(spvlanid) && !vlanmap.containsKey(spvlanid)) {
VMwareDVSPvlanConfigSpec spvlanConfigSpec = createDVPortPvlanConfigSpec(vid, spvlanid, PvlanType.isolated, PvlanOperation.add);
dvsSpec.getPvlanConfigSpec().add(spvlanConfigSpec);
}
if (dvsSpec.getPvlanConfigSpec().size() > 0) {
// We have something to configure on the DVS... so send it the command.