python-openstackclient 7.3.1__py3-none-any.whl → 8.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openstackclient/common/availability_zone.py +3 -6
- openstackclient/common/clientmanager.py +2 -1
- openstackclient/common/envvars.py +57 -0
- openstackclient/common/extension.py +3 -11
- openstackclient/common/limits.py +1 -1
- openstackclient/common/project_cleanup.py +3 -2
- openstackclient/common/quota.py +54 -28
- openstackclient/compute/client.py +2 -5
- openstackclient/compute/v2/agent.py +5 -5
- openstackclient/compute/v2/aggregate.py +17 -15
- openstackclient/compute/v2/console.py +3 -4
- openstackclient/compute/v2/flavor.py +14 -18
- openstackclient/compute/v2/host.py +3 -3
- openstackclient/compute/v2/hypervisor.py +10 -4
- openstackclient/compute/v2/hypervisor_stats.py +1 -1
- openstackclient/compute/v2/keypair.py +8 -10
- openstackclient/compute/v2/server.py +70 -112
- openstackclient/compute/v2/server_backup.py +1 -1
- openstackclient/compute/v2/server_event.py +7 -16
- openstackclient/compute/v2/server_group.py +6 -6
- openstackclient/compute/v2/server_image.py +1 -1
- openstackclient/compute/v2/server_migration.py +6 -6
- openstackclient/compute/v2/server_volume.py +4 -4
- openstackclient/compute/v2/service.py +9 -13
- openstackclient/compute/v2/usage.py +4 -6
- openstackclient/identity/client.py +2 -4
- openstackclient/identity/common.py +16 -17
- openstackclient/identity/v2_0/ec2creds.py +4 -3
- openstackclient/identity/v2_0/endpoint.py +12 -10
- openstackclient/identity/v2_0/project.py +6 -6
- openstackclient/identity/v2_0/role.py +1 -1
- openstackclient/identity/v2_0/service.py +7 -7
- openstackclient/identity/v2_0/user.py +6 -21
- openstackclient/identity/v3/access_rule.py +2 -5
- openstackclient/identity/v3/consumer.py +4 -3
- openstackclient/identity/v3/credential.py +8 -9
- openstackclient/identity/v3/domain.py +1 -1
- openstackclient/identity/v3/ec2creds.py +4 -3
- openstackclient/identity/v3/endpoint.py +104 -88
- openstackclient/identity/v3/endpoint_group.py +1 -1
- openstackclient/identity/v3/group.py +3 -4
- openstackclient/identity/v3/identity_provider.py +1 -2
- openstackclient/identity/v3/limit.py +4 -9
- openstackclient/identity/v3/mapping.py +4 -3
- openstackclient/identity/v3/policy.py +5 -8
- openstackclient/identity/v3/project.py +6 -6
- openstackclient/identity/v3/region.py +2 -5
- openstackclient/identity/v3/registered_limit.py +4 -8
- openstackclient/identity/v3/role.py +15 -16
- openstackclient/identity/v3/service.py +8 -8
- openstackclient/identity/v3/service_provider.py +3 -6
- openstackclient/identity/v3/tag.py +2 -2
- openstackclient/identity/v3/token.py +1 -2
- openstackclient/identity/v3/trust.py +74 -25
- openstackclient/identity/v3/user.py +9 -6
- openstackclient/image/client.py +2 -5
- openstackclient/image/v1/image.py +11 -15
- openstackclient/image/v2/cache.py +2 -4
- openstackclient/image/v2/image.py +30 -37
- openstackclient/image/v2/metadef_namespaces.py +4 -3
- openstackclient/image/v2/metadef_resource_type_association.py +1 -2
- openstackclient/image/v2/metadef_resource_types.py +1 -2
- openstackclient/locale/tr_TR/LC_MESSAGES/openstackclient.po +9 -1370
- openstackclient/network/client.py +4 -10
- openstackclient/network/common.py +16 -12
- openstackclient/network/utils.py +3 -3
- openstackclient/network/v2/address_group.py +5 -9
- openstackclient/network/v2/address_scope.py +2 -3
- openstackclient/network/v2/default_security_group_rule.py +1 -2
- openstackclient/network/v2/floating_ip.py +14 -21
- openstackclient/network/v2/floating_ip_port_forwarding.py +7 -7
- openstackclient/network/v2/ip_availability.py +1 -2
- openstackclient/network/v2/l3_conntrack_helper.py +8 -12
- openstackclient/network/v2/local_ip.py +24 -26
- openstackclient/network/v2/local_ip_association.py +4 -5
- openstackclient/network/v2/ndp_proxy.py +9 -10
- openstackclient/network/v2/network.py +12 -16
- openstackclient/network/v2/network_agent.py +29 -37
- openstackclient/network/v2/network_auto_allocated_topology.py +4 -5
- openstackclient/network/v2/network_flavor.py +1 -1
- openstackclient/network/v2/network_flavor_profile.py +5 -5
- openstackclient/network/v2/network_meter.py +3 -3
- openstackclient/network/v2/network_meter_rule.py +5 -8
- openstackclient/network/v2/network_qos_policy.py +4 -4
- openstackclient/network/v2/network_qos_rule.py +4 -5
- openstackclient/network/v2/network_rbac.py +4 -4
- openstackclient/network/v2/network_segment.py +6 -7
- openstackclient/network/v2/network_segment_range.py +16 -20
- openstackclient/network/v2/network_trunk.py +24 -16
- openstackclient/network/v2/port.py +42 -31
- openstackclient/network/v2/router.py +55 -41
- openstackclient/network/v2/security_group.py +8 -15
- openstackclient/network/v2/security_group_rule.py +9 -10
- openstackclient/network/v2/subnet.py +31 -30
- openstackclient/network/v2/subnet_pool.py +4 -4
- openstackclient/object/client.py +2 -3
- openstackclient/object/v1/container.py +2 -3
- openstackclient/object/v1/object.py +2 -9
- openstackclient/shell.py +22 -5
- openstackclient/tests/functional/base.py +2 -2
- openstackclient/tests/functional/common/test_quota.py +3 -1
- openstackclient/tests/functional/compute/v2/common.py +12 -6
- openstackclient/tests/functional/compute/v2/test_server.py +2 -3
- openstackclient/tests/functional/compute/v2/test_server_event.py +1 -1
- openstackclient/tests/functional/identity/v2/test_user.py +1 -1
- openstackclient/tests/functional/identity/v3/common.py +3 -8
- openstackclient/tests/functional/identity/v3/test_application_credential.py +10 -10
- openstackclient/tests/functional/identity/v3/test_endpoint.py +3 -3
- openstackclient/tests/functional/identity/v3/test_group.py +3 -3
- openstackclient/tests/functional/identity/v3/test_idp.py +3 -7
- openstackclient/tests/functional/identity/v3/test_limit.py +4 -4
- openstackclient/tests/functional/identity/v3/test_project.py +5 -14
- openstackclient/tests/functional/identity/v3/test_region.py +1 -3
- openstackclient/tests/functional/identity/v3/test_registered_limit.py +3 -3
- openstackclient/tests/functional/identity/v3/test_role.py +1 -1
- openstackclient/tests/functional/identity/v3/test_role_assignment.py +13 -31
- openstackclient/tests/functional/identity/v3/test_service_provider.py +3 -7
- openstackclient/tests/functional/identity/v3/test_user.py +8 -8
- openstackclient/tests/functional/network/v2/common.py +7 -3
- openstackclient/tests/functional/network/v2/test_address_group.py +4 -0
- openstackclient/tests/functional/network/v2/test_l3_conntrack_helper.py +15 -11
- openstackclient/tests/functional/network/v2/test_local_ip.py +4 -0
- openstackclient/tests/functional/network/v2/test_network_meter_rule.py +2 -2
- openstackclient/tests/functional/network/v2/test_network_ndp_proxy.py +2 -3
- openstackclient/tests/functional/network/v2/test_network_rbac.py +2 -2
- openstackclient/tests/functional/network/v2/test_network_trunk.py +1 -1
- openstackclient/tests/functional/network/v2/test_port.py +17 -7
- openstackclient/tests/functional/network/v2/test_router.py +42 -0
- openstackclient/tests/functional/network/v2/test_subnet_pool.py +4 -0
- openstackclient/tests/unit/api/test_compute_v2.py +67 -87
- openstackclient/tests/unit/common/test_availability_zone.py +6 -14
- openstackclient/tests/unit/common/test_command.py +1 -1
- openstackclient/tests/unit/common/test_extension.py +5 -7
- openstackclient/tests/unit/common/test_limits.py +1 -1
- openstackclient/tests/unit/common/test_project_cleanup.py +5 -6
- openstackclient/tests/unit/common/test_quota.py +51 -28
- openstackclient/tests/unit/compute/v2/fakes.py +4 -10
- openstackclient/tests/unit/compute/v2/test_agent.py +16 -16
- openstackclient/tests/unit/compute/v2/test_aggregate.py +56 -60
- openstackclient/tests/unit/compute/v2/test_console.py +16 -16
- openstackclient/tests/unit/compute/v2/test_flavor.py +71 -71
- openstackclient/tests/unit/compute/v2/test_host.py +8 -8
- openstackclient/tests/unit/compute/v2/test_hypervisor.py +22 -30
- openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +2 -2
- openstackclient/tests/unit/compute/v2/test_keypair.py +24 -24
- openstackclient/tests/unit/compute/v2/test_server.py +524 -560
- openstackclient/tests/unit/compute/v2/test_server_backup.py +5 -7
- openstackclient/tests/unit/compute/v2/test_server_event.py +16 -18
- openstackclient/tests/unit/compute/v2/test_server_group.py +25 -31
- openstackclient/tests/unit/compute/v2/test_server_image.py +6 -8
- openstackclient/tests/unit/compute/v2/test_server_migration.py +37 -37
- openstackclient/tests/unit/compute/v2/test_server_volume.py +12 -12
- openstackclient/tests/unit/compute/v2/test_service.py +39 -45
- openstackclient/tests/unit/compute/v2/test_usage.py +5 -5
- openstackclient/tests/unit/identity/v2_0/fakes.py +1 -1
- openstackclient/tests/unit/identity/v3/test_access_rule.py +1 -3
- openstackclient/tests/unit/identity/v3/test_application_credential.py +1 -1
- openstackclient/tests/unit/identity/v3/test_credential.py +4 -4
- openstackclient/tests/unit/identity/v3/test_endpoint.py +167 -172
- openstackclient/tests/unit/identity/v3/test_mappings.py +2 -2
- openstackclient/tests/unit/identity/v3/test_trust.py +5 -2
- openstackclient/tests/unit/identity/v3/test_user.py +16 -0
- openstackclient/tests/unit/image/v1/fakes.py +2 -2
- openstackclient/tests/unit/image/v2/test_image.py +39 -1
- openstackclient/tests/unit/integ/cli/test_shell.py +1 -2
- openstackclient/tests/unit/network/test_common.py +2 -2
- openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +8 -14
- openstackclient/tests/unit/network/v2/test_floating_ip_network.py +49 -35
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_compute.py +11 -11
- openstackclient/tests/unit/network/v2/test_network_trunk.py +2 -2
- openstackclient/tests/unit/network/v2/test_port.py +33 -5
- openstackclient/tests/unit/network/v2/test_router.py +120 -7
- openstackclient/tests/unit/network/v2/test_security_group_compute.py +11 -19
- openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +14 -14
- openstackclient/tests/unit/object/v1/test_object_all.py +4 -3
- openstackclient/tests/unit/test_shell.py +16 -13
- openstackclient/tests/unit/volume/v2/test_volume.py +1 -1
- openstackclient/tests/unit/volume/v2/test_volume_transfer_request.py +1 -1
- openstackclient/tests/unit/volume/v3/fakes.py +2 -8
- openstackclient/tests/unit/volume/v3/test_volume.py +1 -1
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +3 -3
- openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +1 -2
- openstackclient/tests/unit/volume/v3/test_volume_transfer_request.py +1 -1
- openstackclient/volume/client.py +1 -3
- openstackclient/volume/v2/consistency_group.py +4 -8
- openstackclient/volume/v2/consistency_group_snapshot.py +1 -2
- openstackclient/volume/v2/qos_specs.py +1 -2
- openstackclient/volume/v2/volume.py +8 -16
- openstackclient/volume/v2/volume_backup.py +6 -7
- openstackclient/volume/v2/volume_snapshot.py +8 -9
- openstackclient/volume/v2/volume_transfer_request.py +0 -3
- openstackclient/volume/v2/volume_type.py +10 -21
- openstackclient/volume/v3/block_storage_cluster.py +3 -3
- openstackclient/volume/v3/block_storage_manage.py +1 -3
- openstackclient/volume/v3/volume.py +18 -19
- openstackclient/volume/v3/volume_attachment.py +3 -2
- openstackclient/volume/v3/volume_backup.py +7 -8
- openstackclient/volume/v3/volume_group.py +2 -1
- openstackclient/volume/v3/volume_group_snapshot.py +2 -1
- openstackclient/volume/v3/volume_snapshot.py +4 -3
- openstackclient/volume/v3/volume_type.py +10 -21
- {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/AUTHORS +4 -0
- {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/METADATA +7 -13
- {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/RECORD +210 -233
- {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/entry_points.txt +0 -41
- python_openstackclient-8.0.0.dist-info/pbr.json +1 -0
- openstackclient/tests/functional/volume/v1/__init__.py +0 -0
- openstackclient/tests/functional/volume/v1/common.py +0 -35
- openstackclient/tests/functional/volume/v1/test_qos.py +0 -100
- openstackclient/tests/functional/volume/v1/test_service.py +0 -76
- openstackclient/tests/functional/volume/v1/test_snapshot.py +0 -232
- openstackclient/tests/functional/volume/v1/test_transfer_request.py +0 -111
- openstackclient/tests/functional/volume/v1/test_volume.py +0 -228
- openstackclient/tests/functional/volume/v1/test_volume_type.py +0 -213
- openstackclient/tests/unit/volume/v1/__init__.py +0 -0
- openstackclient/tests/unit/volume/v1/fakes.py +0 -615
- openstackclient/tests/unit/volume/v1/test_qos_specs.py +0 -471
- openstackclient/tests/unit/volume/v1/test_service.py +0 -295
- openstackclient/tests/unit/volume/v1/test_transfer_request.py +0 -380
- openstackclient/tests/unit/volume/v1/test_type.py +0 -633
- openstackclient/tests/unit/volume/v1/test_volume.py +0 -1447
- openstackclient/tests/unit/volume/v1/test_volume_backup.py +0 -435
- openstackclient/volume/v1/__init__.py +0 -0
- openstackclient/volume/v1/qos_specs.py +0 -377
- openstackclient/volume/v1/service.py +0 -136
- openstackclient/volume/v1/volume.py +0 -734
- openstackclient/volume/v1/volume_backup.py +0 -302
- openstackclient/volume/v1/volume_snapshot.py +0 -433
- openstackclient/volume/v1/volume_transfer_request.py +0 -200
- openstackclient/volume/v1/volume_type.py +0 -520
- python_openstackclient-7.3.1.dist-info/pbr.json +0 -1
- {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/LICENSE +0 -0
- {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/top_level.txt +0 -0
|
@@ -55,7 +55,7 @@ class TestMappingCreate(TestMapping):
|
|
|
55
55
|
mocker = mock.Mock()
|
|
56
56
|
mocker.return_value = identity_fakes.MAPPING_RULES
|
|
57
57
|
with mock.patch(
|
|
58
|
-
"openstackclient.identity.v3.mapping.
|
|
58
|
+
"openstackclient.identity.v3.mapping.CreateMapping._read_rules",
|
|
59
59
|
mocker,
|
|
60
60
|
):
|
|
61
61
|
columns, data = self.cmd.take_action(parsed_args)
|
|
@@ -170,7 +170,7 @@ class TestMappingSet(TestMapping):
|
|
|
170
170
|
mocker = mock.Mock()
|
|
171
171
|
mocker.return_value = identity_fakes.MAPPING_RULES_2
|
|
172
172
|
with mock.patch(
|
|
173
|
-
"openstackclient.identity.v3.mapping.
|
|
173
|
+
"openstackclient.identity.v3.mapping.SetMapping._read_rules",
|
|
174
174
|
mocker,
|
|
175
175
|
):
|
|
176
176
|
result = self.cmd.take_action(parsed_args)
|
|
@@ -70,12 +70,15 @@ class TestTrustCreate(identity_fakes.TestIdentityv3):
|
|
|
70
70
|
# Set expected values
|
|
71
71
|
kwargs = {
|
|
72
72
|
'project_id': self.project.id,
|
|
73
|
-
'roles': [self.role.id],
|
|
73
|
+
'roles': [{'id': self.role.id}],
|
|
74
|
+
'impersonation': False,
|
|
74
75
|
}
|
|
75
76
|
# TrustManager.create(trustee_id, trustor_id, impersonation=,
|
|
76
77
|
# project=, role_names=, expires_at=)
|
|
77
78
|
self.identity_sdk_client.create_trust.assert_called_with(
|
|
78
|
-
|
|
79
|
+
trustor_user_id=self.user.id,
|
|
80
|
+
trustee_user_id=self.user.id,
|
|
81
|
+
**kwargs,
|
|
79
82
|
)
|
|
80
83
|
|
|
81
84
|
collist = (
|
|
@@ -1206,6 +1206,17 @@ class TestUserSet(identity_fakes.TestIdentityv3):
|
|
|
1206
1206
|
self.identity_sdk_client.update_user.assert_called_with(
|
|
1207
1207
|
user=self.user, **kwargs
|
|
1208
1208
|
)
|
|
1209
|
+
self.identity_sdk_client.find_domain.assert_not_called()
|
|
1210
|
+
|
|
1211
|
+
# Set expected values
|
|
1212
|
+
kwargs = {
|
|
1213
|
+
'ignore_missing': False,
|
|
1214
|
+
'domain_id': None,
|
|
1215
|
+
}
|
|
1216
|
+
self.identity_sdk_client.find_project.assert_called_once_with(
|
|
1217
|
+
name_or_id=self.project.id, **kwargs
|
|
1218
|
+
)
|
|
1219
|
+
|
|
1209
1220
|
self.assertIsNone(result)
|
|
1210
1221
|
|
|
1211
1222
|
def test_user_set_project_domain(self):
|
|
@@ -1238,6 +1249,11 @@ class TestUserSet(identity_fakes.TestIdentityv3):
|
|
|
1238
1249
|
self.identity_sdk_client.update_user.assert_called_with(
|
|
1239
1250
|
user=self.user, **kwargs
|
|
1240
1251
|
)
|
|
1252
|
+
|
|
1253
|
+
self.identity_sdk_client.find_domain.assert_called_once_with(
|
|
1254
|
+
name_or_id=self.project.domain_id, ignore_missing=False
|
|
1255
|
+
)
|
|
1256
|
+
|
|
1241
1257
|
self.assertIsNone(result)
|
|
1242
1258
|
|
|
1243
1259
|
def test_user_set_enable(self):
|
|
@@ -20,7 +20,7 @@ from openstack.image.v1 import image
|
|
|
20
20
|
|
|
21
21
|
from openstackclient.tests.unit import fakes
|
|
22
22
|
from openstackclient.tests.unit import utils
|
|
23
|
-
from openstackclient.tests.unit.volume.
|
|
23
|
+
from openstackclient.tests.unit.volume.v2 import fakes as volume_fakes
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
class FakeClientMixin:
|
|
@@ -35,7 +35,7 @@ class TestImagev1(FakeClientMixin, utils.TestCommand):
|
|
|
35
35
|
def setUp(self):
|
|
36
36
|
super().setUp()
|
|
37
37
|
|
|
38
|
-
self.app.client_manager.volume = volume_fakes.
|
|
38
|
+
self.app.client_manager.volume = volume_fakes.FakeVolumeClient(
|
|
39
39
|
endpoint=fakes.AUTH_URL,
|
|
40
40
|
token=fakes.AUTH_TOKEN,
|
|
41
41
|
)
|
|
@@ -346,7 +346,13 @@ class TestImageCreate(TestImage):
|
|
|
346
346
|
columns, data = self.cmd.take_action(parsed_args)
|
|
347
347
|
|
|
348
348
|
self.volumes_mock.upload_to_image.assert_called_with(
|
|
349
|
-
fake_vol_id,
|
|
349
|
+
fake_vol_id,
|
|
350
|
+
False,
|
|
351
|
+
self.new_image.name,
|
|
352
|
+
'bare',
|
|
353
|
+
'raw',
|
|
354
|
+
visibility=None,
|
|
355
|
+
protected=None,
|
|
350
356
|
)
|
|
351
357
|
|
|
352
358
|
@mock.patch('osc_lib.utils.find_resource')
|
|
@@ -2092,6 +2098,38 @@ class TestImageImport(TestImage):
|
|
|
2092
2098
|
all_stores_must_succeed=False,
|
|
2093
2099
|
)
|
|
2094
2100
|
|
|
2101
|
+
def test_import_image__copy_image_disallow_failure(self):
|
|
2102
|
+
self.image.status = 'active'
|
|
2103
|
+
arglist = [
|
|
2104
|
+
self.image.name,
|
|
2105
|
+
'--method',
|
|
2106
|
+
'copy-image',
|
|
2107
|
+
'--store',
|
|
2108
|
+
'fast',
|
|
2109
|
+
'--disallow-failure',
|
|
2110
|
+
]
|
|
2111
|
+
verifylist = [
|
|
2112
|
+
('image', self.image.name),
|
|
2113
|
+
('import_method', 'copy-image'),
|
|
2114
|
+
('stores', ['fast']),
|
|
2115
|
+
('allow_failure', False),
|
|
2116
|
+
]
|
|
2117
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
2118
|
+
|
|
2119
|
+
self.cmd.take_action(parsed_args)
|
|
2120
|
+
|
|
2121
|
+
self.image_client.import_image.assert_called_once_with(
|
|
2122
|
+
self.image,
|
|
2123
|
+
method='copy-image',
|
|
2124
|
+
uri=None,
|
|
2125
|
+
remote_region=None,
|
|
2126
|
+
remote_image_id=None,
|
|
2127
|
+
remote_service_interface=None,
|
|
2128
|
+
stores=['fast'],
|
|
2129
|
+
all_stores=None,
|
|
2130
|
+
all_stores_must_succeed=True,
|
|
2131
|
+
)
|
|
2132
|
+
|
|
2095
2133
|
def test_import_image__glance_download(self):
|
|
2096
2134
|
arglist = [
|
|
2097
2135
|
self.image.name,
|
|
@@ -361,8 +361,7 @@ class TestIntegShellCliPrecedence(test_base.TestInteg):
|
|
|
361
361
|
|
|
362
362
|
_shell = shell.OpenStackShell()
|
|
363
363
|
_shell.run(
|
|
364
|
-
"--os-username zarquon --os-password qaz "
|
|
365
|
-
"extension list".split(),
|
|
364
|
+
"--os-username zarquon --os-password qaz extension list".split(),
|
|
366
365
|
)
|
|
367
366
|
|
|
368
367
|
# Check general calls
|
|
@@ -132,8 +132,8 @@ class TestNetworkAndCompute(utils.TestCommand):
|
|
|
132
132
|
return_value='take_action_network'
|
|
133
133
|
)
|
|
134
134
|
|
|
135
|
-
self.app.client_manager.
|
|
136
|
-
self.compute_client = self.app.client_manager.
|
|
135
|
+
self.app.client_manager.compute = mock.Mock()
|
|
136
|
+
self.compute_client = self.app.client_manager.compute
|
|
137
137
|
self.compute_client.compute_action = mock.Mock(
|
|
138
138
|
return_value='take_action_compute'
|
|
139
139
|
)
|
|
@@ -73,7 +73,7 @@ class TestCreateFloatingIPCompute(compute_fakes.TestComputev2):
|
|
|
73
73
|
columns, data = self.cmd.take_action(parsed_args)
|
|
74
74
|
|
|
75
75
|
fip_mock.assert_called_once_with(
|
|
76
|
-
self.
|
|
76
|
+
self.compute_client, self._floating_ip['pool']
|
|
77
77
|
)
|
|
78
78
|
self.assertEqual(self.columns, columns)
|
|
79
79
|
self.assertEqual(self.data, data)
|
|
@@ -103,7 +103,7 @@ class TestDeleteFloatingIPCompute(compute_fakes.TestComputev2):
|
|
|
103
103
|
result = self.cmd.take_action(parsed_args)
|
|
104
104
|
|
|
105
105
|
fip_mock.assert_called_once_with(
|
|
106
|
-
self.
|
|
106
|
+
self.compute_client, self._floating_ips[0]['id']
|
|
107
107
|
)
|
|
108
108
|
self.assertIsNone(result)
|
|
109
109
|
|
|
@@ -122,12 +122,8 @@ class TestDeleteFloatingIPCompute(compute_fakes.TestComputev2):
|
|
|
122
122
|
|
|
123
123
|
fip_mock.assert_has_calls(
|
|
124
124
|
[
|
|
125
|
-
mock.call(
|
|
126
|
-
|
|
127
|
-
),
|
|
128
|
-
mock.call(
|
|
129
|
-
self.compute_sdk_client, self._floating_ips[1]['id']
|
|
130
|
-
),
|
|
125
|
+
mock.call(self.compute_client, self._floating_ips[0]['id']),
|
|
126
|
+
mock.call(self.compute_client, self._floating_ips[1]['id']),
|
|
131
127
|
]
|
|
132
128
|
)
|
|
133
129
|
self.assertIsNone(result)
|
|
@@ -157,11 +153,9 @@ class TestDeleteFloatingIPCompute(compute_fakes.TestComputev2):
|
|
|
157
153
|
self.assertEqual('1 of 2 floating_ips failed to delete.', str(e))
|
|
158
154
|
|
|
159
155
|
fip_mock.assert_any_call(
|
|
160
|
-
self.
|
|
161
|
-
)
|
|
162
|
-
fip_mock.assert_any_call(
|
|
163
|
-
self.compute_sdk_client, 'unexist_floating_ip'
|
|
156
|
+
self.compute_client, self._floating_ips[0]['id']
|
|
164
157
|
)
|
|
158
|
+
fip_mock.assert_any_call(self.compute_client, 'unexist_floating_ip')
|
|
165
159
|
|
|
166
160
|
|
|
167
161
|
@mock.patch.object(compute_v2, 'list_floating_ips')
|
|
@@ -203,7 +197,7 @@ class TestListFloatingIPCompute(compute_fakes.TestComputev2):
|
|
|
203
197
|
|
|
204
198
|
columns, data = self.cmd.take_action(parsed_args)
|
|
205
199
|
|
|
206
|
-
fip_mock.assert_called_once_with(self.
|
|
200
|
+
fip_mock.assert_called_once_with(self.compute_client)
|
|
207
201
|
self.assertEqual(self.columns, columns)
|
|
208
202
|
self.assertEqual(self.data, list(data))
|
|
209
203
|
|
|
@@ -248,7 +242,7 @@ class TestShowFloatingIPCompute(compute_fakes.TestComputev2):
|
|
|
248
242
|
columns, data = self.cmd.take_action(parsed_args)
|
|
249
243
|
|
|
250
244
|
fip_mock.assert_called_once_with(
|
|
251
|
-
self.
|
|
245
|
+
self.compute_client, self._floating_ip['id']
|
|
252
246
|
)
|
|
253
247
|
self.assertEqual(self.columns, columns)
|
|
254
248
|
self.assertEqual(self.data, data)
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
from unittest import mock
|
|
15
15
|
from unittest.mock import call
|
|
16
16
|
|
|
17
|
+
from openstack.network.v2 import floating_ip as _floating_ip
|
|
18
|
+
from openstack.test import fakes as sdk_fakes
|
|
19
|
+
from osc_lib.cli import format_columns
|
|
17
20
|
from osc_lib import exceptions
|
|
18
21
|
|
|
19
22
|
from openstackclient.network.v2 import floating_ip as fip
|
|
@@ -706,46 +709,57 @@ class TestListFloatingIPNetwork(TestFloatingIPNetwork):
|
|
|
706
709
|
|
|
707
710
|
|
|
708
711
|
class TestShowFloatingIPNetwork(TestFloatingIPNetwork):
|
|
709
|
-
# The floating ip to display.
|
|
710
|
-
floating_ip = network_fakes.FakeFloatingIP.create_one_floating_ip()
|
|
711
|
-
|
|
712
|
-
columns = (
|
|
713
|
-
'description',
|
|
714
|
-
'dns_domain',
|
|
715
|
-
'dns_name',
|
|
716
|
-
'fixed_ip_address',
|
|
717
|
-
'floating_ip_address',
|
|
718
|
-
'floating_network_id',
|
|
719
|
-
'id',
|
|
720
|
-
'port_id',
|
|
721
|
-
'project_id',
|
|
722
|
-
'qos_policy_id',
|
|
723
|
-
'router_id',
|
|
724
|
-
'status',
|
|
725
|
-
'tags',
|
|
726
|
-
)
|
|
727
|
-
|
|
728
|
-
data = (
|
|
729
|
-
floating_ip.description,
|
|
730
|
-
floating_ip.dns_domain,
|
|
731
|
-
floating_ip.dns_name,
|
|
732
|
-
floating_ip.fixed_ip_address,
|
|
733
|
-
floating_ip.floating_ip_address,
|
|
734
|
-
floating_ip.floating_network_id,
|
|
735
|
-
floating_ip.id,
|
|
736
|
-
floating_ip.port_id,
|
|
737
|
-
floating_ip.project_id,
|
|
738
|
-
floating_ip.qos_policy_id,
|
|
739
|
-
floating_ip.router_id,
|
|
740
|
-
floating_ip.status,
|
|
741
|
-
floating_ip.tags,
|
|
742
|
-
)
|
|
743
|
-
|
|
744
712
|
def setUp(self):
|
|
745
713
|
super().setUp()
|
|
746
714
|
|
|
715
|
+
self.floating_ip = sdk_fakes.generate_fake_resource(
|
|
716
|
+
_floating_ip.FloatingIP
|
|
717
|
+
)
|
|
747
718
|
self.network_client.find_ip = mock.Mock(return_value=self.floating_ip)
|
|
748
719
|
|
|
720
|
+
self.columns = (
|
|
721
|
+
'created_at',
|
|
722
|
+
'description',
|
|
723
|
+
'dns_domain',
|
|
724
|
+
'dns_name',
|
|
725
|
+
'fixed_ip_address',
|
|
726
|
+
'floating_ip_address',
|
|
727
|
+
'floating_network_id',
|
|
728
|
+
'id',
|
|
729
|
+
'name',
|
|
730
|
+
'port_details',
|
|
731
|
+
'port_id',
|
|
732
|
+
'project_id',
|
|
733
|
+
'qos_policy_id',
|
|
734
|
+
'revision_number',
|
|
735
|
+
'router_id',
|
|
736
|
+
'status',
|
|
737
|
+
'subnet_id',
|
|
738
|
+
'tags',
|
|
739
|
+
'updated_at',
|
|
740
|
+
)
|
|
741
|
+
self.data = (
|
|
742
|
+
self.floating_ip.created_at,
|
|
743
|
+
self.floating_ip.description,
|
|
744
|
+
self.floating_ip.dns_domain,
|
|
745
|
+
self.floating_ip.dns_name,
|
|
746
|
+
self.floating_ip.fixed_ip_address,
|
|
747
|
+
self.floating_ip.floating_ip_address,
|
|
748
|
+
self.floating_ip.floating_network_id,
|
|
749
|
+
self.floating_ip.id,
|
|
750
|
+
self.floating_ip.name,
|
|
751
|
+
format_columns.DictColumn(self.floating_ip.port_details),
|
|
752
|
+
self.floating_ip.port_id,
|
|
753
|
+
self.floating_ip.project_id,
|
|
754
|
+
self.floating_ip.qos_policy_id,
|
|
755
|
+
self.floating_ip.revision_number,
|
|
756
|
+
self.floating_ip.router_id,
|
|
757
|
+
self.floating_ip.status,
|
|
758
|
+
self.floating_ip.subnet_id,
|
|
759
|
+
self.floating_ip.tags,
|
|
760
|
+
self.floating_ip.updated_at,
|
|
761
|
+
)
|
|
762
|
+
|
|
749
763
|
# Get the command object to test
|
|
750
764
|
self.cmd = fip.ShowFloatingIP(self.app, None)
|
|
751
765
|
|
|
@@ -44,6 +44,6 @@ class TestListFloatingIPPoolCompute(compute_fakes.TestComputev2):
|
|
|
44
44
|
|
|
45
45
|
columns, data = self.cmd.take_action(parsed_args)
|
|
46
46
|
|
|
47
|
-
fipp_mock.assert_called_once_with(self.
|
|
47
|
+
fipp_mock.assert_called_once_with(self.compute_client)
|
|
48
48
|
self.assertEqual(self.columns, columns)
|
|
49
49
|
self.assertEqual(self.data, list(data))
|
|
@@ -148,7 +148,7 @@ class TestCreateNetworkCompute(compute_fakes.TestComputev2):
|
|
|
148
148
|
columns, data = self.cmd.take_action(parsed_args)
|
|
149
149
|
|
|
150
150
|
net_mock.assert_called_once_with(
|
|
151
|
-
self.
|
|
151
|
+
self.compute_client,
|
|
152
152
|
subnet=self._network['cidr'],
|
|
153
153
|
name=self._network['label'],
|
|
154
154
|
)
|
|
@@ -182,7 +182,7 @@ class TestDeleteNetworkCompute(compute_fakes.TestComputev2):
|
|
|
182
182
|
result = self.cmd.take_action(parsed_args)
|
|
183
183
|
|
|
184
184
|
delete_net_mock.assert_called_once_with(
|
|
185
|
-
self.
|
|
185
|
+
self.compute_client,
|
|
186
186
|
self._networks[0]['id'],
|
|
187
187
|
)
|
|
188
188
|
self.assertIsNone(result)
|
|
@@ -203,8 +203,8 @@ class TestDeleteNetworkCompute(compute_fakes.TestComputev2):
|
|
|
203
203
|
|
|
204
204
|
delete_net_mock.assert_has_calls(
|
|
205
205
|
[
|
|
206
|
-
mock.call(self.
|
|
207
|
-
mock.call(self.
|
|
206
|
+
mock.call(self.compute_client, self._networks[0]['id']),
|
|
207
|
+
mock.call(self.compute_client, self._networks[1]['id']),
|
|
208
208
|
]
|
|
209
209
|
)
|
|
210
210
|
self.assertIsNone(result)
|
|
@@ -238,15 +238,15 @@ class TestDeleteNetworkCompute(compute_fakes.TestComputev2):
|
|
|
238
238
|
|
|
239
239
|
find_net_mock.assert_has_calls(
|
|
240
240
|
[
|
|
241
|
-
mock.call(self.
|
|
242
|
-
mock.call(self.
|
|
243
|
-
mock.call(self.
|
|
241
|
+
mock.call(self.compute_client, self._networks[0]['id']),
|
|
242
|
+
mock.call(self.compute_client, 'xxxx-yyyy-zzzz'),
|
|
243
|
+
mock.call(self.compute_client, self._networks[1]['id']),
|
|
244
244
|
]
|
|
245
245
|
)
|
|
246
246
|
delete_net_mock.assert_has_calls(
|
|
247
247
|
[
|
|
248
|
-
mock.call(self.
|
|
249
|
-
mock.call(self.
|
|
248
|
+
mock.call(self.compute_client, self._networks[0]['id']),
|
|
249
|
+
mock.call(self.compute_client, self._networks[1]['id']),
|
|
250
250
|
]
|
|
251
251
|
)
|
|
252
252
|
|
|
@@ -286,7 +286,7 @@ class TestListNetworkCompute(compute_fakes.TestComputev2):
|
|
|
286
286
|
|
|
287
287
|
columns, data = self.cmd.take_action(parsed_args)
|
|
288
288
|
|
|
289
|
-
net_mock.assert_called_once_with(self.
|
|
289
|
+
net_mock.assert_called_once_with(self.compute_client)
|
|
290
290
|
self.assertEqual(self.columns, columns)
|
|
291
291
|
self.assertEqual(self.data, list(data))
|
|
292
292
|
|
|
@@ -398,7 +398,7 @@ class TestShowNetworkCompute(compute_fakes.TestComputev2):
|
|
|
398
398
|
columns, data = self.cmd.take_action(parsed_args)
|
|
399
399
|
|
|
400
400
|
net_mock.assert_called_once_with(
|
|
401
|
-
self.
|
|
401
|
+
self.compute_client, self._network['label']
|
|
402
402
|
)
|
|
403
403
|
self.assertEqual(self.columns, columns)
|
|
404
404
|
self.assertEqual(self.data, data)
|
|
@@ -263,7 +263,7 @@ class TestCreateNetworkTrunk(TestNetworkTrunk):
|
|
|
263
263
|
'--parent-port',
|
|
264
264
|
self.new_trunk.port_id,
|
|
265
265
|
'--subport',
|
|
266
|
-
'segmentation-type={seg_type},
|
|
266
|
+
'segmentation-type={seg_type},segmentation-id={seg_id}'.format(
|
|
267
267
|
seg_id=subport['segmentation_id'],
|
|
268
268
|
seg_type=subport['segmentation_type'],
|
|
269
269
|
),
|
|
@@ -727,7 +727,7 @@ class TestSetNetworkTrunk(TestNetworkTrunk):
|
|
|
727
727
|
subport = self._trunk['sub_ports'][0]
|
|
728
728
|
arglist = [
|
|
729
729
|
'--subport',
|
|
730
|
-
'segmentation-type={seg_type},
|
|
730
|
+
'segmentation-type={seg_type},segmentation-id={seg_id}'.format(
|
|
731
731
|
seg_id=subport['segmentation_id'],
|
|
732
732
|
seg_type=subport['segmentation_type'],
|
|
733
733
|
),
|
|
@@ -807,8 +807,7 @@ class TestCreatePort(TestPort):
|
|
|
807
807
|
extra_dhcp_options = [
|
|
808
808
|
{
|
|
809
809
|
'opt_name': 'classless-static-route',
|
|
810
|
-
'opt_value': '169.254.169.254/32,22.2.0.2,'
|
|
811
|
-
'0.0.0.0/0,22.2.0.1',
|
|
810
|
+
'opt_value': '169.254.169.254/32,22.2.0.2,0.0.0.0/0,22.2.0.1',
|
|
812
811
|
'ip_version': '4',
|
|
813
812
|
},
|
|
814
813
|
{
|
|
@@ -826,7 +825,7 @@ class TestCreatePort(TestPort):
|
|
|
826
825
|
'0.0.0.0/0,22.2.0.1,'
|
|
827
826
|
'ip-version=4',
|
|
828
827
|
'--extra-dhcp-option',
|
|
829
|
-
'name=dns-server,value=240C::6666,
|
|
828
|
+
'name=dns-server,value=240C::6666,ip-version=6',
|
|
830
829
|
'test-port',
|
|
831
830
|
]
|
|
832
831
|
|
|
@@ -1379,7 +1378,7 @@ class TestListPort(compute_fakes.FakeClientMixin, TestPort):
|
|
|
1379
1378
|
|
|
1380
1379
|
def test_port_list_with_server_option(self):
|
|
1381
1380
|
fake_server = compute_fakes.create_one_sdk_server()
|
|
1382
|
-
self.
|
|
1381
|
+
self.compute_client.find_server.return_value = fake_server
|
|
1383
1382
|
|
|
1384
1383
|
arglist = [
|
|
1385
1384
|
'--server',
|
|
@@ -1394,7 +1393,7 @@ class TestListPort(compute_fakes.FakeClientMixin, TestPort):
|
|
|
1394
1393
|
self.network_client.ports.assert_called_once_with(
|
|
1395
1394
|
device_id=fake_server.id, fields=LIST_FIELDS_TO_RETRIEVE
|
|
1396
1395
|
)
|
|
1397
|
-
self.
|
|
1396
|
+
self.compute_client.find_server.aassert_called_once_with(
|
|
1398
1397
|
mock.ANY, 'fake-server-name'
|
|
1399
1398
|
)
|
|
1400
1399
|
self.assertEqual(self.columns, columns)
|
|
@@ -2633,6 +2632,35 @@ class TestSetPort(TestPort):
|
|
|
2633
2632
|
def test_set_trusted_false(self):
|
|
2634
2633
|
self._test_set_trusted_field(False)
|
|
2635
2634
|
|
|
2635
|
+
def _test_set_uplink_status_propagation(self, uspropagation):
|
|
2636
|
+
arglist = [self._port.id]
|
|
2637
|
+
if uspropagation:
|
|
2638
|
+
arglist += ['--enable-uplink-status-propagation']
|
|
2639
|
+
else:
|
|
2640
|
+
arglist += ['--disable-uplink-status-propagation']
|
|
2641
|
+
|
|
2642
|
+
verifylist = [
|
|
2643
|
+
('port', self._port.id),
|
|
2644
|
+
]
|
|
2645
|
+
if uspropagation:
|
|
2646
|
+
verifylist.append(('enable_uplink_status_propagation', True))
|
|
2647
|
+
else:
|
|
2648
|
+
verifylist.append(('enable_uplink_status_propagation', False))
|
|
2649
|
+
|
|
2650
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
2651
|
+
|
|
2652
|
+
result = self.cmd.take_action(parsed_args)
|
|
2653
|
+
self.network_client.update_port.assert_called_once_with(
|
|
2654
|
+
self._port, **{'propagate_uplink_status': uspropagation}
|
|
2655
|
+
)
|
|
2656
|
+
self.assertIsNone(result)
|
|
2657
|
+
|
|
2658
|
+
def test_set_uplink_status_propagation_true(self):
|
|
2659
|
+
self._test_set_uplink_status_propagation(True)
|
|
2660
|
+
|
|
2661
|
+
def test_set_uplink_status_propagation_false(self):
|
|
2662
|
+
self._test_set_uplink_status_propagation(False)
|
|
2663
|
+
|
|
2636
2664
|
|
|
2637
2665
|
class TestShowPort(TestPort):
|
|
2638
2666
|
# The port to show.
|
|
@@ -384,7 +384,7 @@ class TestCreateRouter(TestRouter):
|
|
|
384
384
|
def test_create_with_no_tag(self):
|
|
385
385
|
self._test_create_with_tag(add_tags=False)
|
|
386
386
|
|
|
387
|
-
def
|
|
387
|
+
def test_create_with_flavor_id_id(self):
|
|
388
388
|
_flavor = network_fakes.create_one_network_flavor()
|
|
389
389
|
self.network_client.find_flavor = mock.Mock(return_value=_flavor)
|
|
390
390
|
arglist = [
|
|
@@ -392,7 +392,6 @@ class TestCreateRouter(TestRouter):
|
|
|
392
392
|
'--flavor-id',
|
|
393
393
|
_flavor.id,
|
|
394
394
|
]
|
|
395
|
-
arglist_with_name = [self.new_router.name, '--flavor-id', _flavor.name]
|
|
396
395
|
verifylist = [
|
|
397
396
|
('name', self.new_router.name),
|
|
398
397
|
('enable', True),
|
|
@@ -412,18 +411,69 @@ class TestCreateRouter(TestRouter):
|
|
|
412
411
|
self.assertEqual(self.columns, columns)
|
|
413
412
|
self.assertCountEqual(self.data, data)
|
|
414
413
|
|
|
415
|
-
|
|
416
|
-
|
|
414
|
+
def test_create_with_flavor_id_name(self):
|
|
415
|
+
_flavor = network_fakes.create_one_network_flavor()
|
|
416
|
+
self.network_client.find_flavor = mock.Mock(return_value=_flavor)
|
|
417
|
+
arglist = [self.new_router.name, '--flavor-id', _flavor.name]
|
|
418
|
+
verifylist = [
|
|
417
419
|
('name', self.new_router.name),
|
|
418
420
|
('enable', True),
|
|
419
421
|
('distributed', False),
|
|
420
422
|
('ha', False),
|
|
421
423
|
('flavor_id', _flavor.name),
|
|
422
424
|
]
|
|
423
|
-
|
|
424
|
-
|
|
425
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
426
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
427
|
+
self.network_client.create_router.assert_called_once_with(
|
|
428
|
+
**{
|
|
429
|
+
'admin_state_up': True,
|
|
430
|
+
'name': self.new_router.name,
|
|
431
|
+
'flavor_id': _flavor.id,
|
|
432
|
+
}
|
|
425
433
|
)
|
|
426
|
-
columns,
|
|
434
|
+
self.assertEqual(self.columns, columns)
|
|
435
|
+
self.assertCountEqual(self.data, data)
|
|
436
|
+
|
|
437
|
+
def test_create_with_flavor_id(self):
|
|
438
|
+
_flavor = network_fakes.create_one_network_flavor()
|
|
439
|
+
self.network_client.find_flavor = mock.Mock(return_value=_flavor)
|
|
440
|
+
arglist = [
|
|
441
|
+
self.new_router.name,
|
|
442
|
+
'--flavor',
|
|
443
|
+
_flavor.id,
|
|
444
|
+
]
|
|
445
|
+
verifylist = [
|
|
446
|
+
('name', self.new_router.name),
|
|
447
|
+
('enable', True),
|
|
448
|
+
('distributed', False),
|
|
449
|
+
('ha', False),
|
|
450
|
+
('flavor', _flavor.id),
|
|
451
|
+
]
|
|
452
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
453
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
454
|
+
self.network_client.create_router.assert_called_once_with(
|
|
455
|
+
**{
|
|
456
|
+
'admin_state_up': True,
|
|
457
|
+
'name': self.new_router.name,
|
|
458
|
+
'flavor_id': _flavor.id,
|
|
459
|
+
}
|
|
460
|
+
)
|
|
461
|
+
self.assertEqual(self.columns, columns)
|
|
462
|
+
self.assertCountEqual(self.data, data)
|
|
463
|
+
|
|
464
|
+
def test_create_with_flavor_name(self):
|
|
465
|
+
_flavor = network_fakes.create_one_network_flavor()
|
|
466
|
+
self.network_client.find_flavor = mock.Mock(return_value=_flavor)
|
|
467
|
+
arglist = [self.new_router.name, '--flavor', _flavor.name]
|
|
468
|
+
verifylist = [
|
|
469
|
+
('name', self.new_router.name),
|
|
470
|
+
('enable', True),
|
|
471
|
+
('distributed', False),
|
|
472
|
+
('ha', False),
|
|
473
|
+
('flavor', _flavor.name),
|
|
474
|
+
]
|
|
475
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
476
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
427
477
|
self.network_client.create_router.assert_called_once_with(
|
|
428
478
|
**{
|
|
429
479
|
'admin_state_up': True,
|
|
@@ -502,6 +552,69 @@ class TestCreateRouter(TestRouter):
|
|
|
502
552
|
parsed_args,
|
|
503
553
|
)
|
|
504
554
|
|
|
555
|
+
def test_create_with_qos_policy(self):
|
|
556
|
+
_network = network_fakes.create_one_network()
|
|
557
|
+
self.network_client.find_network = mock.Mock(return_value=_network)
|
|
558
|
+
_qos_policy = (
|
|
559
|
+
network_fakes.FakeNetworkQosPolicy.create_one_qos_policy()
|
|
560
|
+
)
|
|
561
|
+
self.network_client.find_qos_policy = mock.Mock(
|
|
562
|
+
return_value=_qos_policy
|
|
563
|
+
)
|
|
564
|
+
arglist = [
|
|
565
|
+
self.new_router.name,
|
|
566
|
+
'--external-gateway',
|
|
567
|
+
_network.id,
|
|
568
|
+
'--qos-policy',
|
|
569
|
+
_qos_policy.id,
|
|
570
|
+
]
|
|
571
|
+
verifylist = [
|
|
572
|
+
('name', self.new_router.name),
|
|
573
|
+
('enable', True),
|
|
574
|
+
('distributed', False),
|
|
575
|
+
('ha', False),
|
|
576
|
+
('qos_policy', _qos_policy.id),
|
|
577
|
+
('external_gateways', [_network.id]),
|
|
578
|
+
]
|
|
579
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
580
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
581
|
+
gw_info = {'network_id': _network.id, 'qos_policy_id': _qos_policy.id}
|
|
582
|
+
self.network_client.create_router.assert_called_once_with(
|
|
583
|
+
**{
|
|
584
|
+
'admin_state_up': True,
|
|
585
|
+
'name': self.new_router.name,
|
|
586
|
+
**{'external_gateway_info': gw_info},
|
|
587
|
+
}
|
|
588
|
+
)
|
|
589
|
+
self.assertEqual(self.columns, columns)
|
|
590
|
+
self.assertCountEqual(self.data, data)
|
|
591
|
+
|
|
592
|
+
def test_create_with_qos_policy_no_external_gateway(self):
|
|
593
|
+
_qos_policy = (
|
|
594
|
+
network_fakes.FakeNetworkQosPolicy.create_one_qos_policy()
|
|
595
|
+
)
|
|
596
|
+
self.network_client.find_qos_policy = mock.Mock(
|
|
597
|
+
return_value=_qos_policy
|
|
598
|
+
)
|
|
599
|
+
arglist = [
|
|
600
|
+
self.new_router.name,
|
|
601
|
+
'--qos-policy',
|
|
602
|
+
_qos_policy.id,
|
|
603
|
+
]
|
|
604
|
+
verifylist = [
|
|
605
|
+
('name', self.new_router.name),
|
|
606
|
+
('enable', True),
|
|
607
|
+
('distributed', False),
|
|
608
|
+
('ha', False),
|
|
609
|
+
('qos_policy', _qos_policy.id),
|
|
610
|
+
]
|
|
611
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
612
|
+
self.assertRaises(
|
|
613
|
+
exceptions.CommandError,
|
|
614
|
+
self.cmd.take_action,
|
|
615
|
+
parsed_args,
|
|
616
|
+
)
|
|
617
|
+
|
|
505
618
|
|
|
506
619
|
class TestDeleteRouter(TestRouter):
|
|
507
620
|
# The routers to delete.
|