Merge "ONOS-2392 SCPFscaleTopo move to production"
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index e4dbf9d..3b89282 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -35,6 +35,7 @@
 import threading
 module = new.module("test")
 import openspeak
+import subprocess
 global path, drivers_path, core_path, tests_path,logs_path
 path = re.sub("(core|bin)$", "", os.getcwd())
 drivers_path = path+"drivers/"
@@ -167,6 +168,9 @@
         driverClass = getattr(driverModule, driverName)
         driverObject = driverClass()
 
+        if ( "OCN" in self.componentDictionary[component]['host'] and main.onoscell ):
+            self.componentDictionary[component]['host'] = main.mnIP
+
         connect_result = driverObject.connect(user_name = self.componentDictionary[component]['user'] if ('user' in self.componentDictionary[component].keys()) else getpass.getuser(),
                                               ip_address= self.componentDictionary[component]['host'] if ('host' in self.componentDictionary[component].keys()) else 'localhost',
                                               pwd = self.componentDictionary[component]['password'] if ('password' in self.componentDictionary[component].keys()) else 'changeme',
@@ -683,9 +687,22 @@
             sys.exit()
 
 def verifyOnosCell(options):
-    # Verifying onoscell option. This could be extended to do even more from here.
+    # Verifying onoscell option
     if options.onoscell:
         main.onoscell = options.onoscell
+        main.onosIPs = []
+        main.mnIP = ""
+        cellCMD = ". ~/.profile; cell "+main.onoscell
+        output=subprocess.check_output( ["bash", '-c', cellCMD] )
+        splitOutput = output.splitlines()
+        for i in range( len(splitOutput) ):
+            if( re.match( "OCN", splitOutput[i] ) ):
+                mnNode=splitOutput[i].split("=")
+                main.mnIP = mnNode[1]
+            # cell already sorts OC variables in bash, so no need to sort in TestON
+            if( re.match( "OC[1-9]", splitOutput[i] ) ):
+                onosNodes = splitOutput[i].split("=")
+                main.onosIPs.append( onosNodes[1] )
     else :
         main.onoscell = main.FALSE
 
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 5e82465..3337ea4 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -938,43 +938,141 @@
             main.exit()
         return response
 
-    def iperf( self, host1, host2 ):
-        main.log.info(
-            self.name +
-            ": Simple iperf TCP test between two hosts" )
-        try:
-            cmd1 = 'iperf ' + host1 + " " + host2
-            self.handle.sendline( cmd1 )
-            self.handle.expect( "mininet>" )
-            response = self.handle.before
-            if re.search( 'Results:', response ):
-                main.log.info( self.name + ": iperf test successful" )
+    def iperftcpAll(self, hosts, timeout=6):
+    '''
+    Runs the iperftcp function with a given set of hosts and specified timeout.
+
+    @parm:
+        timeout: The defualt timeout is 6 sec to allow enough time for a successful test to complete,
+         and short enough to stop an unsuccessful test from quiting and cleaning up mininet.
+    '''
+    for host1 in hosts:
+        for host2 in hosts:
+            if host1 != host2:
+                if self.iperftcp(host1, host2, timeout) == main.FALSE:
+                    main.log.error(self.name + ": iperftcp test failed for " + host1 + " and " + host2)
+
+    def iperftcp(self, host1="h1", host2="h2", timeout=6):
+    '''
+    Creates an iperf TCP test between two hosts. Returns main.TRUE if test results
+    are valid.
+
+    @parm:
+        timeout: The defualt timeout is 6 sec to allow enough time for a successful test to complete,
+         and short enough to stop an unsuccessful test from quiting and cleaning up mininet.
+    '''
+    main.log.info( self.name + ": Simple iperf TCP test between two hosts" )
+    try:
+        # Setup the mininet command
+        cmd1 = 'iperf ' + host1 + " " + host2
+        self.handle.sendline( cmd1 )
+        outcome = self.handle.expect( "mininet>", timeout )
+        response = self.handle.before
+
+        # checks if there are results in the mininet response
+        if "Results:" in response:
+            main.log.report(self.name +  ": iperf test completed")
+            # parse the mn results
+            response = response.split("\r\n")
+            response = response[len(response)-2]
+            response = response.split(": ")
+            response = response[len(response)-1]
+            response = response.replace("[", "")
+            response = response.replace("]", "")
+            response = response.replace("\'", "")
+
+            # this is the bandwith two and from the two hosts
+            bandwidth = response.split(", ")
+
+            # there should be two elements in the bandwidth list
+            # ['host1 to host2', 'host2 to host1"]
+            if len(bandwidth) == 2:
+                main.log.report(self.name + ": iperf test successful")
                 return main.TRUE
             else:
-                main.log.error( self.name + ": iperf test failed" )
+                main.log.error(self.name + ": invalid iperf results")
                 return main.FALSE
-        except pexpect.EOF:
-            main.log.error( self.name + ": EOF exception found" )
-            main.log.error( self.name + ":     " + self.handle.before )
-            main.cleanup()
-            main.exit()
+        else:
+            main.log.error( self.name + ": iperf test failed" )
+            return main.FALSE
 
-    def iperfudp( self ):
-        main.log.info(
-            self.name +
-            ": Simple iperf TCP test between two " +
-            "(optionally specified) hosts" )
-        try:
-            response = self.execute(
-                cmd='iperfudp',
-                prompt='mininet>',
-                timeout=10 )
+        except pexpect.TIMEOUT:
+            main.log.error( self.name + ": TIMEOUT exception found")
+            main.log.error( self.name + ": Exception: Cannot connect to iperf on port 5001" )
+            return main.FALSE
+
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
-            main.exit()
-        return response
+            main.exit() 
+
+    def iperfudpAll(self, hosts, bandwidth="10M"):
+        '''
+        Runs the iperfudp function with a given set of hosts and specified
+        bandwidth
+        
+        @param:
+            bandwidth: the targeted bandwidth, in megabits ('M')
+        '''
+        for host1 in hosts:
+            for host2 in hosts:
+                if host1 != host2:
+                    if self.iperfudp(host1, host2, bandwidth) == main.FALSE:
+                        main.log.error(self.name + ": iperfudp test failed for " + host1 + " and " + host2)
+
+    def iperfudp( self, bandwidth="10M", host1="h1", host2="h2"):
+
+    '''
+    Creates an iperf UDP test with a specific bandwidth.
+    Returns true if results are valid.
+
+    @param:
+        bandwidth: the targeted bandwidth, in megabits ('M'), to run the test
+    '''
+    main.log.info(self.name + ": Simple iperf UDP test between two hosts")
+    try:
+        # setup the mininet command
+        cmd = 'iperfudp ' + bandwidth + " " + host1 + " " + host2
+        self.handle.sendline(cmd)
+        self.handle.expect("mininet>")
+        response = self.handle.before
+
+        # check if there are in results in the mininet response
+        if "Results:" in response:
+            main.log.report(self.name +  ": iperfudp test completed")
+            # parse the results
+            response = response.split("\r\n")
+            response = response[len(response)-2]
+            response = response.split(": ")
+            response = response[len(response)-1]
+            response = response.replace("[", "")
+            response = response.replace("]", "")
+            response = response.replace("\'", "")
+
+            mnBandwidth = response.split(", ")
+
+            # check to see if there are at least three entries
+            # ['bandwidth', 'host1 to host2', 'host2 to host1']
+            if len(mnBandwidth) == 3:
+                # if one entry is blank then something is wrong
+                for item in mnBandwidth:
+                    if item == "":
+                        main.log.error(self.name + ": Could not parse iperf output")
+                        main.log.error(self.name + ": invalid iperfudp results")
+                        return main.FALSE
+                # otherwise results are vaild
+                main.log.report(self.name + ": iperfudp test successful")
+                return main.TRUE
+            else:
+                main.log.error(self.name + ": invalid iperfudp results")
+                return main.FALSE
+
+    except pexpect.EOF:
+        main.log.error( self.name + ": EOF exception found" )
+        main.log.error( self.name + ":     " + self.handle.before )
+        main.cleanup()
+        main.exit()
 
     def nodes( self ):
         main.log.info( self.name + ": List all nodes." )
@@ -1795,7 +1893,10 @@
         """
         # Regex patterns to parse dump output
         # Example host: <Host h1: h1-eth0:10.0.0.1 pid=5227>
-        #            or <Host h1:  pid=12725>
+        #               <Host h1:  pid=12725>
+        #               <VLANHost h12: h12-eth0.100.100.100:100.1.0.3 pid=30186>
+        #               <dualStackHost h19: h19-eth0:10.1.0.9 pid=30200>
+        #               <IPv6Host h18: h18-eth0:10.0.0.18 pid=30198>
         # NOTE: Does not correctly match hosts with multi-links
         #       <Host h2: h2-eth0:10.0.0.2,h2-eth1:10.0.1.2 pid=14386>
         # FIXME: Fix that
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 37d55fe..e602a71 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -18,6 +18,7 @@
 """
 import sys
 import time
+import types
 import pexpect
 import os
 import os.path
@@ -58,26 +59,36 @@
 
             self.name = self.options[ 'name' ]
 
+            # The 'nodes' tag is optional and it is not required in .topo file
             for key in self.options:
                 if key == "nodes":
-                    # Maximum number of ONOS nodes to run
+                    # Maximum number of ONOS nodes to run, if there is any
                     self.maxNodes = int( self.options[ 'nodes' ] )
                     break
                 self.maxNodes = None
 
+            if self.maxNodes == None or self.maxNodes == "":
+                self.maxNodes = 100
 
-            # Grabs all OC environment variables
+
+            # Grabs all OC environment variables based on max number of nodes
             self.onosIps = {}  # Dictionary of all possible ONOS ip
 
             try:
                 if self.maxNodes:
-                    main.log.info( self.name + ": Creating cluster data with " +
-                                   str( self.maxNodes ) + " maximum number" +
-                                   " of nodes" )
-
                     for i in range( self.maxNodes ):
                         envString = "OC" + str( i + 1 )
-                        self.onosIps[ envString ] = os.getenv( envString )
+                        # If there is no more OC# then break the loop
+                        if os.getenv( envString ):
+                            self.onosIps[ envString ] = os.getenv( envString )
+                        else:
+                            self.maxNodes = len( self.onosIps )
+                            main.log.info( self.name +
+                                           ": Created cluster data with " +
+                                           str( self.maxNodes ) +
+                                           " maximum number" +
+                                           " of nodes" )
+                            break
 
                     if not self.onosIps:
                         main.log.info( "Could not read any environment variable"
@@ -87,7 +98,6 @@
                         main.log.info( self.name + ": Found " +
                                        str( self.onosIps.values() ) +
                                        " ONOS IPs" )
-
             except KeyError:
                 main.log.info( "Invalid environment variable" )
             except Exception as inst:
@@ -100,7 +110,6 @@
                     main.log.info( self.name +
                                    ": Trying to connect to " +
                                    self.ip_address )
-
             except KeyError:
                 main.log.info( "Invalid host name," +
                                " connecting to local host instead" )
@@ -660,12 +669,14 @@
             ~/<self.home>/tools/test/cells/
         """
         # Variable initialization
-        cellDirectory = os.environ["ONOS_ROOT"] + "/tools/test/cells/"
+        cellDirectory = self.home + "/tools/test/cells/"
         # We want to create the cell file in the dependencies directory
         # of TestON first, then copy over to ONOS bench
         tempDirectory = "/tmp/"
         # Create the cell file in the directory for writing ( w+ )
         cellFile = open( tempDirectory + fileName, 'w+' )
+        if isinstance( onosIpAddrs, types.StringType ):
+            onosIpAddrs = [ onosIpAddrs ]
 
         # App string is hardcoded environment variables
         # That you may wish to use by default on startup.
@@ -711,8 +722,8 @@
             # Note that even if TestON is located on the same cluster
             # as ONOS bench, you must setup passwordless ssh
             # between TestON and ONOS bench in order to automate the test.
-            os.system( "scp " + tempDirectory + fileName +
-                       " admin@" + benchIp + ":" + cellDirectory )
+            os.system( "scp " + tempDirectory + fileName + " " +
+                       self.user_name + "@" + self.ip_address + ":" + cellDirectory )
 
             return main.TRUE
 
@@ -1917,7 +1928,7 @@
         linkGraph.close()
 
         #SCP
-        os.system( "scp " + tempFile + " admin@" + benchIp + ":" + linkGraphPath)        
+        os.system( "scp " + tempFile + " " + self.user_name + "@" + benchIp + ":" + linkGraphPath)        
         main.log.info("linkGraph.cfg creation complete")
 
     def configNullDev( self, ONOSIpList, deviceCount, numPorts=10):
@@ -2105,51 +2116,7 @@
                     main.log.info(outputString) 
                 
         main.log.info("================================================================\n")
-        return totalHits 
-
-    def getOnosIPfromCell(self):
-        '''
-            Returns the ONOS node names and their IP addresses as defined in the cell and applied to shell environment
-            Example output return: ['10.128.40.41','10.128.40.42','10.128.40.43']. This will work even if the Mininet is
-            not part of the cell definition and also if there are multiple mininets, just by using static hostname  
-            in TOPO file.
-        '''
-        import re
-        try:
-            # Clean handle by sending empty and expecting $
-            self.handle.sendline( "" )
-            self.handle.expect( "\$" )
-            self.handle.sendline( "cell" )
-            self.handle.expect( "\$" )
-            handleBefore = self.handle.before
-            handleAfter = self.handle.after
-            # Get the rest of the handle
-            self.handle.sendline( "" )
-            self.handle.expect( "\$" )
-            handleMore = self.handle.before
-            ipList = []
-            cellOutput = handleBefore + handleAfter + handleMore
-            cellOutput = cellOutput.replace("\r\r","")
-            cellOutput = cellOutput.splitlines()
-            for i in range( len(cellOutput) ):
-                if( re.match( "OC", cellOutput[i] ) ):
-                    if( re.match( "OCI", cellOutput[i] ) or re.match( "OCN", cellOutput[i] ) ):
-                        continue
-                    else:
-                        onosIP = cellOutput[i].split("=")
-                        ipList.append(onosIP[1])
-            return ipList
-        except pexpect.ExceptionPexpect as e:
-            main.log.error( self.name + ": Pexpect exception found of type " +
-                            str( type( e ) ) )
-            main.log.error ( e.get_trace() )
-            main.log.error( self.name + ":    " + self.handle.before )
-            main.cleanup()
-            main.exit()
-        except Exception:
-            main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+        return totalHits
 
     def copyMininetFile( self, fileName, localPath, userName, ip,
                          mnPath='~/mininet/custom/', timeout = 60 ):
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index f75df5f..b4d0251 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -87,24 +87,31 @@
                                     refused,
                                     'teston>',
                                     '>|#|\$' ],
-                		    120 )
+                            120 )
             if i == 0:  # Accept key, then expect either a password prompt or access
                 main.log.info( "ssh key confirmation received, send yes" )
                 self.handle.sendline( 'yes' )
                 i = 5  # Run the loop again
-                continue 
-            if i == 1:
+                continue
+            if i == 1:  # Password required
                 if self.pwd:
                     main.log.info(
-                        "ssh connection asked for password, gave password" )
-                    self.handle.sendline( self.pwd )
-                    self.handle.expect( '>|#|\$' )
+                    "ssh connection asked for password, gave password" )
                 else:
-                    # FIXME: TestON does not support a username having no
-                    #        password
-                    main.log.error( "Server asked for password, but none was "
-                                    "given in the .topo file" )
-                    main.exit()
+                    main.log.info( "Server asked for password, but none was "
+                                    "given in the .topo file. Trying "
+                                    "no password.")
+                    self.pwd = ""
+                self.handle.sendline( self.pwd )
+                j = self.handle.expect( [
+                                        '>|#|\$',
+                                        'password:|Password:',
+                                        pexpect.EOF,
+                                        pexpect.TIMEOUT ],
+                                        120 )
+                if j != 0:
+                    main.log.error( "Incorrect Password" )
+                    return main.FALSE
             elif i == 2:
                 main.log.error( "Connection timeout" )
                 return main.FALSE
@@ -146,11 +153,11 @@
         result = super( CLI, self ).execute( self )
         defaultPrompt = '.*[$>\#]'
         args = utilities.parse_args( [
-				     "CMD",
+                     "CMD",
                                      "TIMEOUT",
                                      "PROMPT",
                                      "MORE" ],
-            			     **execparams )
+                             **execparams )
 
         expectPrompt = args[ "PROMPT" ] if args[ "PROMPT" ] else defaultPrompt
         self.LASTRSP = ""
@@ -165,12 +172,12 @@
         self.handle.sendline( cmd )
         self.lastCommand = cmd
         index = self.handle.expect( [
-				    expectPrompt,
+                    expectPrompt,
                                     "--More--",
                                     'Command not found.',
                                     pexpect.TIMEOUT,
                                     "^:$" ],
-            			    timeout=timeoutVar )
+                            timeout=timeoutVar )
         if index == 0:
             self.LASTRSP = self.LASTRSP + \
                 self.handle.before + self.handle.after
@@ -264,19 +271,19 @@
         ssh_newkey = 'Are you sure you want to continue connecting'
         refused = "ssh: connect to host " + \
             ip_address + " port 22: Connection refused"
-        
-	cmd = 'scp ' + str( user_name ) + '@' + str( ip_address ) + ':' + \
-	      str( filepath ) + ' ' + str(dst_path )
+
+        cmd = 'scp ' + str( user_name ) + '@' + str( ip_address ) + ':' + \
+          str( filepath ) + ' ' + str(dst_path )
 
         main.log.info( "Sending: " + cmd )
         self.handle = pexpect.spawn( cmd )
         i = self.handle.expect( [
-				ssh_newkey,
-                              	'password:',
-                              	pexpect.EOF,
-                              	pexpect.TIMEOUT,
-                              	refused ],
-            			120 )
+                            ssh_newkey,
+                            'password:',
+                            pexpect.EOF,
+                            pexpect.TIMEOUT,
+                            refused ],
+                            120 )
 
         if i == 0:
             main.log.info( "ssh key confirmation received, send yes" )
@@ -309,4 +316,3 @@
         print self.handle.before
 
         return self.handle
-
diff --git a/TestON/tests/CHOtest/CHOtest.py b/TestON/tests/CHOtest/CHOtest.py
index 20daf09..994a710 100644
--- a/TestON/tests/CHOtest/CHOtest.py
+++ b/TestON/tests/CHOtest/CHOtest.py
@@ -34,7 +34,6 @@
         karafTimeout = main.params['CTRL']['karafCliTimeout']
         main.newTopo = ""
         main.CLIs = []
-        main.onosIPs = []
 
         for i in range( 1, int(main.numCtrls) + 1 ):
             main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
@@ -47,8 +46,6 @@
         if ( main.onoscell ):
             cellName = main.onoscell
             cell_result = main.ONOSbench.setCell( cellName )
-            onosNodes = main.ONOSbench.getOnosIPfromCell()
-            main.onosIPs = onosNodes
             utilities.assert_equals( expect=main.TRUE, actual=cell_result,
                                  onpass="Test step PASS",
                                  onfail="Test step FAIL" )
diff --git a/TestON/tests/CHOtest/CHOtest.topo b/TestON/tests/CHOtest/CHOtest.topo
index 8b596e7..8053e31 100644
--- a/TestON/tests/CHOtest/CHOtest.topo
+++ b/TestON/tests/CHOtest/CHOtest.topo
@@ -5,11 +5,9 @@
             <host>localhost</host>
             <user>admin</user>
             <password></password>
-			<type>OnosDriver</type>
-			<connect_order>1</connect_order>
-            <COMPONENTS>
-                <home>~/ONOS</home>
-            </COMPONENTS>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
         </ONOSbench>
 
         <ONOScli1>
diff --git a/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
index 304ed29..13877b2 100644
--- a/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
@@ -48,6 +48,9 @@
             host1 - Name of first host
             host2 - Name of second host
         Optional:
+            onosNode - ONOS node to install the intents in main.CLIs[ ]
+                       0 by default so that it will always use the first
+                       ONOS node
             host1Id - ONOS id of the first host eg. 00:00:00:00:00:01/-1
             host2Id - ONOS id of the second host
             mac1 - Mac address of first host
@@ -258,6 +261,9 @@
             host1 - Name of first host
             host2 - Name of second host
         Optional:
+            onosNode - ONOS node to install the intents in main.CLIs[ ]
+                       0 by default so that it will always use the first
+                       ONOS node
             deviceId1 - ONOS device id of the first switch, the same as the
                         location of the first host eg. of:0000000000000001/1,
                         located at device 1 port 1
@@ -473,6 +479,9 @@
             name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
             hostNames - List of host names
         Optional:
+            onosNode - ONOS node to install the intents in main.CLIs[ ]
+                       0 by default so that it will always use the first
+                       ONOS node
             devices - List of device ids in the same order as the hosts
                       in hostNames
             ports - List of port numbers in the same order as the device in
@@ -722,6 +731,9 @@
             name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
             hostNames - List of host names
         Optional:
+            onosNode - ONOS node to install the intents in main.CLIs[ ]
+                       0 by default so that it will always use the first
+                       ONOS node
             devices - List of device ids in the same order as the hosts
                       in hostNames
             ports - List of port numbers in the same order as the device in
diff --git a/TestON/tests/FUNCintent/FUNCintent.params b/TestON/tests/FUNCintent/FUNCintent.params
index e1021d3..1daba68 100644
--- a/TestON/tests/FUNCintent/FUNCintent.params
+++ b/TestON/tests/FUNCintent/FUNCintent.params
@@ -1,6 +1,6 @@
 <PARAMS>
 
-    <testcases>1,2,11,12,13,1001,1002,1003,1004</testcases>
+    <testcases>1,2,11,12,13,1000,2000,3000,4000</testcases>
 
     <SCALE>
         <size>1,3</size>
@@ -32,4 +32,12 @@
         <links>20</links>
     </MININET>
 
+    # Intent tests params
+    <SDNIP>
+        <tcpProto>6</tcpProto>
+        <icmpProto>1</icmpProto>
+        <srcPort>5001</srcPort>
+        <dstPort>5001</dstPort>
+    </SDNIP>
+
 </PARAMS>
diff --git a/TestON/tests/FUNCintent/FUNCintent.py b/TestON/tests/FUNCintent/FUNCintent.py
index 0a8092f..1e10db3 100644
--- a/TestON/tests/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNCintent/FUNCintent.py
@@ -316,7 +316,7 @@
             main.cleanup()
             main.exit()
 
-    def CASE1001( self, main ):
+    def CASE1000( self, main ):
         """
             Add host intents between 2 host:
                 - Discover hosts
@@ -349,8 +349,8 @@
 
         main.case( "Add host intents between 2 host" )
 
-        stepResult = main.TRUE
         main.step( "IPV4: Add host intents between h1 and h9" )
+        stepResult = main.TRUE
         stepResult = main.intentFunction.hostIntent( main,
                                               onosNode='0',
                                               name='IPV4',
@@ -367,8 +367,8 @@
                                  onpass="IPV4: Add host intent successful",
                                  onfail="IPV4: Add host intent failed" )
 
-        stepResult = main.TRUE
         main.step( "DUALSTACK1: Add host intents between h3 and h11" )
+        stepResult = main.TRUE
         stepResult = main.intentFunction.hostIntent( main,
                                               name='DUALSTACK',
                                               host1='h3',
@@ -385,8 +385,8 @@
                                         " successful",
                                  onfail="DUALSTACK1: Add host intent failed" )
 
-        stepResult = main.TRUE
         main.step( "DUALSTACK2: Add host intents between h1 and h11" )
+        stepResult = main.TRUE
         stepResult = main.intentFunction.hostIntent( main,
                                               name='DUALSTACK2',
                                               host1='h1',
@@ -401,8 +401,8 @@
                                         " successful",
                                  onfail="DUALSTACK2: Add host intent failed" )
 
-        stepResult = main.TRUE
         main.step( "1HOP: Add host intents between h1 and h3" )
+        stepResult = main.TRUE
         stepResult = main.intentFunction.hostIntent( main,
                                               name='1HOP',
                                               host1='h1',
@@ -414,8 +414,8 @@
                                         " successful",
                                  onfail="1HOP: Add host intent failed" )
 
-        stepResult = main.TRUE
         main.step( "VLAN1: Add vlan host intents between h4 and h12" )
+        stepResult = main.TRUE
         stepResult = main.intentFunction.hostIntent( main,
                                               name='VLAN1',
                                               host1='h4',
@@ -432,8 +432,8 @@
                                         " intent successful",
                                  onfail="VLAN1: Add vlan host intent failed" )
 
-        stepResult = main.TRUE
         main.step( "VLAN2: Add inter vlan host intents between h13 and h20" )
+        stepResult = main.TRUE
         stepResult = main.intentFunction.hostIntent( main,
                                               name='VLAN2',
                                               host1='h13',
@@ -446,7 +446,7 @@
                                  onfail="VLAN2: Add inter vlan host" +
                                         " intent failed" )
 
-    def CASE1002( self, main ):
+    def CASE2000( self, main ):
         """
             Add point intents between 2 hosts:
                 - Get device ids | ports
@@ -479,9 +479,9 @@
 
         main.case( "Add point intents between 2 devices" )
 
-        stepResult = main.TRUE
         # No option point intents
         main.step( "NOOPTION: Add point intents between h1 and h9" )
+        stepResult = main.TRUE
         stepResult = main.intentFunction.pointIntent(
                                        main,
                                        name="NOOPTION",
@@ -493,13 +493,13 @@
                                        sw2="s2",
                                        expectedLink=18 )
 
-        stepResult = main.TRUE
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="NOOPTION: Add point intent successful",
                                  onfail="NOOPTION: Add point intent failed" )
 
         stepResult = main.TRUE
+        main.step( "IPV4: Add point intents between h1 and h9" )
         stepResult = main.intentFunction.pointIntent(
                                        main,
                                        name="IPV4",
@@ -528,6 +528,7 @@
                                  onpass="IPV4: Add point intent successful",
                                  onfail="IPV4: Add point intent failed" )
 
+        main.step( "IPV4_2: Add point intents between h1 and h9" )
         stepResult = main.TRUE
         stepResult = main.intentFunction.pointIntent(
                                        main,
@@ -536,7 +537,7 @@
                                        host2="h9",
                                        deviceId1="of:0000000000000005/1",
                                        deviceId2="of:0000000000000006/1",
-                                       ipProto=1,
+                                       ipProto="",
                                        ip1="",
                                        ip2="",
                                        tcp1="",
@@ -550,8 +551,66 @@
                                  onpass="IPV4_2: Add point intent successful",
                                  onfail="IPV4_2: Add point intent failed" )
 
+        main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
         stepResult = main.TRUE
+        mac1 = main.hostsData[ 'h1' ][ 'mac' ]
+        mac2 = main.hostsData[ 'h9' ][ 'mac' ]
+        ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/24"
+        ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/24"
+        ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
+        tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
+        tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
+
+        stepResult = main.intentFunction.pointIntent(
+                                           main,
+                                           name="SDNIP-TCP",
+                                           host1="h1",
+                                           host2="h9",
+                                           deviceId1="of:0000000000000005/1",
+                                           deviceId2="of:0000000000000006/1",
+                                           mac1=mac1,
+                                           mac2=mac2,
+                                           ethType="IPV4",
+                                           ipProto=ipProto,
+                                           ip1=ip1,
+                                           ip2=ip2,
+                                           tcp1=tcp1,
+                                           tcp2=tcp2 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                             actual=stepResult,
+                             onpass="SDNIP-TCP: Add point intent successful",
+                             onfail="SDNIP-TCP: Add point intent failed" )
+
+        main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
+        stepResult = main.TRUE
+        mac1 = main.hostsData[ 'h1' ][ 'mac' ]
+        mac2 = main.hostsData[ 'h9' ][ 'mac' ]
+        ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/24"
+        ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/24"
+        ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
+        tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
+        tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
+
+        stepResult = main.intentFunction.pointIntent(
+                                           main,
+                                           name="SDNIP-ICMP",
+                                           host1="h1",
+                                           host2="h9",
+                                           deviceId1="of:0000000000000005/1",
+                                           deviceId2="of:0000000000000006/1",
+                                           mac1=mac1,
+                                           mac2=mac2,
+                                           ethType="IPV4",
+                                           ipProto=ipProto )
+
+        utilities.assert_equals( expect=main.TRUE,
+                             actual=stepResult,
+                             onpass="SDNIP-ICMP: Add point intent successful",
+                             onfail="SDNIP-ICMP: Add point intent failed" )
+
         main.step( "DUALSTACK1: Add point intents between h1 and h9" )
+        stepResult = main.TRUE
         stepResult = main.intentFunction.pointIntent(
                                        main,
                                        name="DUALSTACK1",
@@ -580,8 +639,9 @@
                                  onpass="DUALSTACK1: Add point intent" +
                                         " successful",
                                  onfail="DUALSTACK1: Add point intent failed" ) 
-        stepResult = main.TRUE
+
         main.step( "VLAN: Add point intents between h5 and h21" )
+        stepResult = main.TRUE
         stepResult = main.intentFunction.pointIntent(
                                        main,
                                        name="VLAN",
@@ -610,8 +670,8 @@
                                  onpass="VLAN: Add point intent successful",
                                  onfail="VLAN: Add point intent failed" )
 
-        stepResult = main.TRUE
         main.step( "1HOP: Add point intents between h1 and h3" )
+        stepResult = main.TRUE
         stepResult = main.intentFunction.hostIntent( main,
                                               name='1HOP',
                                               host1='h1',
@@ -623,7 +683,7 @@
                                         " successful",
                                  onfail="1HOP: Add point intent failed" )
 
-    def CASE1003( self, main ):
+    def CASE3000( self, main ):
         """
             Add single point to multi point intents
                 - Get device ids
@@ -650,13 +710,12 @@
 
         main.case( "Add single point to multi point intents between devices" )
 
+        main.step( "NOOPTION: Add single point to multi point intents" )
         stepResult = main.TRUE
         hostNames = [ 'h8', 'h16', 'h24' ]
         devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
                     'of:0000000000000007/8' ]
         macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
-
-        main.step( "NOOPTION: Add single point to multi point intents" )
         stepResult = main.intentFunction.singleToMultiIntent(
                                          main,
                                          name="NOOPTION",
@@ -673,8 +732,8 @@
                                  onfail="NOOPTION: Failed to add single point" +
                                         " to multi point intents" )
 
-        stepResult = main.TRUE
         main.step( "IPV4: Add single point to multi point intents" )
+        stepResult = main.TRUE
         stepResult = main.intentFunction.singleToMultiIntent(
                                          main,
                                          name="IPV4",
@@ -699,8 +758,8 @@
                                  onfail="IPV4: Failed to add single point" +
                                         " to multi point intents" )
 
-        stepResult = main.TRUE
         main.step( "IPV4_2: Add single point to multi point intents" )
+        stepResult = main.TRUE
         hostNames = [ 'h8', 'h16', 'h24' ]
         stepResult = main.intentFunction.singleToMultiIntent(
                                          main,
@@ -715,8 +774,9 @@
                                         + " point to multi point intents",
                                  onfail="IPV4_2: Failed to add single point" +
                                         " to multi point intents" )
-        stepResult = main.TRUE
+
         main.step( "VLAN: Add single point to multi point intents" )
+        stepResult = main.TRUE
         hostNames = [ 'h4', 'h12', 'h20' ]
         devices = [ 'of:0000000000000005/4', 'of:0000000000000006/4', \
                     'of:0000000000000007/4' ]
@@ -745,7 +805,7 @@
                                  onfail="VLAN: Failed to add single point" +
                                         " to multi point intents" ) 
 
