Help Center/ Virtual Private Cloud/ API Reference/ FAQs/ What Are the Differences Between the VPC Subnet API and the OpenStack Neutron Subnet API?
Updated on 2024-10-31 GMT+08:00

What Are the Differences Between the VPC Subnet API and the OpenStack Neutron Subnet API?

Differences

Subnet APIs are classified into VPC subnet APIs and 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, e06cc6c0-6967-4e0c-af03-7be3b5546ddd.
  • The subnet ID used when calling the OpenStack Neutron subnet API is the subnet ID shown in Figure 1. For example, 97a14c19-fba4-46e3-9aab-60fae092aff7.

Example

The following queries subnet details to compare the difference.

VPC subnet API

GET /v1/049d06b7f20037e12f0dc0137381822f/subnets/e06cc6c0-6967-4e0c-af03-7be3b5546ddd
{
    "subnet": {
        "id": "e06cc6c0-6967-4e0c-af03-7be3b5546ddd",  //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": "e06cc6c0-6967-4e0c-af03-7be3b5546ddd",  //Correspond to the network ID on the management console.
        "neutron_subnet_id": "97a14c19-fba4-46e3-9aab-60fae092aff7",  //Correspond to the subnet ID on the management console.
        "extra_dhcp_opts": []
    }
}

OpenStack Neutron subnet API

GET /v2.0/subnets/97a14c19-fba4-46e3-9aab-60fae092aff7
{
    "subnet": {
        "name": "subnet-54eb",
        "cidr": "192.168.0.0/24",
        "id": "97a14c19-fba4-46e3-9aab-60fae092aff7",  //Correspond to the subnet ID on the management console.
        "enable_dhcp": true,
        "network_id": "e06cc6c0-6967-4e0c-af03-7be3b5546ddd",  //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"
    }
}