File: networks.inc

package info (click to toggle)
python-neutron-lib 3.18.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,652 kB
  • sloc: python: 22,800; sh: 145; makefile: 24
file content (691 lines) | stat: -rw-r--r-- 22,407 bytes parent folder | download
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
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
.. -*- rst -*-
.. needs:method_verification
.. NOTE(amotoki): method_verification will be removed after sorting methods
   in the recommended order.

========
Networks
========

Lists, shows details for, creates, updates, and deletes networks.

Address Scopes Extension
========================

The ``address-scope`` extension adds the ``ipv4_address_scope`` and
``ipv6_address_scope`` attributes to networks. ``ipv4_address_scope``
is the ID of the IPv4 address scope that the network is associated with.
``ipv6_address_scope`` is the ID of the IPv6 address scope that the network
is associated with.

Auto Allocated Topology
=======================

The ``auto-allocated-topology`` extension adds the ``is_default`` boolean
attribute to networks. This value indicates the network should be used when
auto allocating topologies.

DNS integration
===============

The ``dns-integration`` extension adds the ``dns_domain`` attribute to networks.
The ``dns_domain`` of a network in conjunction with the ``dns_name`` attribute
of its ports will be published in an external DNS service when Neutron is
configured to integrate with such a service.

External network
================

The ``external-net`` extension adds the ``router:external`` attribute to
networks. This boolean attribute indicates the network has an external
routing facility that's not managed by the networking service.

FloatingIP autodelete internal
==============================

The ``floatingip-autodelete-internal`` shim extension signals that the
update of a network's ``router:external`` attribute from ``true`` to
``false`` autodeletes the unused Floating IPs of that network.

HA extension
============

The ``network-ha`` extension allows to pass a boolean parameter during the
network creation. If ``true`` is passed, a ``ha_router_networks`` database
register will be created along with the ``network`` register. This field is
not visible and, initially, not meant to be supported in the CLI.

L2 adjacency extension
======================

The ``l2_adjacency`` extension provides display of L2 Adjacency
for ``networks`` by adding the read-only ``l2_adjacency`` attribute.
This is a boolean value where ``true`` means that you can expect
L2 connectivity throughout the Network and ``false`` means that there
is no guarantee of L2 connectivity.
This value is read-only and is derived from the current state of
``segments`` within the ``network``.

MTU extensions
==============

The ``net-mtu`` extension allows plug-ins to expose the MTU that is guaranteed
to pass through the data path of the segments in the network. This extension
introduces a read-only ``mtu`` attribute.

A newer ``net-mtu-writable`` extension enhances ``net-mtu`` in that now the
``mtu`` attribute is available for write (both when creating as well as
updating networks).

.. warning::

   Due to limitations in libvirt and QEMU, updating the ``mtu`` value for an
   existing network with instances plugged into it requires either a hard
   reboot of those instances, or a detach and re-attach of their ports from
   that network.

Multiple provider extension
===========================

The ``multi-provider`` extension allows administrative users to define multiple
physical bindings for a logical network.

To define multiple physical bindings for a network, include a ``segments`` list
in the request body of network creation request.  Each element in the
``segments`` list has the same structure as the provider network
attributes. These attributes are ``provider:network_type``,
``provider:physical_network``, and ``provider:segmentation_id``. The same
validation rules are applied to each element in the ``segments`` list.

Note that you cannot use the provider extension and the multiple provider
extension for a single logical network.

Network availability zone extension
===================================

The ``network_availability_zone`` extension provides support of availability
zone for networks, exposing ``availability_zone_hints``
and ``availability_zones`` attributes.

Network cascade delete extension
================================

The ``network-cascade-delete`` shim extension adds to networks the optional
boolean attribute, ``cascade``, that when defined as ``true``, removes all
child objects of a network upon its deletion.

Port security
=============