-    def CASE1004( self, main ):
+    def CASE4000( self, main ):
         """
             Add multi point to single point intents
                 - Get device ids
@@ -772,13 +832,12 @@
 
         main.case( "Add multi point to single point intents between devices" )
 
+        main.step( "NOOPTION: Add multi point to single point intents" )
         stepResult = main.TRUE
         hostNames = [ 'h8', 'h16', 'h24' ]
         devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
                     'of:0000000000000007/8' ]
         macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
-
-        main.step( "NOOPTION: Add multi point to single point intents" )
         stepResult = main.intentFunction.multiToSingleIntent(
                                          main,
                                          name="NOOPTION",
@@ -795,8 +854,8 @@
                                  onfail="NOOPTION: Failed to add multi point" +
                                         " to single point intents" )
 
-        stepResult = main.TRUE
         main.step( "IPV4: Add multi point to single point intents" )
+        stepResult = main.TRUE
         stepResult = main.intentFunction.multiToSingleIntent(
                                          main,
                                          name="IPV4",
@@ -821,8 +880,8 @@
                                  onfail="IPV4: Failed to add multi point" +
                                         " to single point intents" )
 
-        stepResult = main.TRUE
         main.step( "IPV4_2: Add multi point to single point intents" )
+        stepResult = main.TRUE
         hostNames = [ 'h8', 'h16', 'h24' ]
         stepResult = main.intentFunction.multiToSingleIntent(
                                          main,
@@ -838,8 +897,8 @@
                                  onfail="IPV4_2: Failed to add multi point" +
                                         " to single point intents" )
 
-        stepResult = main.TRUE
         main.step( "VLAN: Add multi point to single point intents" )
+        stepResult = main.TRUE
         hostNames = [ 'h5', 'h13', 'h21' ]
         devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5', \
                     'of:0000000000000007/5' ]
diff --git a/TestON/tests/FUNCintent/README b/TestON/tests/FUNCintent/README
new file mode 100644
index 0000000..ce4e99f
--- /dev/null
+++ b/TestON/tests/FUNCintent/README
@@ -0,0 +1,39 @@
+Summary:
+        This test suite consist of basic intent functionality testing.
+        The following is an overview of how host intents is being tested.
+        Steps:
+            - Discover hosts
+            - Add host intents
+            - Check intents
+            - Verify flows
+            - Ping hosts
+            - Reroute
+                - Link down
+                - Verify flows
+                - Check topology
+                - Ping hosts
+                - Link up
+                - Verify flows
+                - Check topology
+                - Ping hosts
+            - Remove intents
+        This test suite includes testing of different types of intents such as
+        host, point, single-to-multi and multi-to-single ( More intent types to
+        add later ). The same steps above is being performed to other type of
+        intents.
+
+Required:
+        This test requires Mininet topology file newFuncIntent.py that is in the
+        Dependency folder. You should run the topology file to check for any
+        missing packages. The mininet topology file has different type of hosts
+        including VLAN hosts. Therefore you need to install VLAN module to build
+        the topology correctly.
+
+VLAN configuration:
+        Execute command:
+            $ sudo apt-get install vlan
+        Configuration:
+            $ sudo modprobe 8021q
+        NOTE:To make this configuration permanent
+            $ sudo su -c 'echo "8021q" >> /etc/modules'
+
diff --git a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py
index acd899d..96d24a9 100644
--- a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py
+++ b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py
@@ -1,6 +1,6 @@
 
-# Testing the basic functionality of ONOS Next
-# For sanity and driver functionality excercises only.
+# This is a sample template that starts up ONOS cluster, this template
+# is used as a starting script for creating functionality and performance test
 
 class SAMPstartTemplate:
 
diff --git a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.topo b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.topo
index 4a116c3..cd2640f 100755
--- a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.topo
+++ b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.topo
@@ -8,7 +8,6 @@
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
             <COMPONENTS>
-                <nodes>3</nodes>
             </COMPONENTS>
         </ONOSbench>
 
diff --git a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py
index 6cc65ab..3c1805a 100644
--- a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py
+++ b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py
@@ -75,7 +75,7 @@
             commit = main.ONOSbench.getVersion()
             commit = (commit.split(" "))[1]
 
-            resultsDB = open("flowTP1gDB", "w+")
+            resultsDB = open("/tmp/flowTP1gDB", "w+")
             resultsDB.close()
 
         # -- END OF INIT SECTION --#
@@ -367,7 +367,7 @@
             main.log.info("Average thoughput:  " + str(avgTP) + " Kflows/second" )
             main.log.info("Standard deviation of throughput: " + str(stdTP) + " Kflows/second") 
 
-            resultsLog = open("flowTP1gDB","a")
+            resultsLog = open("/tmp/flowTP1gDB","a")
             resultString = ("'" + commit + "',")
             resultString += ("'1gig',")
             resultString += ((main.params[ 'TEST' ][ 'flows' ]) + ",")
diff --git a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py
index 053556a..06fc028 100644
--- a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py
+++ b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py
@@ -86,7 +86,7 @@
             commit = (commit.split(" "))[1]
         
             main.log.step("Creating results file") 
-            resultsDB = open("IntentEventTPDB", "w+")
+            resultsDB = open("/tmp/IntentEventTPDB", "w+")
             resultsDB.close()
 
         # -- END OF INIT SECTION --#
@@ -340,7 +340,7 @@
             main.ONOSbench.handle.expect(":~")
             main.log.info("Stopping intentperf" )
    
-            resultsDB = open("IntentEventTPDB", "a")
+            resultsDB = open("/tmp/IntentEventTPDB", "a")
             for node in groupResult: 
 
                 resultString = "'" + commit + "',"
diff --git a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
index d9179cf..ef92e58 100644
--- a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
+++ b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
@@ -71,7 +71,7 @@
             commit = main.ONOSbench.getVersion()
             commit = (commit.split(" "))[1]
 
-            resultsDB = open("IntentInstallWithdrawLatDB", "w+")
+            resultsDB = open("/tmp/IntentInstallWithdrawLatDB", "w+")
             resultsDB.close()
 
         # -- END OF INIT SECTION --#
@@ -267,7 +267,7 @@
             resultString += str(numpy.std(installed)) + ","
             resultString += str(numpy.mean(withdrawn)) + ","
             resultString += str(numpy.std(withdrawn)) + "\n"
-            resultsDB = open("IntentInstallWithdrawLatDB", "a")
+            resultsDB = open("/tmp/IntentInstallWithdrawLatDB", "a")
             resultsDB.write(resultString)
             resultsDB.close()
 
diff --git a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py
index 8bbf003..07871f9 100644
--- a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py
+++ b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py
@@ -72,7 +72,7 @@
             commit = main.ONOSbench.getVersion()
             commit = (commit.split(" "))[1]
 
-            resultsDB = open("IntentRerouteLatDB", "w+")
+            resultsDB = open("/tmp/IntentRerouteLatDB", "w+")
             resultsDB.close()
 
         # -- END OF INIT SECTION --#
@@ -397,7 +397,7 @@
             main.log.report("Mode of last node to respond:..." + str(nodeMode))
             main.log.report("________________________________________________________")
 
-            resultsDB = open("IntentRerouteLatDB", "a")
+            resultsDB = open("/tmp/IntentRerouteLatDB", "a")
             resultsDB.write("'" + commit + "',") 
             resultsDB.write(str(clusterCount) + ",")
             resultsDB.write(str(intents) + ",")