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
@@ -16,7 +16,7 @@ from openstackclient.identity.v3 import token
16
16
  from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes
17
17
 
18
18
 
19
- class TestTokenIssue(identity_fakes.TestIdentityv3):
19
+ class TestTokenIssue(identity_fakes.TestIdentity):
20
20
  def setUp(self):
21
21
  super().setUp()
22
22
 
@@ -99,7 +99,7 @@ class TestTokenIssue(identity_fakes.TestIdentityv3):
99
99
  self.assertEqual(datalist, data)
100
100
 
101
101
 
102
- class TestTokenRevoke(identity_fakes.TestIdentityv3):
102
+ class TestTokenRevoke(identity_fakes.TestIdentity):
103
103
  TOKEN = 'fob'
104
104
 
105
105
  def setUp(self):
@@ -26,7 +26,7 @@ from openstackclient.identity.v3 import trust
26
26
  from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes
27
27
 
28
28
 
29
- class TestTrustCreate(identity_fakes.TestIdentityv3):
29
+ class TestTrustCreate(identity_fakes.TestIdentity):
30
30
  def setUp(self):
31
31
  super().setUp()
32
32
 
@@ -109,7 +109,7 @@ class TestTrustCreate(identity_fakes.TestIdentityv3):
109
109
  self.assertEqual(datalist, data)
110
110
 
111
111
 
112
- class TestTrustDelete(identity_fakes.TestIdentityv3):
112
+ class TestTrustDelete(identity_fakes.TestIdentity):
113
113
  def setUp(self):
114
114
  super().setUp()
115
115
 
@@ -166,7 +166,7 @@ class TestTrustDelete(identity_fakes.TestIdentityv3):
166
166
  )
167
167
 
168
168
 
169
- class TestTrustList(identity_fakes.TestIdentityv3):
169
+ class TestTrustList(identity_fakes.TestIdentity):
170
170
  def setUp(self):
171
171
  super().setUp()
172
172
 
@@ -341,7 +341,7 @@ class TestTrustList(identity_fakes.TestIdentityv3):
341
341
  self.assertEqual(datalist, tuple(data))
342
342
 
343
343
 
344
- class TestTrustShow(identity_fakes.TestIdentityv3):
344
+ class TestTrustShow(identity_fakes.TestIdentity):
345
345
  def setUp(self):
346
346
  super().setUp()
347
347
 
@@ -31,7 +31,7 @@ from openstackclient.identity.v3 import user
31
31
  from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes
32
32
 
33
33
 
34
- class TestUserCreate(identity_fakes.TestIdentityv3):
34
+ class TestUserCreate(identity_fakes.TestIdentity):
35
35
  domain = sdk_fakes.generate_fake_resource(_domain.Domain)
36
36
  project = sdk_fakes.generate_fake_resource(_project.Project)
37
37
 
@@ -777,7 +777,7 @@ class TestUserCreate(identity_fakes.TestIdentityv3):
777
777
  self.assertEqual(self.datalist, data)
778
778
 
779
779
 
780
- class TestUserDelete(identity_fakes.TestIdentityv3):
780
+ class TestUserDelete(identity_fakes.TestIdentity):
781
781
  user = sdk_fakes.generate_fake_resource(_user.User)
782
782
 
783
783
  def setUp(self):
@@ -840,7 +840,7 @@ class TestUserDelete(identity_fakes.TestIdentityv3):
840
840
  )
841
841
 
842
842
 
843
- class TestUserList(identity_fakes.TestIdentityv3):
843
+ class TestUserList(identity_fakes.TestIdentity):
844
844
  domain = sdk_fakes.generate_fake_resource(_domain.Domain)
845
845
  project = sdk_fakes.generate_fake_resource(_project.Project)
