The first step in the Manager-to-Policy import process is to import shared resources such as routers, IP blocks and pools, NsGroups, and so on.

NCP in Policy mode only accepts the Policy ID of NSX resources in its ncp.ini. Shared Resources are imported to Policy from Manager with a policy ID that is derived from their display names in the following way:
  • Each space (' ') literal is replaced with underscore ('_')
  • Each forward slash ('/') is replaced with underscore ('_')
  • If the display name has only periods (for example, '.', '.....', etc.) it is prepended with one underscore ('_')
  • "mp display name" becomes policy id: "mp_display_name"
  • "mp display/name" becomes policy id: "mp_display_name"
  • "....." becomes policy id: "_....."

You must ensure that all the NSX resources that you created have unique display names.

If needed, update the ncp.ini based on the above rules wherever the config reads the ID of the NSX resource.

Edit user-spec.yaml

You must edit user-spec.yaml to specify which resources will be imported. You can specify:
  • The resource using either display_name or ID in the Manager API. If the resource is not found in Manager API, it is ignored.
  • The IP-Allocations to be imported for any IP Pool in the user-spec.yaml under "ip-allocations". Two scenarios:
    1. With custom IpPoolAllocations from this IpPool

      If you have created some IpAllocations manually, please specify them under here. Key is the allocation_id of the IpPoolAllocation and value is its expected policy ID. Do not import any other resource like IpBlock, Tier0, etc. with it. Once they are imported, run the script again to import shared_resources but as specified in step 2 below.

    2. Without custom IpPoolAllocations from this IpPool (default)

      Do not edit/specify ip-allocations under any IpPool and add all the other resources like IpBlock, Tier0, etc in the spec to be imported

  • static routes and router ports to be imported for a tier 1 router.

    Do not change the `key` and `value` identifier in the spec, but only their assigned values. `Key` is the manager ID and value is the expected policy ID.

Refer to Resource Specification Order to see how shared resources should be specified in user-spec.yaml.

Steps to import shared resources

  1. Fill in the appropriate information in config.yaml and set import_shared_resources_only to True. See Sample config.yaml.
  2. Fill in the shared resources info in user-spec.yaml. See Sample user-spec.yaml.
  3. Run the mp_to_policy_importer using either the config file or command line arguments. For example:

    python3 --config-file config.yaml