A library and actor to communicate with an SDSS-V LVM network power switch
Project description
lvmnps
LVM Network Power Switch
Features
- CLU Actor based interface
- Supports a Dummy PDU
- Supports iBOOT g2 with python code from here
- Supports Digital Loggers Web Power with python code from here
Installation
Clone this repository.
git clone https://github.com/sdss/lvmnps
cd lvmnps
Quick Start
Start the actor
Start lvmnps
actor.
lvmnps start
In another terminal, type clu
and lvmnps ping
for test.
clu
lvmnps ping
07:41:22.636 lvmnps >
07:41:22.645 lvmnps : {
"text": "Pong."
}
Stop lvmnps
actor.
lvmnps stop
Config file structure
switches:
name_your_switch_here: # should be a unique name
type: dummy # currently dummy, iboot, dli
num: 8 # number of ports
ports:
1:
name: "skyw.pwi" # should also be a unique name
desc: "Something that make sense"
should_be_a_unique_name:
type: dummy
ports:
1:
name: "skye.pwi"
desc: "PlaneWavemount Skye"
Status return for all commands
- if
name
is not defined then the port name will beswitch name.port number
, e.g.nps_dummy_1.port1
. Otherwisename
from the config file will be used. STATE: 1: ON, 0: OFF, -1: UNKNOWN
"STATUS": {
"nps_dummy_1.port1": {
"STATE": -1,
"DESCR": "was 1",
"SWITCH": "nps_dummy_1",
"PORT": 1
},
Run the example lvmnps_dummy
cd lvmnps
poetry run lvmnps -vvv -c $(pwd)/python/lvmnps/etc/lvmnps_dummy.yml start
poetry run clu
- Status command without parameter returns all ports of all switches.
- The default is to return only configured ports, otherwise define 'ouo' false in the config file, see lvmnps_dummy.yml
>>> lvmnps status
12:02:08.649 lvmnps >
12:02:08.660 lvmnps i {
"STATUS": {
"nps_dummy_1.port1": {
"STATE": -1,
"DESCR": "was 1",
"SWITCH": "nps_dummy_1",
"PORT": 1
},
"skye.what.ever": {
"STATE": -1,
"DESCR": "whatever is connected to skye",
"SWITCH": "nps_dummy_1",
"PORT": 2
},
"skyw.what.ever": {
"STATE": -1,
"DESCR": "Something @ skyw",
"SWITCH": "nps_dummy_1",
"PORT": 4
},
"skye.pwi": {
"STATE": -1,
"DESCR": "PlaneWavemount Skye",
"SWITCH": "skye.nps",
"PORT": 1
},
"skyw.pwi": {
"STATE": -1,
"DESCR": "PlaneWavemount Skyw",
"SWITCH": "nps_dummy_3",
"PORT": 1
}
}
}
- status command with port name skyw.what.ever
>>> lvmnps status skyw.what.ever
12:07:12.349 lvmnps >
12:07:12.377 lvmnps i {
"STATUS": {
"skyw.what.ever": {
"STATE": -1,
"DESCR": "Something @ skyw",
"SWITCH": "nps_dummy_1",
"PORT": 4
}
- status command with switch name nps_dummy_1
>>> lvmnps status nps_dummy_1
12:07:12.349 lvmnps >
12:12:21.349 lvmnps i {
"STATUS": {
"nps_dummy_1.port1": {
"STATE": -1,
"DESCR": "was 1",
"SWITCH": "nps_dummy_1",
"PORT": 1
},
"skye.what.ever": {
"STATE": -1,
"DESCR": "whatever is connected to skye",
"SWITCH": "nps_dummy_1",
"PORT": 2
},
"skyw.what.ever": {
"STATE": -1,
"DESCR": "Something @ skyw",
"SWITCH": "nps_dummy_1",
"PORT": 4
}
}
}
- status command with switch name nps_dummy_1 and port 4 returns
lvmnps status nps_dummy_1 4
12:07:12.349 lvmnps >
12:12:21.349 lvmnps i {
"STATUS": {
"skyw.what.ever": {
"STATE": -1,
"DESCR": "Something @ skyw",
"SWITCH": "nps_dummy_1",
"PORT": 4
}
}
}
- the commands on and off use the same addressing scheme as status
## Test
```console
poetry run pytest
poetry run pytest -p no:logging -s -vv
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sdss-lvmnps-0.3.0.tar.gz
(17.3 kB
view hashes)
Built Distribution
Close
Hashes for sdss_lvmnps-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 105221b76f1ed4fe3b6534053f620415d2301876b467071624f2506c8e9b1a70 |
|
MD5 | 46d6a88aafd442c124557ad805b08e8e |
|
BLAKE2b-256 | c08fb595f6907c1e97bb5fa75a63ac601521ab51a4277ef9f5d7d26a0f8e6aa1 |