846
846
  user = sdk_fakes.generate_fake_resource(
@@ -1034,8 +1034,75 @@ class TestUserList(identity_fakes.TestIdentityv3):
1034
1034
  self.assertEqual(self.columns, columns)
1035
1035
  self.assertEqual(self.datalist, tuple(data))
1036
1036
 
1037
+ def test_user_list_with_pagination(self):
1038
+ arglist = [
1039
+ '--limit',
1040
+ '2',
1041
+ '--marker',
1042
+ 'some-marker',
1043
+ ]
1044
+ verifylist = [
1045
+ ('limit', 2),
1046
+ ('marker', 'some-marker'),
1047
+ ]
1048
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
1049
+
1050
+ columns, data = self.cmd.take_action(parsed_args)
1051
+
1052
+ kwargs = {
1053
+ 'domain_id': None,
1054
+ 'limit': 2,
1055
+ 'marker': 'some-marker',
1056
+ }
1057
+ self.identity_sdk_client.users.assert_called_with(**kwargs)
1058
+
1059
+ self.assertEqual(self.columns, columns)
1060
+ self.assertEqual(self.datalist, tuple(data))
1061
+
1062
+ def test_user_list_with_pagination_and_group(self):
1063
+ arglist = [
1064
+ '--group',
1065
+ self.group.name,
1066
+ '--limit',
1067
+ '5',
1068
+ ]
1069
+ verifylist = [
1070
+ ('group', self.group.name),
1071
+ ('limit', 5),
1072
+ ]
1073
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
1074
+
1075
+ columns, data = self.cmd.take_action(parsed_args)
1076
+
1077
+ kwargs = {
1078
+ 'domain_id': None,
1079
+ 'group': self.group.id,
1080
+ 'limit': 5,
1081
+ }
1082
+ self.identity_sdk_client.group_users.assert_called_with(**kwargs)
1083
+
1084
+ self.assertEqual(self.columns, columns)
1085
+ self.assertEqual(self.datalist, tuple(data))
1086
+
1087
+ def test_user_list_pagination_with_project_fails(self):
1088
+ arglist = [
1089
+ '--project',
1090
+ self.project.name,
1091
+ '--limit',
1092
+ '2',
1093
+ ]
1094
+ verifylist = [
1095
+ ('project', self.project.name),
1096
+ ('limit', 2),
1097
+ ]
1098
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
1099
+
1100
+ self.assertRaises(
1101
+ exceptions.CommandError, self.cmd.take_action, parsed_args
1102
+ )
1103
+
1037
1104
 
1038
- class TestUserSet(identity_fakes.TestIdentityv3):
1105
+ class TestUserSet(identity_fakes.TestIdentity):
1039
1106
  project = sdk_fakes.generate_fake_resource(_project.Project)
1040
1107
  domain = sdk_fakes.generate_fake_resource(_domain.Domain)
1041
1108
  user = sdk_fakes.generate_fake_resource(
@@ -1684,7 +1751,7 @@ class TestUserSet(identity_fakes.TestIdentityv3):
1684
1751
  self.assertIsNone(result)
1685
1752
 
1686
1753
 
1687
- class TestUserSetPassword(identity_fakes.TestIdentityv3):
1754
+ class TestUserSetPassword(identity_fakes.TestIdentity):
1688
1755
  def setUp(self):
1689
1756
  super().setUp()
1690
1757
  self.cmd = user.SetPasswordUser(self.app, None)
@@ -1763,7 +1830,7 @@ class TestUserSetPassword(identity_fakes.TestIdentityv3):
1763
1830
  )
1764
1831
 
1765
1832
 
1766
- class TestUserShow(identity_fakes.TestIdentityv3):
1833
+ class TestUserShow(identity_fakes.TestIdentity):
1767
1834
  user = sdk_fakes.generate_fake_resource(_user.User)
1768
1835
 
1769
1836
  def setUp(self):
@@ -58,6 +58,8 @@ from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes
58
58
  from openstackclient.tests.unit import utils
59
59
 
60
60
 
61
+ PVLAN_TYPE_COMMUNITY = 'community'
62
+ PVLAN_COMMUNITY_NAME = 'community_1'
61
63
  RULE_TYPE_BANDWIDTH_LIMIT = 'bandwidth-limit'
62
64
  RULE_TYPE_DSCP_MARKING = 'dscp-marking'
63
65
  RULE_TYPE_MINIMUM_BANDWIDTH = 'minimum-bandwidth'
@@ -951,6 +953,7 @@ def create_one_network(attrs=None):
951
953
  'provider:network_type': 'vlan',
952
954
  'provider:physical_network': 'physnet1',
953
955
  'provider:segmentation_id': "400",
956
+ 'pvlan': "False",
954
957
  'router:external': True,
955
958
  'availability_zones': [],
956
959
  'availability_zone_hints': [],
@@ -1211,6 +1214,8 @@ def create_one_port(attrs=None):
1211
1214
  'security_group_ids': [],
1212
1215
  'status': 'ACTIVE',
1213
1216
  'project_id': 'project-id-' + uuid.uuid4().hex,
1217
+ 'pvlan_type': PVLAN_TYPE_COMMUNITY,
1218
+ 'pvlan_community': PVLAN_COMMUNITY_NAME,
1214
1219
  'qos_network_policy_id': 'qos-policy-id-' + uuid.uuid4().hex,
1215
1220
  'qos_policy_id': 'qos-policy-id-' + uuid.uuid4().hex,
1216
1221
  'tags': [],
@@ -1309,25 +1314,6 @@ def create_network_agents(attrs=None, count=2):
1309
1314
  return agents
1310
1315
 
1311
1316
 
1312
- def get_network_agents(agents=None, count=2):
1313
- """Get an iterable Mock object with a list of faked network agents.
1314
-
1315
- If network agents list is provided, then initialize the Mock object
1316
- with the list. Otherwise create one.
1317
-
1318
- :param List agents:
1319
- A list of Agent objects faking network agents
1320
- :param int count:
1321
- The number of network agents to fake
1322
- :return:
1323
- An iterable Mock object with side_effect set to a list of faked
1324
- network agents
1325
- """
1326
- if agents is None:
1327
- agents = create_network_agents(count)
1328
- return mock.Mock(side_effect=agents)
1329
-
1330
-
1331
1317
  def create_one_network_rbac(attrs=None):
1332
1318
  """Create a fake network rbac
1333
1319
 
@@ -1962,26 +1948,6 @@ def create_local_ip_associations(attrs=None, count=2):
1962
1948
  return local_ip_associations
1963
1949
 
1964
1950
 
1965
- def get_local_ip_associations(local_ip_associations=None, count=2):
1966
- """Get a list of faked local ip associations
1967
-
1968
- If local ip association list is provided, then initialize
1969
- the Mock object with the list. Otherwise create one.
1970
-
1971
- :param List local_ip_associations:
1972
- A list of FakeResource objects faking local ip associations
1973
- :param int count:
1974
- The number of local ip associations to fake
1975
- :return:
1976
- An iterable Mock object with side_effect set to a list of faked
1977
- local ip associations
1978
- """
1979
- if local_ip_associations is None:
1980
- local_ip_associations = create_local_ip_associations(count)
1981
-
1982
- return mock.Mock(side_effect=local_ip_associations)
1983
-
1984
-
1985
1951
  def create_one_ndp_proxy(attrs=None):
1986
1952
  """Create a fake NDP proxy.
1987
1953
 
@@ -2027,25 +1993,6 @@ def create_ndp_proxies(attrs=None, count=2):
2027
1993
  return ndp_proxies
2028
1994
 
2029
1995
 
2030
- def get_ndp_proxies(ndp_proxies=None, count=2):
2031
- """Get a list of faked NDP proxies.
2032
-
2033
- If ndp_proxy list is provided, then initialize the Mock object
2034
- with the list. Otherwise create one.
2035
-
2036
- :param List ndp_proxies:
2037
- A list of FakeResource objects faking ndp proxy
2038
- :param int count:
2039
- The number of ndp proxy to fake
2040
- :return:
2041
- An iterable Mock object with side_effect set to a list of faked
2042
- ndp proxy
2043
- """
2044
- if ndp_proxies is None:
2045
- ndp_proxies = create_ndp_proxies(count)
2046
- return mock.Mock(side_effect=ndp_proxies)
2047
-
2048
-
2049
1996
  def create_one_trunk(attrs=None):
2050
1997
  """Create a fake trunk.
2051
1998
 
@@ -2096,22 +2043,3 @@ def create_trunks(attrs=None, count=2):
2096
2043
  trunks.append(create_one_trunk(attrs))
2097
2044
 
2098
2045
  return trunks
2099
-
2100
-
2101
- def get_trunks(trunks=None, count=2):
2102
- """Get an iterable Mock object with a list of faked trunks.
2103
-
2104
- If trunk list is provided, then initialize the Mock object
2105
- with the list. Otherwise create one.
2106
-
2107
- :param List trunks:
2108
- A list of FakeResource objects faking trunks
2109
- :param int count:
2110
- The number of trunks to fake
2111
- :return:
2112
- An iterable Mock object with side_effect set to a list of faked
2113
- trunks
2114
- """
2115
- if trunks is None:
2116
- trunks = create_trunks(count)
2117
- return mock.Mock(side_effect=trunks)
@@ -32,6 +32,7 @@ CONVERT_MAP = {
32
32
  'egress_firewall_policy': 'egress_firewall_policy_id',
33
33
  'no_ingress_firewall_policy': 'ingress_firewall_policy_id',
34
34
  'no_egress_firewall_policy': 'egress_firewall_policy_id',
35
+ 'positional_name': 'name',
35
36
  'project': 'project_id',
36
37
  'port': 'ports',
37
38
  }
@@ -247,7 +248,6 @@ class TestCreateFirewallGroup(TestFirewallGroup):
247
248
  self.network_client.find_port.side_effect = _mock_find
248
249
  project_id = 'my-project'
249
250
  arglist = [
250
- '--name',
251
251
  name,
252
252
  '--description',
253
253
  description,
@@ -263,7 +263,7 @@ class TestCreateFirewallGroup(TestFirewallGroup):
263
263
  '--disable',
264
264
  ]
265
265
  verifylist = [
266
- ('name', name),
266
+ ('positional_name', name),
267
267
  ('description', description),
268
268
  ('ingress_firewall_policy', ingress_policy),
269
269
  ('egress_firewall_policy', egress_policy),
@@ -279,6 +279,32 @@ class TestCreateFirewallGroup(TestFirewallGroup):
279
279
 
280
280
  self.check_results(headers, data, request)
281
281
 
282
+ def test_create_with_name_option_deprecated(self):
283
+ name = 'my-name'
284
+ arglist = ['--name', name]
285
+ verifylist = [('name', name)]
286
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
287
+ with mock.patch.object(fwaas_group.LOG, 'warning') as mock_warning:
288
+ headers, _data = self.cmd.take_action(parsed_args)
289
+ mock_warning.assert_called_once_with(
290
+ 'The --name option is deprecated for the "firewall group '
291
+ 'create" command, please pass the name as a positional '
292
+ 'argument instead.'
293
+ )
294
+ self.assertEqual(self.ordered_headers, tuple(sorted(headers)))
295
+
296
+ def test_create_with_both_positional_and_option_name(self):
297
+ name = 'my-name'
298
+ arglist = [name, '--name', 'other-name']
299
+ verifylist = [
300
+ ('positional_name', name),
301
+ ('name', 'other-name'),
302
+ ]
303
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
304
+ self.assertRaises(
305
+ exceptions.CommandError, self.cmd.take_action, parsed_args
306
+ )
307
+
282
308
  def test_create_with_shared_and_no_share(self):
283
309
  arglist = [
284
310
  '--share',
@@ -29,6 +29,7 @@ from openstackclient.tests.unit import utils as test_utils
29
29
 
30
30
 
31
31
  CONVERT_MAP = {
32
+ 'positional_name': 'name',
32
33
  'project': 'project_id',
33
34
  }
34
35
 
@@ -222,10 +223,9 @@ class TestCreateFirewallRule(TestFirewallRule):
222
223
  destination_port = args.get('destination_port') or '0:65535'
223
224
  project_id = args.get('project_id') or 'my-tenant'
224
225
  arglist = [
226
+ name,
225
227
  '--description',
226
228
  description,
227
- '--name',
228
- name,
229
229
  '--protocol',
230
230
  protocol,
231
231
  '--ip-version',
@@ -247,7 +247,7 @@ class TestCreateFirewallRule(TestFirewallRule):
247
247
  ]
248
248
 
249
249
  verifylist = [
250
- ('name', name),
250
+ ('positional_name', name),
251
251
  ('description', description),
252
252
  ('shared', True),
253
253
  ('protocol', protocol),
@@ -320,6 +320,31 @@ class TestCreateFirewallRule(TestFirewallRule):
320
320
  verifylist,
321
321
  )
322
322
 
323
+ def test_create_with_name_option_deprecated(self):
324
+ name = 'my-name'
325
+ arglist = ['--name', name]
326
+ verifylist = [('name', name)]
327
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
328
+ with mock.patch.object(fwaas_rule.LOG, 'warning') as mock_warning:
329
+ _headers, _data = self.cmd.take_action(parsed_args)
330
+ mock_warning.assert_called_once_with(
331
+ 'The --name option is deprecated for the "firewall group '
332
+ 'rule create" command, please pass the name as a positional '
333
+ 'argument instead.'
334
+ )
335
+
336
+ def test_create_with_both_positional_and_option_name(self):
337
+ name = 'my-name'
338
+ arglist = [name, '--name', 'other-name']
339
+ verifylist = [
340
+ ('positional_name', name),
341
+ ('name', 'other-name'),
342
+ ]
343
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
344
+ self.assertRaises(
345
+ exceptions.CommandError, self.cmd.take_action, parsed_args
346
+ )
347
+
323
348
 
324
349
  class TestListFirewallRule(TestFirewallRule):
325
350
  def _setup_summary(self, expect=None):
@@ -264,6 +264,30 @@ class TestListAddressGroup(TestAddressGroup):
264
264
  self.assertEqual(self.columns, columns)
265
265
  self.assertCountEqual(self.data, list(data))
266
266
 
267
+ def test_address_group_list_pagination(self):
268
+ arglist = [
269
+ '--marker',
270
+ self.address_groups[0].id,
271
+ '--limit',
272
+ '1',
273
+ ]
274
+ verifylist = [
275
+ ('marker', self.address_groups[0].id),
276
+ ('limit', 1),
277
+ ]
278
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
279
+
280
+ columns, data = self.cmd.take_action(parsed_args)
281
+
282
+ self.network_client.address_groups.assert_called_once_with(
283
+ **{
284
+ 'marker': self.address_groups[0].id,
285
+ 'limit': 1,
286
+ }
287
+ )
288
+ self.assertEqual(self.columns, columns)
289
+ self.assertEqual(self.data, list(data))
290
+
267
291
  def test_address_group_list_name(self):
268
292
  arglist = [
269
293
  '--name',
@@ -280,6 +280,30 @@ class TestListAddressScope(TestAddressScope):
280
280
  self.assertEqual(self.columns, columns)
281
281
  self.assertEqual(self.data, list(data))
282
282
 
283
+ def test_address_scope_list_pagination(self):
284
+ arglist = [
285
+ '--marker',
286
+ self.address_scopes[0].id,
287
+ '--limit',
288
+ '1',
289
+ ]
290
+ verifylist = [
291
+ ('marker', self.address_scopes[0].id),
292
+ ('limit', 1),
293
+ ]
294
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
295
+
296
+ columns, data = self.cmd.take_action(parsed_args)
297
+
298
+ self.network_client.address_scopes.assert_called_once_with(
299
+ **{
300
+ 'marker': self.address_scopes[0].id,
301
+ 'limit': 1,
302
+ }
303
+ )
304
+ self.assertEqual(self.columns, columns)
305
+ self.assertEqual(self.data, list(data))
306
+
283
307
  def test_address_scope_list_name(self):
284
308
  arglist = [
285
309
  '--name',
@@ -700,6 +700,30 @@ class TestListFloatingIPNetwork(TestFloatingIPNetwork):
700
700
  self.assertEqual(self.columns, columns)
701
701
  self.assertEqual(self.data, list(data))
702
702
 
703
+ def test_floating_ip_list_pagination(self):
704
+ arglist = [
705
+ '--marker',
706
+ self.floating_ips[0].id,
707
+ '--limit',
708
+ '1',
709
+ ]
710
+ verifylist = [
711
+ ('marker', self.floating_ips[0].id),
712
+ ('limit', 1),
713
+ ]
714
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
715
+
716
+ columns, data = self.cmd.take_action(parsed_args)
717
+
718
+ self.network_client.ips.assert_called_once_with(
719
+ **{
720
+ 'marker': self.floating_ips[0].id,
721
+ 'limit': 1,
722
+ }
723
+ )
724
+ self.assertEqual(self.columns, columns)
725
+ self.assertEqual(self.data, list(data))
726
+
703
727
 
704
728
  class TestShowFloatingIPNetwork(TestFloatingIPNetwork):
705
729
  def setUp(self):
@@ -513,6 +513,30 @@ class TestListFloatingIPPortForwarding(TestFloatingIPPortForwarding):
513
513
  self.assertEqual(self.columns, columns)
514
514
  self.assertEqual(self.data, list(data))
515
515
 
516
+ def test_port_forwarding_list_pagination(self):
517
+ arglist = [
518
+ '--marker',
519
+ self.port_forwardings[0].id,
520
+ '--limit',
521
+ '1',
522
+ self.floating_ip.id,
523
+ ]
524
+ verifylist = [
525
+ ('marker', self.port_forwardings[0].id),
526
+ ('limit', 1),
527
+ ('floating_ip', self.floating_ip.id),
528
+ ]
529
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
530
+
531
+ columns, data = self.cmd.take_action(parsed_args)
532
+
533
+ self.network_client.floating_ip_port_forwardings.assert_called_once_with(
534
+ self.floating_ip,
535
+ **{'marker': self.port_forwardings[0].id, 'limit': 1},
536
+ )
537
+ self.assertEqual(self.columns, columns)
538
+ self.assertEqual(self.data, list(data))
539
+
516
540
  def test_port_forwarding_list_all_options(self):
517
541
  arglist = [
518
542
  '--port',
@@ -73,6 +73,31 @@ class TestListIPAvailability(TestIPAvailability):
73
73
  self.assertEqual(self.columns, columns)
74
74
  self.assertCountEqual(self.data, list(data))
75
75
 
76
+ def test_list_pagination(self):
77
+ arglist = [
78
+ '--marker',
79
+ self._ip_availability[0].network_id,
80
+ '--limit',
81
+ '1',
82
+ ]
83
+ verifylist = [
84
+ ('marker', self._ip_availability[0].network_id),
85
+ ('limit', 1),
86
+ ]
87
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
88
+
89
+ columns, data = self.cmd.take_action(parsed_args)
90
+
91
+ self.network_client.network_ip_availabilities.assert_called_once_with(
92
+ **{
93
+ 'ip_version': 4,
94
+ 'marker': self._ip_availability[0].network_id,
95
+ 'limit': 1,
96
+ }
97
+ )
98
+ self.assertEqual(self.columns, columns)
99
+ self.assertEqual(self.data, list(data))
100
+
76
101
  def test_list_ip_version(self):
77
102
  arglist = [
78
103
  '--ip-version',
@@ -155,7 +155,7 @@ class TestListL3ConntrackHelper(TestConntrackHelper):
155
155
  def setUp(self):
156
156
  super().setUp()
157
157
  attrs = {'router_id': self.router.id}
158
- ct_helpers = (
158
+ self.conntrack_helpers = (
159
159
  network_fakes.FakeL3ConntrackHelper.create_l3_conntrack_helpers(
160
160
  attrs, count=3
161
161
  )
@@ -168,7 +168,7 @@ class TestListL3ConntrackHelper(TestConntrackHelper):
168
168
  'Port',
169
169
  )
170
170
  self.data = []
171
- for ct_helper in ct_helpers:
171
+ for ct_helper in self.conntrack_helpers:
172
172
  self.data.append(
173
173
  (
174
174
  ct_helper.id,
@@ -178,7 +178,9 @@ class TestListL3ConntrackHelper(TestConntrackHelper):
178
178
  ct_helper.port,
179
179
  )
180
180
  )
181
- self.network_client.conntrack_helpers.return_value = ct_helpers
181
+ self.network_client.conntrack_helpers.return_value = (
182
+ self.conntrack_helpers
183
+ )
182
184
 
183
185
  # Get the command object to test
184
186
  self.cmd = l3_conntrack_helper.ListConntrackHelper(self.app, None)
@@ -201,6 +203,30 @@ class TestListL3ConntrackHelper(TestConntrackHelper):
201
203
  for index in range(len(list_data)):
202
204
  self.assertEqual(self.data[index], list_data[index])
203
205
 
206
+ def test_conntrack_helpers_list_pagination(self):
207
+ arglist = [
208
+ '--marker',
209
+ self.conntrack_helpers[0].id,
210
+ '--limit',
211
+ '1',
212
+ self.router.id,
213
+ ]
214
+ verifylist = [
215
+ ('marker', self.conntrack_helpers[0].id),
216
+ ('limit', 1),
217
+ ('router', self.router.id),
218
+ ]
219
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
220
+
221
+ columns, data = self.cmd.take_action(parsed_args)
222
+
223
+ self.network_client.conntrack_helpers.assert_called_once_with(
224
+ self.router.id,
225
+ **{'marker': self.conntrack_helpers[0].id, 'limit': 1},
226
+ )
227
+ self.assertEqual(self.columns, columns)
228
+ self.assertEqual(self.data, list(data))
229
+
204
230
 
205
231
  class TestSetL3ConntrackHelper(TestConntrackHelper):
206
232
  def setUp(self):