From 094646c6bcee5a24e13d6a2f794d25d35bf20a08 Mon Sep 17 00:00:00 2001 From: pettershao-ragilenetworks <81281940+pettershao-ragilenetworks@users.noreply.github.com> Date: Mon, 17 Oct 2022 08:02:31 +0800 Subject: [PATCH] [yang]Update port yang model, change MTU range to [68,9216] (#12223) What I did Filter port invalid MTU configuration How I did it Adjust the MTU value to the range of [68,9216] How to verify it Use "config interface mtu Ethernet1 40" command to configure the port MTU. The following error will occur in SWSS. --- .../tests/yang_model_tests/tests/port.json | 6 ++++ .../yang_model_tests/tests_config/port.json | 30 +++++++++++++++++++ .../yang-models/sonic-port.yang | 2 +- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json index 3b94cedab..6f7af54c4 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json @@ -13,6 +13,12 @@ "eStrKey" : "Pattern", "eStr": ["rc"] }, + "PORT_VALID_MTU_TEST_1": { + "desc": "PORT_VALID_MTU_TEST_1 no failure." + }, + "PORT_VALID_MTU_TEST_2": { + "desc": "PORT_VALID_MTU_TEST_2 no failure." + }, "PORT_VALID_AUTONEG_TEST_1": { "desc": "PORT_VALID_AUTONEG_TEST_1 no failure." }, diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json index b6ccf9ec8..684caa243 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json @@ -39,6 +39,36 @@ } } }, + "PORT_VALID_MTU_TEST_1": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "mtu": 68 + } + ] + } + } + }, + "PORT_VALID_MTU_TEST_2": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "mtu": 9216 + } + ] + } + } + }, "PORT_VALID_AUTONEG_TEST_1": { "sonic-port:sonic-port": { "sonic-port:PORT": { diff --git a/src/sonic-yang-models/yang-models/sonic-port.yang b/src/sonic-yang-models/yang-models/sonic-port.yang index 6e03f777a..a60e6b162 100644 --- a/src/sonic-yang-models/yang-models/sonic-port.yang +++ b/src/sonic-yang-models/yang-models/sonic-port.yang @@ -117,7 +117,7 @@ module sonic-port{ leaf mtu { type uint16 { - range 1..9216; + range 68..9216; } }