python-openstackclient 9.0.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 +97 -99
- 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 +249 -169
- 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 +78 -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 +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 +38 -16
- 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 +38 -16
- openstackclient/identity/v3/mapping.py +26 -13
- openstackclient/identity/v3/policy.py +23 -12
- openstackclient/identity/v3/project.py +43 -23
- openstackclient/identity/v3/region.py +36 -16
- openstackclient/identity/v3/registered_limit.py +40 -16
- 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 -6
- 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 +74 -48
- 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_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_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_module.py +12 -7
- openstackclient/tests/unit/common/test_project_cleanup.py +3 -1
- openstackclient/tests/unit/common/test_quota.py +6 -26
- 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 +11 -96
- 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_user.py +4 -4
- 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/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_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 +60 -3
- 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 +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 +57 -29
- openstackclient/volume/v2/volume_backend.py +19 -6
- openstackclient/volume/v2/volume_backup.py +46 -20
- openstackclient/volume/v2/volume_host.py +6 -4
- openstackclient/volume/v2/volume_snapshot.py +50 -24
- openstackclient/volume/v2/volume_transfer_request.py +31 -13
- openstackclient/volume/v2/volume_type.py +43 -24
- 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 +89 -39
- openstackclient/volume/v3/volume_attachment.py +43 -21
- openstackclient/volume/v3/volume_backup.py +53 -24
- 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 +69 -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.0.0.dist-info}/METADATA +6 -6
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/RECORD +271 -260
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/entry_points.txt +53 -1
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/licenses/AUTHORS +4 -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-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.0.0.dist-info}/licenses/LICENSE +0 -0
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/top_level.txt +0 -0
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
"""Network agent 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
|
|
|
18
21
|
from cliff import columns as cliff_columns
|
|
19
22
|
from osc_lib.cli import format_columns
|
|
@@ -27,12 +30,12 @@ LOG = logging.getLogger(__name__)
|
|
|
27
30
|
|
|
28
31
|
|
|
29
32
|
class AliveColumn(cliff_columns.FormattableColumn[bool]):
|
|
30
|
-
def human_readable(self):
|
|
33
|
+
def human_readable(self) -> str:
|
|
31
34
|
return ":-)" if self._value else "XXX"
|
|
32
35
|
|
|
33
36
|
|
|
34
37
|
class AdminStateColumn(cliff_columns.FormattableColumn[bool]):
|
|
35
|
-
def human_readable(self):
|
|
38
|
+
def human_readable(self) -> str:
|
|
36
39
|
return 'UP' if self._value else 'DOWN'
|
|
37
40
|
|
|
38
41
|
|
|
@@ -45,21 +48,35 @@ _formatters = {
|
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
|
|
48
|
-
def _get_network_columns(item):
|
|
49
|
-
|
|
50
|
-
'
|
|
51
|
-
'
|
|
51
|
+
def _get_network_columns(item: Any) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
|
52
|
+
column_data_mapping = {
|
|
53
|
+
'admin_state_up': 'is_admin_state_up',
|
|
54
|
+
'agent_type': 'agent_type',
|
|
55
|
+
'alive': 'is_alive',
|
|
56
|
+
'availability_zone': 'availability_zone',
|
|
57
|
+
'binary': 'binary',
|
|
58
|
+
'configuration': 'configuration',
|
|
59
|
+
'created_at': 'created_at',
|
|
60
|
+
'description': 'description',
|
|
61
|
+
'ha_chassis_priority': 'ha_chassis_priority',
|
|
62
|
+
'ha_state': 'ha_state',
|
|
63
|
+
'host': 'host',
|
|
64
|
+
'id': 'id',
|
|
65
|
+
'last_heartbeat_at': 'last_heartbeat_at',
|
|
66
|
+
'resources_synced': 'resources_synced',
|
|
67
|
+
'started_at': 'started_at',
|
|
68
|
+
'topic': 'topic',
|
|
52
69
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
70
|
+
return (
|
|
71
|
+
tuple(column_data_mapping.keys()),
|
|
72
|
+
tuple(column_data_mapping.values()),
|
|
56
73
|
)
|
|
57
74
|
|
|
58
75
|
|
|
59
76
|
class AddNetworkToAgent(command.Command):
|
|
60
77
|
_description = _("Add network to an agent")
|
|
61
78
|
|
|
62
|
-
def get_parser(self, prog_name):
|
|
79
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
63
80
|
parser = super().get_parser(prog_name)
|
|
64
81
|
parser.add_argument(
|
|
65
82
|
'--dhcp',
|
|
@@ -79,7 +96,7 @@ class AddNetworkToAgent(command.Command):
|
|
|
79
96
|
|
|
80
97
|
return parser
|
|
81
98
|
|
|
82
|
-
def take_action(self, parsed_args):
|
|
99
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
83
100
|
client = self.app.client_manager.network
|
|
84
101
|
agent = client.get_agent(parsed_args.agent_id)
|
|
85
102
|
network = client.find_network(
|
|
@@ -96,7 +113,7 @@ class AddNetworkToAgent(command.Command):
|
|
|
96
113
|
class AddRouterToAgent(command.Command):
|
|
97
114
|
_description = _("Add router to an agent")
|
|
98
115
|
|
|
99
|
-
def get_parser(self, prog_name):
|
|
116
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
100
117
|
parser = super().get_parser(prog_name)
|
|
101
118
|
parser.add_argument(
|
|
102
119
|
'--l3', action='store_true', help=_('Add router to an L3 agent')
|
|
@@ -114,7 +131,7 @@ class AddRouterToAgent(command.Command):
|
|
|
114
131
|
|
|
115
132
|
return parser
|
|
116
133
|
|
|
117
|
-
def take_action(self, parsed_args):
|
|
134
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
118
135
|
client = self.app.client_manager.network
|
|
119
136
|
agent = client.get_agent(parsed_args.agent_id)
|
|
120
137
|
router = client.find_router(parsed_args.router, ignore_missing=False)
|
|
@@ -125,7 +142,7 @@ class AddRouterToAgent(command.Command):
|
|
|
125
142
|
class DeleteNetworkAgent(command.Command):
|
|
126
143
|
_description = _("Delete network agent(s)")
|
|
127
144
|
|
|
128
|
-
def get_parser(self, prog_name):
|
|
145
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
129
146
|
parser = super().get_parser(prog_name)
|
|
130
147
|
parser.add_argument(
|
|
131
148
|
'network_agent',
|
|
@@ -135,7 +152,7 @@ class DeleteNetworkAgent(command.Command):
|
|
|
135
152
|
)
|
|
136
153
|
return parser
|
|
137
154
|
|
|
138
|
-
def take_action(self, parsed_args):
|
|
155
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
139
156
|
client = self.app.client_manager.network
|
|
140
157
|
result = 0
|
|
141
158
|
|
|
@@ -183,7 +200,7 @@ class ListNetworkAgent(command.Lister):
|
|
|
183
200
|
'ovn-agent': 'OVN Neutron agent',
|
|
184
201
|
}
|
|
185
202
|
|
|
186
|
-
def get_parser(self, prog_name):
|
|
203
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
187
204
|
parser = super().get_parser(prog_name)
|
|
188
205
|
supported_agents = ','.join(self._supported_agents.keys())
|
|
189
206
|
parser.add_argument(
|
|
@@ -221,7 +238,9 @@ class ListNetworkAgent(command.Lister):
|
|
|
221
238
|
|
|
222
239
|
return parser
|
|
223
240
|
|
|
224
|
-
def take_action(
|
|
241
|
+
def take_action(
|
|
242
|
+
self, parsed_args: argparse.Namespace
|
|
243
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
225
244
|
client = self.app.client_manager.network
|
|
226
245
|
columns: tuple[str, ...] = (
|
|
227
246
|
'id',
|
|
@@ -282,7 +301,7 @@ class ListNetworkAgent(command.Lister):
|
|
|
282
301
|
class RemoveNetworkFromAgent(command.Command):
|
|
283
302
|
_description = _("Remove network from an agent.")
|
|
284
303
|
|
|
285
|
-
def get_parser(self, prog_name):
|
|
304
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
286
305
|
parser = super().get_parser(prog_name)
|
|
287
306
|
parser.add_argument(
|
|
288
307
|
'--dhcp',
|
|
@@ -301,7 +320,7 @@ class RemoveNetworkFromAgent(command.Command):
|
|
|
301
320
|
)
|
|
302
321
|
return parser
|
|
303
322
|
|
|
304
|
-
def take_action(self, parsed_args):
|
|
323
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
305
324
|
client = self.app.client_manager.network
|
|
306
325
|
agent = client.get_agent(parsed_args.agent_id)
|
|
307
326
|
network = client.find_network(
|
|
@@ -318,7 +337,7 @@ class RemoveNetworkFromAgent(command.Command):
|
|
|
318
337
|
class RemoveRouterFromAgent(command.Command):
|
|
319
338
|
_description = _("Remove router from an agent")
|
|
320
339
|
|
|
321
|
-
def get_parser(self, prog_name):
|
|
340
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
322
341
|
parser = super().get_parser(prog_name)
|
|
323
342
|
parser.add_argument(
|
|
324
343
|
'--l3',
|
|
@@ -338,7 +357,7 @@ class RemoveRouterFromAgent(command.Command):
|
|
|
338
357
|
|
|
339
358
|
return parser
|
|
340
359
|
|
|
341
|
-
def take_action(self, parsed_args):
|
|
360
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
342
361
|
client = self.app.client_manager.network
|
|
343
362
|
agent = client.get_agent(parsed_args.agent_id)
|
|
344
363
|
router = client.find_router(parsed_args.router, ignore_missing=False)
|
|
@@ -351,7 +370,7 @@ class RemoveRouterFromAgent(command.Command):
|
|
|
351
370
|
class SetNetworkAgent(command.Command):
|
|
352
371
|
_description = _("Set network agent properties")
|
|
353
372
|
|
|
354
|
-
def get_parser(self, prog_name):
|
|
373
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
355
374
|
parser = super().get_parser(prog_name)
|
|
356
375
|
parser.add_argument(
|
|
357
376
|
'network_agent',
|
|
@@ -372,7 +391,7 @@ class SetNetworkAgent(command.Command):
|
|
|
372
391
|
)
|
|
373
392
|
return parser
|
|
374
393
|
|
|
375
|
-
def take_action(self, parsed_args):
|
|
394
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
376
395
|
client = self.app.client_manager.network
|
|
377
396
|
obj = client.get_agent(parsed_args.network_agent)
|
|
378
397
|
attrs = {}
|
|
@@ -390,7 +409,7 @@ class SetNetworkAgent(command.Command):
|
|
|
390
409
|
class ShowNetworkAgent(command.ShowOne):
|
|
391
410
|
_description = _("Display network agent details")
|
|
392
411
|
|
|
393
|
-
def get_parser(self, prog_name):
|
|
412
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
394
413
|
parser = super().get_parser(prog_name)
|
|
395
414
|
parser.add_argument(
|
|
396
415
|
'network_agent',
|
|
@@ -399,7 +418,9 @@ class ShowNetworkAgent(command.ShowOne):
|
|
|
399
418
|
)
|
|
400
419
|
return parser
|
|
401
420
|
|
|
402
|
-
def take_action(
|
|
421
|
+
def take_action(
|
|
422
|
+
self, parsed_args: argparse.Namespace
|
|
423
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
403
424
|
client = self.app.client_manager.network
|
|
404
425
|
obj = client.get_agent(parsed_args.network_agent)
|
|
405
426
|
display_columns, columns = _get_network_columns(obj)
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
"""Auto-allocated Topology Implementations"""
|
|
15
15
|
|
|
16
|
+
import argparse
|
|
16
17
|
import logging
|
|
18
|
+
from collections.abc import Iterable, Sequence
|
|
19
|
+
from typing import Any
|
|
17
20
|
|
|
18
21
|
from osc_lib import utils
|
|
19
22
|
|
|
@@ -24,26 +27,28 @@ from openstackclient.identity import common as identity_common
|
|
|
24
27
|
LOG = logging.getLogger(__name__)
|
|
25
28
|
|
|
26
29
|
|
|
27
|
-
def _get_columns(item):
|
|
30
|
+
def _get_columns(item: Any) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
|
28
31
|
hidden_columns = ['name', 'location', 'tenant_id']
|
|
29
32
|
return utils.get_osc_show_columns_for_sdk_resource(
|
|
30
33
|
item, {}, hidden_columns
|
|
31
34
|
)
|
|
32
35
|
|
|
33
36
|
|
|
34
|
-
def _format_check_resource_columns():
|
|
37
|
+
def _format_check_resource_columns() -> tuple[str, ...]:
|
|
35
38
|
return ('dry_run',)
|
|
36
39
|
|
|
37
40
|
|
|
38
|
-
def _format_check_resource(item):
|
|
41
|
+
def _format_check_resource(item: Any) -> Any:
|
|
39
42
|
item_id = getattr(item, 'id', False)
|
|
40
43
|
if item_id == 'dry-run=pass':
|
|
41
44
|
item.check_resource = 'pass'
|
|
42
45
|
return item
|
|
43
46
|
|
|
44
47
|
|
|
45
|
-
def _get_attrs(
|
|
46
|
-
|
|
48
|
+
def _get_attrs(
|
|
49
|
+
client_manager: Any, parsed_args: argparse.Namespace
|
|
50
|
+
) -> dict[str, Any]:
|
|
51
|
+
attrs: dict[str, Any] = {}
|
|
47
52
|
if parsed_args.project:
|
|
48
53
|
identity_client = client_manager.identity
|
|
49
54
|
project_id = identity_common.find_project(
|
|
@@ -63,7 +68,7 @@ def _get_attrs(client_manager, parsed_args):
|
|
|
63
68
|
class CreateAutoAllocatedTopology(command.ShowOne):
|
|
64
69
|
_description = _("Create the auto allocated topology for project")
|
|
65
70
|
|
|
66
|
-
def get_parser(self, prog_name):
|
|
71
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
67
72
|
parser = super().get_parser(prog_name)
|
|
68
73
|
parser.add_argument(
|
|
69
74
|
'--project',
|
|
@@ -94,7 +99,9 @@ class CreateAutoAllocatedTopology(command.ShowOne):
|
|
|
94
99
|
|
|
95
100
|
return parser
|
|
96
101
|
|
|
97
|
-
def check_resource_topology(
|
|
102
|
+
def check_resource_topology(
|
|
103
|
+
self, client: Any, parsed_args: argparse.Namespace
|
|
104
|
+
) -> tuple[tuple[str, ...], Any]:
|
|
98
105
|
obj = client.validate_auto_allocated_topology(parsed_args.project)
|
|
99
106
|
|
|
100
107
|
columns = _format_check_resource_columns()
|
|
@@ -104,13 +111,17 @@ class CreateAutoAllocatedTopology(command.ShowOne):
|
|
|
104
111
|
|
|
105
112
|
return (columns, data)
|
|
106
113
|
|
|
107
|
-
def get_topology(
|
|
114
|
+
def get_topology(
|
|
115
|
+
self, client: Any, parsed_args: argparse.Namespace
|
|
116
|
+
) -> tuple[tuple[str, ...], Any]:
|
|
108
117
|
obj = client.get_auto_allocated_topology(parsed_args.project)
|
|
109
118
|
display_columns, columns = _get_columns(obj)
|
|
110
119
|
data = utils.get_item_properties(obj, columns, formatters={})
|
|
111
120
|
return (display_columns, data)
|
|
112
121
|
|
|
113
|
-
def take_action(
|
|
122
|
+
def take_action(
|
|
123
|
+
self, parsed_args: argparse.Namespace
|
|
124
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
114
125
|
client = self.app.client_manager.network
|
|
115
126
|
if parsed_args.check_resources:
|
|
116
127
|
columns, data = self.check_resource_topology(client, parsed_args)
|
|
@@ -124,7 +135,7 @@ class CreateAutoAllocatedTopology(command.ShowOne):
|
|
|
124
135
|
class DeleteAutoAllocatedTopology(command.Command):
|
|
125
136
|
_description = _("Delete auto allocated topology for project")
|
|
126
137
|
|
|
127
|
-
def get_parser(self, prog_name):
|
|
138
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
128
139
|
parser = super().get_parser(prog_name)
|
|
129
140
|
parser.add_argument(
|
|
130
141
|
'--project',
|
|
@@ -138,6 +149,6 @@ class DeleteAutoAllocatedTopology(command.Command):
|
|
|
138
149
|
|
|
139
150
|
return parser
|
|
140
151
|
|
|
141
|
-
def take_action(self, parsed_args):
|
|
152
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
142
153
|
client = self.app.client_manager.network
|
|
143
154
|
client.delete_auto_allocated_topology(parsed_args.project)
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
"""Flavor 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
|
|
|
18
21
|
from osc_lib import exceptions
|
|
19
22
|
from osc_lib import utils
|
|
@@ -26,7 +29,7 @@ from openstackclient.network import common
|
|
|
26
29
|
LOG = logging.getLogger(__name__)
|
|
27
30
|
|
|
28
31
|
|
|
29
|
-
def _get_columns(item):
|
|
32
|
+
def _get_columns(item: Any) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
|
30
33
|
column_map = {
|
|
31
34
|
'is_enabled': 'enabled',
|
|
32
35
|
}
|
|
@@ -37,8 +40,10 @@ def _get_columns(item):
|
|
|
37
40
|
)
|
|
38
41
|
|
|
39
42
|
|
|
40
|
-
def _get_attrs(
|
|
41
|
-
|
|
43
|
+
def _get_attrs(
|
|
44
|
+
client_manager: Any, parsed_args: argparse.Namespace
|
|
45
|
+
) -> dict[str, Any]:
|
|
46
|
+
attrs: dict[str, Any] = {}
|
|
42
47
|
attrs['name'] = parsed_args.name
|
|
43
48
|
attrs['service_type'] = parsed_args.service_type
|
|
44
49
|
if parsed_args.description is not None:
|
|
@@ -62,7 +67,7 @@ def _get_attrs(client_manager, parsed_args):
|
|
|
62
67
|
class AddNetworkFlavorToProfile(command.Command):
|
|
63
68
|
_description = _("Add a service profile to a network flavor")
|
|
64
69
|
|
|
65
|
-
def get_parser(self, prog_name):
|
|
70
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
66
71
|
parser = super().get_parser(prog_name)
|
|
67
72
|
parser.add_argument(
|
|
68
73
|
'flavor', metavar="<flavor>", help=_("Network flavor (name or ID)")
|
|
@@ -74,7 +79,7 @@ class AddNetworkFlavorToProfile(command.Command):
|
|
|
74
79
|
)
|
|
75
80
|
return parser
|
|
76
81
|
|
|
77
|
-
def take_action(self, parsed_args):
|
|
82
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
78
83
|
client = self.app.client_manager.network
|
|
79
84
|
obj_flavor = client.find_flavor(
|
|
80
85
|
parsed_args.flavor, ignore_missing=False
|
|
@@ -92,7 +97,7 @@ class AddNetworkFlavorToProfile(command.Command):
|
|
|
92
97
|
class CreateNetworkFlavor(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
|
93
98
|
_description = _("Create new network flavor")
|
|
94
99
|
|
|
95
|
-
def get_parser(self, prog_name):
|
|
100
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
96
101
|
parser = super().get_parser(prog_name)
|
|
97
102
|
parser.add_argument(
|
|
98
103
|
'name', metavar="<name>", help=_("Name for the flavor")
|
|
@@ -129,7 +134,9 @@ class CreateNetworkFlavor(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
|
|
129
134
|
|
|
130
135
|
return parser
|
|
131
136
|
|
|
132
|
-
def take_action(
|
|
137
|
+
def take_action(
|
|
138
|
+
self, parsed_args: argparse.Namespace
|
|
139
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
133
140
|
client = self.app.client_manager.network
|
|
134
141
|
attrs = _get_attrs(self.app.client_manager, parsed_args)
|
|
135
142
|
attrs.update(
|
|
@@ -145,7 +152,7 @@ class CreateNetworkFlavor(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
|
|
145
152
|
class DeleteNetworkFlavor(command.Command):
|
|
146
153
|
_description = _("Delete network flavors")
|
|
147
154
|
|
|
148
|
-
def get_parser(self, prog_name):
|
|
155
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
149
156
|
parser = super().get_parser(prog_name)
|
|
150
157
|
|
|
151
158
|
parser.add_argument(
|
|
@@ -156,7 +163,7 @@ class DeleteNetworkFlavor(command.Command):
|
|
|
156
163
|
)
|
|
157
164
|
return parser
|
|
158
165
|
|
|
159
|
-
def take_action(self, parsed_args):
|
|
166
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
160
167
|
client = self.app.client_manager.network
|
|
161
168
|
result = 0
|
|
162
169
|
|
|
@@ -185,7 +192,9 @@ class DeleteNetworkFlavor(command.Command):
|
|
|
185
192
|
class ListNetworkFlavor(command.Lister):
|
|
186
193
|
_description = _("List network flavors")
|
|
187
194
|
|
|
188
|
-
def take_action(
|
|
195
|
+
def take_action(
|
|
196
|
+
self, parsed_args: argparse.Namespace
|
|
197
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
189
198
|
client = self.app.client_manager.network
|
|
190
199
|
|
|
191
200
|
columns = ('id', 'name', 'is_enabled', 'service_type', 'description')
|
|
@@ -213,7 +222,7 @@ class ListNetworkFlavor(command.Lister):
|
|
|
213
222
|
class RemoveNetworkFlavorFromProfile(command.Command):
|
|
214
223
|
_description = _("Remove service profile from network flavor")
|
|
215
224
|
|
|
216
|
-
def get_parser(self, prog_name):
|
|
225
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
217
226
|
parser = super().get_parser(prog_name)
|
|
218
227
|
parser.add_argument(
|
|
219
228
|
'flavor', metavar="<flavor>", help=_("Network flavor (name or ID)")
|
|
@@ -225,7 +234,7 @@ class RemoveNetworkFlavorFromProfile(command.Command):
|
|
|
225
234
|
)
|
|
226
235
|
return parser
|
|
227
236
|
|
|
228
|
-
def take_action(self, parsed_args):
|
|
237
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
229
238
|
client = self.app.client_manager.network
|
|
230
239
|
obj_flavor = client.find_flavor(
|
|
231
240
|
parsed_args.flavor, ignore_missing=False
|
|
@@ -243,7 +252,7 @@ class RemoveNetworkFlavorFromProfile(command.Command):
|
|
|
243
252
|
class SetNetworkFlavor(common.NeutronCommandWithExtraArgs):
|
|
244
253
|
_description = _("Set network flavor properties")
|
|
245
254
|
|
|
246
|
-
def get_parser(self, prog_name):
|
|
255
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
247
256
|
parser = super().get_parser(prog_name)
|
|
248
257
|
parser.add_argument(
|
|
249
258
|
'flavor',
|
|
@@ -266,7 +275,7 @@ class SetNetworkFlavor(common.NeutronCommandWithExtraArgs):
|
|
|
266
275
|
|
|
267
276
|
return parser
|
|
268
277
|
|
|
269
|
-
def take_action(self, parsed_args):
|
|
278
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
270
279
|
client = self.app.client_manager.network
|
|
271
280
|
obj = client.find_flavor(parsed_args.flavor, ignore_missing=False)
|
|
272
281
|
attrs = {}
|
|
@@ -287,7 +296,7 @@ class SetNetworkFlavor(common.NeutronCommandWithExtraArgs):
|
|
|
287
296
|
class ShowNetworkFlavor(command.ShowOne):
|
|
288
297
|
_description = _("Display network flavor details")
|
|
289
298
|
|
|
290
|
-
def get_parser(self, prog_name):
|
|
299
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
291
300
|
parser = super().get_parser(prog_name)
|
|
292
301
|
parser.add_argument(
|
|
293
302
|
'flavor',
|
|
@@ -296,7 +305,9 @@ class ShowNetworkFlavor(command.ShowOne):
|
|
|
296
305
|
)
|
|
297
306
|
return parser
|
|
298
307
|
|
|
299
|
-
def take_action(
|
|
308
|
+
def take_action(
|
|
309
|
+
self, parsed_args: argparse.Namespace
|
|
310
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
300
311
|
client = self.app.client_manager.network
|
|
301
312
|
obj = client.find_flavor(parsed_args.flavor, ignore_missing=False)
|
|
302
313
|
display_columns, columns = _get_columns(obj)
|
|
@@ -11,7 +11,10 @@
|
|
|
11
11
|
# under the License.
|
|
12
12
|
#
|
|
13
13
|
|
|
14
|
+
import argparse
|
|
14
15
|
import logging
|
|
16
|
+
from collections.abc import Iterable, Sequence
|
|
17
|
+
from typing import Any
|
|
15
18
|
|
|
16
19
|
from osc_lib import exceptions
|
|
17
20
|
from osc_lib import utils
|
|
@@ -23,7 +26,7 @@ from openstackclient.network import common
|
|
|
23
26
|
LOG = logging.getLogger(__name__)
|
|
24
27
|
|
|
25
28
|
|
|
26
|
-
def _get_columns(item):
|
|
29
|
+
def _get_columns(item: Any) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
|
27
30
|
column_map = {
|
|
28
31
|
'is_enabled': 'enabled',
|
|
29
32
|
}
|
|
@@ -34,8 +37,10 @@ def _get_columns(item):
|
|
|
34
37
|
)
|
|
35
38
|
|
|
36
39
|
|
|
37
|
-
def _get_attrs(
|
|
38
|
-
|
|
40
|
+
def _get_attrs(
|
|
41
|
+
client_manager: Any, parsed_args: argparse.Namespace
|
|
42
|
+
) -> dict[str, Any]:
|
|
43
|
+
attrs: dict[str, Any] = {}
|
|
39
44
|
if parsed_args.description is not None:
|
|
40
45
|
attrs['description'] = parsed_args.description
|
|
41
46
|
if parsed_args.driver is not None:
|
|
@@ -57,7 +62,7 @@ class CreateNetworkFlavorProfile(
|
|
|
57
62
|
):
|
|
58
63
|
_description = _("Create new network flavor profile")
|
|
59
64
|
|
|
60
|
-
def get_parser(self, prog_name):
|
|
65
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
61
66
|
parser = super().get_parser(prog_name)
|
|
62
67
|
parser.add_argument(
|
|
63
68
|
'--description',
|
|
@@ -92,7 +97,9 @@ class CreateNetworkFlavorProfile(
|
|
|
92
97
|
|
|
93
98
|
return parser
|
|
94
99
|
|
|
95
|
-
def take_action(
|
|
100
|
+
def take_action(
|
|
101
|
+
self, parsed_args: argparse.Namespace
|
|
102
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
96
103
|
client = self.app.client_manager.network
|
|
97
104
|
attrs = _get_attrs(self.app.client_manager, parsed_args)
|
|
98
105
|
attrs.update(
|
|
@@ -113,7 +120,7 @@ class CreateNetworkFlavorProfile(
|
|
|
113
120
|
class DeleteNetworkFlavorProfile(command.Command):
|
|
114
121
|
_description = _("Delete network flavor profile")
|
|
115
122
|
|
|
116
|
-
def get_parser(self, prog_name):
|
|
123
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
117
124
|
parser = super().get_parser(prog_name)
|
|
118
125
|
|
|
119
126
|
parser.add_argument(
|
|
@@ -124,7 +131,7 @@ class DeleteNetworkFlavorProfile(command.Command):
|
|
|
124
131
|
)
|
|
125
132
|
return parser
|
|
126
133
|
|
|
127
|
-
def take_action(self, parsed_args):
|
|
134
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
128
135
|
client = self.app.client_manager.network
|
|
129
136
|
result = 0
|
|
130
137
|
|
|
@@ -154,7 +161,9 @@ class DeleteNetworkFlavorProfile(command.Command):
|
|
|
154
161
|
class ListNetworkFlavorProfile(command.Lister):
|
|
155
162
|
_description = _("List network flavor profile(s)")
|
|
156
163
|
|
|
157
|
-
def take_action(
|
|
164
|
+
def take_action(
|
|
165
|
+
self, parsed_args: argparse.Namespace
|
|
166
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
158
167
|
client = self.app.client_manager.network
|
|
159
168
|
|
|
160
169
|
columns = (
|
|
@@ -190,7 +199,7 @@ class ListNetworkFlavorProfile(command.Lister):
|
|
|
190
199
|
class SetNetworkFlavorProfile(common.NeutronCommandWithExtraArgs):
|
|
191
200
|
_description = _("Set network flavor profile properties")
|
|
192
201
|
|
|
193
|
-
def get_parser(self, prog_name):
|
|
202
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
194
203
|
parser = super().get_parser(prog_name)
|
|
195
204
|
parser.add_argument(
|
|
196
205
|
'flavor_profile',
|
|
@@ -230,7 +239,7 @@ class SetNetworkFlavorProfile(common.NeutronCommandWithExtraArgs):
|
|
|
230
239
|
|
|
231
240
|
return parser
|
|
232
241
|
|
|
233
|
-
def take_action(self, parsed_args):
|
|
242
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
234
243
|
client = self.app.client_manager.network
|
|
235
244
|
obj = client.find_service_profile(
|
|
236
245
|
parsed_args.flavor_profile, ignore_missing=False
|
|
@@ -246,7 +255,7 @@ class SetNetworkFlavorProfile(common.NeutronCommandWithExtraArgs):
|
|
|
246
255
|
class ShowNetworkFlavorProfile(command.ShowOne):
|
|
247
256
|
_description = _("Display network flavor profile details")
|
|
248
257
|
|
|
249
|
-
def get_parser(self, prog_name):
|
|
258
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
250
259
|
parser = super().get_parser(prog_name)
|
|
251
260
|
parser.add_argument(
|
|
252
261
|
'flavor_profile',
|
|
@@ -255,7 +264,9 @@ class ShowNetworkFlavorProfile(command.ShowOne):
|
|
|
255
264
|
)
|
|
256
265
|
return parser
|
|
257
266
|
|
|
258
|
-
def take_action(
|
|
267
|
+
def take_action(
|
|
268
|
+
self, parsed_args: argparse.Namespace
|
|
269
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
259
270
|
client = self.app.client_manager.network
|
|
260
271
|
obj = client.find_service_profile(
|
|
261
272
|
parsed_args.flavor_profile, ignore_missing=False
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
"""Metering Label Implementations"""
|
|
15
15
|
|
|
16
|
+
import argparse
|
|
16
17
|
import logging
|
|
18
|
+
from collections.abc import Iterable, Sequence
|
|
19
|
+
from typing import Any
|
|
17
20
|
|
|
18
21
|
from osc_lib import exceptions
|
|
19
22
|
from osc_lib import utils
|
|
@@ -26,7 +29,7 @@ from openstackclient.network import common
|
|
|
26
29
|
LOG = logging.getLogger(__name__)
|
|
27
30
|
|
|
28
31
|
|
|
29
|
-
def _get_columns(item):
|
|
32
|
+
def _get_columns(item: Any) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
|
30
33
|
column_map = {
|
|
31
34
|
'is_shared': 'shared',
|
|
32
35
|
}
|
|
@@ -36,8 +39,10 @@ def _get_columns(item):
|
|
|
36
39
|
)
|
|
37
40
|
|
|
38
41
|
|
|
39
|
-
def _get_attrs(
|
|
40
|
-
|
|
42
|
+
def _get_attrs(
|
|
43
|
+
client_manager: Any, parsed_args: argparse.Namespace
|
|
44
|
+
) -> dict[str, Any]:
|
|
45
|
+
attrs: dict[str, Any] = {}
|
|
41
46
|
|
|
42
47
|
if parsed_args.description is not None:
|
|
43
48
|
attrs['description'] = parsed_args.description
|
|
@@ -64,7 +69,7 @@ def _get_attrs(client_manager, parsed_args):
|
|
|
64
69
|
class CreateMeter(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
|
65
70
|
_description = _("Create network meter")
|
|
66
71
|
|
|
67
|
-
def get_parser(self, prog_name):
|
|
72
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
68
73
|
parser = super().get_parser(prog_name)
|
|
69
74
|
|
|
70
75
|
parser.add_argument(
|
|
@@ -99,7 +104,9 @@ class CreateMeter(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
|
|
99
104
|
|
|
100
105
|
return parser
|
|
101
106
|
|
|
102
|
-
def take_action(
|
|
107
|
+
def take_action(
|
|
108
|
+
self, parsed_args: argparse.Namespace
|
|
109
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
103
110
|
client = self.app.client_manager.network
|
|
104
111
|
attrs = _get_attrs(self.app.client_manager, parsed_args)
|
|
105
112
|
attrs.update(
|
|
@@ -117,7 +124,7 @@ class CreateMeter(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
|
|
117
124
|
class DeleteMeter(command.Command):
|
|
118
125
|
_description = _("Delete network meter")
|
|
119
126
|
|
|
120
|
-
def get_parser(self, prog_name):
|
|
127
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
121
128
|
parser = super().get_parser(prog_name)
|
|
122
129
|
|
|
123
130
|
parser.add_argument(
|
|
@@ -128,7 +135,7 @@ class DeleteMeter(command.Command):
|
|
|
128
135
|
)
|
|
129
136
|
return parser
|
|
130
137
|
|
|
131
|
-
def take_action(self, parsed_args):
|
|
138
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
132
139
|
client = self.app.client_manager.network
|
|
133
140
|
result = 0
|
|
134
141
|
|
|
@@ -154,7 +161,9 @@ class DeleteMeter(command.Command):
|
|
|
154
161
|
class ListMeter(command.Lister):
|
|
155
162
|
_description = _("List network meters")
|
|
156
163
|
|
|
157
|
-
def take_action(
|
|
164
|
+
def take_action(
|
|
165
|
+
self, parsed_args: argparse.Namespace
|
|
166
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
158
167
|
client = self.app.client_manager.network
|
|
159
168
|
|
|
160
169
|
columns = (
|
|
@@ -186,14 +195,16 @@ class ListMeter(command.Lister):
|
|
|
186
195
|
class ShowMeter(command.ShowOne):
|
|
187
196
|
_description = _("Show network meter")
|
|
188
197
|
|
|
189
|
-
def get_parser(self, prog_name):
|
|
198
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
190
199
|
parser = super().get_parser(prog_name)
|
|
191
200
|
parser.add_argument(
|
|
192
201
|
'meter', metavar='<meter>', help=_('Meter to display (name or ID)')
|
|
193
202
|
)
|
|
194
203
|
return parser
|
|
195
204
|
|
|
196
|
-
def take_action(
|
|
205
|
+
def take_action(
|
|
206
|
+
self, parsed_args: argparse.Namespace
|
|
207
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
197
208
|
client = self.app.client_manager.network
|
|
198
209
|
obj = client.find_metering_label(
|
|
199
210
|
parsed_args.meter, ignore_missing=False
|