python-openstackclient 7.4.0__py3-none-any.whl → 8.1.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 (264) 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 +7 -5
  9. openstackclient/compute/v2/agent.py +5 -5
  10. openstackclient/compute/v2/aggregate.py +17 -15
  11. openstackclient/compute/v2/console.py +10 -4
  12. openstackclient/compute/v2/console_connection.py +48 -0
  13. openstackclient/compute/v2/flavor.py +14 -18
  14. openstackclient/compute/v2/host.py +3 -3
  15. openstackclient/compute/v2/hypervisor.py +10 -4
  16. openstackclient/compute/v2/hypervisor_stats.py +1 -1
  17. openstackclient/compute/v2/keypair.py +18 -13
  18. openstackclient/compute/v2/server.py +144 -121
  19. openstackclient/compute/v2/server_backup.py +1 -1
  20. openstackclient/compute/v2/server_event.py +8 -17
  21. openstackclient/compute/v2/server_group.py +6 -6
  22. openstackclient/compute/v2/server_image.py +1 -1
  23. openstackclient/compute/v2/server_migration.py +6 -6
  24. openstackclient/compute/v2/server_volume.py +4 -4
  25. openstackclient/compute/v2/service.py +9 -13
  26. openstackclient/compute/v2/usage.py +4 -6
  27. openstackclient/identity/client.py +2 -4
  28. openstackclient/identity/common.py +95 -17
  29. openstackclient/identity/v2_0/ec2creds.py +4 -3
  30. openstackclient/identity/v2_0/endpoint.py +12 -10
  31. openstackclient/identity/v2_0/project.py +6 -6
  32. openstackclient/identity/v2_0/role.py +1 -1
  33. openstackclient/identity/v2_0/service.py +7 -7
  34. openstackclient/identity/v2_0/user.py +6 -21
  35. openstackclient/identity/v3/access_rule.py +2 -5
  36. openstackclient/identity/v3/application_credential.py +2 -2
  37. openstackclient/identity/v3/consumer.py +4 -3
  38. openstackclient/identity/v3/credential.py +6 -7
  39. openstackclient/identity/v3/domain.py +63 -44
  40. openstackclient/identity/v3/ec2creds.py +4 -3
  41. openstackclient/identity/v3/endpoint.py +104 -88
  42. openstackclient/identity/v3/endpoint_group.py +1 -1
  43. openstackclient/identity/v3/group.py +116 -72
  44. openstackclient/identity/v3/identity_provider.py +1 -2
  45. openstackclient/identity/v3/limit.py +4 -9
  46. openstackclient/identity/v3/mapping.py +4 -3
  47. openstackclient/identity/v3/policy.py +5 -8
  48. openstackclient/identity/v3/project.py +23 -6
  49. openstackclient/identity/v3/region.py +2 -5
  50. openstackclient/identity/v3/registered_limit.py +4 -8
  51. openstackclient/identity/v3/role.py +15 -16
  52. openstackclient/identity/v3/service.py +8 -8
  53. openstackclient/identity/v3/service_provider.py +3 -6
  54. openstackclient/identity/v3/tag.py +2 -2
  55. openstackclient/identity/v3/token.py +1 -2
  56. openstackclient/identity/v3/trust.py +74 -25
  57. openstackclient/identity/v3/user.py +47 -11
  58. openstackclient/image/client.py +7 -5
  59. openstackclient/image/v1/image.py +11 -15
  60. openstackclient/image/v2/cache.py +2 -4
  61. openstackclient/image/v2/image.py +41 -48
  62. openstackclient/image/v2/metadef_namespaces.py +4 -3
  63. openstackclient/image/v2/metadef_resource_type_association.py +1 -2
  64. openstackclient/image/v2/metadef_resource_types.py +1 -2
  65. openstackclient/locale/tr_TR/LC_MESSAGES/openstackclient.po +9 -1370
  66. openstackclient/network/client.py +4 -16
  67. openstackclient/network/common.py +16 -12
  68. openstackclient/network/utils.py +3 -3
  69. openstackclient/network/v2/address_group.py +5 -9
  70. openstackclient/network/v2/address_scope.py +2 -3
  71. openstackclient/network/v2/default_security_group_rule.py +1 -2
  72. openstackclient/network/v2/floating_ip.py +69 -47
  73. openstackclient/network/v2/floating_ip_port_forwarding.py +7 -7
  74. openstackclient/network/v2/ip_availability.py +1 -2
  75. openstackclient/network/v2/l3_conntrack_helper.py +8 -12
  76. openstackclient/network/v2/local_ip.py +24 -26
  77. openstackclient/network/v2/local_ip_association.py +4 -5
  78. openstackclient/network/v2/ndp_proxy.py +9 -10
  79. openstackclient/network/v2/network.py +12 -16
  80. openstackclient/network/v2/network_agent.py +29 -37
  81. openstackclient/network/v2/network_auto_allocated_topology.py +4 -5
  82. openstackclient/network/v2/network_flavor.py +1 -1
  83. openstackclient/network/v2/network_flavor_profile.py +5 -5
  84. openstackclient/network/v2/network_meter.py +3 -3
  85. openstackclient/network/v2/network_meter_rule.py +5 -8
  86. openstackclient/network/v2/network_qos_policy.py +4 -4
  87. openstackclient/network/v2/network_qos_rule.py +7 -16
  88. openstackclient/network/v2/network_rbac.py +4 -4
  89. openstackclient/network/v2/network_segment.py +6 -7
  90. openstackclient/network/v2/network_segment_range.py +16 -20
  91. openstackclient/network/v2/network_trunk.py +24 -16
  92. openstackclient/network/v2/port.py +28 -29
  93. openstackclient/network/v2/router.py +53 -42
  94. openstackclient/network/v2/security_group.py +13 -19
  95. openstackclient/network/v2/security_group_rule.py +10 -11
  96. openstackclient/network/v2/subnet.py +31 -30
  97. openstackclient/network/v2/subnet_pool.py +4 -4
  98. openstackclient/object/client.py +2 -3
  99. openstackclient/object/v1/container.py +2 -3
  100. openstackclient/object/v1/object.py +2 -9
  101. openstackclient/shell.py +22 -5
  102. openstackclient/tests/functional/base.py +7 -3
  103. openstackclient/tests/functional/common/test_quota.py +3 -1
  104. openstackclient/tests/functional/compute/v2/common.py +12 -6
  105. openstackclient/tests/functional/compute/v2/test_keypair.py +41 -5
  106. openstackclient/tests/functional/compute/v2/test_server.py +2 -3
  107. openstackclient/tests/functional/compute/v2/test_server_event.py +1 -1
  108. openstackclient/tests/functional/identity/v2/test_user.py +1 -1
  109. openstackclient/tests/functional/identity/v3/common.py +3 -8
  110. openstackclient/tests/functional/identity/v3/test_application_credential.py +10 -10
  111. openstackclient/tests/functional/identity/v3/test_endpoint.py +3 -3
  112. openstackclient/tests/functional/identity/v3/test_group.py +3 -3
  113. openstackclient/tests/functional/identity/v3/test_idp.py +3 -7
  114. openstackclient/tests/functional/identity/v3/test_limit.py +4 -4
  115. openstackclient/tests/functional/identity/v3/test_project.py +5 -14
  116. openstackclient/tests/functional/identity/v3/test_region.py +1 -3
  117. openstackclient/tests/functional/identity/v3/test_registered_limit.py +3 -3
  118. openstackclient/tests/functional/identity/v3/test_role.py +1 -1
  119. openstackclient/tests/functional/identity/v3/test_role_assignment.py +13 -31
  120. openstackclient/tests/functional/identity/v3/test_service_provider.py +3 -7
  121. openstackclient/tests/functional/identity/v3/test_user.py +8 -8
  122. openstackclient/tests/functional/network/v2/common.py +7 -3
  123. openstackclient/tests/functional/network/v2/test_address_group.py +4 -0
  124. openstackclient/tests/functional/network/v2/test_l3_conntrack_helper.py +15 -11
  125. openstackclient/tests/functional/network/v2/test_local_ip.py +4 -0
  126. openstackclient/tests/functional/network/v2/test_network_meter_rule.py +2 -2
  127. openstackclient/tests/functional/network/v2/test_network_ndp_proxy.py +2 -3
  128. openstackclient/tests/functional/network/v2/test_network_rbac.py +2 -2
  129. openstackclient/tests/functional/network/v2/test_network_trunk.py +1 -1
  130. openstackclient/tests/functional/network/v2/test_port.py +17 -7
  131. openstackclient/tests/functional/network/v2/test_router.py +42 -0
  132. openstackclient/tests/functional/network/v2/test_subnet_pool.py +4 -0
  133. openstackclient/tests/unit/api/test_compute_v2.py +67 -87
  134. openstackclient/tests/unit/common/test_availability_zone.py +6 -14
  135. openstackclient/tests/unit/common/test_command.py +1 -1
  136. openstackclient/tests/unit/common/test_extension.py +5 -7
  137. openstackclient/tests/unit/common/test_limits.py +1 -1
  138. openstackclient/tests/unit/common/test_project_cleanup.py +5 -6
  139. openstackclient/tests/unit/common/test_quota.py +51 -28
  140. openstackclient/tests/unit/compute/v2/fakes.py +85 -315
  141. openstackclient/tests/unit/compute/v2/test_agent.py +16 -16
  142. openstackclient/tests/unit/compute/v2/test_aggregate.py +56 -60
  143. openstackclient/tests/unit/compute/v2/test_console.py +34 -17
  144. openstackclient/tests/unit/compute/v2/test_console_connection.py +72 -0
  145. openstackclient/tests/unit/compute/v2/test_flavor.py +72 -72
  146. openstackclient/tests/unit/compute/v2/test_host.py +8 -8
  147. openstackclient/tests/unit/compute/v2/test_hypervisor.py +22 -30
  148. openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +2 -2
  149. openstackclient/tests/unit/compute/v2/test_keypair.py +36 -29
  150. openstackclient/tests/unit/compute/v2/test_server.py +693 -606
  151. openstackclient/tests/unit/compute/v2/test_server_backup.py +36 -77
  152. openstackclient/tests/unit/compute/v2/test_server_event.py +18 -20
  153. openstackclient/tests/unit/compute/v2/test_server_group.py +25 -31
  154. openstackclient/tests/unit/compute/v2/test_server_image.py +37 -78
  155. openstackclient/tests/unit/compute/v2/test_server_migration.py +41 -41
  156. openstackclient/tests/unit/compute/v2/test_server_volume.py +12 -12
  157. openstackclient/tests/unit/compute/v2/test_service.py +39 -45
  158. openstackclient/tests/unit/compute/v2/test_usage.py +5 -5
  159. openstackclient/tests/unit/identity/v2_0/fakes.py +1 -1
  160. openstackclient/tests/unit/identity/v3/test_access_rule.py +1 -3
  161. openstackclient/tests/unit/identity/v3/test_application_credential.py +48 -26
  162. openstackclient/tests/unit/identity/v3/test_domain.py +115 -105
  163. openstackclient/tests/unit/identity/v3/test_endpoint.py +167 -172
  164. openstackclient/tests/unit/identity/v3/test_group.py +353 -202
  165. openstackclient/tests/unit/identity/v3/test_mappings.py +2 -2
  166. openstackclient/tests/unit/identity/v3/test_project.py +16 -0
  167. openstackclient/tests/unit/identity/v3/test_trust.py +5 -2
  168. openstackclient/tests/unit/identity/v3/test_user.py +102 -6
  169. openstackclient/tests/unit/image/v1/fakes.py +2 -2
  170. openstackclient/tests/unit/image/v1/test_image.py +8 -9
  171. openstackclient/tests/unit/image/v2/test_image.py +84 -46
  172. openstackclient/tests/unit/integ/cli/test_shell.py +1 -2
  173. openstackclient/tests/unit/network/test_common.py +2 -2
  174. openstackclient/tests/unit/network/v2/fakes.py +405 -485
  175. openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +8 -14
  176. openstackclient/tests/unit/network/v2/test_floating_ip_network.py +62 -54
  177. openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +1 -1
  178. openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py +2 -2
  179. openstackclient/tests/unit/network/v2/test_ndp_proxy.py +1 -3
  180. openstackclient/tests/unit/network/v2/test_network.py +4 -4
  181. openstackclient/tests/unit/network/v2/test_network_agent.py +15 -29
  182. openstackclient/tests/unit/network/v2/test_network_compute.py +11 -11
  183. openstackclient/tests/unit/network/v2/test_network_qos_policy.py +16 -19
  184. openstackclient/tests/unit/network/v2/test_network_qos_rule.py +79 -152
  185. openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +4 -6
  186. openstackclient/tests/unit/network/v2/test_network_rbac.py +2 -2
  187. openstackclient/tests/unit/network/v2/test_network_trunk.py +2 -2
  188. openstackclient/tests/unit/network/v2/test_port.py +21 -22
  189. openstackclient/tests/unit/network/v2/test_router.py +130 -51
  190. openstackclient/tests/unit/network/v2/test_security_group_compute.py +11 -19
  191. openstackclient/tests/unit/network/v2/test_security_group_network.py +25 -27
  192. openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +15 -17
  193. openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +33 -39
  194. openstackclient/tests/unit/object/v1/test_object_all.py +4 -3
  195. openstackclient/tests/unit/test_shell.py +16 -13
  196. openstackclient/tests/unit/volume/v2/fakes.py +1 -2
  197. openstackclient/tests/unit/volume/v2/test_service.py +57 -91
  198. openstackclient/tests/unit/volume/v2/test_volume.py +109 -106
  199. openstackclient/tests/unit/volume/v2/test_volume_backup.py +141 -148
  200. openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +293 -283
  201. openstackclient/tests/unit/volume/v2/test_volume_transfer_request.py +1 -1
  202. openstackclient/tests/unit/volume/v3/fakes.py +2 -8
  203. openstackclient/tests/unit/volume/v3/test_block_storage_log_level.py +61 -71
  204. openstackclient/tests/unit/volume/v3/test_service.py +221 -141
  205. openstackclient/tests/unit/volume/v3/test_volume.py +131 -120
  206. openstackclient/tests/unit/volume/v3/test_volume_attachment.py +4 -4
  207. openstackclient/tests/unit/volume/v3/test_volume_backup.py +198 -203
  208. openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +683 -49
  209. openstackclient/tests/unit/volume/v3/test_volume_transfer_request.py +1 -1
  210. openstackclient/volume/client.py +1 -3
  211. openstackclient/volume/v2/consistency_group.py +4 -8
  212. openstackclient/volume/v2/consistency_group_snapshot.py +1 -2
  213. openstackclient/volume/v2/qos_specs.py +1 -2
  214. openstackclient/volume/v2/service.py +41 -38
  215. openstackclient/volume/v2/volume.py +71 -53
  216. openstackclient/volume/v2/volume_backup.py +15 -10
  217. openstackclient/volume/v2/volume_snapshot.py +129 -93
  218. openstackclient/volume/v2/volume_transfer_request.py +0 -3
  219. openstackclient/volume/v2/volume_type.py +10 -21
  220. openstackclient/volume/v3/block_storage_cluster.py +3 -3
  221. openstackclient/volume/v3/block_storage_log_level.py +22 -28
  222. openstackclient/volume/v3/block_storage_manage.py +1 -3
  223. openstackclient/volume/v3/service.py +105 -14
  224. openstackclient/volume/v3/volume.py +218 -58
  225. openstackclient/volume/v3/volume_attachment.py +3 -2
  226. openstackclient/volume/v3/volume_backup.py +31 -27
  227. openstackclient/volume/v3/volume_group.py +2 -1
  228. openstackclient/volume/v3/volume_group_snapshot.py +2 -1
  229. openstackclient/volume/v3/volume_snapshot.py +489 -13
  230. openstackclient/volume/v3/volume_type.py +10 -21
  231. {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/AUTHORS +11 -0
  232. python_openstackclient-8.1.0.dist-info/METADATA +264 -0
  233. {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/RECORD +238 -259
  234. {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/WHEEL +1 -1
  235. {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/entry_points.txt +7 -47
  236. python_openstackclient-8.1.0.dist-info/pbr.json +1 -0
  237. openstackclient/tests/functional/volume/v1/__init__.py +0 -0
  238. openstackclient/tests/functional/volume/v1/common.py +0 -35
  239. openstackclient/tests/functional/volume/v1/test_qos.py +0 -100
  240. openstackclient/tests/functional/volume/v1/test_service.py +0 -76
  241. openstackclient/tests/functional/volume/v1/test_snapshot.py +0 -232
  242. openstackclient/tests/functional/volume/v1/test_transfer_request.py +0 -111
  243. openstackclient/tests/functional/volume/v1/test_volume.py +0 -228
  244. openstackclient/tests/functional/volume/v1/test_volume_type.py +0 -213
  245. openstackclient/tests/unit/volume/v1/__init__.py +0 -0
  246. openstackclient/tests/unit/volume/v1/fakes.py +0 -615
  247. openstackclient/tests/unit/volume/v1/test_qos_specs.py +0 -471
  248. openstackclient/tests/unit/volume/v1/test_service.py +0 -295
  249. openstackclient/tests/unit/volume/v1/test_transfer_request.py +0 -380
  250. openstackclient/tests/unit/volume/v1/test_type.py +0 -633
  251. openstackclient/tests/unit/volume/v1/test_volume.py +0 -1447
  252. openstackclient/tests/unit/volume/v1/test_volume_backup.py +0 -435
  253. openstackclient/volume/v1/__init__.py +0 -0
  254. openstackclient/volume/v1/qos_specs.py +0 -377
  255. openstackclient/volume/v1/service.py +0 -136
  256. openstackclient/volume/v1/volume.py +0 -734
  257. openstackclient/volume/v1/volume_backup.py +0 -302
  258. openstackclient/volume/v1/volume_snapshot.py +0 -433
  259. openstackclient/volume/v1/volume_transfer_request.py +0 -200
  260. openstackclient/volume/v1/volume_type.py +0 -520
  261. python_openstackclient-7.4.0.dist-info/METADATA +0 -172
  262. python_openstackclient-7.4.0.dist-info/pbr.json +0 -1
  263. {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/LICENSE +0 -0
  264. {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/top_level.txt +0 -0
@@ -54,13 +54,9 @@ class IdentityProviderTests(common.IdentityTests):
54
54
  identity_provider = self._create_dummy_idp(add_clean_up=True)
55
55
  new_remoteid = data_utils.rand_name('newRemoteId')
56
56
  raw_output = self.openstack(
57
- 'identity provider set '
58
- '%(identity-provider)s '
59
- '--remote-id %(remote-id)s '
60
- % {
61
- 'identity-provider': identity_provider,
62
- 'remote-id': new_remoteid,
63
- }
57
+ f'identity provider set '
58
+ f'{identity_provider} '
59
+ f'--remote-id {new_remoteid}'
64
60
  )
65
61
  self.assertEqual(0, len(raw_output))
66
62
  raw_output = self.openstack(
@@ -174,7 +174,7 @@ class LimitTestCase(common.IdentityTests):
174
174
  }
175
175
 
176
176
  raw_output = self.openstack(
177
- 'limit set' ' --description {description}' ' {limit_id}'.format(
177
+ 'limit set --description {description} {limit_id}'.format(
178
178
  **params
179
179
  ),
180
180
  cloud=SYSTEM_CLOUD,
@@ -188,9 +188,9 @@ class LimitTestCase(common.IdentityTests):
188
188
  params = {'resource_limit': 5, 'limit_id': limit_id}
189
189
 
190
190
  raw_output = self.openstack(
191
- 'limit set'
192
- ' --resource-limit {resource_limit}'
193
- ' {limit_id}'.format(**params),
191
+ 'limit set --resource-limit {resource_limit} {limit_id}'.format(
192
+ **params
193
+ ),
194
194
  cloud=SYSTEM_CLOUD,
195
195
  )
196
196
  items = self.parse_show(raw_output)
@@ -30,9 +30,7 @@ class ProjectTests(common.IdentityTests):
30
30
  )
31
31
  self.addCleanup(
32
32
  self.openstack,
33
- 'project delete '
34
- f'--domain {self.domain_name} '
35
- f'{project_name}',
33
+ f'project delete --domain {self.domain_name} {project_name}',
36
34
  )
37
35
  items = self.parse_show(raw_output)
38
36
  show_fields = list(self.PROJECT_FIELDS)
@@ -45,7 +43,7 @@ class ProjectTests(common.IdentityTests):
45
43
  def test_project_delete(self):
46
44
  project_name = self._create_dummy_project(add_clean_up=False)
47
45
  raw_output = self.openstack(
48
- 'project delete ' f'--domain {self.domain_name} ' f'{project_name}'
46
+ f'project delete --domain {self.domain_name} {project_name}'
49
47
  )
50
48
  self.assertEqual(0, len(raw_output))
51
49
 
@@ -77,9 +75,7 @@ class ProjectTests(common.IdentityTests):
77
75
  self.assertEqual(0, len(raw_output))
78
76
  # check project details
79
77
  raw_output = self.openstack(
80
- 'project show '
81
- f'--domain {self.domain_name} '
82
- f'{new_project_name}'
78
+ f'project show --domain {self.domain_name} {new_project_name}'
83
79
  )
84
80
  items = self.parse_show(raw_output)
85
81
  fields = list(self.PROJECT_FIELDS)
@@ -91,17 +87,12 @@ class ProjectTests(common.IdentityTests):
91
87
  self.assertEqual('v0', project['k0'])
92
88
  # reset project to make sure it will be cleaned up
93
89
  self.openstack(
94
- 'project set '
95
- f'--name {project_name} '
96
- '--enable '
97
- f'{new_project_name}'
90
+ f'project set --name {project_name} --enable {new_project_name}'
98
91
  )
99
92
 
100
93
  def test_project_show(self):
101
94
  raw_output = self.openstack(
102
- 'project show '
103
- f'--domain {self.domain_name} '
104
- f'{self.project_name}'
95
+ f'project show --domain {self.domain_name} {self.project_name}'
105
96
  )
106
97
  items = self.parse_show(raw_output)
107
98
  self.assert_show_fields(items, self.PROJECT_FIELDS)
@@ -49,9 +49,7 @@ class RegionTests(common.IdentityTests):
49
49
  self.assertEqual(region_id, region['region'])
50
50
  # update parent-region
51
51
  raw_output = self.openstack(
52
- 'region set '
53
- f'--parent-region {new_parent_region_id} '
54
- f'{region_id}'
52
+ f'region set --parent-region {new_parent_region_id} {region_id}'
55
53
  )
56
54
  self.assertEqual(0, len(raw_output))
57
55
  # check updated region details
@@ -25,7 +25,7 @@ class RegisteredLimitTestCase(common.IdentityTests):
25
25
 
26
26
  def test_registered_limit_create_with_service_id(self):
27
27
  service_name = self._create_dummy_service()
28
- raw_output = self.openstack('service show' f' {service_name}')
28
+ raw_output = self.openstack(f'service show {service_name}')
29
29
  service_items = self.parse_show(raw_output)
30
30
  service_id = self._extract_value_from_items('id', service_items)
31
31
 
@@ -44,7 +44,7 @@ class RegisteredLimitTestCase(common.IdentityTests):
44
44
  registered_limit_id = self._extract_value_from_items('id', items)
45
45
  self.addCleanup(
46
46
  self.openstack,
47
- 'registered limit delete' f' {registered_limit_id}',
47
+ f'registered limit delete {registered_limit_id}',
48
48
  cloud=SYSTEM_CLOUD,
49
49
  )
50
50
 
@@ -178,7 +178,7 @@ class RegisteredLimitTestCase(common.IdentityTests):
178
178
  add_clean_up=False
179
179
  )
180
180
  raw_output = self.openstack(
181
- 'registered limit delete' f' {registered_limit_id}',
181
+ f'registered limit delete {registered_limit_id}',
182
182
  cloud=SYSTEM_CLOUD,
183
183
  )
184
184
  self.assertEqual(0, len(raw_output))
@@ -23,7 +23,7 @@ class RoleTests(common.IdentityTests):
23
23
  role_name = data_utils.rand_name('TestRole')
24
24
  description = data_utils.rand_name('description')
25
25
  raw_output = self.openstack(
26
- 'role create ' f'--description {description} ' f'{role_name}'
26
+ f'role create --description {description} {role_name}'
27
27
  )
28
28
  role = self.parse_show_as_object(raw_output)
29
29
  self.addCleanup(self.openstack, 'role delete {}'.format(role['id']))
@@ -24,35 +24,25 @@ class RoleAssignmentTests(common.IdentityTests):
24
24
  username = self._create_dummy_user()
25
25
  system = 'all'
26
26
  raw_output = self.openstack(
27
- 'role add '
28
- f'--user {username} '
29
- f'--system {system} '
30
- f'{role_name}'
27
+ f'role add --user {username} --system {system} {role_name}'
31
28
  )
32
29
  self.addCleanup(
33
30
  self.openstack,
34
- 'role remove '
35
- f'--user {username} '
36
- f'--system {system} '
37
- f'{role_name}',
31
+ f'role remove --user {username} --system {system} {role_name}',
38
32
  )
39
33
  self.assertEqual(0, len(raw_output))
40
34
 
41
- raw_output = self.openstack(
42
- 'role assignment list ' f'--user {username} '
43
- )
35
+ raw_output = self.openstack(f'role assignment list --user {username} ')
44
36
  items = self.parse_listing(raw_output)
45
37
  self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
46
38
 
47
39
  raw_output = self.openstack(
48
- 'role assignment list ' f'--role {role_name} '
40
+ f'role assignment list --role {role_name} '
49
41
  )
50
42
  items = self.parse_listing(raw_output)
51
43
  self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
52
44
 
53
- raw_output = self.openstack(
54
- 'role assignment list ' f'--system {system} '
55
- )
45
+ raw_output = self.openstack(f'role assignment list --system {system} ')
56
46
  items = self.parse_listing(raw_output)
57
47
  self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
58
48
 
@@ -61,22 +51,14 @@ class RoleAssignmentTests(common.IdentityTests):
61
51
  group = self._create_dummy_group()
62
52
  system = 'all'
63
53
  raw_output = self.openstack(
64
- 'role add '
65
- f'--group {group} '
66
- f'--system {system} '
67
- f'{role_name}'
54
+ f'role add --group {group} --system {system} {role_name}'
68
55
  )
69
56
  self.addCleanup(
70
57
  self.openstack,
71
- 'role remove '
72
- f'--group {group} '
73
- f'--system {system} '
74
- f'{role_name}',
58
+ f'role remove --group {group} --system {system} {role_name}',
75
59
  )
76
60
  self.assertEqual(0, len(raw_output))
77
- raw_output = self.openstack(
78
- 'role assignment list ' f'--group {group} '
79
- )
61
+ raw_output = self.openstack(f'role assignment list --group {group} ')
80
62
  items = self.parse_listing(raw_output)
81
63
  self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
82
64
 
@@ -98,7 +80,7 @@ class RoleAssignmentTests(common.IdentityTests):
98
80
  )
99
81
  self.assertEqual(0, len(raw_output))
100
82
  raw_output = self.openstack(
101
- 'role assignment list ' f'--domain {self.domain_name} '
83
+ f'role assignment list --domain {self.domain_name} '
102
84
  )
103
85
  items = self.parse_listing(raw_output)
104
86
  self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
@@ -121,23 +103,23 @@ class RoleAssignmentTests(common.IdentityTests):
121
103
  )
122
104
  self.assertEqual(0, len(raw_output))
123
105
  raw_output = self.openstack(
124
- 'role assignment list ' f'--project {self.project_name} '
106
+ f'role assignment list --project {self.project_name} '
125
107
  )
126
108
  items = self.parse_listing(raw_output)
127
109
  self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
128
110
 
129
111
  def test_role_assignment_list_effective(self):
130
- raw_output = self.openstack('role assignment list ' '--effective')
112
+ raw_output = self.openstack('role assignment list --effective')
131
113
  items = self.parse_listing(raw_output)
132
114
  self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
133
115
 
134
116
  def test_role_assignment_list_auth_user(self):
135
- raw_output = self.openstack('role assignment list ' '--auth-user')
117
+ raw_output = self.openstack('role assignment list --auth-user')
136
118
  items = self.parse_listing(raw_output)
137
119
  self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
138
120
 
139
121
  def test_role_assignment_list_auth_project(self):
140
- raw_output = self.openstack('role assignment list ' '--auth-project')
122
+ raw_output = self.openstack('role assignment list --auth-project')
141
123
  items = self.parse_listing(raw_output)
142
124
  self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
143
125
 
@@ -52,13 +52,9 @@ class ServiceProviderTests(common.IdentityTests):
52
52
  service_provider = self._create_dummy_sp(add_clean_up=True)
53
53
  new_description = data_utils.rand_name('newDescription')
54
54
  raw_output = self.openstack(
55
- 'service provider set '
56
- '%(service-provider)s '
57
- '--description %(description)s '
58
- % {
59
- 'service-provider': service_provider,
60
- 'description': new_description,
61
- }
55
+ f'service provider set '
56
+ f'{service_provider} '
57
+ f'--description {new_description}'
62
58
  )
63
59
  updated_value = self.parse_show_as_object(raw_output)
64
60
  self.assertEqual(new_description, updated_value.get('description'))
@@ -22,7 +22,7 @@ class UserTests(common.IdentityTests):
22
22
  def test_user_delete(self):
23
23
  username = self._create_dummy_user(add_clean_up=False)
24
24
  raw_output = self.openstack(
25
- 'user delete ' f'--domain {self.domain_name} ' f'{username}'
25
+ f'user delete --domain {self.domain_name} {username}'
26
26
  )
27
27
  self.assertEqual(0, len(raw_output))
28
28
 
@@ -34,19 +34,19 @@ class UserTests(common.IdentityTests):
34
34
  def test_user_set(self):
35
35
  username = self._create_dummy_user()
36
36
  raw_output = self.openstack(
37
- 'user show ' f'--domain {self.domain_name} ' f'{username}'
37
+ f'user show --domain {self.domain_name} {username}'
38
38
  )
39
39
  user = self.parse_show_as_object(raw_output)
40
40
  new_username = data_utils.rand_name('NewTestUser')
41
41
  new_email = data_utils.rand_name() + '@example.com'
42
42
  raw_output = self.openstack(
43
- 'user set ' '--email {email} ' '--name {new_name} ' '{id}'.format(
43
+ 'user set --email {email} --name {new_name} {id}'.format(
44
44
  email=new_email, new_name=new_username, id=user['id']
45
45
  )
46
46
  )
47
47
  self.assertEqual(0, len(raw_output))
48
48
  raw_output = self.openstack(
49
- 'user show ' f'--domain {self.domain_name} ' f'{new_username}'
49
+ f'user show --domain {self.domain_name} {new_username}'
50
50
  )
51
51
  updated_user = self.parse_show_as_object(raw_output)
52
52
  self.assertEqual(user['id'], updated_user['id'])
@@ -57,7 +57,7 @@ class UserTests(common.IdentityTests):
57
57
  project_name = self._create_dummy_project()
58
58
  # get original user details
59
59
  raw_output = self.openstack(
60
- 'user show ' f'--domain {self.domain_name} ' f'{username}'
60
+ f'user show --domain {self.domain_name} {username}'
61
61
  )
62
62
  user = self.parse_show_as_object(raw_output)
63
63
  # update user
@@ -74,12 +74,12 @@ class UserTests(common.IdentityTests):
74
74
  self.assertEqual(0, len(raw_output))
75
75
  # get updated user details
76
76
  raw_output = self.openstack(
77
- 'user show ' f'--domain {self.domain_name} ' f'{username}'
77
+ f'user show --domain {self.domain_name} {username}'
78
78
  )
79
79
  updated_user = self.parse_show_as_object(raw_output)
80
80
  # get project details
81
81
  raw_output = self.openstack(
82
- 'project show ' f'--domain {self.domain_name} ' f'{project_name}'
82
+ f'project show --domain {self.domain_name} {project_name}'
83
83
  )
84
84
  project = self.parse_show_as_object(raw_output)
85
85
  # check updated user details
@@ -89,7 +89,7 @@ class UserTests(common.IdentityTests):
89
89
  def test_user_show(self):
90
90
  username = self._create_dummy_user()
91
91
  raw_output = self.openstack(
92
- 'user show ' f'--domain {self.domain_name} ' f'{username}'
92
+ f'user show --domain {self.domain_name} {username}'
93
93
  )
94
94
  items = self.parse_show(raw_output)
95
95
  self.assert_show_fields(items, self.USER_FIELDS)
@@ -33,7 +33,7 @@ class NetworkTests(base.TestCase):
33
33
  class NetworkTagTests(NetworkTests):
34
34
  """Functional tests with tag operation"""
35
35
 
36
- base_command = None
36
+ base_command: str
37
37
 
38
38
  def test_tag_operation(self):
39
39
  # Get project IDs
@@ -56,7 +56,7 @@ class NetworkTagTests(NetworkTests):
56
56
  'set', name1, '--tag red --tag green', ['red', 'green']
57
57
  )
58
58
 
59
- list_expected = (
59
+ list_expected: tuple[tuple[str, list[str]], ...] = (
60
60
  (name1, ['red', 'green']),
61
61
  (name2, ['red', 'blue']),
62
62
  (name3, []),
@@ -93,7 +93,11 @@ class NetworkTagTests(NetworkTests):
93
93
  parse_output=True,
94
94
  )
95
95
 
96
- def _create_resource_and_tag_check(self, args, expected):
96
+ def _create_resource_and_tag_check(
97
+ self,
98
+ args: str,
99
+ expected: list[str],
100
+ ) -> str:
97
101
  name = uuid.uuid4().hex
98
102
  cmd_output = self._create_resource_for_tag_test(name, args)
99
103
  self.addCleanup(self.openstack, f'{self.base_command} delete {name}')
@@ -75,6 +75,10 @@ class AddressGroupTests(common.NetworkTests):
75
75
  self.assertNotEqual(admin_project_id, demo_project_id)
76
76
  self.assertEqual(admin_project_id, auth_project_id)
77
77
 
78
+ # type narrow
79
+ assert admin_project_id is not None
80
+ assert demo_project_id is not None
81
+
78
82
  name1 = uuid.uuid4().hex
79
83
  cmd_output = self.openstack(
80
84
  'address group create ' + name1,
@@ -69,8 +69,7 @@ class L3ConntrackHelperTests(common.NetworkTests):
69
69
  ct_ids = " ".join([ct['id'] for ct in created_helpers])
70
70
 
71
71
  raw_output = self.openstack(
72
- f'--debug network l3 conntrack helper delete {router_id} '
73
- f'{ct_ids}'
72
+ f'--debug network l3 conntrack helper delete {router_id} {ct_ids}'
74
73
  )
75
74
  self.assertOutput('', raw_output)
76
75
 
@@ -95,9 +94,14 @@ class L3ConntrackHelperTests(common.NetworkTests):
95
94
  self.assertIn(ct, expected_helpers)
96
95
 
97
96
  def test_l3_conntrack_helper_set_and_show(self):
98
- helper = {'helper': 'tftp', 'protocol': 'udp', 'port': 69}
97
+ helper = 'tftp'
98
+ proto = 'udp'
99
+ port = 69
99
100
  router_id = self._create_router()
100
- created_helper = self._create_helpers(router_id, [helper])[0]
101
+ created_helper = self._create_helpers(
102
+ router_id,
103
+ [{'helper': helper, 'protocol': proto, 'port': port}],
104
+ )[0]
101
105
  output = self.openstack(
102
106
  'network l3 conntrack helper show {router_id} {ct_id} '
103
107
  '-f json'.format(
@@ -106,16 +110,16 @@ class L3ConntrackHelperTests(common.NetworkTests):
106
110
  ),
107
111
  parse_output=True,
108
112
  )
109
- self.assertEqual(helper['helper'], output['helper'])
110
- self.assertEqual(helper['protocol'], output['protocol'])
111
- self.assertEqual(helper['port'], output['port'])
113
+ self.assertEqual(port, output['port'])
114
+ self.assertEqual(helper, output['helper'])
115
+ self.assertEqual(proto, output['protocol'])
112
116
 
113
117
  raw_output = self.openstack(
114
118
  'network l3 conntrack helper set {router_id} {ct_id} '
115
119
  '--port {port} '.format(
116
120
  router_id=router_id,
117
121
  ct_id=created_helper['id'],
118
- port=helper['port'] + 1,
122
+ port=port + 1,
119
123
  )
120
124
  )
121
125
  self.assertOutput('', raw_output)
@@ -128,6 +132,6 @@ class L3ConntrackHelperTests(common.NetworkTests):
128
132
  ),
129
133
  parse_output=True,
130
134
  )
131
- self.assertEqual(helper['port'] + 1, output['port'])
132
- self.assertEqual(helper['helper'], output['helper'])
133
- self.assertEqual(helper['protocol'], output['protocol'])
135
+ self.assertEqual(port + 1, output['port'])
136
+ self.assertEqual(helper, output['helper'])
137
+ self.assertEqual(proto, output['protocol'])
@@ -77,6 +77,10 @@ class LocalIPTests(common.NetworkTests):
77
77
  self.assertNotEqual(admin_project_id, demo_project_id)
78
78
  self.assertEqual(admin_project_id, auth_project_id)
79
79
 
80
+ # type narrow
81
+ assert admin_project_id is not None
82
+ assert demo_project_id is not None
83
+
80
84
  name1 = uuid.uuid4().hex
81
85
  cmd_output = self.openstack(
82
86
  'local ip create ' + name1,
@@ -22,8 +22,8 @@ from openstackclient.tests.functional.network.v2 import common
22
22
  class TestMeterRule(common.NetworkTests):
23
23
  """Functional tests for meter rule"""
24
24
 
25
- METER_ID = None
26
- METER_RULE_ID = None
25
+ METER_ID: str
26
+ METER_RULE_ID: str
27
27
 
28
28
  @classmethod
29
29
  def setUpClass(cls):
@@ -31,7 +31,7 @@ class L3NDPProxyTests(common.NetworkTests):
31
31
  self.created_ndp_proxies = []
32
32
 
33
33
  json_output = self.openstack(
34
- 'address scope create --ip-version 6 ' f'{self.ADDR_SCOPE_NAME}',
34
+ f'address scope create --ip-version 6 {self.ADDR_SCOPE_NAME}',
35
35
  parse_output=True,
36
36
  )
37
37
  self.assertIsNotNone(json_output['id'])
@@ -88,8 +88,7 @@ class L3NDPProxyTests(common.NetworkTests):
88
88
  self.assertIsNotNone(json_output['id'])
89
89
  self.INT_SUB_ID = json_output['id']
90
90
  json_output = self.openstack(
91
- f'port create --network {self.INT_NET_ID} '
92
- f'{self.INT_PORT_NAME}',
91
+ f'port create --network {self.INT_NET_ID} {self.INT_PORT_NAME}',
93
92
  parse_output=True,
94
93
  )
95
94
  self.assertIsNotNone(json_output['id'])
@@ -18,8 +18,8 @@ from openstackclient.tests.functional.network.v2 import common
18
18
  class NetworkRBACTests(common.NetworkTests):
19
19
  """Functional tests for network rbac"""
20
20
 
21
- OBJECT_ID = None
22
- ID = None
21
+ OBJECT_ID: str
22
+ ID: str
23
23
  HEADERS = ['ID']
24
24
  FIELDS = ['id']
25
25
 
@@ -80,7 +80,7 @@ class NetworkTrunkTests(common.NetworkTests):
80
80
  self.addCleanup(self.openstack, 'network trunk delete ' + trunk_name)
81
81
  self.assertEqual(trunk_name, json_output['name'])
82
82
 
83
- self.openstack('network trunk set ' '--enable ' + trunk_name)
83
+ self.openstack('network trunk set --enable ' + trunk_name)
84
84
 
85
85
  json_output = json.loads(
86
86
  self.openstack('network trunk show -f json ' + trunk_name)
@@ -12,6 +12,8 @@
12
12
 
13
13
  import uuid
14
14
 
15
+ from tempest.lib import exceptions as tempest_exc
16
+
15
17
  from openstackclient.tests.functional.network.v2 import common
16
18
 
17
19
 
@@ -162,8 +164,16 @@ class PortTests(common.NetworkTagTests):
162
164
  id_list = [p['ID'] for p in json_output]
163
165
  self.assertIn(id1, id_list)
164
166
  self.assertIn(id2, id_list)
165
- # Check an unknown field exists
166
- self.assertIn('device_id', json_output[0])
167
+ # Check an unknown field does not exist
168
+ self.assertNotIn('device_id', json_output[0])
169
+
170
+ # Test list with only unknown fields
171
+ exc = self.assertRaises(
172
+ tempest_exc.CommandFailed,
173
+ self.openstack,
174
+ 'port list -c device_id',
175
+ )
176
+ self.assertIn("No recognized column names in ['device_id']", str(exc))
167
177
 
168
178
  def test_port_set(self):
169
179
  """Test create, set, show, delete"""
@@ -209,7 +219,7 @@ class PortTests(common.NetworkTagTests):
209
219
  def test_port_admin_set(self):
210
220
  """Test create, set (as admin), show, delete"""
211
221
  json_output = self.openstack(
212
- 'port create ' f'--network {self.NETWORK_NAME} {self.NAME}',
222
+ f'port create --network {self.NETWORK_NAME} {self.NAME}',
213
223
  parse_output=True,
214
224
  )
215
225
  id_ = json_output.get('id')
@@ -257,7 +267,7 @@ class PortTests(common.NetworkTagTests):
257
267
  self.assertEqual([sg_id1], json_output.get('security_group_ids'))
258
268
 
259
269
  raw_output = self.openstack(
260
- 'port set ' f'--security-group {sg_name2} {name}'
270
+ f'port set --security-group {sg_name2} {name}'
261
271
  )
262
272
  self.assertOutput('', raw_output)
263
273
 
@@ -296,17 +306,17 @@ class PortTests(common.NetworkTagTests):
296
306
  sport2 = uuid.uuid4().hex
297
307
  trunk = uuid.uuid4().hex
298
308
  json_output = self.openstack(
299
- 'port create ' f'--network {self.NETWORK_NAME} {pport}',
309
+ f'port create --network {self.NETWORK_NAME} {pport}',
300
310
  parse_output=True,
301
311
  )
302
312
  pport_id = json_output.get('id')
303
313
  json_output = self.openstack(
304
- 'port create ' f'--network {self.NETWORK_NAME} {sport1}',
314
+ f'port create --network {self.NETWORK_NAME} {sport1}',
305
315
  parse_output=True,
306
316
  )
307
317
  sport1_id = json_output.get('id')
308
318
  json_output = self.openstack(
309
- 'port create ' f'--network {self.NETWORK_NAME} {sport2}',
319
+ f'port create --network {self.NETWORK_NAME} {sport2}',
310
320
  parse_output=True,
311
321
  )
312
322
  sport2_id = json_output.get('id')
@@ -44,6 +44,44 @@ class RouterTests(common.NetworkTagTests):
44
44
  del_output = self.openstack('router delete ' + name1 + ' ' + name2)
45
45
  self.assertOutput('', del_output)
46
46
 
47
+ def test_router_create_with_external_gateway(self):
48
+ network_name = uuid.uuid4().hex
49
+ subnet_name = uuid.uuid4().hex
50
+ qos_policy = uuid.uuid4().hex
51
+ router_name = uuid.uuid4().hex
52
+
53
+ cmd_net = self.openstack(
54
+ f'network create --external {network_name}', parse_output=True
55
+ )
56
+ self.addCleanup(self.openstack, f'network delete {network_name}')
57
+ network_id = cmd_net['id']
58
+
59
+ self.openstack(
60
+ f'subnet create {subnet_name} '
61
+ f'--network {network_name} --subnet-range 10.0.0.0/24'
62
+ )
63
+
64
+ cmd_qos = self.openstack(
65
+ f'network qos policy create {qos_policy}', parse_output=True
66
+ )
67
+ self.addCleanup(
68
+ self.openstack, f'network qos policy delete {qos_policy}'
69
+ )
70
+ qos_id = cmd_qos['id']
71
+
72
+ self.openstack(
73
+ f'router create --external-gateway {network_name} '
74
+ f'--qos-policy {qos_policy} {router_name}'
75
+ )
76
+ self.addCleanup(self.openstack, f'router delete {router_name}')
77
+
78
+ cmd_output = self.openstack(
79
+ f'router show {router_name}', parse_output=True
80
+ )
81
+ gw_info = cmd_output['external_gateway_info']
82
+ self.assertEqual(network_id, gw_info['network_id'])
83
+ self.assertEqual(qos_id, gw_info['qos_policy_id'])
84
+
47
85
  def test_router_list(self):
48
86
  """Test create, list filter"""
49
87
  # Get project IDs
@@ -68,6 +106,10 @@ class RouterTests(common.NetworkTagTests):
68
106
  self.assertNotEqual(admin_project_id, demo_project_id)
69
107
  self.assertEqual(admin_project_id, auth_project_id)
70
108
 
109
+ # type narrow
110
+ assert admin_project_id is not None
111
+ assert demo_project_id is not None
112
+
71
113
  name1 = uuid.uuid4().hex
72
114
  name2 = uuid.uuid4().hex
73
115
  cmd_output = self.openstack(
@@ -63,6 +63,10 @@ class SubnetPoolTests(common.NetworkTagTests):
63
63
  self.assertNotEqual(admin_project_id, demo_project_id)
64
64
  self.assertEqual(admin_project_id, auth_project_id)
65
65
 
66
+ # type narrow
67
+ assert admin_project_id is not None
68
+ assert demo_project_id is not None
69
+
66
70
  name1 = uuid.uuid4().hex
67
71
  name2 = uuid.uuid4().hex
68
72