cafe.engine.clients package¶
cafe.engine.clients.commandline module¶
-
class
cafe.engine.clients.commandline.
BaseCommandLineClient
(base_command=None, env_var_dict=None)[source]¶ Bases:
cafe.engine.clients.base.BaseClient
Provides low level connectivity to the commandline via popen()
Primarily intended to serve as base classes for a specific command line client Class. This class is dependent on a local installation of the wrapped client process. The thing you run has to be there!
-
run_command
(cmd, *args)[source]¶ Sends a command directly to this instance’s command line @param cmd: Command to sent to command line @type cmd: C{str} @param args: Optional list of args to be passed with the command @type args: C{list} @raise exception: If unable to close process after running the command @return: The full response details from the command line @rtype: L{CommandLineResponse} @note: PRIVATE. Can be over-ridden in a child class
-
run_command_async
(cmd, *args)[source]¶ Running a command asynchronously returns a CommandLineResponse objecct with a running subprocess.Process object in it. This process needs to be closed or killed manually after execution.
-
set_environment_variables
(env_var_dict=None)[source]¶ Sets all os environment variables provided in env_var_dict
-
cafe.engine.clients.ping module¶
-
class
cafe.engine.clients.ping.
PingClient
[source]¶ Bases:
object
@summary: Client to ping windows or linux servers
-
DEFAULT_NUM_PINGS
= 3¶
-
PING_IPV4_COMMAND_LINUX
= 'ping -c {num_pings}'¶
-
PING_IPV4_COMMAND_WINDOWS
= 'ping -c {num_pings}'¶
-
PING_IPV6_COMMAND_LINUX
= 'ping6 -c {num_pings}'¶
-
PING_IPV6_COMMAND_WINDOWS
= 'ping -6 -c {num_pings}'¶
-
PING_PACKET_LOSS_REGEX
= '(\\d{1,3})\\.?\\d*\\%.*loss'¶
-
classmethod
ping
(ip, ip_address_version, num_pings=3)[source]¶ @summary: Ping an IP address, return if replies were received or not. @param ip: IP address to ping @type ip: string @param ip_address_version: IP Address version (4 or 6) @type ip_address_version: int @param num_pings: Number of pings to attempt @type num_pings: int @return: True if the server was reachable, False otherwise @rtype: bool
-
classmethod
ping_percent_loss
(ip, ip_address_version, num_pings=3)[source]¶ - @summary: Ping an IP address, return the percent of replies not
- returned
@param ip: IP address to ping @type ip: string @param ip_address_version: IP Address version (4 or 6) @type ip_address_version: int @param num_pings: Number of pings to attempt @type num_pings: int @return: Percent of responses not received, based on number of requests @rtype: int
-
classmethod
ping_percent_success
(ip, ip_address_version, num_pings=3)[source]¶ @summary: Ping an IP address, return the percent of replies received @param ip: IP address to ping @type ip: string @param ip_address_version: IP Address version (4 or 6) @type ip_address_version: int @param num_pings: Number of pings to attempt @type num_pings: int @return: Percent of responses received, based on number of requests @rtype: int
-
cafe.engine.clients.sql module¶
-
class
cafe.engine.clients.sql.
BaseSQLClient
[source]¶ Bases:
cafe.engine.clients.base.BaseClient
Base support client for DBAPI 2.0 clients.
This client is not meant to be used directly. New clients will extend this client and live inside of the individual CAFE.
For more information on the DBAPI 2.0 standard please visit: .. seealso:: http://www.python.org/dev/peps/pep-0249
-
connect
(data_source_name=None, user=None, password=None, host=None, database=None)[source]¶ Connects to self._driver with passed parameters
Parameters: - data_source_name (string) – The data source name
- user (string) – Username
- password (string) – Password
- host (string) – Hostname
- database (string) – Database Name
-
execute
(operation, parameters=None, cursor=None)[source]¶ Calls execute with operation & parameters sent in on either the passed cursor or a new cursor
For more information on the execute command see: http://www.python.org/dev/peps/pep-0249/#id15
Parameters: - operation (string) – The operation being executed
- parameters (string or dictionary) – Sequence or map that wil be bound to variables in the operation
- cursor (cursor object) – A pre-existing cursor
-
execute_many
(operation, seq_of_parameters=None, cursor=None)[source]¶ Calls executemany with operation & parameters sent in on either the passed cursor or a new cursor
For more information on the execute command see: http://www.python.org/dev/peps/pep-0249/#executemany
Parameters: - operation (string) – The operation being executed
- seq_of_parameters (string or object) – The sequence or mappings that will be run against the operation
- cursor (cursor object) – A pre-existing cursor
-