Skip to content

driver: add verified Telnet power control for WTI NPS switches - #2068

Open
ffainelli wants to merge 1 commit into
labgrid-project:masterfrom
ffainelli:wti
Open

ffainelli wants to merge 1 commit into
labgrid-project:masterfrom
ffainelli:wti

Conversation

@ffainelli

Copy link
Copy Markdown
Contributor

Signed-off-by: Florian Fainelli f.fainelli@gmail.com

Comment thread doc/configuration.rst Resolved
Comment thread labgrid/driver/wtipowerdriver.py Outdated
return states[0] == b'ON'

def _request(self, value=None):
from telnetlib3 import Telnet # optional dependency

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please remove the comment, it does not do anything here.

Comment thread labgrid/driver/wtipowerdriver.py Outdated
class WTIPowerDriver(Driver, PowerResetMixin, PowerProtocol):
"""Control one outlet on an eight-outlet WTI switch.

Bind a NetworkPowerPort with model 'wti'. Disable command confirmations

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The comment says this binds only with a wti model, but there is no code here to restrict that.

Either way, using NetworkPowerPort is probably not the correct choice here, the NetworkPowerDriver will fail to bind to it because no wti backend exists. So this either needs its own resource or needs to be turned into a backend for the NetworkPowerPort.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just saw that after reviewing, I agree with @Emantor on converting this to a backend for NetworkPowerPort 👍

@Emantor Emantor added enhancement needs author info Requires more information from the PR/Issue author labels Nov 20, 2026
@ffainelli

Copy link
Copy Markdown
Contributor Author

Thanks, updated the pull request with your review.

@ozan956 ozan956 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Have you considered implementing this as a NetworkPowerPort backend (labgrid/driver/power/wti.py, like netio_kshell)? That would give labgrid-client power support, proxy forwarding, and docs/tests for free. Credentials could go in the host url (e.g. telnet://:supersecret@host:23), as other backends do (e.g. rpm1521). Is there anything a backend can't do here, apart from the timeout?

Comment thread pyproject.toml Outdated
"PyVISA-py>=0.5.2",
]
snmp = ["pysnmp>=7.1.20"]
telnet = ["telnetlib3>=4.0.0,<5"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A comment that explains why this is being capped would be nice.

Comment thread pyproject.toml Outdated
"PyVISA-py>=0.5.2",
]
snmp = ["pysnmp>=7.1.20"]
telnet = ["telnetlib3>=4.0.0,<5"]

@ozan956 ozan956 Dec 1, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CI installs .[dev] only, and telnet isn't part of it, so tests had skipped unfortunately.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
@codecov

codecov Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.55172% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.2%. Comparing base (991408a) to head (840692b).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
labgrid/driver/power/wti.py 96.2% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #2068     +/-   ##
========================================
+ Coverage    66.1%   66.2%   +0.1%     
========================================
  Files         194     195      +1     
  Lines       16204   16261     +57     
========================================
+ Hits        10723   10780     +57     
  Misses       5481    5481             
Flag Coverage Δ
3.11 66.2% <96.5%> (+0.1%) ⬆️
3.12 66.2% <96.5%> (+0.1%) ⬆️
3.13 66.2% <96.5%> (+0.1%) ⬆️
3.14 66.1% <96.5%> (+0.1%) ⬆️
3.15 66.1% <96.5%> (+0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@ozan956 ozan956 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the rework, @ffainelli! 🙌

Moving this to a NetworkPowerPort backend fit much better with the rest of labgrid, and the code is a lot cleaner now 👍

Maybe the changes on powerdriver.py can have its own commit (if you want).

It would also be great to add a release note, since this adds a new backend. We recently switched to reno (https://docs.openstack.org/reno/latest/), and the workflow is described in the development docs (https://labgrid.readthedocs.io/en/latest/development.html#workflow).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement needs author info Requires more information from the PR/Issue author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants