Merge "Added Case32 and updated SAMPstartTemplate"
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index b38e257..1209571 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -126,7 +126,7 @@
             Starts Mininet accepts a topology(.py) file and/or an optional
             argument, to start the mininet, as a parameter.
             Can also send regular mininet command to load up desired topology.
-            Eg. Pass in a string 'sudo mn --topo=tree,3,3' to mnCmd
+            Eg. Pass in a string 'mn --topo=tree,3,3' to mnCmd
         Options:
             topoFile = file path for topology file (.py)
             args = extra option added when starting the topology from the file
diff --git a/TestON/tests/SAMP/SAMPstartTemplate2_1node/Dependency/newFuncTopo.py b/TestON/tests/SAMP/SAMPstartTemplate_1node/Dependency/newFuncTopo.py
similarity index 100%
rename from TestON/tests/SAMP/SAMPstartTemplate2_1node/Dependency/newFuncTopo.py
rename to TestON/tests/SAMP/SAMPstartTemplate_1node/Dependency/newFuncTopo.py
diff --git a/TestON/tests/SAMP/SAMPstartTemplate2_1node/README b/TestON/tests/SAMP/SAMPstartTemplate_1node/README
similarity index 100%
rename from TestON/tests/SAMP/SAMPstartTemplate2_1node/README
rename to TestON/tests/SAMP/SAMPstartTemplate_1node/README
diff --git a/TestON/tests/SAMP/SAMPstartTemplate2_1node/SAMPstartTemplate2_1node.params b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params
similarity index 74%
rename from TestON/tests/SAMP/SAMPstartTemplate2_1node/SAMPstartTemplate2_1node.params
rename to TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params
index 1bed38d..ef2a46a 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate2_1node/SAMPstartTemplate2_1node.params
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params
@@ -20,8 +20,11 @@
     <!--
         CASE22: Sample case of using onos rest
     -->
+    <!--
+        CASE32: Configure fwd app
+    -->
 
-    <testcases>0,1,10,11,12,22,2</testcases>
+    <testcases>0,1,10,11,12,22,2,32</testcases>
 
     <CASE0>
         <gitPull>False</gitPull> # False or True
@@ -44,21 +47,19 @@
             org.onosproject.openflow,org.onosproject.fwd
         </Apps>
         <ONOS_Configuration>
-        <org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
-            <useFlowObjectives>true</useFlowObjectives>
-        </org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
+            <org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
+                <useFlowObjectives>true</useFlowObjectives>
+            </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>
diff --git a/TestON/tests/SAMP/SAMPstartTemplate2_1node/SAMPstartTemplate2_1node.py b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
similarity index 86%
rename from TestON/tests/SAMP/SAMPstartTemplate2_1node/SAMPstartTemplate2_1node.py
rename to TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
index befa623..23bfc09 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate2_1node/SAMPstartTemplate2_1node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
@@ -2,7 +2,7 @@
 # This is a sample template that starts up ONOS cluster, this template
 # can be use as a base script for ONOS System Testing.
 
-class SAMPstartTemplate2_1node:
+class SAMPstartTemplate_1node:
 
     def __init__( self ):
         self.default = ''
@@ -10,7 +10,7 @@
 
     def CASE0(self, main):
         '''
-            Pull specific ONOS branch, then Build ONOS ono ONOS Bench.
+            Pull specific ONOS branch, then Build ONOS on ONOS Bench.
             This step is usually skipped. Because in a Jenkins driven automated
             test env. We want Jenkins jobs to pull&build for flexibility to handle
             different versions of ONOS.
@@ -105,7 +105,7 @@
 
     def CASE10( self, main ):
         """
-        Start ONOS cluster (3 nodes in this example) in three steps:
+        Start ONOS cluster (1 node in this example) in three steps:
         1) start a basic cluster with drivers app via ONOSDriver;
         2) activate apps via ONOSCliDriver;
         3) configure onos via ONOSCliDriver;
@@ -178,13 +178,12 @@
         """
         import time
 
-        dependencyPath = main.params['CASE11']['path']
         topology = main.params['CASE11']['topo']
         main.log.report( "Start Mininet topology" )
         main.log.case( "Start Mininet topology" )
 
         main.step( "Starting Mininet Topology" )
-        topoResult = main.Mininet1.startNet( topoFile=dependencyPath + topology )
+        topoResult = main.Mininet1.startNet( mnCmd=topology )
         stepResult = topoResult
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -225,4 +224,26 @@
 
         main.case( " Sample tests using ONOS REST API handles. ")
         main.log.debug( main.ONOSrest1.send("/devices") )
-        main.log.debug( main.ONOSrest1.apps() )
\ No newline at end of file
+        main.log.debug( main.ONOSrest1.apps() )
+
+    def CASE32( self, main ):
+        """
+            Configure fwd app from .param json string with parameter configured.
+            Check if configuration successful
+            Run pingall to check connectivity
+            Check ONOS log for warning/error/exceptions
+        """
+        main.case( "Configure onos-app-fwd and check if configuration successful. " )
+        main.step( "Install reactive forwarding app." )
+        installResults = main.ONOScli1.activateApp( "org.onosproject.fwd" )
+        utilities.assert_equals( expect=main.TRUE, actual=installResults,
+                                 onpass = "Configure fwd successful", onfail="Configure fwd failed" )
+        main.step( "Run pingall to check connectivity. " )
+        pingResult = main.FALSE
+        passMsg = "Reactive Pingall test passed"
+        pingResult = main.Mininet1.pingall()
+        if not pingResult:
+           main.log.warn( "First pingall failed. Trying again..." )
+           pingResult = main.Mininet1.pingall()
+           passMsg += "on the second try"
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult, onpass=passMsg, onfail= "Reactive Pingall failed, " + "one or more ping pairs failed." )
diff --git a/TestON/tests/SAMP/SAMPstartTemplate2_1node/SAMPstartTemplate2_1node.topo b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo
similarity index 100%
rename from TestON/tests/SAMP/SAMPstartTemplate2_1node/SAMPstartTemplate2_1node.topo
rename to TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo
diff --git a/TestON/tests/SAMP/SAMPstartTemplate2_1node/__init__.py b/TestON/tests/SAMP/SAMPstartTemplate_1node/__init__.py
similarity index 100%
rename from TestON/tests/SAMP/SAMPstartTemplate2_1node/__init__.py
rename to TestON/tests/SAMP/SAMPstartTemplate_1node/__init__.py
diff --git a/TestON/tests/SAMP/SAMPstartTemplate2_3node/Dependency/newFuncTopo.py b/TestON/tests/SAMP/SAMPstartTemplate_3node/Dependency/newFuncTopo.py
similarity index 100%
rename from TestON/tests/SAMP/SAMPstartTemplate2_3node/Dependency/newFuncTopo.py
rename to TestON/tests/SAMP/SAMPstartTemplate_3node/Dependency/newFuncTopo.py
diff --git a/TestON/tests/SAMP/SAMPstartTemplate2_3node/README b/TestON/tests/SAMP/SAMPstartTemplate_3node/README
similarity index 100%
rename from TestON/tests/SAMP/SAMPstartTemplate2_3node/README
rename to TestON/tests/SAMP/SAMPstartTemplate_3node/README
diff --git a/TestON/tests/SAMP/SAMPstartTemplate2_3node/SAMPstartTemplate2_3node.params b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.params
similarity index 88%
rename from TestON/tests/SAMP/SAMPstartTemplate2_3node/SAMPstartTemplate2_3node.params
rename to TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.params
index 41fedd0..1b3ef33 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate2_3node/SAMPstartTemplate2_3node.params
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.params
@@ -20,8 +20,11 @@
     <!--
         CASE22: Sample case of using onos rest
     -->
+   <!--
+        CASE32: Configure fwd apps
+   -->
 
-    <testcases>0,1,10,11,12,22,2</testcases>
+    <testcases>0,1,10,11,12,22,2,32</testcases>
 
     <CASE0>
         <gitPull>False</gitPull> # False or True
@@ -51,14 +54,13 @@
     </CASE10>
 
     <CASE11>
-        <path>~/OnosSystemTest/TestON/tests/SAMP/SAMPstartTemplate2_3node/Dependency/</path>
-        <topo>newFuncTopo.py</topo>
+         <topo> mn --topo tree,3,3</topo>
     </CASE11>
 
     <CASE12>
     </CASE12>
-
     <CASE22>
     </CASE22>
-
+    <CASE32>
+    </CASE32>
 </PARAMS>
diff --git a/TestON/tests/SAMP/SAMPstartTemplate2_3node/SAMPstartTemplate2_3node.py b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
similarity index 87%
rename from TestON/tests/SAMP/SAMPstartTemplate2_3node/SAMPstartTemplate2_3node.py
rename to TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
index 49b72b5..592c8b2 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate2_3node/SAMPstartTemplate2_3node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
@@ -2,7 +2,7 @@
 # This is a sample template that starts up ONOS cluster, this template
 # can be use as a base script for ONOS System Testing.
 
-class SAMPstartTemplate2_3node:
+class SAMPstartTemplate_3node:
 
     def __init__( self ):
         self.default = ''
@@ -10,7 +10,7 @@
 
     def CASE0(self, main):
         '''
