use trunk constants from neutron-lib

The trunk constants now live in neutron-lib. This patch consumes them
by using them from neutron-lib instead of neutron.

Change-Id: Ife7c5b446a1ea00d9957d3b98c3a9b8f40b2662c
This commit is contained in:
Boden R 2019-04-02 11:49:50 -06:00 committed by Kobi Samoray
parent 8b48578f69
commit 3e9532d55e

View File

@ -18,12 +18,12 @@ from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
from neutron.services.trunk import constants as trunk_consts
from neutron.services.trunk.drivers import base from neutron.services.trunk.drivers import base
from neutron_lib.api.definitions import portbindings from neutron_lib.api.definitions import portbindings
from neutron_lib.callbacks import events from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry from neutron_lib.callbacks import registry
from neutron_lib.callbacks import resources from neutron_lib.callbacks import resources
from neutron_lib.services.trunk import constants as trunk_consts
from vmware_nsx.common import nsx_constants as nsx_consts from vmware_nsx.common import nsx_constants as nsx_consts
from vmware_nsx.common import utils as nsx_utils from vmware_nsx.common import utils as nsx_utils
@ -37,7 +37,7 @@ SUPPORTED_INTERFACES = (
portbindings.VIF_TYPE_OVS, portbindings.VIF_TYPE_OVS,
) )
SUPPORTED_SEGMENTATION_TYPES = ( SUPPORTED_SEGMENTATION_TYPES = (
trunk_consts.VLAN, trunk_consts.SEGMENTATION_TYPE_VLAN,
) )
@ -138,9 +138,9 @@ class NsxV3TrunkHandler(object):
try: try:
if trunk.sub_ports: if trunk.sub_ports:
self._set_subports(context, trunk.port_id, trunk.sub_ports) self._set_subports(context, trunk.port_id, trunk.sub_ports)
trunk.update(status=trunk_consts.ACTIVE_STATUS) trunk.update(status=trunk_consts.TRUNK_ACTIVE_STATUS)
except (nsxlib_exc.ManagerError, nsxlib_exc.ResourceNotFound): except (nsxlib_exc.ManagerError, nsxlib_exc.ResourceNotFound):
trunk.update(status=trunk_consts.ERROR_STATUS) trunk.update(status=trunk_consts.TRUNK_ERROR_STATUS)
def trunk_deleted(self, context, trunk): def trunk_deleted(self, context, trunk):
# Retrieve the logical port ID based on the parent port's neutron ID # Retrieve the logical port ID based on the parent port's neutron ID
@ -158,15 +158,15 @@ class NsxV3TrunkHandler(object):
def subports_added(self, context, trunk, subports): def subports_added(self, context, trunk, subports):
try: try:
self._set_subports(context, trunk.port_id, subports) self._set_subports(context, trunk.port_id, subports)
trunk.update(status=trunk_consts.ACTIVE_STATUS) trunk.update(status=trunk_consts.TRUNK_ACTIVE_STATUS)
except (nsxlib_exc.ManagerError, nsxlib_exc.ResourceNotFound): except (nsxlib_exc.ManagerError, nsxlib_exc.ResourceNotFound):
trunk.update(status=trunk_consts.ERROR_STATUS) trunk.update(status=trunk_consts.TRUNK_ERROR_STATUS)
def subports_deleted(self, context, trunk, subports): def subports_deleted(self, context, trunk, subports):
try: try:
self._unset_subports(context, subports) self._unset_subports(context, subports)
except (nsxlib_exc.ManagerError, nsxlib_exc.ResourceNotFound): except (nsxlib_exc.ManagerError, nsxlib_exc.ResourceNotFound):
trunk.update(status=trunk_consts.ERROR_STATUS) trunk.update(status=trunk_consts.TRUNK_ERROR_STATUS)
def trunk_event(self, resource, event, trunk_plugin, payload): def trunk_event(self, resource, event, trunk_plugin, payload):
if event == events.AFTER_CREATE: if event == events.AFTER_CREATE: