NSXP: Use native route advertisement rule API
Change-Id: Ia35986c082f4d8daf355a6e535393e4b06c3f707 Depends-On: Iad1011252fd21c87b1b5bd454fd6fb5a8064835d
This commit is contained in:
parent
e871f7d2e9
commit
1b7ff25d56
@ -14,13 +14,12 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron_lib import exceptions as n_exc
|
from neutron_lib import exceptions as n_exc
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import helpers as log_helpers
|
from oslo_log import helpers as log_helpers
|
||||||
|
|
||||||
from vmware_nsx._i18n import _
|
from vmware_nsx._i18n import _
|
||||||
from vmware_nsx.services.lbaas import lb_const
|
from vmware_nsx.services.lbaas import lb_const
|
||||||
from vmware_nsx.services.lbaas.nsx_p.implementation import lb_const as p_const
|
from vmware_nsx.services.lbaas.nsx_p.implementation import lb_const as p_const
|
||||||
from vmware_nsx.services.lbaas.nsx_v3.implementation import lb_utils
|
from vmware_nsxlib.v3.policy import constants as p_constants
|
||||||
|
|
||||||
ADV_RULE_NAME = 'LB external VIP advertisement'
|
ADV_RULE_NAME = 'LB external VIP advertisement'
|
||||||
|
|
||||||
@ -122,26 +121,14 @@ def update_router_lb_vip_advertisement(context, core_plugin, router_id):
|
|||||||
router = core_plugin.get_router(context, router_id)
|
router = core_plugin.get_router(context, router_id)
|
||||||
|
|
||||||
# Add a rule to advertise external vips on the router
|
# Add a rule to advertise external vips on the router
|
||||||
|
external_subnets = core_plugin._find_router_gw_subnets(
|
||||||
# TODO(kobis): Code below should be executed when platform supports
|
context.elevated(), router)
|
||||||
#
|
external_cidrs = [s['cidr'] for s in external_subnets]
|
||||||
# external_subnets = core_plugin._find_router_gw_subnets(
|
if external_cidrs:
|
||||||
# context.elevated(), router)
|
core_plugin.nsxpolicy.tier1.add_advertisement_rule(
|
||||||
# external_cidrs = [s['cidr'] for s in external_subnets]
|
router_id,
|
||||||
# if external_cidrs:
|
ADV_RULE_NAME,
|
||||||
# core_plugin.nsxpolicy.tier1.add_advertisement_rule(
|
p_constants.ADV_RULE_PERMIT,
|
||||||
# router_id,
|
p_constants.ADV_RULE_OPERATOR_GE,
|
||||||
# ADV_RULE_NAME,
|
[p_constants.ADV_RULE_TIER1_LB_VIP],
|
||||||
# p_constants.ADV_RULE_PERMIT,
|
external_cidrs)
|
||||||
# p_constants.ADV_RULE_OPERATOR_GE,
|
|
||||||
# [p_constants.ADV_RULE_TIER1_LB_VIP],
|
|
||||||
# external_cidrs)
|
|
||||||
if cfg.CONF.nsx_p.allow_passthrough:
|
|
||||||
lb_utils.update_router_lb_vip_advertisement(
|
|
||||||
context, core_plugin, router,
|
|
||||||
core_plugin.nsxpolicy.tier1.get_realized_id(
|
|
||||||
router_id, entity_type='RealizedLogicalRouter'))
|
|
||||||
else:
|
|
||||||
msg = (_('Failed to set loadbalancer advertisement rule for router %s')
|
|
||||||
% router_id)
|
|
||||||
raise n_exc.BadRequest(resource='lbaas-loadbalancer', msg=msg)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user