python-openstackclient 10.0.0__py3-none-any.whl → 10.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 (203) hide show
  1. openstackclient/common/availability_zone.py +1 -1
  2. openstackclient/common/module.py +21 -27
  3. openstackclient/common/pagination.py +42 -4
  4. openstackclient/common/project_cleanup.py +1 -2
  5. openstackclient/common/quota.py +9 -5
  6. openstackclient/compute/v2/flavor.py +3 -1
  7. openstackclient/compute/v2/hypervisor.py +2 -0
  8. openstackclient/compute/v2/keypair.py +6 -2
  9. openstackclient/compute/v2/server.py +21 -12
  10. openstackclient/compute/v2/server_event.py +8 -1
  11. openstackclient/compute/v2/server_group.py +2 -0
  12. openstackclient/compute/v2/server_migration.py +3 -0
  13. openstackclient/compute/v2/server_volume.py +3 -1
  14. openstackclient/compute/v2/service.py +3 -1
  15. openstackclient/compute/v2/usage.py +2 -2
  16. openstackclient/identity/common.py +5 -1
  17. openstackclient/identity/v3/access_rule.py +6 -0
  18. openstackclient/identity/v3/application_credential.py +10 -3
  19. openstackclient/identity/v3/credential.py +4 -2
  20. openstackclient/identity/v3/domain.py +4 -2
  21. openstackclient/identity/v3/endpoint.py +57 -45
  22. openstackclient/identity/v3/federation_protocol.py +7 -5
  23. openstackclient/identity/v3/group.py +11 -10
  24. openstackclient/identity/v3/identity_provider.py +4 -1
  25. openstackclient/identity/v3/limit.py +5 -2
  26. openstackclient/identity/v3/mapping.py +36 -19
  27. openstackclient/identity/v3/project.py +18 -5
  28. openstackclient/identity/v3/region.py +4 -2
  29. openstackclient/identity/v3/registered_limit.py +3 -2
  30. openstackclient/identity/v3/role.py +2 -1
  31. openstackclient/identity/v3/role_assignment.py +3 -2
  32. openstackclient/identity/v3/service.py +4 -2
  33. openstackclient/identity/v3/service_provider.py +4 -2
  34. openstackclient/identity/v3/trust.py +8 -5
  35. openstackclient/identity/v3/user.py +38 -11
  36. openstackclient/image/v2/cache.py +2 -2
  37. openstackclient/image/v2/image.py +15 -9
  38. openstackclient/image/v2/metadef_namespaces.py +11 -10
  39. openstackclient/image/v2/metadef_objects.py +5 -5
  40. openstackclient/image/v2/metadef_properties.py +7 -4
  41. openstackclient/image/v2/task.py +11 -22
  42. openstackclient/network/utils.py +0 -41
  43. openstackclient/network/v2/address_group.py +13 -1
  44. openstackclient/network/v2/address_scope.py +13 -8
  45. openstackclient/network/v2/bgpvpn/bgpvpn.py +33 -19
  46. openstackclient/network/v2/bgpvpn/network_association.py +25 -13
  47. openstackclient/network/v2/bgpvpn/port_association.py +35 -21
  48. openstackclient/network/v2/bgpvpn/router_association.py +27 -14
  49. openstackclient/network/v2/default_security_group_rule.py +14 -6
  50. openstackclient/network/v2/floating_ip.py +12 -4
  51. openstackclient/network/v2/floating_ip_port_forwarding.py +12 -2
  52. openstackclient/network/v2/fwaas/group.py +34 -1
  53. openstackclient/network/v2/fwaas/rule.py +39 -3
  54. openstackclient/network/v2/ip_availability.py +13 -4
  55. openstackclient/network/v2/l3_conntrack_helper.py +14 -1
  56. openstackclient/network/v2/local_ip.py +4 -1
  57. openstackclient/network/v2/local_ip_association.py +4 -1
  58. openstackclient/network/v2/ndp_proxy.py +4 -1
  59. openstackclient/network/v2/network.py +87 -20
  60. openstackclient/network/v2/network_agent.py +32 -10
  61. openstackclient/network/v2/network_auto_allocated_topology.py +6 -5
  62. openstackclient/network/v2/network_flavor.py +19 -6
  63. openstackclient/network/v2/network_flavor_profile.py +20 -6
  64. openstackclient/network/v2/network_meter.py +19 -6
  65. openstackclient/network/v2/network_meter_rule.py +20 -2
  66. openstackclient/network/v2/network_qos_policy.py +15 -7
  67. openstackclient/network/v2/network_qos_rule.py +16 -1
  68. openstackclient/network/v2/network_qos_rule_type.py +16 -5
  69. openstackclient/network/v2/network_rbac.py +12 -5
  70. openstackclient/network/v2/network_segment.py +13 -1
  71. openstackclient/network/v2/network_segment_range.py +15 -3
  72. openstackclient/network/v2/network_trunk.py +4 -1
  73. openstackclient/network/v2/port.py +88 -12
  74. openstackclient/network/v2/router.py +27 -16
  75. openstackclient/network/v2/security_group.py +18 -49
  76. openstackclient/network/v2/security_group_rule.py +18 -5
  77. openstackclient/network/v2/subnet.py +15 -7
  78. openstackclient/network/v2/subnet_pool.py +13 -8
  79. openstackclient/network/v2/taas/tap_flow.py +13 -3
  80. openstackclient/network/v2/taas/tap_mirror.py +7 -4
  81. openstackclient/network/v2/taas/tap_service.py +4 -1
  82. openstackclient/object/v1/container.py +3 -1
  83. openstackclient/object/v1/object.py +3 -1
  84. openstackclient/tests/functional/identity/v3/common.py +34 -0
  85. openstackclient/tests/functional/identity/v3/test_application_credential.py +1 -1
  86. openstackclient/tests/functional/identity/v3/test_mapping.py +81 -0
  87. openstackclient/tests/functional/volume/v3/test_volume_group.py +163 -0
  88. openstackclient/tests/unit/common/test_limits.py +1 -1
  89. openstackclient/tests/unit/common/test_module.py +77 -44
  90. openstackclient/tests/unit/common/test_quota.py +9 -0
  91. openstackclient/tests/unit/compute/v2/fakes.py +1 -57
  92. openstackclient/tests/unit/compute/v2/test_agent.py +4 -4
  93. openstackclient/tests/unit/compute/v2/test_aggregate.py +1 -1
  94. openstackclient/tests/unit/compute/v2/test_console.py +2 -2
  95. openstackclient/tests/unit/compute/v2/test_console_connection.py +1 -1
  96. openstackclient/tests/unit/compute/v2/test_flavor.py +1 -1
  97. openstackclient/tests/unit/compute/v2/test_host.py +3 -3
  98. openstackclient/tests/unit/compute/v2/test_hypervisor.py +2 -2
  99. openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +1 -1
  100. openstackclient/tests/unit/compute/v2/test_keypair.py +1 -1
  101. openstackclient/tests/unit/compute/v2/test_server.py +15 -15
  102. openstackclient/tests/unit/compute/v2/test_server_backup.py +1 -1
  103. openstackclient/tests/unit/compute/v2/test_server_event.py +2 -2
  104. openstackclient/tests/unit/compute/v2/test_server_group.py +1 -1
  105. openstackclient/tests/unit/compute/v2/test_server_image.py +1 -1
  106. openstackclient/tests/unit/compute/v2/test_server_migration.py +4 -4
  107. openstackclient/tests/unit/compute/v2/test_server_share.py +4 -4
  108. openstackclient/tests/unit/compute/v2/test_server_volume.py +2 -2
  109. openstackclient/tests/unit/compute/v2/test_service.py +3 -3
  110. openstackclient/tests/unit/compute/v2/test_usage.py +1 -1
  111. openstackclient/tests/unit/identity/v2_0/fakes.py +3 -7
  112. openstackclient/tests/unit/identity/v2_0/test_endpoint.py +1 -1
  113. openstackclient/tests/unit/identity/v2_0/test_project.py +1 -1
  114. openstackclient/tests/unit/identity/v2_0/test_role.py +1 -1
  115. openstackclient/tests/unit/identity/v2_0/test_role_assignment.py +1 -1
  116. openstackclient/tests/unit/identity/v2_0/test_service.py +1 -1
  117. openstackclient/tests/unit/identity/v2_0/test_token.py +2 -2
  118. openstackclient/tests/unit/identity/v2_0/test_user.py +1 -1
  119. openstackclient/tests/unit/identity/v3/fakes.py +5 -38
  120. openstackclient/tests/unit/identity/v3/test_access_rule.py +3 -3
  121. openstackclient/tests/unit/identity/v3/test_application_credential.py +4 -4
  122. openstackclient/tests/unit/identity/v3/test_credential.py +5 -5
  123. openstackclient/tests/unit/identity/v3/test_domain.py +5 -5
  124. openstackclient/tests/unit/identity/v3/test_endpoint.py +6 -6
  125. openstackclient/tests/unit/identity/v3/test_endpoint_group.py +1 -1
  126. openstackclient/tests/unit/identity/v3/test_group.py +8 -8
  127. openstackclient/tests/unit/identity/v3/test_implied_role.py +1 -1
  128. openstackclient/tests/unit/identity/v3/test_limit.py +5 -5
  129. openstackclient/tests/unit/identity/v3/test_mappings.py +163 -79
  130. openstackclient/tests/unit/identity/v3/test_project.py +28 -5
  131. openstackclient/tests/unit/identity/v3/test_protocol.py +3 -3
  132. openstackclient/tests/unit/identity/v3/test_region.py +5 -5
  133. openstackclient/tests/unit/identity/v3/test_registered_limit.py +5 -5
  134. openstackclient/tests/unit/identity/v3/test_role.py +8 -8
  135. openstackclient/tests/unit/identity/v3/test_role_assignment.py +1 -1
  136. openstackclient/tests/unit/identity/v3/test_service.py +5 -5
  137. openstackclient/tests/unit/identity/v3/test_token.py +2 -2
  138. openstackclient/tests/unit/identity/v3/test_trust.py +4 -4
  139. openstackclient/tests/unit/identity/v3/test_user.py +73 -6
  140. openstackclient/tests/unit/network/v2/fakes.py +5 -77
  141. openstackclient/tests/unit/network/v2/fwaas/test_group.py +28 -2
  142. openstackclient/tests/unit/network/v2/fwaas/test_rule.py +28 -3
  143. openstackclient/tests/unit/network/v2/test_address_group.py +24 -0
  144. openstackclient/tests/unit/network/v2/test_address_scope.py +24 -0
  145. openstackclient/tests/unit/network/v2/test_floating_ip.py +24 -0
  146. openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +24 -0
  147. openstackclient/tests/unit/network/v2/test_ip_availability.py +25 -0
  148. openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py +29 -3
  149. openstackclient/tests/unit/network/v2/test_network.py +74 -12
  150. openstackclient/tests/unit/network/v2/test_network_agent.py +50 -1
  151. openstackclient/tests/unit/network/v2/test_network_flavor.py +24 -0
  152. openstackclient/tests/unit/network/v2/test_network_flavor_profile.py +24 -0
  153. openstackclient/tests/unit/network/v2/test_network_meter.py +24 -0
  154. openstackclient/tests/unit/network/v2/test_network_qos_policy.py +24 -0
  155. openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +24 -0
  156. openstackclient/tests/unit/network/v2/test_network_rbac.py +24 -0
  157. openstackclient/tests/unit/network/v2/test_network_segment.py +24 -0
  158. openstackclient/tests/unit/network/v2/test_network_segment_range.py +24 -0
  159. openstackclient/tests/unit/network/v2/test_port.py +166 -0
  160. openstackclient/tests/unit/network/v2/test_router.py +28 -7
  161. openstackclient/tests/unit/network/v2/test_security_group.py +22 -0
  162. openstackclient/tests/unit/network/v2/test_security_group_rule.py +25 -0
  163. openstackclient/tests/unit/network/v2/test_subnet.py +28 -4
  164. openstackclient/tests/unit/network/v2/test_subnet_pool.py +24 -0
  165. openstackclient/tests/unit/volume/v2/fakes.py +20 -140
  166. openstackclient/tests/unit/volume/v2/test_volume_backup.py +5 -9
  167. openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +6 -0
  168. openstackclient/tests/unit/volume/v3/fakes.py +204 -100
  169. openstackclient/tests/unit/volume/v3/test_backup_record.py +114 -0
  170. openstackclient/tests/unit/volume/v3/test_consistency_group.py +720 -0
  171. openstackclient/tests/unit/volume/v3/test_consistency_group_snapshot.py +354 -0
  172. openstackclient/tests/unit/volume/v3/test_qos_specs.py +455 -0
  173. openstackclient/tests/unit/volume/v3/test_volume_attachment.py +2 -0
  174. openstackclient/tests/unit/volume/v3/test_volume_backend.py +158 -0
  175. openstackclient/tests/unit/volume/v3/test_volume_backup.py +5 -9
  176. openstackclient/tests/unit/volume/v3/test_volume_group_type.py +65 -0
  177. openstackclient/tests/unit/volume/v3/test_volume_host.py +115 -0
  178. openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +6 -0
  179. openstackclient/volume/v2/volume.py +4 -2
  180. openstackclient/volume/v2/volume_backup.py +2 -3
  181. openstackclient/volume/v2/volume_snapshot.py +3 -4
  182. openstackclient/volume/v3/backup_record.py +94 -0
  183. openstackclient/volume/v3/consistency_group.py +400 -0
  184. openstackclient/volume/v3/consistency_group_snapshot.py +225 -0
  185. openstackclient/volume/v3/qos_specs.py +389 -0
  186. openstackclient/volume/v3/volume.py +4 -2
  187. openstackclient/volume/v3/volume_attachment.py +5 -1
  188. openstackclient/volume/v3/volume_backend.py +130 -0
  189. openstackclient/volume/v3/volume_backup.py +2 -3
  190. openstackclient/volume/v3/volume_group_snapshot.py +4 -6
  191. openstackclient/volume/v3/volume_group_type.py +1 -1
  192. openstackclient/volume/v3/volume_host.py +74 -0
  193. openstackclient/volume/v3/volume_message.py +3 -1
  194. openstackclient/volume/v3/volume_snapshot.py +2 -1
  195. {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/METADATA +3 -4
  196. {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/RECORD +202 -188
  197. {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/entry_points.txt +24 -24
  198. {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/licenses/AUTHORS +5 -0
  199. python_openstackclient-10.1.0.dist-info/pbr.json +1 -0
  200. python_openstackclient-10.0.0.dist-info/pbr.json +0 -1
  201. {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/WHEEL +0 -0
  202. {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/licenses/LICENSE +0 -0
  203. {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/top_level.txt +0 -0
@@ -72,6 +72,8 @@ class TestPort(network_fakes.TestNetworkV2):
72
72
  'port_security_enabled',
73
73
  'project_id',
74
74
  'propagate_uplink_status',
75
+ 'pvlan_type',
76
+ 'pvlan_community',
75
77
  'resource_request',
76
78
  'revision_number',
77
79
  'qos_network_policy_id',
@@ -114,6 +116,8 @@ class TestPort(network_fakes.TestNetworkV2):
114
116
  fake_port.is_port_security_enabled,
115
117
  fake_port.project_id,
116
118
  fake_port.propagate_uplink_status,
119
+ fake_port.pvlan_type,
120
+ fake_port.pvlan_community,
117
121
  fake_port.resource_request,
118
122
  fake_port.revision_number,
119
123
  fake_port.qos_network_policy_id,
@@ -207,6 +211,10 @@ class TestCreatePort(TestPort):
207
211
  '--dns-name',
208
212
  '8.8.8.8',
209
213
  'test-port',
214
+ '--pvlan-type',
215
+ network_fakes.PVLAN_TYPE_COMMUNITY,
216
+ '--pvlan-community',
217
+ network_fakes.PVLAN_COMMUNITY_NAME,
210
218
  ]
211
219
  verifylist = [
212
220
  ('mac_address', 'aa:aa:aa:aa:aa:aa'),
@@ -224,6 +232,8 @@ class TestCreatePort(TestPort):
224
232
  ('dns_domain', 'example.org'),
225
233
  ('dns_name', '8.8.8.8'),
226
234
  ('name', 'test-port'),
235
+ ('pvlan_type', network_fakes.PVLAN_TYPE_COMMUNITY),
236
+ ('pvlan_community', network_fakes.PVLAN_COMMUNITY_NAME),
227
237
  ]
228
238
  parsed_args = self.check_parser(self.cmd, arglist, verifylist)
229
239
 
@@ -247,6 +257,8 @@ class TestCreatePort(TestPort):
247
257
  'network_id': self._port.network_id,
248
258
  'dns_domain': 'example.org',
249
259
  'dns_name': '8.8.8.8',
260
+ 'pvlan_type': network_fakes.PVLAN_TYPE_COMMUNITY,
261
+ 'pvlan_community': network_fakes.PVLAN_COMMUNITY_NAME,
250
262
  'name': 'test-port',
251
263
  }
252
264
  )
@@ -1156,6 +1168,78 @@ class TestCreatePort(TestPort):
1156
1168
  def test_create_with_trusted_false(self):
1157
1169
  self._test_create_with_trusted_field(False)
1158
1170
 
1171
+ def test_create_pvlan_community_without_name(self):
1172
+ arglist = [
1173
+ '--network',
1174
+ self._port.network_id,
1175
+ '--pvlan-type',
1176
+ 'community',
1177
+ 'test-port',
1178
+ ]
1179
+ verifylist = [
1180
+ ('network', self._port.network_id),
1181
+ ('enable', True),
1182
+ ('pvlan_type', 'community'),
1183
+ ('name', 'test-port'),
1184
+ ]
1185
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
1186
+
1187
+ self.assertRaises(
1188
+ exceptions.CommandError,
1189
+ self.cmd.take_action,
1190
+ parsed_args,
1191
+ )
1192
+
1193
+ def test_create_pvlan_with_port_security_disabled(self):
1194
+ arglist = [
1195
+ '--network',
1196
+ self._port.network_id,
1197
+ '--disable-port-security',
1198
+ '--pvlan-type',
1199
+ 'isolated',
1200
+ 'test-port',
1201
+ ]
1202
+ verifylist = [
1203
+ ('network', self._port.network_id),
1204
+ ('enable', True),
1205
+ ('disable_port_security', True),
1206
+ ('pvlan_type', 'isolated'),
1207
+ ('name', 'test-port'),
1208
+ ]
1209
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
1210
+
1211
+ self.assertRaises(
1212
+ exceptions.CommandError,
1213
+ self.cmd.take_action,
1214
+ parsed_args,
1215
+ )
1216
+
1217
+ def test_create_pvlan_on_non_pvlan_network(self):
1218
+ fake_net = network_fakes.create_one_network(
1219
+ {'id': self._port.network_id, 'pvlan': False}
1220
+ )
1221
+ self.network_client.find_network.return_value = fake_net
1222
+ arglist = [
1223
+ '--network',
1224
+ self._port.network_id,
1225
+ '--pvlan-type',
1226
+ 'isolated',
1227
+ 'test-port',
1228
+ ]
1229
+ verifylist = [
1230
+ ('network', self._port.network_id),
1231
+ ('enable', True),
1232
+ ('pvlan_type', 'isolated'),
1233
+ ('name', 'test-port'),
1234
+ ]
1235
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
1236
+
1237
+ self.assertRaises(
1238
+ exceptions.CommandError,
1239
+ self.cmd.take_action,
1240
+ parsed_args,
1241
+ )
1242
+
1159
1243
 
1160
1244
  class TestDeletePort(TestPort):
1161
1245
  # Ports to delete.
@@ -1349,6 +1433,28 @@ class TestListPort(compute_fakes.FakeClientMixin, TestPort):
1349
1433
  self.assertEqual(self.columns, columns)
1350
1434
  self.assertCountEqual(self.data, list(data))
1351
1435
 
1436
+ def test_port_list_pagination(self):
1437
+ arglist = [
1438
+ '--marker',
1439
+ self._ports[0].id,
1440
+ '--limit',
1441
+ '1',
1442
+ ]
1443
+ verifylist = [
1444
+ ('marker', self._ports[0].id),
1445
+ ('limit', 1),
1446
+ ]
1447
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
1448
+
1449
+ columns, data = self.cmd.take_action(parsed_args)
1450
+
1451
+ self.network_client.ports.assert_called_once_with(
1452
+ fields=LIST_FIELDS_TO_RETRIEVE,
1453
+ **{'marker': self._ports[0].id, 'limit': 1},
1454
+ )
1455
+ self.assertEqual(self.columns, columns)
1456
+ self.assertEqual(self.data, list(data))
1457
+
1352
1458
  def test_port_list_router_opt(self):
1353
1459
  arglist = [
1354
1460
  '--router',
@@ -2653,6 +2759,66 @@ class TestSetPort(TestPort):
2653
2759
  def test_set_uplink_status_propagation_false(self):
2654
2760
  self._test_set_uplink_status_propagation(False)
2655
2761
 
2762
+ def test_set_pvlan_community_without_name(self):
2763
+ arglist = [
2764
+ '--pvlan-type',
2765
+ 'community',
2766
+ self._port.name,
2767
+ ]
2768
+ verifylist = [
2769
+ ('pvlan_type', 'community'),
2770
+ ('port', self._port.name),
2771
+ ]
2772
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
2773
+
2774
+ self.assertRaises(
2775
+ exceptions.CommandError,
2776
+ self.cmd.take_action,
2777
+ parsed_args,
2778
+ )
2779
+
2780
+ def test_set_pvlan_with_port_security_disabled(self):
2781
+ arglist = [
2782
+ '--disable-port-security',
2783
+ '--pvlan-type',
2784
+ 'isolated',
2785
+ self._port.name,
2786
+ ]
2787
+ verifylist = [
2788
+ ('disable_port_security', True),
2789
+ ('pvlan_type', 'isolated'),
2790
+ ('port', self._port.name),
2791
+ ]
2792
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
2793
+
2794
+ self.assertRaises(
2795
+ exceptions.CommandError,
2796
+ self.cmd.take_action,
2797
+ parsed_args,
2798
+ )
2799
+
2800
+ def test_set_pvlan_on_non_pvlan_network(self):
2801
+ fake_net = network_fakes.create_one_network(
2802
+ {'id': self._port.network_id, 'pvlan': False}
2803
+ )
2804
+ self.network_client.find_network.return_value = fake_net
2805
+ arglist = [
2806
+ '--pvlan-type',
2807
+ 'isolated',
2808
+ self._port.name,
2809
+ ]
2810
+ verifylist = [
2811
+ ('pvlan_type', 'isolated'),
2812
+ ('port', self._port.name),
2813
+ ]
2814
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
2815
+
2816
+ self.assertRaises(
2817
+ exceptions.CommandError,
2818
+ self.cmd.take_action,
2819
+ parsed_args,
2820
+ )
2821
+
2656
2822
 
2657
2823
  class TestShowPort(TestPort):
2658
2824
  # The port to show.
@@ -70,10 +70,7 @@ class TestAddPortToRouter(TestRouter):
70
70
  result = self.cmd.take_action(parsed_args)
71
71
 
72
72
  self.network_client.add_interface_to_router.assert_called_with(
73
- self._router,
74
- **{
75
- 'port_id': self._router.port,
76
- },
73
+ self._router, port=self._router.port
77
74
  )
78
75
  self.assertIsNone(result)
79
76
 
@@ -117,7 +114,7 @@ class TestAddSubnetToRouter(TestRouter):
117
114
 
118
115
  result = self.cmd.take_action(parsed_args)
119
116
  self.network_client.add_interface_to_router.assert_called_with(
120
- self._router, **{'subnet_id': self._router.subnet}
117
+ self._router, subnet=self._router.subnet
121
118
  )
122
119
 
123
120
  self.assertIsNone(result)
@@ -807,6 +804,30 @@ class TestListRouter(TestRouter):
807
804
  self.assertEqual(self.columns, columns)
808
805
  self.assertCountEqual(self.data, list(data))
809
806
 
807
+ def test_router_list_pagination(self):
808
+ arglist = [
809
+ '--marker',
810
+ self.routers[0].id,
811
+ '--limit',
812
+ '1',
813
+ ]
814
+ verifylist = [
815
+ ('marker', self.routers[0].id),
816
+ ('limit', 1),
817
+ ]
818
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
819
+
820
+ columns, data = self.cmd.take_action(parsed_args)
821
+
822
+ self.network_client.routers.assert_called_once_with(
823
+ **{
824
+ 'marker': self.routers[0].id,
825
+ 'limit': 1,
826
+ }
827
+ )
828
+ self.assertEqual(self.columns, columns)
829
+ self.assertEqual(self.data, list(data))
830
+
810
831
  def test_router_list_no_ha_no_distributed(self):
811
832
  _routers = network_fakes.create_routers(
812
833
  {'ha': None, 'distributed': None}, count=3
@@ -1064,7 +1085,7 @@ class TestRemovePortFromRouter(TestRouter):
1064
1085
  result = self.cmd.take_action(parsed_args)
1065
1086
 
1066
1087
  self.network_client.remove_interface_from_router.assert_called_with(
1067
- self._router, **{'port_id': self._router.port}
1088
+ self._router, port=self._router.port
1068
1089
  )
1069
1090
  self.assertIsNone(result)
1070
1091
 
@@ -1108,7 +1129,7 @@ class TestRemoveSubnetFromRouter(TestRouter):
1108
1129
 
1109
1130
  result = self.cmd.take_action(parsed_args)
1110
1131
  self.network_client.remove_interface_from_router.assert_called_with(
1111
- self._router, **{'subnet_id': self._router.subnet}
1132
+ self._router, subnet=self._router.subnet
1112
1133
  )
1113
1134
  self.assertIsNone(result)
1114
1135
 
@@ -310,6 +310,28 @@ class TestListSecurityGroupNetwork(TestSecurityGroupNetwork):
310
310
  self.assertEqual(self.columns, columns)
311
311
  self.assertCountEqual(self.data, list(data))
312
312
 
313
+ def test_security_groups_list_pagination(self):
314
+ arglist = [
315
+ '--marker',
316
+ self._security_groups[0].id,
317
+ '--limit',
318
+ '1',
319
+ ]
320
+ verifylist = [
321
+ ('marker', self._security_groups[0].id),
322
+ ('limit', 1),
323
+ ]
324
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
325
+
326
+ columns, data = self.cmd.take_action(parsed_args)
327
+
328
+ self.network_client.security_groups.assert_called_once_with(
329
+ fields=security_group.ListSecurityGroup.FIELDS_TO_RETRIEVE,
330
+ **{'marker': self._security_groups[0].id, 'limit': 1},
331
+ )
332
+ self.assertEqual(self.columns, columns)
333
+ self.assertEqual(self.data, list(data))
334
+
313
335
  def test_security_group_list_project(self):
314
336
  project = identity_fakes.FakeProject.create_one_project()
315
337
  self.projects_mock.get.return_value = project
@@ -1135,6 +1135,31 @@ class TestListSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
1135
1135
  self.assertEqual(self.expected_columns_no_group, columns)
1136
1136
  self.assertEqual(self.expected_data_no_group, list(data))
1137
1137
 
1138
+ def test_list_with_pagination(self):
1139
+ self._security_group_rule_tcp.port_range_min = 80
1140
+ arglist = [
1141
+ '--marker',
1142
+ self._security_group_rules[0].id,
1143
+ '--limit',
1144
+ '1',
1145
+ ]
1146
+ verifylist = [
1147
+ ('marker', self._security_group_rules[0].id),
1148
+ ('limit', 1),
1149
+ ]
1150
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
1151
+
1152
+ columns, data = self.cmd.take_action(parsed_args)
1153
+
1154
+ self.network_client.security_group_rules.assert_called_once_with(
1155
+ **{
1156
+ 'marker': self._security_group_rules[0].id,
1157
+ 'limit': 1,
1158
+ }
1159
+ )
1160
+ self.assertEqual(self.expected_columns_no_group, columns)
1161
+ self.assertEqual(self.expected_data_no_group, list(data))
1162
+
1138
1163
  def test_list_with_group(self):
1139
1164
  self._security_group_rule_tcp.port_range_min = 80
1140
1165
  arglist = [
@@ -790,7 +790,7 @@ class TestDeleteSubnet(TestSubnet):
790
790
 
791
791
  class TestListSubnet(TestSubnet):
792
792
  # The subnets going to be listed up.
793
- _subnet = network_fakes.FakeSubnet.create_subnets(count=3)
793
+ _subnets = network_fakes.FakeSubnet.create_subnets(count=3)
794
794
 
795
795
  columns = (
796
796
  'ID',
@@ -812,7 +812,7 @@ class TestListSubnet(TestSubnet):
812
812
  )
813
813
 
814
814
  data = []
815
- for subnet in _subnet:
815
+ for subnet in _subnets:
816
816
  data.append(
817
817
  (
818
818
  subnet.id,
@@ -823,7 +823,7 @@ class TestListSubnet(TestSubnet):
823
823
  )
824
824
 
825
825
  data_long = []
826
- for subnet in _subnet:
826
+ for subnet in _subnets:
827
827
  data_long.append(
828
828
  (
829
829
  subnet.id,
@@ -848,7 +848,7 @@ class TestListSubnet(TestSubnet):
848
848
  # Get the command object to test
849
849
  self.cmd = subnet_v2.ListSubnet(self.app, None)
850
850
 
851
- self.network_client.subnets.return_value = self._subnet
851
+ self.network_client.subnets.return_value = self._subnets
852
852
 
853
853
  def test_subnet_list_no_options(self):
854
854
  arglist = []
@@ -878,6 +878,30 @@ class TestListSubnet(TestSubnet):
878
878
  self.assertEqual(self.columns_long, columns)
879
879
  self.assertCountEqual(self.data_long, list(data))
880
880
 
881
+ def test_subnet_list_pagination(self):
882
+ arglist = [
883
+ '--marker',
884
+ self._subnets[0].id,
885
+ '--limit',
886
+ '1',
887
+ ]
888
+ verifylist = [
889
+ ('marker', self._subnets[0].id),
890
+ ('limit', 1),
891
+ ]
892
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
893
+
894
+ columns, data = self.cmd.take_action(parsed_args)
895
+
896
+ self.network_client.subnets.assert_called_once_with(
897
+ **{
898
+ 'marker': self._subnets[0].id,
899
+ 'limit': 1,
900
+ }
901
+ )
902
+ self.assertEqual(self.columns, columns)
903
+ self.assertEqual(self.data, list(data))
904
+
881
905
  def test_subnet_list_ip_version(self):
882
906
  arglist = [
883
907
  '--ip-version',
@@ -541,6 +541,30 @@ class TestListSubnetPool(TestSubnetPool):
541
541
  self.assertEqual(self.columns_long, columns)
542
542
  self.assertCountEqual(self.data_long, list(data))
543
543
 
544
+ def test_subnet_pool_list_pagination(self):
545
+ arglist = [
546
+ '--marker',
547
+ self._subnet_pools[0].id,
548
+ '--limit',
549
+ '1',
550
+ ]
551
+ verifylist = [
552
+ ('marker', self._subnet_pools[0].id),
553
+ ('limit', 1),
554
+ ]
555
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
556
+
557
+ columns, data = self.cmd.take_action(parsed_args)
558
+
559
+ self.network_client.subnet_pools.assert_called_once_with(
560
+ **{
561
+ 'marker': self._subnet_pools[0].id,
562
+ 'limit': 1,
563
+ }
564
+ )
565
+ self.assertEqual(self.columns, columns)
566
+ self.assertEqual(self.data, list(data))
567
+
544
568
  def test_subnet_pool_list_no_share(self):
545
569
  arglist = [
546
570
  '--no-share',
@@ -38,24 +38,14 @@ class FakeVolumeClient:
38
38
  self.management_url = kwargs['endpoint']
39
39
  self.api_version = api_versions.APIVersion('2.0')
40
40
 
41
- self.availability_zones = mock.Mock()
42
- self.availability_zones.resource_class = fakes.FakeResource(None, {})
43
41
  self.backups = mock.Mock()
44
42
  self.backups.resource_class = fakes.FakeResource(None, {})
45
- self.capabilities = mock.Mock()
46
- self.capabilities.resource_class = fakes.FakeResource(None, {})
47
43
  self.cgsnapshots = mock.Mock()
48
44
  self.cgsnapshots.resource_class = fakes.FakeResource(None, {})
49
45
  self.consistencygroups = mock.Mock()
50
46
  self.consistencygroups.resource_class = fakes.FakeResource(None, {})
51
- self.limits = mock.Mock()
52
- self.limits.resource_class = fakes.FakeResource(None, {})
53
- self.pools = mock.Mock()
54
- self.pools.resource_class = fakes.FakeResource(None, {})
55
47
  self.qos_specs = mock.Mock()
56
48
  self.qos_specs.resource_class = fakes.FakeResource(None, {})
57
- self.restores = mock.Mock()
58
- self.restores.resource_class = fakes.FakeResource(None, {})
59
49
  self.services = mock.Mock()
60
50
  self.services.resource_class = fakes.FakeResource(None, {})
61
51
  self.transfers = mock.Mock()
@@ -243,23 +233,6 @@ def create_one_service(attrs=None):
243
233
  return service
244
234
 
245
235
 
246
- def create_services(attrs=None, count=2):
247
- """Create multiple fake services.
248
-
249
- :param dict attrs:
250
- A dictionary with all attributes of service
251
- :param Integer count:
252
- The number of services to be faked
253
- :return:
254
- A list of FakeResource objects
255
- """
256
- services = []
257
- for n in range(0, count):
258
- services.append(create_one_service(attrs))
259
-
260
- return services
261
-
262
-
263
236
  def create_one_capability(attrs=None):
264
237
  """Create a fake volume backend capability.
265
238
 
@@ -400,6 +373,26 @@ def create_volumes(attrs=None, count=2):
400
373
  return volumes
401
374
 
402
375
 
376
+ def get_volumes(volumes=None, count=2):
377
+ """Get an iterable MagicMock object with a list of faked volumes.
378
+
379
+ If volumes list is provided, then initialize the Mock object with the
380
+ list. Otherwise create one.
381
+
382
+ :param List volumes:
383
+ A list of FakeResource objects faking volumes
384
+ :param Integer count:
385
+ The number of volumes to be faked
386
+ :return
387
+ An iterable Mock object with side_effect set to a list of faked
388
+ volumes
389
+ """
390
+ if volumes is None:
391
+ volumes = create_volumes(count)
392
+
393
+ return mock.Mock(side_effect=volumes)
394
+
395
+
403
396
  def create_one_sdk_volume(attrs=None):
404
397
  """Create a fake volume.
405
398
 
@@ -439,43 +432,6 @@ def create_one_sdk_volume(attrs=None):
439
432
  return _volume.Volume(**volume_info)
440
433
 
441
434
 
442
- def create_sdk_volumes(attrs=None, count=2):
443
- """Create multiple fake volumes.
444
-
445
- :param dict attrs:
446
- A dictionary with all attributes of volume
447
- :param Integer count:
448
- The number of volumes to be faked
449
- :return:
450
- A list of FakeResource objects
451
- """
452
- volumes = []
453
- for n in range(0, count):
454
- volumes.append(create_one_sdk_volume(attrs))
455
-
456
- return volumes
457
-
458
-
459
- def get_volumes(volumes=None, count=2):
460
- """Get an iterable MagicMock object with a list of faked volumes.
461
-
462
- If volumes list is provided, then initialize the Mock object with the
463
- list. Otherwise create one.
464
-
465
- :param List volumes:
466
- A list of FakeResource objects faking volumes
467
- :param Integer count:
468
- The number of volumes to be faked
469
- :return
470
- An iterable Mock object with side_effect set to a list of faked
471
- volumes
472
- """
473
- if volumes is None:
474
- volumes = create_volumes(count)
475
-
476
- return mock.Mock(side_effect=volumes)
477
-
478
-
479
435
  def create_one_backup(attrs=None):
480
436
  """Create a fake backup.
481
437
 
@@ -513,44 +469,6 @@ def create_one_backup(attrs=None):
513
469
  return backup
514
470
 
515
471
 
516
- def create_backups(attrs=None, count=2):
517
- """Create multiple fake backups.
518
-
519
- :param dict attrs:
520
- A dictionary with all attributes
521
- :param int count:
522
- The number of backups to fake
523
- :return: A list of fake
524
- openstack.block_storage.v2.backup.Backup objects
525
- """
526
- backups = []
527
- for i in range(0, count):
528
- backup = create_one_backup(attrs)
529
- backups.append(backup)
530
-
531
- return backups
532
-
533
-
534
- def get_backups(backups=None, count=2):
535
- """Get an iterable MagicMock object with a list of faked backups.
536
-
537
- If backups list is provided, then initialize the Mock object with the
538
- list. Otherwise create one.
539
-
540
- :param List backups:
541
- A list of FakeResource objects faking backups
542
- :param Integer count:
543
- The number of backups to be faked
544
- :return
545
- An iterable Mock object with side_effect set to a list of faked
546
- backups
547
- """
548
- if backups is None:
549
- backups = create_backups(count)
550
-
551
- return mock.Mock(side_effect=backups)
552
-
553
-
554
472
  def create_backup_record():
555
473
  """Gets a fake backup record for a given backup.
556
474
 
@@ -841,44 +759,6 @@ def create_one_snapshot(attrs=None):
841
759
  return snapshot
842
760
 
843
761
 
844
- def create_snapshots(attrs=None, count=2):
845
- """Create multiple fake snapshots.
846
-
847
- :param dict attrs:
848
- A dictionary with all attributes
849
- :param int count:
850
- The number of snapshots to fake
851
- :return:
852
- A list of FakeResource objects faking the snapshots
853
- """
854
- snapshots = []
855
- for i in range(0, count):
856
- snapshot = create_one_snapshot(attrs)
857
- snapshots.append(snapshot)
858
-
859
- return snapshots
860
-
861
-
862
- def get_snapshots(snapshots=None, count=2):
863
- """Get an iterable MagicMock object with a list of faked snapshots.
864
-
865
- If snapshots list is provided, then initialize the Mock object with the
866
- list. Otherwise create one.
867
-
868
- :param List snapshots:
869
- A list of FakeResource objects faking snapshots
870
- :param Integer count:
871
- The number of snapshots to be faked
872
- :return
873
- An iterable Mock object with side_effect set to a list of faked
874
- snapshots
875
- """
876
- if snapshots is None:
877
- snapshots = create_snapshots(count)
878
-
879
- return mock.Mock(side_effect=snapshots)
880
-
881
-
882
762
  def create_one_volume_type(attrs=None, methods=None):
883
763
  """Create a fake volume type.
884
764
 
@@ -293,6 +293,7 @@ class TestBackupList(volume_fakes.TestVolume):
293
293
  all_tenants=False,
294
294
  marker=None,
295
295
  limit=None,
296
+ max_items=None,
296
297
  )
297
298
  self.assertEqual(self.columns, columns)
298
299
  self.assertCountEqual(self.data, list(data))
@@ -338,6 +339,7 @@ class TestBackupList(volume_fakes.TestVolume):
338
339
  all_tenants=True,
339
340
  marker=self.backups[0].id,
340
341
  limit=3,
342
+ max_items=None,
341
343
  )
342
344
  self.assertEqual(self.columns_long, columns)
343
345
  self.assertCountEqual(self.data_long, list(data))
@@ -386,9 +388,7 @@ class TestBackupRestore(volume_fakes.TestVolume):
386
388
 
387
389
  columns, data = self.cmd.take_action(parsed_args)
388
390
  self.volume_sdk_client.restore_backup.assert_called_with(
389
- self.backup.id,
390
- volume_id=None,
391
- name=None,
391
+ self.backup.id, volume=None, name=None
392
392
  )
393
393
 
394
394
  self.assertEqual(self.columns, columns)
@@ -410,9 +410,7 @@ class TestBackupRestore(volume_fakes.TestVolume):
410
410
 
411
411
  columns, data = self.cmd.take_action(parsed_args)
412
412
  self.volume_sdk_client.restore_backup.assert_called_with(
413
- self.backup.id,
414
- volume_id=None,
415
- name=self.backup.volume_id,
413
+ self.backup.id, volume=None, name=self.backup.volume_id
416
414
  )
417
415
 
418
416
  self.assertEqual(self.columns, columns)
@@ -433,9 +431,7 @@ class TestBackupRestore(volume_fakes.TestVolume):
433
431
 
434
432
  columns, data = self.cmd.take_action(parsed_args)
435
433
  self.volume_sdk_client.restore_backup.assert_called_with(
436
- self.backup.id,
437
- volume_id=self.volume.id,
438
- name=None,
434
+ self.backup.id, volume=self.volume.id, name=None
439
435
  )
440
436
 
441
437
  self.assertEqual(self.columns, columns)