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

power: add ubus NetworkPowerPort #1409

Merged
merged 1 commit into from
Jun 18, 2024
Merged

Conversation

aparcar
Copy link
Contributor

@aparcar aparcar commented May 21, 2024

Description

Using PoE switches as power supply is convenient since a switch is needed in many cases anyway and with the right adapter most embedded devices can be powered.

OpenWrt offers ubus as micro bus system to control the system, including PoE ports on switches.

This commit adds a driver to handle PoE switches running OpenWrt.

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

Same as for all other NetworkPowerPorts

  • Add a section on how to use the feature to doc/development.rst
  • PR has been tested
  • Man pages have been regenerated

no changes

@aparcar
Copy link
Contributor Author

aparcar commented May 22, 2024

I don't understand how this fails since I haven't touched the problematic files:

************* Module labgrid.util.yaml
labgrid/util/yaml.py:87:18: E0606: Possibly using variable 'items' before assignment (possibly-used-before-assignment)
************* Module labgrid.util.agents.network_interface
labgrid/util/agents/network_interface.py:98:23: E0606: Possibly using variable 'nm' before assignment (possibly-used-before-assignment)
************* Module labgrid.remote.client
labgrid/remote/client.py:1215:27: E0606: Possibly using variable 'data' before assignment (possibly-used-before-assignment)
labgrid/remote/client.py:1327:29: E0606: Possibly using variable 'data' before assignment (possibly-used-before-assignment)
************* Module labgrid.driver.mqtt
labgrid/driver/mqtt.py:46:23: E0606: Possibly using variable 'status' before assignment (possibly-used-before-assignment)

@jremmet
Copy link
Contributor

jremmet commented May 22, 2024

I don't understand how this fails since I haven't touched the problematic files:

Saw this today with an new pylint version

@Emantor
Copy link
Member

Emantor commented May 22, 2024

I don't understand how this fails since I haven't touched the problematic files:

************* Module labgrid.util.yaml
labgrid/util/yaml.py:87:18: E0606: Possibly using variable 'items' before assignment (possibly-used-before-assignment)
************* Module labgrid.util.agents.network_interface
labgrid/util/agents/network_interface.py:98:23: E0606: Possibly using variable 'nm' before assignment (possibly-used-before-assignment)
************* Module labgrid.remote.client
labgrid/remote/client.py:1215:27: E0606: Possibly using variable 'data' before assignment (possibly-used-before-assignment)
labgrid/remote/client.py:1327:29: E0606: Possibly using variable 'data' before assignment (possibly-used-before-assignment)
************* Module labgrid.driver.mqtt
labgrid/driver/mqtt.py:46:23: E0606: Possibly using variable 'status' before assignment (possibly-used-before-assignment)

Yep thats the new pylint version. See #1406

labgrid/driver/power/ubus.py Show resolved Hide resolved
@aparcar
Copy link
Contributor Author

aparcar commented Jun 4, 2024

Successfully tested on real hardware.

@aparcar aparcar marked this pull request as ready for review June 4, 2024 15:05
@aparcar
Copy link
Contributor Author

aparcar commented Jun 13, 2024

How do I regenerate the Man pages?

@Emantor
Copy link
Member

Emantor commented Jun 17, 2024

How do I regenerate the Man pages?

There is a Makefile inside the man folder which requires the python rst2man module.

@aparcar
Copy link
Contributor Author

aparcar commented Jun 17, 2024

done... let me actually fix these dependency issues Installing the dependencies via pip install .[doc] and running make in the man/ folder did not change any docs.

@Emantor
Copy link
Member

Emantor commented Jun 17, 2024

done... let me actually fix these dependency issues Installing the dependencies via pip install .[doc] and running make in the man/ folder did not change any docs.

Ah, yeah this is only required if you touch the .rst files inside the man folder.

@aparcar
Copy link
Contributor Author

aparcar commented Jun 17, 2024

In that case please let me know if anything else is needed prior a merge :)

@Emantor
Copy link
Member

Emantor commented Jun 17, 2024

In that case please let me know if anything else is needed prior a merge :)

The docstring seems to have the wrong format, thats why the CI is failing.

Using PoE switches as power supply is convenient since a switch is
needed in many cases anyway and with the right adapter most embedded
devices can be powered.

OpenWrt offers `ubus` as micro bus system to control the system,
including PoE ports on switches.

This commit adds a driver to handle PoE switches running OpenWrt.

An ACL example is given below:

```shell
root@switch:~# cat /usr/share/rpcd/acl.d/unauthenticated.json
{
    "unauthenticated": {
        "description": "Access controls for unauthenticated requests",
        "read": {
            "ubus": {
                "session": [
                    "access",
                    "login"
                ],
                "poe": [
                    "info",
                    "manage"
                ]
            }
        }
    }
}
```

Signed-off-by: Paul Spooren <mail@aparcar.org>
Copy link

codecov bot commented Jun 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.7%. Comparing base (70232e4) to head (aae45b6).
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1409     +/-   ##
========================================
- Coverage    62.2%   52.7%   -9.5%     
========================================
  Files         164     165      +1     
  Lines       12201   12216     +15     
========================================
- Hits         7590    6439   -1151     
- Misses       4611    5777   +1166     

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

@aparcar
Copy link
Contributor Author

aparcar commented Jun 17, 2024

I added the specific example to the commit message to make docstring happy.

@Emantor Emantor merged commit 67c7c58 into labgrid-project:master Jun 18, 2024
10 of 11 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.

None yet

4 participants