From 81a330113b5ae3d9b163eb2a92bfa0a628a31dd1 Mon Sep 17 00:00:00 2001 From: yangjianfeng Date: Tue, 14 Jun 2022 11:15:02 +0800 Subject: [PATCH] Return default value when get router's enable_ndp_proxy from `request_body` In some cases, the creation of router was called by `l3 plugin` directly, didn't call API. In this way, the router's request_body of the `ndp_proxy` service plugin received has no `enable_ndp_proxy`, this will result in `ndp_proxy` service plugin raise error. Closes-Bug: #1978519 Related-Bug: #1877301 Change-Id: I413c33970002532d11de5bc2afb145704a8488a9 --- neutron/services/ndp_proxy/plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neutron/services/ndp_proxy/plugin.py b/neutron/services/ndp_proxy/plugin.py index 553414a1e85..e7a4c391d3e 100644 --- a/neutron/services/ndp_proxy/plugin.py +++ b/neutron/services/ndp_proxy/plugin.py @@ -174,7 +174,8 @@ class NDPProxyPlugin(l3_ndp_proxy.NDPProxyBase): context = payload.context router_db = payload.metadata['router_db'] request_body = payload.states[0] - ndp_proxy_state = request_body[l3_ext_ndp_proxy.ENABLE_NDP_PROXY] + ndp_proxy_state = request_body.get( + l3_ext_ndp_proxy.ENABLE_NDP_PROXY, lib_consts.ATTR_NOT_SPECIFIED) ext_gw_info = request_body.get('external_gateway_info') if not ext_gw_info and ndp_proxy_state is True: