1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
|
.. -*- rst -*-
=======
Subnets
=======
Lists, shows details for, creates, updates, and deletes subnet
resources.
Default subnetpool extension
============================
The default subnetpool extension (``default-subnetpools``) allows
administrative users to specify default subnetpools (one per
IP version). Then users can specify the ``use_default_subnetpool``
attribute when creating a subnet, instead of having to specify the
``subnetpool_id`` attribute referencing the default subnetpool.
Resource timestamps
===================
The ``standard-attr-timestamp`` extension adds the ``created_at`` and
``updated_at`` attributes to all resources that have standard attributes.
Subnet allocation extension
===========================
Subnet allocation extension (``subnet_allocation``) enables allocation of
subnets from a subnet pool.
Subnet DNS publish fixed IP extension
=====================================
The ``subnet-dns-publish-fixed-ip`` extension adds the ``dns_publish_fixed_ip``
attribute to subnets. It allows to select per subnet whether DNS records
for fixed IPs are to be published in an external DNS service.
Segment extension
=================
The `Segments`_ (``segment``) extension makes it possible to associate a
subnet with a specific L2 segment on the network, instead of spanning all the
segments in the network. The association between network and subnet remains,
but an optional ``segment_id`` field is added to the subnet so that it can be
associated with a particular segment on the network. With multiple subnets on a
network the ``segment_id`` is used to determine if the subnets are l2-adjacent
or not. Subnets within a network are either all associated to segments, or
none of them are associated to segments.
Subnet segment_id writable extension
====================================
The subnet segment_id writable (``subnet-segmentid-writable``) extension
enhances the `Segments`_ (``segment``) extension in that now the ``segment_id``
attribute is also available for write when a subnet is updated.
Segment peer subnet host routes extension
=========================================
The segment peer subnet host routes extension (
``segments-peer-subnet-host-routes``) extension enhances the `Segments`_
(``segment``) extension in that now the ``host_routes`` property of the
different `Subnets`_ (``subnets``) in a routed network gets routes to the peer
subnets on different segments added automatically. This ensures that traffic
within an L3 routed network stays within the network even when the default
route is on a different host interface.
Subnet service types extension
==============================
Subnet service types extension (``subnet-service-types``) allows administrative
users to set the desired port types for a subnet by adding the
``service_types`` attributes to ``subnets``.
(For example, the ``network:floatingip_agent_gateway`` service type enables
DVR floating IP agent gateway ports to use the subnet to minimize public
IP address consumption).
Tag extension
=============
The ``standard-attr-tag`` adds Tag support for resources with
standard attributes by adding the ``tags`` attribute
allowing consumers to associate tags with resources.
List subnets
============
.. rest_method:: GET /v2.0/subnets
Lists subnets that the project has access to.
Default policy settings return only subnets owned by the
project of the user submitting the request, unless the
user has administrative role. You can control which attributes
are returned by using the fields query parameter. You can filter
results by using query string parameters.
.. include:: filtering-list.inc
Normal response codes: 200
Error response codes: 401
Request
-------
.. rest_parameters:: parameters.yaml
- id: id-query
- tenant_id: project_id-query
- project_id: project_id-query
- name: name-query
- enable_dhcp: subnet-enable_dhcp-query
- network_id: subnet-network_id-query
- ip_version: subnet-ip_version-query
- gateway_ip: subnet-gateway_ip-query
- cidr: cidr-query
- description: description-query
- ipv6_address_mode: subnet-ipv6_address_mode-query
- ipv6_ra_mode: subnet-ipv6_ra_mode-query
- revision_number: revision_number-query
- segment_id: subnet-segment_id-query
- shared: shared-query
- sort_dir: sort_dir
- sort_key: subnet-sort_key
- subnetpool_id: subnet-subnetpool_id-query
- tags: tags-query
- tags-any: tags-any-query
- not-tags: not-tags-query
- not-tags-any: not-tags-any-query
- dns_publish_fixed_ip: subnet-dns_publish_fixed_ip-query
- fields: fields
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- subnets: subnets-obj
- id: subnet-id-body
- tenant_id: project_id
- project_id: project_id
- name: subnet-name
- enable_dhcp: subnet-enable_dhcp
- network_id: subnet-network_id
- dns_nameservers: subnet-dns_nameservers
- allocation_pools: subnet-allocation_pools
- host_routes: subnet-host_routes
- ip_version: subnet-ip_version
- gateway_ip: subnet-gateway_ip
- cidr: cidr
- created_at: created_at_resource
- description: description
- ipv6_address_mode: subnet-ipv6_address_mode
- ipv6_ra_mode: subnet-ipv6_ra_mode
- revision_number: revision_number
- segment_id: subnet-segment_id
- service_types: subnet-service_types
- subnetpool_id: subnet-subnetpool_id
- updated_at: updated_at_resource
- tags: tags
- dns_publish_fixed_ip: subnet-dns_publish_fixed_ip
- router:external: subnet-router:external
Response Example
----------------
.. literalinclude:: samples/subnets/subnets-list-response.json
:language: javascript
Create subnet
=============
.. rest_method:: POST /v2.0/subnets
Creates a subnet on a network.
OpenStack Networking does not try to derive the correct IP version
from the CIDR. If you do not specify the ``gateway_ip`` attribute,
OpenStack Networking allocates an address from the CIDR for the
gateway for the subnet.
To specify a subnet without a gateway, set the ``gateway_ip``
attribute to ``null`` in the request body. If you do not specify
the ``allocation_pools`` attribute, OpenStack Networking
automatically allocates pools for covering all IP addresses in the
CIDR, excluding the address reserved for the subnet gateway.
Otherwise, you can explicitly specify allocation pools as shown in
the following example.
When you specify both the ``allocation_pools`` and ``gateway_ip``
attributes, you must ensure that the gateway IP does not overlap
with the allocation pools; otherwise, the call returns the
``Conflict (409)`` response code.
A subnet can have one or more name servers and host routes. Hosts
in this subnet use the name servers. Devices with IP addresses from
this subnet, not including the local subnet route, use the host
routes.
Specify the ``ipv6_ra_mode`` and ``ipv6_address_mode`` attributes
to create subnets that support IPv6 configurations, such as
stateless address autoconfiguration (SLAAC), DHCPv6 stateful, and
DHCPv6 stateless configurations.
A subnet can optionally be associated with a network segment when
it is created by specifying the ``segment_id`` of a valid segment
on the specified network. A network with subnets associated in this
way is called a routed network. On any given network, all of the
subnets must be associated with segments or none of them can be.
Neutron enforces this invariant. Currently, routed networks are
only supported for provider networks.
.. note::
Creating a subnet does not always result in an automatic port update
for the ports which are already bound on the network.
For details see:
https://docs.openstack.org/neutron/latest/admin/config-ipv6.html#address-modes-for-ports
Normal response codes: 201
Error response codes: 400, 401, 403, 404, 409
Request
-------
.. rest_parameters:: parameters.yaml
- subnet: subnet-obj
- tenant_id: project_id-request
- project_id: project_id-request
- name: subnet-name-request
- enable_dhcp: subnet-enable_dhcp-request
- network_id: subnet-network_id
- dns_nameservers: subnet-dns_nameservers-request
- allocation_pools: subnet-allocation_pools-request
- host_routes: subnet-host_routes-request
- ip_version: subnet-ip_version
- gateway_ip: subnet-gateway_ip-request
- cidr: cidr
- prefixlen: subnet-prefixlen-request
- description: description-request
- ipv6_address_mode: subnet-ipv6_address_mode-request
- ipv6_ra_mode: subnet-ipv6_ra_mode-request
- segment_id: subnet-segment_id-request
- subnetpool_id: subnet-subnetpool_id-request
- use_default_subnetpool: use_default_subnetpool
- service_types: subnet-service_types-optional
- dns_publish_fixed_ip: subnet-dns_publish_fixed_ip-request
Request Example
---------------
.. literalinclude:: samples/subnets/subnet-create-request.json
:language: javascript
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- subnet: subnet-obj
- id: subnet-id-body
- tenant_id: project_id
- project_id: project_id
- name: subnet-name
- enable_dhcp: subnet-enable_dhcp
- network_id: subnet-network_id
- dns_nameservers: subnet-dns_nameservers
- allocation_pools: subnet-allocation_pools
- host_routes: subnet-host_routes
- ip_version: subnet-ip_version
- gateway_ip: subnet-gateway_ip
- cidr: cidr
- created_at: created_at_resource
- description: description
- ipv6_address_mode: subnet-ipv6_address_mode
- ipv6_ra_mode: subnet-ipv6_ra_mode
- revision_number: revision_number
- service_types: subnet-service_types
- subnetpool_id: subnet-subnetpool_id
- segment_id: subnet-segment_id
- updated_at: updated_at_resource
- tags: tags
- dns_publish_fixed_ip: subnet-dns_publish_fixed_ip
- router:external: subnet-router:external
Response Example
----------------
.. literalinclude:: samples/subnets/subnet-create-response.json
:language: javascript
Bulk create subnet
==================
.. rest_method:: POST /v2.0/subnets
Creates multiple subnets in a single request. Specify a list of subnets in the request body.
The bulk create operation is always atomic. Either all or no
subnets in the request body are created.
Normal response codes: 201
Error response codes: 400, 401, 403, 404, 409
Request
-------
.. rest_parameters:: parameters.yaml
- subnets: subnets-obj
- tenant_id: project_id-request
- project_id: project_id-request
- name: subnet-name-request
- enable_dhcp: subnet-enable_dhcp-request
- network_id: subnet-network_id
- dns_nameservers: subnet-dns_nameservers-request
- allocation_pools: subnet-allocation_pools-request
- host_routes: subnet-host_routes-request
- ip_version: subnet-ip_version
- gateway_ip: subnet-gateway_ip-request
- cidr: cidr
- prefixlen: subnet-prefixlen-request
- description: description-request
- ipv6_address_mode: subnet-ipv6_address_mode-request
- ipv6_ra_mode: subnet-ipv6_ra_mode-request
- segment_id: subnet-segment_id-request
- subnetpool_id: subnet-subnetpool_id-request
- use_default_subnetpool: use_default_subnetpool
- service_types: subnet-service_types-optional
- dns_publish_fixed_ip: subnet-dns_publish_fixed_ip-request
Request Example
---------------
.. literalinclude:: samples/subnets/subnets-create-bulk-request.json
:language: javascript
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- subnets: subnets-obj
- id: subnet-id-body
- tenant_id: project_id
- project_id: project_id
- name: subnet-name
- enable_dhcp: subnet-enable_dhcp
- network_id: subnet-network_id
- dns_nameservers: subnet-dns_nameservers
- allocation_pools: subnet-allocation_pools
- host_routes: subnet-host_routes
- ip_version: subnet-ip_version
- gateway_ip: subnet-gateway_ip
- cidr: cidr
- created_at: created_at_resource
- description: description
- ipv6_address_mode: subnet-ipv6_address_mode
- ipv6_ra_mode: subnet-ipv6_ra_mode
- revision_number: revision_number
- segment_id: subnet-segment_id
- service_types: subnet-service_types
- subnetpool_id: subnet-subnetpool_id
- updated_at: updated_at_resource
- tags: tags
- dns_publish_fixed_ip: subnet-dns_publish_fixed_ip
- router:external: subnet-router:external
Response Example
----------------
.. literalinclude:: samples/subnets/subnets-create-bulk-response.json
:language: javascript
Show subnet details
===================
.. rest_method:: GET /v2.0/subnets/{subnet_id}
Shows details for a subnet.
Use the fields query parameter to filter the results.
.. include:: filtering-show.inc
Normal response codes: 200
Error response codes: 401, 404
Request
-------
.. rest_parameters:: parameters.yaml
- subnet_id: subnet_id-path
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- subnet: subnet-obj
- id: subnet-id-body
- tenant_id: project_id
- project_id: project_id
- created_at: created_at_resource
- name: subnet-name
- enable_dhcp: subnet-enable_dhcp
- network_id: subnet-network_id
- dns_nameservers: subnet-dns_nameservers
- allocation_pools: subnet-allocation_pools
- host_routes: subnet-host_routes
- ip_version: subnet-ip_version
- gateway_ip: subnet-gateway_ip
- cidr: cidr
- updated_at: updated_at_resource
- description: description
- ipv6_address_mode: subnet-ipv6_address_mode
- ipv6_ra_mode: subnet-ipv6_ra_mode
- revision_number: revision_number
- segment_id: subnet-segment_id
- service_types: subnet-service_types
- subnetpool_id: subnet-subnetpool_id
- tags: tags
- dns_publish_fixed_ip: subnet-dns_publish_fixed_ip
- router:external: subnet-router:external
Response Example
----------------
.. literalinclude:: samples/subnets/subnet-show-response.json
:language: javascript
Update subnet
=============
.. rest_method:: PUT /v2.0/subnets/{subnet_id}
Updates a subnet.
Some attributes, such as IP version (ip_version), CIDR (cidr), and
segment (segment_id) cannot be updated. Attempting to update these
attributes results in a ``400 Bad Request`` error.
Normal response codes: 200
Error response codes: 400, 401, 403, 404, 412
Request
-------
.. rest_parameters:: parameters.yaml
- subnet_id: subnet_id-path
- name: subnet-name-update-request
- enable_dhcp: subnet-enable_dhcp-request
- dns_nameservers: subnet-dns_nameservers-request
- allocation_pools: subnet-allocation_pools-request
- host_routes: subnet-host_routes-request
- gateway_ip: subnet-gateway_ip-request
- description: description-request
- service_types: subnet-service_types-optional
- segment_id: subnet-segment_id-request
- dns_publish_fixed_ip: subnet-dns_publish_fixed_ip-request
Request Example
---------------
.. literalinclude:: samples/subnets/subnet-update-request.json
:language: javascript
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- subnet: subnet-obj
- id: subnet-id-body
- tenant_id: project_id
- project_id: project_id
- name: subnet-name
- enable_dhcp: subnet-enable_dhcp
- network_id: subnet-network_id
- dns_nameservers: subnet-dns_nameservers
- allocation_pools: subnet-allocation_pools
- host_routes: subnet-host_routes
- ip_version: subnet-ip_version
- gateway_ip: subnet-gateway_ip
- cidr: cidr
- created_at: created_at_resource
- description: description
- ipv6_address_mode: subnet-ipv6_address_mode
- ipv6_ra_mode: subnet-ipv6_ra_mode
- revision_number: revision_number
- segment_id: subnet-segment_id
- service_types: subnet-service_types
- subnetpool_id: subnet-subnetpool_id
- updated_at: updated_at_resource
- tags: tags
- dns_publish_fixed_ip: subnet-dns_publish_fixed_ip
- router:external: subnet-router:external
Response Example
----------------
.. literalinclude:: samples/subnets/subnet-update-response.json
:language: javascript
Delete subnet
=============
.. rest_method:: DELETE /v2.0/subnets/{subnet_id}
Deletes a subnet.
The operation fails if subnet IP addresses are still allocated.
Normal response codes: 204
Error response codes: 401, 404, 412
Request
-------
.. rest_parameters:: parameters.yaml
- subnet_id: subnet_id-path
Response
--------
There is no body content for the response of a successful DELETE request.
|