Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • CASE0:   Pulls ONOS code and builds ONOS.  This is usually skipped in the production environment for flexibility to handle testing different versions of ONOS
  • CASE1:   Sets up global test variables and removes existing instances of ONOS in the test cell
  • CASE2:   Reports errors, warnings, and exceptions in ONOS
  • CASE10: Starts ONOS on the cell
  • CASE11: Starts Mininet and assign mastership of switches to ONOS controllers
  • CASE12: Tests some basic ONOS commands using the ONOS cli handle
  • CASE22: Tests some basic ONOS commands using the REST API handle
  • CASE32: Configures fwd app and run pingall

Params File:

Below is the SAMPstartTemplate_1node.params file: 

code
Code Block
language
xml
<PARAMS>
      <!--
           CASE0: pull onos code - this case should be skipped on Jenkins-driven prod test
      -->
    <!--
    CASE1: setup and clean test env
      -->
    <!--
    CASE2: get onos warnings, errors from log
      -->
    <!--
    CASE10: start a 1-node ONOS
      -->
    <!--
    CASE11: Start Mininet and assign controllers
      -->
    <!--
    CASE12: Sample case of using onos cli
      -->
    <!--
    CASE22: Sample case of using onos rest
    -->
    <!--
    CASE32: Configure fwd app
    -->
 
     <testcases>0,1,10,11,12,22,2,32</testcases>
      <CASE0>
        <gitPull>False</gitPull> # False or True
        <gitBranch>master</gitBranch>
   <GIT>
        <pull>False</pull>
        <branch>master</branch>
    </GIT>

    <CASE0>
    </CASE0>

      <CASE1>
            <NodeList>OC1,OC2,OC3<<NodeList>OC1</NodeList>
            <SleepTimers>
                       <onosStartup>60</onosStartup>
                       <onosCfg>5</onosCfg>
                       <mnStartup>15</mnStartup>
                       <mnCfg>10</mnCfg>
            </SleepTimers>
      </CASE1>

      <CASE10>
            <numNodes>1</numNodes>
            <Apps>
                       org.onosproject.openflow,org.onosproject.fwd
            </Apps>
            <ONOS_Configuration>
                       <org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
                               <useFlowObjectives>true</useFlowObjectives>
                           <defaultFlowObjectiveCompiler>org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler</defaultFlowObjectiveCompiler>
            </org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
            </ONOS_Configuration>
      </CASE10>

      <CASE11>
            <path>~/OnosSystemTest/TestON/tests/SAMP/SAMPstartTemplate2_1node/Dependency/</path>
        <topo>newFuncTopo.py</topo>
    <topo> mn --topo tree,3,3 </topo>
    </CASE11>

      <CASE12>
      </CASE12>

      <CASE22>
      </CASE22>
 
    <CASE32>
    </CASE32>
</PARAMS>

...



The <testcases> tag defines the order in which the test cases in the .py file are executed. <PARAMS> and <testcases> are mandatory, case sensitive tags.

Topo File:

Below is the SAMPstartTemplate_1node.topo file:

Code Block

...

code
language
xml
<TOPOLOGY>
 
       <COMPONENT>
 
       <!--
               This is a list of all components and their handles in the test setup.
               Even with some handles not used in test cases, we want to define
               all onos cells here, for cases to set up onos cluster.
       -->
 
        <ONOSbench>
                   <ONOScell>
            <host>localhost</host>
             # ONOS "bench" machine
            <user>sdn</user>
                       <password>rocks</password>
            <type>OnosDriver<            <type>OnosClusterDriver</type>
                       <connect_order>1</connect_order>
            <COMPONENTS>
                           <home></home>   # #definesdefines where onos home is
            </COMPONENTS>
        </ONOSbench>
 
        <ONOScli1>
            <host>OC1</host>
            <user>sdn</user>
            <password>rocks</password>
            <type>OnosCliDriver</type>
            <connect_order>2</connect_order>
            <COMPONENTS>
            </COMPONENTS>
        </ONOScli1>
 
        <Mininet1>
            <host>OCN</host>
            <user>sdn</user>
            <password>rocks</password>
            <type>MininetCliDriver</type>
            <connect_order>5</connect_order>
            <COMPONENTS>
                on the build machine. Defaults to "~/onos/" if empty.
            <COMPONENTS>
                <cluster_name></cluster_name>  # Used as a prefix for cluster components. Defaults to 'ONOS'
                <diff_clihost></diff_clihost> # if it has different host other than localhost for CLI. True or empty. OC# will be used if True.
                <karaf_username></karaf_username>
                <karaf_password></karaf_password>
                <web_user></web_user>
                <web_pass></web_pass>
                <rest_port></rest_port>
                <prompt></prompt>
                <onos_home></onos_home>  # defines where onos home is on the target cell machine. Defaults to entry in "home" if empty.
                <nodes> 1 </nodes>  # number of nodes in the cluster
            </COMPONENTS>
        </ONOScell>

        <Mininet1>
            <host>OCN</host>
            <user>sdn</user>
            <password>rocks</password>
            <type>MininetCliDriver</type>
            <connect_order>2</connect_order>
            <COMPONENTS>
                <home>~/mininet/custom/</home>
            </COMPONENTS>
        </Mininet1>
 
        <ONOSrest1>
            <host>OC1</host>
            <port>8181</port>
            <user>onos</user>
            <password>rocks</password>
            <type>OnosRestDriver</type>
            <connect_order>6</connect_order>
            <COMPONENTS>
                           <prompt></prompt>
            </COMPONENTS>
               </ONOSrest1>Mininet1>
 
       </COMPONENT>
 
</TOPOLOGY>

...

The .topo file includes the login info of the machine that will run ONOS and Mininet. In this example, the test runs using two virtual machines with host IP, username, password, and driver that are defined for Mininet and ONOS components. The <connect_order> tag is the connection order that TestON will execute.  The <type> tag specifies which driver the component will use.  The <args> <connect_order> tag is required in the Mininet component even if no arguments exist. the connection order that TestON will execute.  In the .topo file, all tags are required, but driver specific tags may be reordered between the components tags.

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

Python File:

The .py file defines the test cases.  All of the TestON tests follow the PEP8 coding style.  Check out our built-in PEP8 code checker at /TestON/bin/codecheck

Test case results should be asserted at the end of the case using the TestON utilities class.  There are four types of assertions: "equals", "matches", "greater", and "lesser". Below is an example of "equals" assertion in case 10:

Code Block
languagepy
titleSAMPstartTemplate_1node.py snippet
.
main.step( "Start ONOS cluster with basic (drivers) app.")
onosClusterIPsstepResult = []
for n in range( 1, numNodes + 1 ):
    handle = "main.ONOScli" + str( n )
    onosClusterIPs.append( eval( handle ).ip_address )

stepResult = main.ONOSbench.startBasicONOS(nodeList = onosClusterIPs, opSleep = 200 main.ONOSbench.startBasicONOS( nodeList=main.Cluster.getIps(),
                                            opSleep=200,
                                            onosUser=main.ONOScell.karafUser )
utilities.assert_equals( expect=main.TRUE,
                         actual=stepResult,
                         onpass                         actual=stepResult,
                         onpass="Successfully started basic ONOS cluster ",
                         onfail                         onfail="Failed to start basic ONOS Cluster " )

Log and Report Files

There are two ways to specify the log directory path:

...