Python Api
IE10.1
|
Classes | |
class | PluginError |
plugin error code More... | |
class | Thread |
Wrapper class of threading.Thread for pluginfw If we need use multi-threads in plugin, we need copy the context to new thread. More... | |
Functions | |
def | GetOpUserId () |
get the operation user id. More... | |
def | GetOpUserName () |
get the operation user name. More... | |
def | GetTaskId () |
get the worker task id. More... | |
def | GetAPIContext () |
Get Context Object Pointer in FW Worker, this Context Object is local in thread. More... | |
def | SetAPIContext (contextAddr) |
This method will clone one Context Object in new thread. More... | |
def | ReleaseAPIContext () |
set the plugin API context to null. More... | |
def | AddLog (content, logType=INFO) |
Add logs to plugin exction. More... | |
def | GetExcutionLogs () |
get excution log in current task. More... | |
def | IsUserStopped () |
Test if the task has canceled by user. More... | |
def | SetError (errorCode, errorMsg) |
Set the error message and error code. More... | |
def | GetRunParam () |
Get the plugin running params. More... | |
def | GetXfTaskId () |
Get the xf task id of plugin schedluler(benchmrak task id,discover task id,schedule plugin task id) More... | |
def | GetTaskSourceType () |
Get the xf task source type. More... | |
def | GetTaskSourceId () |
get the task source id,it is the Id of benchmarkdefine or shceduleplugin More... | |
def | GetTaskTargetDevices () |
Get target devices of current task,work only if current task type is Benchmark,otherwise return empty list. More... | |
def | GetTaskAPIServerIDList () |
Get sdn scope range of current task,work only if current task type is Benchmark,otherwise return empty list. More... | |
def | GetQualifyDeviceIds () |
Variables | |
int | DEBUG = 0 |
debug log level More... | |
int | INFO = 1 |
info log level More... | |
int | WARNING = 2 |
waring log level More... | |
int | ERROR = 3 |
error log level More... | |
def netbrain.sysapi.pluginfw.AddLog | ( | content, | |
logType = INFO |
|||
) |
Add logs to plugin exction.
content | (string) content of log. |
logType | (string) log level. |
def netbrain.sysapi.pluginfw.GetAPIContext | ( | ) |
Get Context Object Pointer in FW Worker, this Context Object is local in thread.
If we need use multi-threads in plugin, we need use this method in C++ Thread and use SetAPIContext in Python Thread before call any C++ API.
sample code:
def netbrain.sysapi.pluginfw.GetExcutionLogs | ( | ) |
get excution log in current task.
def netbrain.sysapi.pluginfw.GetOpUserId | ( | ) |
get the operation user id.
def netbrain.sysapi.pluginfw.GetOpUserName | ( | ) |
get the operation user name.
def netbrain.sysapi.pluginfw.GetQualifyDeviceIds | ( | ) |
def netbrain.sysapi.pluginfw.GetRunParam | ( | ) |
Get the plugin running params.
def netbrain.sysapi.pluginfw.GetTaskAPIServerIDList | ( | ) |
Get sdn scope range of current task,work only if current task type is Benchmark,otherwise return empty list.
def netbrain.sysapi.pluginfw.GetTaskId | ( | ) |
get the worker task id.
def netbrain.sysapi.pluginfw.GetTaskSourceId | ( | ) |
get the task source id,it is the Id of benchmarkdefine or shceduleplugin
def netbrain.sysapi.pluginfw.GetTaskSourceType | ( | ) |
Get the xf task source type.
def netbrain.sysapi.pluginfw.GetTaskTargetDevices | ( | ) |
Get target devices of current task,work only if current task type is Benchmark,otherwise return empty list.
def netbrain.sysapi.pluginfw.GetXfTaskId | ( | ) |
Get the xf task id of plugin schedluler(benchmrak task id,discover task id,schedule plugin task id)
def netbrain.sysapi.pluginfw.IsUserStopped | ( | ) |
Test if the task has canceled by user.
if we check it is true in plugin,we should End the script as soon as possible. otherwise,it maybe kill by xfagent.
def netbrain.sysapi.pluginfw.ReleaseAPIContext | ( | ) |
set the plugin API context to null.
def netbrain.sysapi.pluginfw.SetAPIContext | ( | contextAddr | ) |
This method will clone one Context Object in new thread.
Only first call will do clone, more calls will do nothing
contextAddr | (C++ pointer)address of plugin API context,is get from C++ Api by call GetAPIContext |
def netbrain.sysapi.pluginfw.SetError | ( | errorCode, | |
errorMsg | |||
) |
Set the error message and error code.
errorCode | (int) error code |
errorMsg | (string) error message |
int netbrain.sysapi.pluginfw.DEBUG = 0 |
debug log level
int netbrain.sysapi.pluginfw.ERROR = 3 |
error log level
int netbrain.sysapi.pluginfw.INFO = 1 |
info log level
int netbrain.sysapi.pluginfw.WARNING = 2 |
waring log level