-
Notifications
You must be signed in to change notification settings - Fork 685
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
portconfig option to configure Tx power and laser frequency of ZR transceiver module #2197
Conversation
@qiluo-msft can you please review? |
scripts/portconfig
Outdated
sys.exit(1) | ||
port.set_tx_power(args.port, args.tx_power) | ||
if args.laser_freq: | ||
if args.laser_freq < 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -307,6 +326,17 @@ def main(): | |||
port.set_adv_interface_types(args.port, args.adv_interface_types) | |||
if args.tpid: | |||
port.set_tpid(args.port, args.tpid) | |||
if args.tx_power: | |||
d = decimal.Decimal(str(args.tx_power)) | |||
if d.as_tuple().exponent < -1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sys.exit(1) | ||
port.set_tx_power(args.port, args.tx_power) | ||
if args.laser_freq: | ||
if args.laser_freq <= 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests/config_xcvr_test.py
Outdated
result = self.basic_check("frequency", ["Ethernet0", "191300"], ctx) | ||
assert "Setting laser frequency" in result.output | ||
result = self.basic_check("frequency", ["Invalid", "191300"], ctx, op=operator.ne) | ||
result = self.basic_check("frequency", ["Ethernet0", "-191300"], ctx, op=operator.ne) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests/config_xcvr_test.py
Outdated
result = self.basic_check("tx_power", ["Ethernet0", "27.3"], ctx) | ||
assert "Setting target Tx output power" in result.output | ||
result = self.basic_check("tx_power", ["Invalid", "27.3"], ctx, op=operator.ne) | ||
result = self.basic_check("tx_power", ["Ethernet0", "27"], ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests/config_xcvr_test.py
Outdated
#self.basic_check("link-training", ["Ethernet0", "on"], ctx) | ||
result = self.basic_check("frequency", ["Ethernet0", "191300"], ctx) | ||
assert "Setting laser frequency" in result.output | ||
result = self.basic_check("frequency", ["Invalid", "191300"], ctx, op=operator.ne) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prgeor this PR cannot be cherry-picked cleanly, can you create separate PR for 202205? |
@prgeor can you create PR for 202205 ? |
…nsceiver module (sonic-net#2197) * New CLI option for configuring Xcvr frequency and Tx power * portconfig changes to configure xcvr's frequency and laser power * Added unit tests * Added check for tx_power and freq * Address review comment * Address review comment
What I did
Added new configuration CLI options to configure Tx power and laser frequency of ZR transceiver module
New command output (if the output of a command-line utility has changed)