Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sonic-port.yang: add link training support #10025

Merged
merged 3 commits into from
May 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,8 @@ optional attributes.
"description": "fortyGigE1/1/1",
"mtu": "9100",
"alias": "fortyGigE1/1/1",
"speed": "40000"
"speed": "40000",
"link_training": "off"
},
"Ethernet1": {
"index": "1",
Expand All @@ -1161,9 +1162,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",
Expand Down
6 changes: 4 additions & 2 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@
"index": "0",
"asic_port_name": "Eth0-ASIC1",
"role": "Ext",
"macsec": "test"
"macsec": "test",
"link_training": "off"
},
"Ethernet1": {
"alias": "Eth1/2",
Expand All @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/port.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 8 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-port.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down