Skip to content
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

Fix PoE config not showing up for Cisco if interface is missing POEPort #2781

Merged
merged 4 commits into from
Dec 14, 2023

Conversation

stveit
Copy link
Contributor

@stveit stveit commented Dec 5, 2023

During navref, UIA mentioned that the new PoE Status column did not show up for their Cisco equipment.

Turns out this is because get_poe_states fails if even a single interface does not have a related POEPort object.

This was originally intended functionality, even the cisco PoE tests reflects this behaviour. But I realize that a device not having a relation to a POEPort device simply means it does not support PoE, and in that case it should not crash the entire function. It should instead set the state for that interface to None as specified in the docstring for get_poe_states

This PR fixes this and updates tests accordingly. It also updates set_poe_state to behave similarly when it comes to missing PoE indexes

Also fixes a small issue with tests where the property for certain mock objects were named incorrectly.

@stveit stveit self-assigned this Dec 5, 2023
Copy link

codecov bot commented Dec 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2b52575) 57.03% compared to head (33381e1) 57.03%.

Additional details and impacted files
@@            Coverage Diff             @@
##            5.8.x    #2781      +/-   ##
==========================================
- Coverage   57.03%   57.03%   -0.01%     
==========================================
  Files         567      567              
  Lines       41280    41279       -1     
==========================================
- Hits        23544    23543       -1     
  Misses      17736    17736              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Dec 5, 2023

Test results

     12 files       12 suites   11m 39s ⏱️
3 303 tests 3 303 ✔️ 0 💤 0
9 384 runs  9 384 ✔️ 0 💤 0

Results for commit 33381e1.

♻️ This comment has been updated with latest results.

@stveit stveit force-pushed the portadmin/fix-cisco-poe branch 2 times, most recently from 7572d30 to 92d67ce Compare December 5, 2023 12:09
Copy link
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

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

Actually, this should be rebased on the 5.8.x branch for a bugfix release

POEIndexNotFoundError will be raised if POEPorts do not
exist for an interface, and this is likely to be the case
for an interface that  does not support PoE.
get_poe_states should set state to None for these
interfaces, like it does if PoeNotSupportedError is raised.
interface not having poeport should be considered as
the interface not supporting poe
@lunkwill42 lunkwill42 force-pushed the portadmin/fix-cisco-poe branch from e938081 to 33381e1 Compare December 14, 2023 07:47
@lunkwill42 lunkwill42 changed the base branch from master to 5.8.x December 14, 2023 07:47
Copy link
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

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

rebased on 5.8.x myself, since you're on vacation :)

Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@lunkwill42 lunkwill42 merged commit 4ac4d8f into Uninett:5.8.x Dec 14, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants