Have questions? Stuck? Please check our FAQ for some common questions and answers.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Test files

You can see test files in the /TestON/tests/ folder. The name of the test folder should be the name of the test as well as all the files. Each of the tests has a unique set of files defined below:

.params - This file contains user defined variables for the test case. Also specify the order of which test cases to run.

.topo - This file defines all the components and options that Test-ON will use to execute its test. The machine's user name, password, IP addresses, drivers, and/or Mininet's topology would be specified in this file. ( Please use the exact syntax/format in the topo file. The space character in the xml tags is important even though you are not defining anything in the tag Eg. <COMPONENTS> </COMPONENTS>)

.py - This is where all of the test cases are written. It calls upon functions implemented in the respective drivers to create a progression of events that produces some sort of pass/fail outcome.

PingallExample test

This test uses pingall function to ping all the host in the network. The test is successful if all the hosts are reachable.

  • CASE1: Starts up ONOS, from pulling the latest code to running ONOS, also starts a Mininet topology from the .topo file. Reports success if ONOS did not start up correctly.
  • CASE2: Assign mastership to controller. Reports success if all the switches are assigned to a controller.
  • CASE3: Installs onos-app-fwd (reactive forwarding app) and does pingall. Reports success if all hosts are reachable.

Params File

Below is the PingallExample.params file:

<PARAMS>
    <testcases>1,2,3</testcases>
    <ENV>
        <cellName>HA</cellName>
    </ENV>
    <Git>True</Git>

    <CTRL>
        <ip1>10.128.30.11</ip1>
        <port1>6633</port1>
    </CTRL>
</PARAMS>

The <testcases> tag defines the order in which the test cases in the .py file are executed. The <cellName> is the name of the cell when setting up your environment.

Topo File

Below is the PingallExample.topo file:

 

<TOPOLOGY>
    <COMPONENT>

        <ONOSbench>
            <host>10.128.30.10</host>
            <user>admin</user>
            <password> </password>
            <type>OnosDriver</type>
            <connect_order>1</connect_order>
            <COMPONENTS> </COMPONENTS>
        </ONOSbench>

        <ONOScli1>
            <host>10.128.30.10</host>
            <user>admin</user>
            <password> </password>
            <type>OnosCliDriver</type>
            <connect_order>2</connect_order>
            <COMPONENTS> </COMPONENTS>
        </ONOScli1>

        <ONOS1>
            <host>10.128.30.11</host>
            <user>sdn</user>
            <password>rocks</password>
            <type>OnosDriver</type>
            <connect_order>3</connect_order>
            <COMPONENTS> </COMPONENTS>
        </ONOS1>

        <Mininet1>
            <host>10.128.30.9</host>
            <user>admin</user>
            <password> </password>
            <type>MininetCliDriver</type>
            <connect_order>4</connect_order>
            <COMPONENTS>
                #Specify the Option for mininet
                <arg1> --topo=tree,3,3 </arg1>
                <arg2> </arg2>
                <arg3> </arg3>
                <controller> remote </controller>
            </COMPONENTS>
        </Mininet1>

    </COMPONENT>
</TOPOLOGY>

The .topo file includes the log in info of the machine that the ONOS and Mininet will be run. In this example, the test runs using two VM machine with host IP, user name , password as well as the driver that will be used are defined for each of the component. The <connect_order> tag is the connection order that the TestON will execute. The formatting of the .topo file must be followed correctly. The space character inside every empty tag indicates that a blank information will be passed along in the component otherwise the test would give an error , if that space character isn't there, and would stop the test. The <type> tag is use to specify which driver the component will use. The <args> tag in the MIninet component is necessary and should be kept even though have empty arguments.

NOTE: It is important to check the log in info carefully for each component as incorrect information would result to test failure.

Python file

The python file defines all the test cases for the test. In the PingallExample and every other test in TestON, a utility class is called to assert each cases by the end of the case. Although not required, It is a good practice to follow a coding style in to your test scripts to improved readability of your code. Check out our built in code checker using pep8 coding style at /TestON/bin/codecheck. All of the TestON test follow the pep8 coding style.

Logs and report files

Three ways to specify the log directory path:

  1. Default path will be the /logs/test_name_time/
  2. Providing the command line option --logdir "/path/to/logdirectory"
  3. Parameterise in the test_name.params file as 'logdir' = '/path/to/logdirectory'

After execution of the test, there will be three types of logs:

  1. test_name_time.log - Detailed verbose log of everythin that the script does.
  2. test_name_time.rpt - Summary report of test case results.
  3. component_name.SESSION - Log of all commands/APIs run on this component with response.

Exploring Further

Now that you created your test cases, you can now improve your test by modifying the current TestON drivers or create your own test specific drivers. Check TestON Drivers for more information.

 

 

 

  • No labels