def check_if_vlan_interface_exists(session, vlan_interface, cluster=None):
 host_mor = vm_util.get_host_ref(session, cluster)
 physical_nics_ret = session._call_method(vutil, 'get_object_property', host_mor, 'config.network.pnic')
 if (not physical_nics_ret):
  return False
 physical_nics = physical_nics_ret.PhysicalNic
 for pnic in physical_nics:
  if (vlan_interface == pnic.device):
   return True
 return False

def check_if_vlan_interface_exists ( session , vlan_interface , cluster = None ) : host_mor = vm_util . get_host_ref ( session , cluster ) physical_nics_ret = session . _call_method ( vutil , 'get_object_property' , host_mor , 'config.network.pnic' ) if ( not physical_nics_ret ) : return False physical_nics = physical_nics_ret . PhysicalNic for pnic in physical_nics : if ( vlan_interface == pnic . device ) : return True return False
checks if the vlan_interface exists on the esx host .