To traverse inventory objects, you define one or more TraversalSpec objects. In each TraversalSpec object, you specify a property of one managed object that holds a reference to another managed object. The TraversalSpec defines a path that the PropertyCollector can follow between objects.

To define inventory traversal, use the following steps.

Procedure

  1. Create a ContainerView for virtual machines.
  2. Create an ObjectSpec that uses the container view as the collection starting point.
  3. Create a TraversalSpec to be applied to the ContainerView to select VirtualMachine objects.
  4. Create additional TraversalSpec objects to select additional objects.

    The SelectSet list for the container view TraversalSpec has two TraversalSpec objects. Both specify a VirtualMachine object context. One object uses the network property to extend traversal to the Network managed object. The other uses the resourcePool property to extend traversal to the ResourcePool managed object.

  5. Create PropertySpec objects to retrieve VirtualMachine, Network, and ResourcePool properties.

    To retrieve properties that are embedded in data objects, the PropertySpec.PathSet property uses dot notation to specify the property paths.