Skip to content

Commit

Permalink
sonic-port.yang: add link training support (#10025)
Browse files Browse the repository at this point in the history
This is part of HLD  sonic-net/SONiC#925

#### Why I did it
Add link-training support

#### How I did it
Update SONiC YANG for port link-training support

#### Description for the changelog
Add "link_training" to sonic-port.yang

#### Link to config_db schema for YANG module changes

https://github.com/sonic-net/SONiC/wiki/Configuration#port
  • Loading branch information
ds952811 authored May 15, 2022
1 parent 5eda219 commit 4b581f1
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 5 deletions.
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 @@ -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",
Expand All @@ -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",
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

0 comments on commit 4b581f1

Please sign in to comment.