The ``port-security`` extension adds the ``port_security_enabled`` boolean
attribute to networks. At the network level, ``port_security_enabled``
defines the default value for new ports attached to the network; they will
inherit the value of their network's ``port_security_enabled`` unless
explicitly set on the port itself. While the default value for
``port_security_enabled`` is ``true``, this can be changed by updating the
respective network. Note that changing a value of ``port_security_enabled``
on a network, does not cascade the value to ports attached to the network.

Provider extended attributes
============================

The ``provider`` extension allows administrative users to define a physical
binding of a logical network. This extension provides three additional
attributes: ``provider:network_type``, ``provider:physical_network`` and
``provider:segmentation_id``. The validation rules for these attributes
vary across ``provider:network_type``. For example, ``vlan`` and ``flat``
network types require ``provider:physical_network`` attribute, but ``vxlan``
network type does not.

Most Networking plug-ins (e.g. ML2 Plugin) and drivers do not support updating
any provider related attributes. Check your plug-in whether it supports
updating.

QinQ
====

The ``qinq`` extension adds the ``qinq`` boolean attribute which allows to
control the VLAN QinQ (vlan in vlan) of the network. It uses ``0x8a88`` ethertype for
the double tagged packets. If the service does not support VLAN QinQ and a user
requests a VLAN QinQ network, the plug-in refuses to create one and returns an
appropriate error to the user.
This extension enables VLAN-In-VLAN feature where inner and outer frames are
using different ethertypes. Inner (C-Tag) tag is using ethertype ``0x8100`` and
outher (S-Tag) tag is using ethertype ``8x8a88``. This is described in the
`802.1ad IEEE document <https://www.ieee802.org/1/pages/802.1ad.html>`_.

QoS extension
=============

The :ref:`QoS <quality-of-service>` extension (``qos``) makes it possible to
define QoS policies and associate these to the networks by introducing the
``qos_policy_id`` attribute. The policies should be created before they are
associated to the networks.

Resource timestamps
===================

The ``standard-attr-timestamp`` extension adds the ``created_at`` and
``updated_at`` attributes to all resources that have standard attributes.

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.

VLAN transparency extension
===========================

The ``vlan-transparent`` extension enables plug-ins that support VLAN
transparency to deliver VLAN transparent trunk networks.
This extension introduces a ``vlan_transparent`` attribute to control
the VLAN transparency of the network. If the service does not support VLAN
transparency and a user requests a VLAN transparent network,
the plug-in refuses to create one and returns an appropriate error to the user.
This extension enables feature called sometimes as ``QinQ`` which
means "Q-tag-in-Q-tag" where both, inner and outer frame is using ``802.1q`` tag
(ethertype ``0x8100``).

Show network details
====================

.. rest_method::  GET /v2.0/networks/{network_id}

Shows details for a network.

.. include:: filtering-show.inc

Normal response codes: 200

Error response codes: 401, 404

Request
-------

.. rest_parameters:: parameters.yaml

   - network_id: network_id-path
   - fields: fields

Response Parameters
-------------------

.. rest_parameters:: parameters.yaml

   - network: network
   - admin_state_up: network-admin_state_up
   - availability_zone_hints: availability_zone_hints
   - availability_zones: availability_zones
   - created_at: created_at_resource
   - dns_domain: dns_domain
   - id: network-id
   - ipv4_address_scope: ipv4_address_scope
   - ipv6_address_scope: ipv6_address_scope
   - l2_adjacency: l2_adjacency
   - mtu: mtu
   - name: network-name
   - port_security_enabled: network-port_security_enabled
   - project_id: project_id
   - provider:network_type: provider:network_type
   - provider:physical_network: provider:physical_network
   - provider:segmentation_id: provider:segmentation_id
   - qos_policy_id: qos_policy_id-network-response
   - revision_number: revision_number
   - router:external: router:external
   - segments: segments
   - shared: network-shared
   - status: network-status
   - subnets: network-subnets
   - tenant_id: project_id
   - updated_at: updated_at_resource
   - vlan_transparent: vlan_transparent
   - description: description
   - is_default: network_is_default
   - tags: tags

