summaryrefslogtreecommitdiff
path: root/validation/validlib/power_strip.py
diff options
context:
space:
mode:
Diffstat (limited to 'validation/validlib/power_strip.py')
-rw-r--r--validation/validlib/power_strip.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/validation/validlib/power_strip.py b/validation/validlib/power_strip.py
new file mode 100644
index 0000000000..946ba5049b
--- /dev/null
+++ b/validation/validlib/power_strip.py
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+
+"""Module allowing to command and control the Anel power plugs"""
+
+import anellib
+
+config = {
+ #key: (IP adress, login, password)
+ 1: ("192.168.0.11", "admin", "anel"),
+ 2: ("192.168.0.13", "admin", "anel")
+ }
+
+def parameters():
+ """Parameters specific to the command and control of the Anel power plugs"""
+ return {
+ "target":"power plug",
+ "switch_path":"/ctrl.htm",
+ "status_path":"/mobile.htm",
+ "body":"x=10",
+ "letter":"F",
+ "config":config,
+ "size":8
+ }
+
+def switch(command, keys):
+ """Switch on/off of the power plugs specified by the keys"""
+ return anellib.switch(command, keys, parameters())
+
+def status(key):
+ """Return the status on/off of the power plugs specified by the keys"""
+ return anellib.status(key, parameters())
+
+def indexes():
+ """Return a list containing the index of each power strip"""
+ return anellib.indexes(parameters())
+
+def subindexes():
+ """Return a list containing the index of each power plug in a power strip"""
+ return anellib.subindexes(parameters())
+
+def switch_off_all():
+ """Switch off all power plugs"""
+ return anellib.switch_off_all(parameters())
+