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/SRRouting/SRRouting.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
index 5ca5f40..d4ed62c 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
@@ -102,7 +102,7 @@
 
     def CASE9( self, main ):
         """
-        Ping between ipv4 and pv6 hosts and external hosts that is not configured in
+        Ping between ipv4 and ipv6 hosts and external hosts that is not configured in
         external router config, but reachable through the use of route-add
         command.
         """
@@ -1353,7 +1353,7 @@
 
     def CASE652( self, main ):
         """
-        Move a dual-homed host from porst 1A and 1B to ports 2A and 2B
+        Move a dual-homed host from ports 1A and 1B to ports 2A and 2B
         Host retains the same MAC and IP address
         Test connectivity (expect no failure)
         """
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
index 24864e5..9c1b8c1 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
@@ -266,14 +266,32 @@
     Verify host IP assignment, flow/group number and pings
     """
     from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
-    # Verify host IP assignment
-    lib.verifyOnosHostIp( main )
-    lib.verifyNetworkHostIp( main )
+
+    spines = 4
+    leaves = 6
+    switches = spines + leaves
+    links = 0
+    #links = ( spines * leaves ) * 2
+    # Some double links, spines 101 and 102 to leaves 2-5
+    links += ( 2 * 4 * 2 ) * 2
+    # Some paired leaves
+    links += ( ( leaves - 2 ) / 2 ) * 2
+    # Paired spines
+    links += ( spines / 2 ) * 2
+    # single homed leaf to spines
+    links += ( 2 * 2 ) * 2
+
+    lib.verifyTopology( main, switches, links, len( main.Cluster.runningNodes ) )
     # check flows / groups numbers
     if countFlowsGroups:
         lib.checkFlowsGroupsFromFile( main )
     # ping hosts
     verifyPing( main, ipv4, ipv6, disconnected, internal, external )
+    # Verify host IP assignment
+    lib.verifyOnosHostIp( main )
+    lib.verifyNetworkHostIp( main )
+    # ping hosts
+    verifyPing( main, ipv4, ipv6, disconnected, internal, external )
 
 def verifyRouterFailure( main, routerToKill, affectedIpv4Hosts=[], affectedIpv6Hosts=[],
                          ipv4=True, ipv6=True, countFlowsGroups=False ):
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/TEST_CONFIG_ipv4=1_ipv6=0.json b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/TEST_CONFIG_ipv4=1_ipv6=0.json
index 0ff7a0e..23c7750 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/TEST_CONFIG_ipv4=1_ipv6=0.json
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/TEST_CONFIG_ipv4=1_ipv6=0.json
@@ -14,33 +14,25 @@
     "devices":{
         "of:0000000000000001":{
             "basic":{
-                "driver":"ofdpa-ovs",
-                "latitude":30,
-                "longitude":-105,
-                "name":"s001"
+                "driver":"ofdpa-ovs"
             },
             "segmentrouting":{
                 "adjacencySids":[],
                 "ipv4Loopback":"192.168.0.1",
                 "ipv4NodeSid":1001,
                 "isEdgeRouter":true,
-                "name":"s001",
                 "routerMac":"00:00:00:00:00:01"
             }
         },
         "of:0000000000000002":{
             "basic":{
-                "driver":"ofdpa-ovs",
-                "latitude":34,
-                "longitude":-95,
-                "name":"s002"
+                "driver":"ofdpa-ovs"
             },
             "segmentrouting":{
                 "adjacencySids":[],
                 "ipv4Loopback":"192.168.0.2",
                 "ipv4NodeSid":1002,
                 "isEdgeRouter":true,
-                "name":"s002",
                 "pairDeviceId":"of:0000000000000003",
                 "pairLocalPort":5,
                 "routerMac":"00:00:00:00:00:02"
@@ -48,17 +40,13 @@
         },
         "of:0000000000000003":{
             "basic":{
-                "driver":"ofdpa-ovs",
-                "latitude":34,
-                "longitude":-90,
-                "name":"s003"
+                "driver":"ofdpa-ovs"
             },
             "segmentrouting":{
                 "adjacencySids":[],
                 "ipv4Loopback":"192.168.0.3",
                 "ipv4NodeSid":1003,
                 "isEdgeRouter":true,
-                "name":"s003",
                 "pairDeviceId":"of:0000000000000002",
                 "pairLocalPort":5,
                 "routerMac":"00:00:00:00:00:02"
@@ -66,17 +54,13 @@
         },
         "of:0000000000000004":{
             "basic":{
-                "driver":"ofdpa-ovs",
-                "latitude":34,
-                "longitude":-85,
-                "name":"s004"
+                "driver":"ofdpa-ovs"
             },
             "segmentrouting":{
                 "adjacencySids":[],
                 "ipv4Loopback":"192.168.0.4",
                 "ipv4NodeSid":1004,
                 "isEdgeRouter":true,
-                "name":"s004",
                 "pairDeviceId":"of:0000000000000005",
                 "pairLocalPort":5,
                 "routerMac":"00:00:00:00:00:04"
@@ -84,17 +68,13 @@
         },
         "of:0000000000000005":{
             "basic":{
-                "driver":"ofdpa-ovs",
-                "latitude":34,
-                "longitude":-80,
-                "name":"s005"
+                "driver":"ofdpa-ovs"
             },
             "segmentrouting":{
                 "adjacencySids":[],
                 "ipv4Loopback":"192.168.0.5",
                 "ipv4NodeSid":1005,
                 "isEdgeRouter":true,
-                "name":"s005",
                 "pairDeviceId":"of:0000000000000004",
                 "pairLocalPort":5,
                 "routerMac":"00:00:00:00:00:04"
@@ -102,10 +82,7 @@
         },
         "of:0000000000000006":{
             "basic":{
-                "driver":"ofdpa-ovs",
-                "latitude":30,
-                "longitude":-110,
-                "name":"s006"
+                "driver":"ofdpa-ovs"
             },
             "segmentrouting":{
                 "adjacencySids":[],
@@ -114,48 +91,36 @@
                 "ipv6Loopback":"2000::c0a8:0006",
                 "ipv6NodeSid":2006,
                 "isEdgeRouter":true,
-                "name":"s006",
                 "routerMac":"00:00:00:00:00:06"
             }
         },
         "of:0000000000000101":{
             "basic":{
-                "driver":"ofdpa-ovs",
-                "latitude":42,
-                "longitude":-100,
-                "name":"s101"
+                "driver":"ofdpa-ovs"
             },
             "segmentrouting":{
                 "adjacencySids":[],
                 "ipv4Loopback":"192.168.0.101",
                 "ipv4NodeSid":1101,
                 "isEdgeRouter":false,
-                "name":"s101",
                 "routerMac":"00:00:00:00:01:01"
             }
         },
         "of:0000000000000102":{
             "basic":{
-                "driver":"ofdpa-ovs",
-                "latitude":42,
-                "longitude":-95,
-                "name":"s102"
+                "driver":"ofdpa-ovs"
             },
             "segmentrouting":{
                 "adjacencySids":[],
                 "ipv4Loopback":"192.168.0.102",
                 "ipv4NodeSid":1102,
                 "isEdgeRouter":false,
-                "name":"s102",
                 "routerMac":"00:00:00:00:01:02"
             }
         },
         "of:0000000000000103":{
             "basic":{
-                "driver":"ofdpa-ovs",
-                "latitude":35,
-                "longitude":-115,
-                "name":"s103"
+                "driver":"ofdpa-ovs"
             },
             "segmentrouting":{
                 "adjacencySids":[],
@@ -164,16 +129,12 @@
                 "ipv6Loopback":"2000::c0a8:0203",
                 "ipv6NodeSid":2103,
                 "isEdgeRouter":false,
-                "name":"s103",
                 "routerMac":"00:00:00:00:01:03"
             }
         },
         "of:0000000000000104":{
             "basic":{
-                "driver":"ofdpa-ovs",
-                "latitude":35,
-                "longitude":-110,
-                "name":"s104"
+                "driver":"ofdpa-ovs"
             },
             "segmentrouting":{
                 "adjacencySids":[],
@@ -182,7 +143,6 @@
                 "ipv6Loopback":"2000::c0a8:0204",
                 "ipv6NodeSid":2104,
                 "isEdgeRouter":false,
-                "name":"s104",
                 "routerMac":"00:00:00:00:01:04"
             }
         }