#NEWLINE# def build_full_traversal( ) : #NEWLINE# #INDENT# "\n    Builds a traversal spec that will recurse through all objects .. or at\n    least I think it does. additions welcome.\n\n    See com.vmware.apputils.vim25.ServiceUtil.buildFullTraversal in the java\n    API. Extended by Sebastian Tello's examples from pysphere to reach networks\n    and datastores.\n    " #NEWLINE# TraversalSpec = vmodl . query . PropertyCollector . TraversalSpec #NEWLINE# SelectionSpec = vmodl . query . PropertyCollector . SelectionSpec #NEWLINE# rpToRp = TraversalSpec ( name = 'rpToRp' , type = vim . ResourcePool , path = 'resourcePool' , skip = False ) #NEWLINE# rpToRp . selectSet . extend ( ( SelectionSpec ( name = 'rpToRp' ) , SelectionSpec ( name = 'rpToVm' ) ) ) #NEWLINE# rpToVm = TraversalSpec ( name = 'rpToVm' , type = vim . ResourcePool , path = 'vm' , skip = False ) #NEWLINE# crToRp = TraversalSpec ( name = 'crToRp' , type = vim . ComputeResource , path = 'resourcePool' , skip = False ) #NEWLINE# crToRp . selectSet . extend ( ( SelectionSpec ( name = 'rpToRp' ) , SelectionSpec ( name = 'rpToVm' ) ) ) #NEWLINE# crToH = TraversalSpec ( name = 'crToH' , type = vim . ComputeResource , path = 'host' , skip = False ) #NEWLINE# dcToHf = TraversalSpec ( name = 'dcToHf' , type = vim . Datacenter , path = 'hostFolder' , skip = False ) #NEWLINE# dcToHf . selectSet . extend ( ( SelectionSpec ( name = 'visitFolders' ) , ) ) #NEWLINE# dcToVmf = TraversalSpec ( name = 'dcToVmf' , type = vim . Datacenter , path = 'vmFolder' , skip = False ) #NEWLINE# dcToVmf . selectSet . extend ( ( SelectionSpec ( name = 'visitFolders' ) , ) ) #NEWLINE# dcToNet = TraversalSpec ( name = 'dcToNet' , type = vim . Datacenter , path = 'networkFolder' , skip = False ) #NEWLINE# dcToNet . selectSet . extend ( ( SelectionSpec ( name = 'visitFolders' ) , ) ) #NEWLINE# dcToDs = TraversalSpec ( name = 'dcToDs' , type = vim . Datacenter , path = 'datastore' , skip = False ) #NEWLINE# dcToDs . selectSet . extend ( ( SelectionSpec ( name = 'visitFolders' ) , ) ) #NEWLINE# hToVm = TraversalSpec ( name = 'hToVm' , type = vim . HostSystem , path = 'vm' , skip = False ) #NEWLINE# hToVm . selectSet . extend ( ( SelectionSpec ( name = 'visitFolders' ) , ) ) #NEWLINE# visitFolders = TraversalSpec ( name = 'visitFolders' , type = vim . Folder , path = 'childEntity' , skip = False ) #NEWLINE# visitFolders . selectSet . extend ( ( SelectionSpec ( name = 'visitFolders' ) , SelectionSpec ( name = 'dcToHf' ) , SelectionSpec ( name = 'dcToVmf' ) , SelectionSpec ( name = 'dcToNet' ) , SelectionSpec ( name = 'crToH' ) , SelectionSpec ( name = 'crToRp' ) , SelectionSpec ( name = 'dcToDs' ) , SelectionSpec ( name = 'hToVm' ) , SelectionSpec ( name = 'rpToVm' ) ) ) #NEWLINE# fullTraversal = SelectionSpec . Array ( ( visitFolders , dcToHf , dcToVmf , rpToVm , crToH , crToRp , dcToDs , rpToRp , hToVm , rpToVm ) ) #NEWLINE# return fullTraversal