Skip to content

ironware model: graceful handling of N-digit temps, addition of simulated ironware:ICX7150-48Z-HPOE (Ruckus) yaml#3457

Merged
robertcheramy merged 6 commits intoytti:masterfrom
merelissdgr:ironware_3digit_fix
Mar 31, 2025
Merged

ironware model: graceful handling of N-digit temps, addition of simulated ironware:ICX7150-48Z-HPOE (Ruckus) yaml#3457
robertcheramy merged 6 commits intoytti:masterfrom
merelissdgr:ironware_3digit_fix

Conversation

@merelissdgr
Copy link
Contributor

@merelissdgr merelissdgr commented Mar 14, 2025

Pre-Request Checklist

  • Passes rubocop code analysis (try rubocop --auto-correct)
  • Tests added or adapted (try rake test)
  • Changes are reflected in the documentation
  • User-visible changes appended to CHANGELOG.md

Description

Add substitution for 3-digit temps to match 2-digit masking so as not to create unnecessary config commits when temps cross the 100 deg-C boundary in either direction between polls.

@merelissdgr merelissdgr changed the title update regex to be more permissive per CI automation ironware model: graceful handling of 3-digit temps (with more permissive regex per CI automation) Mar 14, 2025
@merelissdgr
Copy link
Contributor Author

rubocop-sequel extension supports plugin, specify `plugins: rubocop-sequel` instead of `require: rubocop-sequel` in /Users/merelis/repos/oxidized/.rubocop.yml.
For more information, see https://docs.rubocop.org/rubocop/plugin_migration_guide.html.

Inspecting 182 files
......................................................................................................................................................................................

182 files inspected, no offenses detected```

@merelissdgr
Copy link
Contributor Author

Please let me know if you require anything further from me to get this merged. Happy to help. Thanks.

Copy link
Collaborator

@robertcheramy robertcheramy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes:

  • If you provide a Device simulation file, it will be easier to test if the change works correctly.
  • Don't worry about the rubocop-sequel extension, this has to be fixed separately.

cfg.gsub! /\d* deg C/, '' # Fix for ADX temperature reporting
cfg.gsub! /([\[]*)1([\]]*)<->([\[]*)2([\]]*)(<->([\[]*)3([\]]*))*/, ''
cfg.gsub! /\d{2}\.\d deg-C/, 'XX.X deg-C'
cfg.gsub! /1XX.X/, 'XX.X'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be better be solved by modifying the Line 40 and use \d+ or \d{2,3}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I originally had it like the latter and it upset something in the PR automated workflow related to linting. That's the only reason I submitted it this way in this attempt, but I've gone ahead and modified it once again as I agree it's better.

@merelissdgr
Copy link
Contributor Author

I've added the simulation yaml file and modified/reverted the regex to the more simplified/generalized solution.

Let me know if there's anything else I can do, thanks.

@merelissdgr merelissdgr changed the title ironware model: graceful handling of 3-digit temps (with more permissive regex per CI automation) ironware model: graceful handling of 3-digit temps, addition of simulated ironware:ICX7150-48Z-HPOE yaml Mar 26, 2025
@merelissdgr merelissdgr changed the title ironware model: graceful handling of 3-digit temps, addition of simulated ironware:ICX7150-48Z-HPOE yaml ironware model: graceful handling of 3-digit temps, addition of simulated ironware:ICX7150-48Z-HPOE (Ruckus) yaml Mar 26, 2025
@merelissdgr merelissdgr changed the title ironware model: graceful handling of 3-digit temps, addition of simulated ironware:ICX7150-48Z-HPOE (Ruckus) yaml ironware model: graceful handling of N-digit temps, addition of simulated ironware:ICX7150-48Z-HPOE (Ruckus) yaml Mar 26, 2025
I had to create (fake) responses for the post_login and pre_logout
commands in simulation.yaml.
Copy link
Collaborator

@robertcheramy robertcheramy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tuned the yaml simulation file because the post_login and pre_logout commands where missing and added a unit test.

If the "fake" answers in the simulation file are OK for you, I would merge this PR. If you want to change them to something more real, please do so, and I'll merge after it.

Note that these answers don't have an impact on the output of the model, so it is okay to leave them unchanged.

@merelissdgr
Copy link
Contributor Author

All seems good to me, thank you.

Copy link
Contributor Author

@merelissdgr merelissdgr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@robertcheramy robertcheramy merged commit 7fddbce into ytti:master Mar 31, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants