use l3 api def from neutron-lib
Commit I81748aa0e48b1275df3e1ea41b1d36a117d0097d added the l3 extension API definition to neutron-lib, commit I2324a3a02789c798248cab41c278a2d9981d24be rehomed the l3 exceptions and Ifd79eb1a92853e49bd4ef028e7a7bd89811c6957 shims the l3 exceptions in neutron. This patch consumes the l3 API definition from neutron-lib in prep for If2e66e06b83e15ee2851ea2bc3b64ad366e675dd Change-Id: Ia63996c641de43472445f6e8ebdb259f89e2b10c
This commit is contained in:
parent
c999d3bbfe
commit
8030a26d17
|
@ -43,10 +43,10 @@ from neutron.db import l3_dvr_db
|
||||||
from neutron.db import l3_hamode_db # noqa
|
from neutron.db import l3_hamode_db # noqa
|
||||||
from neutron.db import models_v2
|
from neutron.db import models_v2
|
||||||
from neutron.db import portbindings_db
|
from neutron.db import portbindings_db
|
||||||
from neutron.extensions import l3
|
|
||||||
from neutron.extensions import providernet as provider
|
from neutron.extensions import providernet as provider
|
||||||
from neutron_lib.api.definitions import availability_zone as az_def
|
from neutron_lib.api.definitions import availability_zone as az_def
|
||||||
from neutron_lib.api.definitions import external_net
|
from neutron_lib.api.definitions import external_net
|
||||||
|
from neutron_lib.api.definitions import l3 as l3_apidef
|
||||||
from neutron_lib.api.definitions import portbindings
|
from neutron_lib.api.definitions import portbindings
|
||||||
from neutron_lib.api.definitions import provider_net
|
from neutron_lib.api.definitions import provider_net
|
||||||
from neutron_lib.api import validators
|
from neutron_lib.api import validators
|
||||||
|
@ -1435,7 +1435,7 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
|
|
||||||
def _add_router_gateway(self, context, router_id, router_data):
|
def _add_router_gateway(self, context, router_id, router_data):
|
||||||
# get top external network information
|
# get top external network information
|
||||||
ext_net_id = router_data[l3.EXTERNAL_GW_INFO].get('network_id')
|
ext_net_id = router_data[l3_apidef.EXTERNAL_GW_INFO].get('network_id')
|
||||||
t_ctx = t_context.get_context_from_neutron_context(context)
|
t_ctx = t_context.get_context_from_neutron_context(context)
|
||||||
network = self.get_network(context, ext_net_id)
|
network = self.get_network(context, ext_net_id)
|
||||||
|
|
||||||
|
@ -1480,7 +1480,7 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
# both router and external network in bottom pod are ready, attach
|
# both router and external network in bottom pod are ready, attach
|
||||||
# external network to router in bottom pod.
|
# external network to router in bottom pod.
|
||||||
b_client = self._get_client(region_name)
|
b_client = self._get_client(region_name)
|
||||||
t_info = router_data[l3.EXTERNAL_GW_INFO]
|
t_info = router_data[l3_apidef.EXTERNAL_GW_INFO]
|
||||||
b_info = {'network_id': b_net_id}
|
b_info = {'network_id': b_net_id}
|
||||||
if 'enable_snat' in t_info:
|
if 'enable_snat' in t_info:
|
||||||
b_info['enable_snat'] = t_info['enable_snat']
|
b_info['enable_snat'] = t_info['enable_snat']
|
||||||
|
@ -1572,9 +1572,10 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
router_data = copy.deepcopy(router['router'])
|
router_data = copy.deepcopy(router['router'])
|
||||||
need_update_bottom = False
|
need_update_bottom = False
|
||||||
is_add = False
|
is_add = False
|
||||||
if validators.is_attr_set(router_data.get(l3.EXTERNAL_GW_INFO)):
|
if validators.is_attr_set(router_data.get(l3_apidef.EXTERNAL_GW_INFO)):
|
||||||
need_update_bottom = True
|
need_update_bottom = True
|
||||||
ext_net_id = router_data[l3.EXTERNAL_GW_INFO].get('network_id')
|
ext_net_id = router_data[l3_apidef.EXTERNAL_GW_INFO].get(
|
||||||
|
'network_id')
|
||||||
if ext_net_id:
|
if ext_net_id:
|
||||||
is_add = True
|
is_add = True
|
||||||
# TODO(zhiyuan) solve ip address conflict issue
|
# TODO(zhiyuan) solve ip address conflict issue
|
||||||
|
@ -1594,7 +1595,8 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
if is_add:
|
if is_add:
|
||||||
ret = super(TricirclePlugin, self).update_router(
|
ret = super(TricirclePlugin, self).update_router(
|
||||||
context, router_id, router)
|
context, router_id, router)
|
||||||
router_data[l3.EXTERNAL_GW_INFO].update(ret[l3.EXTERNAL_GW_INFO])
|
router_data[l3_apidef.EXTERNAL_GW_INFO].update(
|
||||||
|
ret[l3_apidef.EXTERNAL_GW_INFO])
|
||||||
self._add_router_gateway(context, router_id, router_data)
|
self._add_router_gateway(context, router_id, router_data)
|
||||||
else:
|
else:
|
||||||
self._remove_router_gateway(context, router_id)
|
self._remove_router_gateway(context, router_id)
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
from sqlalchemy import orm
|
from sqlalchemy import orm
|
||||||
|
|
||||||
from neutron_lib import constants
|
from neutron_lib import constants
|
||||||
|
from neutron_lib.exceptions import l3 as l3_exc
|
||||||
|
|
||||||
from neutron.db.models import l3 as l3_models
|
from neutron.db.models import l3 as l3_models
|
||||||
from neutron.db import models_v2
|
from neutron.db import models_v2
|
||||||
from neutron.extensions import l3
|
|
||||||
from neutron.services.l3_router import l3_router_plugin
|
from neutron.services.l3_router import l3_router_plugin
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class TricircleL3Plugin(l3_router_plugin.L3RouterPlugin):
|
||||||
if first_router_id:
|
if first_router_id:
|
||||||
return first_router_id
|
return first_router_id
|
||||||
|
|
||||||
raise l3.ExternalGatewayForFloatingIPNotFound(
|
raise l3_exc.ExternalGatewayForFloatingIPNotFound(
|
||||||
subnet_id=internal_subnet['id'],
|
subnet_id=internal_subnet['id'],
|
||||||
external_network_id=external_network_id,
|
external_network_id=external_network_id,
|
||||||
port_id=internal_port['id'])
|
port_id=internal_port['id'])
|
||||||
|
|
Loading…
Reference in New Issue