Ockle’s main data structure is a acyclic graph implemented by pygraph, that lives in an instance of networkTree/ServerNetwork.py . This graph holds ServerNodes instances, each one represents a server.
You can build a server network from Ockle’s ini files using the Sever Network Generator
The class that handles the graph server network
Add a dependency to a server
Parameters: |
|
---|---|
Raises DependencyException: | |
Will raise an exception if there was a cycle in the server network |
Add a server to the network
Parameters: |
|
---|
Get a list of servers a given server is dependent on (only one level)
Parameters: | server – the server name |
---|
Get a list of servers that are dependent on this server
Parameters: | server – the server name |
---|
Get a server by name
Parameters: | serverNameSearch – The server to search for |
---|---|
Returns: | The server class, None if not found |
Get a server node by name
Parameters: | serverName – The name of the server node |
---|---|
Returns: | The server node |
returns a list of the nodes topologically sorted
Returns: | a list of the nodes topologically sorted |
---|
returns a list of the node names topologically sorted
Returns: | a list of the node names topologically sorted |
---|
Is a server ready to be turned on?
Returns: | True if the server is ready to be turned on |
---|
Remove a dependency from a server
Parameters: |
|
---|
The Server Node object holds the global operation state of the server, and methods to control the server as a whole. Server objects are also stored in this instance. Currently server objects are: Outlets, Controls and Tests.
This class represents a PC in the network
Execute an on/off action on the server
Parameters: |
|
---|
Returns controls that don’t have a given opState
Parameters: | opState – |
---|---|
Returns: | controls that don’t have a given state |
Returns outlets that don’t have a given opState
Parameters: | opState – |
---|---|
Returns: | outlets that don’t have a given state |
Get an outlet from the outlet list
:param number outlet number in the list :return: an outlet type that is in the given place
Returns a dict that holds all the outlets and their data dict. This gets sent to the logger
Returns: | A dict with each outlet name, and a dict of its data |
---|
Increment the stop attempt counter
Returns: | Number of shutdown attempts |
---|
Increment the startup attempt counter
Returns: | Number of startup attempts |
---|
Set all the controls to a given opState
Parameters: | opState – The opState to set the control to |
---|
Set all the outlets to a given opState
Parameters: | opState – The opState to set the outlets to |
---|
Sets the outlets all to a given state by force
Parameters: | state – set the outlets to state (boolean) |
---|---|
Returns: | A list of outlets the failed (note: you can check with “if not” to see if there was no failure |