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
This commit is contained in:
yangjianfeng 2022-06-14 11:15:02 +08:00
parent 275b458f14
commit 81a330113b
1 changed files with 2 additions and 1 deletions

View File

@ -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: