[ONOS-7937] Automatically check SCPF test results

Change-Id: Ifec2e7965fbc43ab9bb65338810ca62d7b120739
(cherry picked from commit aa7bc72e78ba2ba5656939232751b1501cc56ceb)
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
index 39f73bf..02334cf 100755
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
@@ -7,8 +7,9 @@
     # 100 - balance master and bring onos node down
     # 200 - bring onos node up and balance masters
     # 1000 - report logs
+    # 1001 - report alarms
     # 1,[2,10,300,11,100,300,11,200,300,11,1000]*3
-    <testcases>1,[3,2,10,300,11,1000]*7,3</testcases>
+    <testcases>1,[3,2,10,300,11,1000]*5,3,1001</testcases>
 
     <GRAPH>
         <nodeCluster>BM</nodeCluster>
@@ -82,4 +83,8 @@
         <host>True</host>
     </TOPOLOGY>
 
+    <ALARM>
+        <minMaxScale>40</minMaxScale>
+    </ALARM>
+
 </PARAMS>
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
index 5ac38e6..99a246d 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
@@ -81,6 +81,7 @@
             main.MNLinksTime = int( main.params[ 'TIMEOUT' ][ 'links' ] )
             main.getTopoTime = int( main.params[ 'TIMEOUT' ][ 'getTopo' ] )
             main.currScale = None
+            main.maxScale = 1
             main.threadID = 0
             if main.hostDiscover == 'True':
                 main.hostDiscover = True
@@ -464,6 +465,7 @@
                 main.log.error( "The results of two capture are different!" )
             main.log.debug( "The data is " + str( main.allinfo ) )
             if main.writeData != -1:
+                main.maxScale = main.currScale
                 main.log.info( "Write the date into database" )
                 # write the date into data base
                 with open( main.dbFilePath, "a" ) as dbFile:
@@ -490,3 +492,12 @@
                                                                   "ERROR",
                                                                   "Except" ],
                                                                   "s" )
+
+    def CASE1001( self, main ):
+        """
+            Write abnormal test results to alarm log
+        """
+        threshold = int( main.params[ 'ALARM' ][ 'minMaxScale' ] )
+        if int( main.maxScale ) < threshold:
+            main.log.alarm( "Max scale: {}x{} < {}x{}".format( main.maxScale, main.maxScale,
+                                                               threshold, threshold ) )