summaryrefslogtreecommitdiff
path: root/validation/validlib/io_group.py
blob: 339c1159ead26e8d130e5a9371d2ddb8499acc78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*- coding: utf-8 -*-

"""Module allowing to command and control the Anel io's"""

import anellib

config = {
    #key: (IP adress, login, password)
    1: ("192.168.0.13", "admin", "anel")
    }

def parameters():
    """Parameters specific to the command and control of the Anel io's"""
    return {
        "target":"io",
        "switch_path":"/io.htm",
        "status_path":"/io.htm",
        "body":"n0=IO-1&e0=0&n1=IO-2&e1=0&n2=IO-3&e2=0&n3=IO-4&e3=0&" \
            "n4=IO-5&e4=0&n5=IO-6&e5=0&n6=IO-7&e6=0&n7=IO-8&e7=0",
        "letter":"E",
        "config":config,
        "size":8
        }

def switch(command, keys):
    """Switch on/off of the io's specified by the keys"""
    return anellib.switch(command, keys, parameters())

def status(key):
    """Return the status on/off of the io's specified by the keys"""
    return anellib.status(key, parameters())

def indexes():
    """Return a list containing the index of each group of io's"""
    return anellib.indexes(parameters())

def subindexes():
    """Return a list containing the index of each io in a group of io's"""
    return anellib.subindexes(parameters())

def switch_off_all():
    """Switch off all io's"""
    return anellib.switch_off_all(parameters())