Controllers - Controls

Controllers are object generators that create controls for a server. Controls are a set of commands that can tell a server to switch itself off on the software level (before the outlets switch off its power). Controllers also have a data field that gets logged in the PluginLogger, enabling logging information from the servers.

Coding a New Controller Type

When creating a new controller type you should extend the class controller.ControllerTemplate.ControllerTemplate.

The python file containing the class should be placed in the src/controllers package.

Here are the methods you should implement when writing a new Controller class:

class controllers.ControllerTemplate.ControllerTemplate(name, controllerConfigDict={}, controllerParams={})[source]

Template for a control object that all other controls extend

Variables:data – Holds a dict of the data from the control
_setControlState(state)[source]

To be implemented by the child, sets the control’s state

Parameters:state (bool) – The state to set
_getControlState()[source]

To be implemented by the child, sets the control’s state

Returns:The current control state
updateData()[source]

To be Implemented in the child, updates the self.data variable

Example Dummy Control

Here is an example dummy outlet implementation

Example for a control INI Template File

Here is an INI template file from a control to send ssh commands to a server, located at src/config/conf_controllers/SSHController.ini:

Project Versions

Table Of Contents

Previous topic

Power distribution units (PDUs) - Outlets

Next topic

Testers - Tests

This Page