Merge "Test Bandwidth Allocation with Intents"
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 4891338..b208b3c 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -2043,12 +2043,12 @@
             Obtain the total IPv4 routes number in the system
         """
         try:
-            cmdStr = "routes -s -j"
+            cmdStr = "routes -j"
             handle = self.sendline( cmdStr )
             assert handle is not None, "Error in sendline"
             assert "Command not found:" not in handle, handle
             jsonResult = json.loads( handle )
-            return jsonResult['totalRoutes4']
+            return len(jsonResult['routes4'])
         except AssertionError:
             main.log.exception( "" )
             return None
diff --git a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
index 183a3e6..2fb6b3d 100755
--- a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
+++ b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
@@ -159,6 +159,15 @@
                                  onfail="Failed to install ONOS package" )
         time.sleep( main.startUpSleep )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for i in range( main.numCtrls ):
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
+        time.sleep( main.startUpSleep )
         main.step( "Starting ONOS service" )
         stopResult = main.TRUE
         startResult = main.TRUE
@@ -187,8 +196,7 @@
         cliResult = main.TRUE
         for i in range( i, main.numCtrls ):
             cliResult = cliResult and \
-                        main.ONOScli1.startCellCli( )
-            main.log.info("ONOSip is: " + main.ONOScli1.ip_address)
+                        main.ONOScli1.startOnosCli( main.ONOSip[ i ] )
         stepResult = cliResult
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
diff --git a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.topo b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.topo
index 05dbe31..0237cda 100755
--- a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.topo
+++ b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.topo
@@ -12,7 +12,7 @@
         </ONOSbench>
 
         <ONOScli1>
-            <host>OC1</host>
+            <host>localhost</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosCliDriver</type>
diff --git a/TestON/tests/SCPF/Jenkinsfile b/TestON/tests/SCPF/Jenkinsfile
index dce6dff..d52afd6 100644
--- a/TestON/tests/SCPF/Jenkinsfile
+++ b/TestON/tests/SCPF/Jenkinsfile
@@ -1,11 +1,11 @@
 #!groovy
 // This is a Jenkinsfile for a scripted pipeline for the SCPF tests
-properties([pipelineTriggers([cron('30 19 * * *')])])
+// properties([pipelineTriggers([cron('30 19 * * *')])])
 
 // TODO: Exception handling around steps
 SCPF = [
     SCPFcbench: [ test:'SCPFcbench', table:'cbench_bm_tests', results:'cbench_bm_results', file:'CbenchDB'],
-    SCPFhostLat: [ test:'SCPFhostLat', table:'host_latency_results', results:'host_latency_results', file:'HostAddLatency'],
+    SCPFhostLat: [ test:'SCPFhostLat', table:'host_latency_tests', results:'host_latency_results', file:'HostAddLatency'],
     SCPFportLat: [ test:'SCPFportLat', table:'port_latency_details', results:'port_latency_results', file:'/tmp/portEventResultDb'],
     SCPFflowTp1g: [ test:'SCPFflowTp1g', table:'flow_tp_tests', results:'flow_tp_results', file:'flowTP1gDB'],
     SCPFscaleTopo: [ test:'SCPFscaleTopo', table:'scale_topo_latency_details', results:'scale_topo_latency_results', file:'/tmp/scaleTopoResultDb'],
@@ -48,22 +48,20 @@
     echo(now.toString())
     today = now[Calendar.DAY_OF_WEEK]
     switch (today) {
-        // TODO Choose which tests to run based on day of the week for nightly run?
-        // TODO Maybe define different subsets of tests above then just add them here
         case Calendar.MONDAY:
-            choices = SCPF_Basic + "\n" + SCPF_ExtraSetA
+            choices = SCPF_Basic + "\n" + SCPF_ExtraSetB
             println "Defaulting to Monday tests:" + choices
             break
         case Calendar.TUESDAY:
-            choices = SCPF_Basic + "\n" + SCPF_ExtraSetB
+            choices = SCPF_Basic
             println "Defaulting to Tuesday tests:" + choices
             break
         case Calendar.WEDNESDAY:
-            choices = SCPF_Basic
+            choices = SCPF_Basic + "\n" + SCPF_ExtraSetA
             println "Defaulting to Wednesday tests:" + choices
             break
         case Calendar.THURSDAY:
-            choices = SCPF_Basic + "\n" + SCPF_ExtraSetA
+            choices = SCPF_Basic + "\n" + SCPF_ExtraSetB
             println "Defaulting to Thursday tests:" + choices
             break
         case Calendar.FRIDAY:
@@ -75,7 +73,7 @@
             println "Defaulting to Saturday tests:" + choices
             break
         case Calendar.SUNDAY:
-            choices = SCPF_Basic
+            choices = SCPF_Basic + "\n" + SCPF_ExtraSetA
             println "Defaulting to Sunday tests:" + choices
             break
     }
@@ -141,6 +139,10 @@
                         string(credentialsId: 'db_user', variable: 'user'),
                         string(credentialsId: 'db_host', variable: 'host'),
                         string(credentialsId: 'db_port', variable: 'port')]) {
+                            def database_command = pass + "|psql --host=" + host + " --port=" + port + " --username=" + user + " --password --dbname onostest -c \"INSERT INTO " + SCPF[testName]['table'] + " VALUES('\$DATE','" + SCPF[testName]['results'] + "','\$BUILD_NUMBER', '\$ONOSBranch', \$line);\""
+                            if (testName == "SCPFscaleTopo" || testName == "SCPFswitchLat" || testName == "SCPFportLat") {
+                                database_command = pass + "|psql --host=" + host + " --port=" + port + " --username=" + user + " --password --dbname onostest -c \"INSERT INTO " + SCPF[testName]['table'] + " VALUES('\$DATE','" + SCPF[testName]['results'] + "','\$BUILD_NUMBER', \$line, '\$ONOSBranch');\""
+                            }
                             sh '''#!/bin/bash
 
                             export DATE=\$(date +%F_%T)
@@ -151,11 +153,9 @@
                             do
 
                             echo \$line
-                            echo ''' + pass + "|psql --host=" + host + " --port=" + port + " --username=" + user + " --password --dbname onostest -c \"INSERT INTO " + SCPF[testName]['table'] + " VALUES('\$DATE','" + SCPF[testName]['results'] + '''','\$BUILD_NUMBER', '\$ONOSBranch', \$line );\"
+                            echo ''' + database_command + '''
 
-                            done< ''' + SCPF[testName]['file'] + '''
-                            echo 'Done'
-                            '''
+                            done< ''' + SCPF[testName]['file']
                     }
                     // Fetch Logs
                     sh '''#!/bin/bash
@@ -172,7 +172,7 @@
                         echo "Job name does not match any test suite name to move log!"
                     else
                         pwd
-                        for i in $OC{1..7}; do onos-fetch-logs $i; done
+                        for i in $OC{1..7}; do onos-fetch-logs $i || echo log does not exist; done
                     fi'''
                 }
             }