Response Example
----------------

.. literalinclude:: samples/networks/network-show-response.json
   :language: javascript

Response Example (admin user; single segment mapping)
-----------------------------------------------------

.. literalinclude:: samples/networks/network-provider-show-response.json
   :language: javascript

Response Example (admin user; multiple segment mappings)
--------------------------------------------------------

.. literalinclude:: samples/networks/network-multi-show-response.json
   :language: javascript

Update network
==============

.. rest_method::  PUT /v2.0/networks/{network_id}

Updates a network.

Normal response codes: 200

Error response codes: 400, 401, 403, 404, 412

Request
-------

.. rest_parameters:: parameters.yaml

   - network_id: network_id-path
   - network: network
   - admin_state_up: network-admin_state_up-request
   - dns_domain: dns_domain-request
   - mtu: mtu-request
   - name: network-name-request
   - port_security_enabled: network-port_security_enabled-request
   - provider:network_type: provider:network_type
   - provider:physical_network: provider:physical_network
   - provider:segmentation_id: provider:segmentation_id
   - qos_policy_id: qos_policy_id-network-request
   - router:external: router:external-request
   - segments: segments
   - shared: shared
   - description: description-request
   - is_default: network_is_default-request

Request Example
---------------

.. literalinclude:: samples/networks/network-update-request.json
   :language: javascript

Request Example (admin user; single segment mapping)
----------------------------------------------------

.. literalinclude:: samples/networks/network-provider-update-request.json
   :language: javascript

Request Example (admin user; multiple segment mappings)
-------------------------------------------------------

.. literalinclude:: samples/networks/network-multi-update-request.json
   :language: javascript

Response Parameters
-------------------

.. rest_parameters:: parameters.yaml

   - network: network
   - admin_state_up: network-admin_state_up
   - availability_zone_hints: availability_zone_hints
   - availability_zones: availability_zones
   - created_at: created_at_resource
   - dns_domain: dns_domain
   - id: network-id
   - ipv4_address_scope: ipv4_address_scope
   - ipv6_address_scope: ipv6_address_scope
   - l2_adjacency: l2_adjacency
   - mtu: mtu
   - name: network-name
   - port_security_enabled: network-port_security_enabled
   - project_id: project_id
   - provider:network_type: provider:network_type
   - provider:physical_network: provider:physical_network
   - provider:segmentation_id: provider:segmentation_id
   - qos_policy_id: qos_policy_id-network-response
   - revision_number: revision_number
   - router:external: router:external
   - segments: segments
   - shared: network-shared
   - status: network-status
   - subnets: network-subnets
   - tenant_id: project_id
   - updated_at: updated_at_resource
   - description: description
   - is_default: network_is_default
   - tags: tags

Response Example
----------------

This is an example when a regular user without administrative roles
sends a PUT request. Response examples for administrative users are
similar to responses of `Show network details <#show-network-details>`__
and `Create network <#create-network>`__. See them for details.

.. literalinclude:: samples/networks/network-update-response.json
   :language: javascript

Delete network
==============

.. rest_method::  DELETE /v2.0/networks/{network_id}

Deletes a network and its associated resources.

Normal response codes: 204

Error response codes: 401, 404, 409, 412

Request
-------

.. rest_parameters:: parameters.yaml

   - network_id: network_id-path

Response
--------

There is no body content for the response of a successful DELETE request.

List networks
=============

.. rest_method::  GET /v2.0/networks

Lists networks to which the project has access.

Default policy settings return only networks that the project who submits the
request owns, unless an administrative user submits the request. In addition,
networks shared with the project who submits the request are also returned.

.. include:: filtering-list.inc

.. TODO(amotoki): Add description on tag filtering to the general API overview.

You can also use the ``tags``, ``tags-any``, ``not-tags``, ``not-tags-any``
query parameter to filter the response with tags. For information,
see `REST API Impact <http://specs.openstack.org/openstack/neutron-
specs/specs/mitaka/add-tags-to-core-resources.html#rest-api-
impact>`__.

