diff --git a/vmware_nsx/shell/admin/plugins/nsxv3/resources/ports.py b/vmware_nsx/shell/admin/plugins/nsxv3/resources/ports.py index e619296620..e2fba3dd67 100644 --- a/vmware_nsx/shell/admin/plugins/nsxv3/resources/ports.py +++ b/vmware_nsx/shell/admin/plugins/nsxv3/resources/ports.py @@ -28,6 +28,7 @@ from vmware_nsx.shell.admin.plugins.common import formatters from vmware_nsx.shell.admin.plugins.common import utils as admin_utils from vmware_nsx.shell.admin.plugins.nsxv3.resources import utils as v3_utils from vmware_nsx.shell import resources as shell +from vmware_nsxlib.v3 import core_resources from vmware_nsxlib.v3 import exceptions as nsx_exc from vmware_nsxlib.v3 import nsx_constants as nsxlib_consts from vmware_nsxlib.v3 import resources @@ -86,7 +87,7 @@ def get_network_nsx_id(session, neutron_id): def get_port_and_profile_clients(): _nsx_client = v3_utils.get_nsxv3_client() return (resources.LogicalPort(_nsx_client), - resources.SwitchingProfile(_nsx_client)) + core_resources.NsxLibSwitchingProfile(_nsx_client)) def get_dhcp_profile_id(profile_client): @@ -126,10 +127,12 @@ def list_missing_ports(resource, event, trigger, **kwargs): # get pre-defined profile ids dhcp_profile_id = get_dhcp_profile_id(profile_client) - dhcp_profile_key = resources.SwitchingProfileTypes.SWITCH_SECURITY + dhcp_profile_key = ( + core_resources.SwitchingProfileTypes.SWITCH_SECURITY) spoofguard_profile_id = get_spoofguard_profile_id(profile_client) - spoofguard_profile_key = resources.SwitchingProfileTypes.SPOOF_GUARD - qos_profile_key = resources.SwitchingProfileTypes.QOS + spoofguard_profile_key = ( + core_resources.SwitchingProfileTypes.SPOOF_GUARD) + qos_profile_key = core_resources.SwitchingProfileTypes.QOS problems = [] for port in neutron_ports: diff --git a/vmware_nsx/tests/unit/nsx_v3/test_dhcp_metadata.py b/vmware_nsx/tests/unit/nsx_v3/test_dhcp_metadata.py index d3e5a27e19..e2838ff228 100644 --- a/vmware_nsx/tests/unit/nsx_v3/test_dhcp_metadata.py +++ b/vmware_nsx/tests/unit/nsx_v3/test_dhcp_metadata.py @@ -33,6 +33,7 @@ from vmware_nsx.db import db as nsx_db from vmware_nsx.extensions import advancedserviceproviders as as_providers from vmware_nsx.plugins.nsx_v3 import availability_zones as nsx_az from vmware_nsx.tests.unit.nsx_v3 import test_plugin +from vmware_nsxlib.v3 import core_resources from vmware_nsxlib.v3 import nsx_constants from vmware_nsxlib.v3 import resources as nsx_resources @@ -69,7 +70,8 @@ class NsxNativeDhcpTestCase(test_plugin.NsxV3PluginTestCaseMixin): self.az_metadata_route = '3.3.3.3' set_az_in_config(self._az_name, native_metadata_route=self.az_metadata_route) - self._patcher = mock.patch.object(nsx_resources.DhcpProfile, 'get') + self._patcher = mock.patch.object(core_resources.NsxLibDhcpProfile, + 'get') self._patcher.start() # Need to run some plugin init methods manually because plugin was # started before setUp() overrides CONF.nsx_v3.native_dhcp_metadata. @@ -920,7 +922,8 @@ class NsxNativeMetadataTestCase(test_plugin.NsxV3PluginTestCaseMixin): self._az_name = 'zone1' self._az_metadata_proxy = 'dummy' set_az_in_config(self._az_name, metadata_proxy=self._az_metadata_proxy) - self._patcher = mock.patch.object(nsx_resources.MetaDataProxy, 'get') + self._patcher = mock.patch.object(core_resources.NsxLibMetadataProxy, + 'get') self._patcher.start() self.plugin.init_availability_zones() self.plugin._translate_configured_names_to_uuids() diff --git a/vmware_nsx/tests/unit/shell/test_admin_utils.py b/vmware_nsx/tests/unit/shell/test_admin_utils.py index 6de733a3d1..5d0a68ab57 100644 --- a/vmware_nsx/tests/unit/shell/test_admin_utils.py +++ b/vmware_nsx/tests/unit/shell/test_admin_utils.py @@ -16,18 +16,18 @@ import abc import mock +from oslo_config import cfg +from oslo_log import _options +from oslo_log import log as logging +from oslo_utils import uuidutils +import six + from neutron.common import config as neutron_config from neutron.db import servicetype_db # noqa from neutron.quota import resource_registry from neutron.tests import base from neutron_lib.callbacks import registry from neutron_lib.plugins import constants -from oslo_config import cfg -from oslo_log import _options -from oslo_log import log as logging -from oslo_utils import uuidutils -import six -from vmware_nsxlib.v3 import resources as nsx_v3_resources from vmware_nsx._i18n import _ from vmware_nsx.common import config # noqa @@ -39,6 +39,8 @@ from vmware_nsx.shell import resources from vmware_nsx.tests import unit as vmware from vmware_nsx.tests.unit.nsx_v import test_plugin as test_v_plugin from vmware_nsx.tests.unit.nsx_v3 import test_plugin as test_v3_plugin +from vmware_nsxlib.v3 import core_resources +from vmware_nsxlib.v3 import resources as nsx_v3_resources LOG = logging.getLogger(__name__) NSX_INI_PATH = vmware.get_fake_conf('nsx.ini.test') @@ -244,16 +246,15 @@ class TestNsxv3AdminUtils(AbstractTestAdminUtils, # mock resources for cls in (nsx_v3_resources.LogicalPort, nsx_v3_resources.LogicalDhcpServer, - nsx_v3_resources.LogicalRouter, - nsx_v3_resources.SwitchingProfile): + core_resources.NsxLibLogicalRouter, + core_resources.NsxLibSwitchingProfile): - self._patch_object(cls, '__init__', return_value=None) self._patch_object(cls, 'list', return_value={'results': []}) self._patch_object(cls, 'get', return_value={'id': uuidutils.generate_uuid()}) self._patch_object(cls, 'update') - self._patch_object(nsx_v3_resources.SwitchingProfile, + self._patch_object(core_resources.NsxLibSwitchingProfile, 'find_by_display_name', return_value=[{'id': uuidutils.generate_uuid()}]) super(TestNsxv3AdminUtils, self)._init_mock_plugin()