python-openstackclient 8.1.0__py3-none-any.whl → 8.3.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.
- openstackclient/api/compute_v2.py +2 -2
- openstackclient/api/object_store_v1.py +4 -1
- openstackclient/api/volume_v2.py +60 -0
- openstackclient/api/volume_v3.py +60 -0
- openstackclient/command.py +27 -0
- openstackclient/common/availability_zone.py +1 -1
- openstackclient/common/clientmanager.py +59 -21
- openstackclient/common/configuration.py +1 -1
- openstackclient/common/extension.py +1 -1
- openstackclient/common/limits.py +1 -1
- openstackclient/common/module.py +4 -2
- openstackclient/common/project_cleanup.py +10 -8
- openstackclient/common/quota.py +23 -6
- openstackclient/common/versions.py +1 -2
- openstackclient/compute/v2/agent.py +1 -1
- openstackclient/compute/v2/aggregate.py +6 -5
- openstackclient/compute/v2/console.py +5 -3
- openstackclient/compute/v2/console_connection.py +1 -1
- openstackclient/compute/v2/flavor.py +15 -2
- openstackclient/compute/v2/host.py +1 -1
- openstackclient/compute/v2/hypervisor.py +1 -1
- openstackclient/compute/v2/hypervisor_stats.py +1 -1
- openstackclient/compute/v2/keypair.py +1 -1
- openstackclient/compute/v2/server.py +77 -30
- openstackclient/compute/v2/server_backup.py +1 -1
- openstackclient/compute/v2/server_event.py +1 -1
- openstackclient/compute/v2/server_group.py +4 -2
- openstackclient/compute/v2/server_image.py +1 -1
- openstackclient/compute/v2/server_migration.py +1 -1
- openstackclient/compute/v2/server_volume.py +1 -1
- openstackclient/compute/v2/service.py +1 -1
- openstackclient/compute/v2/usage.py +6 -4
- openstackclient/identity/common.py +10 -14
- openstackclient/identity/v2_0/catalog.py +3 -2
- openstackclient/identity/v2_0/ec2creds.py +1 -1
- openstackclient/identity/v2_0/endpoint.py +1 -1
- openstackclient/identity/v2_0/project.py +17 -7
- openstackclient/identity/v2_0/role.py +1 -1
- openstackclient/identity/v2_0/role_assignment.py +3 -3
- openstackclient/identity/v2_0/service.py +1 -1
- openstackclient/identity/v2_0/token.py +1 -1
- openstackclient/identity/v2_0/user.py +2 -2
- openstackclient/identity/v3/access_rule.py +16 -4
- openstackclient/identity/v3/application_credential.py +116 -95
- openstackclient/identity/v3/catalog.py +3 -3
- openstackclient/identity/v3/consumer.py +1 -1
- openstackclient/identity/v3/credential.py +1 -1
- openstackclient/identity/v3/domain.py +15 -10
- openstackclient/identity/v3/ec2creds.py +1 -1
- openstackclient/identity/v3/endpoint.py +33 -12
- openstackclient/identity/v3/endpoint_group.py +1 -1
- openstackclient/identity/v3/federation_protocol.py +1 -1
- openstackclient/identity/v3/group.py +11 -5
- openstackclient/identity/v3/identity_provider.py +12 -10
- openstackclient/identity/v3/implied_role.py +1 -1
- openstackclient/identity/v3/limit.py +1 -1
- openstackclient/identity/v3/mapping.py +1 -1
- openstackclient/identity/v3/policy.py +1 -1
- openstackclient/identity/v3/project.py +34 -22
- openstackclient/identity/v3/region.py +1 -1
- openstackclient/identity/v3/registered_limit.py +16 -11
- openstackclient/identity/v3/role.py +27 -41
- openstackclient/identity/v3/role_assignment.py +12 -23
- openstackclient/identity/v3/service.py +1 -1
- openstackclient/identity/v3/service_provider.py +1 -1
- openstackclient/identity/v3/tag.py +3 -2
- openstackclient/identity/v3/token.py +3 -2
- openstackclient/identity/v3/trust.py +4 -2
- openstackclient/identity/v3/unscoped_saml.py +1 -1
- openstackclient/identity/v3/user.py +22 -13
- openstackclient/image/v1/image.py +35 -17
- openstackclient/image/v2/cache.py +11 -7
- openstackclient/image/v2/image.py +62 -12
- openstackclient/image/v2/info.py +1 -1
- openstackclient/image/v2/metadef_namespaces.py +1 -1
- openstackclient/image/v2/metadef_objects.py +9 -3
- openstackclient/image/v2/metadef_properties.py +11 -3
- openstackclient/image/v2/metadef_resource_type_association.py +1 -1
- openstackclient/image/v2/metadef_resource_types.py +1 -1
- openstackclient/image/v2/task.py +1 -1
- openstackclient/network/common.py +10 -9
- openstackclient/network/v2/address_group.py +4 -3
- openstackclient/network/v2/address_scope.py +8 -6
- openstackclient/network/v2/default_security_group_rule.py +9 -8
- openstackclient/network/v2/floating_ip.py +16 -9
- openstackclient/network/v2/floating_ip_port_forwarding.py +9 -6
- openstackclient/network/v2/ip_availability.py +7 -4
- openstackclient/network/v2/l3_conntrack_helper.py +11 -4
- openstackclient/network/v2/local_ip.py +13 -7
- openstackclient/network/v2/local_ip_association.py +7 -4
- openstackclient/network/v2/ndp_proxy.py +13 -6
- openstackclient/network/v2/network.py +33 -16
- openstackclient/network/v2/network_agent.py +5 -5
- openstackclient/network/v2/network_auto_allocated_topology.py +1 -1
- openstackclient/network/v2/network_flavor.py +1 -1
- openstackclient/network/v2/network_flavor_profile.py +1 -1
- openstackclient/network/v2/network_meter.py +1 -1
- openstackclient/network/v2/network_meter_rule.py +1 -1
- openstackclient/network/v2/network_qos_policy.py +7 -5
- openstackclient/network/v2/network_qos_rule.py +1 -1
- openstackclient/network/v2/network_qos_rule_type.py +1 -1
- openstackclient/network/v2/network_rbac.py +8 -5
- openstackclient/network/v2/network_segment.py +2 -2
- openstackclient/network/v2/network_segment_range.py +13 -6
- openstackclient/network/v2/network_service_provider.py +1 -1
- openstackclient/network/v2/network_trunk.py +65 -42
- openstackclient/network/v2/port.py +38 -20
- openstackclient/network/v2/router.py +19 -8
- openstackclient/network/v2/security_group.py +52 -7
- openstackclient/network/v2/security_group_rule.py +27 -4
- openstackclient/network/v2/subnet.py +17 -18
- openstackclient/network/v2/subnet_pool.py +11 -9
- openstackclient/network/v2/taas/__init__.py +0 -0
- openstackclient/network/v2/taas/tap_flow.py +245 -0
- openstackclient/network/v2/taas/tap_mirror.py +237 -0
- openstackclient/network/v2/taas/tap_service.py +211 -0
- openstackclient/object/v1/account.py +1 -1
- openstackclient/object/v1/container.py +1 -1
- openstackclient/object/v1/object.py +1 -1
- openstackclient/shell.py +18 -8
- openstackclient/tests/functional/identity/v3/test_access_rule.py +1 -1
- openstackclient/tests/functional/identity/v3/test_application_credential.py +7 -7
- openstackclient/tests/functional/identity/v3/test_catalog.py +42 -23
- openstackclient/tests/functional/identity/v3/test_role_assignment.py +174 -0
- openstackclient/tests/functional/image/v2/test_cache.py +54 -0
- openstackclient/tests/functional/image/v2/test_image.py +36 -14
- openstackclient/tests/functional/image/v2/test_metadef_resource_type.py +55 -0
- openstackclient/tests/functional/volume/v2/test_volume.py +1 -1
- openstackclient/tests/functional/volume/v3/test_volume.py +2 -2
- openstackclient/tests/unit/api/test_volume_v2.py +124 -0
- openstackclient/tests/unit/api/test_volume_v3.py +124 -0
- openstackclient/tests/unit/common/test_command.py +1 -1
- openstackclient/tests/unit/common/test_extension.py +2 -3
- openstackclient/tests/unit/common/test_module.py +14 -7
- openstackclient/tests/unit/common/test_quota.py +20 -0
- openstackclient/tests/unit/compute/v2/test_aggregate.py +5 -3
- openstackclient/tests/unit/compute/v2/test_console.py +1 -4
- openstackclient/tests/unit/compute/v2/test_flavor.py +160 -177
- openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +1 -9
- openstackclient/tests/unit/compute/v2/test_server.py +406 -81
- openstackclient/tests/unit/compute/v2/test_server_backup.py +1 -3
- openstackclient/tests/unit/compute/v2/test_service.py +1 -3
- openstackclient/tests/unit/fakes.py +35 -134
- openstackclient/tests/unit/identity/test_common.py +100 -0
- openstackclient/tests/unit/identity/v2_0/test_project.py +4 -4
- openstackclient/tests/unit/identity/v3/fakes.py +10 -2
- openstackclient/tests/unit/identity/v3/test_application_credential.py +50 -44
- openstackclient/tests/unit/identity/v3/test_domain.py +3 -3
- openstackclient/tests/unit/identity/v3/test_endpoint.py +1 -1
- openstackclient/tests/unit/identity/v3/test_group.py +4 -2
- openstackclient/tests/unit/identity/v3/test_identity_provider.py +10 -10
- openstackclient/tests/unit/identity/v3/test_oauth.py +1 -1
- openstackclient/tests/unit/identity/v3/test_project.py +31 -54
- openstackclient/tests/unit/identity/v3/test_registered_limit.py +2 -2
- openstackclient/tests/unit/identity/v3/test_role.py +3 -90
- openstackclient/tests/unit/identity/v3/test_user.py +7 -51
- openstackclient/tests/unit/image/v1/test_image.py +47 -0
- openstackclient/tests/unit/image/v2/test_image.py +190 -9
- openstackclient/tests/unit/image/v2/test_metadef_objects.py +22 -0
- openstackclient/tests/unit/image/v2/test_metadef_properties.py +24 -10
- openstackclient/tests/unit/network/test_common.py +9 -13
- openstackclient/tests/unit/network/v2/fakes.py +1 -0
- openstackclient/tests/unit/network/v2/taas/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/taas/test_osc_tap_flow.py +276 -0
- openstackclient/tests/unit/network/v2/taas/test_osc_tap_mirror.py +288 -0
- openstackclient/tests/unit/network/v2/taas/test_osc_tap_service.py +271 -0
- openstackclient/tests/unit/network/v2/test_address_group.py +19 -22
- openstackclient/tests/unit/network/v2/test_address_scope.py +10 -15
- openstackclient/tests/unit/network/v2/test_default_security_group_rule.py +38 -49
- openstackclient/tests/unit/network/v2/test_floating_ip_network.py +21 -27
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +21 -18
- openstackclient/tests/unit/network/v2/test_ip_availability.py +6 -8
- openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py +6 -15
- openstackclient/tests/unit/network/v2/test_local_ip.py +12 -23
- openstackclient/tests/unit/network/v2/test_local_ip_association.py +13 -18
- openstackclient/tests/unit/network/v2/test_ndp_proxy.py +13 -23
- openstackclient/tests/unit/network/v2/test_network.py +41 -37
- openstackclient/tests/unit/network/v2/test_network_agent.py +13 -20
- openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +5 -8
- openstackclient/tests/unit/network/v2/test_network_flavor.py +14 -26
- openstackclient/tests/unit/network/v2/test_network_flavor_profile.py +14 -17
- openstackclient/tests/unit/network/v2/test_network_meter.py +7 -17
- openstackclient/tests/unit/network/v2/test_network_meter_rule.py +10 -20
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +7 -13
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +44 -54
- openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +2 -7
- openstackclient/tests/unit/network/v2/test_network_rbac.py +21 -36
- openstackclient/tests/unit/network/v2/test_network_segment.py +13 -29
- openstackclient/tests/unit/network/v2/test_network_segment_range.py +20 -19
- openstackclient/tests/unit/network/v2/test_network_service_provider.py +1 -4
- openstackclient/tests/unit/network/v2/test_network_trunk.py +52 -47
- openstackclient/tests/unit/network/v2/test_port.py +113 -84
- openstackclient/tests/unit/network/v2/test_router.py +104 -126
- openstackclient/tests/unit/network/v2/test_security_group_network.py +25 -26
- openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +66 -18
- openstackclient/tests/unit/network/v2/test_subnet.py +35 -46
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +21 -33
- openstackclient/tests/unit/volume/test_find_resource.py +4 -13
- openstackclient/tests/unit/volume/v2/test_volume.py +358 -305
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +3 -1
- openstackclient/tests/unit/volume/v3/test_volume.py +443 -415
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +9 -0
- openstackclient/volume/client.py +7 -17
- openstackclient/volume/v2/backup_record.py +1 -1
- openstackclient/volume/v2/consistency_group.py +1 -1
- openstackclient/volume/v2/consistency_group_snapshot.py +1 -1
- openstackclient/volume/v2/qos_specs.py +1 -1
- openstackclient/volume/v2/service.py +2 -2
- openstackclient/volume/v2/volume.py +80 -54
- openstackclient/volume/v2/volume_backend.py +1 -1
- openstackclient/volume/v2/volume_backup.py +5 -3
- openstackclient/volume/v2/volume_host.py +1 -2
- openstackclient/volume/v2/volume_snapshot.py +2 -2
- openstackclient/volume/v2/volume_transfer_request.py +1 -1
- openstackclient/volume/v2/volume_type.py +11 -6
- openstackclient/volume/v3/block_storage_cleanup.py +1 -1
- openstackclient/volume/v3/block_storage_cluster.py +1 -1
- openstackclient/volume/v3/block_storage_log_level.py +1 -1
- openstackclient/volume/v3/block_storage_manage.py +1 -1
- openstackclient/volume/v3/block_storage_resource_filter.py +1 -1
- openstackclient/volume/v3/service.py +2 -2
- openstackclient/volume/v3/volume.py +104 -77
- openstackclient/volume/v3/volume_attachment.py +6 -5
- openstackclient/volume/v3/volume_backup.py +18 -3
- openstackclient/volume/v3/volume_group.py +2 -2
- openstackclient/volume/v3/volume_group_snapshot.py +1 -1
- openstackclient/volume/v3/volume_group_type.py +1 -1
- openstackclient/volume/v3/volume_message.py +1 -1
- openstackclient/volume/v3/volume_snapshot.py +2 -2
- openstackclient/volume/v3/volume_transfer_request.py +1 -1
- openstackclient/volume/v3/volume_type.py +15 -9
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info}/METADATA +19 -17
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info}/RECORD +239 -224
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info}/entry_points.txt +15 -0
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info/licenses}/AUTHORS +15 -0
- python_openstackclient-8.3.0.dist-info/pbr.json +1 -0
- openstackclient/tests/unit/common/test_logs.py +0 -221
- python_openstackclient-8.1.0.dist-info/pbr.json +0 -1
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info/licenses}/LICENSE +0 -0
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info}/top_level.txt +0 -0
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
# under the License.
|
|
12
12
|
#
|
|
13
13
|
|
|
14
|
-
from unittest import mock
|
|
15
14
|
from unittest.mock import call
|
|
16
15
|
|
|
17
16
|
from osc_lib import exceptions
|
|
@@ -69,9 +68,10 @@ class TestCreateSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
69
68
|
self._security_group_rule = (
|
|
70
69
|
network_fakes.create_one_security_group_rule(attrs)
|
|
71
70
|
)
|
|
72
|
-
self.network_client.create_security_group_rule =
|
|
73
|
-
|
|
71
|
+
self.network_client.create_security_group_rule.return_value = (
|
|
72
|
+
self._security_group_rule
|
|
74
73
|
)
|
|
74
|
+
|
|
75
75
|
self.expected_data = (
|
|
76
76
|
self._security_group_rule.created_at,
|
|
77
77
|
self._security_group_rule.description,
|
|
@@ -93,12 +93,12 @@ class TestCreateSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
93
93
|
def setUp(self):
|
|
94
94
|
super().setUp()
|
|
95
95
|
|
|
96
|
-
self.network_client.find_security_group =
|
|
97
|
-
|
|
96
|
+
self.network_client.find_security_group.return_value = (
|
|
97
|
+
self._security_group
|
|
98
98
|
)
|
|
99
99
|
|
|
100
|
-
self.network_client.find_address_group =
|
|
101
|
-
|
|
100
|
+
self.network_client.find_address_group.return_value = (
|
|
101
|
+
self._address_group
|
|
102
102
|
)
|
|
103
103
|
|
|
104
104
|
self.projects_mock.get.return_value = self.project
|
|
@@ -970,9 +970,7 @@ class TestDeleteSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
970
970
|
def setUp(self):
|
|
971
971
|
super().setUp()
|
|
972
972
|
|
|
973
|
-
self.network_client.delete_security_group_rule =
|
|
974
|
-
return_value=None
|
|
975
|
-
)
|
|
973
|
+
self.network_client.delete_security_group_rule.return_value = None
|
|
976
974
|
|
|
977
975
|
self.network_client.find_security_group_rule = (
|
|
978
976
|
network_fakes.get_security_group_rules(self._security_group_rules)
|
|
@@ -1030,8 +1028,8 @@ class TestDeleteSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
1030
1028
|
self._security_group_rules[0],
|
|
1031
1029
|
exceptions.CommandError,
|
|
1032
1030
|
]
|
|
1033
|
-
self.network_client.find_security_group_rule =
|
|
1034
|
-
|
|
1031
|
+
self.network_client.find_security_group_rule.side_effect = (
|
|
1032
|
+
find_mock_result
|
|
1035
1033
|
)
|
|
1036
1034
|
|
|
1037
1035
|
try:
|
|
@@ -1134,11 +1132,12 @@ class TestListSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
1134
1132
|
def setUp(self):
|
|
1135
1133
|
super().setUp()
|
|
1136
1134
|
|
|
1137
|
-
self.network_client.find_security_group =
|
|
1138
|
-
|
|
1135
|
+
self.network_client.find_security_group.return_value = (
|
|
1136
|
+
self._security_group
|
|
1139
1137
|
)
|
|
1140
|
-
|
|
1141
|
-
|
|
1138
|
+
|
|
1139
|
+
self.network_client.security_group_rules.return_value = (
|
|
1140
|
+
self._security_group_rules
|
|
1142
1141
|
)
|
|
1143
1142
|
|
|
1144
1143
|
# Get the command object to test
|
|
@@ -1251,6 +1250,55 @@ class TestListSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
1251
1250
|
self.assertEqual(self.expected_columns_no_group, columns)
|
|
1252
1251
|
self.assertEqual(self.expected_data_no_group, list(data))
|
|
1253
1252
|
|
|
1253
|
+
def test_list_with_project(self):
|
|
1254
|
+
project = identity_fakes.FakeProject.create_one_project()
|
|
1255
|
+
self._security_group_rule_tcp.port_range_min = 80
|
|
1256
|
+
self.projects_mock.get.return_value = project
|
|
1257
|
+
|
|
1258
|
+
arglist = [
|
|
1259
|
+
'--project',
|
|
1260
|
+
project.id,
|
|
1261
|
+
]
|
|
1262
|
+
verifylist = [
|
|
1263
|
+
('project', project.id),
|
|
1264
|
+
]
|
|
1265
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1266
|
+
|
|
1267
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
1268
|
+
filters = {'tenant_id': project.id, 'project_id': project.id}
|
|
1269
|
+
|
|
1270
|
+
self.network_client.security_group_rules.assert_called_once_with(
|
|
1271
|
+
**filters
|
|
1272
|
+
)
|
|
1273
|
+
self.assertEqual(self.expected_columns_no_group, columns)
|
|
1274
|
+
self.assertEqual(self.expected_data_no_group, list(data))
|
|
1275
|
+
|
|
1276
|
+
def test_list_with_project_domain(self):
|
|
1277
|
+
project = identity_fakes.FakeProject.create_one_project()
|
|
1278
|
+
self._security_group_rule_tcp.port_range_min = 80
|
|
1279
|
+
self.projects_mock.get.return_value = project
|
|
1280
|
+
|
|
1281
|
+
arglist = [
|
|
1282
|
+
'--project',
|
|
1283
|
+
project.id,
|
|
1284
|
+
'--project-domain',
|
|
1285
|
+
project.domain_id,
|
|
1286
|
+
]
|
|
1287
|
+
verifylist = [
|
|
1288
|
+
('project', project.id),
|
|
1289
|
+
('project_domain', project.domain_id),
|
|
1290
|
+
]
|
|
1291
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1292
|
+
|
|
1293
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
1294
|
+
filters = {'tenant_id': project.id, 'project_id': project.id}
|
|
1295
|
+
|
|
1296
|
+
self.network_client.security_group_rules.assert_called_once_with(
|
|
1297
|
+
**filters
|
|
1298
|
+
)
|
|
1299
|
+
self.assertEqual(self.expected_columns_no_group, columns)
|
|
1300
|
+
self.assertEqual(self.expected_data_no_group, list(data))
|
|
1301
|
+
|
|
1254
1302
|
|
|
1255
1303
|
class TestShowSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
1256
1304
|
# The security group rule to be shown.
|
|
@@ -1295,8 +1343,8 @@ class TestShowSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
1295
1343
|
def setUp(self):
|
|
1296
1344
|
super().setUp()
|
|
1297
1345
|
|
|
1298
|
-
self.network_client.find_security_group_rule =
|
|
1299
|
-
|
|
1346
|
+
self.network_client.find_security_group_rule.return_value = (
|
|
1347
|
+
self._security_group_rule
|
|
1300
1348
|
)
|
|
1301
1349
|
|
|
1302
1350
|
# Get the command object to test
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
# under the License.
|
|
12
12
|
#
|
|
13
13
|
|
|
14
|
-
from unittest import mock
|
|
15
14
|
from unittest.mock import call
|
|
16
15
|
|
|
17
16
|
from osc_lib.cli import format_columns
|
|
@@ -266,19 +265,14 @@ class TestCreateSubnet(TestSubnet):
|
|
|
266
265
|
self.domains_mock.get.return_value = self.domain
|
|
267
266
|
|
|
268
267
|
# Mock SDK calls for all tests.
|
|
269
|
-
self.network_client.create_subnet =
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
self.network_client.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
self.network_client.
|
|
277
|
-
return_value=self._network_segment
|
|
278
|
-
)
|
|
279
|
-
self.network_client.find_subnet_pool = mock.Mock(
|
|
280
|
-
return_value=self._subnet_pool
|
|
281
|
-
)
|
|
268
|
+
self.network_client.create_subnet.return_value = self._subnet
|
|
269
|
+
|
|
270
|
+
self.network_client.set_tags.return_value = None
|
|
271
|
+
self.network_client.find_network.return_value = self._network
|
|
272
|
+
|
|
273
|
+
self.network_client.find_segment.return_value = self._network_segment
|
|
274
|
+
|
|
275
|
+
self.network_client.find_subnet_pool.return_value = self._subnet_pool
|
|
282
276
|
|
|
283
277
|
def test_create_no_options(self):
|
|
284
278
|
arglist = []
|
|
@@ -333,7 +327,7 @@ class TestCreateSubnet(TestSubnet):
|
|
|
333
327
|
def test_create_from_subnet_pool_options(self):
|
|
334
328
|
# Mock SDK calls for this test.
|
|
335
329
|
self.network_client.create_subnet.return_value = self._subnet_from_pool
|
|
336
|
-
self.network_client.set_tags =
|
|
330
|
+
self.network_client.set_tags.return_value = None
|
|
337
331
|
self._network.id = self._subnet_from_pool.network_id
|
|
338
332
|
|
|
339
333
|
arglist = [
|
|
@@ -721,7 +715,7 @@ class TestDeleteSubnet(TestSubnet):
|
|
|
721
715
|
def setUp(self):
|
|
722
716
|
super().setUp()
|
|
723
717
|
|
|
724
|
-
self.network_client.delete_subnet =
|
|
718
|
+
self.network_client.delete_subnet.return_value = None
|
|
725
719
|
|
|
726
720
|
self.network_client.find_subnet = network_fakes.FakeSubnet.get_subnets(
|
|
727
721
|
self._subnets
|
|
@@ -775,9 +769,7 @@ class TestDeleteSubnet(TestSubnet):
|
|
|
775
769
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
776
770
|
|
|
777
771
|
find_mock_result = [self._subnets[0], exceptions.CommandError]
|
|
778
|
-
self.network_client.find_subnet =
|
|
779
|
-
side_effect=find_mock_result
|
|
780
|
-
)
|
|
772
|
+
self.network_client.find_subnet.side_effect = find_mock_result
|
|
781
773
|
|
|
782
774
|
try:
|
|
783
775
|
self.cmd.take_action(parsed_args)
|
|
@@ -855,7 +847,7 @@ class TestListSubnet(TestSubnet):
|
|
|
855
847
|
# Get the command object to test
|
|
856
848
|
self.cmd = subnet_v2.ListSubnet(self.app, None)
|
|
857
849
|
|
|
858
|
-
self.network_client.subnets =
|
|
850
|
+
self.network_client.subnets.return_value = self._subnet
|
|
859
851
|
|
|
860
852
|
def test_subnet_list_no_options(self):
|
|
861
853
|
arglist = []
|
|
@@ -1019,7 +1011,7 @@ class TestListSubnet(TestSubnet):
|
|
|
1019
1011
|
|
|
1020
1012
|
def test_subnet_list_network(self):
|
|
1021
1013
|
network = network_fakes.create_one_network()
|
|
1022
|
-
self.network_client.find_network =
|
|
1014
|
+
self.network_client.find_network.return_value = network
|
|
1023
1015
|
arglist = [
|
|
1024
1016
|
'--network',
|
|
1025
1017
|
network.id,
|
|
@@ -1038,7 +1030,7 @@ class TestListSubnet(TestSubnet):
|
|
|
1038
1030
|
|
|
1039
1031
|
def test_subnet_list_gateway(self):
|
|
1040
1032
|
subnet = network_fakes.FakeSubnet.create_one_subnet()
|
|
1041
|
-
self.network_client.find_network =
|
|
1033
|
+
self.network_client.find_network.return_value = subnet
|
|
1042
1034
|
arglist = [
|
|
1043
1035
|
'--gateway',
|
|
1044
1036
|
subnet.gateway_ip,
|
|
@@ -1057,7 +1049,7 @@ class TestListSubnet(TestSubnet):
|
|
|
1057
1049
|
|
|
1058
1050
|
def test_subnet_list_name(self):
|
|
1059
1051
|
subnet = network_fakes.FakeSubnet.create_one_subnet()
|
|
1060
|
-
self.network_client.find_network =
|
|
1052
|
+
self.network_client.find_network.return_value = subnet
|
|
1061
1053
|
arglist = [
|
|
1062
1054
|
'--name',
|
|
1063
1055
|
subnet.name,
|
|
@@ -1076,7 +1068,7 @@ class TestListSubnet(TestSubnet):
|
|
|
1076
1068
|
|
|
1077
1069
|
def test_subnet_list_subnet_range(self):
|
|
1078
1070
|
subnet = network_fakes.FakeSubnet.create_one_subnet()
|
|
1079
|
-
self.network_client.find_network =
|
|
1071
|
+
self.network_client.find_network.return_value = subnet
|
|
1080
1072
|
arglist = [
|
|
1081
1073
|
'--subnet-range',
|
|
1082
1074
|
subnet.cidr,
|
|
@@ -1098,10 +1090,9 @@ class TestListSubnet(TestSubnet):
|
|
|
1098
1090
|
subnet = network_fakes.FakeSubnet.create_one_subnet(
|
|
1099
1091
|
{'subnetpool_id': subnet_pool.id}
|
|
1100
1092
|
)
|
|
1101
|
-
self.network_client.find_network =
|
|
1102
|
-
self.network_client.find_subnet_pool =
|
|
1103
|
-
|
|
1104
|
-
)
|
|
1093
|
+
self.network_client.find_network.return_value = subnet
|
|
1094
|
+
self.network_client.find_subnet_pool.return_value = subnet_pool
|
|
1095
|
+
|
|
1105
1096
|
arglist = [
|
|
1106
1097
|
'--subnet-pool',
|
|
1107
1098
|
subnet_pool.name,
|
|
@@ -1123,10 +1114,9 @@ class TestListSubnet(TestSubnet):
|
|
|
1123
1114
|
subnet = network_fakes.FakeSubnet.create_one_subnet(
|
|
1124
1115
|
{'subnetpool_id': subnet_pool.id}
|
|
1125
1116
|
)
|
|
1126
|
-
self.network_client.find_network =
|
|
1127
|
-
self.network_client.find_subnet_pool =
|
|
1128
|
-
|
|
1129
|
-
)
|
|
1117
|
+
self.network_client.find_network.return_value = subnet
|
|
1118
|
+
self.network_client.find_subnet_pool.return_value = subnet_pool
|
|
1119
|
+
|
|
1130
1120
|
arglist = [
|
|
1131
1121
|
'--subnet-pool',
|
|
1132
1122
|
subnet_pool.id,
|
|
@@ -1182,9 +1172,9 @@ class TestSetSubnet(TestSubnet):
|
|
|
1182
1172
|
|
|
1183
1173
|
def setUp(self):
|
|
1184
1174
|
super().setUp()
|
|
1185
|
-
self.network_client.update_subnet =
|
|
1186
|
-
self.network_client.set_tags =
|
|
1187
|
-
self.network_client.find_subnet =
|
|
1175
|
+
self.network_client.update_subnet.return_value = None
|
|
1176
|
+
self.network_client.set_tags.return_value = None
|
|
1177
|
+
self.network_client.find_subnet.return_value = self._subnet
|
|
1188
1178
|
self.cmd = subnet_v2.SetSubnet(self.app, None)
|
|
1189
1179
|
|
|
1190
1180
|
def test_set_this(self):
|
|
@@ -1263,7 +1253,7 @@ class TestSetSubnet(TestSubnet):
|
|
|
1263
1253
|
'service_types': ["network:router_gateway"],
|
|
1264
1254
|
}
|
|
1265
1255
|
)
|
|
1266
|
-
self.network_client.find_subnet =
|
|
1256
|
+
self.network_client.find_subnet.return_value = _testsubnet
|
|
1267
1257
|
arglist = [
|
|
1268
1258
|
'--dns-nameserver',
|
|
1269
1259
|
'10.0.0.2',
|
|
@@ -1329,7 +1319,7 @@ class TestSetSubnet(TestSubnet):
|
|
|
1329
1319
|
'dns_nameservers': ["10.0.0.1"],
|
|
1330
1320
|
}
|
|
1331
1321
|
)
|
|
1332
|
-
self.network_client.find_subnet =
|
|
1322
|
+
self.network_client.find_subnet.return_value = _testsubnet
|
|
1333
1323
|
arglist = [
|
|
1334
1324
|
'--host-route',
|
|
1335
1325
|
'destination=10.30.30.30/24,gateway=10.30.30.1',
|
|
@@ -1379,7 +1369,7 @@ class TestSetSubnet(TestSubnet):
|
|
|
1379
1369
|
'dns_nameservers': ['10.0.0.1'],
|
|
1380
1370
|
}
|
|
1381
1371
|
)
|
|
1382
|
-
self.network_client.find_subnet =
|
|
1372
|
+
self.network_client.find_subnet.return_value = _testsubnet
|
|
1383
1373
|
arglist = [
|
|
1384
1374
|
'--no-host-route',
|
|
1385
1375
|
'--no-allocation-pool',
|
|
@@ -1448,8 +1438,8 @@ class TestSetSubnet(TestSubnet):
|
|
|
1448
1438
|
'segment_id': None,
|
|
1449
1439
|
}
|
|
1450
1440
|
)
|
|
1451
|
-
self.network_client.find_subnet =
|
|
1452
|
-
self.network_client.find_segment =
|
|
1441
|
+
self.network_client.find_subnet.return_value = _subnet
|
|
1442
|
+
self.network_client.find_segment.return_value = _segment
|
|
1453
1443
|
arglist = ['--network-segment', _segment.id, _subnet.name]
|
|
1454
1444
|
verifylist = [('network_segment', _segment.id)]
|
|
1455
1445
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -1514,7 +1504,7 @@ class TestShowSubnet(TestSubnet):
|
|
|
1514
1504
|
# Get the command object to test
|
|
1515
1505
|
self.cmd = subnet_v2.ShowSubnet(self.app, None)
|
|
1516
1506
|
|
|
1517
|
-
self.network_client.find_subnet =
|
|
1507
|
+
self.network_client.find_subnet.return_value = self._subnet
|
|
1518
1508
|
|
|
1519
1509
|
def test_show_no_options(self):
|
|
1520
1510
|
arglist = []
|
|
@@ -1572,11 +1562,10 @@ class TestUnsetSubnet(TestSubnet):
|
|
|
1572
1562
|
'tags': ['green', 'red'],
|
|
1573
1563
|
}
|
|
1574
1564
|
)
|
|
1575
|
-
self.network_client.find_subnet =
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
self.network_client.
|
|
1579
|
-
self.network_client.set_tags = mock.Mock(return_value=None)
|
|
1565
|
+
self.network_client.find_subnet.return_value = self._testsubnet
|
|
1566
|
+
|
|
1567
|
+
self.network_client.update_subnet.return_value = None
|
|
1568
|
+
self.network_client.set_tags.return_value = None
|
|
1580
1569
|
# Get the command object to test
|
|
1581
1570
|
self.cmd = subnet_v2.UnsetSubnet(self.app, None)
|
|
1582
1571
|
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
# License for the specific language governing permissions and limitations
|
|
11
11
|
# under the License.
|
|
12
12
|
|
|
13
|
-
from unittest import mock
|
|
14
13
|
from unittest.mock import call
|
|
15
14
|
|
|
16
15
|
from osc_lib.cli import format_columns
|
|
@@ -76,16 +75,15 @@ class TestCreateSubnetPool(TestSubnetPool):
|
|
|
76
75
|
def setUp(self):
|
|
77
76
|
super().setUp()
|
|
78
77
|
|
|
79
|
-
self.network_client.create_subnet_pool =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
self.network_client.set_tags = mock.Mock(return_value=None)
|
|
78
|
+
self.network_client.create_subnet_pool.return_value = self._subnet_pool
|
|
79
|
+
|
|
80
|
+
self.network_client.set_tags.return_value = None
|
|
83
81
|
|
|
84
82
|
# Get the command object to test
|
|
85
83
|
self.cmd = subnet_pool.CreateSubnetPool(self.app, None)
|
|
86
84
|
|
|
87
|
-
self.network_client.find_address_scope =
|
|
88
|
-
|
|
85
|
+
self.network_client.find_address_scope.return_value = (
|
|
86
|
+
self._address_scope
|
|
89
87
|
)
|
|
90
88
|
|
|
91
89
|
self.projects_mock.get.return_value = self.project
|
|
@@ -387,7 +385,7 @@ class TestDeleteSubnetPool(TestSubnetPool):
|
|
|
387
385
|
def setUp(self):
|
|
388
386
|
super().setUp()
|
|
389
387
|
|
|
390
|
-
self.network_client.delete_subnet_pool =
|
|
388
|
+
self.network_client.delete_subnet_pool.return_value = None
|
|
391
389
|
|
|
392
390
|
self.network_client.find_subnet_pool = (
|
|
393
391
|
network_fakes.FakeSubnetPool.get_subnet_pools(self._subnet_pools)
|
|
@@ -445,9 +443,7 @@ class TestDeleteSubnetPool(TestSubnetPool):
|
|
|
445
443
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
446
444
|
|
|
447
445
|
find_mock_result = [self._subnet_pools[0], exceptions.CommandError]
|
|
448
|
-
self.network_client.find_subnet_pool =
|
|
449
|
-
side_effect=find_mock_result
|
|
450
|
-
)
|
|
446
|
+
self.network_client.find_subnet_pool.side_effect = find_mock_result
|
|
451
447
|
|
|
452
448
|
try:
|
|
453
449
|
self.cmd.take_action(parsed_args)
|
|
@@ -514,9 +510,7 @@ class TestListSubnetPool(TestSubnetPool):
|
|
|
514
510
|
# Get the command object to test
|
|
515
511
|
self.cmd = subnet_pool.ListSubnetPool(self.app, None)
|
|
516
512
|
|
|
517
|
-
self.network_client.subnet_pools =
|
|
518
|
-
return_value=self._subnet_pools
|
|
519
|
-
)
|
|
513
|
+
self.network_client.subnet_pools.return_value = self._subnet_pools
|
|
520
514
|
|
|
521
515
|
def test_subnet_pool_list_no_option(self):
|
|
522
516
|
arglist = []
|
|
@@ -653,7 +647,7 @@ class TestListSubnetPool(TestSubnetPool):
|
|
|
653
647
|
|
|
654
648
|
def test_subnet_pool_list_name(self):
|
|
655
649
|
subnet_pool = network_fakes.FakeSubnetPool.create_one_subnet_pool()
|
|
656
|
-
self.network_client.find_network =
|
|
650
|
+
self.network_client.find_network.return_value = subnet_pool
|
|
657
651
|
arglist = [
|
|
658
652
|
'--name',
|
|
659
653
|
subnet_pool.name,
|
|
@@ -672,9 +666,8 @@ class TestListSubnetPool(TestSubnetPool):
|
|
|
672
666
|
|
|
673
667
|
def test_subnet_pool_list_address_scope(self):
|
|
674
668
|
addr_scope = network_fakes.create_one_address_scope()
|
|
675
|
-
self.network_client.find_address_scope =
|
|
676
|
-
|
|
677
|
-
)
|
|
669
|
+
self.network_client.find_address_scope.return_value = addr_scope
|
|
670
|
+
|
|
678
671
|
arglist = [
|
|
679
672
|
'--address-scope',
|
|
680
673
|
addr_scope.id,
|
|
@@ -734,15 +727,13 @@ class TestSetSubnetPool(TestSubnetPool):
|
|
|
734
727
|
def setUp(self):
|
|
735
728
|
super().setUp()
|
|
736
729
|
|
|
737
|
-
self.network_client.update_subnet_pool =
|
|
738
|
-
self.network_client.set_tags =
|
|
730
|
+
self.network_client.update_subnet_pool.return_value = None
|
|
731
|
+
self.network_client.set_tags.return_value = None
|
|
739
732
|
|
|
740
|
-
self.network_client.find_subnet_pool =
|
|
741
|
-
return_value=self._subnet_pool
|
|
742
|
-
)
|
|
733
|
+
self.network_client.find_subnet_pool.return_value = self._subnet_pool
|
|
743
734
|
|
|
744
|
-
self.network_client.find_address_scope =
|
|
745
|
-
|
|
735
|
+
self.network_client.find_address_scope.return_value = (
|
|
736
|
+
self._address_scope
|
|
746
737
|
)
|
|
747
738
|
|
|
748
739
|
# Get the command object to test
|
|
@@ -1079,9 +1070,7 @@ class TestShowSubnetPool(TestSubnetPool):
|
|
|
1079
1070
|
def setUp(self):
|
|
1080
1071
|
super().setUp()
|
|
1081
1072
|
|
|
1082
|
-
self.network_client.find_subnet_pool =
|
|
1083
|
-
return_value=self._subnet_pool
|
|
1084
|
-
)
|
|
1073
|
+
self.network_client.find_subnet_pool.return_value = self._subnet_pool
|
|
1085
1074
|
|
|
1086
1075
|
# Get the command object to test
|
|
1087
1076
|
self.cmd = subnet_pool.ShowSubnetPool(self.app, None)
|
|
@@ -1122,11 +1111,10 @@ class TestUnsetSubnetPool(TestSubnetPool):
|
|
|
1122
1111
|
self._subnetpool = network_fakes.FakeSubnetPool.create_one_subnet_pool(
|
|
1123
1112
|
{'tags': ['green', 'red']}
|
|
1124
1113
|
)
|
|
1125
|
-
self.network_client.find_subnet_pool =
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
self.network_client.
|
|
1129
|
-
self.network_client.set_tags = mock.Mock(return_value=None)
|
|
1114
|
+
self.network_client.find_subnet_pool.return_value = self._subnetpool
|
|
1115
|
+
|
|
1116
|
+
self.network_client.update_subnet_pool.return_value = None
|
|
1117
|
+
self.network_client.set_tags.return_value = None
|
|
1130
1118
|
# Get the command object to test
|
|
1131
1119
|
self.cmd = subnet_pool.UnsetSubnetPool(self.app, None)
|
|
1132
1120
|
|
|
@@ -21,15 +21,6 @@ from osc_lib import exceptions
|
|
|
21
21
|
from osc_lib import utils
|
|
22
22
|
|
|
23
23
|
from openstackclient.tests.unit import utils as test_utils
|
|
24
|
-
from openstackclient.volume import client # noqa
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
# Monkey patch for v1 cinderclient
|
|
28
|
-
# NOTE(dtroyer): Do here because openstackclient.volume.client
|
|
29
|
-
# doesn't do it until the client object is created now.
|
|
30
|
-
volumes.Volume.NAME_ATTR = 'display_name'
|
|
31
|
-
volume_snapshots.Snapshot.NAME_ATTR = 'display_name'
|
|
32
|
-
|
|
33
24
|
|
|
34
25
|
ID = '1after909'
|
|
35
26
|
NAME = 'PhilSpector'
|
|
@@ -42,14 +33,14 @@ class TestFindResourceVolumes(test_utils.TestCase):
|
|
|
42
33
|
api.client = mock.Mock()
|
|
43
34
|
api.client.get = mock.Mock()
|
|
44
35
|
resp = mock.Mock()
|
|
45
|
-
body = {"volumes": [{"id": ID, '
|
|
36
|
+
body = {"volumes": [{"id": ID, 'name': NAME}]}
|
|
46
37
|
api.client.get.side_effect = [Exception("Not found"), (resp, body)]
|
|
47
38
|
self.manager = volumes.VolumeManager(api)
|
|
48
39
|
|
|
49
40
|
def test_find(self):
|
|
50
41
|
result = utils.find_resource(self.manager, NAME)
|
|
51
42
|
self.assertEqual(ID, result.id)
|
|
52
|
-
self.assertEqual(NAME, result.
|
|
43
|
+
self.assertEqual(NAME, result.name)
|
|
53
44
|
|
|
54
45
|
def test_not_find(self):
|
|
55
46
|
self.assertRaises(
|
|
@@ -67,14 +58,14 @@ class TestFindResourceVolumeSnapshots(test_utils.TestCase):
|
|
|
67
58
|
api.client = mock.Mock()
|
|
68
59
|
api.client.get = mock.Mock()
|
|
69
60
|
resp = mock.Mock()
|
|
70
|
-
body = {"snapshots": [{"id": ID, '
|
|
61
|
+
body = {"snapshots": [{"id": ID, 'name': NAME}]}
|
|
71
62
|
api.client.get.side_effect = [Exception("Not found"), (resp, body)]
|
|
72
63
|
self.manager = volume_snapshots.SnapshotManager(api)
|
|
73
64
|
|
|
74
65
|
def test_find(self):
|
|
75
66
|
result = utils.find_resource(self.manager, NAME)
|
|
76
67
|
self.assertEqual(ID, result.id)
|
|
77
|
-
self.assertEqual(NAME, result.
|
|
68
|
+
self.assertEqual(NAME, result.name)
|
|
78
69
|
|
|
79
70
|
def test_not_find(self):
|
|
80
71
|
self.assertRaises(
|