The Communication Client

The communication is a python library that lets you send commands to Ockle from a python shell using an external program.

Ockle PDU and servers manager Client calls to the Ockle server

Created on Apr 25, 2012

@author: Guy Sheffer <guy.sheffer at mail.huji.ac.il>

ockle_client.ClientCalls.deleteINIFile(iniPath)[source]

Delete an INI file from Ockle’s configuration

Parameters:iniPath – the path of the ini file starting from the ‘etc’ folder
Returns:A response from Ockle
ockle_client.ClientCalls.deleteINISection(section, iniPath)[source]

Delete a section from an INI file in Ockle’s configuration

Parameters:
  • iniPath – the path of the ini file starting from the ‘etc’ folder
  • section – the section to be deleted
Returns:

A response from Ockle

ockle_client.ClientCalls.getAutoControlStatus()[source]

Get the status of the Auto Control plugin

Returns:A dict with a key ‘status’ holding the status of Auto Control
ockle_client.ClientCalls.getAvailableControllersList()[source]

Get the currently available controller types list

Returns:a sorted dict of controllers, the key is the name of the controller, and extra information is within the dict’s value
ockle_client.ClientCalls.getAvailablePDUsList()[source]

Get the currently available PDU types list

Returns:a sorted dict of PDUs, the key is the name of the PDU, and extra information is within the dict’s value
ockle_client.ClientCalls.getAvailablePluginsList()[source]

Get the list of available plugins

Returns:a dict with the plugin names as keys and the description as the value
ockle_client.ClientCalls.getAvailableServerControls(server)[source]

Get the currently configured controls of a given server

Returns:a sorted dict of controls, the key is the name of the test, and extra information is within the dict’s value
ockle_client.ClientCalls.getAvailableServerOutlets(server)[source]

Get the currently configured servers list

Returns:a sorted dict of servers, the key is the name of the server, and extra information is within the dict’s value
ockle_client.ClientCalls.getAvailableServerTesters(server)[source]

Get the currently configured tests of a given server

Returns:a sorted dict of tests, the key is the name of the test, and extra information is within the dict’s value
ockle_client.ClientCalls.getAvailableTestersList()[source]

Get the currently available testers type list

Returns:a sorted dict of testers, the key is the name of the tester, and extra information is within the dict’s value
ockle_client.ClientCalls.getControllerDict()[source]

Get a dict of the current controllers that are configured

Returns:A dict of controllers with the key as their name and the value as their description
ockle_client.ClientCalls.getControllerFolder()[source]

Get the configuration folder of all controllers

Returns:A string of the folder name
ockle_client.ClientCalls.getDataFromServer(command, paramsDict={}, noReturn=False)[source]

Send a command to the Ockle server, and return the responce dict

Parameters:
  • command – The command to send
  • paramsDict – the dictionary that is sent with command arguments
  • noReturn – Should we not expect a reply. Used in cases were we want to restart the Ockle server
Returns:

A dict with the response data, None if we failed to connect

ockle_client.ClientCalls.getINIFile(iniPath)[source]

Get an INI file from Ockle’s configuration

Parameters:iniPath – the path of the ini file starting from the ‘etc’ folder
Returns:A string with the ini file contents
ockle_client.ClientCalls.getPDUDict()[source]

Get a dict of the current PDUs that are configured

Returns:A dict of PDUs with the key as their name and the value as their description
ockle_client.ClientCalls.getPDUFolder()[source]

Get the configuration folder of all PDUs

Returns:A string of the folder name
ockle_client.ClientCalls.getServerAvilableDependencies(server)[source]

Get a dict of the available dependencies that can be created for a server

Parameters:server – the server that is going to have the new dependency
Returns:A dict of servers and their description
ockle_client.ClientCalls.getServerDict()[source]

Get a dict of the current servers that are configured

Returns:A dict of servers with the key as their name and the value as their description
ockle_client.ClientCalls.getServerFolder()[source]

Get the configuration folder of all servers

