Skip to content

Commit

Permalink
[YANG]: Add Yang model support for adding dom_polling to PORT table (s…
Browse files Browse the repository at this point in the history
…onic-net#18277)

### Why I did it
Added YANG related changes for adding `dom_polling` field in PORT table of CONFIG_DB. This field can be set with `config interface transceiver dom PORT_NAME (enable|disable)` CLI.

The `dom_polling` field was added through sonic-net/sonic-utilities#3187. Please refer to this PR for the details on the reason for adding `dom_polling` field.

### How I did it
Added `dom_polling` field to CONFIG_DB PORT table.

#### How to verify it
Added unit tests for both valid and invalid options for controlling `dom_polling`.
Valid values for for `dom_polling` are `enabled` and `disabled`
Any other value is treated as an invalid value
  • Loading branch information
mihirpat1 authored Mar 11, 2024
1 parent 8a780ca commit f9af461
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 7 deletions.
15 changes: 10 additions & 5 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,8 @@ optional attributes.
"speed": "40000",
"link_training": "off",
"laser_freq": "191300",
"tx_power": "-27.3"
"tx_power": "-27.3",
"dom_polling": "enabled"
},
"Ethernet1": {
"index": "1",
Expand All @@ -1819,7 +1820,8 @@ optional attributes.
"speed": "40000",
"link_training": "on",
"laser_freq": "191300",
"tx_power": "-27.3"
"tx_power": "-27.3",
"dom_polling": "enabled"
},
"Ethernet63": {
"index": "63",
Expand All @@ -1829,7 +1831,8 @@ optional attributes.
"alias": "fortyGigE1/4/16",
"speed": "40000",
"laser_freq": "191300",
"tx_power": "-27.3"
"tx_power": "-27.3",
"dom_polling": "disabled"
}
}
}
Expand All @@ -1845,7 +1848,8 @@ optional attributes.
"mtu": "9100",
"alias": "etp1a",
"speed": "100000",
"subport": 1
"subport": 1,
"dom_polling": "enabled"
},
"Ethernet4": {
"admin_status": "up",
Expand All @@ -1855,7 +1859,8 @@ optional attributes.
"mtu": "9100",
"alias": "etp1b",
"speed": "100000",
"subport": 2
"subport": 2,
"dom_polling": "enabled"
},
}
}
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 @@ -605,7 +605,8 @@
"adv_speeds": "all",
"adv_interface_types": "all",
"subport" : "0",
"mode":"trunk"
"mode":"trunk",
"dom_polling":"enabled"
},
"Ethernet3": {
"alias": "Eth1/4",
Expand All @@ -625,7 +626,8 @@
"tpid": "0x9100",
"admin_status": "up",
"subport": "2",
"mode":"trunk"
"mode":"trunk",
"dom_polling":"enabled"
},
"Ethernet5": {
"alias": "Eth2/2",
Expand Down
8 changes: 8 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 @@ -134,6 +134,14 @@
"eStrKey": "Range",
"eStr": "0..8"
},
"PORT_VALID_DOM_POLLING": {
"desc": "PORT_VALID_DOM_POLLING no failure."
},
"PORT_INVALID_DOM_POLLING": {
"desc": "PORT_INVALID_DOM_POLLING invalid condition failure.",
"eStrKey" : "InvalidValue",
"eStr": ["dom_polling"]
},
"PORT_AUTO_FEC_TEST": {
"desc": "PORT_AUTO_FEC_TEST validate auto mode in fec."
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,48 @@
}
},

"PORT_INVALID_DOM_POLLING": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"name": "Ethernet0",
"alias": "etp1a",
"lanes": "60, 61",
"speed": 100000,
"subport": 1,
"dom_polling": "on"
}
]
}
}
},

"PORT_VALID_DOM_POLLING": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"name": "Ethernet0",
"alias": "etp1a",
"lanes": "60, 61",
"speed": 100000,
"subport": 1,
"dom_polling": "enabled"
},
{
"name": "Ethernet2",
"alias": "etp1b",
"lanes": "62, 63",
"speed": 100000,
"subport": 2,
"dom_polling": "disabled"
}
]
}
}
},

"PORT_AUTO_FEC_TEST": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
Expand Down
4 changes: 4 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-port.yang
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ module sonic-port{
}
}

leaf dom_polling {
type stypes:admin_mode;
}

leaf pfc_asym {
type string {
pattern "on|off";
Expand Down

0 comments on commit f9af461

Please sign in to comment.