DeclareOnce
epCfgFileName
=
`MyConfig`
;Configuration file name
Declare
Status
,
tclHandler
; Correct to your installation path
Declare
TclPath
=
"c:\Program Files (x86)\Spirent Communications\Spirent TestCenter 4.20\TCL\bin\tcl85.dll"
; Init TCL and load STC package
TCL_Create
tclHandler
,
TclPath
,
1
,
1
,
'TCL'
; Open session log file
OpenLogFile
'c:\temp\stc_log.txt'
,
1
; Initialize stc package
TCL_Eval
Status
,
tclHandler
,
'package require SpirentTestCenter'
GoSub
'
CheckForErrors
'
,
Status
; if the config is .xml format then use
TCL_Eval
Status
,
tclHandler
,
'stc::perform LoadFromXml -Filename '
$
epCfgFileName
$
'.xml'
GoSub
'
CheckForErrors
'
,
Status
; if the configurtion is .tcc format then
TCL_Eval
Status
,
tclHandler
,
'stc::perform LoadFromDatabaseCommand -DatabaseConnectionString '
$
epCfgFileName
$
'.tcc'
GoSub
'
CheckForErrors
'
,
Status
TCL_Eval
Status
,
tclHandler
,
'stc::apply'
GoSub
'
CheckForErrors
'
,
Status
; Put here more commands in TCL to start traffic and get statistics
;TCL_Eval Status, tclHandler, '.......'
; Close TCL interpreter and release resources
TCL_Delete
tclHandler
; Close session log file
CloseLogFile
End
;-------------------------------------------
; Error check sub-routine
<CheckForErrors>
i_Msg
Declare
Offset
StrSearch
Offset
,
i_Msg
,
`error`
,
0
,
1
; Check for errors
If
Offset
!=
(-
1
)
Then
PrintMessage
i_Msg
Abort
i_Msg
EndIf
PrintMessage
i_Msg
Return