Browse Source

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

tags/14.1.0
Zuul 1 month ago
parent
commit
ec395e44e6
2 changed files with 12 additions and 5 deletions
  1. +1
    -2
      neutron/plugins/ml2/plugin.py
  2. +11
    -3
      neutron/tests/fullstack/test_mtu.py

+ 1
- 2
neutron/plugins/ml2/plugin.py 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


+ 11
- 3
neutron/tests/fullstack/test_mtu.py 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)


Loading…
Cancel
Save