Creating Tier-0 VRF gateway using API call, the "edge-cluster" field is not auto-populated..
search cancel

Creating Tier-0 VRF gateway using API call, the "edge-cluster" field is not auto-populated..

book

Article ID: 421452

calendar_today

Updated On:

Products

VMware NSX

Issue/Introduction

When you are using API call to create the Tier-0 VRF, the "edge-cluster" field is not auto-populated. You are using the below API 

PUT https://<nsx-manager-fqdnornsx-manager-ip>/policy/api/v1/infra/tier-0s/<Vrf-Name>

Body

{
    "transit_subnets": [
        "100.64.0.0/16"
    ],
    "internal_transit_subnets": [
        "169.254.0.0/24"
    ],
    "ha_mode": "ACTIVE_ACTIVE",
    "vrf_config": {
        "tier0_path": "/infra/tier-0s/T0-gateway"
    }
}

Environment

VMware NSX 

Cause

Expected behavior with the API call, as when running the API the local-service is not started until we click on edit on the tier-0 VRF. 

Resolution

  • To resolve this issue use either of the workaround or use NSX UI to create the VRF. 
  • Method 1:
    ==========================================================================
    User can first create a T0 with API then create locale service under newly created VRFs using two payloads.
    a) Step 1: Create VRF with API payload:
    https://<nsx-manager-fqdnornsx-manager-ip>/policy/api/v1/infra/tier-0s/<VRF-name>
    {
     "display_name": "VRF-name",
      "vrf_config": {
        "tier0_path": "/infra/tier-0s/<Parent-T0-id>"
      }
    }

    b) Step 2: Create Locale Service with API payload:
    PATCH https://<mgr-ip>/policy/api/v1/infra/tier-0s/<VRF-id>/locale-services/<ls-id>
    {
      "edge_cluster_path": "/infra/sites/default/enforcement-points/default/edge-clusters/<edge-cluster-id>"
    }

    After completing both payloads, you can go to UI and do editing, if further editing is needed.
  • Method 2:
    ==========================================================================
    User can construct everything in one payload using H-API like this:
    PATCH https://<mgr-ip>/policy/api/v1/infra?enforce_revision_check=true
    {
      "resource_type": "Infra",
      "children": [
        {
          "Tier0": {
            "resource_type": "Tier0",
           "display_name": "VRF-name",
            "vrf_config": {
              "tier0_path": "/infra/tier-0s/<Parent-T0-id>"
            },
           "id": "VRF-name",
            "children": [
              {
                "LocaleServices": {
                  "resource_type": "LocaleServices",
                  "id": "default",
                  "edge_cluster_path": "/infra/sites/default/enforcement-points/default/edge-clusters/<edge-cluster-id>"
                },
                "resource_type": "ChildLocaleServices"
              }
            ]
          },
          "resource_type": "ChildTier0"
        }
      ]
    }

Additional Information

API guide https://developer.broadcom.com/xapis/nsx-t-data-center-rest-api/latest/method_CreateOrReplaceTier0.html