Get default value for BFD/ECMP extra attributes from config
The default value for 'enable_default_route_bfd' and 'enable_default_route_ecmp' is configurable. Ensure the default comes from configuration if a request to create router does not contain a value for these attributes. Partial-Bug: #2002687 Change-Id: I581f4c5e5cfa275f8a6f0adec405f205e877ac55
This commit is contained in:
parent
452dd89ab0
commit
8219f3f61b
|
@ -36,6 +36,7 @@ from neutron_lib.exceptions import l3 as l3_exc
|
||||||
from neutron_lib.exceptions import l3_ext_gw_multihoming as mh_exc
|
from neutron_lib.exceptions import l3_ext_gw_multihoming as mh_exc
|
||||||
from neutron_lib.plugins import constants as plugin_constants
|
from neutron_lib.plugins import constants as plugin_constants
|
||||||
from neutron_lib.plugins import directory
|
from neutron_lib.plugins import directory
|
||||||
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
|
||||||
def format_gateway_info(gw_port):
|
def format_gateway_info(gw_port):
|
||||||
|
@ -79,11 +80,16 @@ class ExtraGatewaysDbOnlyMixin(l3_gwmode_db.L3_NAT_dbonly_mixin):
|
||||||
|
|
||||||
@registry.receives(resources.ROUTER, [events.PRECOMMIT_CREATE])
|
@registry.receives(resources.ROUTER, [events.PRECOMMIT_CREATE])
|
||||||
def _process_bfd_ecmp_request(self, resource, event, trigger, payload):
|
def _process_bfd_ecmp_request(self, resource, event, trigger, payload):
|
||||||
|
attr_defaults = {
|
||||||
|
l3_enable_default_route_ecmp.ENABLE_DEFAULT_ROUTE_ECMP: (
|
||||||
|
cfg.CONF.enable_default_route_ecmp),
|
||||||
|
l3_enable_default_route_bfd.ENABLE_DEFAULT_ROUTE_BFD: (
|
||||||
|
cfg.CONF.enable_default_route_bfd),
|
||||||
|
}
|
||||||
router = payload.latest_state
|
router = payload.latest_state
|
||||||
router_db = payload.metadata['router_db']
|
router_db = payload.metadata['router_db']
|
||||||
for attr in (l3_enable_default_route_ecmp.ENABLE_DEFAULT_ROUTE_ECMP,
|
for attr in attr_defaults.keys():
|
||||||
l3_enable_default_route_bfd.ENABLE_DEFAULT_ROUTE_BFD):
|
value = router.get(attr, attr_defaults[attr])
|
||||||
value = router.get(attr)
|
|
||||||
if value is not None:
|
if value is not None:
|
||||||
self.set_extra_attr_value(router_db, attr, value)
|
self.set_extra_attr_value(router_db, attr, value)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue