# Appendix - Service Chaining 1.0 alternate API instructions

{% hint style="info" %}
**Please Note:**

It is highly recommended to do these steps via the Prism Central UI. These instructions are shared as an appendix and were the original required method. Since Nutanix now allows this to be done in the PC UI, it is much simpler to just do it there unless you want to fully automate deployment processes programmatically in your environment.
{% endhint %}

## vSensor Deployment Step 3 Alternate API Instructions

This is an alternative API based approach to [3. Create network function provider category and value](#create-network-function-provider-category-and-value).&#x20;

In this section we will create the network function provider category, assign a value to the category, and then verify that assignment. This is done using v3 API calls against your Prism Central server. Some things to note:

### Step 3.1 - Create the `network_function_provider` category

```
PUT - https://{{pc_ip}}:9440/api/nutanix/v3/categories/network_function_provider
```

Body:

```
{ 
    "name": "network_function_provider" 
}
```

Response Example:

Description is an optional value that can be added similarly to how `name` was done in the above body):

```
{
     "system_defined": false,
     "name": "network_function_provider",
     "description": null
 }
```

### Step 3.2 - Assign a value to the category we just created

```
PUT - https://{{pc_ip}}:9440/api/nutanix/v3/categories/network_function_provider/vectra_vsensor
```

Body:

<pre><code>{
<strong>     "value": "vectra_vsensor" 
</strong>}
</code></pre>

Response Example:

<pre><code>{ 
    "system_defined": false, 
    "name": "network_function_provider", 
<strong>    "value": "vectra_vsensor", 
</strong>    "description": "for monitoring vendor" 
}
</code></pre>

In the above example, `vectra_vsensor` was chosen but this can be any name you desire. It is suggested that the name be the vendor’s name or application name of the network function VM.

### Step 3.3 - Verify the category and value for the network\_function\_provider

```
POST - https://{{pc_ip}}:9440/api/nutanix/v3/categories/network_function_provider/list
```

Body:

```
{
    "kind": "category"
}
```

Response Example:

<pre><code>{
    "api_version": "3.1",
    "metadata": {
        "total_matches": 2,
        "kind": "category",
        "length": 2,
        "offset": 0
    },
    "entities": [
        {
            "description": "",
<strong>            "value": "firewall",
</strong>            "system_defined": false
        },
        {
            "description": "",
<strong>            "value": "vectra_vsensor",
</strong>            "system_defined": false
        }
    ]
}
</code></pre>

In this response example there are two `network_function_provider` categories, `firewall` and `vectra_vsensor`. Your environment may have multiple categories in use already or none, in our example we are using `vectra_vsensor` .

## vSensor Deployment Step 4 Alternate API Instructions

In order to create a network function chain in the next step, we first need to retrieve the `name` and `UUID` of the AHV cluster where you will deploy the vSensor and network function chain. This is **NOT** your Prism Central server.

```
POST - https://{{pc_ip}}:9440/api/nutanix/v3/clusters/list
```

Body:

```
{
    "kind": "cluster"
}
```

Abbreviated response example:

