python-openstackclient 8.3.0__py3-none-any.whl → 10.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 (292) hide show
  1. openstackclient/__init__.py +2 -6
  2. openstackclient/api/api.py +41 -23
  3. openstackclient/api/compute_v2.py +44 -25
  4. openstackclient/api/object_store_v1.py +75 -97
  5. openstackclient/api/volume_v2.py +2 -1
  6. openstackclient/api/volume_v3.py +2 -1
  7. openstackclient/common/availability_zone.py +58 -42
  8. openstackclient/common/clientmanager.py +56 -29
  9. openstackclient/common/configuration.py +10 -3
  10. openstackclient/common/envvars.py +2 -2
  11. openstackclient/common/extension.py +14 -5
  12. openstackclient/common/limits.py +10 -5
  13. openstackclient/common/module.py +14 -6
  14. openstackclient/common/pagination.py +8 -2
  15. openstackclient/common/progressbar.py +7 -6
  16. openstackclient/common/project_cleanup.py +13 -7
  17. openstackclient/common/quota.py +126 -114
  18. openstackclient/common/versions.py +8 -2
  19. openstackclient/compute/client.py +7 -3
  20. openstackclient/compute/v2/agent.py +17 -10
  21. openstackclient/compute/v2/aggregate.py +36 -22
  22. openstackclient/compute/v2/console.py +14 -8
  23. openstackclient/compute/v2/console_connection.py +11 -3
  24. openstackclient/compute/v2/flavor.py +39 -21
  25. openstackclient/compute/v2/host.py +14 -6
  26. openstackclient/compute/v2/hypervisor.py +14 -5
  27. openstackclient/compute/v2/hypervisor_stats.py +10 -2
  28. openstackclient/compute/v2/keypair.py +29 -14
  29. openstackclient/compute/v2/server.py +251 -171
  30. openstackclient/compute/v2/server_backup.py +10 -4
  31. openstackclient/compute/v2/server_event.py +21 -12
  32. openstackclient/compute/v2/server_group.py +21 -11
  33. openstackclient/compute/v2/server_image.py +19 -10
  34. openstackclient/compute/v2/server_migration.py +24 -10
  35. openstackclient/compute/v2/server_share.py +274 -0
  36. openstackclient/compute/v2/server_volume.py +10 -4
  37. openstackclient/compute/v2/service.py +14 -7
  38. openstackclient/compute/v2/usage.py +26 -21
  39. openstackclient/identity/client.py +8 -3
  40. openstackclient/identity/common.py +103 -41
  41. openstackclient/identity/v2_0/catalog.py +14 -7
  42. openstackclient/identity/v2_0/ec2creds.py +21 -10
  43. openstackclient/identity/v2_0/endpoint.py +23 -11
  44. openstackclient/identity/v2_0/project.py +25 -14
  45. openstackclient/identity/v2_0/role.py +28 -14
  46. openstackclient/identity/v2_0/role_assignment.py +9 -3
  47. openstackclient/identity/v2_0/service.py +26 -12
  48. openstackclient/identity/v2_0/token.py +12 -5
  49. openstackclient/identity/v2_0/user.py +26 -15
  50. openstackclient/identity/v3/access_rule.py +26 -12
  51. openstackclient/identity/v3/application_credential.py +59 -24
  52. openstackclient/identity/v3/catalog.py +14 -7
  53. openstackclient/identity/v3/consumer.py +22 -11
  54. openstackclient/identity/v3/credential.py +36 -16
  55. openstackclient/identity/v3/domain.py +37 -18
  56. openstackclient/identity/v3/ec2creds.py +25 -12
  57. openstackclient/identity/v3/endpoint.py +42 -20
  58. openstackclient/identity/v3/endpoint_group.py +28 -17
  59. openstackclient/identity/v3/federation_protocol.py +71 -50
  60. openstackclient/identity/v3/group.py +55 -32
  61. openstackclient/identity/v3/identity_provider.py +92 -57
  62. openstackclient/identity/v3/implied_role.py +21 -9
  63. openstackclient/identity/v3/limit.py +115 -92
  64. openstackclient/identity/v3/mapping.py +26 -13
  65. openstackclient/identity/v3/policy.py +23 -12
  66. openstackclient/identity/v3/project.py +211 -122
  67. openstackclient/identity/v3/region.py +36 -16
  68. openstackclient/identity/v3/registered_limit.py +116 -109
  69. openstackclient/identity/v3/role.py +61 -31
  70. openstackclient/identity/v3/role_assignment.py +23 -6
  71. openstackclient/identity/v3/service.py +36 -16
  72. openstackclient/identity/v3/service_provider.py +37 -15
  73. openstackclient/identity/v3/tag.py +23 -17
  74. openstackclient/identity/v3/token.py +30 -14
  75. openstackclient/identity/v3/trust.py +32 -14
  76. openstackclient/identity/v3/unscoped_saml.py +10 -2
  77. openstackclient/identity/v3/user.py +49 -26
  78. openstackclient/image/client.py +7 -3
  79. openstackclient/image/v1/image.py +33 -26
  80. openstackclient/image/v2/cache.py +14 -9
  81. openstackclient/image/v2/image.py +76 -49
  82. openstackclient/image/v2/info.py +7 -1
  83. openstackclient/image/v2/metadef_namespaces.py +109 -13
  84. openstackclient/image/v2/metadef_objects.py +28 -15
  85. openstackclient/image/v2/metadef_properties.py +24 -13
  86. openstackclient/image/v2/metadef_resource_type_association.py +14 -7
  87. openstackclient/image/v2/metadef_resource_types.py +7 -1
  88. openstackclient/image/v2/task.py +15 -6
  89. openstackclient/locale/tr_TR/LC_MESSAGES/openstackclient.po +7 -192
  90. openstackclient/network/client.py +7 -2
  91. openstackclient/network/common.py +16 -241
  92. openstackclient/network/utils.py +36 -22
  93. openstackclient/network/v2/address_group.py +27 -16
  94. openstackclient/network/v2/address_scope.py +24 -13
  95. openstackclient/network/v2/bgpvpn/bgpvpn.py +463 -0
  96. openstackclient/network/v2/bgpvpn/constants.py +30 -0
  97. openstackclient/network/v2/bgpvpn/network_association.py +214 -0
  98. openstackclient/network/v2/bgpvpn/port_association.py +490 -0
  99. openstackclient/network/v2/bgpvpn/router_association.py +288 -0
  100. openstackclient/network/v2/default_security_group_rule.py +19 -10
  101. openstackclient/network/v2/floating_ip.py +110 -159
  102. openstackclient/network/v2/floating_ip_port_forwarding.py +30 -18
  103. openstackclient/network/v2/fwaas/__init__.py +0 -0
  104. openstackclient/network/v2/fwaas/group.py +466 -0
  105. openstackclient/network/v2/fwaas/policy.py +518 -0
  106. openstackclient/network/v2/fwaas/rule.py +574 -0
  107. openstackclient/network/v2/ip_availability.py +13 -5
  108. openstackclient/network/v2/l3_conntrack_helper.py +22 -13
  109. openstackclient/network/v2/local_ip.py +24 -13
  110. openstackclient/network/v2/local_ip_association.py +14 -7
  111. openstackclient/network/v2/ndp_proxy.py +20 -11
  112. openstackclient/network/v2/network.py +129 -196
  113. openstackclient/network/v2/network_agent.py +46 -25
  114. openstackclient/network/v2/network_auto_allocated_topology.py +22 -11
  115. openstackclient/network/v2/network_flavor.py +27 -16
  116. openstackclient/network/v2/network_flavor_profile.py +23 -12
  117. openstackclient/network/v2/network_meter.py +21 -10
  118. openstackclient/network/v2/network_meter_rule.py +21 -11
  119. openstackclient/network/v2/network_qos_policy.py +25 -15
  120. openstackclient/network/v2/network_qos_rule.py +32 -17
  121. openstackclient/network/v2/network_qos_rule_type.py +13 -5
  122. openstackclient/network/v2/network_rbac.py +23 -12
  123. openstackclient/network/v2/network_segment.py +20 -11
  124. openstackclient/network/v2/network_segment_range.py +56 -29
  125. openstackclient/network/v2/network_service_provider.py +7 -1
  126. openstackclient/network/v2/network_trunk.py +38 -22
  127. openstackclient/network/v2/port.py +54 -29
  128. openstackclient/network/v2/router.py +75 -52
  129. openstackclient/network/v2/security_group.py +87 -157
  130. openstackclient/network/v2/security_group_rule.py +100 -280
  131. openstackclient/network/v2/subnet.py +49 -28
  132. openstackclient/network/v2/subnet_pool.py +30 -17
  133. openstackclient/network/v2/taas/tap_flow.py +22 -11
  134. openstackclient/network/v2/taas/tap_mirror.py +22 -11
  135. openstackclient/network/v2/taas/tap_service.py +23 -12
  136. openstackclient/object/client.py +7 -2
  137. openstackclient/object/v1/account.py +13 -6
  138. openstackclient/object/v1/container.py +25 -15
  139. openstackclient/object/v1/object.py +25 -15
  140. openstackclient/py.typed +0 -0
  141. openstackclient/shell.py +46 -10
  142. openstackclient/tests/functional/base.py +55 -20
  143. openstackclient/tests/functional/common/test_extension.py +4 -0
  144. openstackclient/tests/functional/common/test_quota.py +3 -1
  145. openstackclient/tests/functional/compute/v2/common.py +14 -13
  146. openstackclient/tests/functional/compute/v2/test_flavor.py +3 -1
  147. openstackclient/tests/functional/compute/v2/test_server.py +3 -0
  148. openstackclient/tests/functional/identity/v2/common.py +10 -6
  149. openstackclient/tests/functional/identity/v2/test_role.py +4 -4
  150. openstackclient/tests/functional/identity/v3/common.py +25 -19
  151. openstackclient/tests/functional/identity/v3/test_group.py +20 -20
  152. openstackclient/tests/functional/identity/v3/test_idp.py +3 -1
  153. openstackclient/tests/functional/identity/v3/test_limit.py +47 -0
  154. openstackclient/tests/functional/identity/v3/test_project.py +10 -10
  155. openstackclient/tests/functional/identity/v3/test_role.py +18 -18
  156. openstackclient/tests/functional/identity/v3/test_role_assignment.py +12 -12
  157. openstackclient/tests/functional/identity/v3/test_user.py +8 -8
  158. openstackclient/tests/functional/image/base.py +1 -6
  159. openstackclient/tests/functional/image/v2/test_metadef_objects.py +69 -0
  160. openstackclient/tests/functional/network/v2/common.py +5 -2
  161. openstackclient/tests/functional/network/v2/test_floating_ip.py +10 -4
  162. openstackclient/tests/functional/network/v2/test_ip_availability.py +4 -0
  163. openstackclient/tests/functional/network/v2/test_network_meter_rule.py +3 -2
  164. openstackclient/tests/functional/network/v2/test_network_segment.py +5 -0
  165. openstackclient/tests/functional/network/v2/test_subnet.py +13 -9
  166. openstackclient/tests/functional/object/v1/common.py +4 -0
  167. openstackclient/tests/functional/volume/v2/common.py +4 -0
  168. openstackclient/tests/functional/volume/v2/test_volume_snapshot.py +27 -11
  169. openstackclient/tests/functional/volume/v2/test_volume_type.py +2 -2
  170. openstackclient/tests/functional/volume/v3/common.py +4 -0
  171. openstackclient/tests/functional/volume/v3/test_volume_snapshot.py +56 -138
  172. openstackclient/tests/functional/volume/v3/test_volume_type.py +2 -2
  173. openstackclient/tests/unit/common/test_availability_zone.py +35 -49
  174. openstackclient/tests/unit/common/test_extension.py +2 -2
  175. openstackclient/tests/unit/common/test_module.py +12 -7
  176. openstackclient/tests/unit/common/test_project_cleanup.py +3 -1
  177. openstackclient/tests/unit/common/test_quota.py +62 -23
  178. openstackclient/tests/unit/compute/v2/fakes.py +25 -0
  179. openstackclient/tests/unit/compute/v2/test_flavor.py +28 -2
  180. openstackclient/tests/unit/compute/v2/test_keypair.py +6 -6
  181. openstackclient/tests/unit/compute/v2/test_server.py +17 -104
  182. openstackclient/tests/unit/compute/v2/test_server_share.py +287 -0
  183. openstackclient/tests/unit/identity/v3/fakes.py +3 -0
  184. openstackclient/tests/unit/identity/v3/test_group.py +4 -14
  185. openstackclient/tests/unit/identity/v3/test_identity_provider.py +303 -299
  186. openstackclient/tests/unit/identity/v3/test_limit.py +197 -145
  187. openstackclient/tests/unit/identity/v3/test_project.py +831 -512
  188. openstackclient/tests/unit/identity/v3/test_protocol.py +97 -88
  189. openstackclient/tests/unit/identity/v3/test_registered_limit.py +355 -220
  190. openstackclient/tests/unit/identity/v3/test_user.py +4 -4
  191. openstackclient/tests/unit/image/v2/test_image.py +16 -16
  192. openstackclient/tests/unit/image/v2/test_metadef_namespaces.py +105 -6
  193. openstackclient/tests/unit/network/test_common.py +0 -155
  194. openstackclient/tests/unit/network/v2/bgpvpn/__init__.py +0 -0
  195. openstackclient/tests/unit/network/v2/bgpvpn/fakes.py +179 -0
  196. openstackclient/tests/unit/network/v2/bgpvpn/test_bgpvpn.py +584 -0
  197. openstackclient/tests/unit/network/v2/bgpvpn/test_network_association.py +285 -0
  198. openstackclient/tests/unit/network/v2/bgpvpn/test_port_association.py +384 -0
  199. openstackclient/tests/unit/network/v2/bgpvpn/test_router_association.py +297 -0
  200. openstackclient/tests/unit/network/v2/fwaas/__init__.py +0 -0
  201. openstackclient/tests/unit/network/v2/fwaas/test_group.py +897 -0
  202. openstackclient/tests/unit/network/v2/fwaas/test_policy.py +869 -0
  203. openstackclient/tests/unit/network/v2/fwaas/test_rule.py +980 -0
  204. openstackclient/tests/unit/network/v2/taas/{test_osc_tap_flow.py → test_tap_flow.py} +18 -25
  205. openstackclient/tests/unit/network/v2/taas/{test_osc_tap_mirror.py → test_tap_mirror.py} +19 -29
  206. openstackclient/tests/unit/network/v2/taas/{test_osc_tap_service.py → test_tap_service.py} +19 -29
  207. openstackclient/tests/unit/network/v2/test_address_group.py +2 -2
  208. openstackclient/tests/unit/network/v2/{test_floating_ip_network.py → test_floating_ip.py} +3 -2
  209. openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +13 -13
  210. openstackclient/tests/unit/network/v2/test_network_agent.py +8 -4
  211. openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +3 -3
  212. openstackclient/tests/unit/network/v2/test_network_flavor.py +2 -2
  213. openstackclient/tests/unit/network/v2/test_network_qos_policy.py +1 -1
  214. openstackclient/tests/unit/network/v2/test_network_qos_rule.py +2 -2
  215. openstackclient/tests/unit/network/v2/test_network_rbac.py +1 -1
  216. openstackclient/tests/unit/network/v2/test_network_segment.py +1 -1
  217. openstackclient/tests/unit/network/v2/test_network_segment_range.py +7 -10
  218. openstackclient/tests/unit/network/v2/test_network_trunk.py +1 -1
  219. openstackclient/tests/unit/network/v2/test_router.py +8 -9
  220. openstackclient/tests/unit/network/v2/{test_security_group_network.py → test_security_group.py} +1 -20
  221. openstackclient/tests/unit/network/v2/{test_security_group_rule_network.py → test_security_group_rule.py} +7 -41
  222. openstackclient/tests/unit/network/v2/test_subnet.py +2 -1
  223. openstackclient/tests/unit/network/v2/test_subnet_pool.py +2 -1
  224. openstackclient/tests/unit/object/v1/fakes.py +8 -7
  225. openstackclient/tests/unit/object/v1/test_container.py +65 -101
  226. openstackclient/tests/unit/object/v1/test_container_all.py +8 -1
  227. openstackclient/tests/unit/object/v1/test_object.py +44 -84
  228. openstackclient/tests/unit/object/v1/test_object_all.py +8 -1
  229. openstackclient/tests/unit/test_hacking.py +108 -0
  230. openstackclient/tests/unit/volume/v2/fakes.py +1 -0
  231. openstackclient/tests/unit/volume/v2/test_consistency_group.py +8 -2
  232. openstackclient/tests/unit/volume/v2/test_volume.py +7 -6
  233. openstackclient/tests/unit/volume/v2/test_volume_backup.py +1 -5
  234. openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +2 -1
  235. openstackclient/tests/unit/volume/v2/test_volume_type.py +2 -4
  236. openstackclient/tests/unit/volume/v3/fakes.py +1 -0
  237. openstackclient/tests/unit/volume/v3/test_volume.py +94 -15
  238. openstackclient/tests/unit/volume/v3/test_volume_attachment.py +1 -1
  239. openstackclient/tests/unit/volume/v3/test_volume_backup.py +1 -5
  240. openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +55 -1
  241. openstackclient/tests/unit/volume/v3/test_volume_type.py +2 -4
  242. openstackclient/volume/client.py +7 -3
  243. openstackclient/volume/v2/backup_record.py +15 -6
  244. openstackclient/volume/v2/consistency_group.py +37 -25
  245. openstackclient/volume/v2/consistency_group_snapshot.py +27 -12
  246. openstackclient/volume/v2/qos_specs.py +30 -19
  247. openstackclient/volume/v2/service.py +17 -6
  248. openstackclient/volume/v2/volume.py +69 -34
  249. openstackclient/volume/v2/volume_backend.py +19 -6
  250. openstackclient/volume/v2/volume_backup.py +48 -22
  251. openstackclient/volume/v2/volume_host.py +6 -4
  252. openstackclient/volume/v2/volume_snapshot.py +52 -26
  253. openstackclient/volume/v2/volume_transfer_request.py +33 -15
  254. openstackclient/volume/v2/volume_type.py +46 -27
  255. openstackclient/volume/v3/block_storage_cleanup.py +11 -3
  256. openstackclient/volume/v3/block_storage_cluster.py +19 -7
  257. openstackclient/volume/v3/block_storage_log_level.py +15 -6
  258. openstackclient/volume/v3/block_storage_manage.py +10 -4
  259. openstackclient/volume/v3/block_storage_resource_filter.py +17 -5
  260. openstackclient/volume/v3/service.py +16 -6
  261. openstackclient/volume/v3/volume.py +103 -46
  262. openstackclient/volume/v3/volume_attachment.py +43 -21
  263. openstackclient/volume/v3/volume_backup.py +55 -26
  264. openstackclient/volume/v3/volume_group.py +23 -13
  265. openstackclient/volume/v3/volume_group_snapshot.py +32 -13
  266. openstackclient/volume/v3/volume_group_type.py +26 -13
  267. openstackclient/volume/v3/volume_message.py +15 -7
  268. openstackclient/volume/v3/volume_snapshot.py +71 -34
  269. openstackclient/volume/v3/volume_transfer_request.py +33 -15
  270. openstackclient/volume/v3/volume_type.py +45 -27
  271. {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/METADATA +6 -6
  272. {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/RECORD +279 -267
  273. {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/WHEEL +1 -1
  274. {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/entry_points.txt +53 -1
  275. {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/licenses/AUTHORS +9 -0
  276. python_openstackclient-10.0.0.dist-info/pbr.json +1 -0
  277. openstackclient/api/image_v1.py +0 -69
  278. openstackclient/api/image_v2.py +0 -79
  279. openstackclient/network/v2/floating_ip_pool.py +0 -38
  280. openstackclient/tests/functional/image/v1/test_image.py +0 -97
  281. openstackclient/tests/unit/api/test_image_v1.py +0 -96
  282. openstackclient/tests/unit/api/test_image_v2.py +0 -96
  283. openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +0 -248
  284. openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +0 -49
  285. openstackclient/tests/unit/network/v2/test_floating_ip_pool_network.py +0 -39
  286. openstackclient/tests/unit/network/v2/test_network_compute.py +0 -404
  287. openstackclient/tests/unit/network/v2/test_security_group_compute.py +0 -392
  288. openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +0 -555
  289. python_openstackclient-8.3.0.dist-info/pbr.json +0 -1
  290. /openstackclient/{tests/functional/image/v1 → network/v2/bgpvpn}/__init__.py +0 -0
  291. {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/licenses/LICENSE +0 -0
  292. {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/top_level.txt +0 -0
@@ -10,11 +10,13 @@
10
10
  # License for the specific language governing permissions and limitations
11
11
  # under the License.
12
12
 
13
+ from collections.abc import Iterable, Mapping, Sequence
13
14
  import json
14
15
  import logging
15
16
  import os
16
17
  import shlex
17
18
  import subprocess
19
+ from typing import Any, Literal, cast, overload
18
20
 
19
21
  from tempest.lib.cli import output_parser
20
22
  from tempest.lib import exceptions
@@ -24,7 +26,7 @@ ADMIN_CLOUD = os.environ.get('OS_ADMIN_CLOUD', 'devstack-admin')
24
26
  LOG = logging.getLogger(__name__)
25
27
 
26
28
 
27
- def execute(cmd, *, fail_ok=False):
29
+ def execute(cmd: str, *, fail_ok: bool = False) -> str:
28
30
  """Executes specified command for the given action."""
29
31
  LOG.debug('Executing: %s', cmd)
30
32
  cmdlist = shlex.split(cmd)
@@ -53,15 +55,37 @@ def execute(cmd, *, fail_ok=False):
53
55
 
54
56
 
55
57
  class TestCase(testtools.TestCase):
58
+ @overload
56
59
  @classmethod
57
60
  def openstack(
58
61
  cls,
59
- cmd,
62
+ cmd: str,
60
63
  *,
61
- cloud=ADMIN_CLOUD,
62
- fail_ok=False,
63
- parse_output=False,
64
- ):
64
+ cloud: str | None = ADMIN_CLOUD,
65
+ fail_ok: bool = False,
66
+ parse_output: Literal[False] = False,
67
+ ) -> str: ...
68
+
69
+ @overload
70
+ @classmethod
71
+ def openstack(
72
+ cls,
73
+ cmd: str,
74
+ *,
75
+ cloud: str | None = ADMIN_CLOUD,
76
+ fail_ok: bool = False,
77
+ parse_output: Literal[True] = ...,
78
+ ) -> Any: ...
79
+
80
+ @classmethod
81
+ def openstack(
82
+ cls,
83
+ cmd: str,
84
+ *,
85
+ cloud: str | None = ADMIN_CLOUD,
86
+ fail_ok: bool = False,
87
+ parse_output: bool = False,
88
+ ) -> str | Any:
65
89
  """Executes openstackclient command for the given action
66
90
 
67
91
  :param cmd: A string representation of the command to execute.
@@ -92,7 +116,7 @@ class TestCase(testtools.TestCase):
92
116
  format_args.append('-f json')
93
117
 
94
118
  output = execute(
95
- ' '.join(['openstack'] + auth_args + [cmd] + format_args),
119
+ ' '.join(['openstack', *auth_args, cmd, *format_args]),
96
120
  fail_ok=fail_ok,
97
121
  )
98
122
 
@@ -106,7 +130,9 @@ class TestCase(testtools.TestCase):
106
130
  return output
107
131
 
108
132
  @classmethod
109
- def is_service_enabled(cls, service, version=None):
133
+ def is_service_enabled(
134
+ cls, service: str, version: str | None = None
135
+ ) -> bool:
110
136
  """Ask client cloud if service is available
111
137
 
112
138
  :param service: The service name or type. This should be either an
@@ -126,7 +152,9 @@ class TestCase(testtools.TestCase):
126
152
  return bool(ret)
127
153
 
128
154
  @classmethod
129
- def is_extension_enabled(cls, alias, *, service='network'):
155
+ def is_extension_enabled(
156
+ cls, alias: str, *, service: str = 'network'
157
+ ) -> bool:
130
158
  """Ask client cloud if extension is enabled"""
131
159
  extensions = cls.openstack(
132
160
  f'extension list --{service}',
@@ -135,38 +163,44 @@ class TestCase(testtools.TestCase):
135
163
  return alias in [x['Alias'] for x in extensions]
136
164
 
137
165
  @classmethod
138
- def get_openstack_configuration_value(cls, configuration):
166
+ def get_openstack_configuration_value(cls, configuration: str) -> str:
139
167
  opts = cls.get_opts([configuration])
140
168
  return cls.openstack('configuration show ' + opts)
141
169
 
142
170
  @classmethod
143
- def get_opts(cls, fields, output_format='value'):
171
+ def get_opts(cls, fields: list[str], output_format: str = 'value') -> str:
144
172
  return ' -f {} {}'.format(
145
173
  output_format, ' '.join(['-c ' + it for it in fields])
146
174
  )
147
175
 
148
176
  @classmethod
149
- def assertOutput(cls, expected, actual):
177
+ def assertOutput(cls, expected: str, actual: str) -> None:
150
178
  if expected != actual:
151
179
  raise Exception(expected + ' != ' + actual)
152
180
 
153
181
  @classmethod
154
- def assertInOutput(cls, expected, actual):
182
+ def assertInOutput(cls, expected: str, actual: str) -> None:
155
183
  if expected not in actual:
156
184
  raise Exception(expected + ' not in ' + actual)
157
185
 
158
186
  @classmethod
159
- def assertsOutputNotNone(cls, observed):
187
+ def assertsOutputNotNone(cls, observed: Any) -> None:
160
188
  if observed is None:
161
189
  raise Exception('No output observed')
162
190
 
163
- def assert_table_structure(self, items, field_names):
191
+ def assert_table_structure(
192
+ self, items: Iterable[Mapping[str, Any]], field_names: Sequence[str]
193
+ ) -> None:
164
194
  """Verify that all items have keys listed in field_names."""
165
195
  for item in items:
166
196
  for field in field_names:
167
197
  self.assertIn(field, item)
168
198
 
169
- def assert_show_fields(self, show_output, field_names):
199
+ def assert_show_fields(
200
+ self,
201
+ show_output: Iterable[Mapping[str, Any]],
202
+ field_names: Sequence[str],
203
+ ) -> None:
170
204
  """Verify that all items have keys listed in field_names."""
171
205
 
172
206
  # field_names = ['name', 'description']
@@ -186,17 +220,18 @@ class TestCase(testtools.TestCase):
186
220
  o.update(item)
187
221
  return o
188
222
 
189
- def parse_show(self, raw_output):
223
+ def parse_show(self, raw_output: str) -> list[dict[str, Any]]:
190
224
  """Return list of dicts with item values parsed from cli output."""
191
225
 
192
226
  items = []
193
227
  table_ = output_parser.table(raw_output)
194
228
  for row in table_['values']:
195
229
  item = {}
196
- item[row[0]] = row[1]
230
+ item[str(row[0])] = row[1]
197
231
  items.append(item)
198
232
  return items
199
233
 
200
- def parse_listing(self, raw_output):
234
+ def parse_listing(self, raw_output: str) -> list[dict[str, Any]]:
201
235
  """Return list of dicts with basic item parsed from cli output."""
202
- return output_parser.listing(raw_output)
236
+ # need to add hints to tempest
237
+ return cast(list[dict[str, Any]], output_parser.listing(raw_output))
@@ -13,6 +13,8 @@
13
13
  # License for the specific language governing permissions and limitations
14
14
  # under the License.
15
15
 
16
+ from typing import ClassVar
17
+
16
18
  from tempest.lib import exceptions as tempest_exc
17
19
 
18
20
  from openstackclient.tests.functional import base
@@ -21,6 +23,8 @@ from openstackclient.tests.functional import base
21
23
  class ExtensionTests(base.TestCase):
22
24
  """Functional tests for extension"""
23
25
 
26
+ haz_network: ClassVar[bool]
27
+
24
28
  @classmethod
25
29
  def setUpClass(cls):
26
30
  super().setUpClass()
@@ -10,6 +10,7 @@
10
10
  # License for the specific language governing permissions and limitations
11
11
  # under the License.
12
12
 
13
+ from typing import ClassVar
13
14
  import uuid
14
15
 
15
16
  from tempest.lib.common.utils import data_utils
@@ -25,7 +26,8 @@ class QuotaTests(base.TestCase):
25
26
  test runs as these may run in parallel and otherwise step on each other.
26
27
  """
27
28
 
28
- PROJECT_NAME: str
29
+ haz_network: ClassVar[bool]
30
+ PROJECT_NAME: ClassVar[str]
29
31
 
30
32
  @classmethod
31
33
  def setUpClass(cls):
@@ -12,6 +12,7 @@
12
12
  #
13
13
 
14
14
  import time
15
+ from typing import cast
15
16
  import uuid
16
17
 
17
18
  from tempest.lib import exceptions
@@ -35,18 +36,18 @@ class ComputeTestCase(base.TestCase):
35
36
 
36
37
  @classmethod
37
38
  def get_flavor(cls) -> str:
39
+ valid_flavors = ['m1.tiny', 'cirros256']
38
40
  # NOTE(rtheis): Get cirros256 or m1.tiny flavors since functional
39
41
  # tests may create other flavors.
40
42
  flavors = cls.openstack("flavor list", parse_output=True)
41
- server_flavor = None
42
43
  for flavor in flavors:
43
44
  if flavor['Name'] in ['m1.tiny', 'cirros256']:
44
- server_flavor = flavor['Name']
45
- break
46
-
47
- assert server_flavor is not None
45
+ return cast(str, flavor['Name'])
48
46
 
49
- return server_flavor
47
+ raise Exception(
48
+ f'Failed to find a suitable flavor. Required one of: '
49
+ f'{", ".join(valid_flavors)}'
50
+ )
50
51
 
51
52
  @classmethod
52
53
  def get_image(cls) -> str:
@@ -54,18 +55,17 @@ class ComputeTestCase(base.TestCase):
54
55
  # create other images. Image may be named '-uec' or
55
56
  # '-disk'.
56
57
  images = cls.openstack("image list", parse_output=True)
57
- server_image = None
58
58
  for image in images:
59
59
  if image['Name'].startswith('cirros-') and (
60
60
  image['Name'].endswith('-uec')
61
61
  or image['Name'].endswith('-disk')
62
62
  ):
63
- server_image = image['Name']
64
- break
63
+ return cast(str, image['Name'])
65
64
 
66
- assert server_image is not None
67
-
68
- return server_image
65
+ raise Exception(
66
+ 'Failed to find a suitable image. Required one matching one of '
67
+ 'the following patterns: cirros-*-uec, cirros-*-disk'
68
+ )
69
69
 
70
70
  @classmethod
71
71
  def get_network(cls) -> str:
@@ -78,7 +78,8 @@ class ComputeTestCase(base.TestCase):
78
78
  )
79
79
  except exceptions.CommandFailed:
80
80
  return ''
81
- return '--nic net-id=' + cmd_output['id']
81
+
82
+ return '='.join(('--nic net-id', cmd_output['id']))
82
83
 
83
84
  def server_create(self, name=None, cleanup=True):
84
85
  """Create server, with cleanup"""
@@ -10,6 +10,7 @@
10
10
  # License for the specific language governing permissions and limitations
11
11
  # under the License.
12
12
 
13
+ from typing import ClassVar
13
14
  import uuid
14
15
 
15
16
  from openstackclient.tests.functional import base
@@ -19,6 +20,7 @@ class FlavorTests(base.TestCase):
19
20
  """Functional tests for flavor."""
20
21
 
21
22
  PROJECT_NAME = uuid.uuid4().hex
23
+ PROJECT_ID: ClassVar[str]
22
24
 
23
25
  @classmethod
24
26
  def setUpClass(cls):
@@ -28,7 +30,7 @@ class FlavorTests(base.TestCase):
28
30
  "project create --enable " + cls.PROJECT_NAME,
29
31
  parse_output=True,
30
32
  )
31
- cls.project_id = cmd_output["id"]
33
+ cls.PROJECT_ID = cmd_output["id"]
32
34
 
33
35
  @classmethod
34
36
  def tearDownClass(cls):
@@ -13,6 +13,7 @@
13
13
  import itertools
14
14
  import json
15
15
  import time
16
+ from typing import ClassVar
16
17
  import uuid
17
18
 
18
19
  from tempest.lib import exceptions
@@ -25,6 +26,8 @@ from openstackclient.tests.functional.volume.v2 import common as volume_common
25
26
  class ServerTests(common.ComputeTestCase):
26
27
  """Functional tests for openstack server commands"""
27
28
 
29
+ haz_network: ClassVar[bool]
30
+
28
31
  @classmethod
29
32
  def setUpClass(cls):
30
33
  super().setUpClass()
@@ -11,6 +11,7 @@
11
11
  # under the License.
12
12
 
13
13
  import os
14
+ from typing import ClassVar
14
15
  import unittest
15
16
 
16
17
  import fixtures
@@ -57,19 +58,22 @@ class IdentityTests(base.TestCase):
57
58
  CATALOG_LIST_HEADERS = ['Name', 'Type', 'Endpoints']
58
59
  ENDPOINT_LIST_HEADERS = ['ID', 'Region', 'Service Name', 'Service Type']
59
60
 
61
+ PROJECT_NAME: ClassVar[str]
62
+ PROJECT_DESCRIPTION: ClassVar[str]
63
+
60
64
  @classmethod
61
65
  def setUpClass(cls):
62
66
  super().setUpClass()
63
67
  # create dummy project
64
- cls.project_name = data_utils.rand_name('TestProject')
65
- cls.project_description = data_utils.rand_name('description')
68
+ cls.PROJECT_NAME = data_utils.rand_name('TestProject')
69
+ cls.PROJECT_DESCRIPTION = data_utils.rand_name('description')
66
70
  try:
67
71
  cls.openstack(
68
72
  '--os-identity-api-version 2 '
69
73
  'project create '
70
- f'--description {cls.project_description} '
74
+ f'--description {cls.PROJECT_DESCRIPTION} '
71
75
  '--enable '
72
- f'{cls.project_name}'
76
+ f'{cls.PROJECT_NAME}'
73
77
  )
74
78
  except tempest_exceptions.CommandFailed:
75
79
  # Good chance this is due to Identity v2 admin not being enabled
@@ -83,7 +87,7 @@ class IdentityTests(base.TestCase):
83
87
  try:
84
88
  cls.openstack(
85
89
  '--os-identity-api-version 2 '
86
- f'project delete {cls.project_name}'
90
+ f'project delete {cls.PROJECT_NAME}'
87
91
  )
88
92
  finally:
89
93
  super().tearDownClass()
@@ -125,7 +129,7 @@ class IdentityTests(base.TestCase):
125
129
  email = data_utils.rand_name() + '@example.com'
126
130
  raw_output = self.openstack(
127
131
  'user create '
128
- f'--project {self.project_name} '
132
+ f'--project {self.PROJECT_NAME} '
129
133
  f'--password {password} '
130
134
  f'--email {email} '
131
135
  '--enable '
@@ -39,14 +39,14 @@ class RoleTests(common.IdentityTests):
39
39
  username = self._create_dummy_user()
40
40
  raw_output = self.openstack(
41
41
  'role add '
42
- f'--project {self.project_name} '
42
+ f'--project {self.PROJECT_NAME} '
43
43
  f'--user {username} '
44
44
  f'{role_name}'
45
45
  )
46
46
  self.addCleanup(
47
47
  self.openstack,
48
48
  'role remove '
49
- f'--project {self.project_name} '
49
+ f'--project {self.PROJECT_NAME} '
50
50
  f'--user {username} '
51
51
  f'{role_name}',
52
52
  )
@@ -58,13 +58,13 @@ class RoleTests(common.IdentityTests):
58
58
  username = self._create_dummy_user()
59
59
  add_raw_output = self.openstack(
60
60
  'role add '
61
- f'--project {self.project_name} '
61
+ f'--project {self.PROJECT_NAME} '
62
62
  f'--user {username} '
63
63
  f'{role_name}'
64
64
  )
65
65
  del_raw_output = self.openstack(
66
66
  'role remove '
67
- f'--project {self.project_name} '
67
+ f'--project {self.PROJECT_NAME} '
68
68
  f'--user {username} '
69
69
  f'{role_name}'
70
70
  )
@@ -11,6 +11,7 @@
11
11
  # under the License.
12
12
 
13
13
  import os
14
+ from typing import ClassVar
14
15
 
15
16
  import fixtures
16
17
  from tempest.lib.common.utils import data_utils
@@ -147,30 +148,35 @@ class IdentityTests(base.TestCase):
147
148
  'Region ID',
148
149
  ]
149
150
 
151
+ DOMAIN_NAME: ClassVar[str]
152
+ DOMAIN_DESCRIPTION: ClassVar[str]
153
+ PROJECT_NAME: ClassVar[str]
154
+ PROJECT_DESCRIPTION: ClassVar[str]
155
+
150
156
  @classmethod
151
157
  def setUpClass(cls):
152
158
  super().setUpClass()
153
159
  # create dummy domain
154
- cls.domain_name = data_utils.rand_name('TestDomain')
155
- cls.domain_description = data_utils.rand_name('description')
160
+ cls.DOMAIN_NAME = data_utils.rand_name('TestDomain')
161
+ cls.DOMAIN_DESCRIPTION = data_utils.rand_name('description')
156
162
  cls.openstack(
157
163
  '--os-identity-api-version 3 '
158
164
  'domain create '
159
- f'--description {cls.domain_description} '
165
+ f'--description {cls.DOMAIN_DESCRIPTION} '
160
166
  '--enable '
161
- f'{cls.domain_name}'
167
+ f'{cls.DOMAIN_NAME}'
162
168
  )
163
169
 
164
170
  # create dummy project
165
- cls.project_name = data_utils.rand_name('TestProject')
166
- cls.project_description = data_utils.rand_name('description')
171
+ cls.PROJECT_NAME = data_utils.rand_name('TestProject')
172
+ cls.PROJECT_DESCRIPTION = data_utils.rand_name('description')
167
173
  cls.openstack(
168
174
  '--os-identity-api-version 3 '
169
175
  'project create '
170
- f'--domain {cls.domain_name} '
171
- f'--description {cls.project_description} '
176
+ f'--domain {cls.DOMAIN_NAME} '
177
+ f'--description {cls.PROJECT_DESCRIPTION} '
172
178
  '--enable '
173
- f'{cls.project_name}'
179
+ f'{cls.PROJECT_NAME}'
174
180
  )
175
181
 
176
182
  @classmethod
@@ -179,15 +185,15 @@ class IdentityTests(base.TestCase):
179
185
  # delete dummy project
180
186
  cls.openstack(
181
187
  '--os-identity-api-version 3 '
182
- f'project delete {cls.project_name}'
188
+ f'project delete {cls.PROJECT_NAME}'
183
189
  )
184
190
  # disable and delete dummy domain
185
191
  cls.openstack(
186
192
  '--os-identity-api-version 3 '
187
- f'domain set --disable {cls.domain_name}'
193
+ f'domain set --disable {cls.DOMAIN_NAME}'
188
194
  )
189
195
  cls.openstack(
190
- f'--os-identity-api-version 3 domain delete {cls.domain_name}'
196
+ f'--os-identity-api-version 3 domain delete {cls.DOMAIN_NAME}'
191
197
  )
192
198
  finally:
193
199
  super().tearDownClass()
@@ -213,9 +219,9 @@ class IdentityTests(base.TestCase):
213
219
  description = data_utils.rand_name('description')
214
220
  raw_output = self.openstack(
215
221
  'user create '
216
- f'--domain {self.domain_name} '
217
- f'--project {self.project_name} '
218
- f'--project-domain {self.domain_name} '
222
+ f'--domain {self.DOMAIN_NAME} '
223
+ f'--project {self.PROJECT_NAME} '
224
+ f'--project-domain {self.DOMAIN_NAME} '
219
225
  f'--password {password} '
220
226
  f'--email {email} '
221
227
  f'--description {description} '
@@ -262,14 +268,14 @@ class IdentityTests(base.TestCase):
262
268
  description = data_utils.rand_name('description')
263
269
  raw_output = self.openstack(
264
270
  'group create '
265
- f'--domain {self.domain_name} '
271
+ f'--domain {self.DOMAIN_NAME} '
266
272
  f'--description {description} '
267
273
  f'{group_name}'
268
274
  )
269
275
  if add_clean_up:
270
276
  self.addCleanup(
271
277
  self.openstack,
272
- f'group delete --domain {self.domain_name} {group_name}',
278
+ f'group delete --domain {self.DOMAIN_NAME} {group_name}',
273
279
  )
274
280
  items = self.parse_show(raw_output)
275
281
  self.assert_show_fields(items, self.GROUP_FIELDS)
@@ -295,14 +301,14 @@ class IdentityTests(base.TestCase):
295
301
  project_description = data_utils.rand_name('description')
296
302
  self.openstack(
297
303
  'project create '
298
- f'--domain {self.domain_name} '
304
+ f'--domain {self.DOMAIN_NAME} '
299
305
  f'--description {project_description} '
300
306
  f'--enable {project_name}'
301
307
  )
302
308
  if add_clean_up:
303
309
  self.addCleanup(
304
310
  self.openstack,
305
- f'project delete --domain {self.domain_name} {project_name}',
311
+ f'project delete --domain {self.DOMAIN_NAME} {project_name}',
306
312
  )
307
313
  return project_name
308
314
 
@@ -28,7 +28,7 @@ class GroupTests(common.IdentityTests):
28
28
 
29
29
  def test_group_list_with_domain(self):
30
30
  group_name = self._create_dummy_group()
31
- raw_output = self.openstack(f'group list --domain {self.domain_name}')
31
+ raw_output = self.openstack(f'group list --domain {self.DOMAIN_NAME}')
32
32
  items = self.parse_listing(raw_output)
33
33
  self.assert_table_structure(items, common.BASIC_LIST_HEADERS)
34
34
  self.assertIn(group_name, raw_output)
@@ -36,14 +36,14 @@ class GroupTests(common.IdentityTests):
36
36
  def test_group_delete(self):
37
37
  group_name = self._create_dummy_group(add_clean_up=False)
38
38
  raw_output = self.openstack(
39
- f'group delete --domain {self.domain_name} {group_name}'
39
+ f'group delete --domain {self.DOMAIN_NAME} {group_name}'
40
40
  )
41
41
  self.assertEqual(0, len(raw_output))
42
42
 
43
43
  def test_group_show(self):
44
44
  group_name = self._create_dummy_group()
45
45
  raw_output = self.openstack(
46
- f'group show --domain {self.domain_name} {group_name}'
46
+ f'group show --domain {self.DOMAIN_NAME} {group_name}'
47
47
  )
48
48
  items = self.parse_show(raw_output)
49
49
  self.assert_show_fields(items, self.GROUP_FIELDS)
@@ -53,20 +53,20 @@ class GroupTests(common.IdentityTests):
53
53
  new_group_name = data_utils.rand_name('NewTestGroup')
54
54
  raw_output = self.openstack(
55
55
  'group set '
56
- f'--domain {self.domain_name} '
56
+ f'--domain {self.DOMAIN_NAME} '
57
57
  f'--name {new_group_name} '
58
58
  f'{group_name}'
59
59
  )
60
60
  self.assertEqual(0, len(raw_output))
61
61
  raw_output = self.openstack(
62
- f'group show --domain {self.domain_name} {new_group_name}'
62
+ f'group show --domain {self.DOMAIN_NAME} {new_group_name}'
63
63
  )
64
64
  group = self.parse_show_as_object(raw_output)
65
65
  self.assertEqual(new_group_name, group['name'])
66
66
  # reset group name to make sure it will be cleaned up
67
67
  raw_output = self.openstack(
68
68
  'group set '
69
- f'--domain {self.domain_name} '
69
+ f'--domain {self.DOMAIN_NAME} '
70
70
  f'--name {group_name} '
71
71
  f'{new_group_name}'
72
72
  )
@@ -77,15 +77,15 @@ class GroupTests(common.IdentityTests):
77
77
  username = self._create_dummy_user()
78
78
  raw_output = self.openstack(
79
79
  'group add user '
80
- f'--group-domain {self.domain_name} '
81
- f'--user-domain {self.domain_name} '
80
+ f'--group-domain {self.DOMAIN_NAME} '
81
+ f'--user-domain {self.DOMAIN_NAME} '
82
82
  f'{group_name} {username}'
83
83
  )
84
84
  self.addCleanup(
85
85
  self.openstack,
86
86
  'group remove user '
87
- f'--group-domain {self.domain_name} '
88
- f'--user-domain {self.domain_name} '
87
+ f'--group-domain {self.DOMAIN_NAME} '
88
+ f'--user-domain {self.DOMAIN_NAME} '
89
89
  f'{group_name} {username}',
90
90
  )
91
91
  self.assertOutput('', raw_output)
@@ -95,22 +95,22 @@ class GroupTests(common.IdentityTests):
95
95
  username = self._create_dummy_user()
96
96
  raw_output = self.openstack(
97
97
  'group add user '
98
- f'--group-domain {self.domain_name} '
99
- f'--user-domain {self.domain_name} '
98
+ f'--group-domain {self.DOMAIN_NAME} '
99
+ f'--user-domain {self.DOMAIN_NAME} '
100
100
  f'{group_name} {username}'
101
101
  )
102
102
  self.addCleanup(
103
103
  self.openstack,
104
104
  'group remove user '
105
- f'--group-domain {self.domain_name} '
106
- f'--user-domain {self.domain_name} '
105
+ f'--group-domain {self.DOMAIN_NAME} '
106
+ f'--user-domain {self.DOMAIN_NAME} '
107
107
  f'{group_name} {username}',
108
108
  )
109
109
  self.assertOutput('', raw_output)
110
110
  raw_output = self.openstack(
111
111
  'group contains user '
112
- f'--group-domain {self.domain_name} '
113
- f'--user-domain {self.domain_name} '
112
+ f'--group-domain {self.DOMAIN_NAME} '
113
+ f'--user-domain {self.DOMAIN_NAME} '
114
114
  f'{group_name} {username}'
115
115
  )
116
116
  self.assertEqual(
@@ -123,14 +123,14 @@ class GroupTests(common.IdentityTests):
123
123
  username = self._create_dummy_user()
124
124
  add_raw_output = self.openstack(
125
125
  'group add user '
126
- f'--group-domain {self.domain_name} '
127
- f'--user-domain {self.domain_name} '
126
+ f'--group-domain {self.DOMAIN_NAME} '
127
+ f'--user-domain {self.DOMAIN_NAME} '
128
128
  f'{group_name} {username}'
129
129
  )
130
130
  remove_raw_output = self.openstack(
131
131
  'group remove user '
132
- f'--group-domain {self.domain_name} '
133
- f'--user-domain {self.domain_name} '
132
+ f'--group-domain {self.DOMAIN_NAME} '
133
+ f'--user-domain {self.DOMAIN_NAME} '
134
134
  f'{group_name} {username}'
135
135
  )
136
136
  self.assertOutput('', add_raw_output)
@@ -56,7 +56,9 @@ class IdentityProviderTests(common.IdentityTests):
56
56
  raw_output = self.openstack(
57
57
  f'identity provider set '
58
58
  f'{identity_provider} '
59
- f'--remote-id {new_remoteid}'
59
+ f'--authorization-ttl 7 '
60
+ f'--remote-id {new_remoteid} '
61
+ f'--remote-id {new_remoteid + "2nd"}'
60
62
  )
61
63
  self.assertEqual(0, len(raw_output))
62
64
  raw_output = self.openstack(