Returns:A string of the folder name
ockle_client.ClientCalls.getServerTree()[source]

Get a server tree status from the Ockle server, and return a dict ready to be parsed by a pyramid view

Returns:a string with the dot graph
ockle_client.ClientCalls.getServerView(serverName)[source]

Get information of the server

Parameters:serverName – the server’s name
Returns:a dict of string of the server’s info
ockle_client.ClientCalls.getTesterDict()[source]

Get a dict of the current testers that are configured

Returns:A dict of testers with the key as their name and the value as their description
ockle_client.ClientCalls.getTesterFolder()[source]

Get the configuration folder of all testers

Returns:A string of the folder name
ockle_client.ClientCalls.listCommands()[source]

A command to list all available commands on the communication server

Returns:A dict with the command names as the key and a description if available as their value
ockle_client.ClientCalls.loadINIFileConfig(configPath)[source]

Get the config on an ini file @param configPath: the path to the config relative to etc @return: a dict of the config

ockle_client.ClientCalls.loadINIFileTemplate(templatePaths)[source]

Load an INI file and template data so it would display correctly. Is called with loadINIFileConfig(configPath)

Parameters:templatesPaths – A path, or list of paths relative to ‘src/config’
Returns:A dicts of the template
ockle_client.ClientCalls.restartOckle()[source]

Restart Ockle

ockle_client.ClientCalls.runTest(dataDict)[source]

Switch a server outlet on or off

Parameters:dataDict – a dict holding two keys: ‘server’ key for the server’s name and an ‘obj’ key for the outlet’s name
Returns:the OpState of the test
ockle_client.ClientCalls.serversDependent(server)[source]

Get a dict of servers that this server is dependent on

Parameters:server – The server to check for
Returns:a dict of servers that this server is dependent on
ockle_client.ClientCalls.setAutoControlStatus(dataDict)[source]

Set the status of Auto Control

Param :dataDict: A dictionary with the field status which is either ‘on’ or ‘off’
Returns:A dict similar to ::func: getAutoControlStatus
ockle_client.ClientCalls.setINIFile(iniPath, iniDict)[source]

Set an INI file from Ockle’s configuration

Parameters:
  • iniPath – the path of the ini file starting from the ‘etc’ folder
  • iniDict – a dict holding the structure of the ini file
Returns:

A response from Ockle

ockle_client.ClientCalls.setServer(dataDict)[source]

Set a server on or off

Parameters:dataDict – A dict with two keys, one with the key ‘server’ which holds the server name in its value, and another with the key ‘state’ where its value is wither ‘on’ or ‘off’
Returns:A dict with the key ‘status’ containing a string reply from Ockle
ockle_client.ClientCalls.switchControl(dataDict)[source]

Switch a server control on or off

Parameters:dataDict – a dict holding three keys: ‘server’ key for the server’s name, an ‘obj’ key for the control’s name and the ‘state’ key with a string ‘on’ or ‘off’
Returns:the OpState of the control
ockle_client.ClientCalls.switchNetwork(dataDict)[source]

A master command to turn all the servers on the network on or off

Parameters:dataDict – a dict with the key ‘state’ that has a string ‘true’ or ‘false’
Returns:a dict with the key ‘status’ with a string reply from Ockle
ockle_client.ClientCalls.switchOutlet(dataDict)[source]

Switch a server outlet on or off

Parameters:dataDict – a dict holding three keys: ‘server’ key for the server’s name, an ‘obj’ key for the outlet’s name and the ‘state’ key with a string ‘on’ or ‘off’
Returns:the OpState of the outlet

Example usage

Here is a simple example on how to use the ockle_client module:
import webserver.ockle_client.ClientCalls as ockleClient
ockleClient.PORT = 8088
ockleClient.OCKLE_SERVER_HOSTNAME = 'localhost'

print ockleClient.listCommands()

Project Versions

Table Of Contents

Previous topic

Webserver - Ockle’s GUI

Next topic

Server Objects and Object Generators

This Page