Merge "Fixed TypeError when creating MlnxException"

This commit is contained in:
Jenkins 2014-04-05 23:25:51 +00:00 committed by Gerrit Code Review
commit 0eb3a105d6
2 changed files with 23 additions and 1 deletions

View File

@ -57,7 +57,7 @@ class EswitchManager(object):
err_msg = _("Agent cache inconsistency - port id "
"is not stored for %s") % port_mac
LOG.error(err_msg)
raise exceptions.MlnxException(err_msg)
raise exceptions.MlnxException(err_msg=err_msg)
def get_vnics_mac(self):
return set(self.utils.get_attached_vnics().keys())

View File

@ -19,12 +19,34 @@ import contextlib
import mock
from oslo.config import cfg
import testtools
from neutron.plugins.mlnx.agent import eswitch_neutron_agent
from neutron.plugins.mlnx.agent import utils
from neutron.plugins.mlnx.common import exceptions
from neutron.tests import base
class TestEswichManager(base.BaseTestCase):
def setUp(self):
super(TestEswichManager, self).setUp()
class MockEswitchUtils(object):
def __init__(self, endpoint, timeout):
pass
mock.patch('neutron.plugins.mlnx.agent.utils.EswitchManager',
new=MockEswitchUtils)
with mock.patch.object(utils, 'zmq'):
self.manager = eswitch_neutron_agent.EswitchManager({}, None, None)
def test_get_not_exist_port_id(self):
with testtools.ExpectedException(exceptions.MlnxException):
self.manager.get_port_id_by_mac('no-such-mac')
class TestEswitchAgent(base.BaseTestCase):
def setUp(self):