python-openstackclient 8.3.0__py3-none-any.whl → 10.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openstackclient/__init__.py +2 -6
- openstackclient/api/api.py +41 -23
- openstackclient/api/compute_v2.py +44 -25
- openstackclient/api/object_store_v1.py +75 -97
- openstackclient/api/volume_v2.py +2 -1
- openstackclient/api/volume_v3.py +2 -1
- openstackclient/common/availability_zone.py +58 -42
- openstackclient/common/clientmanager.py +56 -29
- openstackclient/common/configuration.py +10 -3
- openstackclient/common/envvars.py +2 -2
- openstackclient/common/extension.py +14 -5
- openstackclient/common/limits.py +10 -5
- openstackclient/common/module.py +14 -6
- openstackclient/common/pagination.py +8 -2
- openstackclient/common/progressbar.py +7 -6
- openstackclient/common/project_cleanup.py +13 -7
- openstackclient/common/quota.py +126 -114
- openstackclient/common/versions.py +8 -2
- openstackclient/compute/client.py +7 -3
- openstackclient/compute/v2/agent.py +17 -10
- openstackclient/compute/v2/aggregate.py +36 -22
- openstackclient/compute/v2/console.py +14 -8
- openstackclient/compute/v2/console_connection.py +11 -3
- openstackclient/compute/v2/flavor.py +39 -21
- openstackclient/compute/v2/host.py +14 -6
- openstackclient/compute/v2/hypervisor.py +14 -5
- openstackclient/compute/v2/hypervisor_stats.py +10 -2
- openstackclient/compute/v2/keypair.py +29 -14
- openstackclient/compute/v2/server.py +251 -171
- openstackclient/compute/v2/server_backup.py +10 -4
- openstackclient/compute/v2/server_event.py +21 -12
- openstackclient/compute/v2/server_group.py +21 -11
- openstackclient/compute/v2/server_image.py +19 -10
- openstackclient/compute/v2/server_migration.py +24 -10
- openstackclient/compute/v2/server_share.py +274 -0
- openstackclient/compute/v2/server_volume.py +10 -4
- openstackclient/compute/v2/service.py +14 -7
- openstackclient/compute/v2/usage.py +26 -21
- openstackclient/identity/client.py +8 -3
- openstackclient/identity/common.py +103 -41
- openstackclient/identity/v2_0/catalog.py +14 -7
- openstackclient/identity/v2_0/ec2creds.py +21 -10
- openstackclient/identity/v2_0/endpoint.py +23 -11
- openstackclient/identity/v2_0/project.py +25 -14
- openstackclient/identity/v2_0/role.py +28 -14
- openstackclient/identity/v2_0/role_assignment.py +9 -3
- openstackclient/identity/v2_0/service.py +26 -12
- openstackclient/identity/v2_0/token.py +12 -5
- openstackclient/identity/v2_0/user.py +26 -15
- openstackclient/identity/v3/access_rule.py +26 -12
- openstackclient/identity/v3/application_credential.py +59 -24
- openstackclient/identity/v3/catalog.py +14 -7
- openstackclient/identity/v3/consumer.py +22 -11
- openstackclient/identity/v3/credential.py +36 -16
- openstackclient/identity/v3/domain.py +37 -18
- openstackclient/identity/v3/ec2creds.py +25 -12
- openstackclient/identity/v3/endpoint.py +42 -20
- openstackclient/identity/v3/endpoint_group.py +28 -17
- openstackclient/identity/v3/federation_protocol.py +71 -50
- openstackclient/identity/v3/group.py +55 -32
- openstackclient/identity/v3/identity_provider.py +92 -57
- openstackclient/identity/v3/implied_role.py +21 -9
- openstackclient/identity/v3/limit.py +115 -92
- openstackclient/identity/v3/mapping.py +26 -13
- openstackclient/identity/v3/policy.py +23 -12
- openstackclient/identity/v3/project.py +211 -122
- openstackclient/identity/v3/region.py +36 -16
- openstackclient/identity/v3/registered_limit.py +116 -109
- openstackclient/identity/v3/role.py +61 -31
- openstackclient/identity/v3/role_assignment.py +23 -6
- openstackclient/identity/v3/service.py +36 -16
- openstackclient/identity/v3/service_provider.py +37 -15
- openstackclient/identity/v3/tag.py +23 -17
- openstackclient/identity/v3/token.py +30 -14
- openstackclient/identity/v3/trust.py +32 -14
- openstackclient/identity/v3/unscoped_saml.py +10 -2
- openstackclient/identity/v3/user.py +49 -26
- openstackclient/image/client.py +7 -3
- openstackclient/image/v1/image.py +33 -26
- openstackclient/image/v2/cache.py +14 -9
- openstackclient/image/v2/image.py +76 -49
- openstackclient/image/v2/info.py +7 -1
- openstackclient/image/v2/metadef_namespaces.py +109 -13
- openstackclient/image/v2/metadef_objects.py +28 -15
- openstackclient/image/v2/metadef_properties.py +24 -13
- openstackclient/image/v2/metadef_resource_type_association.py +14 -7
- openstackclient/image/v2/metadef_resource_types.py +7 -1
- openstackclient/image/v2/task.py +15 -6
- openstackclient/locale/tr_TR/LC_MESSAGES/openstackclient.po +7 -192
- openstackclient/network/client.py +7 -2
- openstackclient/network/common.py +16 -241
- openstackclient/network/utils.py +36 -22
- openstackclient/network/v2/address_group.py +27 -16
- openstackclient/network/v2/address_scope.py +24 -13
- openstackclient/network/v2/bgpvpn/bgpvpn.py +463 -0
- openstackclient/network/v2/bgpvpn/constants.py +30 -0
- openstackclient/network/v2/bgpvpn/network_association.py +214 -0
- openstackclient/network/v2/bgpvpn/port_association.py +490 -0
- openstackclient/network/v2/bgpvpn/router_association.py +288 -0
- openstackclient/network/v2/default_security_group_rule.py +19 -10
- openstackclient/network/v2/floating_ip.py +110 -159
- openstackclient/network/v2/floating_ip_port_forwarding.py +30 -18
- openstackclient/network/v2/fwaas/__init__.py +0 -0
- openstackclient/network/v2/fwaas/group.py +466 -0
- openstackclient/network/v2/fwaas/policy.py +518 -0
- openstackclient/network/v2/fwaas/rule.py +574 -0
- openstackclient/network/v2/ip_availability.py +13 -5
- openstackclient/network/v2/l3_conntrack_helper.py +22 -13
- openstackclient/network/v2/local_ip.py +24 -13
- openstackclient/network/v2/local_ip_association.py +14 -7
- openstackclient/network/v2/ndp_proxy.py +20 -11
- openstackclient/network/v2/network.py +129 -196
- openstackclient/network/v2/network_agent.py +46 -25
- openstackclient/network/v2/network_auto_allocated_topology.py +22 -11
- openstackclient/network/v2/network_flavor.py +27 -16
- openstackclient/network/v2/network_flavor_profile.py +23 -12
- openstackclient/network/v2/network_meter.py +21 -10
- openstackclient/network/v2/network_meter_rule.py +21 -11
- openstackclient/network/v2/network_qos_policy.py +25 -15
- openstackclient/network/v2/network_qos_rule.py +32 -17
- openstackclient/network/v2/network_qos_rule_type.py +13 -5
- openstackclient/network/v2/network_rbac.py +23 -12
- openstackclient/network/v2/network_segment.py +20 -11
- openstackclient/network/v2/network_segment_range.py +56 -29
- openstackclient/network/v2/network_service_provider.py +7 -1
- openstackclient/network/v2/network_trunk.py +38 -22
- openstackclient/network/v2/port.py +54 -29
- openstackclient/network/v2/router.py +75 -52
- openstackclient/network/v2/security_group.py +87 -157
- openstackclient/network/v2/security_group_rule.py +100 -280
- openstackclient/network/v2/subnet.py +49 -28
- openstackclient/network/v2/subnet_pool.py +30 -17
- openstackclient/network/v2/taas/tap_flow.py +22 -11
- openstackclient/network/v2/taas/tap_mirror.py +22 -11
- openstackclient/network/v2/taas/tap_service.py +23 -12
- openstackclient/object/client.py +7 -2
- openstackclient/object/v1/account.py +13 -6
- openstackclient/object/v1/container.py +25 -15
- openstackclient/object/v1/object.py +25 -15
- openstackclient/py.typed +0 -0
- openstackclient/shell.py +46 -10
- openstackclient/tests/functional/base.py +55 -20
- openstackclient/tests/functional/common/test_extension.py +4 -0
- openstackclient/tests/functional/common/test_quota.py +3 -1
- openstackclient/tests/functional/compute/v2/common.py +14 -13
- openstackclient/tests/functional/compute/v2/test_flavor.py +3 -1
- openstackclient/tests/functional/compute/v2/test_server.py +3 -0
- openstackclient/tests/functional/identity/v2/common.py +10 -6
- openstackclient/tests/functional/identity/v2/test_role.py +4 -4
- openstackclient/tests/functional/identity/v3/common.py +25 -19
- openstackclient/tests/functional/identity/v3/test_group.py +20 -20
- openstackclient/tests/functional/identity/v3/test_idp.py +3 -1
- openstackclient/tests/functional/identity/v3/test_limit.py +47 -0
- openstackclient/tests/functional/identity/v3/test_project.py +10 -10
- openstackclient/tests/functional/identity/v3/test_role.py +18 -18
- openstackclient/tests/functional/identity/v3/test_role_assignment.py +12 -12
- openstackclient/tests/functional/identity/v3/test_user.py +8 -8
- openstackclient/tests/functional/image/base.py +1 -6
- openstackclient/tests/functional/image/v2/test_metadef_objects.py +69 -0
- openstackclient/tests/functional/network/v2/common.py +5 -2
- openstackclient/tests/functional/network/v2/test_floating_ip.py +10 -4
- openstackclient/tests/functional/network/v2/test_ip_availability.py +4 -0
- openstackclient/tests/functional/network/v2/test_network_meter_rule.py +3 -2
- openstackclient/tests/functional/network/v2/test_network_segment.py +5 -0
- openstackclient/tests/functional/network/v2/test_subnet.py +13 -9
- openstackclient/tests/functional/object/v1/common.py +4 -0
- openstackclient/tests/functional/volume/v2/common.py +4 -0
- openstackclient/tests/functional/volume/v2/test_volume_snapshot.py +27 -11
- openstackclient/tests/functional/volume/v2/test_volume_type.py +2 -2
- openstackclient/tests/functional/volume/v3/common.py +4 -0
- openstackclient/tests/functional/volume/v3/test_volume_snapshot.py +56 -138
- openstackclient/tests/functional/volume/v3/test_volume_type.py +2 -2
- openstackclient/tests/unit/common/test_availability_zone.py +35 -49
- openstackclient/tests/unit/common/test_extension.py +2 -2
- openstackclient/tests/unit/common/test_module.py +12 -7
- openstackclient/tests/unit/common/test_project_cleanup.py +3 -1
- openstackclient/tests/unit/common/test_quota.py +62 -23
- openstackclient/tests/unit/compute/v2/fakes.py +25 -0
- openstackclient/tests/unit/compute/v2/test_flavor.py +28 -2
- openstackclient/tests/unit/compute/v2/test_keypair.py +6 -6
- openstackclient/tests/unit/compute/v2/test_server.py +17 -104
- openstackclient/tests/unit/compute/v2/test_server_share.py +287 -0
- openstackclient/tests/unit/identity/v3/fakes.py +3 -0
- openstackclient/tests/unit/identity/v3/test_group.py +4 -14
- openstackclient/tests/unit/identity/v3/test_identity_provider.py +303 -299
- openstackclient/tests/unit/identity/v3/test_limit.py +197 -145
- openstackclient/tests/unit/identity/v3/test_project.py +831 -512
- openstackclient/tests/unit/identity/v3/test_protocol.py +97 -88
- openstackclient/tests/unit/identity/v3/test_registered_limit.py +355 -220
- openstackclient/tests/unit/identity/v3/test_user.py +4 -4
- openstackclient/tests/unit/image/v2/test_image.py +16 -16
- openstackclient/tests/unit/image/v2/test_metadef_namespaces.py +105 -6
- openstackclient/tests/unit/network/test_common.py +0 -155
- openstackclient/tests/unit/network/v2/bgpvpn/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/bgpvpn/fakes.py +179 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_bgpvpn.py +584 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_network_association.py +285 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_port_association.py +384 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_router_association.py +297 -0
- openstackclient/tests/unit/network/v2/fwaas/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/fwaas/test_group.py +897 -0
- openstackclient/tests/unit/network/v2/fwaas/test_policy.py +869 -0
- openstackclient/tests/unit/network/v2/fwaas/test_rule.py +980 -0
- openstackclient/tests/unit/network/v2/taas/{test_osc_tap_flow.py → test_tap_flow.py} +18 -25
- openstackclient/tests/unit/network/v2/taas/{test_osc_tap_mirror.py → test_tap_mirror.py} +19 -29
- openstackclient/tests/unit/network/v2/taas/{test_osc_tap_service.py → test_tap_service.py} +19 -29
- openstackclient/tests/unit/network/v2/test_address_group.py +2 -2
- openstackclient/tests/unit/network/v2/{test_floating_ip_network.py → test_floating_ip.py} +3 -2
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +13 -13
- openstackclient/tests/unit/network/v2/test_network_agent.py +8 -4
- openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +3 -3
- openstackclient/tests/unit/network/v2/test_network_flavor.py +2 -2
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +2 -2
- openstackclient/tests/unit/network/v2/test_network_rbac.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_segment.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_segment_range.py +7 -10
- openstackclient/tests/unit/network/v2/test_network_trunk.py +1 -1
- openstackclient/tests/unit/network/v2/test_router.py +8 -9
- openstackclient/tests/unit/network/v2/{test_security_group_network.py → test_security_group.py} +1 -20
- openstackclient/tests/unit/network/v2/{test_security_group_rule_network.py → test_security_group_rule.py} +7 -41
- openstackclient/tests/unit/network/v2/test_subnet.py +2 -1
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +2 -1
- openstackclient/tests/unit/object/v1/fakes.py +8 -7
- openstackclient/tests/unit/object/v1/test_container.py +65 -101
- openstackclient/tests/unit/object/v1/test_container_all.py +8 -1
- openstackclient/tests/unit/object/v1/test_object.py +44 -84
- openstackclient/tests/unit/object/v1/test_object_all.py +8 -1
- openstackclient/tests/unit/test_hacking.py +108 -0
- openstackclient/tests/unit/volume/v2/fakes.py +1 -0
- openstackclient/tests/unit/volume/v2/test_consistency_group.py +8 -2
- openstackclient/tests/unit/volume/v2/test_volume.py +7 -6
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +1 -5
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +2 -1
- openstackclient/tests/unit/volume/v2/test_volume_type.py +2 -4
- openstackclient/tests/unit/volume/v3/fakes.py +1 -0
- openstackclient/tests/unit/volume/v3/test_volume.py +94 -15
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +1 -1
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +1 -5
- openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +55 -1
- openstackclient/tests/unit/volume/v3/test_volume_type.py +2 -4
- openstackclient/volume/client.py +7 -3
- openstackclient/volume/v2/backup_record.py +15 -6
- openstackclient/volume/v2/consistency_group.py +37 -25
- openstackclient/volume/v2/consistency_group_snapshot.py +27 -12
- openstackclient/volume/v2/qos_specs.py +30 -19
- openstackclient/volume/v2/service.py +17 -6
- openstackclient/volume/v2/volume.py +69 -34
- openstackclient/volume/v2/volume_backend.py +19 -6
- openstackclient/volume/v2/volume_backup.py +48 -22
- openstackclient/volume/v2/volume_host.py +6 -4
- openstackclient/volume/v2/volume_snapshot.py +52 -26
- openstackclient/volume/v2/volume_transfer_request.py +33 -15
- openstackclient/volume/v2/volume_type.py +46 -27
- openstackclient/volume/v3/block_storage_cleanup.py +11 -3
- openstackclient/volume/v3/block_storage_cluster.py +19 -7
- openstackclient/volume/v3/block_storage_log_level.py +15 -6
- openstackclient/volume/v3/block_storage_manage.py +10 -4
- openstackclient/volume/v3/block_storage_resource_filter.py +17 -5
- openstackclient/volume/v3/service.py +16 -6
- openstackclient/volume/v3/volume.py +103 -46
- openstackclient/volume/v3/volume_attachment.py +43 -21
- openstackclient/volume/v3/volume_backup.py +55 -26
- openstackclient/volume/v3/volume_group.py +23 -13
- openstackclient/volume/v3/volume_group_snapshot.py +32 -13
- openstackclient/volume/v3/volume_group_type.py +26 -13
- openstackclient/volume/v3/volume_message.py +15 -7
- openstackclient/volume/v3/volume_snapshot.py +71 -34
- openstackclient/volume/v3/volume_transfer_request.py +33 -15
- openstackclient/volume/v3/volume_type.py +45 -27
- {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/METADATA +6 -6
- {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/RECORD +279 -267
- {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/entry_points.txt +53 -1
- {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/licenses/AUTHORS +9 -0
- python_openstackclient-10.0.0.dist-info/pbr.json +1 -0
- openstackclient/api/image_v1.py +0 -69
- openstackclient/api/image_v2.py +0 -79
- openstackclient/network/v2/floating_ip_pool.py +0 -38
- openstackclient/tests/functional/image/v1/test_image.py +0 -97
- openstackclient/tests/unit/api/test_image_v1.py +0 -96
- openstackclient/tests/unit/api/test_image_v2.py +0 -96
- openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +0 -248
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +0 -49
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_network.py +0 -39
- openstackclient/tests/unit/network/v2/test_network_compute.py +0 -404
- openstackclient/tests/unit/network/v2/test_security_group_compute.py +0 -392
- openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +0 -555
- python_openstackclient-8.3.0.dist-info/pbr.json +0 -1
- /openstackclient/{tests/functional/image/v1 → network/v2/bgpvpn}/__init__.py +0 -0
- {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/licenses/LICENSE +0 -0
- {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/top_level.txt +0 -0
|
@@ -1716,7 +1716,7 @@ class TestUserSetPassword(identity_fakes.TestIdentityv3):
|
|
|
1716
1716
|
conn = self.app.client_manager.sdk_connection
|
|
1717
1717
|
user_id = conn.config.get_auth().get_user_id(conn.identity)
|
|
1718
1718
|
|
|
1719
|
-
self.identity_sdk_client.
|
|
1719
|
+
self.identity_sdk_client.update_password.assert_called_with(
|
|
1720
1720
|
user=user_id, current_password=current_pass, password=new_pass
|
|
1721
1721
|
)
|
|
1722
1722
|
|
|
@@ -1733,7 +1733,7 @@ class TestUserSetPassword(identity_fakes.TestIdentityv3):
|
|
|
1733
1733
|
conn = self.app.client_manager.sdk_connection
|
|
1734
1734
|
user_id = conn.config.get_auth().get_user_id(conn.identity)
|
|
1735
1735
|
|
|
1736
|
-
self.identity_sdk_client.
|
|
1736
|
+
self.identity_sdk_client.update_password.assert_called_with(
|
|
1737
1737
|
user=user_id, current_password=current_pass, password=new_pass
|
|
1738
1738
|
)
|
|
1739
1739
|
|
|
@@ -1758,7 +1758,7 @@ class TestUserSetPassword(identity_fakes.TestIdentityv3):
|
|
|
1758
1758
|
conn = self.app.client_manager.sdk_connection
|
|
1759
1759
|
user_id = conn.config.get_auth().get_user_id(conn.identity)
|
|
1760
1760
|
|
|
1761
|
-
self.identity_sdk_client.
|
|
1761
|
+
self.identity_sdk_client.update_password.assert_called_with(
|
|
1762
1762
|
user=user_id, current_password=current_pass, password=new_pass
|
|
1763
1763
|
)
|
|
1764
1764
|
|
|
@@ -1773,7 +1773,7 @@ class TestUserShow(identity_fakes.TestIdentityv3):
|
|
|
1773
1773
|
|
|
1774
1774
|
# Get the command object to test
|
|
1775
1775
|
self.cmd = user.ShowUser(self.app, None)
|
|
1776
|
-
self.identity_client.auth.client.get_user_id.return_value = (
|
|
1776
|
+
self.identity_client.auth.client.get_user_id.return_value = (
|
|
1777
1777
|
self.user.id
|
|
1778
1778
|
)
|
|
1779
1779
|
self.identity_client.tokens.get_token_data.return_value = {
|
|
@@ -305,7 +305,7 @@ class TestImageCreate(TestImage):
|
|
|
305
305
|
]
|
|
306
306
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
307
307
|
|
|
308
|
-
|
|
308
|
+
self.cmd.take_action(parsed_args)
|
|
309
309
|
|
|
310
310
|
self.image_client.create_image.assert_called_with(
|
|
311
311
|
name=self.new_image.name,
|
|
@@ -336,7 +336,7 @@ class TestImageCreate(TestImage):
|
|
|
336
336
|
]
|
|
337
337
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
338
338
|
|
|
339
|
-
|
|
339
|
+
self.cmd.take_action(parsed_args)
|
|
340
340
|
|
|
341
341
|
self.volume_sdk_client.upload_volume_to_image.assert_called_once_with(
|
|
342
342
|
volume.id,
|
|
@@ -397,7 +397,7 @@ class TestImageCreate(TestImage):
|
|
|
397
397
|
]
|
|
398
398
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
399
399
|
|
|
400
|
-
|
|
400
|
+
self.cmd.take_action(parsed_args)
|
|
401
401
|
|
|
402
402
|
self.volume_sdk_client.upload_volume_to_image.assert_called_once_with(
|
|
403
403
|
volume.id,
|
|
@@ -946,7 +946,7 @@ class TestImageList(TestImage):
|
|
|
946
946
|
]
|
|
947
947
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
948
948
|
|
|
949
|
-
|
|
949
|
+
self.cmd.take_action(parsed_args)
|
|
950
950
|
self.image_client.images.assert_called_with(
|
|
951
951
|
marker=self._image.id,
|
|
952
952
|
)
|
|
@@ -966,7 +966,7 @@ class TestImageList(TestImage):
|
|
|
966
966
|
]
|
|
967
967
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
968
968
|
|
|
969
|
-
|
|
969
|
+
self.cmd.take_action(parsed_args)
|
|
970
970
|
self.image_client.images.assert_called_with(
|
|
971
971
|
name='abc',
|
|
972
972
|
# marker=self._image.id
|
|
@@ -982,7 +982,7 @@ class TestImageList(TestImage):
|
|
|
982
982
|
]
|
|
983
983
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
984
984
|
|
|
985
|
-
|
|
985
|
+
self.cmd.take_action(parsed_args)
|
|
986
986
|
self.image_client.images.assert_called_with(status='active')
|
|
987
987
|
|
|
988
988
|
def test_image_list_hidden_option(self):
|
|
@@ -994,7 +994,7 @@ class TestImageList(TestImage):
|
|
|
994
994
|
]
|
|
995
995
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
996
996
|
|
|
997
|
-
|
|
997
|
+
self.cmd.take_action(parsed_args)
|
|
998
998
|
self.image_client.images.assert_called_with(is_hidden=True)
|
|
999
999
|
|
|
1000
1000
|
def test_image_list_tag_option(self):
|
|
@@ -1004,7 +1004,7 @@ class TestImageList(TestImage):
|
|
|
1004
1004
|
]
|
|
1005
1005
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1006
1006
|
|
|
1007
|
-
|
|
1007
|
+
self.cmd.take_action(parsed_args)
|
|
1008
1008
|
self.image_client.images.assert_called_with(tag=['abc', 'cba'])
|
|
1009
1009
|
|
|
1010
1010
|
|
|
@@ -1329,7 +1329,7 @@ class TestImageSet(TestImage):
|
|
|
1329
1329
|
self.image_client.update_image.assert_called()
|
|
1330
1330
|
call_args = self.image_client.update_image.call_args
|
|
1331
1331
|
if call_args:
|
|
1332
|
-
|
|
1332
|
+
_args, kwargs = call_args
|
|
1333
1333
|
self.assertNotIn('owner_id', kwargs)
|
|
1334
1334
|
|
|
1335
1335
|
def test_image_set_membership_reject_with_project_no_owner_change(self):
|
|
@@ -1366,7 +1366,7 @@ class TestImageSet(TestImage):
|
|
|
1366
1366
|
self.image_client.update_image.assert_called()
|
|
1367
1367
|
call_args = self.image_client.update_image.call_args
|
|
1368
1368
|
if call_args:
|
|
1369
|
-
|
|
1369
|
+
_args, kwargs = call_args
|
|
1370
1370
|
self.assertNotIn('owner_id', kwargs)
|
|
1371
1371
|
|
|
1372
1372
|
def test_image_set_membership_pending_with_project_no_owner_change(self):
|
|
@@ -1403,7 +1403,7 @@ class TestImageSet(TestImage):
|
|
|
1403
1403
|
self.image_client.update_image.assert_called()
|
|
1404
1404
|
call_args = self.image_client.update_image.call_args
|
|
1405
1405
|
if call_args:
|
|
1406
|
-
|
|
1406
|
+
_args, kwargs = call_args
|
|
1407
1407
|
self.assertNotIn('owner_id', kwargs)
|
|
1408
1408
|
|
|
1409
1409
|
def test_image_set_options(self):
|
|
@@ -2085,7 +2085,7 @@ class TestImageImport(TestImage):
|
|
|
2085
2085
|
remote_image_id=None,
|
|
2086
2086
|
remote_service_interface=None,
|
|
2087
2087
|
stores=None,
|
|
2088
|
-
all_stores=
|
|
2088
|
+
all_stores=False,
|
|
2089
2089
|
all_stores_must_succeed=False,
|
|
2090
2090
|
)
|
|
2091
2091
|
|
|
@@ -2115,7 +2115,7 @@ class TestImageImport(TestImage):
|
|
|
2115
2115
|
remote_image_id=None,
|
|
2116
2116
|
remote_service_interface=None,
|
|
2117
2117
|
stores=None,
|
|
2118
|
-
all_stores=
|
|
2118
|
+
all_stores=False,
|
|
2119
2119
|
all_stores_must_succeed=False,
|
|
2120
2120
|
)
|
|
2121
2121
|
|
|
@@ -2253,7 +2253,7 @@ class TestImageImport(TestImage):
|
|
|
2253
2253
|
remote_image_id=None,
|
|
2254
2254
|
remote_service_interface=None,
|
|
2255
2255
|
stores=['fast'],
|
|
2256
|
-
all_stores=
|
|
2256
|
+
all_stores=False,
|
|
2257
2257
|
all_stores_must_succeed=False,
|
|
2258
2258
|
)
|
|
2259
2259
|
|
|
@@ -2285,7 +2285,7 @@ class TestImageImport(TestImage):
|
|
|
2285
2285
|
remote_image_id=None,
|
|
2286
2286
|
remote_service_interface=None,
|
|
2287
2287
|
stores=['fast'],
|
|
2288
|
-
all_stores=
|
|
2288
|
+
all_stores=False,
|
|
2289
2289
|
all_stores_must_succeed=True,
|
|
2290
2290
|
)
|
|
2291
2291
|
|
|
@@ -2320,7 +2320,7 @@ class TestImageImport(TestImage):
|
|
|
2320
2320
|
remote_image_id='remote-image-id',
|
|
2321
2321
|
remote_service_interface='private',
|
|
2322
2322
|
stores=None,
|
|
2323
|
-
all_stores=
|
|
2323
|
+
all_stores=False,
|
|
2324
2324
|
all_stores_must_succeed=False,
|
|
2325
2325
|
)
|
|
2326
2326
|
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
# License for the specific language governing permissions and limitations
|
|
13
13
|
# under the License.
|
|
14
14
|
|
|
15
|
+
from unittest import mock
|
|
16
|
+
|
|
15
17
|
from openstackclient.image.v2 import metadef_namespaces
|
|
16
18
|
from openstackclient.tests.unit.image.v2 import fakes as image_fakes
|
|
17
19
|
|
|
@@ -24,6 +26,7 @@ class TestMetadefNamespaceCreate(image_fakes.TestImagev2):
|
|
|
24
26
|
'display_name',
|
|
25
27
|
'namespace',
|
|
26
28
|
'owner',
|
|
29
|
+
'tags',
|
|
27
30
|
'visibility',
|
|
28
31
|
)
|
|
29
32
|
expected_data = (
|
|
@@ -31,6 +34,7 @@ class TestMetadefNamespaceCreate(image_fakes.TestImagev2):
|
|
|
31
34
|
_metadef_namespace.display_name,
|
|
32
35
|
_metadef_namespace.namespace,
|
|
33
36
|
_metadef_namespace.owner,
|
|
37
|
+
_metadef_namespace.tags,
|
|
34
38
|
_metadef_namespace.visibility,
|
|
35
39
|
)
|
|
36
40
|
|
|
@@ -114,21 +118,25 @@ class TestMetadefNamespaceList(image_fakes.TestImagev2):
|
|
|
114
118
|
|
|
115
119
|
|
|
116
120
|
class TestMetadefNamespaceSet(image_fakes.TestImagev2):
|
|
117
|
-
_metadef_namespace = image_fakes.create_one_metadef_namespace()
|
|
118
|
-
|
|
119
121
|
def setUp(self):
|
|
120
122
|
super().setUp()
|
|
121
123
|
|
|
124
|
+
self.metadef_namespace = image_fakes.create_one_metadef_namespace()
|
|
125
|
+
|
|
126
|
+
self.image_client.get_metadef_namespace.return_value = (
|
|
127
|
+
self.metadef_namespace
|
|
128
|
+
)
|
|
122
129
|
self.image_client.update_metadef_namespace.return_value = (
|
|
123
|
-
self.
|
|
130
|
+
self.metadef_namespace
|
|
124
131
|
)
|
|
132
|
+
self.image_client.add_tag_to_metadef_namespace.return_value = None
|
|
133
|
+
|
|
125
134
|
self.cmd = metadef_namespaces.SetMetadefNamespace(self.app, None)
|
|
126
|
-
self.datalist = self._metadef_namespace
|
|
127
135
|
|
|
128
136
|
def test_namespace_set_no_options(self):
|
|
129
|
-
arglist = [self.
|
|
137
|
+
arglist = [self.metadef_namespace.namespace]
|
|
130
138
|
verifylist = [
|
|
131
|
-
('namespace', self.
|
|
139
|
+
('namespace', self.metadef_namespace.namespace),
|
|
132
140
|
]
|
|
133
141
|
|
|
134
142
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -137,6 +145,95 @@ class TestMetadefNamespaceSet(image_fakes.TestImagev2):
|
|
|
137
145
|
|
|
138
146
|
self.assertIsNone(result)
|
|
139
147
|
|
|
148
|
+
def test_namespace_set_tag(self):
|
|
149
|
+
arglist = [
|
|
150
|
+
self.metadef_namespace.namespace,
|
|
151
|
+
'--tag',
|
|
152
|
+
't1',
|
|
153
|
+
'--tag',
|
|
154
|
+
't2',
|
|
155
|
+
]
|
|
156
|
+
verifylist = [
|
|
157
|
+
('namespace', self.metadef_namespace.namespace),
|
|
158
|
+
('tags', ['t1', 't2']),
|
|
159
|
+
]
|
|
160
|
+
|
|
161
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
162
|
+
|
|
163
|
+
self.cmd.take_action(parsed_args)
|
|
164
|
+
|
|
165
|
+
self.image_client.add_tag_to_metadef_namespace.assert_has_calls(
|
|
166
|
+
[
|
|
167
|
+
mock.call(self.metadef_namespace.namespace, 't1'),
|
|
168
|
+
mock.call(self.metadef_namespace.namespace, 't2'),
|
|
169
|
+
]
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
class TestMetadefNamespaceUnset(image_fakes.TestImagev2):
|
|
174
|
+
def setUp(self):
|
|
175
|
+
super().setUp()
|
|
176
|
+
|
|
177
|
+
self.metadef_namespace = image_fakes.create_one_metadef_namespace(
|
|
178
|
+
attrs={'tags': [{'name': 't1'}]}
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
self.image_client.get_metadef_namespace.return_value = (
|
|
182
|
+
self.metadef_namespace
|
|
183
|
+
)
|
|
184
|
+
self.image_client.update_metadef_namespace.return_value = (
|
|
185
|
+
self.metadef_namespace
|
|
186
|
+
)
|
|
187
|
+
self.image_client.remove_tag_from_metadef_namespace.return_value = None
|
|
188
|
+
self.image_client.remove_tags_from_metadef_namespace.return_value = (
|
|
189
|
+
None
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
self.cmd = metadef_namespaces.UnsetMetadefNamespace(self.app, None)
|
|
193
|
+
|
|
194
|
+
def test_namespace_unset_tag(self):
|
|
195
|
+
arglist = [
|
|
196
|
+
self.metadef_namespace.namespace,
|
|
197
|
+
'--tag',
|
|
198
|
+
't1',
|
|
199
|
+
'--tag',
|
|
200
|
+
't2',
|
|
201
|
+
]
|
|
202
|
+
verifylist = [
|
|
203
|
+
('namespace', self.metadef_namespace.namespace),
|
|
204
|
+
('tags', ['t1', 't2']),
|
|
205
|
+
]
|
|
206
|
+
|
|
207
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
208
|
+
|
|
209
|
+
self.cmd.take_action(parsed_args)
|
|
210
|
+
|
|
211
|
+
self.image_client.remove_tag_from_metadef_namespace.assert_has_calls(
|
|
212
|
+
[
|
|
213
|
+
mock.call(self.metadef_namespace, 't1'),
|
|
214
|
+
mock.call(self.metadef_namespace, 't2'),
|
|
215
|
+
]
|
|
216
|
+
)
|
|
217
|
+
self.image_client.remove_tags_from_metadef_namespace.assert_not_called()
|
|
218
|
+
|
|
219
|
+
def test_namespace_unset_all_tag(self):
|
|
220
|
+
arglist = [
|
|
221
|
+
self.metadef_namespace.namespace,
|
|
222
|
+
'--all-tags',
|
|
223
|
+
]
|
|
224
|
+
verifylist = [
|
|
225
|
+
('namespace', self.metadef_namespace.namespace),
|
|
226
|
+
]
|
|
227
|
+
|
|
228
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
229
|
+
|
|
230
|
+
self.cmd.take_action(parsed_args)
|
|
231
|
+
|
|
232
|
+
self.image_client.remove_tags_from_metadef_namespace.assert_called_once_with(
|
|
233
|
+
self.metadef_namespace
|
|
234
|
+
)
|
|
235
|
+
self.image_client.remove_tag_from_metadef_namespace.assert_not_called()
|
|
236
|
+
|
|
140
237
|
|
|
141
238
|
class TestMetadefNamespaceShow(image_fakes.TestImagev2):
|
|
142
239
|
_metadef_namespace = image_fakes.create_one_metadef_namespace()
|
|
@@ -146,6 +243,7 @@ class TestMetadefNamespaceShow(image_fakes.TestImagev2):
|
|
|
146
243
|
'display_name',
|
|
147
244
|
'namespace',
|
|
148
245
|
'owner',
|
|
246
|
+
'tags',
|
|
149
247
|
'visibility',
|
|
150
248
|
)
|
|
151
249
|
expected_data = (
|
|
@@ -153,6 +251,7 @@ class TestMetadefNamespaceShow(image_fakes.TestImagev2):
|
|
|
153
251
|
_metadef_namespace.display_name,
|
|
154
252
|
_metadef_namespace.namespace,
|
|
155
253
|
_metadef_namespace.owner,
|
|
254
|
+
_metadef_namespace.tags,
|
|
156
255
|
_metadef_namespace.visibility,
|
|
157
256
|
)
|
|
158
257
|
|
|
@@ -13,91 +13,11 @@
|
|
|
13
13
|
|
|
14
14
|
from unittest import mock
|
|
15
15
|
|
|
16
|
-
import openstack
|
|
17
|
-
from osc_lib import exceptions
|
|
18
16
|
|
|
19
17
|
from openstackclient.network import common
|
|
20
18
|
from openstackclient.tests.unit import utils
|
|
21
19
|
|
|
22
20
|
|
|
23
|
-
def _add_common_argument(parser):
|
|
24
|
-
parser.add_argument(
|
|
25
|
-
'common',
|
|
26
|
-
metavar='<common>',
|
|
27
|
-
help='Common argument',
|
|
28
|
-
)
|
|
29
|
-
return parser
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def _add_network_argument(parser):
|
|
33
|
-
parser.add_argument(
|
|
34
|
-
'network',
|
|
35
|
-
metavar='<network>',
|
|
36
|
-
help='Network argument',
|
|
37
|
-
)
|
|
38
|
-
return parser
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def _add_compute_argument(parser):
|
|
42
|
-
parser.add_argument(
|
|
43
|
-
'compute',
|
|
44
|
-
metavar='<compute>',
|
|
45
|
-
help='Compute argument',
|
|
46
|
-
)
|
|
47
|
-
return parser
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
class FakeNetworkAndComputeCommand(common.NetworkAndComputeCommand):
|
|
51
|
-
def update_parser_common(self, parser):
|
|
52
|
-
return _add_common_argument(parser)
|
|
53
|
-
|
|
54
|
-
def update_parser_network(self, parser):
|
|
55
|
-
return _add_network_argument(parser)
|
|
56
|
-
|
|
57
|
-
def update_parser_compute(self, parser):
|
|
58
|
-
return _add_compute_argument(parser)
|
|
59
|
-
|
|
60
|
-
def take_action_network(self, client, parsed_args):
|
|
61
|
-
return client.network_action(parsed_args)
|
|
62
|
-
|
|
63
|
-
def take_action_compute(self, client, parsed_args):
|
|
64
|
-
return client.compute_action(parsed_args)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class FakeNetworkAndComputeLister(common.NetworkAndComputeLister):
|
|
68
|
-
def update_parser_common(self, parser):
|
|
69
|
-
return _add_common_argument(parser)
|
|
70
|
-
|
|
71
|
-
def update_parser_network(self, parser):
|
|
72
|
-
return _add_network_argument(parser)
|
|
73
|
-
|
|
74
|
-
def update_parser_compute(self, parser):
|
|
75
|
-
return _add_compute_argument(parser)
|
|
76
|
-
|
|
77
|
-
def take_action_network(self, client, parsed_args):
|
|
78
|
-
return client.network_action(parsed_args)
|
|
79
|
-
|
|
80
|
-
def take_action_compute(self, client, parsed_args):
|
|
81
|
-
return client.compute_action(parsed_args)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
class FakeNetworkAndComputeShowOne(common.NetworkAndComputeShowOne):
|
|
85
|
-
def update_parser_common(self, parser):
|
|
86
|
-
return _add_common_argument(parser)
|
|
87
|
-
|
|
88
|
-
def update_parser_network(self, parser):
|
|
89
|
-
return _add_network_argument(parser)
|
|
90
|
-
|
|
91
|
-
def update_parser_compute(self, parser):
|
|
92
|
-
return _add_compute_argument(parser)
|
|
93
|
-
|
|
94
|
-
def take_action_network(self, client, parsed_args):
|
|
95
|
-
return client.network_action(parsed_args)
|
|
96
|
-
|
|
97
|
-
def take_action_compute(self, client, parsed_args):
|
|
98
|
-
return client.compute_action(parsed_args)
|
|
99
|
-
|
|
100
|
-
|
|
101
21
|
class FakeCreateNeutronCommandWithExtraArgs(
|
|
102
22
|
common.NeutronCommandWithExtraArgs
|
|
103
23
|
):
|
|
@@ -119,81 +39,6 @@ class FakeCreateNeutronCommandWithExtraArgs(
|
|
|
119
39
|
client.test_create_action(**attrs)
|
|
120
40
|
|
|
121
41
|
|
|
122
|
-
class TestNetworkAndCompute(utils.TestCommand):
|
|
123
|
-
def setUp(self):
|
|
124
|
-
super().setUp()
|
|
125
|
-
|
|
126
|
-
# Create client mocks. Note that we intentionally do not use specced
|
|
127
|
-
# mocks since we want to test fake methods.
|
|
128
|
-
|
|
129
|
-
self.app.client_manager.network = mock.Mock() # noqa: O401
|
|
130
|
-
self.network_client = self.app.client_manager.network # noqa: O401
|
|
131
|
-
self.network_client.network_action.return_value = 'take_action_network'
|
|
132
|
-
|
|
133
|
-
self.app.client_manager.compute = mock.Mock() # noqa: O401
|
|
134
|
-
self.compute_client = self.app.client_manager.compute # noqa: O401
|
|
135
|
-
self.compute_client.compute_action.return_value = 'take_action_compute'
|
|
136
|
-
|
|
137
|
-
self.cmd = FakeNetworkAndComputeCommand(self.app, None)
|
|
138
|
-
|
|
139
|
-
def test_take_action_network(self):
|
|
140
|
-
arglist = ['common', 'network']
|
|
141
|
-
verifylist = [('common', 'common'), ('network', 'network')]
|
|
142
|
-
|
|
143
|
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
144
|
-
result = self.cmd.take_action(parsed_args)
|
|
145
|
-
self.network_client.network_action.assert_called_with(parsed_args)
|
|
146
|
-
self.assertEqual('take_action_network', result)
|
|
147
|
-
|
|
148
|
-
def test_take_action_compute(self):
|
|
149
|
-
arglist = ['common', 'compute']
|
|
150
|
-
verifylist = [('common', 'common'), ('compute', 'compute')]
|
|
151
|
-
|
|
152
|
-
self.app.client_manager.network_endpoint_enabled = False
|
|
153
|
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
154
|
-
result = self.cmd.take_action(parsed_args)
|
|
155
|
-
self.compute_client.compute_action.assert_called_with(parsed_args)
|
|
156
|
-
self.assertEqual('take_action_compute', result)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
class TestNetworkAndComputeCommand(TestNetworkAndCompute):
|
|
160
|
-
def setUp(self):
|
|
161
|
-
super().setUp()
|
|
162
|
-
self.cmd = FakeNetworkAndComputeCommand(self.app, None)
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
class TestNetworkAndComputeLister(TestNetworkAndCompute):
|
|
166
|
-
def setUp(self):
|
|
167
|
-
super().setUp()
|
|
168
|
-
self.cmd = FakeNetworkAndComputeLister(self.app, None)
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
class TestNetworkAndComputeShowOne(TestNetworkAndCompute):
|
|
172
|
-
def setUp(self):
|
|
173
|
-
super().setUp()
|
|
174
|
-
self.cmd = FakeNetworkAndComputeShowOne(self.app, None)
|
|
175
|
-
|
|
176
|
-
def test_take_action_with_http_exception(self):
|
|
177
|
-
with mock.patch.object(self.cmd, 'take_action_network') as m_action:
|
|
178
|
-
m_action.side_effect = openstack.exceptions.HttpException("bar")
|
|
179
|
-
self.assertRaisesRegex(
|
|
180
|
-
exceptions.CommandError,
|
|
181
|
-
"bar",
|
|
182
|
-
self.cmd.take_action,
|
|
183
|
-
mock.Mock(),
|
|
184
|
-
)
|
|
185
|
-
|
|
186
|
-
self.app.client_manager.network_endpoint_enabled = False
|
|
187
|
-
with mock.patch.object(self.cmd, 'take_action_compute') as m_action:
|
|
188
|
-
m_action.side_effect = openstack.exceptions.HttpException("bar")
|
|
189
|
-
self.assertRaisesRegex(
|
|
190
|
-
exceptions.CommandError,
|
|
191
|
-
"bar",
|
|
192
|
-
self.cmd.take_action,
|
|
193
|
-
mock.Mock(),
|
|
194
|
-
)
|
|
195
|
-
|
|
196
|
-
|
|
197
42
|
class TestNeutronCommandWithExtraArgs(utils.TestCommand):
|
|
198
43
|
def setUp(self):
|
|
199
44
|
super().setUp()
|
|
File without changes
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Copyright (c) 2016 Juniper Networks Inc.
|
|
2
|
+
# All Rights Reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
5
|
+
# not use this file except in compliance with the License. You may obtain
|
|
6
|
+
# a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
13
|
+
# License for the specific language governing permissions and limitations
|
|
14
|
+
# under the License.
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
from openstack.network.v2 import bgpvpn as _bgpvpn
|
|
19
|
+
from openstack.network.v2 import bgpvpn_network_association as _net_assoc
|
|
20
|
+
from openstack.network.v2 import bgpvpn_port_association as _port_assoc
|
|
21
|
+
from openstack.network.v2 import bgpvpn_router_association as _router_assoc
|
|
22
|
+
from openstack import resource as sdk_resource
|
|
23
|
+
|
|
24
|
+
from openstackclient.tests.unit.network.v2 import fakes as test_fakes
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
_FAKE_PROJECT_ID = 'fake_project_id'
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class TestNeutronClientBgpvpn(test_fakes.TestNetworkV2):
|
|
31
|
+
def setUp(self):
|
|
32
|
+
super().setUp()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def create_one_bgpvpn(attrs=None):
|
|
36
|
+
"""Create a fake BGP VPN."""
|
|
37
|
+
|
|
38
|
+
attrs = attrs or {}
|
|
39
|
+
|
|
40
|
+
# Set default attributes.
|
|
41
|
+
bgpvpn_attrs = {
|
|
42
|
+
'id': 'fake_bgpvpn_id',
|
|
43
|
+
'project_id': _FAKE_PROJECT_ID,
|
|
44
|
+
'name': '',
|
|
45
|
+
'type': 'l3',
|
|
46
|
+
'route_targets': [],
|
|
47
|
+
'import_targets': [],
|
|
48
|
+
'export_targets': [],
|
|
49
|
+
'route_distinguishers': [],
|
|
50
|
+
'networks': [],
|
|
51
|
+
'routers': [],
|
|
52
|
+
'ports': [],
|
|
53
|
+
'vni': 100,
|
|
54
|
+
'local_pref': 777,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
# Overwrite default attributes.
|
|
58
|
+
bgpvpn_attrs.update(attrs)
|
|
59
|
+
return _bgpvpn.BgpVpn(**bgpvpn_attrs)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def create_bgpvpns(attrs=None, count=1):
|
|
63
|
+
"""Create multiple fake BGP VPN."""
|
|
64
|
+
|
|
65
|
+
bgpvpns = []
|
|
66
|
+
for i in range(0, count):
|
|
67
|
+
if attrs is None:
|
|
68
|
+
attrs = {'id': 'fake_id{i}'}
|
|
69
|
+
elif getattr(attrs, 'id', None) is None:
|
|
70
|
+
attrs['id'] = 'fake_id{i}'
|
|
71
|
+
bgpvpns.append(create_one_bgpvpn(attrs))
|
|
72
|
+
|
|
73
|
+
return bgpvpns
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def create_one_resource(attrs=None):
|
|
77
|
+
"""Create a fake resource."""
|
|
78
|
+
attrs = attrs or {}
|
|
79
|
+
|
|
80
|
+
res_attrs = {
|
|
81
|
+
'id': 'fake_resource_id',
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
res_attrs.update(attrs)
|
|
85
|
+
return sdk_resource.Resource(**res_attrs)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def create_resources(attrs=None, count=1):
|
|
89
|
+
"""Create multiple fake resources."""
|
|
90
|
+
|
|
91
|
+
resources = []
|
|
92
|
+
for i in range(0, count):
|
|
93
|
+
if attrs is None:
|
|
94
|
+
attrs = {'id': 'fake_id{i}'}
|
|
95
|
+
elif getattr(attrs, 'id', None) is None:
|
|
96
|
+
attrs['id'] = 'fake_id{i}'
|
|
97
|
+
resources.append(create_one_resource(attrs))
|
|
98
|
+
|
|
99
|
+
return resources
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def create_one_network_association(attrs=None):
|
|
103
|
+
"""Create a fake network association."""
|
|
104
|
+
attrs = attrs or {}
|
|
105
|
+
assoc_attrs = {
|
|
106
|
+
'id': 'fake_association_id',
|
|
107
|
+
'network_id': 'fake_resource_id',
|
|
108
|
+
'project_id': _FAKE_PROJECT_ID,
|
|
109
|
+
}
|
|
110
|
+
assoc_attrs.update(attrs)
|
|
111
|
+
return _net_assoc.BgpVpnNetworkAssociation(**assoc_attrs)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def create_network_associations(count=1):
|
|
115
|
+
"""Create multiple fake network associations."""
|
|
116
|
+
assocs = []
|
|
117
|
+
for idx in range(count):
|
|
118
|
+
assocs.append(
|
|
119
|
+
{
|
|
120
|
+
'id': f'fake_association_id{idx}',
|
|
121
|
+
'network_id': f'fake_resource_id{idx}',
|
|
122
|
+
'project_id': _FAKE_PROJECT_ID,
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
return assocs
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def create_one_router_association(attrs=None):
|
|
129
|
+
"""Create a fake router association."""
|
|
130
|
+
attrs = attrs or {}
|
|
131
|
+
assoc_attrs = {
|
|
132
|
+
'id': 'fake_association_id',
|
|
133
|
+
'router_id': 'fake_resource_id',
|
|
134
|
+
'project_id': _FAKE_PROJECT_ID,
|
|
135
|
+
}
|
|
136
|
+
assoc_attrs.update(attrs)
|
|
137
|
+
return _router_assoc.BgpVpnRouterAssociation(**assoc_attrs)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def create_router_associations(count=1):
|
|
141
|
+
"""Create multiple fake router associations."""
|
|
142
|
+
assocs = []
|
|
143
|
+
for idx in range(count):
|
|
144
|
+
assocs.append(
|
|
145
|
+
{
|
|
146
|
+
'id': f'fake_association_id{idx}',
|
|
147
|
+
'router_id': f'fake_resource_id{idx}',
|
|
148
|
+
'project_id': _FAKE_PROJECT_ID,
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
return assocs
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def create_one_port_association(attrs=None):
|
|
155
|
+
"""Create a fake port association."""
|
|
156
|
+
attrs = attrs or {}
|
|
157
|
+
assoc_attrs = {
|
|
158
|
+
'id': 'fake_association_id',
|
|
159
|
+
'port_id': 'fake_resource_id',
|
|
160
|
+
'project_id': _FAKE_PROJECT_ID,
|
|
161
|
+
'routes': [],
|
|
162
|
+
}
|
|
163
|
+
assoc_attrs.update(attrs)
|
|
164
|
+
return _port_assoc.BgpVpnPortAssociation(**assoc_attrs)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def create_port_associations(count=1):
|
|
168
|
+
"""Create multiple fake port associations."""
|
|
169
|
+
assocs = []
|
|
170
|
+
for idx in range(count):
|
|
171
|
+
assocs.append(
|
|
172
|
+
{
|
|
173
|
+
'id': f'fake_association_id{idx}',
|
|
174
|
+
'port_id': f'fake_resource_id{idx}',
|
|
175
|
+
'project_id': _FAKE_PROJECT_ID,
|
|
176
|
+
'routes': [],
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
return assocs
|