def _get_network_obj(session, network_objects, network_name):
 network_obj = {}
 for obj_content in network_objects:
  if (not hasattr(obj_content, 'propSet')):
   continue
  prop_dict = vm_util.propset_dict(obj_content.propSet)
  network_refs = prop_dict.get('network')
  if network_refs:
   network_refs = network_refs.ManagedObjectReference
   for network in network_refs:
    if (network._type == 'DistributedVirtualPortgroup'):
     props = session._call_method(vutil, 'get_object_property', network, 'config')
     if (network_name in props.name):
      network_obj['type'] = 'DistributedVirtualPortgroup'
      network_obj['dvpg'] = props.key
      dvs_props = session._call_method(vutil, 'get_object_property', props.distributedVirtualSwitch, 'uuid')
      network_obj['dvsw'] = dvs_props
      return network_obj
    else:
     props = session._call_method(vutil, 'get_object_property', network, 'summary.name')
     if (props == network_name):
      network_obj['type'] = 'Network'
      network_obj['name'] = network_name
      return network_obj

def _get_network_obj ( session , network_objects , network_name ) : network_obj = { } for obj_content in network_objects : if ( not hasattr ( obj_content , 'propSet' ) ) : continue prop_dict = vm_util . propset_dict ( obj_content . propSet ) network_refs = prop_dict . get ( 'network' ) if network_refs : network_refs = network_refs . ManagedObjectReference for network in network_refs : if ( network . _type == 'DistributedVirtualPortgroup' ) : props = session . _call_method ( vutil , 'get_object_property' , network , 'config' ) if ( network_name in props . name ) : network_obj [ 'type' ] = 'DistributedVirtualPortgroup' network_obj [ 'dvpg' ] = props . key dvs_props = session . _call_method ( vutil , 'get_object_property' , props . distributedVirtualSwitch , 'uuid' ) network_obj [ 'dvsw' ] = dvs_props return network_obj else : props = session . _call_method ( vutil , 'get_object_property' , network , 'summary.name' ) if ( props == network_name ) : network_obj [ 'type' ] = 'Network' network_obj [ 'name' ] = network_name return network_obj
gets the network object for the requested network .