import sqlalchemy as sa
from sqlalchemy.sql import expression as sa_expr
-from neutron.extensions import portbindings
from neutron.plugins.common import constants as p_const
+from neutron.plugins.ml2.drivers.hyperv import constants
FLAT_VLAN_ID = -1
LOCAL_VLAN_ID = -2
sa_expr.select(['*'], from_obj=port_binding_ports))
ml2_bindings = [dict(x) for x in source_bindings]
for binding in ml2_bindings:
- binding['vif_type'] = portbindings.VIF_TYPE_HYPERV
+ binding['vif_type'] = constants.VIF_TYPE_HYPERV
binding['driver'] = HYPERV
segment = port_segment_map.get(binding['port_id'])
if segment:
VIF_TYPE_BRIDGE = 'bridge'
VIF_TYPE_802_QBG = '802.1qbg'
VIF_TYPE_802_QBH = '802.1qbh'
-VIF_TYPE_HYPERV = 'hyperv'
VIF_TYPE_MIDONET = 'midonet'
-VIF_TYPE_IB_HOSTDEV = 'ib_hostdev'
-VIF_TYPE_HW_VEB = 'hw_veb'
-VIF_TYPE_VROUTER = 'vrouter'
VIF_TYPE_OTHER = 'other'
VNIC_NORMAL = 'normal'
--- /dev/null
+# Copyright (c) 2015 Thales Services SAS
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+VIF_TYPE_HYPERV = 'hyperv'
from neutron.common import constants
from neutron.extensions import portbindings
+from neutron.plugins.ml2.drivers.hyperv import constants as h_constants
from neutron.plugins.ml2.drivers import mech_agent
def __init__(self):
super(HypervMechanismDriver, self).__init__(
constants.AGENT_TYPE_HYPERV,
- portbindings.VIF_TYPE_HYPERV,
+ h_constants.VIF_TYPE_HYPERV,
{portbindings.CAP_PORT_FILTER: False})
LOG = log.getLogger(__name__)
+VIF_TYPE_HW_VEB = 'hw_veb'
FLAT_VLAN = 0
sriov_opts = [
def __init__(self,
agent_type=constants.AGENT_TYPE_NIC_SWITCH,
- vif_type=portbindings.VIF_TYPE_HW_VEB,
+ vif_type=VIF_TYPE_HW_VEB,
vif_details={portbindings.CAP_PORT_FILTER: False},
supported_vnic_types=[portbindings.VNIC_DIRECT,
portbindings.VNIC_MACVTAP],
from neutron.plugins.ml2.drivers import mech_agent
LOG = log.getLogger(__name__)
+VIF_TYPE_IB_HOSTDEV = 'ib_hostdev'
class MlnxMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
def __init__(self):
super(MlnxMechanismDriver, self).__init__(
agent_type=n_const.AGENT_TYPE_MLNX,
- vif_type=portbindings.VIF_TYPE_IB_HOSTDEV,
+ vif_type=VIF_TYPE_IB_HOSTDEV,
vif_details={portbindings.CAP_PORT_FILTER: False},
supported_vnic_types=[portbindings.VNIC_DIRECT])
cfg.CONF.register_opts(opencontrail_opts, 'CONTRAIL')
+VIF_TYPE_VROUTER = 'vrouter'
CONTRAIL_EXCEPTION_MAP = {
requests.codes.not_found: c_exc.ContrailNotFoundError,
requests.codes.conflict: c_exc.ContrailConflictError,
"""return VIF type and details."""
binding = {
- portbindings.VIF_TYPE: portbindings.VIF_TYPE_VROUTER,
+ portbindings.VIF_TYPE: VIF_TYPE_VROUTER,
portbindings.VIF_DETAILS: {
# TODO(praneetb): Replace with new VIF security details
portbindings.CAP_PORT_FILTER:
class SriovNicSwitchMechanismBaseTestCase(base.AgentMechanismBaseTestCase):
- VIF_TYPE = portbindings.VIF_TYPE_HW_VEB
+ VIF_TYPE = mech_driver.VIF_TYPE_HW_VEB
CAP_PORT_FILTER = False
AGENT_TYPE = constants.AGENT_TYPE_NIC_SWITCH
VLAN_SEGMENTS = base.AgentMechanismVlanTestCase.VLAN_SEGMENTS
def test_vnic_type_direct(self):
self._check_vif_type_for_vnic_type(portbindings.VNIC_DIRECT,
- portbindings.VIF_TYPE_HW_VEB)
+ mech_driver.VIF_TYPE_HW_VEB)
def test_vnic_type_macvtap(self):
self._check_vif_type_for_vnic_type(portbindings.VNIC_MACVTAP,
- portbindings.VIF_TYPE_HW_VEB)
+ mech_driver.VIF_TYPE_HW_VEB)
class SriovSwitchMechProfileTestCase(SriovNicSwitchMechanismBaseTestCase):
def test_profile_supported_pci_info(self):
self._check_vif_for_pci_info(MELLANOX_CONNECTX3_PCI_INFO,
- portbindings.VIF_TYPE_HW_VEB)
+ mech_driver.VIF_TYPE_HW_VEB)
def test_profile_unsupported_pci_info(self):
with mock.patch('neutron.plugins.ml2.drivers.mech_sriov.'
class MlnxMechanismBaseTestCase(base.AgentMechanismBaseTestCase):
- VIF_TYPE = portbindings.VIF_TYPE_IB_HOSTDEV
+ VIF_TYPE = mech_mlnx.VIF_TYPE_IB_HOSTDEV
CAP_PORT_FILTER = False
AGENT_TYPE = constants.AGENT_TYPE_MLNX
VNIC_TYPE = portbindings.VNIC_DIRECT
from neutron.db import external_net_db
from neutron.db import l3_db
from neutron.db import securitygroups_db
-from neutron.extensions import portbindings
from neutron.extensions import securitygroup as ext_sg
+from neutron.plugins.opencontrail import contrail_plugin
from neutron.tests.unit import _test_extension_portbindings as test_bindings
from neutron.tests.unit.api import test_extensions
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
class TestContrailPortBinding(ContrailPluginTestCase,
test_bindings.PortBindingsTestCase):
- VIF_TYPE = portbindings.VIF_TYPE_VROUTER
+ VIF_TYPE = contrail_plugin.VIF_TYPE_VROUTER
HAS_PORT_FILTER = True
def setUp(self):