summaryrefslogtreecommitdiffstats
path: root/tests/lib/inspector
diff options
context:
space:
mode:
authorwenjuan dong <dong.wenjuan@zte.com.cn>2016-12-22 03:37:38 +0000
committerGerrit Code Review <gerrit@opnfv.org>2016-12-22 03:37:38 +0000
commitbb5fd848c7bee3bf2d0d43a143f613076211ff07 (patch)
treec1bbac3b9521e89baf6c75d98d191da5b443361e /tests/lib/inspector
parent0207bbf49f8814caacbf151e1b71657d2d3276ab (diff)
parent18651c07b942abf0060e6478758050dd365619eb (diff)
Merge "Refactor inspectors support code"
Diffstat (limited to 'tests/lib/inspector')
-rw-r--r--tests/lib/inspector30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/lib/inspector b/tests/lib/inspector
new file mode 100644
index 00000000..2fb7c409
--- /dev/null
+++ b/tests/lib/inspector
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+INSPECTOR_TYPE=${INSPECTOR_TYPE:-sample}
+
+function is_inspector_supported {
+ local inspector="$1"
+ [[ -f $TOP_DIR/lib/inspectors/$inspector ]]
+}
+
+function is_inspector {
+ local inspector="$1"
+ [[ $inspector == $INSPECTOR_TYPE ]]
+}
+
+function start_inspector {
+ if ! is_inspector_supported $INSPECTOR_TYPE; then
+ die $LINENO"INSPECTOR_TYPE=$INSPECTOR_TYPE is not supported."
+ fi
+
+ source $TOP_DIR/lib/inspectors/$INSPECTOR_TYPE
+ start_inspector_$INSPECTOR_TYPE
+}
+
+function stop_inspector {
+ stop_inspector_$INSPECTOR_TYPE
+}
+
+function cleanup_inspector {
+ cleanup_inspector_$INSPECTOR_TYPE
+}