b1diagnostics Class¶
-
class
bloxone.
b1diagnostics
(cfg_file='config.ini')[source]¶ Class to simplify access to the BloxOne Platform APIs
-
delete
(objpath, id='')[source]¶ Generic delete object wrapper for platform objects
Parameters: - objpath (str) – Swagger object path
- id (str) – Object id to delete
Returns: Requests response object
Return type: response object
-
download_task_results
(taskid)[source]¶ Get the results for specidied task
Parameters: taskid (str) – id of executed task Returns: Requests response object if id_only=False Return type: response object Note:
-
execute_task
(command, args={}, ophname=None, ophid=None, id_only=True, priv=False)[source]¶ Execute remote command on an OPH
Parameters: - cmd (str) – Command to execute
- args (dict) – Command arguments
- ophname (str) – Name of OPH to execute command on (or supply ophid)
- ophid (str) – (Optional) ophid of OPH for cmd execution
- id_only (bool) – default of True
- priv (bool) – Run privileged task, default of False
Returns: id string of task if id_only=True (defult) response object: Requests response object if id_only=False
Raises: - TypeError Exception if required options not supplied
- KeyErro Exception if ophname is not found (and ophid not supplied)
- Command_Not_Supported Exception if command is not valid
- Unknown_Argument Exception if arguments do not match required
Todo
[ ] Enhance logic to run /priviledgetask or /task Awaiting API enhancement to determine priv versus non-priv [ ] Enhance args check for required arguments Awaiting API enhancement for arg to determine required versus optional arguments
-
get
(objpath, id='', action='', **params)[source]¶ Generic get object wrapper for platform calls
Parameters: - objpath (str) – Swagger object path
- id (str) – Optional Object ID
- action (str) – Optional object action, e.g. “nextavailableip”
Returns: Requests response object
Return type: response object
-
get_args
(command)[source]¶ Check the args for a command
Parameters: command (str) – Command to retrieve argyments for Returns: Disctionary of arguments or empty dictionary if none. Raises: Command_Not_Supported Exception if command is not available
-
get_id
(objpath, *, key='', value='', include_path=False)[source]¶ Get object id using key/value pair
Parameters: - objpath (str) – Swagger object path
- key (str) – name of key to match
- value (str) – value to match
- include_path (bool) – Include path to object id
Returns: object id or “”
Return type: id (str)
-
get_remote_commands
()[source]¶ Get set of possible remote commands and parameters
Returns: Requests response object Return type: response object
-
get_task_result
(taskid)[source]¶ Get the results for specidied task
Parameters: taskid (str) – id of executed task Returns: Requests response object if id_only=False Return type: response object
-
is_command
(command)[source]¶ Check whether command is valid
Parameters: command (str) – command to check Returns: boolean
-