python-openstackclient 9.0.0__py3-none-any.whl → 10.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +59 -43
- 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 +36 -34
- openstackclient/common/pagination.py +50 -6
- openstackclient/common/progressbar.py +7 -6
- openstackclient/common/project_cleanup.py +11 -6
- openstackclient/common/quota.py +105 -103
- 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 +42 -22
- openstackclient/compute/v2/host.py +14 -6
- openstackclient/compute/v2/hypervisor.py +16 -5
- openstackclient/compute/v2/hypervisor_stats.py +10 -2
- openstackclient/compute/v2/keypair.py +35 -16
- openstackclient/compute/v2/server.py +268 -179
- openstackclient/compute/v2/server_backup.py +10 -4
- openstackclient/compute/v2/server_event.py +28 -12
- openstackclient/compute/v2/server_group.py +23 -11
- openstackclient/compute/v2/server_image.py +19 -10
- openstackclient/compute/v2/server_migration.py +27 -10
- openstackclient/compute/v2/server_share.py +274 -0
- openstackclient/compute/v2/server_volume.py +13 -5
- openstackclient/compute/v2/service.py +17 -8
- openstackclient/compute/v2/usage.py +28 -23
- openstackclient/identity/client.py +8 -3
- openstackclient/identity/common.py +82 -47
- 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 +23 -11
- openstackclient/identity/v2_0/token.py +12 -5
- openstackclient/identity/v2_0/user.py +26 -15
- openstackclient/identity/v3/access_rule.py +32 -12
- openstackclient/identity/v3/application_credential.py +66 -24
- openstackclient/identity/v3/catalog.py +14 -7
- openstackclient/identity/v3/consumer.py +22 -11
- openstackclient/identity/v3/credential.py +39 -17
- openstackclient/identity/v3/domain.py +40 -19
- openstackclient/identity/v3/ec2creds.py +25 -12
- openstackclient/identity/v3/endpoint.py +98 -64
- openstackclient/identity/v3/endpoint_group.py +28 -17
- openstackclient/identity/v3/federation_protocol.py +44 -20
- openstackclient/identity/v3/group.py +64 -40
- openstackclient/identity/v3/identity_provider.py +95 -57
- openstackclient/identity/v3/implied_role.py +21 -9
- openstackclient/identity/v3/limit.py +42 -17
- openstackclient/identity/v3/mapping.py +58 -28
- openstackclient/identity/v3/policy.py +23 -12
- openstackclient/identity/v3/project.py +59 -26
- openstackclient/identity/v3/region.py +39 -17
- openstackclient/identity/v3/registered_limit.py +41 -16
- openstackclient/identity/v3/role.py +62 -31
- openstackclient/identity/v3/role_assignment.py +25 -7
- openstackclient/identity/v3/service.py +39 -17
- openstackclient/identity/v3/service_provider.py +40 -16
- openstackclient/identity/v3/tag.py +23 -6
- openstackclient/identity/v3/token.py +30 -14
- openstackclient/identity/v3/trust.py +39 -18
- openstackclient/identity/v3/unscoped_saml.py +10 -2
- openstackclient/identity/v3/user.py +86 -36
- openstackclient/image/client.py +7 -3
- openstackclient/image/v1/image.py +33 -26
- openstackclient/image/v2/cache.py +16 -11
- openstackclient/image/v2/image.py +88 -56
- openstackclient/image/v2/info.py +7 -1
- openstackclient/image/v2/metadef_namespaces.py +117 -20
- openstackclient/image/v2/metadef_objects.py +32 -19
- openstackclient/image/v2/metadef_properties.py +30 -16
- openstackclient/image/v2/metadef_resource_type_association.py +14 -7
- openstackclient/image/v2/metadef_resource_types.py +7 -1
- openstackclient/image/v2/task.py +25 -27
- 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 +27 -54
- openstackclient/network/v2/address_group.py +39 -16
- openstackclient/network/v2/address_scope.py +36 -20
- openstackclient/network/v2/bgpvpn/bgpvpn.py +477 -0
- openstackclient/network/v2/bgpvpn/constants.py +30 -0
- openstackclient/network/v2/bgpvpn/network_association.py +226 -0
- openstackclient/network/v2/bgpvpn/port_association.py +504 -0
- openstackclient/network/v2/bgpvpn/router_association.py +301 -0
- openstackclient/network/v2/default_security_group_rule.py +31 -14
- openstackclient/network/v2/floating_ip.py +121 -162
- openstackclient/network/v2/floating_ip_port_forwarding.py +41 -19
- openstackclient/network/v2/fwaas/__init__.py +0 -0
- openstackclient/network/v2/fwaas/group.py +499 -0
- openstackclient/network/v2/fwaas/policy.py +518 -0
- openstackclient/network/v2/fwaas/rule.py +610 -0
- openstackclient/network/v2/ip_availability.py +25 -8
- openstackclient/network/v2/l3_conntrack_helper.py +35 -13
- openstackclient/network/v2/local_ip.py +27 -13
- openstackclient/network/v2/local_ip_association.py +17 -7
- openstackclient/network/v2/ndp_proxy.py +23 -11
- openstackclient/network/v2/network.py +213 -213
- openstackclient/network/v2/network_agent.py +77 -34
- openstackclient/network/v2/network_auto_allocated_topology.py +27 -15
- openstackclient/network/v2/network_flavor.py +45 -21
- openstackclient/network/v2/network_flavor_profile.py +42 -17
- openstackclient/network/v2/network_meter.py +39 -15
- openstackclient/network/v2/network_meter_rule.py +40 -12
- openstackclient/network/v2/network_qos_policy.py +39 -21
- openstackclient/network/v2/network_qos_rule.py +48 -18
- openstackclient/network/v2/network_qos_rule_type.py +28 -9
- openstackclient/network/v2/network_rbac.py +34 -16
- openstackclient/network/v2/network_segment.py +32 -11
- openstackclient/network/v2/network_segment_range.py +70 -31
- openstackclient/network/v2/network_service_provider.py +7 -1
- openstackclient/network/v2/network_trunk.py +41 -22
- openstackclient/network/v2/port.py +141 -40
- openstackclient/network/v2/router.py +101 -67
- openstackclient/network/v2/security_group.py +97 -198
- openstackclient/network/v2/security_group_rule.py +115 -282
- openstackclient/network/v2/subnet.py +63 -34
- openstackclient/network/v2/subnet_pool.py +42 -24
- openstackclient/network/v2/taas/tap_flow.py +35 -14
- openstackclient/network/v2/taas/tap_mirror.py +28 -14
- openstackclient/network/v2/taas/tap_service.py +26 -12
- openstackclient/object/client.py +7 -2
- openstackclient/object/v1/account.py +13 -6
- openstackclient/object/v1/container.py +28 -16
- openstackclient/object/v1/object.py +28 -16
- 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 +59 -19
- openstackclient/tests/functional/identity/v3/test_application_credential.py +1 -1
- 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_mapping.py +81 -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/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_group.py +163 -0
- openstackclient/tests/functional/volume/v3/test_volume_snapshot.py +11 -7
- 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_limits.py +1 -1
- openstackclient/tests/unit/common/test_module.py +82 -44
- openstackclient/tests/unit/common/test_project_cleanup.py +3 -1
- openstackclient/tests/unit/common/test_quota.py +15 -26
- openstackclient/tests/unit/compute/v2/fakes.py +26 -57
- openstackclient/tests/unit/compute/v2/test_agent.py +4 -4
- openstackclient/tests/unit/compute/v2/test_aggregate.py +1 -1
- openstackclient/tests/unit/compute/v2/test_console.py +2 -2
- openstackclient/tests/unit/compute/v2/test_console_connection.py +1 -1
- openstackclient/tests/unit/compute/v2/test_flavor.py +29 -3
- openstackclient/tests/unit/compute/v2/test_host.py +3 -3
- openstackclient/tests/unit/compute/v2/test_hypervisor.py +2 -2
- openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +1 -1
- openstackclient/tests/unit/compute/v2/test_keypair.py +7 -7
- openstackclient/tests/unit/compute/v2/test_server.py +26 -111
- openstackclient/tests/unit/compute/v2/test_server_backup.py +1 -1
- openstackclient/tests/unit/compute/v2/test_server_event.py +2 -2
- openstackclient/tests/unit/compute/v2/test_server_group.py +1 -1
- openstackclient/tests/unit/compute/v2/test_server_image.py +1 -1
- openstackclient/tests/unit/compute/v2/test_server_migration.py +4 -4
- openstackclient/tests/unit/compute/v2/test_server_share.py +287 -0
- openstackclient/tests/unit/compute/v2/test_server_volume.py +2 -2
- openstackclient/tests/unit/compute/v2/test_service.py +3 -3
- openstackclient/tests/unit/compute/v2/test_usage.py +1 -1
- openstackclient/tests/unit/identity/v2_0/fakes.py +3 -7
- openstackclient/tests/unit/identity/v2_0/test_endpoint.py +1 -1
- openstackclient/tests/unit/identity/v2_0/test_project.py +1 -1
- openstackclient/tests/unit/identity/v2_0/test_role.py +1 -1
- openstackclient/tests/unit/identity/v2_0/test_role_assignment.py +1 -1
- openstackclient/tests/unit/identity/v2_0/test_service.py +1 -1
- openstackclient/tests/unit/identity/v2_0/test_token.py +2 -2
- openstackclient/tests/unit/identity/v2_0/test_user.py +1 -1
- openstackclient/tests/unit/identity/v3/fakes.py +8 -38
- openstackclient/tests/unit/identity/v3/test_access_rule.py +3 -3
- openstackclient/tests/unit/identity/v3/test_application_credential.py +4 -4
- openstackclient/tests/unit/identity/v3/test_credential.py +5 -5
- openstackclient/tests/unit/identity/v3/test_domain.py +5 -5
- openstackclient/tests/unit/identity/v3/test_endpoint.py +6 -6
- openstackclient/tests/unit/identity/v3/test_endpoint_group.py +1 -1
- openstackclient/tests/unit/identity/v3/test_group.py +12 -22
- openstackclient/tests/unit/identity/v3/test_identity_provider.py +303 -299
- openstackclient/tests/unit/identity/v3/test_implied_role.py +1 -1
- openstackclient/tests/unit/identity/v3/test_limit.py +5 -5
- openstackclient/tests/unit/identity/v3/test_mappings.py +163 -79
- openstackclient/tests/unit/identity/v3/test_project.py +28 -5
- openstackclient/tests/unit/identity/v3/test_protocol.py +3 -3
- openstackclient/tests/unit/identity/v3/test_region.py +5 -5
- openstackclient/tests/unit/identity/v3/test_registered_limit.py +5 -5
- openstackclient/tests/unit/identity/v3/test_role.py +8 -8
- openstackclient/tests/unit/identity/v3/test_role_assignment.py +1 -1
- openstackclient/tests/unit/identity/v3/test_service.py +5 -5
- openstackclient/tests/unit/identity/v3/test_token.py +2 -2
- openstackclient/tests/unit/identity/v3/test_trust.py +4 -4
- openstackclient/tests/unit/identity/v3/test_user.py +77 -10
- openstackclient/tests/unit/image/v2/test_image.py +11 -11
- 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/fakes.py +5 -77
- openstackclient/tests/unit/network/v2/fwaas/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/fwaas/test_group.py +923 -0
- openstackclient/tests/unit/network/v2/fwaas/test_policy.py +869 -0
- openstackclient/tests/unit/network/v2/fwaas/test_rule.py +1005 -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 +26 -2
- openstackclient/tests/unit/network/v2/test_address_scope.py +24 -0
- openstackclient/tests/unit/network/v2/{test_floating_ip_network.py → test_floating_ip.py} +27 -2
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +37 -13
- openstackclient/tests/unit/network/v2/test_ip_availability.py +25 -0
- openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py +29 -3
- openstackclient/tests/unit/network/v2/test_network.py +74 -12
- openstackclient/tests/unit/network/v2/test_network_agent.py +58 -5
- openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +3 -3
- openstackclient/tests/unit/network/v2/test_network_flavor.py +26 -2
- openstackclient/tests/unit/network/v2/test_network_flavor_profile.py +24 -0
- openstackclient/tests/unit/network/v2/test_network_meter.py +24 -0
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +25 -1
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +2 -2
- openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +24 -0
- openstackclient/tests/unit/network/v2/test_network_rbac.py +25 -1
- openstackclient/tests/unit/network/v2/test_network_segment.py +25 -1
- openstackclient/tests/unit/network/v2/test_network_segment_range.py +31 -10
- openstackclient/tests/unit/network/v2/test_network_trunk.py +1 -1
- openstackclient/tests/unit/network/v2/test_port.py +166 -0
- openstackclient/tests/unit/network/v2/test_router.py +36 -16
- openstackclient/tests/unit/network/v2/{test_security_group_network.py → test_security_group.py} +11 -8
- openstackclient/tests/unit/network/v2/{test_security_group_rule_network.py → test_security_group_rule.py} +28 -37
- openstackclient/tests/unit/network/v2/test_subnet.py +30 -5
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +26 -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 +21 -140
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +6 -14
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +8 -1
- openstackclient/tests/unit/volume/v2/test_volume_type.py +2 -4
- openstackclient/tests/unit/volume/v3/fakes.py +205 -100
- openstackclient/tests/unit/volume/v3/test_backup_record.py +114 -0
- openstackclient/tests/unit/volume/v3/test_consistency_group.py +720 -0
- openstackclient/tests/unit/volume/v3/test_consistency_group_snapshot.py +354 -0
- openstackclient/tests/unit/volume/v3/test_qos_specs.py +455 -0
- openstackclient/tests/unit/volume/v3/test_volume.py +60 -3
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +3 -1
- openstackclient/tests/unit/volume/v3/test_volume_backend.py +158 -0
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +6 -14
- openstackclient/tests/unit/volume/v3/test_volume_group_type.py +65 -0
- openstackclient/tests/unit/volume/v3/test_volume_host.py +115 -0
- openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +61 -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 +29 -17
- openstackclient/volume/v2/consistency_group_snapshot.py +25 -10
- openstackclient/volume/v2/qos_specs.py +28 -17
- openstackclient/volume/v2/service.py +17 -6
- openstackclient/volume/v2/volume.py +60 -30
- openstackclient/volume/v2/volume_backend.py +19 -6
- openstackclient/volume/v2/volume_backup.py +48 -23
- openstackclient/volume/v2/volume_host.py +6 -4
- openstackclient/volume/v2/volume_snapshot.py +49 -24
- openstackclient/volume/v2/volume_transfer_request.py +31 -13
- openstackclient/volume/v2/volume_type.py +43 -24
- openstackclient/volume/v3/backup_record.py +94 -0
- 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/consistency_group.py +400 -0
- openstackclient/volume/v3/consistency_group_snapshot.py +225 -0
- openstackclient/volume/v3/qos_specs.py +389 -0
- openstackclient/volume/v3/service.py +16 -6
- openstackclient/volume/v3/volume.py +92 -40
- openstackclient/volume/v3/volume_attachment.py +47 -21
- openstackclient/volume/v3/volume_backend.py +130 -0
- openstackclient/volume/v3/volume_backup.py +55 -27
- openstackclient/volume/v3/volume_group.py +23 -13
- openstackclient/volume/v3/volume_group_snapshot.py +34 -17
- openstackclient/volume/v3/volume_group_type.py +27 -14
- openstackclient/volume/v3/volume_host.py +74 -0
- openstackclient/volume/v3/volume_message.py +18 -8
- openstackclient/volume/v3/volume_snapshot.py +70 -32
- openstackclient/volume/v3/volume_transfer_request.py +31 -13
- openstackclient/volume/v3/volume_type.py +42 -24
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/METADATA +7 -8
- python_openstackclient-10.1.0.dist-info/RECORD +524 -0
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/entry_points.txt +77 -25
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/licenses/AUTHORS +9 -0
- python_openstackclient-10.1.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-9.0.0.dist-info/RECORD +0 -499
- python_openstackclient-9.0.0.dist-info/pbr.json +0 -1
- /openstackclient/{tests/functional/image/v1 → network/v2/bgpvpn}/__init__.py +0 -0
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/licenses/LICENSE +0 -0
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/top_level.txt +0 -0
|
@@ -13,12 +13,17 @@
|
|
|
13
13
|
|
|
14
14
|
"""Address scope action implementations"""
|
|
15
15
|
|
|
16
|
+
import argparse
|
|
16
17
|
import logging
|
|
18
|
+
from collections.abc import Iterable, Sequence
|
|
19
|
+
from typing import Any
|
|
17
20
|
|
|
21
|
+
from openstack.network.v2 import address_scope as _address_scope
|
|
18
22
|
from osc_lib import exceptions
|
|
19
23
|
from osc_lib import utils
|
|
20
24
|
|
|
21
25
|
from openstackclient import command
|
|
26
|
+
from openstackclient.common import pagination
|
|
22
27
|
from openstackclient.i18n import _
|
|
23
28
|
from openstackclient.identity import common as identity_common
|
|
24
29
|
from openstackclient.network import common
|
|
@@ -26,7 +31,9 @@ from openstackclient.network import common
|
|
|
26
31
|
LOG = logging.getLogger(__name__)
|
|
27
32
|
|
|
28
33
|
|
|
29
|
-
def _get_columns(
|
|
34
|
+
def _get_columns(
|
|
35
|
+
item: _address_scope.AddressScope,
|
|
36
|
+
) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
|
30
37
|
column_map = {
|
|
31
38
|
'is_shared': 'shared',
|
|
32
39
|
}
|
|
@@ -36,8 +43,10 @@ def _get_columns(item):
|
|
|
36
43
|
)
|
|
37
44
|
|
|
38
45
|
|
|
39
|
-
def _get_attrs(
|
|
40
|
-
|
|
46
|
+
def _get_attrs(
|
|
47
|
+
client_manager: Any, parsed_args: argparse.Namespace
|
|
48
|
+
) -> dict[str, Any]:
|
|
49
|
+
attrs: dict[str, Any] = {}
|
|
41
50
|
attrs['name'] = parsed_args.name
|
|
42
51
|
attrs['ip_version'] = parsed_args.ip_version
|
|
43
52
|
if parsed_args.share:
|
|
@@ -56,12 +65,10 @@ def _get_attrs(client_manager, parsed_args):
|
|
|
56
65
|
return attrs
|
|
57
66
|
|
|
58
67
|
|
|
59
|
-
# TODO(rtheis): Use the SDK resource mapped attribute names once the
|
|
60
|
-
# OSC minimum requirements include SDK 1.0.
|
|
61
68
|
class CreateAddressScope(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
|
62
69
|
_description = _("Create a new Address Scope")
|
|
63
70
|
|
|
64
|
-
def get_parser(self, prog_name):
|
|
71
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
65
72
|
parser = super().get_parser(prog_name)
|
|
66
73
|
parser.add_argument(
|
|
67
74
|
'name', metavar="<name>", help=_("New address scope name")
|
|
@@ -96,7 +103,9 @@ class CreateAddressScope(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
|
|
96
103
|
|
|
97
104
|
return parser
|
|
98
105
|
|
|
99
|
-
def take_action(
|
|
106
|
+
def take_action(
|
|
107
|
+
self, parsed_args: argparse.Namespace
|
|
108
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
100
109
|
client = self.app.client_manager.network
|
|
101
110
|
attrs = _get_attrs(self.app.client_manager, parsed_args)
|
|
102
111
|
attrs.update(
|
|
@@ -112,7 +121,7 @@ class CreateAddressScope(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
|
|
112
121
|
class DeleteAddressScope(command.Command):
|
|
113
122
|
_description = _("Delete address scope(s)")
|
|
114
123
|
|
|
115
|
-
def get_parser(self, prog_name):
|
|
124
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
116
125
|
parser = super().get_parser(prog_name)
|
|
117
126
|
parser.add_argument(
|
|
118
127
|
'address_scope',
|
|
@@ -123,7 +132,7 @@ class DeleteAddressScope(command.Command):
|
|
|
123
132
|
|
|
124
133
|
return parser
|
|
125
134
|
|
|
126
|
-
def take_action(self, parsed_args):
|
|
135
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
127
136
|
client = self.app.client_manager.network
|
|
128
137
|
result = 0
|
|
129
138
|
|
|
@@ -149,12 +158,10 @@ class DeleteAddressScope(command.Command):
|
|
|
149
158
|
raise exceptions.CommandError(msg)
|
|
150
159
|
|
|
151
160
|
|
|
152
|
-
# TODO(yanxing'an): Use the SDK resource mapped attribute names once the
|
|
153
|
-
# OSC minimum requirements include SDK 1.0.
|
|
154
161
|
class ListAddressScope(command.Lister):
|
|
155
162
|
_description = _("List address scopes")
|
|
156
163
|
|
|
157
|
-
def get_parser(self, prog_name):
|
|
164
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
158
165
|
parser = super().get_parser(prog_name)
|
|
159
166
|
|
|
160
167
|
parser.add_argument(
|
|
@@ -182,7 +189,7 @@ class ListAddressScope(command.Lister):
|
|
|
182
189
|
),
|
|
183
190
|
)
|
|
184
191
|
identity_common.add_project_domain_option_to_parser(parser)
|
|
185
|
-
|
|
192
|
+
pagination.add_marker_pagination_option_to_parser(parser)
|
|
186
193
|
shared_group = parser.add_mutually_exclusive_group()
|
|
187
194
|
shared_group.add_argument(
|
|
188
195
|
'--share',
|
|
@@ -194,9 +201,12 @@ class ListAddressScope(command.Lister):
|
|
|
194
201
|
action='store_true',
|
|
195
202
|
help=_("List only address scopes not shared between projects"),
|
|
196
203
|
)
|
|
204
|
+
|
|
197
205
|
return parser
|
|
198
206
|
|
|
199
|
-
def take_action(
|
|
207
|
+
def take_action(
|
|
208
|
+
self, parsed_args: argparse.Namespace
|
|
209
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
200
210
|
client = self.app.client_manager.network
|
|
201
211
|
columns = (
|
|
202
212
|
'id',
|
|
@@ -229,6 +239,12 @@ class ListAddressScope(command.Lister):
|
|
|
229
239
|
parsed_args.project_domain,
|
|
230
240
|
).id
|
|
231
241
|
attrs['project_id'] = project_id
|
|
242
|
+
if parsed_args.marker is not None:
|
|
243
|
+
attrs['marker'] = parsed_args.marker
|
|
244
|
+
if parsed_args.limit is not None:
|
|
245
|
+
attrs['limit'] = parsed_args.limit
|
|
246
|
+
if parsed_args.max_items is not None:
|
|
247
|
+
attrs['max_items'] = parsed_args.max_items
|
|
232
248
|
data = client.address_scopes(**attrs)
|
|
233
249
|
|
|
234
250
|
return (
|
|
@@ -244,12 +260,10 @@ class ListAddressScope(command.Lister):
|
|
|
244
260
|
)
|
|
245
261
|
|
|
246
262
|
|
|
247
|
-
# TODO(rtheis): Use the SDK resource mapped attribute names once the
|
|
248
|
-
# OSC minimum requirements include SDK 1.0.
|
|
249
263
|
class SetAddressScope(common.NeutronCommandWithExtraArgs):
|
|
250
264
|
_description = _("Set address scope properties")
|
|
251
265
|
|
|
252
|
-
def get_parser(self, prog_name):
|
|
266
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
253
267
|
parser = super().get_parser(prog_name)
|
|
254
268
|
parser.add_argument(
|
|
255
269
|
'address_scope',
|
|
@@ -273,7 +287,7 @@ class SetAddressScope(common.NeutronCommandWithExtraArgs):
|
|
|
273
287
|
|
|
274
288
|
return parser
|
|
275
289
|
|
|
276
|
-
def take_action(self, parsed_args):
|
|
290
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
277
291
|
client = self.app.client_manager.network
|
|
278
292
|
obj = client.find_address_scope(
|
|
279
293
|
parsed_args.address_scope, ignore_missing=False
|
|
@@ -294,7 +308,7 @@ class SetAddressScope(common.NeutronCommandWithExtraArgs):
|
|
|
294
308
|
class ShowAddressScope(command.ShowOne):
|
|
295
309
|
_description = _("Display address scope details")
|
|
296
310
|
|
|
297
|
-
def get_parser(self, prog_name):
|
|
311
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
298
312
|
parser = super().get_parser(prog_name)
|
|
299
313
|
parser.add_argument(
|
|
300
314
|
'address_scope',
|
|
@@ -304,7 +318,9 @@ class ShowAddressScope(command.ShowOne):
|
|
|
304
318
|
|
|
305
319
|
return parser
|
|
306
320
|
|
|
307
|
-
def take_action(
|
|
321
|
+
def take_action(
|
|
322
|
+
self, parsed_args: argparse.Namespace
|
|
323
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
308
324
|
client = self.app.client_manager.network
|
|
309
325
|
obj = client.find_address_scope(
|
|
310
326
|
parsed_args.address_scope, ignore_missing=False
|
|
@@ -0,0 +1,477 @@
|
|
|
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
|
+
import argparse
|
|
17
|
+
from collections.abc import Iterable, Sequence
|
|
18
|
+
import logging
|
|
19
|
+
from typing import Any
|
|
20
|
+
|
|
21
|
+
from openstack.network.v2 import bgpvpn as _bgpvpn
|
|
22
|
+
from osc_lib.cli import format_columns
|
|
23
|
+
from osc_lib.cli import identity as osc_id
|
|
24
|
+
from osc_lib.cli.parseractions import KeyValueAction
|
|
25
|
+
from osc_lib import exceptions
|
|
26
|
+
from osc_lib import utils as osc_utils
|
|
27
|
+
from osc_lib.utils import columns as column_util
|
|
28
|
+
|
|
29
|
+
from openstackclient import command
|
|
30
|
+
from openstackclient.i18n import _
|
|
31
|
+
|
|
32
|
+
LOG = logging.getLogger(__name__)
|
|
33
|
+
|
|
34
|
+
_attr_map = (
|
|
35
|
+
('id', 'ID', column_util.LIST_BOTH),
|
|
36
|
+
('project_id', 'Project', column_util.LIST_LONG_ONLY),
|
|
37
|
+
('name', 'Name', column_util.LIST_BOTH),
|
|
38
|
+
('type', 'Type', column_util.LIST_BOTH),
|
|
39
|
+
('route_targets', 'Route Targets', column_util.LIST_LONG_ONLY),
|
|
40
|
+
('import_targets', 'Import Targets', column_util.LIST_LONG_ONLY),
|
|
41
|
+
('export_targets', 'Export Targets', column_util.LIST_LONG_ONLY),
|
|
42
|
+
(
|
|
43
|
+
'route_distinguishers',
|
|
44
|
+
'Route Distinguishers',
|
|
45
|
+
column_util.LIST_LONG_ONLY,
|
|
46
|
+
),
|
|
47
|
+
('networks', 'Associated Networks', column_util.LIST_LONG_ONLY),
|
|
48
|
+
('routers', 'Associated Routers', column_util.LIST_LONG_ONLY),
|
|
49
|
+
('ports', 'Associated Ports', column_util.LIST_LONG_ONLY),
|
|
50
|
+
('vni', 'VNI', column_util.LIST_LONG_ONLY),
|
|
51
|
+
('local_pref', 'Local Pref', column_util.LIST_LONG_ONLY),
|
|
52
|
+
)
|
|
53
|
+
_formatters = {
|
|
54
|
+
'route_targets': format_columns.ListColumn,
|
|
55
|
+
'import_targets': format_columns.ListColumn,
|
|
56
|
+
'export_targets': format_columns.ListColumn,
|
|
57
|
+
'route_distinguishers': format_columns.ListColumn,
|
|
58
|
+
'networks': format_columns.ListColumn,
|
|
59
|
+
'routers': format_columns.ListColumn,
|
|
60
|
+
'ports': format_columns.ListColumn,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _get_columns(
|
|
65
|
+
item: _bgpvpn.BgpVpn,
|
|
66
|
+
) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
|
67
|
+
column_map: dict[str, str] = {}
|
|
68
|
+
hidden_columns = ['location', 'tenant_id']
|
|
69
|
+
return osc_utils.get_osc_show_columns_for_sdk_resource(
|
|
70
|
+
item, column_map, hidden_columns
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _get_common_parser(
|
|
75
|
+
parser: argparse.ArgumentParser, update: str | None = None
|
|
76
|
+
) -> None:
|
|
77
|
+
"""Adds to parser arguments common to create, set and unset commands.
|
|
78
|
+
|
|
79
|
+
:params ArgumentParser parser: argparse object contains all command's
|
|
80
|
+
arguments
|
|
81
|
+
:params string update: Determines if it is a create command (value: None),
|
|
82
|
+
it is a set command (value: 'set') or if it is an unset command (value:
|
|
83
|
+
'unset')
|
|
84
|
+
"""
|
|
85
|
+
ADD_RT = _("Add Route Target to import/export list")
|
|
86
|
+
REMOVE_RT = _("Remove Route Target from import/export list")
|
|
87
|
+
ADD_IMPORT_RT = _("Add Route Target to import list")
|
|
88
|
+
DEL_IMPORT_RT = _("Remove Route Target from import list")
|
|
89
|
+
ADD_EXPORT_RT = _("Add Route Target to export list")
|
|
90
|
+
DEL_EXPORT_RT = _("Remove Route Target from export list")
|
|
91
|
+
ADD_RD = _(
|
|
92
|
+
"Add Route Distinguisher to the list of Route Distinguishers "
|
|
93
|
+
"from which a Route Distinguishers will be picked from to "
|
|
94
|
+
"advertise a VPN route"
|
|
95
|
+
)
|
|
96
|
+
REMOVE_RD = _(
|
|
97
|
+
"Remove Route Distinguisher from the list of Route "
|
|
98
|
+
"Distinguishers from which a Route Distinguishers will be "
|
|
99
|
+
"picked from to advertise a VPN route"
|
|
100
|
+
)
|
|
101
|
+
REPEAT_RT = _("repeat option for multiple Route Targets")
|
|
102
|
+
REPEAT_RD = _("repeat option for multiple Route Distinguishers")
|
|
103
|
+
|
|
104
|
+
def is_appended() -> bool:
|
|
105
|
+
return update is None or update == 'set'
|
|
106
|
+
|
|
107
|
+
if update is None or update == 'set':
|
|
108
|
+
parser.add_argument(
|
|
109
|
+
'--name',
|
|
110
|
+
metavar="<name>",
|
|
111
|
+
help=_("Name of the BGP VPN"),
|
|
112
|
+
)
|
|
113
|
+
parser.add_argument(
|
|
114
|
+
'--route-target',
|
|
115
|
+
dest='route_targets',
|
|
116
|
+
action='append',
|
|
117
|
+
metavar="<route-target>",
|
|
118
|
+
help=f"{ADD_RT if is_appended() else REMOVE_RT} ({REPEAT_RT})",
|
|
119
|
+
)
|
|
120
|
+
if update:
|
|
121
|
+
parser.add_argument(
|
|
122
|
+
'--no-route-target' if update == 'set' else '--all-route-target',
|
|
123
|
+
dest='purge_route_target',
|
|
124
|
+
action='store_true',
|
|
125
|
+
help=_('Empty route target list'),
|
|
126
|
+
)
|
|
127
|
+
import_target_action = ADD_IMPORT_RT if is_appended() else DEL_IMPORT_RT
|
|
128
|
+
parser.add_argument(
|
|
129
|
+
'--import-target',
|
|
130
|
+
dest='import_targets',
|
|
131
|
+
action='append',
|
|
132
|
+
metavar="<import-target>",
|
|
133
|
+
help=f"{import_target_action} ({REPEAT_RT})",
|
|
134
|
+
)
|
|
135
|
+
if update:
|
|
136
|
+
parser.add_argument(
|
|
137
|
+
'--no-import-target' if update == 'set' else '--all-import-target',
|
|
138
|
+
dest='purge_import_target',
|
|
139
|
+
action='store_true',
|
|
140
|
+
help=_('Empty import route target list'),
|
|
141
|
+
)
|
|
142
|
+
export_target_action = ADD_EXPORT_RT if is_appended() else DEL_EXPORT_RT
|
|
143
|
+
parser.add_argument(
|
|
144
|
+
'--export-target',
|
|
145
|
+
dest='export_targets',
|
|
146
|
+
action='append',
|
|
147
|
+
metavar="<export-target>",
|
|
148
|
+
help=f"{export_target_action} ({REPEAT_RT})",
|
|
149
|
+
)
|
|
150
|
+
if update:
|
|
151
|
+
parser.add_argument(
|
|
152
|
+
'--no-export-target' if update == 'set' else '--all-export-target',
|
|
153
|
+
dest='purge_export_target',
|
|
154
|
+
action='store_true',
|
|
155
|
+
help=_('Empty export route target list'),
|
|
156
|
+
)
|
|
157
|
+
parser.add_argument(
|
|
158
|
+
'--route-distinguisher',
|
|
159
|
+
dest='route_distinguishers',
|
|
160
|
+
action='append',
|
|
161
|
+
metavar="<route-distinguisher>",
|
|
162
|
+
help=f"{ADD_RD if is_appended() else REMOVE_RD} ({REPEAT_RD})",
|
|
163
|
+
)
|
|
164
|
+
if update:
|
|
165
|
+
parser.add_argument(
|
|
166
|
+
'--no-route-distinguisher'
|
|
167
|
+
if update == 'set'
|
|
168
|
+
else '--all-route-distinguisher',
|
|
169
|
+
dest='purge_route_distinguisher',
|
|
170
|
+
action='store_true',
|
|
171
|
+
help=_('Empty route distinguisher list'),
|
|
172
|
+
)
|
|
173
|
+
parser.add_argument(
|
|
174
|
+
'--vni',
|
|
175
|
+
type=int,
|
|
176
|
+
help=_(
|
|
177
|
+
'VXLAN Network Identifier to be used for this BGPVPN '
|
|
178
|
+
'when a VXLAN encapsulation is used'
|
|
179
|
+
),
|
|
180
|
+
)
|
|
181
|
+
parser.add_argument(
|
|
182
|
+
'--local-pref',
|
|
183
|
+
type=int,
|
|
184
|
+
dest='local_pref',
|
|
185
|
+
help=_(
|
|
186
|
+
'Default BGP LOCAL_PREF to use in route advertisements'
|
|
187
|
+
'towards this BGPVPN.'
|
|
188
|
+
),
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def _args2body(
|
|
193
|
+
client_manager: Any, id: str, action: str, args: argparse.Namespace
|
|
194
|
+
) -> dict[str, Any]:
|
|
195
|
+
|
|
196
|
+
if not (
|
|
197
|
+
args.purge_route_target
|
|
198
|
+
and args.purge_import_target
|
|
199
|
+
and args.purge_export_target
|
|
200
|
+
and args.purge_route_distinguisher
|
|
201
|
+
) and (
|
|
202
|
+
args.route_targets
|
|
203
|
+
or args.import_targets
|
|
204
|
+
or args.export_targets
|
|
205
|
+
or args.route_distinguishers
|
|
206
|
+
):
|
|
207
|
+
bgpvpn = client_manager.network.get_bgpvpn(id)
|
|
208
|
+
|
|
209
|
+
attrs: dict[str, Any] = {}
|
|
210
|
+
|
|
211
|
+
if 'name' in args and args.name is not None:
|
|
212
|
+
attrs['name'] = str(args.name)
|
|
213
|
+
|
|
214
|
+
if 'vni' in args and args.vni is not None:
|
|
215
|
+
attrs['vni'] = args.vni
|
|
216
|
+
|
|
217
|
+
if 'local_pref' in args and args.local_pref is not None:
|
|
218
|
+
attrs['local_pref'] = args.local_pref
|
|
219
|
+
|
|
220
|
+
if args.purge_route_target:
|
|
221
|
+
attrs['route_targets'] = []
|
|
222
|
+
elif args.route_targets:
|
|
223
|
+
if action == 'set':
|
|
224
|
+
attrs['route_targets'] = list(
|
|
225
|
+
set(bgpvpn['route_targets']) | set(args.route_targets)
|
|
226
|
+
)
|
|
227
|
+
elif action == 'unset':
|
|
228
|
+
attrs['route_targets'] = list(
|
|
229
|
+
set(bgpvpn['route_targets']) - set(args.route_targets)
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
if args.purge_import_target:
|
|
233
|
+
attrs['import_targets'] = []
|
|
234
|
+
elif args.import_targets:
|
|
235
|
+
if action == 'set':
|
|
236
|
+
attrs['import_targets'] = list(
|
|
237
|
+
set(bgpvpn['import_targets']) | set(args.import_targets)
|
|
238
|
+
)
|
|
239
|
+
elif action == 'unset':
|
|
240
|
+
attrs['import_targets'] = list(
|
|
241
|
+
set(bgpvpn['import_targets']) - set(args.import_targets)
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
if args.purge_export_target:
|
|
245
|
+
attrs['export_targets'] = []
|
|
246
|
+
elif args.export_targets:
|
|
247
|
+
if action == 'set':
|
|
248
|
+
attrs['export_targets'] = list(
|
|
249
|
+
set(bgpvpn['export_targets']) | set(args.export_targets)
|
|
250
|
+
)
|
|
251
|
+
elif action == 'unset':
|
|
252
|
+
attrs['export_targets'] = list(
|
|
253
|
+
set(bgpvpn['export_targets']) - set(args.export_targets)
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
if args.purge_route_distinguisher:
|
|
257
|
+
attrs['route_distinguishers'] = []
|
|
258
|
+
elif args.route_distinguishers:
|
|
259
|
+
if action == 'set':
|
|
260
|
+
attrs['route_distinguishers'] = list(
|
|
261
|
+
set(bgpvpn['route_distinguishers'])
|
|
262
|
+
| set(args.route_distinguishers)
|
|
263
|
+
)
|
|
264
|
+
elif action == 'unset':
|
|
265
|
+
attrs['route_distinguishers'] = list(
|
|
266
|
+
set(bgpvpn['route_distinguishers'])
|
|
267
|
+
- set(args.route_distinguishers)
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
return attrs
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
class CreateBgpvpn(command.ShowOne):
|
|
274
|
+
_description = _("Create BGP VPN resource")
|
|
275
|
+
|
|
276
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
277
|
+
parser = super().get_parser(prog_name)
|
|
278
|
+
osc_id.add_project_owner_option_to_parser(parser)
|
|
279
|
+
_get_common_parser(parser)
|
|
280
|
+
parser.add_argument(
|
|
281
|
+
'--type',
|
|
282
|
+
default='l3',
|
|
283
|
+
choices=['l2', 'l3'],
|
|
284
|
+
help=_(
|
|
285
|
+
"BGP VPN type selection between IP VPN (l3) and Ethernet "
|
|
286
|
+
"VPN (l2) (default: l3)"
|
|
287
|
+
),
|
|
288
|
+
)
|
|
289
|
+
return parser
|
|
290
|
+
|
|
291
|
+
def take_action(
|
|
292
|
+
self, parsed_args: argparse.Namespace
|
|
293
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
294
|
+
client = self.app.client_manager.network
|
|
295
|
+
attrs = {}
|
|
296
|
+
if parsed_args.name is not None:
|
|
297
|
+
attrs['name'] = str(parsed_args.name)
|
|
298
|
+
if parsed_args.type is not None:
|
|
299
|
+
attrs['type'] = parsed_args.type
|
|
300
|
+
if parsed_args.route_targets is not None:
|
|
301
|
+
attrs['route_targets'] = parsed_args.route_targets
|
|
302
|
+
if parsed_args.import_targets is not None:
|
|
303
|
+
attrs['import_targets'] = parsed_args.import_targets
|
|
304
|
+
if parsed_args.export_targets is not None:
|
|
305
|
+
attrs['export_targets'] = parsed_args.export_targets
|
|
306
|
+
if parsed_args.route_distinguishers is not None:
|
|
307
|
+
attrs['route_distinguishers'] = parsed_args.route_distinguishers
|
|
308
|
+
if parsed_args.vni is not None:
|
|
309
|
+
attrs['vni'] = parsed_args.vni
|
|
310
|
+
if parsed_args.local_pref is not None:
|
|
311
|
+
attrs['local_pref'] = parsed_args.local_pref
|
|
312
|
+
if 'project' in parsed_args and parsed_args.project is not None:
|
|
313
|
+
project_id = osc_id.find_project(
|
|
314
|
+
self.app.client_manager.sdk_connection,
|
|
315
|
+
parsed_args.project,
|
|
316
|
+
parsed_args.project_domain,
|
|
317
|
+
).id
|
|
318
|
+
attrs['project_id'] = project_id
|
|
319
|
+
obj = client.create_bgpvpn(**attrs)
|
|
320
|
+
display_columns, columns = _get_columns(obj)
|
|
321
|
+
data = osc_utils.get_dict_properties(
|
|
322
|
+
obj, columns, formatters=_formatters
|
|
323
|
+
)
|
|
324
|
+
return display_columns, data
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
class SetBgpvpn(command.Command):
|
|
328
|
+
_description = _("Set BGP VPN properties")
|
|
329
|
+
|
|
330
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
331
|
+
parser = super().get_parser(prog_name)
|
|
332
|
+
parser.add_argument(
|
|
333
|
+
'bgpvpn',
|
|
334
|
+
metavar="<bgpvpn>",
|
|
335
|
+
help=_("BGP VPN to update (name or ID)"),
|
|
336
|
+
)
|
|
337
|
+
_get_common_parser(parser, update='set')
|
|
338
|
+
return parser
|
|
339
|
+
|
|
340
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
341
|
+
client = self.app.client_manager.network
|
|
342
|
+
id = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)['id']
|
|
343
|
+
body = _args2body(self.app.client_manager, id, 'set', parsed_args)
|
|
344
|
+
client.update_bgpvpn(id, **body)
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
class UnsetBgpvpn(command.Command):
|
|
348
|
+
_description = _("Unset BGP VPN properties")
|
|
349
|
+
|
|
350
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
351
|
+
parser = super().get_parser(prog_name)
|
|
352
|
+
parser.add_argument(
|
|
353
|
+
'bgpvpn',
|
|
354
|
+
metavar="<bgpvpn>",
|
|
355
|
+
help=_("BGP VPN to update (name or ID)"),
|
|
356
|
+
)
|
|
357
|
+
_get_common_parser(parser, update='unset')
|
|
358
|
+
return parser
|
|
359
|
+
|
|
360
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
361
|
+
client = self.app.client_manager.network
|
|
362
|
+
id = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)['id']
|
|
363
|
+
body = _args2body(self.app.client_manager, id, 'unset', parsed_args)
|
|
364
|
+
client.update_bgpvpn(id, **body)
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
class DeleteBgpvpn(command.Command):
|
|
368
|
+
_description = _("Delete BGP VPN resource(s)")
|
|
369
|
+
|
|
370
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
371
|
+
parser = super().get_parser(prog_name)
|
|
372
|
+
parser.add_argument(
|
|
373
|
+
'bgpvpns',
|
|
374
|
+
metavar="<bgpvpn>",
|
|
375
|
+
nargs="+",
|
|
376
|
+
help=_("BGP VPN(s) to delete (name or ID)"),
|
|
377
|
+
)
|
|
378
|
+
return parser
|
|
379
|
+
|
|
380
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
381
|
+
client = self.app.client_manager.network
|
|
382
|
+
fails = 0
|
|
383
|
+
for id_or_name in parsed_args.bgpvpns:
|
|
384
|
+
try:
|
|
385
|
+
id = client.find_bgpvpn(id_or_name, ignore_missing=False)['id']
|
|
386
|
+
client.delete_bgpvpn(id)
|
|
387
|
+
LOG.warning("BGP VPN %(id)s deleted", {'id': id})
|
|
388
|
+
except Exception as e:
|
|
389
|
+
fails += 1
|
|
390
|
+
LOG.error(
|
|
391
|
+
"Failed to delete BGP VPN with name or ID "
|
|
392
|
+
"'%(id_or_name)s': %(e)s",
|
|
393
|
+
{'id_or_name': id_or_name, 'e': e},
|
|
394
|
+
)
|
|
395
|
+
if fails > 0:
|
|
396
|
+
msg = _("Failed to delete %(fails)s of %(total)s BGP VPN.") % {
|
|
397
|
+
'fails': fails,
|
|
398
|
+
'total': len(parsed_args.bgpvpns),
|
|
399
|
+
}
|
|
400
|
+
raise exceptions.CommandError(msg)
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
class ListBgpvpn(command.Lister):
|
|
404
|
+
_description = _("List BGP VPN resources")
|
|
405
|
+
|
|
406
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
407
|
+
parser = super().get_parser(prog_name)
|
|
408
|
+
osc_id.add_project_owner_option_to_parser(parser)
|
|
409
|
+
parser.add_argument(
|
|
410
|
+
'--long',
|
|
411
|
+
action='store_true',
|
|
412
|
+
help=_("List additional fields in output"),
|
|
413
|
+
)
|
|
414
|
+
parser.add_argument(
|
|
415
|
+
'--property',
|
|
416
|
+
metavar="<key=value>",
|
|
417
|
+
default=dict(),
|
|
418
|
+
help=_(
|
|
419
|
+
"Filter property to apply on returned BGP VPNs (repeat to "
|
|
420
|
+
"filter on multiple properties)"
|
|
421
|
+
),
|
|
422
|
+
action=KeyValueAction,
|
|
423
|
+
)
|
|
424
|
+
return parser
|
|
425
|
+
|
|
426
|
+
def take_action(
|
|
427
|
+
self, parsed_args: argparse.Namespace
|
|
428
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
429
|
+
client = self.app.client_manager.network
|
|
430
|
+
params = {}
|
|
431
|
+
if parsed_args.project is not None:
|
|
432
|
+
project_id = osc_id.find_project(
|
|
433
|
+
self.app.client_manager.sdk_connection,
|
|
434
|
+
parsed_args.project,
|
|
435
|
+
parsed_args.project_domain,
|
|
436
|
+
).id
|
|
437
|
+
params['project_id'] = project_id
|
|
438
|
+
if parsed_args.property:
|
|
439
|
+
params.update(parsed_args.property)
|
|
440
|
+
objs = client.bgpvpns(**params)
|
|
441
|
+
headers, columns = column_util.get_column_definitions(
|
|
442
|
+
list(_attr_map), long_listing=parsed_args.long
|
|
443
|
+
)
|
|
444
|
+
return (
|
|
445
|
+
headers,
|
|
446
|
+
(
|
|
447
|
+
osc_utils.get_dict_properties(
|
|
448
|
+
s, columns, formatters=_formatters
|
|
449
|
+
)
|
|
450
|
+
for s in objs
|
|
451
|
+
),
|
|
452
|
+
)
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
class ShowBgpvpn(command.ShowOne):
|
|
456
|
+
_description = _("Show information of a given BGP VPN")
|
|
457
|
+
|
|
458
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
459
|
+
parser = super().get_parser(prog_name)
|
|
460
|
+
parser.add_argument(
|
|
461
|
+
'bgpvpn',
|
|
462
|
+
metavar="<bgpvpn>",
|
|
463
|
+
help=_("BGP VPN to display (name or ID)"),
|
|
464
|
+
)
|
|
465
|
+
return parser
|
|
466
|
+
|
|
467
|
+
def take_action(
|
|
468
|
+
self, parsed_args: argparse.Namespace
|
|
469
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
470
|
+
client = self.app.client_manager.network
|
|
471
|
+
id = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)['id']
|
|
472
|
+
obj = client.get_bgpvpn(id)
|
|
473
|
+
display_columns, columns = _get_columns(obj)
|
|
474
|
+
data = osc_utils.get_dict_properties(
|
|
475
|
+
obj, columns, formatters=_formatters
|
|
476
|
+
)
|
|
477
|
+
return display_columns, data
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
BGPVPN = 'bgpvpn'
|
|
18
|
+
BGPVPNS = f'{BGPVPN}s'
|
|
19
|
+
|
|
20
|
+
NETWORK_RESOURCE_NAME = 'network'
|
|
21
|
+
NETWORK_ASSOCIATION = f'{NETWORK_RESOURCE_NAME}_association'
|
|
22
|
+
NETWORK_ASSOCIATIONS = f'{NETWORK_ASSOCIATION}s'
|
|
23
|
+
|
|
24
|
+
ROUTER_RESOURCE_NAME = 'router'
|
|
25
|
+
ROUTER_ASSOCIATION = f'{ROUTER_RESOURCE_NAME}_association'
|
|
26
|
+
ROUTER_ASSOCIATIONS = f'{ROUTER_ASSOCIATION}s'
|
|
27
|
+
|
|
28
|
+
PORT_RESOURCE_NAME = 'port'
|
|
29
|
+
PORT_ASSOCIATION = f'{PORT_RESOURCE_NAME}_association'
|
|
30
|
+
PORT_ASSOCIATIONS = f'{PORT_ASSOCIATION}s'
|