From 30254fc79a5b4ab1c4d53790e150291670966766 Mon Sep 17 00:00:00 2001 From: mihirpat1 <112018033+mihirpat1@users.noreply.github.com> Date: Thu, 6 Apr 2023 10:59:47 -0700 Subject: [PATCH] [yang]: Modify yang model to handle subport in PORT table (#14519) Based on the port breakout HLD, we are now using subport instead of channel in the CONFIG_DB PORT table to handle port breakout. The yang schema needs to be modified accordingly to handle the corresponding change. The corresponding code changes have been merged through sonic-net/sonic-platform-daemons/pull/342 merged Signed-off-by: Mihir Patel --- src/sonic-yang-models/doc/Configuration.md | 4 ++-- .../tests/files/sample_config_db.json | 18 +++++++++--------- .../tests/yang_model_tests/tests/port.json | 8 ++++---- .../yang_model_tests/tests_config/port.json | 14 +++++++------- .../yang-models/sonic-port.yang | 4 ++-- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index 5dcb982c06d0..5dc65909c29f 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -1282,7 +1282,7 @@ optional attributes. "mtu": "9100", "alias": "etp1a", "speed": "100000", - "channel": 1 + "subport": 1 }, "Ethernet4": { "admin_status": "up", @@ -1292,7 +1292,7 @@ optional attributes. "mtu": "9100", "alias": "etp1b", "speed": "100000", - "channel": 2 + "subport": 2 }, } } diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index d4f5e9cd6470..a292b8e9193d 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -463,7 +463,7 @@ "autoneg": "on", "adv_speeds": "all", "adv_interface_types": "all", - "channel" : "0" + "subport" : "0" }, "Ethernet3": { "alias": "Eth1/4", @@ -472,7 +472,7 @@ "speed": "11100", "tpid": "0x88A8", "admin_status": "up", - "channel": "1" + "subport": "1" }, "Ethernet4": { "alias": "Eth2/1", @@ -481,7 +481,7 @@ "speed": "11100", "tpid": "0x9100", "admin_status": "up", - "channel": "2" + "subport": "2" }, "Ethernet5": { "alias": "Eth2/2", @@ -490,7 +490,7 @@ "speed": "11100", "tpid": "0x9200", "admin_status": "up", - "channel": "3" + "subport": "3" }, "Ethernet6": { "alias": "Eth2/3", @@ -499,7 +499,7 @@ "speed": "11100", "tpid": "0x8100", "admin_status": "up", - "channel": "4" + "subport": "4" }, "Ethernet7": { "alias": "Eth2/4", @@ -508,7 +508,7 @@ "speed": "11100", "tpid": "0x8100", "admin_status": "up", - "channel": "5" + "subport": "5" }, "Ethernet8": { "alias": "Eth3/1", @@ -517,7 +517,7 @@ "speed": "11100", "tpid": "0x8100", "admin_status": "up", - "channel": "6" + "subport": "6" }, "Ethernet9": { "alias": "Eth3/2", @@ -526,7 +526,7 @@ "speed": "11100", "tpid": "0x8100", "admin_status": "up", - "channel": "7" + "subport": "7" }, "Ethernet10": { "alias": "Eth3/3", @@ -535,7 +535,7 @@ "speed": "11100", "tpid": "0x8100", "admin_status": "up", - "channel": "8" + "subport": "8" }, "Ethernet11": { "alias": "Eth3/4", 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 a2331f03b8ba..c8a3ce102c25 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 @@ -115,11 +115,11 @@ "desc": "PORT_INVALID_MULTIASIC_TEST invalid role pattern, expect fail", "eStrKey": "Pattern" }, - "PORT_VALID_CHANNEL_NUMBER": { - "desc": "PORT_VALID_CHANNEL_NUMBER no failure." + "PORT_VALID_SUBPORT_NUMBER": { + "desc": "PORT_VALID_SUBPORT_NUMBER no failure." }, - "PORT_INVALID_CHANNEL_NUMBER": { - "desc": "Out of range channel number", + "PORT_INVALID_SUBPORT_NUMBER": { + "desc": "Out of range subport number", "eStrKey": "Range", "eStr": "0..8" } 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 8b9c7a650bcc..7444040036e9 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 @@ -486,7 +486,7 @@ } }, - "PORT_INVALID_CHANNEL_NUMBER": { + "PORT_INVALID_SUBPORT_NUMBER": { "sonic-port:sonic-port": { "sonic-port:PORT": { "PORT_LIST": [ @@ -495,14 +495,14 @@ "alias": "etp1a", "lanes": "60, 61", "speed": 100000, - "channel": 9 + "subport": 9 } ] } } }, - "PORT_VALID_CHANNEL_NUMBER": { + "PORT_VALID_SUBPORT_NUMBER": { "sonic-port:sonic-port": { "sonic-port:PORT": { "PORT_LIST": [ @@ -511,28 +511,28 @@ "alias": "etp1a", "lanes": "60, 61", "speed": 100000, - "channel": 1 + "subport": 1 }, { "name": "Ethernet2", "alias": "etp1b", "lanes": "62, 63", "speed": 100000, - "channel": 2 + "subport": 2 }, { "name": "Ethernet4", "alias": "etp1c", "lanes": "64, 65", "speed": 100000, - "channel": 3 + "subport": 3 }, { "name": "Ethernet6", "alias": "etp1d", "lanes": "66, 67", "speed": 100000, - "channel": 4 + "subport": 4 } ] } diff --git a/src/sonic-yang-models/yang-models/sonic-port.yang b/src/sonic-yang-models/yang-models/sonic-port.yang index 6b87d6f839dc..1b9c6b14b5a9 100644 --- a/src/sonic-yang-models/yang-models/sonic-port.yang +++ b/src/sonic-yang-models/yang-models/sonic-port.yang @@ -121,8 +121,8 @@ module sonic-port{ } } - leaf channel { - description "Logical channel(s) for physical port breakout"; + leaf subport { + description "Logical subport(s) for physical port breakout"; type uint8 { range 0..8; }