diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index 9a8f2a9fe2..9a1adcab9c 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -1167,7 +1167,8 @@ optional attributes. "description": "fortyGigE1/1/1", "mtu": "9100", "alias": "fortyGigE1/1/1", - "speed": "40000" + "speed": "40000", + "link_training": "off" }, "Ethernet1": { "index": "1", @@ -1176,9 +1177,10 @@ optional attributes. "mtu": "9100", "alias": "fortyGigE1/1/2", "admin_status": "up", - "speed": "40000" + "speed": "40000", + "link_training": "on" }, - "Ethernet63": { + "Ethernet63": { "index": "63", "lanes": "87,88", "description": "fortyGigE1/4/16", 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 5af414359b..e19c8aeb8d 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -438,7 +438,8 @@ "index": "0", "asic_port_name": "Eth0-ASIC1", "role": "Ext", - "macsec": "test" + "macsec": "test", + "link_training": "off" }, "Ethernet1": { "alias": "Eth1/2", @@ -449,7 +450,8 @@ "admin_status": "up", "autoneg": "on", "adv_speeds": "100000,50000", - "adv_interface_types": "CR,CR4" + "adv_interface_types": "CR,CR4", + "link_training": "on" }, "Ethernet2": { "alias": "Eth1/3", 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 db9b432714..0d67a73148 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 @@ -69,6 +69,17 @@ "desc": "PORT_INVALID_ADVTYPES_TEST_2 must condition failure.", "eStrKey" : "Must" }, + "PORT_VALID_LINK_TRAINING_TEST_1": { + "desc": "PORT_VALID_LINK_TRAINING_TEST_1 no failure." + }, + "PORT_VALID_LINK_TRAINING_TEST_2": { + "desc": "PORT_VALID_LINK_TRAINING_TEST_2 no failure." + }, + "PORT_INVALID_LINK_TRAINING_TEST": { + "desc": "PORT_INVALID_LINK_TRAINING_TEST must condition failure.", + "eStrKey" : "Pattern", + "eStr": ["on|off"] + }, "PORT_INVALID_TPID_TEST": { "desc": "PORT_INVALID_TPID_TEST invalid tpid value failure.", "eStrKey" : "Pattern", 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 db3334e80d..7f5c91230d 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 @@ -311,6 +311,57 @@ } }, + "PORT_VALID_LINK_TRAINING_TEST_1": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "tpid": "0x8100", + "link_training": "on" + } + ] + } + } + }, + + "PORT_VALID_LINK_TRAINING_TEST_2": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "tpid": "0x8100", + "link_training": "off" + } + ] + } + } + }, + + "PORT_INVALID_LINK_TRAINING_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "tpid": "0x8100", + "link_training": 0 + } + ] + } + } + }, + "PORT_INVALID_TPID_TEST": { "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 eab52996fb..6921613624 100644 --- a/src/sonic-yang-models/yang-models/sonic-port.yang +++ b/src/sonic-yang-models/yang-models/sonic-port.yang @@ -65,6 +65,14 @@ module sonic-port{ } } + leaf link_training { + description "Port link training mode"; + + type string { + pattern "on|off"; + } + } + leaf autoneg { description "Port auto negotiation mode";