use ml2 driver api from neutron-lib

The ml2 plugin driver API was rehomed into neutron-lib with commit
Ifc829953ef4d5859c3475903965dc08aba42fd9c and the API was shimmed in
neutron with I86a10091b55d1123e8d16f16155e0312bb10e54c. In prep for
neutron consumption Ice49572e217eeaf820e48d40f2251d08766490b5 this
patch switches over to lib's version of the respective code.

Change-Id: If6e20cf90cdf61a05a499f1251376db498e5e7c0
This commit is contained in:
Boden R 2017-10-25 12:51:11 -06:00
parent 6b792d017e
commit f969f8973b
4 changed files with 12 additions and 12 deletions

View File

@ -13,11 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.plugins.ml2 import api
from oslo_config import cfg
from oslo_log import log
from neutron.common import exceptions
from neutron.plugins.ml2 import driver_api
from neutron.plugins.ml2.drivers import type_flat
from tricircle.common import constants
@ -45,8 +45,8 @@ class FlatTypeDriver(type_flat.FlatTypeDriver):
# for external network, we ignore this exception and let local
# Neutron judge whether the physical network is valid
res = segment
res[driver_api.MTU] = None
res[driver_api.NETWORK_TYPE] = self.get_type()
res[api.MTU] = None
res[api.NETWORK_TYPE] = self.get_type()
return res
def get_mtu(self, physical_network=None):

View File

@ -13,12 +13,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron.plugins.ml2 import driver_api
from neutron_lib.plugins.ml2 import api
from tricircle.common import constants
class LocalTypeDriver(driver_api.TypeDriver):
class LocalTypeDriver(api.TypeDriver):
def get_type(self):
return constants.NT_LOCAL
@ -35,7 +35,7 @@ class LocalTypeDriver(driver_api.TypeDriver):
return segment
def allocate_tenant_segment(self, context):
return {driver_api.NETWORK_TYPE: constants.NT_LOCAL}
return {api.NETWORK_TYPE: constants.NT_LOCAL}
def release_segment(self, context, segment):
pass

View File

@ -15,11 +15,11 @@
import sys
from neutron_lib.plugins.ml2 import api
from oslo_config import cfg
from oslo_log import log
from neutron.plugins.common import utils as plugin_utils
from neutron.plugins.ml2 import driver_api
from neutron.plugins.ml2.drivers import type_vlan
from tricircle.common import constants
@ -47,13 +47,13 @@ class VLANTypeDriver(type_vlan.VlanTypeDriver):
def reserve_provider_segment(self, context, segment):
res = super(VLANTypeDriver,
self).reserve_provider_segment(context, segment)
res[driver_api.NETWORK_TYPE] = constants.NT_VLAN
res[api.NETWORK_TYPE] = constants.NT_VLAN
return res
def allocate_tenant_segment(self, context):
res = super(VLANTypeDriver,
self).allocate_tenant_segment(context)
res[driver_api.NETWORK_TYPE] = constants.NT_VLAN
res[api.NETWORK_TYPE] = constants.NT_VLAN
return res
def get_mtu(self, physical):

View File

@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.plugins.ml2 import api
from oslo_config import cfg
from oslo_log import log
from neutron.plugins.ml2 import driver_api
from neutron.plugins.ml2.drivers import type_vxlan
from neutron_lib import constants as q_lib_constants
from neutron_lib import exceptions as n_exc
@ -46,13 +46,13 @@ class VxLANTypeDriver(type_vxlan.VxlanTypeDriver):
def reserve_provider_segment(self, context, segment):
res = super(VxLANTypeDriver,
self).reserve_provider_segment(context, segment)
res[driver_api.NETWORK_TYPE] = constants.NT_VxLAN
res[api.NETWORK_TYPE] = constants.NT_VxLAN
return res
def allocate_tenant_segment(self, context):
res = super(VxLANTypeDriver,
self).allocate_tenant_segment(context)
res[driver_api.NETWORK_TYPE] = constants.NT_VxLAN
res[api.NETWORK_TYPE] = constants.NT_VxLAN
return res
def get_mtu(self, physical_network=None):