-
Notifications
You must be signed in to change notification settings - Fork 186
Adding frequency grid validation for ZR optics #466
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
afa88e5
Update test_xcvrd.py
balram-csco d746755
Update xcvrd.py
balram-csco 6172c5e
Added 100Ghz grid check
balram-csco 1ebfe1d
Addresses indentation xcvrd.py
balram-csco 2b7a35b
Updated xcvrd.py with proper return enum values
balram-csco 92b6736
Updated test cases for coverage
balram-csco 37aeb72
Update for code optimisation
balram-csco 653c38a
Merge branch 'master' into master
balram-csco f7a1672
Added frequency and grid information is failure cases
balram-csco 0f4643d
renamed the function to validate_frequency_and_grid
balram-csco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1189,18 +1189,31 @@ def configure_tx_output_power(self, api, lport, tx_power): | |
self.log_error("{} configured tx power {} > maximum power {} supported".format(lport, tx_power, max_p)) | ||
return api.set_tx_power(tx_power) | ||
|
||
def configure_laser_frequency(self, api, lport, freq, grid=75): | ||
_, _, _, lowf, highf = api.get_supported_freq_config() | ||
def config_laser_frequency_validate(self, api, lport, freq, grid=75): | ||
supported_grid, _, _, lowf, highf = api.get_supported_freq_config() | ||
if freq < lowf: | ||
self.log_error("{} configured freq:{} GHz is lower than the supported freq:{} GHz".format(lport, freq, lowf)) | ||
return false | ||
if freq > highf: | ||
self.log_error("{} configured freq:{} GHz is higher than the supported freq:{} GHz".format(lport, freq, highf)) | ||
chan = int(round((freq - 193100)/25)) | ||
if chan % 3 != 0: | ||
self.log_error("{} configured freq:{} GHz is NOT in 75GHz grid".format(lport, freq)) | ||
return false | ||
if grid == 75: | ||
if (supported_grid >> 7) & 0x1 != 1: | ||
self.log_error("{} 75GHz is not supported".format(lport)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @balram-csco log the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added freq and grid logging |
||
return False | ||
chan = int(round((freq - 193100)/25)) | ||
if chan % 3 != 0: | ||
self.log_error("{} configured freq:{} GHz is NOT in 75GHz grid".format(lport, freq)) | ||
return False | ||
return True | ||
|
||
def configure_laser_frequency(self, api, lport, freq, grid=75): | ||
if api.get_tuning_in_progress(): | ||
self.log_error("{} Tuning in progress, subport selection may fail!".format(lport)) | ||
return api.set_laser_freq(freq, grid) | ||
try: | ||
balram-csco marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return api.set_laser_freq(freq, grid) | ||
except: | ||
return False | ||
|
||
def post_port_active_apsel_to_db(self, api, lport, host_lanes_mask): | ||
try: | ||
|
@@ -1424,11 +1437,15 @@ def task_worker(self): | |
|
||
# For ZR module, Datapath needes to be re-initlialized on new channel selection | ||
if api.is_coherent_module(): | ||
freq = self.port_dict[lport]['laser_freq'] | ||
# If user requested frequency is NOT the same as configured on the module | ||
# force datapath re-initialization | ||
if 0 != freq and freq != api.get_laser_config_freq(): | ||
need_update = True | ||
freq = self.port_dict[lport]['laser_freq'] | ||
# If user requested frequency is NOT the same as configured on the module | ||
# force datapath re-initialization | ||
if 0 != freq and freq != api.get_laser_config_freq(): | ||
if self.config_laser_frequency_validate(api, lport, freq) == True: | ||
need_update = True | ||
else: | ||
# clear setting of invalid frequency config | ||
self.port_dict[lport]['laser_freq'] = 0 | ||
|
||
if not need_update: | ||
# No application updates | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@balram-csco please rename it to ->
validate_frequency_and_grid()
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.
renamed function to validate_frequency_and_grid()