use trunk constants from neutron-lib
The trunk constants live in neutron-lib now. This patch switches over to them in prep for https://review.openstack.org/#/c/649672/ Change-Id: I072b28a2e7c6466912f5a2f7f3f8e303a70cef8a
This commit is contained in:
parent
9d05539831
commit
cdcd620791
@ -12,7 +12,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.services.trunk import constants
|
||||
from neutron.services.trunk.drivers import base
|
||||
from neutron_lib.api.definitions import portbindings
|
||||
from neutron_lib.callbacks import events
|
||||
@ -21,6 +20,7 @@ from neutron_lib.callbacks import resources
|
||||
from neutron_lib import constants as n_constants
|
||||
from neutron_lib import context
|
||||
from neutron_lib.plugins import directory
|
||||
from neutron_lib.services.trunk import constants
|
||||
|
||||
from dragonflow import conf as cfg
|
||||
from dragonflow.db.models import l2
|
||||
@ -40,7 +40,7 @@ class DfTrunkDriver(base.DriverBase, mixins.LazyNbApiMixin):
|
||||
super(DfTrunkDriver, self).__init__(
|
||||
'df',
|
||||
(portbindings.VIF_TYPE_OVS, portbindings.VIF_TYPE_VHOST_USER),
|
||||
(constants.VLAN,),
|
||||
(constants.SEGMENTATION_TYPE_VLAN,),
|
||||
can_trunk_bound_port=True
|
||||
)
|
||||
self._nb_api = None
|
||||
@ -66,18 +66,18 @@ class DfTrunkDriver(base.DriverBase, mixins.LazyNbApiMixin):
|
||||
|
||||
def _register_init_events(self):
|
||||
registry.subscribe(self.register,
|
||||
constants.TRUNK_PLUGIN,
|
||||
resources.TRUNK_PLUGIN,
|
||||
events.AFTER_INIT)
|
||||
|
||||
def _register_trunk_events(self):
|
||||
registry.subscribe(self._add_trunk_handler,
|
||||
constants.TRUNK, events.AFTER_CREATE)
|
||||
resources.TRUNK, events.AFTER_CREATE)
|
||||
|
||||
def _register_subport_events(self):
|
||||
registry.subscribe(self._add_subports_handler,
|
||||
constants.SUBPORTS, events.AFTER_CREATE)
|
||||
resources.SUBPORTS, events.AFTER_CREATE)
|
||||
registry.subscribe(self._delete_subports_handler,
|
||||
constants.SUBPORTS, events.AFTER_DELETE)
|
||||
resources.SUBPORTS, events.AFTER_DELETE)
|
||||
registry.subscribe(self._update_port_handler,
|
||||
resources.PORT, events.AFTER_UPDATE)
|
||||
|
||||
@ -85,7 +85,7 @@ class DfTrunkDriver(base.DriverBase, mixins.LazyNbApiMixin):
|
||||
"""Handle the event that trunk was created"""
|
||||
payload = kwargs['payload']
|
||||
trunk = payload.current_trunk
|
||||
trunk.update(status=constants.ACTIVE_STATUS)
|
||||
trunk.update(status=constants.TRUNK_ACTIVE_STATUS)
|
||||
|
||||
def _add_subports_handler(self, *args, **kwargs):
|
||||
"""Handle the event that subports were created"""
|
||||
|
@ -13,11 +13,11 @@
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
|
||||
from neutron.services.trunk import constants as trunk_const
|
||||
from neutron.services.trunk import drivers as trunk_drivers
|
||||
from neutron.services.trunk import plugin as trunk_plugin
|
||||
from neutron_lib import constants
|
||||
from neutron_lib.plugins import directory
|
||||
from neutron_lib.services.trunk import constants as trunk_const
|
||||
|
||||
from dragonflow.neutron.db.models import l2
|
||||
from dragonflow.neutron.services.trunk import driver
|
||||
@ -76,7 +76,7 @@ class TestDFTrunkDriver(test_mech_driver.DFMechanismDriverTestCase):
|
||||
'sub_ports': [],
|
||||
}
|
||||
})
|
||||
self.assertTrue(trunk['status'] == trunk_const.ACTIVE_STATUS)
|
||||
self.assertTrue(trunk['status'] == trunk_const.TRUNK_ACTIVE_STATUS)
|
||||
|
||||
def test_driver_create_delete_subport(self):
|
||||
# Create parent port
|
||||
|
Loading…
Reference in New Issue
Block a user