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

[feature] spe_switch: Add spe_switch power feature #1274

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ActionHOSchT
Copy link

This PR adds the feature to set power for a phoenix_fl_switch over telnet.

Devices connected with single-pair-ethernet can now be set to power off/on/cycle.

To verify, this Driver was tested on a FL SWITCH 2303-8SP1 with FW-version 3.27.01 BETA.
Even if it's a BETA, we got the information that the power control won't experience breaking changes.

grafik
grafik

grafik

Checklist

  • Documentation for the feature
  • Tests for the feature
  • The arguments and description in doc/configuration.rst have been updated
  • PR has been tested

added single-pair-ethernet power support over telnet

changed name as requested in #4 (comment)

set default for username and password

added .vscode to .gitignore

Signed-off-by: Raffael Krakau <r.krakau90@gmail.com>
Signed-off-by: Raffael Krakau <r.krakau90@gmail.com>
reworked telnet-handling
moved login to function

Signed-off-by: Raffael Krakau <r.krakau90@gmail.com>
Signed-off-by: Raffael Krakau <r.krakau90@gmail.com>
Copy link
Member

@Bastian-Krause Bastian-Krause left a comment

Choose a reason for hiding this comment

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

Looks mostly good to me.

CI test errors are not your fault, #1277 fixes them.

FYI: there is also https://github.com/pdudaemon/pdudaemon, a project that focuses only on PDUs. labgrid's PDUDaemonDriver interfaces with it. So it might be worth a thought to implement this rather over there. Let us know how you think about this.

Note: we should wait for #1277 and rebase this to make CI run this before merging.

Comment on lines +198 to +201
``phoenix_fl_switch``
Controls a single-pair-ethernet powerswitch via telnet.
Tested on a FL SWITCH 2303-8SP1 with FW-version 3.27.01 BETA

Copy link
Member

Choose a reason for hiding this comment

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

I am not sure about the backend name. The complete name of your device is "Phoenix Contact FL SWITCH 2303-8SP1". Could you find out which products use the same "telnet API"? Maybe have look at the firmware? Maybe something like "phoenixcontact_fl_2300"?

@Bastian-Krause Bastian-Krause added enhancement needs rebase Needs a rebase onto the master branch, maintainter could probably not push to submitter branch. labels Oct 9, 2023
@jluebbe jluebbe assigned jluebbe and unassigned ActionHOSchT Dec 15, 2023
Copy link
Member

@jluebbe jluebbe left a comment

Choose a reason for hiding this comment

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

Please also squashfs the existing commits into one with a title following our usual conventions, like "driver/power: add backend for Phoenix Contact FL 2303-8SP1 SPE switch".

Adding support for the telnet scheme in labgrid/driver/powerdriver.py should be a separate commit.

Otherwise it looks good.

Comment on lines +20 to +21
username = "admin"
password = "private"
Copy link
Member

Choose a reason for hiding this comment

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

Instead of hardcoding the credentials, you could use a URL like telnet://admin:private@1.2.3.4/ as the host. You'd need to add telnet as a scheme in https://github.com/labgrid-project/labgrid/blob/master/labgrid/driver/powerdriver.py#L194

Copy link
Author

Choose a reason for hiding this comment

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

This would indeed be nice.

I used netio_kshell.py as inspiration for the phoenix_fl_switch.py .
Implementing a new scheme would be some effort.

If you want me to put this suggestion on our todo this will be noted ?

__login_telnet(tn)

# set value
tn.send(bytes(f'pse port {index} power {action}\r\n', 'utf-8'))
Copy link
Member

@jluebbe jluebbe Dec 15, 2023

Choose a reason for hiding this comment

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

Suggested change
tn.send(bytes(f'pse port {index} power {action}\r\n', 'utf-8'))
tn.send(f'pse port {index} power {action}\r\n'.encode())

Below as well.

@jluebbe jluebbe assigned ActionHOSchT and unassigned jluebbe Dec 15, 2023
@ActionHOSchT
Copy link
Author

Since I will be no longer collaborating with JUMO and therefore have no setup to test changes, I close this PR.

@Bastian-Krause
Copy link
Member

Reopened as requested by @JUMO-GmbH-Co-KG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement needs rebase Needs a rebase onto the master branch, maintainter could probably not push to submitter branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants