Hide keyboard shortcuts

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 

2 

3 

4class DummyPDU(PDU): 

5 def __init__(self, name, config): 

6 self._ports = [] 

7 

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) 

12 

13 super().__init__(name) 

14 

15 @property 

16 def ports(self): 

17 return self._ports 

18 

19 def set_port_state(self, port_id, state): 

20 port = self.ports[int(port_id)] 

21 port._state = state 

22 

23 def get_port_state(self, port_id): 

24 port = self.ports[int(port_id)] 

25 return port._state