Update subnet

 
MethodURIDescription
PUT/v2.0/subnets/{subnet_id}

Updates a specified subnet.

Some attributes, such as IP version (ip_version), CIDR (cidr), and IP allocation pools (allocation_pools) cannot be updated. Attempting to update these attributes results in a 400 Bad Request error.

Normal response codes: 201

Error response codes: badRequest (400), unauthorized (401), forbidden (403), itemNotFound (404)

 Request

This table shows the URI parameters for the update subnet request:

NameTypeDescription

{subnet_id}

​U​U​ID

The UUID for the subnet of interest to you.

 

Example 3.29. Update subnet: JSON request

{
   "subnet":{
      "subnet":{
         "name":"my_subnet"
      }
   }
}

 

Example 3.30. Update subnet: XML request

<?xml version="1.0" encoding="UTF-8"?>
<subnet>
    <name>my_subnet</name>
</subnet>

This operation does not require a request body.

 Response

 

Example 3.31. Update subnet: JSON response

{
   "subnet":{
      "name":"private-subnet",
      "enable_dhcp":true,
      "network_id":"db193ab3-96e3-4cb3-8fc5-05f4296d0324",
      "tenant_id":"26a7980765d0414dbc1fc1f88cdb7e6e",
      "dns_nameservers":[

      ],
      "allocation_pools":[
         {
            "start":"10.0.0.2",
            "end":"10.0.0.254"
         }
      ],
      "host_routes":[

      ],
      "ip_version":4,
      "gateway_ip":"10.0.0.1",
      "cidr":"10.0.0.0/24",
      "id":"08eae331-0402-425a-923c-34f7cfe39c1b"
   }
}

 

Example 3.32. Update subnet: XML response

<?xml version='1.0' encoding='UTF-8'?>
<subnet xmlns="http://openstack.org/quantum/api/v2.0"
    xmlns:quantum="http://openstack.org/quantum/api/v2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <name>my_subnet</name>
    <enable_dhcp quantum:type="bool">True</enable_dhcp>
    <network_id>d32019d3-bc6e-4319-9c1d-6722fc136a22</network_id>
    <tenant_id>4fd44f30292945e481c7b8a0c8908869</tenant_id>
    <dns_nameservers quantum:type="list"/>
    <allocation_pools>
        <allocation_pool>
            <start>192.0.0.2</start>
            <end>192.255.255.254</end>
        </allocation_pool>
    </allocation_pools>
    <host_routes quantum:type="list"/>
    <ip_version quantum:type="long">4</ip_version>
    <gateway_ip>192.0.0.1</gateway_ip>
    <cidr>192.0.0.0/8</cidr>
    <id>54d6f61d-db07-451c-9ab3-b9609b6b6f0b</id>
</subnet>

This operation does not return a response body.

Questions? Discuss on ask.openstack.org
Found an error? Report a bug against this page


loading table of contents...