Fix type of exception in ml2 l2pop
Closes-Bug: #1423703 Change-Id: Ie6e2b33a8084381c01a35e3ded6b021f540ef42e
This commit is contained in:
parent
fc0b6ae80a
commit
639b885cb7
|
@ -107,7 +107,7 @@ class L2populationMechanismDriver(api.MechanismDriver,
|
||||||
context.status == const.PORT_STATUS_ACTIVE):
|
context.status == const.PORT_STATUS_ACTIVE):
|
||||||
LOG.warning(_LW("unable to modify mac_address of ACTIVE port "
|
LOG.warning(_LW("unable to modify mac_address of ACTIVE port "
|
||||||
"%s"), port['id'])
|
"%s"), port['id'])
|
||||||
raise ml2_exc.MechansimDriverError(method='update_port_postcommit')
|
raise ml2_exc.MechanismDriverError(method='update_port_postcommit')
|
||||||
diff_ips = self._get_diff_ips(orig, port)
|
diff_ips = self._get_diff_ips(orig, port)
|
||||||
if diff_ips:
|
if diff_ips:
|
||||||
self._fixed_ips_changed(context, orig, port, diff_ips)
|
self._fixed_ips_changed(context, orig, port, diff_ips)
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import testtools
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
@ -26,6 +27,8 @@ from neutron.db import agents_db
|
||||||
from neutron.extensions import portbindings
|
from neutron.extensions import portbindings
|
||||||
from neutron.extensions import providernet as pnet
|
from neutron.extensions import providernet as pnet
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
|
from neutron.plugins.ml2.common import exceptions as ml2_exc
|
||||||
|
from neutron.plugins.ml2 import driver_context
|
||||||
from neutron.plugins.ml2.drivers.l2pop import db as l2pop_db
|
from neutron.plugins.ml2.drivers.l2pop import db as l2pop_db
|
||||||
from neutron.plugins.ml2.drivers.l2pop import mech_driver as l2pop_mech_driver
|
from neutron.plugins.ml2.drivers.l2pop import mech_driver as l2pop_mech_driver
|
||||||
from neutron.plugins.ml2.drivers.l2pop import rpc as l2pop_rpc
|
from neutron.plugins.ml2.drivers.l2pop import rpc as l2pop_rpc
|
||||||
|
@ -994,3 +997,25 @@ class TestL2PopulationMechDriver(base.BaseTestCase):
|
||||||
{'10.0.0.1':
|
{'10.0.0.1':
|
||||||
[constants.FLOODING_ENTRY]}}
|
[constants.FLOODING_ENTRY]}}
|
||||||
self.assertEqual(expected_result, result)
|
self.assertEqual(expected_result, result)
|
||||||
|
|
||||||
|
def test_update_port_postcommit_mac_address_changed_raises(self):
|
||||||
|
port = {'status': u'ACTIVE',
|
||||||
|
'device_owner': u'compute:None',
|
||||||
|
'mac_address': u'12:34:56:78:4b:0e',
|
||||||
|
'id': u'1'}
|
||||||
|
|
||||||
|
original_port = port.copy()
|
||||||
|
original_port['mac_address'] = u'12:34:56:78:4b:0f'
|
||||||
|
|
||||||
|
with mock.patch.object(driver_context.db, 'get_network_segments'):
|
||||||
|
ctx = driver_context.PortContext(mock.Mock(),
|
||||||
|
mock.Mock(),
|
||||||
|
port,
|
||||||
|
mock.MagicMock(),
|
||||||
|
mock.Mock(),
|
||||||
|
None,
|
||||||
|
original_port=original_port)
|
||||||
|
|
||||||
|
mech_driver = l2pop_mech_driver.L2populationMechanismDriver()
|
||||||
|
with testtools.ExpectedException(ml2_exc.MechanismDriverError):
|
||||||
|
mech_driver.update_port_postcommit(ctx)
|
||||||
|
|
Loading…
Reference in New Issue