Skip to content

Commit

Permalink
Yang model for xcvr tx power and frequency configuration (sonic-net#1…
Browse files Browse the repository at this point in the history
…1053)

* Yang model for xcvr tx power and frequency configuration

* Add unit test cases

* Addressed review comments
  • Loading branch information
prgeor authored Jun 12, 2022
1 parent 356b51f commit 201792f
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,9 @@ optional attributes.
"mtu": "9100",
"alias": "fortyGigE1/1/1",
"speed": "40000",
"link_training": "off"
"link_training": "off",
"laser_freq": "191300",
"tx_power": "-27.3"
},
"Ethernet1": {
"index": "1",
Expand All @@ -1186,15 +1188,19 @@ optional attributes.
"alias": "fortyGigE1/1/2",
"admin_status": "up",
"speed": "40000",
"link_training": "on"
"link_training": "on",
"laser_freq": "191300",
"tx_power": "-27.3"
},
"Ethernet63": {
"index": "63",
"lanes": "87,88",
"description": "fortyGigE1/4/16",
"mtu": "9100",
"alias": "fortyGigE1/4/16",
"speed": "40000"
"speed": "40000",
"laser_freq": "191300",
"tx_power": "-27.3"
}
}
}
Expand Down
8 changes: 6 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 @@ -446,7 +446,9 @@
"asic_port_name": "Eth0-ASIC1",
"role": "Ext",
"macsec": "test",
"link_training": "off"
"link_training": "off",
"laser_freq": "191600",
"tx_power": "-26.6"
},
"Ethernet1": {
"alias": "Eth1/2",
Expand All @@ -458,7 +460,9 @@
"autoneg": "on",
"adv_speeds": "100000,50000",
"adv_interface_types": "CR,CR4",
"link_training": "on"
"link_training": "on",
"laser_freq": "191300",
"tx_power": "-27.3"
},
"Ethernet2": {
"alias": "Eth1/3",
Expand Down
16 changes: 16 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,22 @@
"desc": "PORT_INVALID_ADVTYPES_TEST_2 must condition failure.",
"eStrKey" : "Must"
},
"PORT_VALID_XCVR_FREQ_TEST": {
"desc": "PORT_VALID_XCVR_FREQ_TEST no failure"
},
"PORT_VALID_XCVR_TX_POWER_TEST": {
"desc": "PORT_VALID_XCVR_TX_POWER_TEST no failure"
},
"PORT_INVALID_XCVR_FREQ_TEST": {
"desc": "PORT_INVALID_XCVR_FREQ_TEST non-integer value, expect failure",
"eStrKey": "InvalidValue",
"eStr": ["laser_freq"]
},
"PORT_INVALID_XCVR_TX_POWER_TEST": {
"desc": "PORT_INVALID_XCVR_TX_POWER_TEST non-float value, expect failure",
"eStrKey": "InvalidValue",
"eStr": ["tx_power"]
},
"PORT_VALID_LINK_TRAINING_TEST_1": {
"desc": "PORT_VALID_LINK_TRAINING_TEST_1 no failure."
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,74 @@
}
},

"PORT_VALID_XCVR_FREQ_TEST": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"name": "Ethernet8",
"alias": "eth8",
"lanes": "65",
"speed": 25000,
"tpid": "0x8100",
"laser_freq": 193100
}
]
}
}
},

"PORT_VALID_XCVR_TX_POWER_TEST": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"name": "Ethernet8",
"alias": "eth8",
"lanes": "65",
"speed": 25000,
"tpid": "0x8100",
"tx_power": "27.3"
}
]
}
}
},

"PORT_INVALID_XCVR_FREQ_TEST": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"name": "Ethernet8",
"alias": "eth8",
"lanes": "65",
"speed": 25000,
"tpid": "0x8100",
"laser_freq": "27.3"
}
]
}
}
},

"PORT_INVALID_XCVR_TX_POWER_TEST": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"name": "Ethernet8",
"alias": "eth8",
"lanes": "65",
"speed": 25000,
"tpid": "0x8100",
"tx_power": "27/4"
}
]
}
}
},

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

leaf tx_power {
description "Target output power(dBm) for the 400G ZR transceiver";
type decimal64 {
fraction-digits 1;
}
}

leaf laser_freq {
description "Target laser frequency(GHz) for the 400G ZR transceiver";
type int32;
}

} /* end of list PORT_LIST */

} /* end of container PORT */
Expand Down

0 comments on commit 201792f

Please sign in to comment.