summaryrefslogtreecommitdiff
path: root/openstackclient/network/v2/router.py
diff options
context:
space:
mode:
authorYang JianFeng <yjf1970231893@gmail.com>2020-08-31 11:39:48 +0000
committeryangjianfeng <yjf1970231893@gmail.com>2022-08-26 08:15:43 +0800
commitb36cd0f4c0416182ce69d71a4e99d89507d53e7f (patch)
tree52faf7f0694c9896e35b170e9383148bc986a11f /openstackclient/network/v2/router.py
parent27b2496e03ceb95b56b3b1b68a57058fe90251b5 (diff)
downloadpython-openstackclient-b36cd0f4c0416182ce69d71a4e99d89507d53e7f.tar.gz
Add router ndp proxy commands
Depends-on: https://review.opendev.org/749036 Change-Id: I77e12cc2dfe4000bd5ae6511878c6591f52d9791 Related-Bug: #1877301
Diffstat (limited to 'openstackclient/network/v2/router.py')
-rw-r--r--openstackclient/network/v2/router.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/openstackclient/network/v2/router.py b/openstackclient/network/v2/router.py
index f1fce298..8302ee01 100644
--- a/openstackclient/network/v2/router.py
+++ b/openstackclient/network/v2/router.py
@@ -369,6 +369,21 @@ class CreateRouter(command.ShowOne, common.NeutronCommandWithExtraArgs):
action='store_true',
help=_("Disable Source NAT on external gateway")
)
+ ndp_proxy_group = parser.add_mutually_exclusive_group()
+ ndp_proxy_group.add_argument(
+ '--enable-ndp-proxy',
+ dest='enable_ndp_proxy',
+ default=None,
+ action='store_true',
+ help=_("Enable IPv6 NDP proxy on external gateway")
+ )
+ ndp_proxy_group.add_argument(
+ '--disable-ndp-proxy',
+ dest='enable_ndp_proxy',
+ default=None,
+ action='store_false',
+ help=_("Disable IPv6 NDP proxy on external gateway")
+ )
return parser
@@ -383,6 +398,14 @@ class CreateRouter(command.ShowOne, common.NeutronCommandWithExtraArgs):
attrs.update(
self._parse_extra_properties(parsed_args.extra_properties))
+ if parsed_args.enable_ndp_proxy and not parsed_args.external_gateway:
+ msg = (_("You must specify '--external-gateway' in order "
+ "to enable router's NDP proxy"))
+ raise exceptions.CommandError(msg)
+
+ if parsed_args.enable_ndp_proxy is not None:
+ attrs['enable_ndp_proxy'] = parsed_args.enable_ndp_proxy
+
obj = client.create_router(**attrs)
# tags cannot be set when created, so tags need to be set later.
_tag.update_tags_for_set(client, obj, parsed_args)
@@ -737,6 +760,21 @@ class SetRouter(common.NeutronCommandWithExtraArgs):
action='store_true',
help=_("Disable Source NAT on external gateway")
)
+ ndp_proxy_group = parser.add_mutually_exclusive_group()
+ ndp_proxy_group.add_argument(
+ '--enable-ndp-proxy',
+ dest='enable_ndp_proxy',
+ default=None,
+ action='store_true',
+ help=_("Enable IPv6 NDP proxy on external gateway")
+ )
+ ndp_proxy_group.add_argument(
+ '--disable-ndp-proxy',
+ dest='enable_ndp_proxy',
+ default=None,
+ action='store_false',
+ help=_("Disable IPv6 NDP proxy on external gateway")
+ )
qos_policy_group = parser.add_mutually_exclusive_group()
qos_policy_group.add_argument(
'--qos-policy',
@@ -804,6 +842,9 @@ class SetRouter(common.NeutronCommandWithExtraArgs):
attrs.update(
self._parse_extra_properties(parsed_args.extra_properties))
+ if parsed_args.enable_ndp_proxy is not None:
+ attrs['enable_ndp_proxy'] = parsed_args.enable_ndp_proxy
+
if attrs:
client.update_router(obj, **attrs)
# tags is a subresource and it needs to be updated separately.