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

driver: digitalloggers_restapi: enable REST API #1512

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

moto-timo
Copy link

@moto-timo moto-timo commented Sep 30, 2024

The legacy HTTP API does not work on newer units without manually changing the configuration in Setup.

This driver is based on https://www.digital-loggers.com/restapi.pdf

Curl examples that were used for development are included as comments so that users can test their access outside of labgrid.

The REST API seems to only allow authenticated users, so the host: parameter is parsed to pass user and password to HTTPDigestAuth. CSRF is also required, so a valid (simple) header is provided. Non-authenticated URLs are supported, but most likely will not work.

HTTPS is recommended, but the units ship with self-signed certificates so SSL certificate verification warnings are intentionally ignored.

Example usage in lg-env.yaml (default as-shipped settings):

NetworkPowerPort:
model: 'digitalloggers_restapi'
host: 'http://admin:1234@192.168.0.100'
index: 0

Description

Checklist

  • Documentation for the feature
  • Tests for the feature
  • The arguments and description in doc/configuration.rst have been updated
  • Add a section on how to use the feature to doc/usage.rst
  • Add a section on how to use the feature to doc/development.rst
  • PR has been tested
  • Man pages have been regenerated

The legacy HTTP API does not work on newer units without manually
changing the configuration in Setup.

This driver is based on https://www.digital-loggers.com/restapi.pdf

Curl examples that were used for development are included as comments
so that users can test their access outside of labgrid.

The REST API seems to only allow authenticated users, so the host:
parameter is parsed to pass user and password to HTTPDigestAuth.
CSRF is also required, so a valid (simple) header is provided.
Non-authenticated URLs are supported, but most likely will not
work.

HTTPS is recommended, but the units ship with self-signed certificates
so SSL certificate verification warnings are intentionally ignored.

Add to test_powerdriver.py import test.

Example usage in lg-env.yaml (default as-shipped settings):

NetworkPowerPort:
    model: 'digitalloggers_restapi'
    host: 'http://admin:1234@192.168.0.100'
    index: 0

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
@moto-timo
Copy link
Author

Added to test_powerdriver.py in second push.

@Bastian-Krause
Copy link
Member

Have you considered contributing this to pdudaemon? Please see our merge policy for network PDUs: #1031

@moto-timo
Copy link
Author

Have you considered contributing this to pdudaemon? Please see our merge policy for network PDUs: #1031

There is no support for digitalloggers in pdudaemon but there was support in labgrid... I'm not currently using pdudaemon and the code will be significantly different so no sure when i will have time for that.

I remember conversations about pdudaemon in the past, not opposed to the policy... I almost feel like we should drop network power support in labgrid though to avoid confusion.

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.

4 participants