Normal response codes: 200

Error response codes: 401

Request
-------

.. rest_parameters:: parameters.yaml

   - admin_state_up: admin_state_up-query
   - id: id-query
   - mtu: mtu-query
   - name: name-query
   - project_id: project_id-query
   - provider:network_type: provider:network_type-query
   - provider:physical_network: provider:physical_network-query
   - provider:segmentation_id: provider:segmentation_id-query
   - revision_number: revision_number-query
   - router:external: router:external-query
   - shared: network-shared-query
   - status: network-status-query
   - tenant_id: project_id-query
   - vlan_transparent: vlan_transparent-query
   - description: description-query
   - is_default: network_is_default-query
   - tags: tags-query
   - tags-any: tags-any-query
   - not-tags: not-tags-query
   - not-tags-any: not-tags-any-query
   - sort_dir: sort_dir
   - sort_key: network-sort_key
   - fields: fields

Response Parameters
-------------------

.. rest_parameters:: parameters.yaml

   - networks: networks
   - admin_state_up: network-admin_state_up
   - availability_zone_hints: availability_zone_hints
   - availability_zones: availability_zones
   - created_at: created_at_resource
   - dns_domain: dns_domain
   - id: network-id
   - ipv4_address_scope: ipv4_address_scope
   - ipv6_address_scope: ipv6_address_scope
   - l2_adjacency: l2_adjacency
   - mtu: mtu
   - name: network-name
   - port_security_enabled: network-port_security_enabled
   - project_id: project_id
   - provider:network_type: provider:network_type
   - provider:physical_network: provider:physical_network
   - provider:segmentation_id: provider:segmentation_id
   - qos_policy_id: qos_policy_id-network-response
   - revision_number: revision_number
   - router:external: router:external
   - segments: segments
   - shared: network-shared
   - status: network-status
   - subnets: network-subnets
   - tenant_id: project_id
   - updated_at: updated_at_resource
   - vlan_transparent: vlan_transparent
   - description: description
   - is_default: network_is_default
   - tags: tags

Response Example
----------------

.. literalinclude:: samples/networks/networks-list-response.json
   :language: javascript

Response Example (admin user)
-----------------------------

When Administrative users request to list networks,
physical segment information bound to the networks are also returned
in a response. In this example, a network ``net1`` is mapped to a single
network segment and a network ``net2`` is mapped to multiple network segments.

.. literalinclude:: samples/networks/networks-provider-list-response.json
   :language: javascript

Create network
==============

.. rest_method::  POST /v2.0/networks

Creates a network.

A request body is optional. An administrative user can specify
another project ID, which is the project that owns the network, in
the request body.

Normal response codes: 201

Error response codes: 400, 401

Request
-------

.. rest_parameters:: parameters.yaml

   - network: network
   - admin_state_up: network-admin_state_up-request
   - dns_domain: dns_domain-request
   - mtu: mtu-request
   - name: network-name-request
   - port_security_enabled: network-port_security_enabled-request
   - project_id: project_id-request
   - provider:network_type: provider:network_type-request
   - provider:physical_network: provider:physical_network-request
   - provider:segmentation_id: provider:segmentation_id-request
   - qos_policy_id: qos_policy_id-network-request
   - router:external: router:external-request
   - segments: segments-request
   - shared: shared
   - tenant_id: project_id-request
   - vlan_transparent: vlan_transparent-request
   - description: description-request
   - is_default: network_is_default-request
   - availability_zone_hints: availability_zone_hints-request

Request Example
---------------

.. literalinclude:: samples/networks/network-create-request.json
   :language: javascript

Request Example (admin user; single segment mapping)
----------------------------------------------------

.. literalinclude:: samples/networks/network-provider-create-request.json
   :language: javascript

Request Example (admin user; multiple segment mappings)
-------------------------------------------------------

.. literalinclude:: samples/networks/network-multi-create-request.json
   :language: javascript

