python-openstackclient 7.3.1__py3-none-any.whl → 8.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. openstackclient/common/availability_zone.py +3 -6
  2. openstackclient/common/clientmanager.py +2 -1
  3. openstackclient/common/envvars.py +57 -0
  4. openstackclient/common/extension.py +3 -11
  5. openstackclient/common/limits.py +1 -1
  6. openstackclient/common/project_cleanup.py +3 -2
  7. openstackclient/common/quota.py +54 -28
  8. openstackclient/compute/client.py +2 -5
  9. openstackclient/compute/v2/agent.py +5 -5
  10. openstackclient/compute/v2/aggregate.py +17 -15
  11. openstackclient/compute/v2/console.py +3 -4
  12. openstackclient/compute/v2/flavor.py +14 -18
  13. openstackclient/compute/v2/host.py +3 -3
  14. openstackclient/compute/v2/hypervisor.py +10 -4
  15. openstackclient/compute/v2/hypervisor_stats.py +1 -1
  16. openstackclient/compute/v2/keypair.py +8 -10
  17. openstackclient/compute/v2/server.py +70 -112
  18. openstackclient/compute/v2/server_backup.py +1 -1
  19. openstackclient/compute/v2/server_event.py +7 -16
  20. openstackclient/compute/v2/server_group.py +6 -6
  21. openstackclient/compute/v2/server_image.py +1 -1
  22. openstackclient/compute/v2/server_migration.py +6 -6
  23. openstackclient/compute/v2/server_volume.py +4 -4
  24. openstackclient/compute/v2/service.py +9 -13
  25. openstackclient/compute/v2/usage.py +4 -6
  26. openstackclient/identity/client.py +2 -4
  27. openstackclient/identity/common.py +16 -17
  28. openstackclient/identity/v2_0/ec2creds.py +4 -3
  29. openstackclient/identity/v2_0/endpoint.py +12 -10
  30. openstackclient/identity/v2_0/project.py +6 -6
  31. openstackclient/identity/v2_0/role.py +1 -1
  32. openstackclient/identity/v2_0/service.py +7 -7
  33. openstackclient/identity/v2_0/user.py +6 -21
  34. openstackclient/identity/v3/access_rule.py +2 -5
  35. openstackclient/identity/v3/consumer.py +4 -3
  36. openstackclient/identity/v3/credential.py +8 -9
  37. openstackclient/identity/v3/domain.py +1 -1
  38. openstackclient/identity/v3/ec2creds.py +4 -3
  39. openstackclient/identity/v3/endpoint.py +104 -88
  40. openstackclient/identity/v3/endpoint_group.py +1 -1
  41. openstackclient/identity/v3/group.py +3 -4
  42. openstackclient/identity/v3/identity_provider.py +1 -2
  43. openstackclient/identity/v3/limit.py +4 -9
  44. openstackclient/identity/v3/mapping.py +4 -3
  45. openstackclient/identity/v3/policy.py +5 -8
  46. openstackclient/identity/v3/project.py +6 -6
  47. openstackclient/identity/v3/region.py +2 -5
  48. openstackclient/identity/v3/registered_limit.py +4 -8
  49. openstackclient/identity/v3/role.py +15 -16
  50. openstackclient/identity/v3/service.py +8 -8
  51. openstackclient/identity/v3/service_provider.py +3 -6
  52. openstackclient/identity/v3/tag.py +2 -2
  53. openstackclient/identity/v3/token.py +1 -2
  54. openstackclient/identity/v3/trust.py +74 -25
  55. openstackclient/identity/v3/user.py +9 -6
  56. openstackclient/image/client.py +2 -5
  57. openstackclient/image/v1/image.py +11 -15
  58. openstackclient/image/v2/cache.py +2 -4
  59. openstackclient/image/v2/image.py +30 -37
  60. openstackclient/image/v2/metadef_namespaces.py +4 -3
  61. openstackclient/image/v2/metadef_resource_type_association.py +1 -2
  62. openstackclient/image/v2/metadef_resource_types.py +1 -2
  63. openstackclient/locale/tr_TR/LC_MESSAGES/openstackclient.po +9 -1370
  64. openstackclient/network/client.py +4 -10
  65. openstackclient/network/common.py +16 -12
  66. openstackclient/network/utils.py +3 -3
  67. openstackclient/network/v2/address_group.py +5 -9
  68. openstackclient/network/v2/address_scope.py +2 -3
  69. openstackclient/network/v2/default_security_group_rule.py +1 -2
  70. openstackclient/network/v2/floating_ip.py +14 -21
  71. openstackclient/network/v2/floating_ip_port_forwarding.py +7 -7
  72. openstackclient/network/v2/ip_availability.py +1 -2
  73. openstackclient/network/v2/l3_conntrack_helper.py +8 -12
  74. openstackclient/network/v2/local_ip.py +24 -26
  75. openstackclient/network/v2/local_ip_association.py +4 -5
  76. openstackclient/network/v2/ndp_proxy.py +9 -10
  77. openstackclient/network/v2/network.py +12 -16
  78. openstackclient/network/v2/network_agent.py +29 -37
  79. openstackclient/network/v2/network_auto_allocated_topology.py +4 -5
  80. openstackclient/network/v2/network_flavor.py +1 -1
  81. openstackclient/network/v2/network_flavor_profile.py +5 -5
  82. openstackclient/network/v2/network_meter.py +3 -3
  83. openstackclient/network/v2/network_meter_rule.py +5 -8
  84. openstackclient/network/v2/network_qos_policy.py +4 -4
  85. openstackclient/network/v2/network_qos_rule.py +4 -5
  86. openstackclient/network/v2/network_rbac.py +4 -4
  87. openstackclient/network/v2/network_segment.py +6 -7
  88. openstackclient/network/v2/network_segment_range.py +16 -20
  89. openstackclient/network/v2/network_trunk.py +24 -16
  90. openstackclient/network/v2/port.py +42 -31
  91. openstackclient/network/v2/router.py +55 -41
  92. openstackclient/network/v2/security_group.py +8 -15
  93. openstackclient/network/v2/security_group_rule.py +9 -10
  94. openstackclient/network/v2/subnet.py +31 -30
  95. openstackclient/network/v2/subnet_pool.py +4 -4
  96. openstackclient/object/client.py +2 -3
  97. openstackclient/object/v1/container.py +2 -3
  98. openstackclient/object/v1/object.py +2 -9
  99. openstackclient/shell.py +22 -5
  100. openstackclient/tests/functional/base.py +2 -2
  101. openstackclient/tests/functional/common/test_quota.py +3 -1
  102. openstackclient/tests/functional/compute/v2/common.py +12 -6
  103. openstackclient/tests/functional/compute/v2/test_server.py +2 -3
  104. openstackclient/tests/functional/compute/v2/test_server_event.py +1 -1
  105. openstackclient/tests/functional/identity/v2/test_user.py +1 -1
  106. openstackclient/tests/functional/identity/v3/common.py +3 -8
  107. openstackclient/tests/functional/identity/v3/test_application_credential.py +10 -10
  108. openstackclient/tests/functional/identity/v3/test_endpoint.py +3 -3
  109. openstackclient/tests/functional/identity/v3/test_group.py +3 -3
  110. openstackclient/tests/functional/identity/v3/test_idp.py +3 -7
  111. openstackclient/tests/functional/identity/v3/test_limit.py +4 -4
  112. openstackclient/tests/functional/identity/v3/test_project.py +5 -14
  113. openstackclient/tests/functional/identity/v3/test_region.py +1 -3
  114. openstackclient/tests/functional/identity/v3/test_registered_limit.py +3 -3
  115. openstackclient/tests/functional/identity/v3/test_role.py +1 -1
  116. openstackclient/tests/functional/identity/v3/test_role_assignment.py +13 -31
  117. openstackclient/tests/functional/identity/v3/test_service_provider.py +3 -7
  118. openstackclient/tests/functional/identity/v3/test_user.py +8 -8
  119. openstackclient/tests/functional/network/v2/common.py +7 -3
  120. openstackclient/tests/functional/network/v2/test_address_group.py +4 -0
  121. openstackclient/tests/functional/network/v2/test_l3_conntrack_helper.py +15 -11
  122. openstackclient/tests/functional/network/v2/test_local_ip.py +4 -0
  123. openstackclient/tests/functional/network/v2/test_network_meter_rule.py +2 -2
  124. openstackclient/tests/functional/network/v2/test_network_ndp_proxy.py +2 -3
  125. openstackclient/tests/functional/network/v2/test_network_rbac.py +2 -2
  126. openstackclient/tests/functional/network/v2/test_network_trunk.py +1 -1
  127. openstackclient/tests/functional/network/v2/test_port.py +17 -7
  128. openstackclient/tests/functional/network/v2/test_router.py +42 -0
  129. openstackclient/tests/functional/network/v2/test_subnet_pool.py +4 -0
  130. openstackclient/tests/unit/api/test_compute_v2.py +67 -87
  131. openstackclient/tests/unit/common/test_availability_zone.py +6 -14
  132. openstackclient/tests/unit/common/test_command.py +1 -1
  133. openstackclient/tests/unit/common/test_extension.py +5 -7
  134. openstackclient/tests/unit/common/test_limits.py +1 -1
  135. openstackclient/tests/unit/common/test_project_cleanup.py +5 -6
  136. openstackclient/tests/unit/common/test_quota.py +51 -28
  137. openstackclient/tests/unit/compute/v2/fakes.py +4 -10
  138. openstackclient/tests/unit/compute/v2/test_agent.py +16 -16
  139. openstackclient/tests/unit/compute/v2/test_aggregate.py +56 -60
  140. openstackclient/tests/unit/compute/v2/test_console.py +16 -16
  141. openstackclient/tests/unit/compute/v2/test_flavor.py +71 -71
  142. openstackclient/tests/unit/compute/v2/test_host.py +8 -8
  143. openstackclient/tests/unit/compute/v2/test_hypervisor.py +22 -30
  144. openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +2 -2
  145. openstackclient/tests/unit/compute/v2/test_keypair.py +24 -24
  146. openstackclient/tests/unit/compute/v2/test_server.py +524 -560
  147. openstackclient/tests/unit/compute/v2/test_server_backup.py +5 -7
  148. openstackclient/tests/unit/compute/v2/test_server_event.py +16 -18
  149. openstackclient/tests/unit/compute/v2/test_server_group.py +25 -31
  150. openstackclient/tests/unit/compute/v2/test_server_image.py +6 -8
  151. openstackclient/tests/unit/compute/v2/test_server_migration.py +37 -37
  152. openstackclient/tests/unit/compute/v2/test_server_volume.py +12 -12
  153. openstackclient/tests/unit/compute/v2/test_service.py +39 -45
  154. openstackclient/tests/unit/compute/v2/test_usage.py +5 -5
  155. openstackclient/tests/unit/identity/v2_0/fakes.py +1 -1
  156. openstackclient/tests/unit/identity/v3/test_access_rule.py +1 -3
  157. openstackclient/tests/unit/identity/v3/test_application_credential.py +1 -1
  158. openstackclient/tests/unit/identity/v3/test_credential.py +4 -4
  159. openstackclient/tests/unit/identity/v3/test_endpoint.py +167 -172
  160. openstackclient/tests/unit/identity/v3/test_mappings.py +2 -2
  161. openstackclient/tests/unit/identity/v3/test_trust.py +5 -2
  162. openstackclient/tests/unit/identity/v3/test_user.py +16 -0
  163. openstackclient/tests/unit/image/v1/fakes.py +2 -2
  164. openstackclient/tests/unit/image/v2/test_image.py +39 -1
  165. openstackclient/tests/unit/integ/cli/test_shell.py +1 -2
  166. openstackclient/tests/unit/network/test_common.py +2 -2
  167. openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +8 -14
  168. openstackclient/tests/unit/network/v2/test_floating_ip_network.py +49 -35
  169. openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +1 -1
  170. openstackclient/tests/unit/network/v2/test_network_compute.py +11 -11
  171. openstackclient/tests/unit/network/v2/test_network_trunk.py +2 -2
  172. openstackclient/tests/unit/network/v2/test_port.py +33 -5
  173. openstackclient/tests/unit/network/v2/test_router.py +120 -7
  174. openstackclient/tests/unit/network/v2/test_security_group_compute.py +11 -19
  175. openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +14 -14
  176. openstackclient/tests/unit/object/v1/test_object_all.py +4 -3
  177. openstackclient/tests/unit/test_shell.py +16 -13
  178. openstackclient/tests/unit/volume/v2/test_volume.py +1 -1
  179. openstackclient/tests/unit/volume/v2/test_volume_transfer_request.py +1 -1
  180. openstackclient/tests/unit/volume/v3/fakes.py +2 -8
  181. openstackclient/tests/unit/volume/v3/test_volume.py +1 -1
  182. openstackclient/tests/unit/volume/v3/test_volume_attachment.py +3 -3
  183. openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +1 -2
  184. openstackclient/tests/unit/volume/v3/test_volume_transfer_request.py +1 -1
  185. openstackclient/volume/client.py +1 -3
  186. openstackclient/volume/v2/consistency_group.py +4 -8
  187. openstackclient/volume/v2/consistency_group_snapshot.py +1 -2
  188. openstackclient/volume/v2/qos_specs.py +1 -2
  189. openstackclient/volume/v2/volume.py +8 -16
  190. openstackclient/volume/v2/volume_backup.py +6 -7
  191. openstackclient/volume/v2/volume_snapshot.py +8 -9
  192. openstackclient/volume/v2/volume_transfer_request.py +0 -3
  193. openstackclient/volume/v2/volume_type.py +10 -21
  194. openstackclient/volume/v3/block_storage_cluster.py +3 -3
  195. openstackclient/volume/v3/block_storage_manage.py +1 -3
  196. openstackclient/volume/v3/volume.py +18 -19
  197. openstackclient/volume/v3/volume_attachment.py +3 -2
  198. openstackclient/volume/v3/volume_backup.py +7 -8
  199. openstackclient/volume/v3/volume_group.py +2 -1
  200. openstackclient/volume/v3/volume_group_snapshot.py +2 -1
  201. openstackclient/volume/v3/volume_snapshot.py +4 -3
  202. openstackclient/volume/v3/volume_type.py +10 -21
  203. {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/AUTHORS +4 -0
  204. {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/METADATA +7 -13
  205. {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/RECORD +210 -233
  206. {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/WHEEL +1 -1
  207. {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/entry_points.txt +0 -41
  208. python_openstackclient-8.0.0.dist-info/pbr.json +1 -0
  209. openstackclient/tests/functional/volume/v1/__init__.py +0 -0
  210. openstackclient/tests/functional/volume/v1/common.py +0 -35
  211. openstackclient/tests/functional/volume/v1/test_qos.py +0 -100
  212. openstackclient/tests/functional/volume/v1/test_service.py +0 -76
  213. openstackclient/tests/functional/volume/v1/test_snapshot.py +0 -232
  214. openstackclient/tests/functional/volume/v1/test_transfer_request.py +0 -111
  215. openstackclient/tests/functional/volume/v1/test_volume.py +0 -228
  216. openstackclient/tests/functional/volume/v1/test_volume_type.py +0 -213
  217. openstackclient/tests/unit/volume/v1/__init__.py +0 -0
  218. openstackclient/tests/unit/volume/v1/fakes.py +0 -615
  219. openstackclient/tests/unit/volume/v1/test_qos_specs.py +0 -471
  220. openstackclient/tests/unit/volume/v1/test_service.py +0 -295
  221. openstackclient/tests/unit/volume/v1/test_transfer_request.py +0 -380
  222. openstackclient/tests/unit/volume/v1/test_type.py +0 -633
  223. openstackclient/tests/unit/volume/v1/test_volume.py +0 -1447
  224. openstackclient/tests/unit/volume/v1/test_volume_backup.py +0 -435
  225. openstackclient/volume/v1/__init__.py +0 -0
  226. openstackclient/volume/v1/qos_specs.py +0 -377
  227. openstackclient/volume/v1/service.py +0 -136
  228. openstackclient/volume/v1/volume.py +0 -734
  229. openstackclient/volume/v1/volume_backup.py +0 -302
  230. openstackclient/volume/v1/volume_snapshot.py +0 -433
  231. openstackclient/volume/v1/volume_transfer_request.py +0 -200
  232. openstackclient/volume/v1/volume_type.py +0 -520
  233. python_openstackclient-7.3.1.dist-info/pbr.json +0 -1
  234. {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/LICENSE +0 -0
  235. {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/top_level.txt +0 -0
@@ -18,6 +18,7 @@
18
18
 
19
19
  import itertools
20
20
  import logging
21
+ import typing as ty
21
22
 
22
23
  from osc_lib.command import command
23
24
  from osc_lib import exceptions
@@ -32,19 +33,18 @@ LOG = logging.getLogger(__name__)
32
33
 
33
34
 
34
35
  def _get_columns(item):
35
- column_map = {}
36
36
  hidden_columns = ['location', 'tenant_id']
37
37
  return utils.get_osc_show_columns_for_sdk_resource(
38
- item, column_map, hidden_columns
38
+ item, {}, hidden_columns
39
39
  )
40
40
 
41
41
 
42
42
  def _get_ranges(item):
43
43
  item = sorted([int(i) for i in item])
44
44
  for a, b in itertools.groupby(enumerate(item), lambda xy: xy[1] - xy[0]):
45
- b = list(b)
45
+ c = list(b)
46
46
  yield (
47
- f"{b[0][1]}-{b[-1][1]}" if b[0][1] != b[-1][1] else str(b[0][1])
47
+ f"{c[0][1]}-{c[-1][1]}" if c[0][1] != c[-1][1] else str(c[0][1])
48
48
  )
49
49
 
50
50
 
@@ -59,7 +59,7 @@ def _is_prop_empty(columns, props, prop_name):
59
59
 
60
60
 
61
61
  def _exchange_dict_keys_with_values(orig_dict):
62
- updated_dict = dict()
62
+ updated_dict: dict[str, ty.Any] = {}
63
63
  for k, v in orig_dict.items():
64
64
  k = [k]
65
65
  if not updated_dict.get(v):
@@ -105,8 +105,7 @@ class CreateNetworkSegmentRange(
105
105
  dest="private",
106
106
  action="store_true",
107
107
  help=_(
108
- 'Network segment range is assigned specifically to the '
109
- 'project'
108
+ 'Network segment range is assigned specifically to the project'
110
109
  ),
111
110
  )
112
111
  shared_group.add_argument(
@@ -125,7 +124,7 @@ class CreateNetworkSegmentRange(
125
124
  metavar='<project>',
126
125
  help=_(
127
126
  'Network segment range owner (name or ID). Optional when '
128
- 'the segment range is shared'
127
+ 'the segment range is shared.'
129
128
  ),
130
129
  )
131
130
  identity_common.add_project_domain_option_to_parser(parser)
@@ -196,8 +195,7 @@ class CreateNetworkSegmentRange(
196
195
  and parsed_args.physical_network
197
196
  ):
198
197
  msg = _(
199
- "--physical-network is only allowed with --network-type "
200
- "vlan"
198
+ "--physical-network is only allowed with --network-type vlan"
201
199
  )
202
200
  raise exceptions.CommandError(msg)
203
201
 
@@ -323,7 +321,7 @@ class ListNetworkSegmentRange(command.Lister):
323
321
  '--unused',
324
322
  action='store_true',
325
323
  help=_(
326
- 'List network segment ranges that have segments ' 'not in use'
324
+ 'List network segment ranges that have segments not in use'
327
325
  ),
328
326
  )
329
327
  available_group = parser.add_mutually_exclusive_group()
@@ -353,10 +351,9 @@ class ListNetworkSegmentRange(command.Lister):
353
351
  ) % {'e': e}
354
352
  raise exceptions.CommandError(msg)
355
353
 
356
- filters = {}
357
- data = network_client.network_segment_ranges(**filters)
354
+ data = network_client.network_segment_ranges()
358
355
 
359
- headers = (
356
+ headers: tuple[str, ...] = (
360
357
  'ID',
361
358
  'Name',
362
359
  'Default',
@@ -367,7 +364,7 @@ class ListNetworkSegmentRange(command.Lister):
367
364
  'Minimum ID',
368
365
  'Maximum ID',
369
366
  )
370
- columns = (
367
+ columns: tuple[str, ...] = (
371
368
  'id',
372
369
  'name',
373
370
  'default',
@@ -389,16 +386,16 @@ class ListNetworkSegmentRange(command.Lister):
389
386
  # should be listed in output.
390
387
  parsed_args.long = True
391
388
  if parsed_args.long:
392
- headers = headers + (
389
+ headers += (
393
390
  'Used',
394
391
  'Available',
395
392
  )
396
- columns = columns + (
393
+ columns += (
397
394
  'used',
398
395
  'available',
399
396
  )
400
397
 
401
- display_props = tuple()
398
+ display_props: tuple[str, ...] = tuple()
402
399
  for s in data:
403
400
  props = utils.get_item_properties(s, columns)
404
401
  if (
@@ -457,8 +454,7 @@ class SetNetworkSegmentRange(common.NeutronCommandWithExtraArgs):
457
454
  )
458
455
  except Exception as e:
459
456
  msg = _(
460
- 'Network segment range set not supported by '
461
- 'Network API: %(e)s'
457
+ 'Network segment range set not supported by Network API: %(e)s'
462
458
  ) % {'e': e}
463
459
  raise exceptions.CommandError(msg)
464
460
 
@@ -17,6 +17,7 @@
17
17
  """Network trunk and subports action implementations"""
18
18
 
19
19
  import logging
20
+ import typing as ty
20
21
 
21
22
  from cliff import columns as cliff_columns
22
23
  from osc_lib.cli import format_columns
@@ -69,8 +70,8 @@ class CreateNetworkTrunk(command.ShowOne):
69
70
  help=_(
70
71
  "Subport to add. Subport is of form "
71
72
  "'port=<name or ID>,segmentation-type=<segmentation-type>,"
72
- "segmentation-id=<segmentation-ID>' (--subport) option "
73
- "can be repeated"
73
+ "segmentation-id=<segmentation-ID>' (repeat option "
74
+ "to add multiple subports)"
74
75
  ),
75
76
  )
76
77
  admin_group = parser.add_mutually_exclusive_group()
@@ -128,7 +129,7 @@ class DeleteNetworkTrunk(command.Command):
128
129
  )
129
130
  if result > 0:
130
131
  total = len(parsed_args.trunk)
131
- msg = _("%(result)s of %(total)s trunks failed " "to delete.") % {
132
+ msg = _("%(result)s of %(total)s trunks failed to delete.") % {
132
133
  'result': result,
133
134
  'total': total,
134
135
  }
@@ -151,8 +152,8 @@ class ListNetworkTrunk(command.Lister):
151
152
  def take_action(self, parsed_args):
152
153
  client = self.app.client_manager.network
153
154
  data = client.trunks()
154
- headers = ('ID', 'Name', 'Parent Port', 'Description')
155
- columns = ('id', 'name', 'port_id', 'description')
155
+ headers: tuple[str, ...] = ('ID', 'Name', 'Parent Port', 'Description')
156
+ columns: tuple[str, ...] = ('id', 'name', 'port_id', 'description')
156
157
  if parsed_args.long:
157
158
  headers += (
158
159
  'Status',
@@ -199,9 +200,9 @@ class SetNetworkTrunk(command.Command):
199
200
  required_keys=['port'],
200
201
  help=_(
201
202
  "Subport to add. Subport is of form "
202
- "'port=<name or ID>,segmentation-type=<segmentation-type>"
203
- ",segmentation-id=<segmentation-ID>' (--subport) option "
204
- "can be repeated"
203
+ "'port=<name or ID>,segmentation-type=<segmentation-type>,"
204
+ "segmentation-id=<segmentation-ID>' (repeat option "
205
+ "to add multiple subports)"
205
206
  ),
206
207
  )
207
208
  admin_group = parser.add_mutually_exclusive_group()
@@ -277,8 +278,16 @@ class ListNetworkSubport(command.Lister):
277
278
  client = self.app.client_manager.network
278
279
  trunk_id = client.find_trunk(parsed_args.trunk)
279
280
  data = client.get_trunk_subports(trunk_id)
280
- headers = ('Port', 'Segmentation Type', 'Segmentation ID')
281
- columns = ('port_id', 'segmentation_type', 'segmentation_id')
281
+ headers: tuple[str, ...] = (
282
+ 'Port',
283
+ 'Segmentation Type',
284
+ 'Segmentation ID',
285
+ )
286
+ columns: tuple[str, ...] = (
287
+ 'port_id',
288
+ 'segmentation_type',
289
+ 'segmentation_id',
290
+ )
282
291
  return (
283
292
  headers,
284
293
  (
@@ -308,8 +317,8 @@ class UnsetNetworkTrunk(command.Command):
308
317
  action='append',
309
318
  dest='unset_subports',
310
319
  help=_(
311
- "Subport to delete (name or ID of the port) "
312
- "(--subport) option can be repeated"
320
+ "Subport to unset (name or ID of the port) "
321
+ "(repeat option to unset multiple subports)"
313
322
  ),
314
323
  )
315
324
  return parser
@@ -328,15 +337,14 @@ _formatters = {
328
337
 
329
338
 
330
339
  def _get_columns(item):
331
- column_map = {}
332
340
  hidden_columns = ['location', 'tenant_id']
333
341
  return osc_utils.get_osc_show_columns_for_sdk_resource(
334
- item, column_map, hidden_columns
342
+ item, {}, hidden_columns
335
343
  )
336
344
 
337
345
 
338
346
  def _get_attrs_for_trunk(client_manager, parsed_args):
339
- attrs = {}
347
+ attrs: dict[str, ty.Any] = {}
340
348
  if parsed_args.name is not None:
341
349
  attrs['name'] = str(parsed_args.name)
342
350
  if parsed_args.description is not None:
@@ -393,7 +401,7 @@ def _format_subports(client_manager, subports):
393
401
 
394
402
 
395
403
  def _get_attrs_for_subports(client_manager, parsed_args):
396
- attrs = {}
404
+ attrs = []
397
405
  if 'set_subports' in parsed_args and parsed_args.set_subports is not None:
398
406
  attrs = _format_subports(client_manager, parsed_args.set_subports)
399
407
  if (
@@ -17,6 +17,7 @@ import argparse
17
17
  import copy
18
18
  import json
19
19
  import logging
20
+ import typing as ty
20
21
 
21
22
  from cliff import columns as cliff_columns
22
23
  from osc_lib.cli import format_columns
@@ -39,6 +40,8 @@ class AdminStateColumn(cliff_columns.FormattableColumn):
39
40
 
40
41
 
41
42
  class SubPortColumn(format_columns.ListDictColumn):
43
+ _value: ty.Any
44
+
42
45
  def _retrieve_subports(self):
43
46
  if isinstance(self._value, dict):
44
47
  self._value = self._value['sub_ports']
@@ -347,8 +350,8 @@ def _add_updatable_args(parser, create=False):
347
350
  help=_(
348
351
  "VNIC type for this port (direct | direct-physical | "
349
352
  "macvtap | normal | baremetal | virtio-forwarder | vdpa | "
350
- "remote-managed, "
351
- "default: normal)"
353
+ "remote-managed) "
354
+ "(default: normal)"
352
355
  ),
353
356
  )
354
357
  parser.add_argument(
@@ -368,8 +371,7 @@ def _add_updatable_args(parser, create=False):
368
371
  '--dns-name',
369
372
  metavar='<dns-name>',
370
373
  help=_(
371
- "Set DNS name for this port "
372
- "(requires DNS integration extension)"
374
+ "Set DNS name for this port (requires DNS integration extension)"
373
375
  ),
374
376
  )
375
377
  numa_affinity_policy_group = parser.add_mutually_exclusive_group()
@@ -406,7 +408,7 @@ def _add_updatable_args(parser, create=False):
406
408
  '(requires port-hints extension) '
407
409
  '(requires port-hint-ovs-tx-steering extension for alias: '
408
410
  'ovs-tx-steering) '
409
- '(repeat option to set multiple hints)'
411
+ '(repeat option to set multiple hints).'
410
412
  ),
411
413
  )
412
414
  port_trusted = parser.add_mutually_exclusive_group()
@@ -416,7 +418,7 @@ def _add_updatable_args(parser, create=False):
416
418
  help=_(
417
419
  "Set port to be trusted. This will be populated into the "
418
420
  "'binding:profile' dictionary and passed to the services "
419
- "which expect it in this dictionary (for example, Nova)"
421
+ "which expect it in this dictionary (for example, Nova)."
420
422
  ),
421
423
  )
422
424
  port_trusted.add_argument(
@@ -425,7 +427,7 @@ def _add_updatable_args(parser, create=False):
425
427
  help=_(
426
428
  "Set port to be not trusted. This will be populated into the "
427
429
  "'binding:profile' dictionary and passed to the services "
428
- "which expect it in this dictionary (for example, Nova)"
430
+ "which expect it in this dictionary (for example, Nova)."
429
431
  ),
430
432
  )
431
433
 
@@ -512,7 +514,7 @@ class CreatePort(command.ShowOne, common.NeutronCommandWithExtraArgs):
512
514
  fixed_ip.add_argument(
513
515
  '--no-fixed-ip',
514
516
  action='store_true',
515
- help=_("No IP or subnet for this port."),
517
+ help=_("No IP or subnet set for this port"),
516
518
  )
517
519
  parser.add_argument(
518
520
  '--binding-profile',
@@ -520,8 +522,8 @@ class CreatePort(command.ShowOne, common.NeutronCommandWithExtraArgs):
520
522
  action=JSONKeyValueAction,
521
523
  help=_(
522
524
  "Custom data to be passed as binding:profile. Data may "
523
- "be passed as <key>=<value> or JSON. "
524
- "(repeat option to set multiple binding:profile data)"
525
+ "be passed as <key>=<value> or JSON "
526
+ "(repeat option to set multiple binding:profile data)."
525
527
  ),
526
528
  )
527
529
  admin_group = parser.add_mutually_exclusive_group()
@@ -538,12 +540,12 @@ class CreatePort(command.ShowOne, common.NeutronCommandWithExtraArgs):
538
540
  uplink_status_group.add_argument(
539
541
  '--enable-uplink-status-propagation',
540
542
  action='store_true',
541
- help=_("Enable uplink status propagate"),
543
+ help=_("Enable uplink status propagation (default)"),
542
544
  )
543
545
  uplink_status_group.add_argument(
544
546
  '--disable-uplink-status-propagation',
545
547
  action='store_true',
546
- help=_("Disable uplink status propagate (default)"),
548
+ help=_("Disable uplink status propagation"),
547
549
  )
548
550
  parser.add_argument(
549
551
  '--project',
@@ -596,7 +598,7 @@ class CreatePort(command.ShowOne, common.NeutronCommandWithExtraArgs):
596
598
  port_security.add_argument(
597
599
  '--enable-port-security',
598
600
  action='store_true',
599
- help=_("Enable port security for this port (Default)"),
601
+ help=_("Enable port security for this port (default)"),
600
602
  )
601
603
  port_security.add_argument(
602
604
  '--disable-port-security',
@@ -619,7 +621,7 @@ class CreatePort(command.ShowOne, common.NeutronCommandWithExtraArgs):
619
621
  parser.add_argument(
620
622
  '--device-profile',
621
623
  metavar='<device-profile>',
622
- help=_('Cyborg port device profile'),
624
+ help=_('Port device profile'),
623
625
  )
624
626
  parser.add_argument(
625
627
  '--hardware-offload-type',
@@ -753,7 +755,7 @@ class DeletePort(command.Command):
753
755
 
754
756
  if result > 0:
755
757
  total = len(parsed_args.port)
756
- msg = _("%(result)s of %(total)s ports failed " "to delete.") % {
758
+ msg = _("%(result)s of %(total)s ports failed to delete.") % {
757
759
  'result': result,
758
760
  'total': total,
759
761
  }
@@ -901,7 +903,7 @@ class ListPort(command.Lister):
901
903
  )
902
904
  filters['device_id'] = _router.id
903
905
  if parsed_args.server:
904
- compute_client = self.app.client_manager.sdk_connection.compute
906
+ compute_client = self.app.client_manager.compute
905
907
  server = compute_client.find_server(
906
908
  parsed_args.server,
907
909
  ignore_missing=False,
@@ -944,15 +946,12 @@ class ListPort(command.Lister):
944
946
  for item in columns
945
947
  ]
946
948
 
947
- headers, attrs = utils.calculate_header_and_attrs(
948
- column_headers, columns, parsed_args
949
- )
950
949
  return (
951
- headers,
950
+ column_headers,
952
951
  (
953
952
  utils.get_item_properties(
954
953
  s,
955
- attrs,
954
+ columns,
956
955
  formatters=_list_formatters,
957
956
  )
958
957
  for s in data
@@ -996,7 +995,7 @@ class SetPort(common.NeutronCommandWithExtraArgs):
996
995
  '--no-fixed-ip',
997
996
  action='store_true',
998
997
  help=_(
999
- "Clear existing information of fixed IP addresses."
998
+ "Clear existing information of fixed IP addresses. "
1000
999
  "Specify both --fixed-ip and --no-fixed-ip "
1001
1000
  "to overwrite the current fixed IP addresses."
1002
1001
  ),
@@ -1007,8 +1006,8 @@ class SetPort(common.NeutronCommandWithExtraArgs):
1007
1006
  action=JSONKeyValueAction,
1008
1007
  help=_(
1009
1008
  "Custom data to be passed as binding:profile. Data may "
1010
- "be passed as <key>=<value> or JSON. "
1011
- "(repeat option to set multiple binding:profile data)"
1009
+ "be passed as <key>=<value> or JSON "
1010
+ "(repeat option to set multiple binding:profile data)."
1012
1011
  ),
1013
1012
  )
1014
1013
  parser.add_argument(
@@ -1075,8 +1074,8 @@ class SetPort(common.NeutronCommandWithExtraArgs):
1075
1074
  help=_(
1076
1075
  "Clear existing allowed-address pairs associated "
1077
1076
  "with this port. "
1078
- "(Specify both --allowed-address and --no-allowed-address "
1079
- "to overwrite the current allowed-address pairs)"
1077
+ "Specify both --allowed-address and --no-allowed-address "
1078
+ "to overwrite the current allowed-address pairs."
1080
1079
  ),
1081
1080
  )
1082
1081
  parser.add_argument(
@@ -1100,9 +1099,21 @@ class SetPort(common.NeutronCommandWithExtraArgs):
1100
1099
  help=_(
1101
1100
  "Set data plane status of this port (ACTIVE | DOWN). "
1102
1101
  "Unset it to None with the 'port unset' command "
1103
- "(requires data plane status extension)"
1102
+ "(requires data plane status extension)."
1104
1103
  ),
1105
1104
  )
1105
+ uplink_status_group = parser.add_mutually_exclusive_group()
1106
+ uplink_status_group.add_argument(
1107
+ '--enable-uplink-status-propagation',
1108
+ action='store_true',
1109
+ help=_('Enable uplink status propagation'),
1110
+ )
1111
+ uplink_status_group.add_argument(
1112
+ '--disable-uplink-status-propagation',
1113
+ action='store_true',
1114
+ help=_('Disable uplink status propagation'),
1115
+ )
1116
+
1106
1117
  _tag.add_tag_option_to_parser_for_set(parser, _('port'))
1107
1118
 
1108
1119
  return parser
@@ -1250,7 +1261,7 @@ class UnsetPort(common.NeutronUnsetCommandWithExtraArgs):
1250
1261
  action='append',
1251
1262
  help=_(
1252
1263
  "Desired key which should be removed from binding:profile "
1253
- "(repeat option to unset multiple binding:profile data)"
1264
+ "(repeat option to unset multiple binding:profile keys)"
1254
1265
  ),
1255
1266
  )
1256
1267
  parser.add_argument(
@@ -1286,7 +1297,7 @@ class UnsetPort(common.NeutronUnsetCommandWithExtraArgs):
1286
1297
  parser.add_argument(
1287
1298
  '--data-plane-status',
1288
1299
  action='store_true',
1289
- help=_("Clear existing information of data plane status"),
1300
+ help=_("Clear existing data plane status information"),
1290
1301
  )
1291
1302
  parser.add_argument(
1292
1303
  '--numa-policy',
@@ -1297,13 +1308,13 @@ class UnsetPort(common.NeutronUnsetCommandWithExtraArgs):
1297
1308
  '--host',
1298
1309
  action='store_true',
1299
1310
  default=False,
1300
- help=_("Clear host binding for the port."),
1311
+ help=_("Clear host binding for the port"),
1301
1312
  )
1302
1313
  parser.add_argument(
1303
1314
  '--hints',
1304
1315
  action='store_true',
1305
1316
  default=False,
1306
- help=_("Clear hints for the port."),
1317
+ help=_("Clear hints for the port"),
1307
1318
  )
1308
1319
  _tag.add_tag_option_to_parser_for_unset(parser, _('port'))
1309
1320
  parser.add_argument(