STC is a developer oriented framework for testing and debugging running ONOS clusters. It allows modular definition and composition of test scenarios, as well as reuse of test modules. Developers can use scenarios in a semi-automated or fully automated manner. STC tracks dependencies between scenarios and allows parallel execution of steps that don't depend on each other to improve performance and to allow modeling concurrent activities like running a step on each node in a cluster. Larger scenarios can be built up from smaller scenarios allowing reuse of tests. STC is integrated into the cell framework and can be used to deploy and test on a cell.
STC comes with a set of predefined scenarios designed to test specific ONOS behavior. The most commonly used scenarios are:
STC is run from a command line shell. If you have a properly configured development environment and cell, stc will run the tests for you and display the results of the test run. Here is an example of how to run the fast smoke test on a cell with one controller and one mininet node.
STC will report failures by displaying a red line of text for the step that failed. If the environment variable stcHaltOnError is set to true, execution stops on the first error that is encountered. If this variable is undefined or set to some other value, execution continues as long as there are scenarios remaining that don't depend on failed steps. This behavior is useful for the clean up portion of scenarios. Here is an example of a failed STC run:
We can tell from this output that the Check-Passwordless-Login-1 step failed. Looking back in the output stream, if we look at the started message for that step, we can see that at the time of the failure, STC was running the command `ssh -n -o ConnectTimeout=3 -o PasswordAuthentication=no firstname.lastname@example.org date'. There are two ways we can diagnose this problem. Any time there is an error, you can always rerun the failed step by simply rerunning the command from the command line:
The output of the command is getting a timeout error, in this case because there is no cell set up on the given IP address. Another way to diagnose a failure is to look at the log files generated by execution of the command. STC keeps the log of each step as it executes, and you can retrieve the log using the stl command. stl takes the scenario name and the step name as arguments. Both arguments can be filled in using tab completion. In the case of previous error, since the test being run was smoke and the step was Check-Passwordless-Login-1, the command to fetch the log file is 'stl smoke Check-Passwordless-Login-1.log'. It shows us the output of the failing command:
If you want to learn more about STC, you can refer to the STC Advanced Topics page to find out more about STC internals, or the Developing Your Own STC Test to find out how to write a test scenario. You can also consult the STC Reference Guide for detailed descriptions of each STC entity.
Not interested in smoke testing? Looking for basic STC scripts to deploy ONOS target machines and your Mininet topology ? You can find info at this page.