@ -27,6 +27,7 @@ from neutron_lib.callbacks import resources
from neutron_lib import constants as lib_constants
from neutron_lib import context
from neutron_lib import exceptions as n_exc
from neutron_lib . plugins import constants as plugin_constants
from neutron_lib . plugins import directory
from oslo_config import cfg
from oslo_utils import importutils
@ -100,7 +101,7 @@ class L3NatExtensionTestCase(test_extensions_base.ExtensionTestCase):
super ( L3NatExtensionTestCase , self ) . setUp ( )
self . _setUpExtension (
' neutron.services.l3_router.l3_router_plugin.L3RouterPlugin ' ,
lib _constants. L3 , l3 . RESOURCE_ATTRIBUTE_MAP ,
plugin _constants. L3 , l3 . RESOURCE_ATTRIBUTE_MAP ,
l3 . L3 , ' ' , allow_pagination = True , allow_sorting = True ,
supported_extension_aliases = [ ' router ' ] ,
use_quota = True )
@ -269,7 +270,7 @@ class TestL3NatBasePlugin(db_base_plugin_v2.NeutronDbPluginV2,
return net
def delete_port ( self , context , id , l3_port_check = True ) :
plugin = directory . get_plugin ( lib _constants. L3 )
plugin = directory . get_plugin ( plugin _constants. L3 )
if plugin :
if l3_port_check :
plugin . prevent_l3_port_deletion ( context , id )
@ -322,7 +323,7 @@ class TestL3NatServicePlugin(common_db_mixin.CommonDbMixin,
@classmethod
def get_plugin_type ( cls ) :
return lib _constants. L3
return plugin _constants. L3
def get_plugin_description ( self ) :
return " L3 Routing Service Plugin for testing "
@ -571,7 +572,7 @@ class ExtraAttributesMixinTestCase(testlib_api.SqlTestCase):
def setUp ( self ) :
super ( ExtraAttributesMixinTestCase , self ) . setUp ( )
self . mixin = l3_attrs_db . ExtraAttributesMixin ( )
directory . add_plugin ( lib _constants. L3 , self . mixin )
directory . add_plugin ( plugin _constants. L3 , self . mixin )
self . ctx = context . get_admin_context ( )
self . router = l3_models . Router ( )
with self . ctx . session . begin ( ) :
@ -901,7 +902,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
r [ ' router ' ] [ ' id ' ] ,
n [ ' network ' ] [ ' id ' ] ,
ext_ips = [ { ' subnet_id ' : s1 [ ' subnet ' ] [ ' id ' ] } ] )
plugin = directory . get_plugin ( lib _constants. L3 )
plugin = directory . get_plugin ( plugin _constants. L3 )
mock . patch . object (
plugin , ' update_router ' ,
side_effect = l3 . RouterNotFound ( router_id = ' 1 ' ) ) . start ( )
@ -2131,7 +2132,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
self . assertIsNotNone ( body [ ' floatingip ' ] [ ' router_id ' ] )
def test_create_floatingip_non_admin_context_agent_notification ( self ) :
plugin = directory . get_plugin ( lib _constants. L3 )
plugin = directory . get_plugin ( plugin _constants. L3 )
if not hasattr ( plugin , ' l3_rpc_notifier ' ) :
self . skipTest ( " Plugin does not support l3_rpc_notifier " )
@ -2972,7 +2973,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
def test_floatingip_via_router_interface_returns_201 ( self ) :
# Override get_router_for_floatingip, as
# networking-midonet's L3 service plugin would do.
plugin = directory . get_plugin ( lib _constants. L3 )
plugin = directory . get_plugin ( plugin _constants. L3 )
with mock . patch . object ( plugin , " get_router_for_floatingip " ,
self . _get_router_for_floatingip_without_device_owner_check ) :
self . _test_floatingip_via_router_interface ( exc . HTTPCreated . code )
@ -3112,7 +3113,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
self . assertEqual ( exc . HTTPConflict . code , res . status_int )
def test_router_specify_id_backend ( self ) :
plugin = directory . get_plugin ( lib _constants. L3 )
plugin = directory . get_plugin ( plugin _constants. L3 )
router_req = { ' router ' : { ' id ' : _uuid ( ) , ' name ' : ' router ' ,
' tenant_id ' : ' foo ' ,
' admin_state_up ' : True } }
@ -3167,7 +3168,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
def test_create_router_gateway_fails_nested ( self ) :
# Force _update_router_gw_info failure
plugin = directory . get_plugin ( lib _constants. L3 )
plugin = directory . get_plugin ( plugin _constants. L3 )
if not isinstance ( plugin , l3_db . L3_NAT_dbonly_mixin ) :
self . skipTest ( " Plugin is not L3_NAT_dbonly_mixin " )
ctx = context . Context ( ' ' , ' foo ' )
@ -3198,7 +3199,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
def test_create_router_gateway_fails_nested_delete_router_failed ( self ) :
# Force _update_router_gw_info failure
plugin = directory . get_plugin ( lib _constants. L3 )
plugin = directory . get_plugin ( plugin _constants. L3 )
if not isinstance ( plugin , l3_db . L3_NAT_dbonly_mixin ) :
self . skipTest ( " Plugin is not L3_NAT_dbonly_mixin " )
ctx = context . Context ( ' ' , ' foo ' )
@ -3235,7 +3236,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
def test_router_add_interface_by_port_fails_nested ( self ) :
# Force _validate_router_port_info failure
plugin = directory . get_plugin ( lib _constants. L3 )
plugin = directory . get_plugin ( plugin _constants. L3 )
if not isinstance ( plugin , l3_db . L3_NAT_dbonly_mixin ) :
self . skipTest ( " Plugin is not L3_NAT_dbonly_mixin " )
orig_update_port = self . plugin . update_port
@ -3288,7 +3289,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
""" Test to make sure notification to routers occurs when the gateway
ip address of a subnet of the external network is changed .
"""
plugin = directory . get_plugin ( lib _constants. L3 )
plugin = directory . get_plugin ( plugin _constants. L3 )
if not hasattr ( plugin , ' l3_rpc_notifier ' ) :
self . skipTest ( " Plugin does not support l3_rpc_notifier " )
# make sure the callback is registered.
@ -3320,7 +3321,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
[ ' fake_device ' ] , None )
def test__notify_subnetpool_address_scope_update ( self ) :
plugin = directory . get_plugin ( lib _constants. L3 )
plugin = directory . get_plugin ( plugin _constants. L3 )
tenant_id = _uuid ( )
with mock . patch . object (
@ -3350,7 +3351,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
chk_method . assert_called_with ( admin_ctx , [ router [ ' router ' ] [ ' id ' ] ] )
def test_janitor_clears_orphaned_floatingip_port ( self ) :
plugin = directory . get_plugin ( lib _constants. L3 )
plugin = directory . get_plugin ( plugin _constants. L3 )
with self . network ( ) as n :
# floating IP ports are initially created with a device ID of
# PENDING and are updated after the floating IP is actually
@ -3375,7 +3376,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
# if a server dies after the floating IP is created but before it
# updates the floating IP port device ID, the janitor will be
# responsible for updating the device ID to the correct value.
plugin = directory . get_plugin ( lib _constants. L3 )
plugin = directory .