Response Parameters
-------------------

.. rest_parameters:: parameters.yaml

   - network: network
   - admin_state_up: network-admin_state_up
   - availability_zone_hints: availability_zone_hints
   - availability_zones: availability_zones
   - created_at: created_at_resource
   - dns_domain: dns_domain
   - id: network-id
   - ipv4_address_scope: ipv4_address_scope
   - ipv6_address_scope: ipv6_address_scope
   - l2_adjacency: l2_adjacency
   - mtu: mtu
   - name: network-name
   - port_security_enabled: network-port_security_enabled
   - project_id: project_id
   - provider:network_type: provider:network_type
   - provider:physical_network: provider:physical_network
   - provider:segmentation_id: provider:segmentation_id
   - qos_policy_id: qos_policy_id-network-response
   - revision_number: revision_number
   - router:external: router:external
   - segments: segments
   - shared: network-shared
   - status: network-status
   - subnets: network-subnets
   - tenant_id: project_id
   - updated_at: updated_at_resource
   - vlan_transparent: vlan_transparent
   - description: description
   - is_default: network_is_default
   - tags: tags

Response Example
----------------

.. literalinclude:: samples/networks/network-create-response.json
   :language: javascript

Response Example (admin user; single segment mapping)
-----------------------------------------------------

.. literalinclude:: samples/networks/network-provider-create-response.json
   :language: javascript

Response Example (admin user; multiple segment mappings)
--------------------------------------------------------

.. literalinclude:: samples/networks/network-multi-create-response.json
   :language: javascript

Bulk create networks
====================

.. rest_method::  POST /v2.0/networks

Creates multiple networks in a single request.

In the request body, specify a list of networks.

The bulk create operation is always atomic. Either all or no
networks in the request body are created.

Normal response codes: 201

Error response codes: 400, 401

Request
-------

.. rest_parameters:: parameters.yaml

   - networks: networks
   - admin_state_up: network-admin_state_up-request
   - dns_domain: dns_domain-request
   - mtu: mtu-request
   - name: network-name-request
   - port_security_enabled: network-port_security_enabled-request
   - project_id: project_id-request
   - provider:network_type: provider:network_type-request
   - provider:physical_network: provider:physical_network-request
   - provider:segmentation_id: provider:segmentation_id-request
   - qos_policy_id: qos_policy_id-network-request
   - router:external: router:external-request
   - segments: segments-request
   - shared: shared
   - tenant_id: project_id-request
   - vlan_transparent: vlan_transparent-request
   - description: description-request
   - availability_zone_hints: availability_zone_hints-request

Request Example
---------------

.. literalinclude:: samples/networks/networks-bulk-create-request.json
   :language: javascript

Response Parameters
-------------------

.. rest_parameters:: parameters.yaml

   - networks: networks
   - admin_state_up: network-admin_state_up
   - availability_zone_hints: availability_zone_hints
   - availability_zones: availability_zones
   - created_at: created_at_resource
   - dns_domain: dns_domain
   - id: network-id
   - ipv4_address_scope: ipv4_address_scope
   - ipv6_address_scope: ipv6_address_scope
   - l2_adjacency: l2_adjacency
   - mtu: mtu
   - name: network-name
   - port_security_enabled: network-port_security_enabled
   - project_id: project_id
   - provider:network_type: provider:network_type
   - provider:physical_network: provider:physical_network
   - provider:segmentation_id: provider:segmentation_id
   - qos_policy_id: qos_policy_id-network-response
   - revision_number: revision_number
   - router:external: router:external
   - segments: segments
   - shared: network-shared
   - status: network-status
   - subnets: network-subnets
   - tenant_id: project_id
   - updated_at: updated_at_resource
   - vlan_transparent: vlan_transparent
   - description: description
   - is_default: network_is_default
   - tags: tags

Response Example
----------------

.. literalinclude:: samples/networks/networks-bulk-create-response.json
   :language: javascript