Merge "Check mtu on network update" into stable/stein

This commit is contained in:
Zuul 2020-01-20 12:42:06 +00:00 committed by Gerrit Code Review
commit ec395e44e6
2 changed files with 12 additions and 5 deletions

View File

@ -1054,8 +1054,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
# removed in Queens when we populate all mtu attributes and
# enforce it's not nullable on database level
db_network.mtu is None):
db_network.mtu = self._get_network_mtu(db_network,
validate=False)
db_network.mtu = self._get_network_mtu(db_network)
# agents should now update all ports to reflect new MTU
need_network_update_notify = True

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
# from neutronclient.common import exceptions
from neutronclient.common import exceptions
from oslo_utils import uuidutils
from neutron.tests.fullstack import base
@ -44,11 +44,19 @@ class MTUNetworkTestSetup(base.BaseFullStackTestCase):
class TestMTUScenarios(MTUNetworkTestSetup):
def test_mtu_update_delete_network(self):
def test_mtu_update_network_neg(self):
network = self.safe_client.create_network(self.tenant_id,
name='mtu-test-network',
mtu=1450)
self.safe_client.update_network(network['id'], mtu=9000)
self.assertRaises(exceptions.BadRequest,
self.safe_client.update_network,
network['id'], mtu=9000)
def test_mtu_update_delete_network(self):
network = self.safe_client.create_network(self.tenant_id,
name='mtu-test-network',
mtu=1200)
self.safe_client.update_network(network['id'], mtu=1450)
res = self.safe_client.delete_network(network['id'])
self.assertEqual((), res)