Updating test for TOST QA Pod

Add more robust topology check to Segment routing tests
Fix Typos
Include minimum flow count # in the comparision (>= vs > )
Add option for username and password in onos-app function
Don't add app prefix if it looks like it is already the full name

Change-Id: Ib4af0f72df8e7dcc5c179fafea1fd9c61d931246
(cherry picked from commit cda0902ee85041b22da8ad7638a8518914d07322)
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/dependencies/SRLinkFailFuncs.py b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/dependencies/SRLinkFailFuncs.py
index 0a0ef5a..4664c9e 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/dependencies/SRLinkFailFuncs.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/dependencies/SRLinkFailFuncs.py
@@ -82,17 +82,20 @@
                 pass
             # xconnects need to be loaded after topology
             run.loadXconnects( main )
+            switches = self.topo[ Topo ][ 0 ] + self.topo[ Topo ][ 1 ]
+            links = ( self.topo[ Topo ][ 0 ] * self.topo[ Topo ][ 1 ] ) * 2
             # pre-configured routing and bridging test
+            run.verifyTopology( main, switches, links, numNodes )
             run.checkFlows( main, minFlowCount=minFlow )
-            run.pingAll( main )
-            switch = self.topo[ Topo ][ 0 ] + self.topo[ Topo ][ 1 ]
-            link = ( self.topo[ Topo ][ 0 ] + self.topo[ Topo ][ 1 ] ) * self.topo[ Topo ][ 0 ]
+            run.pingAll( main, 'CASE{}'.format( caseNum ) )
             # link failure
-            run.killLink( main, self.switchOne, self.switchTwo, switches='{}'.format( switch ), links='{}'.format( link - 2 ) )
-            run.pingAll( main, "CASE{}_Failure".format( caseNum ) )
-            run.restoreLink( main, self.switchOne, self.switchTwo, '{}'.format( switch ), '{}'.format( link ),
+            run.killLink( main, self.switchOne, self.switchTwo, switches='{}'.format( switches ), links='{}'.format( links - 2 ) )
+            run.pingAll( main, 'CASE{}_Failure'.format( caseNum ) )
+            run.restoreLink( main, self.switchOne, self.switchTwo, '{}'.format( switches ), '{}'.format( links ),
                              True, self.dpidOne, self.dpidTwo, self.portOne, self.portTwo )
-            run.pingAll( main, "CASE{}_Recovery".format( caseNum ) )
+            run.checkFlows( main, minFlowCount=minFlow, tag='CASE{}_Recovery'.format( caseNum ) )
+            run.pingAll( main, 'CASE{}_Recovery'.format( caseNum ) )
+            run.verifyTopology( main, switches, links, numNodes )
             # TODO Dynamic config of hosts in subnet
             # TODO Dynamic config of host not in subnet
             # TODO Dynamic config of vlan xconnect