Help Center> Virtual Private Cloud> API Reference> FAQs> What Is the Difference Between the VPC Subnet API and the OpenStack Neutron Subnet API?
Updated on 2022-09-13 GMT+08:00

What Is the Difference Between the VPC Subnet API and the OpenStack Neutron Subnet API?

Difference

Subnet APIs are classified into VPC subnet APIs and OpenStack Neutron subnet APIs. They can create, query, update, and delete subnets.

The differences between the two are the meanings of the network ID and subnet ID.

Log in to the management console and view the basic information about the subnet. Network ID and Subnet ID are displayed.

Figure 1 Basic subnet information
  • The subnet ID used when calling the VPC subnet API is the network ID shown in Figure 1. For example, a22724a0-b77b-44b4-b731-afd3a4839863.
  • The subnet ID used when calling the OpenStack Neutron subnet API is the subnet ID shown in Figure 1. For example, f32a3acf-2312-41d0-947c-13d377a35059.

Example

The following queries subnet details to compare the difference.

VPC subnet API

GET /v1/049d06b7f20037e12f0dc0137381822f/subnets/a22724a0-b77b-44b4-b731-afd3a4839863
{
    "subnet": {
        "id": "a22724a0-b77b-44b4-b731-afd3a4839863",  //Correspond to the network ID on the management console.
        "name": "subnet-54eb",
        "description": "",
        "cidr": "192.168.0.0/24",
        "dnsList": [
            "100.125.1.202",
            "100.125.1.230"
        ],
        "status": "ACTIVE",
        "tags": [],
        "vpc_id": "f4d0ebd4-2a62-4396-980b-96e73b3386de",
        "ipv6_enable": false,
        "gateway_ip": "192.168.0.1",
        "dhcp_enable": true,
        "primary_dns": "100.125.1.202",
        "secondary_dns": "100.125.1.230",
        "availability_zone": "az1.dc1",
        "neutron_network_id": "a22724a0-b77b-44b4-b731-afd3a4839863",  //Correspond to the network ID on the management console.
        "neutron_subnet_id": "f32a3acf-2312-41d0-947c-13d377a35059",  //Correspond to the subnet ID on the management console.
        "extra_dhcp_opts": []
    }
}

OpenStack Neutron subnet API

GET /v2.0/subnets/f32a3acf-2312-41d0-947c-13d377a35059
{
    "subnet": {
        "name": "subnet-54eb",
        "cidr": "192.168.0.0/24",
        "id": "f32a3acf-2312-41d0-947c-13d377a35059",  //Correspond to the subnet ID on the management console.
        "enable_dhcp": true,
        "network_id": "a22724a0-b77b-44b4-b731-afd3a4839863",  //Correspond to the network ID on the management console.
        "tenant_id": "049d06b7f20037e12f0dc0137381822f",
        "project_id": "049d06b7f20037e12f0dc0137381822f",
        "dns_nameservers": [
            "100.125.1.202",
            "100.125.1.230"
        ],
        "allocation_pools": [
            {
                "start": "192.168.0.2",
                "end": "192.168.0.252"
            }
        ],
        "host_routes": [],
        "ip_version": 4,
        "gateway_ip": "192.168.0.1",
        "created_at": "2019-04-09T08:03:58",
        "updated_at": "2019-04-09T08:03:59"
    }
}