[Fuego] [PATCH] power-control: readme about pdudaemon and ttc

Daniel Sangorrin daniel.sangorrin at toshiba.co.jp
Mon Jul 8 08:08:33 UTC 2019


Temporary readme to explain how my power control patch works.
Ultimately it should be integrated with the documentation
and the website

Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
 fuego-ro/boards/README.pdu | 146 +++++++++++++++++++++++++++++++++++++
 1 file changed, 146 insertions(+)
 create mode 100644 fuego-ro/boards/README.pdu

diff --git a/fuego-ro/boards/README.pdu b/fuego-ro/boards/README.pdu
new file mode 100644
index 0000000..f6050cf
--- /dev/null
+++ b/fuego-ro/boards/README.pdu
@@ -0,0 +1,146 @@
+Using power control
+===================
+
+To power on, off and reboot a board use.
+
+  $ ftc power-on -b bbb
+  $ ftc power-off -b bbb
+  $ ftc power-cycle -b bbb
+
+You can also specify multiple boards at once.
+
+  $ ftc power-on -b bbb,raspi3
+  $ ftc power-off -b bbb,raspi3
+  $ ftc power-cycle -b bbb,raspi3
+
+Adding board control to your board
+==================================
+
+First, you need to decide what board control software to use. For example,
+if you want to use PDUdaemon write:
+
+  $ vi fuego-ro/boards/bbb.board
+    BOARD_CONTROL="pdudaemon"
+
+If you prefer to use TTC then write
+
+  $ vi fuego-ro/boards/bbb.board
+    BOARD_CONTROL="ttc"
+
+Next, you need to provide the options required by the board control software
+that you chose.
+
+PDUdaemon-related board options
+-------------------------------
+
+First, you need to configure your PDU hostname and PORT.
+ - PDU_HOSTNAME: the hostname or IP address of your PDU. This needs to match
+   the one defined in the PDUDaemon configuration file (see below)
+ - PDU_PORT: the PDU port number that identifies the outlet where the board
+   is plugged.
+
+  $ vi fuego-ro/boards/bbb.board
+    BOARD_CONTROL="pdudaemon"
+    PDU_HOSTNAME=192.168.11.68
+    PDU_PORT=1
+
+You can optionally specify a delay.
+  - PDU_DELAY: seconds before command runs, or between off/on when rebooting
+    (default: 1 second)
+
+  $ vi fuego-ro/boards/bbb.board
+    BOARD_CONTROL="pdudaemon"
+    PDU_HOSTNAME=192.168.11.68
+    PDU_PORT=1
+    PDU_DELAY=5
+
+Finally, if you are running PDUDaemon outside of your host machine then you
+need to configure PDUDAEMON_HOSTNAME and PDUDAEMON_PORT.
+ - PDUDAEMON_HOSTNAME: hostname or IP address of the computer where the
+   PDUDaemon container is running (default: localhost)
+ - PDUDAEMON_PORT: port where PDUDaemon is listening (default: 16421)
+
+  $ vi fuego-ro/boards/bbb.board
+    BOARD_CONTROL="pdudaemon"
+    PDU_HOSTNAME=192.168.11.68
+    PDU_PORT=1
+    PDUDAEMON_HOSTNAME=localhost <-- change as necessary
+    PDUDAEMON_PORT=16421 <-- change only if you know what you are doing
+
+TTC-related board options
+-------------------------
+
+You only need to configure the TTC target name on your board. Otherwise,
+the board name will be used by default.
+
+  $ vi fuego-ro/boards/bbb.board
+    TTC_TARGET="bbb"
+
+PDUDaemon installation notes
+============================
+
+PDUDaemon can be installed quickly as a Docker container. The first step is to
+clone the source code.
+
+  $ git clone https://github.com/pdudaemon/pdudaemon
+  $ cd pdudaemon
+
+Next, configure the PDUDaemon's hostname and port. This is where the daemon
+will listen for requests.
+
+  $ vi share/pdudaemon.conf
+    {
+        "daemon": {
+            "hostname": "localhost", <-- PDUDaemon hostname or IP address
+            "port": 16421, <-- PDUDaemon port
+            "dbname": "pdudaemon",
+            "logging_level": "DEBUG",
+            "listener": "http"
+        },
+
+You also need to configure your PDU(s). Try to find a driver that supports
+your PDU under pdudaemon/drivers/ (e.g. ip9258.py). Open the driver file
+and check for adjustable settings (e.g., grep settings).
+
+  $ vi share/pdudaemon.conf
+    [...]
+        "pdus": {
+            "192.168.11.68": { <-- PDU hostname or IP address
+                "driver": "ip9258" <-- PDU driver
+            }
+        }
+    }
+
+If you cannot find a driver for your PDU, you will have to write one.
+Alternatively, you may be able to configure the "localcmdline" driver for
+your needs. The symbol %d represents a "port number" that identifies the
+outlet where a board is connected
+
+  $ vi share/pdudaemon.conf
+    [...]
+        "myscript_hostname": {
+            "driver": "localcmdline",
+            "cmd_on": "myscript %d on",
+            "cmd_off": "myscript %d off"
+        },
+
+Finally, build the Docker image and run it on the machine where the daemon
+is configured to run. Here we run it locally because we are using "localhost".
+
+  $ docker build -t pdudaemon --build-arg HTTP_PROXY=$http_proxy -f Dockerfile.dockerhub .
+  $ docker run --rm -it -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e NO_PROXY="$no_proxy" --net="host" pdudaemon:latest
+
+Test the installation manually
+------------------------------
+
+First, make sure that the PDUDaemon is reachable.
+
+  $ ping $PDUDAEMON_HOSTNAME
+
+Next, you can use CURL to power on and off the outlet number 1.
+
+  $ curl "http://localhost:16421/power/control/on?hostname=192.168.11.68&port=1"
+    OK - accepted request
+  $ curl "http://localhost:16421/power/control/off?hostname=192.168.11.68&port=1"
+    OK - accepted request
+
-- 
2.17.1



More information about the Fuego mailing list