Skip to content

Commit 57e5840

Browse files
committed
Network tag support
Neutron tag mechanism now supports network, subnet, port, subnetpool and router. Tag support for more resources is planned. This commit introduces a common mixin class to implement tag operation and individual resource consumes it. To support tag remove, network unset command is added. Implements blueprint neutron-client-tag Change-Id: Iad59d052f46896d27d73c22d6d4bb3df889f2352
1 parent e889ba1 commit 57e5840

27 files changed

Lines changed: 1172 additions & 102 deletions

doc/source/cli/command-objects/network.rst

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Create new network
3232
[--provider-segment <provider-segment>]
3333
[--qos-policy <qos-policy>]
3434
[--transparent-vlan | --no-transparent-vlan]
35+
[--tag <tag> | --no-tag]
3536
<name>
3637
3738
.. option:: --project <project>
@@ -165,6 +166,18 @@ Create new network
165166
166167
*Network version 2 only*
167168
169+
.. option:: --tag <tag>
170+
171+
Tag to be added to the network (repeat option to set multiple tags)
172+
173+
*Network version 2 only*
174+
175+
.. option:: --no-tag
176+
177+
No tags associated with the network
178+
179+
*Network version 2 only*
180+
168181
.. _network_create-name:
169182
.. describe:: <name>
170183
@@ -206,6 +219,8 @@ List networks
206219
[--provider-physical-network <provider-physical-network>]
207220
[--provider-segment <provider-segment>]
208221
[--agent <agent-id>]
222+
[--tags <tag>[,<tag>,...]] [--any-tags <tag>[,<tag>,...]]
223+
[--not-tags <tag>[,<tag>,...]] [--not-any-tags <tag>[,<tag>,...]]
209224
210225
.. option:: --external
211226
@@ -297,6 +312,32 @@ List networks
297312
298313
List networks hosted by agent (ID only)
299314
315+
*Network version 2 only*
316+
317+
.. option:: --tags <tag>[,<tag>,...]
318+
319+
List networks which have all given tag(s)
320+
321+
*Network version 2 only*
322+
323+
.. option:: --any-tags <tag>[,<tag>,...]
324+
325+
List networks which have any given tag(s)
326+
327+
*Network version 2 only*
328+
329+
.. option:: --not-tags <tag>[,<tag>,...]
330+
331+
Exclude networks which have all given tag(s)
332+
333+
*Network version 2 only*
334+
335+
.. option:: --not-any-tags <tag>[,<tag>,...]
336+
337+
Exclude networks which have any given tag(s)
338+
339+
*Network version 2 only*
340+
300341
network set
301342
-----------
302343
@@ -318,6 +359,7 @@ Set network properties
318359
[--provider-physical-network <provider-physical-network>]
319360
[--provider-segment <provider-segment>]
320361
[--qos-policy <qos-policy> | --no-qos-policy]
362+
[--tag <tag>] [--no-tag]
321363
<network>
322364
323365
.. option:: --name <name>
@@ -392,6 +434,15 @@ Set network properties
392434
393435
Remove the QoS policy attached to this network
394436
437+
.. option:: --tag <tag>
438+
439+
Tag to be added to the network (repeat option to set multiple tags)
440+
441+
.. option:: --no-tag
442+
443+
Clear tags associated with the network. Specify both --tag
444+
and --no-tag to overwrite current tags
445+
395446
.. _network_set-network:
396447
.. describe:: <network>
397448
@@ -412,3 +463,31 @@ Display network details
412463
.. describe:: <network>
413464
414465
Network to display (name or ID)
466+
467+
network unset
468+
-------------
469+
470+
Unset network properties
471+
472+
*Network version 2 only*
473+
474+
.. program:: network unset
475+
.. code:: bash
476+
477+
openstack network unset
478+
[--tag <tag> | --all-tag]
479+
<network>
480+
481+
.. option:: --tag <tag>
482+
483+
Tag to be removed from the network
484+
(repeat option to remove multiple tags)
485+
486+
.. option:: --all-tag
487+
488+
Clear all tags associated with the network
489+
490+
.. _network_unset-network:
491+
.. describe:: <network>
492+
493+
Network to modify (name or ID)

