• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Neutron
  5. Subnets
  6. Update subnet

Update subnet

Function Description

This interface is used to update a subnet.

Interface Format

Method

URI

Description

PUT

/v2.0/subnets/{subnet-id}

Updates a subnet.

Restrictions

When updating the allocation_pools field, neither gateway nor broadcast IP addresses can be included.

Request Parameter

Parameter

Type

Mandatory

Description

subnet

dict

Yes

Specifies the subnet object. For details, see Table 1.

This parameter has no mandatory fields. You must specify at least one attribute when updating the subnet.

Response Parameter

Parameter

Type

Mandatory

Description

subnet

dict

Yes

Specifies the subnet object. For details, see Table 1.

Request Example

PUT /v2.0/subnets/907c9a08-7b14-4863-9d9c-9f6b93fa987a
{
    "subnet": {
        "name": "testsubnet",
        "dns_nameservers": [
            "1.1.1.1",
            "2.2.2.2"
        ],
        "enable_dhcp": true
    }
}

Response Example

{
    "subnet": {
        "name": "testsubnet",
        "enable_dhcp": true,
        "network_id": "9daeac7c-a98f-430f-8e38-67f9c044e299",
        "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f",
        "dns_nameservers": [
            "1.1.1.1",
            "2.2.2.2"
        ],
        "allocation_pools": [
            {
                "start": "10.0.10.2",
                "end": "10.0.10.254"
            }
        ],
        "host_routes": [],
        "ip_version": 4,
        "gateway_ip": "10.0.10.1",
        "cidr": "10.0.10.0/24",
        "id": "907c9a08-7b14-4863-9d9c-9f6b93fa987a"
    }
}

Error Code

See section Return Code Processing.