python-openstackclient 10.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/common/availability_zone.py +1 -1
- openstackclient/common/module.py +21 -27
- openstackclient/common/pagination.py +42 -4
- openstackclient/common/project_cleanup.py +1 -2
- openstackclient/common/quota.py +9 -5
- openstackclient/compute/v2/flavor.py +3 -1
- openstackclient/compute/v2/hypervisor.py +2 -0
- openstackclient/compute/v2/keypair.py +6 -2
- openstackclient/compute/v2/server.py +21 -12
- openstackclient/compute/v2/server_event.py +8 -1
- openstackclient/compute/v2/server_group.py +2 -0
- openstackclient/compute/v2/server_migration.py +3 -0
- openstackclient/compute/v2/server_volume.py +3 -1
- openstackclient/compute/v2/service.py +3 -1
- openstackclient/compute/v2/usage.py +2 -2
- openstackclient/identity/common.py +5 -1
- openstackclient/identity/v3/access_rule.py +6 -0
- openstackclient/identity/v3/application_credential.py +10 -3
- openstackclient/identity/v3/credential.py +4 -2
- openstackclient/identity/v3/domain.py +4 -2
- openstackclient/identity/v3/endpoint.py +57 -45
- openstackclient/identity/v3/federation_protocol.py +7 -5
- openstackclient/identity/v3/group.py +11 -10
- openstackclient/identity/v3/identity_provider.py +4 -1
- openstackclient/identity/v3/limit.py +5 -2
- openstackclient/identity/v3/mapping.py +36 -19
- openstackclient/identity/v3/project.py +18 -5
- openstackclient/identity/v3/region.py +4 -2
- openstackclient/identity/v3/registered_limit.py +3 -2
- openstackclient/identity/v3/role.py +2 -1
- openstackclient/identity/v3/role_assignment.py +3 -2
- openstackclient/identity/v3/service.py +4 -2
- openstackclient/identity/v3/service_provider.py +4 -2
- openstackclient/identity/v3/trust.py +8 -5
- openstackclient/identity/v3/user.py +38 -11
- openstackclient/image/v2/cache.py +2 -2
- openstackclient/image/v2/image.py +15 -9
- openstackclient/image/v2/metadef_namespaces.py +11 -10
- openstackclient/image/v2/metadef_objects.py +5 -5
- openstackclient/image/v2/metadef_properties.py +7 -4
- openstackclient/image/v2/task.py +11 -22
- openstackclient/network/utils.py +0 -41
- openstackclient/network/v2/address_group.py +13 -1
- openstackclient/network/v2/address_scope.py +13 -8
- openstackclient/network/v2/bgpvpn/bgpvpn.py +33 -19
- openstackclient/network/v2/bgpvpn/network_association.py +25 -13
- openstackclient/network/v2/bgpvpn/port_association.py +35 -21
- openstackclient/network/v2/bgpvpn/router_association.py +27 -14
- openstackclient/network/v2/default_security_group_rule.py +14 -6
- openstackclient/network/v2/floating_ip.py +12 -4
- openstackclient/network/v2/floating_ip_port_forwarding.py +12 -2
- openstackclient/network/v2/fwaas/group.py +34 -1
- openstackclient/network/v2/fwaas/rule.py +39 -3
- openstackclient/network/v2/ip_availability.py +13 -4
- openstackclient/network/v2/l3_conntrack_helper.py +14 -1
- openstackclient/network/v2/local_ip.py +4 -1
- openstackclient/network/v2/local_ip_association.py +4 -1
- openstackclient/network/v2/ndp_proxy.py +4 -1
- openstackclient/network/v2/network.py +87 -20
- openstackclient/network/v2/network_agent.py +32 -10
- openstackclient/network/v2/network_auto_allocated_topology.py +6 -5
- openstackclient/network/v2/network_flavor.py +19 -6
- openstackclient/network/v2/network_flavor_profile.py +20 -6
- openstackclient/network/v2/network_meter.py +19 -6
- openstackclient/network/v2/network_meter_rule.py +20 -2
- openstackclient/network/v2/network_qos_policy.py +15 -7
- openstackclient/network/v2/network_qos_rule.py +16 -1
- openstackclient/network/v2/network_qos_rule_type.py +16 -5
- openstackclient/network/v2/network_rbac.py +12 -5
- openstackclient/network/v2/network_segment.py +13 -1
- openstackclient/network/v2/network_segment_range.py +15 -3
- openstackclient/network/v2/network_trunk.py +4 -1
- openstackclient/network/v2/port.py +88 -12
- openstackclient/network/v2/router.py +27 -16
- openstackclient/network/v2/security_group.py +18 -49
- openstackclient/network/v2/security_group_rule.py +18 -5
- openstackclient/network/v2/subnet.py +15 -7
- openstackclient/network/v2/subnet_pool.py +13 -8
- openstackclient/network/v2/taas/tap_flow.py +13 -3
- openstackclient/network/v2/taas/tap_mirror.py +7 -4
- openstackclient/network/v2/taas/tap_service.py +4 -1
- openstackclient/object/v1/container.py +3 -1
- openstackclient/object/v1/object.py +3 -1
- openstackclient/tests/functional/identity/v3/common.py +34 -0
- openstackclient/tests/functional/identity/v3/test_application_credential.py +1 -1
- openstackclient/tests/functional/identity/v3/test_mapping.py +81 -0
- openstackclient/tests/functional/volume/v3/test_volume_group.py +163 -0
- openstackclient/tests/unit/common/test_limits.py +1 -1
- openstackclient/tests/unit/common/test_module.py +77 -44
- openstackclient/tests/unit/common/test_quota.py +9 -0
- openstackclient/tests/unit/compute/v2/fakes.py +1 -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 +1 -1
- 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 +1 -1
- openstackclient/tests/unit/compute/v2/test_server.py +15 -15
- 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 +4 -4
- 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 +5 -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 +8 -8
- 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 +73 -6
- openstackclient/tests/unit/network/v2/fakes.py +5 -77
- openstackclient/tests/unit/network/v2/fwaas/test_group.py +28 -2
- openstackclient/tests/unit/network/v2/fwaas/test_rule.py +28 -3
- openstackclient/tests/unit/network/v2/test_address_group.py +24 -0
- openstackclient/tests/unit/network/v2/test_address_scope.py +24 -0
- openstackclient/tests/unit/network/v2/test_floating_ip.py +24 -0
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +24 -0
- 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 +50 -1
- openstackclient/tests/unit/network/v2/test_network_flavor.py +24 -0
- 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 +24 -0
- openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +24 -0
- openstackclient/tests/unit/network/v2/test_network_rbac.py +24 -0
- openstackclient/tests/unit/network/v2/test_network_segment.py +24 -0
- openstackclient/tests/unit/network/v2/test_network_segment_range.py +24 -0
- openstackclient/tests/unit/network/v2/test_port.py +166 -0
- openstackclient/tests/unit/network/v2/test_router.py +28 -7
- openstackclient/tests/unit/network/v2/test_security_group.py +22 -0
- openstackclient/tests/unit/network/v2/test_security_group_rule.py +25 -0
- openstackclient/tests/unit/network/v2/test_subnet.py +28 -4
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +24 -0
- openstackclient/tests/unit/volume/v2/fakes.py +20 -140
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +5 -9
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +6 -0
- openstackclient/tests/unit/volume/v3/fakes.py +204 -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_attachment.py +2 -0
- openstackclient/tests/unit/volume/v3/test_volume_backend.py +158 -0
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +5 -9
- 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 +6 -0
- openstackclient/volume/v2/volume.py +4 -2
- openstackclient/volume/v2/volume_backup.py +2 -3
- openstackclient/volume/v2/volume_snapshot.py +3 -4
- openstackclient/volume/v3/backup_record.py +94 -0
- 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/volume.py +4 -2
- openstackclient/volume/v3/volume_attachment.py +5 -1
- openstackclient/volume/v3/volume_backend.py +130 -0
- openstackclient/volume/v3/volume_backup.py +2 -3
- openstackclient/volume/v3/volume_group_snapshot.py +4 -6
- openstackclient/volume/v3/volume_group_type.py +1 -1
- openstackclient/volume/v3/volume_host.py +74 -0
- openstackclient/volume/v3/volume_message.py +3 -1
- openstackclient/volume/v3/volume_snapshot.py +2 -1
- {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/METADATA +3 -4
- {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/RECORD +202 -188
- {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/entry_points.txt +24 -24
- {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/licenses/AUTHORS +5 -0
- python_openstackclient-10.1.0.dist-info/pbr.json +1 -0
- python_openstackclient-10.0.0.dist-info/pbr.json +0 -1
- {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/WHEEL +0 -0
- {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/licenses/LICENSE +0 -0
- {python_openstackclient-10.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/top_level.txt +0 -0
|
@@ -12,11 +12,13 @@
|
|
|
12
12
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
13
13
|
# License for the specific language governing permissions and limitations
|
|
14
14
|
# under the License.
|
|
15
|
-
#
|
|
16
15
|
|
|
16
|
+
import argparse
|
|
17
|
+
from collections.abc import Iterable, Sequence
|
|
17
18
|
import logging
|
|
18
|
-
|
|
19
|
+
from typing import Any
|
|
19
20
|
|
|
21
|
+
from openstack.network.v2 import bgpvpn as _bgpvpn
|
|
20
22
|
from osc_lib.cli import format_columns
|
|
21
23
|
from osc_lib.cli import identity as osc_id
|
|
22
24
|
from osc_lib.cli.parseractions import KeyValueAction
|
|
@@ -59,7 +61,9 @@ _formatters = {
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
|
|
62
|
-
def _get_columns(
|
|
64
|
+
def _get_columns(
|
|
65
|
+
item: _bgpvpn.BgpVpn,
|
|
66
|
+
) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
|
63
67
|
column_map: dict[str, str] = {}
|
|
64
68
|
hidden_columns = ['location', 'tenant_id']
|
|
65
69
|
return osc_utils.get_osc_show_columns_for_sdk_resource(
|
|
@@ -67,7 +71,9 @@ def _get_columns(item):
|
|
|
67
71
|
)
|
|
68
72
|
|
|
69
73
|
|
|
70
|
-
def _get_common_parser(
|
|
74
|
+
def _get_common_parser(
|
|
75
|
+
parser: argparse.ArgumentParser, update: str | None = None
|
|
76
|
+
) -> None:
|
|
71
77
|
"""Adds to parser arguments common to create, set and unset commands.
|
|
72
78
|
|
|
73
79
|
:params ArgumentParser parser: argparse object contains all command's
|
|
@@ -95,7 +101,7 @@ def _get_common_parser(parser, update=None):
|
|
|
95
101
|
REPEAT_RT = _("repeat option for multiple Route Targets")
|
|
96
102
|
REPEAT_RD = _("repeat option for multiple Route Distinguishers")
|
|
97
103
|
|
|
98
|
-
def is_appended():
|
|
104
|
+
def is_appended() -> bool:
|
|
99
105
|
return update is None or update == 'set'
|
|
100
106
|
|
|
101
107
|
if update is None or update == 'set':
|
|
@@ -183,7 +189,9 @@ def _get_common_parser(parser, update=None):
|
|
|
183
189
|
)
|
|
184
190
|
|
|
185
191
|
|
|
186
|
-
def _args2body(
|
|
192
|
+
def _args2body(
|
|
193
|
+
client_manager: Any, id: str, action: str, args: argparse.Namespace
|
|
194
|
+
) -> dict[str, Any]:
|
|
187
195
|
|
|
188
196
|
if not (
|
|
189
197
|
args.purge_route_target
|
|
@@ -198,7 +206,7 @@ def _args2body(client_manager, id, action, args):
|
|
|
198
206
|
):
|
|
199
207
|
bgpvpn = client_manager.network.get_bgpvpn(id)
|
|
200
208
|
|
|
201
|
-
attrs: dict[str,
|
|
209
|
+
attrs: dict[str, Any] = {}
|
|
202
210
|
|
|
203
211
|
if 'name' in args and args.name is not None:
|
|
204
212
|
attrs['name'] = str(args.name)
|
|
@@ -265,7 +273,7 @@ def _args2body(client_manager, id, action, args):
|
|
|
265
273
|
class CreateBgpvpn(command.ShowOne):
|
|
266
274
|
_description = _("Create BGP VPN resource")
|
|
267
275
|
|
|
268
|
-
def get_parser(self, prog_name):
|
|
276
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
269
277
|
parser = super().get_parser(prog_name)
|
|
270
278
|
osc_id.add_project_owner_option_to_parser(parser)
|
|
271
279
|
_get_common_parser(parser)
|
|
@@ -280,7 +288,9 @@ class CreateBgpvpn(command.ShowOne):
|
|
|
280
288
|
)
|
|
281
289
|
return parser
|
|
282
290
|
|
|
283
|
-
def take_action(
|
|
291
|
+
def take_action(
|
|
292
|
+
self, parsed_args: argparse.Namespace
|
|
293
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
284
294
|
client = self.app.client_manager.network
|
|
285
295
|
attrs = {}
|
|
286
296
|
if parsed_args.name is not None:
|
|
@@ -317,7 +327,7 @@ class CreateBgpvpn(command.ShowOne):
|
|
|
317
327
|
class SetBgpvpn(command.Command):
|
|
318
328
|
_description = _("Set BGP VPN properties")
|
|
319
329
|
|
|
320
|
-
def get_parser(self, prog_name):
|
|
330
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
321
331
|
parser = super().get_parser(prog_name)
|
|
322
332
|
parser.add_argument(
|
|
323
333
|
'bgpvpn',
|
|
@@ -327,7 +337,7 @@ class SetBgpvpn(command.Command):
|
|
|
327
337
|
_get_common_parser(parser, update='set')
|
|
328
338
|
return parser
|
|
329
339
|
|
|
330
|
-
def take_action(self, parsed_args):
|
|
340
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
331
341
|
client = self.app.client_manager.network
|
|
332
342
|
id = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)['id']
|
|
333
343
|
body = _args2body(self.app.client_manager, id, 'set', parsed_args)
|
|
@@ -337,7 +347,7 @@ class SetBgpvpn(command.Command):
|
|
|
337
347
|
class UnsetBgpvpn(command.Command):
|
|
338
348
|
_description = _("Unset BGP VPN properties")
|
|
339
349
|
|
|
340
|
-
def get_parser(self, prog_name):
|
|
350
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
341
351
|
parser = super().get_parser(prog_name)
|
|
342
352
|
parser.add_argument(
|
|
343
353
|
'bgpvpn',
|
|
@@ -347,7 +357,7 @@ class UnsetBgpvpn(command.Command):
|
|
|
347
357
|
_get_common_parser(parser, update='unset')
|
|
348
358
|
return parser
|
|
349
359
|
|
|
350
|
-
def take_action(self, parsed_args):
|
|
360
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
351
361
|
client = self.app.client_manager.network
|
|
352
362
|
id = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)['id']
|
|
353
363
|
body = _args2body(self.app.client_manager, id, 'unset', parsed_args)
|
|
@@ -357,7 +367,7 @@ class UnsetBgpvpn(command.Command):
|
|
|
357
367
|
class DeleteBgpvpn(command.Command):
|
|
358
368
|
_description = _("Delete BGP VPN resource(s)")
|
|
359
369
|
|
|
360
|
-
def get_parser(self, prog_name):
|
|
370
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
361
371
|
parser = super().get_parser(prog_name)
|
|
362
372
|
parser.add_argument(
|
|
363
373
|
'bgpvpns',
|
|
@@ -367,7 +377,7 @@ class DeleteBgpvpn(command.Command):
|
|
|
367
377
|
)
|
|
368
378
|
return parser
|
|
369
379
|
|
|
370
|
-
def take_action(self, parsed_args):
|
|
380
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
371
381
|
client = self.app.client_manager.network
|
|
372
382
|
fails = 0
|
|
373
383
|
for id_or_name in parsed_args.bgpvpns:
|
|
@@ -393,7 +403,7 @@ class DeleteBgpvpn(command.Command):
|
|
|
393
403
|
class ListBgpvpn(command.Lister):
|
|
394
404
|
_description = _("List BGP VPN resources")
|
|
395
405
|
|
|
396
|
-
def get_parser(self, prog_name):
|
|
406
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
397
407
|
parser = super().get_parser(prog_name)
|
|
398
408
|
osc_id.add_project_owner_option_to_parser(parser)
|
|
399
409
|
parser.add_argument(
|
|
@@ -413,7 +423,9 @@ class ListBgpvpn(command.Lister):
|
|
|
413
423
|
)
|
|
414
424
|
return parser
|
|
415
425
|
|
|
416
|
-
def take_action(
|
|
426
|
+
def take_action(
|
|
427
|
+
self, parsed_args: argparse.Namespace
|
|
428
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
417
429
|
client = self.app.client_manager.network
|
|
418
430
|
params = {}
|
|
419
431
|
if parsed_args.project is not None:
|
|
@@ -443,7 +455,7 @@ class ListBgpvpn(command.Lister):
|
|
|
443
455
|
class ShowBgpvpn(command.ShowOne):
|
|
444
456
|
_description = _("Show information of a given BGP VPN")
|
|
445
457
|
|
|
446
|
-
def get_parser(self, prog_name):
|
|
458
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
447
459
|
parser = super().get_parser(prog_name)
|
|
448
460
|
parser.add_argument(
|
|
449
461
|
'bgpvpn',
|
|
@@ -452,7 +464,9 @@ class ShowBgpvpn(command.ShowOne):
|
|
|
452
464
|
)
|
|
453
465
|
return parser
|
|
454
466
|
|
|
455
|
-
def take_action(
|
|
467
|
+
def take_action(
|
|
468
|
+
self, parsed_args: argparse.Namespace
|
|
469
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
456
470
|
client = self.app.client_manager.network
|
|
457
471
|
id = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)['id']
|
|
458
472
|
obj = client.get_bgpvpn(id)
|
|
@@ -12,11 +12,15 @@
|
|
|
12
12
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
13
13
|
# License for the specific language governing permissions and limitations
|
|
14
14
|
# under the License.
|
|
15
|
-
#
|
|
16
15
|
|
|
16
|
+
import argparse
|
|
17
|
+
from collections.abc import Iterable, Sequence
|
|
17
18
|
import logging
|
|
18
|
-
|
|
19
|
+
from typing import Any
|
|
19
20
|
|
|
21
|
+
from openstack.network.v2 import (
|
|
22
|
+
bgpvpn_network_association as _bgpvpn_network_association,
|
|
23
|
+
)
|
|
20
24
|
from osc_lib.cli import identity as osc_id
|
|
21
25
|
from osc_lib.cli import parseractions
|
|
22
26
|
from osc_lib import exceptions
|
|
@@ -34,10 +38,12 @@ _attr_map = (
|
|
|
34
38
|
('project_id', 'Project', column_util.LIST_LONG_ONLY),
|
|
35
39
|
('network_id', 'Network ID', column_util.LIST_BOTH),
|
|
36
40
|
)
|
|
37
|
-
_formatters: dict[str,
|
|
41
|
+
_formatters: dict[str, Any] = {}
|
|
38
42
|
|
|
39
43
|
|
|
40
|
-
def _get_columns(
|
|
44
|
+
def _get_columns(
|
|
45
|
+
item: _bgpvpn_network_association.BgpVpnNetworkAssociation,
|
|
46
|
+
) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
|
41
47
|
column_map: dict[str, str] = {}
|
|
42
48
|
hidden_columns = ['location', 'name', 'tenant_id']
|
|
43
49
|
return osc_utils.get_osc_show_columns_for_sdk_resource(
|
|
@@ -48,7 +54,7 @@ def _get_columns(item):
|
|
|
48
54
|
class CreateBgpvpnNetAssoc(command.ShowOne):
|
|
49
55
|
_description = _("Create a BGP VPN network association")
|
|
50
56
|
|
|
51
|
-
def get_parser(self, prog_name):
|
|
57
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
52
58
|
parser = super().get_parser(prog_name)
|
|
53
59
|
osc_id.add_project_owner_option_to_parser(parser)
|
|
54
60
|
parser.add_argument(
|
|
@@ -63,13 +69,15 @@ class CreateBgpvpnNetAssoc(command.ShowOne):
|
|
|
63
69
|
)
|
|
64
70
|
return parser
|
|
65
71
|
|
|
66
|
-
def take_action(
|
|
72
|
+
def take_action(
|
|
73
|
+
self, parsed_args: argparse.Namespace
|
|
74
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
67
75
|
client = self.app.client_manager.network
|
|
68
76
|
bgpvpn = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)
|
|
69
77
|
network = client.find_network(
|
|
70
78
|
parsed_args.resource, ignore_missing=False
|
|
71
79
|
)
|
|
72
|
-
body: dict[str,
|
|
80
|
+
body: dict[str, Any] = {'network_id': network['id']}
|
|
73
81
|
if 'project' in parsed_args and parsed_args.project is not None:
|
|
74
82
|
project_id = osc_id.find_project(
|
|
75
83
|
self.app.client_manager.sdk_connection,
|
|
@@ -91,7 +99,7 @@ class DeleteBgpvpnNetAssoc(command.Command):
|
|
|
91
99
|
"Delete a BGP VPN network association(s) for a given BGP VPN"
|
|
92
100
|
)
|
|
93
101
|
|
|
94
|
-
def get_parser(self, prog_name):
|
|
102
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
95
103
|
parser = super().get_parser(prog_name)
|
|
96
104
|
parser.add_argument(
|
|
97
105
|
'resource_association_ids',
|
|
@@ -106,7 +114,7 @@ class DeleteBgpvpnNetAssoc(command.Command):
|
|
|
106
114
|
)
|
|
107
115
|
return parser
|
|
108
116
|
|
|
109
|
-
def take_action(self, parsed_args):
|
|
117
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
110
118
|
client = self.app.client_manager.network
|
|
111
119
|
bgpvpn = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)
|
|
112
120
|
fails = 0
|
|
@@ -138,7 +146,7 @@ class DeleteBgpvpnNetAssoc(command.Command):
|
|
|
138
146
|
class ListBgpvpnNetAssoc(command.Lister):
|
|
139
147
|
_description = _("List BGP VPN network associations for a given BGP VPN")
|
|
140
148
|
|
|
141
|
-
def get_parser(self, prog_name):
|
|
149
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
142
150
|
parser = super().get_parser(prog_name)
|
|
143
151
|
parser.add_argument(
|
|
144
152
|
'bgpvpn',
|
|
@@ -161,7 +169,9 @@ class ListBgpvpnNetAssoc(command.Lister):
|
|
|
161
169
|
)
|
|
162
170
|
return parser
|
|
163
171
|
|
|
164
|
-
def take_action(
|
|
172
|
+
def take_action(
|
|
173
|
+
self, parsed_args: argparse.Namespace
|
|
174
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
165
175
|
client = self.app.client_manager.network
|
|
166
176
|
bgpvpn = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)
|
|
167
177
|
params = {}
|
|
@@ -187,7 +197,7 @@ class ListBgpvpnNetAssoc(command.Lister):
|
|
|
187
197
|
class ShowBgpvpnNetAssoc(command.ShowOne):
|
|
188
198
|
_description = _("Show information of a given BGP VPN network association")
|
|
189
199
|
|
|
190
|
-
def get_parser(self, prog_name):
|
|
200
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
191
201
|
parser = super().get_parser(prog_name)
|
|
192
202
|
parser.add_argument(
|
|
193
203
|
'resource_association_id',
|
|
@@ -201,7 +211,9 @@ class ShowBgpvpnNetAssoc(command.ShowOne):
|
|
|
201
211
|
)
|
|
202
212
|
return parser
|
|
203
213
|
|
|
204
|
-
def take_action(
|
|
214
|
+
def take_action(
|
|
215
|
+
self, parsed_args: argparse.Namespace
|
|
216
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
205
217
|
client = self.app.client_manager.network
|
|
206
218
|
bgpvpn = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)
|
|
207
219
|
obj = client.get_bgpvpn_network_association(
|
|
@@ -12,11 +12,15 @@
|
|
|
12
12
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
13
13
|
# License for the specific language governing permissions and limitations
|
|
14
14
|
# under the License.
|
|
15
|
-
#
|
|
16
15
|
|
|
16
|
+
import argparse
|
|
17
|
+
from collections.abc import Iterable, Sequence
|
|
17
18
|
import logging
|
|
18
|
-
|
|
19
|
+
from typing import Any
|
|
19
20
|
|
|
21
|
+
from openstack.network.v2 import (
|
|
22
|
+
bgpvpn_port_association as _bgpvpn_port_association,
|
|
23
|
+
)
|
|
20
24
|
from osc_lib.cli import format_columns
|
|
21
25
|
from osc_lib.cli import identity as osc_id
|
|
22
26
|
from osc_lib.cli import parseractions
|
|
@@ -55,7 +59,9 @@ _formatters = {
|
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
|
|
58
|
-
def _get_columns(
|
|
62
|
+
def _get_columns(
|
|
63
|
+
item: _bgpvpn_port_association.BgpVpnPortAssociation,
|
|
64
|
+
) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
|
59
65
|
column_map: dict[str, str] = {}
|
|
60
66
|
hidden_columns = ['location', 'name', 'tenant_id']
|
|
61
67
|
return osc_utils.get_osc_show_columns_for_sdk_resource(
|
|
@@ -63,7 +69,7 @@ def _get_columns(item):
|
|
|
63
69
|
)
|
|
64
70
|
|
|
65
71
|
|
|
66
|
-
def _transform_resource(data):
|
|
72
|
+
def _transform_resource(data: Any) -> Any:
|
|
67
73
|
"""Transforms BGP VPN port association routes property.
|
|
68
74
|
|
|
69
75
|
Separates the two route types and formats them with ListColumn.
|
|
@@ -101,7 +107,7 @@ def _transform_resource(data):
|
|
|
101
107
|
return data
|
|
102
108
|
|
|
103
109
|
|
|
104
|
-
def _get_common_parser(parser, action):
|
|
110
|
+
def _get_common_parser(parser: argparse.ArgumentParser, action: str) -> None:
|
|
105
111
|
"""Adds to parser arguments common to create, set and unset commands.
|
|
106
112
|
|
|
107
113
|
:params ArgumentParser parser: argparse object contains all command's
|
|
@@ -194,8 +200,10 @@ def _get_common_parser(parser, action):
|
|
|
194
200
|
)
|
|
195
201
|
|
|
196
202
|
|
|
197
|
-
def _args2body(
|
|
198
|
-
|
|
203
|
+
def _args2body(
|
|
204
|
+
client: Any, action: str, bgpvpn_id: str, args: argparse.Namespace
|
|
205
|
+
) -> dict[str, Any]:
|
|
206
|
+
attrs: dict[str, Any] = {}
|
|
199
207
|
|
|
200
208
|
if action != 'create':
|
|
201
209
|
assoc = client.find_bgpvpn_port_association(
|
|
@@ -211,7 +219,7 @@ def _args2body(client, action, bgpvpn_id, args):
|
|
|
211
219
|
elif args.no_advertise_fixed_ips:
|
|
212
220
|
attrs['advertise_fixed_ips'] = action == 'unset'
|
|
213
221
|
|
|
214
|
-
prefix_routes: dict[str,
|
|
222
|
+
prefix_routes: dict[str, Any] | None = None
|
|
215
223
|
if 'purge_prefix_route' in args and args.purge_prefix_route:
|
|
216
224
|
prefix_routes = {}
|
|
217
225
|
else:
|
|
@@ -232,7 +240,7 @@ def _args2body(client, action, bgpvpn_id, args):
|
|
|
232
240
|
for prefix in args.prefix_routes:
|
|
233
241
|
prefix_routes.pop(prefix, None)
|
|
234
242
|
|
|
235
|
-
bgpvpn_routes: dict[str,
|
|
243
|
+
bgpvpn_routes: dict[str, Any] | None = None
|
|
236
244
|
if 'purge_bgpvpn_route' in args and args.purge_bgpvpn_route:
|
|
237
245
|
bgpvpn_routes = {}
|
|
238
246
|
else:
|
|
@@ -262,7 +270,7 @@ def _args2body(client, action, bgpvpn_id, args):
|
|
|
262
270
|
attrs.setdefault('routes', [])
|
|
263
271
|
elif prefix_routes is not None:
|
|
264
272
|
for prefix, local_pref in prefix_routes.items():
|
|
265
|
-
route: dict[str,
|
|
273
|
+
route: dict[str, Any] = {
|
|
266
274
|
'type': 'prefix',
|
|
267
275
|
'prefix': prefix,
|
|
268
276
|
}
|
|
@@ -287,7 +295,7 @@ def _args2body(client, action, bgpvpn_id, args):
|
|
|
287
295
|
class CreateBgpvpnPortAssoc(command.ShowOne):
|
|
288
296
|
_description = _("Create a BGP VPN port association")
|
|
289
297
|
|
|
290
|
-
def get_parser(self, prog_name):
|
|
298
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
291
299
|
parser = super().get_parser(prog_name)
|
|
292
300
|
osc_id.add_project_owner_option_to_parser(parser)
|
|
293
301
|
parser.add_argument(
|
|
@@ -303,11 +311,13 @@ class CreateBgpvpnPortAssoc(command.ShowOne):
|
|
|
303
311
|
_get_common_parser(parser, 'create')
|
|
304
312
|
return parser
|
|
305
313
|
|
|
306
|
-
def take_action(
|
|
314
|
+
def take_action(
|
|
315
|
+
self, parsed_args: argparse.Namespace
|
|
316
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
307
317
|
client = self.app.client_manager.network
|
|
308
318
|
bgpvpn = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)
|
|
309
319
|
port = client.find_port(parsed_args.port, ignore_missing=False)
|
|
310
|
-
body: dict[str,
|
|
320
|
+
body: dict[str, Any] = {'port_id': port['id']}
|
|
311
321
|
if 'project' in parsed_args and parsed_args.project is not None:
|
|
312
322
|
project_id = osc_id.find_project(
|
|
313
323
|
self.app.client_manager.sdk_connection,
|
|
@@ -331,7 +341,7 @@ class SetBgpvpnPortAssoc(command.Command):
|
|
|
331
341
|
_description = _("Set BGP VPN port association properties")
|
|
332
342
|
_action = 'set'
|
|
333
343
|
|
|
334
|
-
def get_parser(self, prog_name):
|
|
344
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
335
345
|
parser = super().get_parser(prog_name)
|
|
336
346
|
parser.add_argument(
|
|
337
347
|
'port_association_id',
|
|
@@ -346,7 +356,7 @@ class SetBgpvpnPortAssoc(command.Command):
|
|
|
346
356
|
_get_common_parser(parser, self._action)
|
|
347
357
|
return parser
|
|
348
358
|
|
|
349
|
-
def take_action(self, parsed_args):
|
|
359
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
350
360
|
client = self.app.client_manager.network
|
|
351
361
|
bgpvpn = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)
|
|
352
362
|
body = _args2body(client, self._action, bgpvpn['id'], parsed_args)
|
|
@@ -365,7 +375,7 @@ class DeleteBgpvpnPortAssoc(command.Command):
|
|
|
365
375
|
"Delete a BGP VPN port association(s) for a given BGP VPN"
|
|
366
376
|
)
|
|
367
377
|
|
|
368
|
-
def get_parser(self, prog_name):
|
|
378
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
369
379
|
parser = super().get_parser(prog_name)
|
|
370
380
|
parser.add_argument(
|
|
371
381
|
'port_association_ids',
|
|
@@ -380,7 +390,7 @@ class DeleteBgpvpnPortAssoc(command.Command):
|
|
|
380
390
|
)
|
|
381
391
|
return parser
|
|
382
392
|
|
|
383
|
-
def take_action(self, parsed_args):
|
|
393
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
384
394
|
client = self.app.client_manager.network
|
|
385
395
|
bgpvpn = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)
|
|
386
396
|
fails = 0
|
|
@@ -412,7 +422,7 @@ class DeleteBgpvpnPortAssoc(command.Command):
|
|
|
412
422
|
class ListBgpvpnPortAssoc(command.Lister):
|
|
413
423
|
_description = _("List BGP VPN port associations for a given BGP VPN")
|
|
414
424
|
|
|
415
|
-
def get_parser(self, prog_name):
|
|
425
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
416
426
|
parser = super().get_parser(prog_name)
|
|
417
427
|
parser.add_argument(
|
|
418
428
|
'bgpvpn',
|
|
@@ -435,7 +445,9 @@ class ListBgpvpnPortAssoc(command.Lister):
|
|
|
435
445
|
)
|
|
436
446
|
return parser
|
|
437
447
|
|
|
438
|
-
def take_action(
|
|
448
|
+
def take_action(
|
|
449
|
+
self, parsed_args: argparse.Namespace
|
|
450
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
439
451
|
client = self.app.client_manager.network
|
|
440
452
|
bgpvpn = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)
|
|
441
453
|
params = {}
|
|
@@ -462,7 +474,7 @@ class ListBgpvpnPortAssoc(command.Lister):
|
|
|
462
474
|
class ShowBgpvpnPortAssoc(command.ShowOne):
|
|
463
475
|
_description = _("Show information of a given BGP VPN port association")
|
|
464
476
|
|
|
465
|
-
def get_parser(self, prog_name):
|
|
477
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
466
478
|
parser = super().get_parser(prog_name)
|
|
467
479
|
parser.add_argument(
|
|
468
480
|
'port_association_id',
|
|
@@ -476,7 +488,9 @@ class ShowBgpvpnPortAssoc(command.ShowOne):
|
|
|
476
488
|
)
|
|
477
489
|
return parser
|
|
478
490
|
|
|
479
|
-
def take_action(
|
|
491
|
+
def take_action(
|
|
492
|
+
self, parsed_args: argparse.Namespace
|
|
493
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
480
494
|
client = self.app.client_manager.network
|
|
481
495
|
bgpvpn = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)
|
|
482
496
|
obj = client.get_bgpvpn_port_association(
|
|
@@ -12,10 +12,15 @@
|
|
|
12
12
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
13
13
|
# License for the specific language governing permissions and limitations
|
|
14
14
|
# under the License.
|
|
15
|
-
#
|
|
16
15
|
|
|
16
|
+
import argparse
|
|
17
|
+
from collections.abc import Iterable, Sequence
|
|
17
18
|
import logging
|
|
19
|
+
from typing import Any
|
|
18
20
|
|
|
21
|
+
from openstack.network.v2 import (
|
|
22
|
+
bgpvpn_router_association as _bgpvpn_router_association,
|
|
23
|
+
)
|
|
19
24
|
from osc_lib.cli import identity as osc_id
|
|
20
25
|
from osc_lib.cli import parseractions
|
|
21
26
|
from osc_lib import exceptions
|
|
@@ -41,7 +46,9 @@ _attr_map = (
|
|
|
41
46
|
_formatters: dict[str, osc_utils.FormatterT] = {}
|
|
42
47
|
|
|
43
48
|
|
|
44
|
-
def _get_columns(
|
|
49
|
+
def _get_columns(
|
|
50
|
+
item: _bgpvpn_router_association.BgpVpnRouterAssociation,
|
|
51
|
+
) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
|
45
52
|
column_map: dict[str, str] = {}
|
|
46
53
|
hidden_columns = ['location', 'name', 'tenant_id']
|
|
47
54
|
return osc_utils.get_osc_show_columns_for_sdk_resource(
|
|
@@ -49,7 +56,7 @@ def _get_columns(item):
|
|
|
49
56
|
)
|
|
50
57
|
|
|
51
58
|
|
|
52
|
-
def _get_common_parser(parser, action):
|
|
59
|
+
def _get_common_parser(parser: argparse.ArgumentParser, action: str) -> None:
|
|
53
60
|
"""Adds to parser arguments common to create, set and unset commands.
|
|
54
61
|
|
|
55
62
|
:params ArgumentParser parser: argparse object contains all command's
|
|
@@ -76,7 +83,7 @@ def _get_common_parser(parser, action):
|
|
|
76
83
|
)
|
|
77
84
|
|
|
78
85
|
|
|
79
|
-
def _args2body(action, args):
|
|
86
|
+
def _args2body(action: str, args: argparse.Namespace) -> dict[str, Any]:
|
|
80
87
|
attrs = {'advertise_extra_routes': False}
|
|
81
88
|
if args.advertise_extra_routes:
|
|
82
89
|
attrs['advertise_extra_routes'] = action != 'unset'
|
|
@@ -88,7 +95,7 @@ def _args2body(action, args):
|
|
|
88
95
|
class CreateBgpvpnRouterAssoc(command.ShowOne):
|
|
89
96
|
_description = _("Create a BGP VPN router association")
|
|
90
97
|
|
|
91
|
-
def get_parser(self, prog_name):
|
|
98
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
92
99
|
parser = super().get_parser(prog_name)
|
|
93
100
|
osc_id.add_project_owner_option_to_parser(parser)
|
|
94
101
|
parser.add_argument(
|
|
@@ -104,7 +111,9 @@ class CreateBgpvpnRouterAssoc(command.ShowOne):
|
|
|
104
111
|
_get_common_parser(parser, 'create')
|
|
105
112
|
return parser
|
|
106
113
|
|
|
107
|
-
def take_action(
|
|
114
|
+
def take_action(
|
|
115
|
+
self, parsed_args: argparse.Namespace
|
|
116
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
108
117
|
client = self.app.client_manager.network
|
|
109
118
|
bgpvpn = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)
|
|
110
119
|
router = client.find_router(parsed_args.resource, ignore_missing=False)
|
|
@@ -131,7 +140,7 @@ class SetBgpvpnRouterAssoc(command.Command):
|
|
|
131
140
|
_description = _("Set BGP VPN router association properties")
|
|
132
141
|
_action = 'set'
|
|
133
142
|
|
|
134
|
-
def get_parser(self, prog_name):
|
|
143
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
135
144
|
parser = super().get_parser(prog_name)
|
|
136
145
|
parser.add_argument(
|
|
137
146
|
'resource_association_id',
|
|
@@ -146,7 +155,7 @@ class SetBgpvpnRouterAssoc(command.Command):
|
|
|
146
155
|
_get_common_parser(parser, self._action)
|
|
147
156
|
return parser
|
|
148
157
|
|
|
149
|
-
def take_action(self, parsed_args):
|
|
158
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
150
159
|
client = self.app.client_manager.network
|
|
151
160
|
bgpvpn = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)
|
|
152
161
|
body = _args2body(self._action, parsed_args)
|
|
@@ -165,7 +174,7 @@ class DeleteBgpvpnRouterAssoc(command.Command):
|
|
|
165
174
|
"Delete a BGP VPN router association(s) for a given BGP VPN"
|
|
166
175
|
)
|
|
167
176
|
|
|
168
|
-
def get_parser(self, prog_name):
|
|
177
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
169
178
|
parser = super().get_parser(prog_name)
|
|
170
179
|
parser.add_argument(
|
|
171
180
|
'resource_association_ids',
|
|
@@ -180,7 +189,7 @@ class DeleteBgpvpnRouterAssoc(command.Command):
|
|
|
180
189
|
)
|
|
181
190
|
return parser
|
|
182
191
|
|
|
183
|
-
def take_action(self, parsed_args):
|
|
192
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
184
193
|
client = self.app.client_manager.network
|
|
185
194
|
bgpvpn = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)
|
|
186
195
|
fails = 0
|
|
@@ -212,7 +221,7 @@ class DeleteBgpvpnRouterAssoc(command.Command):
|
|
|
212
221
|
class ListBgpvpnRouterAssoc(command.Lister):
|
|
213
222
|
_description = _("List BGP VPN router associations for a given BGP VPN")
|
|
214
223
|
|
|
215
|
-
def get_parser(self, prog_name):
|
|
224
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
216
225
|
parser = super().get_parser(prog_name)
|
|
217
226
|
parser.add_argument(
|
|
218
227
|
'bgpvpn',
|
|
@@ -235,7 +244,9 @@ class ListBgpvpnRouterAssoc(command.Lister):
|
|
|
235
244
|
)
|
|
236
245
|
return parser
|
|
237
246
|
|
|
238
|
-
def take_action(
|
|
247
|
+
def take_action(
|
|
248
|
+
self, parsed_args: argparse.Namespace
|
|
249
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
239
250
|
client = self.app.client_manager.network
|
|
240
251
|
bgpvpn = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)
|
|
241
252
|
params = {}
|
|
@@ -261,7 +272,7 @@ class ListBgpvpnRouterAssoc(command.Lister):
|
|
|
261
272
|
class ShowBgpvpnRouterAssoc(command.ShowOne):
|
|
262
273
|
_description = _("Show information of a given BGP VPN router association")
|
|
263
274
|
|
|
264
|
-
def get_parser(self, prog_name):
|
|
275
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
265
276
|
parser = super().get_parser(prog_name)
|
|
266
277
|
parser.add_argument(
|
|
267
278
|
'resource_association_id',
|
|
@@ -275,7 +286,9 @@ class ShowBgpvpnRouterAssoc(command.ShowOne):
|
|
|
275
286
|
)
|
|
276
287
|
return parser
|
|
277
288
|
|
|
278
|
-
def take_action(
|
|
289
|
+
def take_action(
|
|
290
|
+
self, parsed_args: argparse.Namespace
|
|
291
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
279
292
|
client = self.app.client_manager.network
|
|
280
293
|
bgpvpn = client.find_bgpvpn(parsed_args.bgpvpn, ignore_missing=False)
|
|
281
294
|
obj = client.get_bgpvpn_router_association(
|
|
@@ -18,6 +18,9 @@ import logging
|
|
|
18
18
|
from collections.abc import Iterable, Sequence
|
|
19
19
|
from typing import Any
|
|
20
20
|
|
|
21
|
+
from openstack.network.v2 import (
|
|
22
|
+
default_security_group_rule as _default_security_group_rule,
|
|
23
|
+
)
|
|
21
24
|
from osc_lib.cli import parseractions
|
|
22
25
|
from osc_lib import exceptions
|
|
23
26
|
from osc_lib import utils
|
|
@@ -30,7 +33,9 @@ from openstackclient.network import utils as network_utils
|
|
|
30
33
|
LOG = logging.getLogger(__name__)
|
|
31
34
|
|
|
32
35
|
|
|
33
|
-
def _get_columns(
|
|
36
|
+
def _get_columns(
|
|
37
|
+
item: _default_security_group_rule.DefaultSecurityGroupRule,
|
|
38
|
+
) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
|
34
39
|
hidden_columns = ['location', 'name', 'revision_number']
|
|
35
40
|
return utils.get_osc_show_columns_for_sdk_resource(
|
|
36
41
|
item, {}, hidden_columns
|
|
@@ -286,16 +291,19 @@ class ListDefaultSecurityGroupRule(command.Lister):
|
|
|
286
291
|
security groups.
|
|
287
292
|
"""
|
|
288
293
|
|
|
289
|
-
|
|
294
|
+
@staticmethod
|
|
295
|
+
def _format_network_security_group_rule(
|
|
296
|
+
rule: _default_security_group_rule.DefaultSecurityGroupRule,
|
|
297
|
+
) -> dict[str, object]:
|
|
290
298
|
"""Transform the SDK DefaultSecurityGroupRule object to a dict
|
|
291
299
|
|
|
292
300
|
The SDK object gets in the way of reformatting columns...
|
|
293
301
|
Create port_range column from port_range_min and port_range_max
|
|
294
302
|
"""
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
return
|
|
303
|
+
data = rule.to_dict()
|
|
304
|
+
data['port_range'] = network_utils.format_network_port_range(data)
|
|
305
|
+
data['remote_ip_prefix'] = network_utils.format_remote_ip_prefix(data)
|
|
306
|
+
return data
|
|
299
307
|
|
|
300
308
|
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
301
309
|
parser = super().get_parser(prog_name)
|