doc/source/cli/command-objects/port.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Create new port
3333
[--qos-policy <qos-policy>]
3434
[--project <project> [--project-domain <project-domain>]]
3535
[--enable-port-security | --disable-port-security]
36+
[--tag <tag> | --no-tag]
3637
<name>
3738
3839
.. option:: --network <network>
@@ -126,6 +127,14 @@ Create new port
126127
127128
Disable port security for this port
128129
130+
.. option:: --tag <tag>
131+
132+
Tag to be added to the port (repeat option to set multiple tags)
133+
134+
.. option:: --no-tag
135+
136+
No tags associated with the port
137+
129138
.. _port_create-name:
130139
.. describe:: <name>
131140
@@ -163,6 +172,8 @@ List ports
163172
[--fixed-ip subnet=<subnet>,ip-address=<ip-address>]
164173
[--long]
165174
[--project <project> [--project-domain <project-domain>]]
175+
[--tags <tag>[,<tag>,...]] [--any-tags <tag>[,<tag>,...]]
176+
[--not-tags <tag>[,<tag>,...]] [--not-any-tags <tag>[,<tag>,...]]
166177
167178
.. option:: --device-owner <device-owner>
168179
@@ -204,6 +215,22 @@ List ports
204215
Domain the project belongs to (name or ID).
205216
This can be used in case collisions between project names exist.
206217
218+
.. option:: --tags <tag>[,<tag>,...]
219+
220+
List ports which have all given tag(s)
221+
222+
.. option:: --any-tags <tag>[,<tag>,...]
223+
224+
List ports which have any given tag(s)
225+
226+
.. option:: --not-tags <tag>[,<tag>,...]
227+
228+
Exclude ports which have all given tag(s)
229+
230+
.. option:: --not-any-tags <tag>[,<tag>,...]
231+
232+
Exclude ports which have any given tag(s)
233+
207234
port set
208235
--------
209236
@@ -233,6 +260,7 @@ Set port properties
233260
[--allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]]
234261
[--no-allowed-address]
235262
[--data-plane-status <status>]
263+
[--tag <tag>] [--no-tag]
236264
<port>
237265
238266
.. option:: --description <description>
@@ -342,6 +370,15 @@ Set port properties
342370
Unset it to None with the 'port unset' command
343371
(requires data plane status extension)
344372
373+
.. option:: --tag <tag>
374+
375+
Tag to be added to the port (repeat option to set multiple tags)
376+
377+
.. option:: --no-tag
378+
379+
Clear tags associated with the port. Specify both --tag
380+
and --no-tag to overwrite current tags
381+
345382
.. _port_set-port:
346383
.. describe:: <port>
347384
@@ -378,6 +415,7 @@ Unset port properties
378415
[--allowed-address ip-address=<ip-address>[,mac-address=<mac-address>] [...]]
379416
[--qos-policy]
380417
[--data-plane-status]
418+
[--tag <tag> | --all-tag]
381419
<port>
382420
383421
.. option:: --fixed-ip subnet=<subnet>,ip-address=<ip-address>
@@ -410,6 +448,15 @@ Unset port properties
410448
411449
Clear existing information of data plane status
412450
451+
.. option:: --tag <tag>
452+
453+
Tag to be removed from the port
454+
(repeat option to remove multiple tags)
455+
456+
.. option:: --all-tag
457+
458+
Clear all tags associated with the port
459+
413460
.. _port_unset-port:
414461
.. describe:: <port>
415462

doc/source/cli/command-objects/router.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Create new router
6767
[--ha | --no-ha]
6868
[--description <description>]
6969
[--availability-zone-hint <availability-zone>]
70+
[--tag <tag> | --no-tag]
7071
<name>
7172
7273
.. option:: --project <project>
@@ -121,6 +122,14 @@ Create new router
121122
(Router Availability Zone extension required,
122123
repeat option to set multiple availability zones)
123124
125+
.. option:: --tag <tag>
126+
127+
Tag to be added to the router (repeat option to set multiple tags)
128+
129+
.. option:: --no-tag
130+
131+
No tags associated with the router
132+
124133
.. _router_create-name:
125134
.. describe:: <name>
126135
@@ -156,6 +165,8 @@ List routers
156165
[--long]
157166
[--project <project> [--project-domain <project-domain>]]
158167
[--agent <agent-id>]
168+
[--tags <tag>[,<tag>,...]] [--any-tags <tag>[,<tag>,...]]
169+
[--not-tags <tag>[,<tag>,...]] [--not-any-tags <tag>[,<tag>,...]]
159170
160171
.. option:: --agent <agent-id>
161172
@@ -186,6 +197,22 @@ List routers
186197
Domain the project belongs to (name or ID).
187198
This can be used in case collisions between project names exist.
188199
200+
.. option:: --tags <tag>[,<tag>,...]
201+
202+
List routers which have all given tag(s)
203+
204+
.. option:: --any-tags <tag>[,<tag>,...]
205+
206+
List routers which have any given tag(s)
207+
208+
.. option:: --not-tags <tag>[,<tag>,...]
209+
210+
Exclude routers which have all given tag(s)
211+
212+
.. option:: --not-any-tags <tag>[,<tag>,...]
213+
214+
Exclude routers which have any given tag(s)
215+
189216
router remove port
190217
------------------
191218
@@ -246,6 +273,7 @@ Set router properties
246273
[--route destination=<subnet>,gateway=<ip-address> | --no-route]
247274
[--ha | --no-ha]
248275
[--external-gateway <network> [--enable-snat|--disable-snat] [--fixed-ip subnet=<subnet>,ip-address=<ip-address>]]
276+
[--tag <tag>] [--no-tag]
249277
<router>
250278
251279
.. option:: --name <name>
@@ -311,6 +339,15 @@ Set router properties
311339
subnet=<subnet>,ip-address=<ip-address>
312340
(repeat option to set multiple fixed IP addresses)
313341
342+
.. option:: --tag <tag>
343+
344+
Tag to be added to the router (repeat option to set multiple tags)
345+
346+
.. option:: --no-tag
347+
348+
Clear tags associated with the router. Specify both --tag
349+
and --no-tag to overwrite current tags
350+
314351
.. _router_set-router:
315352
.. describe:: <router>
316353
@@ -343,6 +380,7 @@ Unset router properties
343380
openstack router unset
344381
[--route destination=<subnet>,gateway=<ip-address>]
345382
[--external-gateway]
383+
[--tag <tag> | --all-tag]
346384
<router>
347385
348386
.. option:: --route destination=<subnet>,gateway=<ip-address>
@@ -356,6 +394,15 @@ Unset router properties
356394
357395
Remove external gateway information from the router
358396
397+
.. option:: --tag <tag>
398+
399+
Tag to be removed from the router
400+
(repeat option to remove multiple tags)
401+
402+
.. option:: --all-tag
403+
404+
Clear all tags associated with the router
405+
359406
.. _router_unset-router:
360407
.. describe:: <router>
361408

0 commit comments

Comments
 (0)