NSX|P: Remove warning logs from admin utilities

Change-Id: Ieec32145af8544c87c10d24696937d72e3426cdf
This commit is contained in:
Adit Sarfaty 2019-07-29 11:54:41 +03:00
parent f21858b75e
commit 0705f382dc
2 changed files with 22 additions and 10 deletions

View File

@ -57,7 +57,8 @@ def log_info(resource, data, attrs=['display_name', 'id']):
def get_realization_info(resource, *realization_args):
try:
nsx_info = resource.get_realization_info(*realization_args)
nsx_info = resource.get_realization_info(*realization_args,
silent=True)
if not nsx_info:
info_text = "MISSING"
else:

View File

@ -33,6 +33,7 @@ from vmware_nsx._i18n import _
from vmware_nsx.common import config # noqa
from vmware_nsx.db import nsxv_db
from vmware_nsx.dvs import dvs_utils
from vmware_nsx.shell.admin.plugins.nsxp.resources import utils as nsxp_utils
from vmware_nsx.shell.admin.plugins.nsxv.resources import utils as nsxv_utils
from vmware_nsx.shell.admin.plugins.nsxv3.resources import utils as nsxv3_utils
from vmware_nsx.shell import resources
@ -109,6 +110,15 @@ class AbstractTestAdminUtils(base.BaseTestCase):
args = {'property': func_args}
self._test_resource(res_name, op, **args)
def _create_router(self):
tenant_id = uuidutils.generate_uuid()
data = {'router': {'tenant_id': tenant_id}}
data['router']['name'] = 'dummy'
data['router']['admin_state_up'] = True
edgeapi = nsxv_utils.NeutronDbClient()
return self._plugin.create_router(edgeapi.context, data)
class TestNsxvAdminUtils(AbstractTestAdminUtils,
test_v_plugin.NsxVPluginV2TestCase):
@ -295,15 +305,6 @@ class TestNsxv3AdminUtils(AbstractTestAdminUtils,
self._test_resources_with_args(
resources.nsxv3_resources, args)
def _create_router(self):
tenant_id = uuidutils.generate_uuid()
data = {'router': {'tenant_id': tenant_id}}
data['router']['name'] = 'dummy'
data['router']['admin_state_up'] = True
edgeapi = nsxv_utils.NeutronDbClient()
return self._plugin.create_router(edgeapi.context, data)
class TestNsxtvdAdminUtils(AbstractTestAdminUtils):
@ -320,5 +321,15 @@ class TestNsxpAdminUtils(AbstractTestAdminUtils,
def _get_plugin_name(self):
return 'nsxp'
def _init_mock_plugin(self):
self._plugin = nsxp_utils.NsxPolicyPluginWrapper()
def test_nsxp_resources(self):
self._test_resources(resources.nsxp_resources)
def test_nsxp_resources_with_objects(self):
# Create some neutron objects for the utilities to run on
self._create_router()
with self.network():
# Run all utilities with backend objects
self._test_resources(resources.nsxp_resources)