]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Merge "Stale VXLAN and GRE tunnel port/flow deletion"
authorJenkins <jenkins@review.openstack.org>
Fri, 20 Feb 2015 21:25:45 +0000 (21:25 +0000)
committerGerrit Code Review <review@openstack.org>
Fri, 20 Feb 2015 21:25:45 +0000 (21:25 +0000)
1  2 
neutron/agent/rpc.py
neutron/plugins/ofagent/agent/ofa_neutron_agent.py
neutron/plugins/openvswitch/agent/ovs_neutron_agent.py
neutron/tests/unit/ml2/test_type_gre.py
neutron/tests/unit/ofagent/test_ofa_neutron_agent.py
neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py

Simple merge
index 0ee4163ce7e1b6ab500c66eb09174b07515495f9,6c4051792ceeb6324d96a564f36a3bb160bdf73c..105f25b734b8e99df2be2c651d97c2ad9128bb1f
  
  import mock
  
 +from oslo_db import exception as db_exc
 +from sqlalchemy.orm import exc as sa_exc
 +import testtools
 +
 +from neutron.db import api as db_api
  from neutron.plugins.common import constants as p_const
  from neutron.plugins.ml2.drivers import type_gre
+ from neutron.tests.unit.ml2 import test_rpcapi
  from neutron.tests.unit.ml2 import test_type_tunnel
  from neutron.tests.unit import testlib_api
  
@@@ -98,33 -84,14 +99,40 @@@ class GreTypeTest(test_type_tunnel.Tunn
          endpoints = self.driver.get_endpoints()
          self.assertNotIn(TUNNEL_IP_ONE, endpoints)
  
 +    def test_sync_allocations_entry_added_during_session(self):
 +        with mock.patch.object(self.driver, '_add_allocation',
 +                               side_effect=db_exc.DBDuplicateEntry) as (
 +                mock_add_allocation):
 +            self.driver.sync_allocations()
 +            self.assertTrue(mock_add_allocation.called)
 +
 +    def test__add_allocation_not_existing(self):
 +        session = db_api.get_session()
 +        _add_allocation(session, gre_id=1)
 +        self.driver._add_allocation(session, {1, 2})
 +        _get_allocation(session, 2)
 +
 +    def test__add_allocation_existing_allocated_is_kept(self):
 +        session = db_api.get_session()
 +        _add_allocation(session, gre_id=1, allocated=True)
 +        self.driver._add_allocation(session, {2})
 +        _get_allocation(session, 1)
 +
 +    def test__add_allocation_existing_not_allocated_is_removed(self):
 +        session = db_api.get_session()
 +        _add_allocation(session, gre_id=1)
 +        self.driver._add_allocation(session, {2})
 +        with testtools.ExpectedException(sa_exc.NoResultFound):
 +            _get_allocation(session, 1)
 +
  
  class GreTypeMultiRangeTest(test_type_tunnel.TunnelTypeMultiRangeTestMixin,
-                            testlib_api.SqlTestCase):
+                             testlib_api.SqlTestCase):
      DRIVER_CLASS = type_gre.GreTypeDriver
+ class GreTypeRpcCallbackTest(test_type_tunnel.TunnelRpcCallbackTestMixin,
+                              test_rpcapi.RpcCallbacksTestCase,
+                              testlib_api.SqlTestCase):
+         DRIVER_CLASS = type_gre.GreTypeDriver
+         TYPE = p_const.TYPE_GRE