-            Pull specific ONOS branch, then Build ONOS ono ONOS Bench.
+            Pull specific ONOS branch, then Build ONOS on ONOS Bench.
             This step is usually skipped. Because in a Jenkins driven automated
             test env. We want Jenkins jobs to pull&build for flexibility to handle
             different versions of ONOS.
@@ -178,13 +178,12 @@
         """
         import time
 
-        dependencyPath = main.params['CASE11']['path']
         topology = main.params['CASE11']['topo']
         main.log.report( "Start Mininet topology" )
         main.log.case( "Start Mininet topology" )
 
         main.step( "Starting Mininet Topology" )
-        topoResult = main.Mininet1.startNet( topoFile=dependencyPath + topology )
+        topoResult = main.Mininet1.startNet(mnCmd=topology )
         stepResult = topoResult
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -226,3 +225,25 @@
         main.case( " Sample tests using ONOS REST API handles. ")
         main.log.debug( main.ONOSrest1.send("/devices") )
         main.log.debug( main.ONOSrest2.apps() )
+
+    def CASE32( self, main ):
+        """
+            Configure fwd app from .params json string with parameter configured
+            Check if configuration successful
+            Run pingall to check connectivity
+            Check ONOS log for warning/error/exceptions
+        """
+        main.case( "Configure onos-app-fwd and check if configuration successful. " )
+        main.step( "Install reactive forwarding app." )
+        installResults = main.ONOScli1.activateApp( "org.onosproject.fwd" )
+        utilities.assert_equals( expect=main.TRUE, actual=installResults,
+                                 onpass= "Configure fwd successful", onfail= "Configure fwd failed" )
+        main.step( "Run pingall to check connectivity. " )
+        pingResult = main.FALSE
+        passMsg = "Reactive Pingall test passed"
+        pingResult = main.Mininet1.pingall()
+        if not pingResult:
+           main.log.warn("First pingall failed. Trying again...")
+           pingResult = main.Mininet1.pingall()
+           passMsg += "on the second try"
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult, onpass=passMsg, onfail= "Reactive Pingall failed, " + "one or more ping pairs failed" )
diff --git a/TestON/tests/SAMP/SAMPstartTemplate2_3node/SAMPstartTemplate2_3node.topo b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo
similarity index 100%
rename from TestON/tests/SAMP/SAMPstartTemplate2_3node/SAMPstartTemplate2_3node.topo
rename to TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo
diff --git a/TestON/tests/SAMP/SAMPstartTemplate2_3node/__init__.py b/TestON/tests/SAMP/SAMPstartTemplate_3node/__init__.py
similarity index 100%
rename from TestON/tests/SAMP/SAMPstartTemplate2_3node/__init__.py
rename to TestON/tests/SAMP/SAMPstartTemplate_3node/__init__.py
diff --git a/TestON/tests/__init__.py b/TestON/tests/__init__.py
index e69de29..8b13789 100644
--- a/TestON/tests/__init__.py
+++ b/TestON/tests/__init__.py
@@ -0,0 +1 @@
+