<pre><code>.
.
.
            "spec": {
<strong>                "name": "nutanix2",
</strong>                "resources": {
                    "config": {
                        "software_map": {
.
.
.
"metadata": {
                "last_update_time": "2022-06-15T17:59:38Z",
                "kind": "cluster",
<strong>                "uuid": "0005dd45-7584-73d2-07af-52540083d046",
</strong>                "spec_version": 0,
                "creation_time": "2022-06-15T17:59:38Z",
                "categories_mapping": {},
                "categories": {}
.
.
.
</code></pre>

## vSensor Deployment Step 6 Alternate API Instructions

This is an alternative API based approach to the later parts of [6. Update the Powered off VM Using Both the ACLI and Prism Central UI](#update-the-powered-off-vm-using-both-the-acli-and-prism-central-ui).

### Step 6.2 - Get the UUID of the network function VM (vSensor)

<pre><code>&#x3C;acropolis> vm.list
VM name                    VM UUID
PC01                       001ea51a-a84c-4484-ac6c-aa6dd5a4ce17
debian_vm                  97ffead9-58e0-4c09-9dac-ec3faafbf5b7
debian_vm_demo             7b2591ec-b673-43a7-94c0-fc11f47d26c5
<strong>vSensor-Demo               9e15edae-3b57-4886-9b8d-3e77b79dcb45
</strong>vectra vsensor api test    8896756f-4eba-43f5-80ab-d3353acd7bc9
vectra_vsensor_chain_test  90893122-046b-447d-b02d-246f9843ddb3
</code></pre>

### Step 6.3 - GET all values for all parameters of the network function VM (vSensor)

Any REST API call that updates an existing entity requires that you perform a `GET` on the value before updating it to retrieve the most current value of the spec. Failure to get the most recent spec before an update will lead to failed tasks in Prism Central.

In our demo example, the vSensor we are using is `vSensor-Demo` so we will make the API call for that VM `UUID` with an empty body. The response example is an abbreviated response and only includes the `spec` portion of the response. This `spec` portion of the response will need to be modified to be used as the body of the `PUT` API call in the next step. See step 6.4 below for more details.

```
GET - https://{{pc_ip}}:9440/api/nutanix/v3/vms/9e15edae-3b57-4886-9b8d-3e77b79dcb45
```

Abbreviated response example (already modified to be the body of the PUT in the next step):

<pre><code>{
    "spec": {
        "name": "vSensor-Demo",
        "resources": {
            "num_threads_per_core": 1,
            "vnuma_config": {
                "num_vnuma_nodes": 0
            },
            "serial_port_list": [],
            "nic_list": [
                {
                    "nic_type": "NORMAL_NIC",
                    "uuid": "58e9b04c-b5d6-4aa7-8619-14247af5c285",
                    "ip_endpoint_list": [],
                    "vlan_mode": "ACCESS",
                    "mac_address": "50:6b:8d:dd:a9:7d",
                    "subnet_reference": {
                        "kind": "subnet",
                        "name": "default",
                        "uuid": "56deddea-3df9-47a0-ab9a-45348673b261"
                    },
                    "is_connected": true,
                    "trunked_vlan_list": []
                },
                {
                    "nic_type": "NETWORK_FUNCTION_NIC",
                    "uuid": "2bdd5afe-b39b-4a08-8547-036ecf32ce7e",
                    "network_function_nic_type": "TAP",
                    "vlan_mode": "ACCESS",
                    "mac_address": "50:6b:8d:e0:bd:bc",
                    "is_connected": true,
                    "trunked_vlan_list": []
                }
            ],
            "num_vcpus_per_socket": 1,
            "num_sockets": 2,
            "disable_branding": false,
            "enable_cpu_passthrough": false,
            "gpu_list": [],
            "is_agent_vm": true,
            "memory_size_mib": 8192,
            "boot_config": {
                "boot_device_order_list": [
                    "CDROM",
                    "DISK",
                    "NETWORK"
                ],
                "boot_type": "LEGACY"
            },
            "hardware_clock_timezone": "UTC",
            "power_state_mechanism": {},
            "power_state": "OFF",
            "machine_type": "PC",
            "vga_console_enabled": true,
            "disk_list": [
                {
                    "uuid": "17f43679-913c-4d8c-8f91-55158b7df1ec",
                    "disk_size_bytes": 107374182400,
                    "storage_config": {
                        "storage_container_reference": {
                            "kind": "storage_container",
                            "uuid": "4adfaee8-5d13-43d0-9e2c-0acb78c20bf3",
                            "name": "default-container-36061588278502"
                        }
                    },
                    "device_properties": {
                        "disk_address": {
                            "device_index": 0,
                            "adapter_type": "SCSI"
                        },
                        "device_type": "DISK"
                    },
                    "data_source_reference": {
                        "kind": "image",
                        "uuid": "49c30577-d09f-4df0-8308-9f631127cad8"
                    },
                    "disk_size_mib": 102400
                },
                {
                    "uuid": "c2817978-d7a7-4bd7-80ef-eb6c14daa7ac",
                    "disk_size_bytes": 377856,
                    "storage_config": {
                        "storage_container_reference": {
                            "kind": "storage_container",
                            "uuid": "4adfaee8-5d13-43d0-9e2c-0acb78c20bf3",
                            "name": "default-container-36061588278502"
                        }
                    },
                    "device_properties": {
                        "disk_address": {
                            "device_index": 0,
                            "adapter_type": "IDE"
                        },
                        "device_type": "CDROM"
                    },
                    "data_source_reference": {
                        "kind": "image",
                        "uuid": "7845607e-2f43-4ba1-a87c-f0a8d2b9e7cb"
                    },
                    "disk_size_mib": 1
                }
            ]
        },
        "cluster_reference": {
            "kind": "cluster",
            "name": "nutanix2",
            "uuid": "0005dd45-7584-73d2-07af-52540083d046"
        }
    },
    "api_version": "3.1",
    "metadata": {
        "last_update_time": "2022-08-22T17:14:43Z",
        "kind": "vm",
        "uuid": "9e15edae-3b57-4886-9b8d-3e77b79dcb45",
        "project_reference": {
            "kind": "project",
            "name": "default",
            "uuid": "6ec5e4cf-81da-4c2e-8ee2-efa5bbf522f1"
        },
        "creation_time": "2022-08-16T19:41:12Z",
        "spec_version": 5,
        "categories_mapping": {
            "network_function_provider": [
                "vectra_vsensor"
            ]
        },
        "entity_version": "5",
        "owner_reference": {
            "kind": "user",
            "uuid": "00000000-0000-0000-0000-000000000000",
            "name": "admin"
        },
<strong>        "categories": {
</strong><strong>            "network_function_provider": "vectra_vsensor"
</strong>        }
    }
}
</code></pre>

{% hint style="info" %}
**Please Note:**

The initial get is not expected to return a value under `categories`.
{% endhint %}

### Step 6.4 - Add the network function provider category and value to the vSensor VM specifications.

Only the `spec` and `metadata` portions of the response from step 6.3 are shown below. The `metadata`  section needs to be modified to add the network function provider category and value to the VM specification near the bottom of the response.

{% hint style="warning" %}
**Please Note:**

Copy both the `spec` and `metadata` and modify only the `metadata` portion of the repsonse from step 6.3. Do not copy any of the other response sections. If the format is not set correctly then the API call will fail to execute, and you may get a `422 “Additional properties are not allowed…”` error message.
{% endhint %}

We modified the `metadata` portion of the response above by adding the following category and value that we created earlier:

<pre><code>         ,
        "categories": {
<strong>            "network_function_provider": "vectra_vsensor"
</strong>        }
</code></pre>

Then we use the PUT below with the PC API to add this to the VM specification of the network function VM (vSensor).

```
PUT - https://{{pc_ip}}:9440/api/nutanix/v3/vms/9e15edae-3b57-4886-9b8d-3e77b79dcb45
```

Body:

Use the `spec` and modified `metadata` portions of the response from step 6.3 as the body.

Abbreviated response example (we are only showing that it is `PENDING` and you can check the task status):

<pre><code>{
    "status": {
        "state": "PENDING",
        "execution_context": {
<strong>            "task_uuid": "fbca45b1-f8ab-451a-9758-b62e1026435e"
</strong>        }
    },
</code></pre>

## vSensor Deployment Step 7 Alternate API Instructions

This is an alternative API based approach to [7. Direct Traffic to the Configured Network Function Chain](#direct-traffic-to-the-configured-network-function-chain). These instructions were the original required method but remain if you want to fully automate deployment processes programmatically in your environment.

### Step 7.1 - List Available Networks (Subnets)

In this step we will obtain the UUID of a subnet that should be directed through the network function chain.

{% hint style="info" %}
**Please Note:**&#x20;

The Prism Central v3 api defaults to returning a maximum of 20 results unless the body or the request is modified to include `length` and `offset` parameters which can also be used to paginate results. Our example below does not include these parameters and just uses a default query.

* Up to 500 subnet entities (0-499 for example) can be retrieved by a single query by using a length of 500 and an offset of 0.

* `total_matches` will also return the total number of subnets available.&#x20;
  {% endhint %}

* The Prism Central UI can also show the total number of subnets:

![](https://content.gitbook.com/content/HJ1ltuWFvsArFWtevnRn/blobs/qTwvwfknDWsqgIwgZ9E5/Nutanix_vSensor_Deployment_Guide-2025_Nov_6-22.png)

* Nutanix provides more detail about how these parameters work, along with examples in this [KB article](https://www.nutanix.dev/2019/06/13/the-five-hundred-500-vms-via-v3-api/).

```
POST - https://{{pc_ip}}:9440/api/nutanix/v3/subnets/list
```

Body:

```
{
    "kind": "subnet"
}
```

Response Example:

Our example contains only one `default-subnet` entity, but customer deployments will typically have many subnets. Find the UUIDs for all subnets that you wish to have mapped to the network function chain. Each node in the cluster will forward traffic they see on these subnets to the vSensor VMs.

<pre><code>{
    "api_version": "3.1",
    "metadata": {
        "kind": "subnet",
        "offset": 0,
        "length": 1,
        "total_matches": 1
    },
    "entities": [
        {
            "status": {
                "name": "default-subnet",
                "cluster_reference": {
                    "kind": "cluster",
                    "name": "nutanix2",
                    "uuid": "000639fc-7386-2da4-7938-bc2411a17fee"
                },
                "resources": {
                    "virtual_switch_uuid": "7925c9f7-c20f-44a8-b4e3-e4067048a755",
                    "vswitch_name": "br0",
                    "network_function_chain_reference": {
                        "kind": "network_function_chain",
                        "uuid": "9385b9d5-d2cf-4039-b3b1-45f5ef744e1a"
                    },
                    "vlan_id": 0,
                    "subnet_type": "VLAN",
                    "ip_usage_stats": {
                        "num_macs": 5
                    }
                },
                "state": "COMPLETE",
                "execution_context": {
                    "task_uuid": [
                        "8171576a-6bc5-4bc1-b191-2ba6a8cb2f42"
                    ]
                }
            },
            "metadata": {
<strong>                "uuid": "f5d8c6bb-8ad9-42c5-b977-8bafbba10b81",
</strong>                "spec_hash": "00000000000000000000000000000000000000000000000000",
                "spec_version": 2,
                "owner_reference": {
                    "kind": "user",
                    "uuid": "71f50668-79f9-50d4-8dec-eaaf5a411f36",
                    "name": "tbilen"
                },
                "categories": {},
                "categories_mapping": {},
                "creation_time": "2025-09-10T20:39:29Z",
                "last_update_time": "2025-09-15T21:25:45Z",
                "kind": "subnet"
            },
            "spec": {
                "resources": {
                    "subnet_type": "VLAN",
                    "vswitch_name": "br0",
                    "network_function_chain_reference": {
                        "kind": "network_function_chain",
                        "uuid": "9385b9d5-d2cf-4039-b3b1-45f5ef744e1a"
                    },
                    "vlan_id": 0,
                    "virtual_switch_uuid": "7925c9f7-c20f-44a8-b4e3-e4067048a755"
                },
                "cluster_reference": {
                    "kind": "cluster",
                    "name": "nutanix2",
                    "uuid": "000639fc-7386-2da4-7938-bc2411a17fee"
                },
                "name": "default-subnet"
            }
        }
    ]
}
</code></pre>

### Step 7.2 - Get the Subnet Details Using the Retrieved UUID

Use an empty body in your request.

```
https://{{pc_ip}}:9440/api/nutanix/v3/subnets/f5d8c6bb-8ad9-42c5-b977-8bafbba10b81
```

Response Example:

<pre><code><strong>{
</strong><strong>    "api_version": "3.1",
</strong><strong>    "metadata": {
</strong><strong>        "last_update_time": "2025-09-15T21:25:45Z",
</strong><strong>        "kind": "subnet",
</strong><strong>        "uuid": "f5d8c6bb-8ad9-42c5-b977-8bafbba10b81",
</strong><strong>        "spec_version": 2,
</strong><strong>        "creation_time": "2025-09-10T20:39:29Z",
</strong><strong>        "categories_mapping": {},
</strong><strong>        "categories": {},
</strong><strong>        "owner_reference": {
</strong><strong>            "kind": "user",
</strong><strong>            "uuid": "71f50668-79f9-50d4-8dec-eaaf5a411f36",
</strong><strong>            "name": "tbilen"
</strong><strong>        },
</strong><strong>        "spec_hash": "00000000000000000000000000000000000000000000000000"
</strong><strong>    },
</strong><strong>    "spec": {
</strong><strong>        "resources": {
</strong><strong>            "subnet_type": "VLAN",
</strong><strong>            "vswitch_name": "br0",
</strong><strong>            "vlan_id": 0,
</strong><strong>            "virtual_switch_uuid": "7925c9f7-c20f-44a8-b4e3-e4067048a755"
</strong><strong>        },
</strong><strong>        "cluster_reference": {
</strong><strong>            "kind": "cluster",
</strong><strong>            "name": "nutanix2",
</strong><strong>            "uuid": "000639fc-7386-2da4-7938-bc2411a17fee"
</strong><strong>        },
</strong><strong>        "name": "default-subnet"
</strong><strong>    },
</strong>    "status": {
        "name": "default-subnet",
        "cluster_reference": {
            "kind": "cluster",
            "name": "nutanix2",
            "uuid": "000639fc-7386-2da4-7938-bc2411a17fee"
        },
        "resources": {
            "virtual_switch_uuid": "7925c9f7-c20f-44a8-b4e3-e4067048a755",
            "vswitch_name": "br0",
            "network_function_chain_reference": {
                "kind": "network_function_chain",
                "uuid": "9385b9d5-d2cf-4039-b3b1-45f5ef744e1a"
            },
            "vlan_id": 0,
            "subnet_type": "VLAN",
            "ip_usage_stats": {
                "num_macs": 5
            }
        },
        "state": "COMPLETE",
        "execution_context": {
            "task_uuid": [
                "8171576a-6bc5-4bc1-b191-2ba6a8cb2f42"
            ]
        }
    }
}
</code></pre>

### Step 7.3 - Update the Subnet to Reference the Network Function Chain

The `spec` and `metadata` portions (highlighted above) of the response from step 7.2 need to be copied, modified, and then used as the body of the `PUT` in this step to update the subnet to point to the network function chain. It is suggested to use an API client that enforces proper json formatting to make the modifications. Some options were given [Guidance for using the Nutanix Prism Central REST API](#_Guidance_for_using). Note that an extra brace needed to be added to the body at the bottom after copying from above.

The `spec` portion of the response you copied must be modified to include the NFC reference. This should be done within the `resources` section of the `spec` portion of the body.

```
PUT - https://{{pc_ip}}:9440/api/nutanix/v3/subnets/b9aa1db8-47fd-4f39-9b97-d4aeb3d621c3
```

Body:

<pre><code>`{
    "api_version": "3.1",
    "metadata": {
        "kind": "subnet",
        "uuid": "f5d8c6bb-8ad9-42c5-b977-8bafbba10b81",
        "categories": {},
        "categories_mapping": {},
        "creation_time": "2025-09-10T20:39:29Z",
        "last_update_time": "2025-09-10T20:39:29Z",
        "spec_hash": "00000000000000000000000000000000000000000000000000",
        "spec_version": 0
    },
    "spec": {
        "resources": {
            "subnet_type": "VLAN",
            "vswitch_name": "br0",
<strong>            "network_function_chain_reference": {
</strong><strong>                "kind": "network_function_chain",
</strong><strong>                "name": "vectra_tap",
</strong><strong>                "uuid": "9385b9d5-d2cf-4039-b3b1-45f5ef744e1a"
</strong><strong>            },
</strong>            "vlan_id": 0,
            "virtual_switch_uuid": "7925c9f7-c20f-44a8-b4e3-e4067048a755"
        },
        "cluster_reference": {
            "kind": "cluster",
            "name": "nutanix2",
            "uuid": "000639fc-7386-2da4-7938-bc2411a17fee"
        },
        "name": "default-subnet"
    }
<strong>}
</strong></code></pre>

Response example:

<pre><code>{
    "metadata": {
        "last_update_time": "2025-09-10T20:39:29Z",
        "use_categories_mapping": false,
        "kind": "subnet",
        "uuid": "f5d8c6bb-8ad9-42c5-b977-8bafbba10b81",
        "spec_version": 2,
        "creation_time": "2025-09-10T20:39:29Z",
        "spec_hash": "00000000000000000000000000000000000000000000000000",
        "categories_mapping": {},
        "categories": {}
    },
    "api_version": "3.1",
    "spec": {
        "resources": {
            "subnet_type": "VLAN",
            "vswitch_name": "br0",
<strong>            "network_function_chain_reference": {
</strong><strong>                "kind": "network_function_chain",
</strong><strong>                "name": "vectra_tap",
</strong><strong>                "uuid": "9385b9d5-d2cf-4039-b3b1-45f5ef744e1a"
</strong>            },
            "vlan_id": 0,
            "virtual_switch_uuid": "7925c9f7-c20f-44a8-b4e3-e4067048a755"
        },
        "cluster_reference": {
            "kind": "cluster",
            "name": "nutanix2",
            "uuid": "000639fc-7386-2da4-7938-bc2411a17fee"
        },
        "name": "default-subnet"
    },
    "status": {
        "state": "PENDING",
        "execution_context": {
            "task_uuid": "9dd87309-bcd8-4497-9237-029b57f4f28e"
        }
    }
} 
</code></pre>
