Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from pdu import PDU, PDUPort, PDUState
4class DummyPDU(PDU):
5 def __init__(self, name, config):
6 self._ports = []
8 for i, port_label in enumerate(config.get('ports', [])):
9 port = PDUPort(self, i, port_label)
10 port._state = PDUState.ON
11 self._ports.append(port)
13 super().__init__(name)
15 @property
16 def ports(self):
17 return self._ports
19 def set_port_state(self, port_id, state):
20 port = self.ports[int(port_id)]
21 port._state = state
23 def get_port_state(self, port_id):
24 port = self.ports[int(port_id)]
25 return port._state