adding TestON
diff --git a/TestON/tests/OnosScale4nodes/.OnosSanity.py.swp b/TestON/tests/OnosScale4nodes/.OnosSanity.py.swp
new file mode 100644
index 0000000..ac9cdc3
--- /dev/null
+++ b/TestON/tests/OnosScale4nodes/.OnosSanity.py.swp
Binary files differ
diff --git a/TestON/tests/OnosScale4nodes/OnosScale4nodes.params b/TestON/tests/OnosScale4nodes/OnosScale4nodes.params
new file mode 100644
index 0000000..dff7284
--- /dev/null
+++ b/TestON/tests/OnosScale4nodes/OnosScale4nodes.params
@@ -0,0 +1,9 @@
+<PARAMS>
+    <testcases>1,2,3,4</testcases>
+    <Iterations>2</Iterations>
+    <WaitTime>50</WaitTime>
+    <TargetTime>50</TargetTime>
+    <RestIP>10.128.100.4</RestIP>
+    <NR_Switches>100</NR_Switches>
+    <NR_Links>198</NR_Links>
+</PARAMS>      
diff --git a/TestON/tests/OnosScale4nodes/OnosScale4nodes.py b/TestON/tests/OnosScale4nodes/OnosScale4nodes.py
new file mode 100644
index 0000000..a054088
--- /dev/null
+++ b/TestON/tests/OnosScale4nodes/OnosScale4nodes.py
@@ -0,0 +1,217 @@
+
+class OnosScale4nodes:
+
+    def __init__(self) :
+        self.default = ''
+
+    def CASE1(self,main) :
+        '''
+        First case is to simply check if ONOS, ZK, and Cassandra are all running properly.
+        If ONOS if not running properly, it will restart ONOS once before continuing. 
+        It will then check if the ONOS has a view of all the switches and links as defined in the params file.
+        The test will only pass if ONOS is running properly, and has a full view of all topology elements.
+        '''
+        import time
+        main.log.report("Checking is startup was clean")
+        main.case("Checking if the startup was clean...")
+        main.step("Testing startup Zookeeper")
+        main.ONOS1.get_version()
+        data =  main.Zookeeper1.isup()
+        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
+        main.step("Testing startup Cassandra")
+        data =  main.Cassandra1.isup()
+        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
+        main.step("Testing startup ONOS")
+        main.ONOS1.start()
+        main.ONOS2.start()
+        main.ONOS3.start()
+        main.ONOS4.start()
+        data = main.ONOS1.isup()
+        if data == main.FALSE:
+            main.log.info("Something is funny... restarting ONOS")
+            main.ONOS1.stop()
+            time.sleep(3)
+            main.ONOS1.start()
+            time.sleep(5)
+            data = main.ONOS1.isup()
+        #topoview = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+        topoview = main.TRUE
+        if topoview == main.TRUE & data == main.TRUE :
+            data = main.TRUE
+        else:
+            data = main.FALSE
+
+        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running and has full view of topology",onfail="ONOS didn't start or has fragmented view of topology...")
+
+    def CASE2(self,main) :
+        '''
+        Second case is to time the convergence time of a topology for ONOS. 
+        It shuts down the ONOS, drops keyspace, starts ONOS...
+        Then it points all the mininet switches at the ONOS node and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
+        '''
+        import time
+        main.log.report("Time convergence for switches -> single ONOS node in cluster")
+        main.case("Timing Onos Convergence for switch -> a single ONOS node in the cluster")
+        main.step("Bringing ONOS down...") 
+        main.log.info("all switch no controllers") 
+        main.Mininet1.ctrl_none()
+        main.log.info("bringing ONOS down") 
+        main.ONOS1.stop()
+        main.ONOS2.stop()
+        main.ONOS3.stop()
+        main.ONOS4.stop()
+        main.log.info("Dropping keyspace...")
+        main.ONOS1.drop_keyspace()
+        time.sleep(5)
+        main.log.info("Bringing ONOS up")
+        main.ONOS1.start()
+        time.sleep(5) 
+        main.ONOS2.start()
+        main.ONOS3.start()
+        main.ONOS4.start()
+        main.ONOS1.isup()
+        main.ONOS2.isup()
+        main.ONOS3.isup()
+        main.ONOS4.isup()
+        main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+        main.log.info("Pointing the Switches at ONE controller... then BEGIN time") 
+        main.Mininet1.ctrl_local()
+        t1 = time.time()
+        for i in range(9) : 
+            result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+            if result == 1 : 
+                break
+            else : 
+                time.sleep(1)
+        t2 = time.time()
+        conv_time = t2 - t1
+        main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+        if result == 1 : 
+            main.log.report( "Convergence time of : %f seconds" % conv_time ) 
+            if float(conv_time) < float(main.params['TargetTime']) :
+                test=main.TRUE
+                main.log.info("Time is less then supplied target time")
+            else:
+                test=main.FALSE
+                main.log.info("Time is greater then supplied target time")
+        else : 
+            main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time ) 
+            test=main.FALSE
+ 
+        utilities.assert_equals(expect=main.TRUE,actual=test)
+
+    def CASE3(self,main) :
+        '''
+        Second case is to time the convergence time of a topology for ONOS. 
+        It shuts down the ONOS, drops keyspace, starts ONOS...
+        Then it points all the mininet switches at all ONOS nodes and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
+        '''
+        import time
+        main.log.report("Time convergence for switches -> all ONOS nodes in cluster")
+        main.case("Timing Onos Convergence for switch -> all ONOS nodes in cluster")
+        main.step("Bringing ONOS down...") 
+        main.log.info("all switch no controllers") 
+        main.Mininet1.ctrl_none()
+        main.log.info("bringing ONOS down") 
+        main.ONOS1.stop()
+        main.ONOS2.stop()
+        main.ONOS3.stop()
+        main.ONOS4.stop()
+        main.log.info("Dropping keyspace...")
+        main.ONOS1.drop_keyspace()
+        time.sleep(5)
+        main.log.info("Bringing ONOS up")
+        main.ONOS1.start()
+        time.sleep(5) 
+        main.ONOS2.start()
+        main.ONOS3.start()
+        main.ONOS4.start()
+        main.ONOS1.isup()
+        main.ONOS2.isup()
+        main.ONOS3.isup()
+        main.ONOS4.isup()
+        main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+        main.log.info("Pointing the Switches at ALL controllers... then BEGIN time") 
+        main.Mininet1.ctrl_all()
+        t1 = time.time()
+        for i in range(9) : 
+            result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+            if result == 1 : 
+                break
+            else : 
+                time.sleep(1)
+        t2 = time.time()
+        conv_time = t2 - t1
+        main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+        if result == 1 : 
+            main.log.report( "Convergence time of : %f seconds" % conv_time ) 
+            if float(conv_time) < float(main.params['TargetTime']) :
+                test=main.TRUE
+                main.log.info("Time is less then supplied target time")
+            else:
+                test=main.FALSE
+                main.log.info("Time is greater then supplied target time")
+        else : 
+            main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time ) 
+            test=main.FALSE
+ 
+        utilities.assert_equals(expect=main.TRUE,actual=test)
+
+    def CASE4(self,main) :
+        '''
+        Second case is to time the convergence time of a topology for ONOS. 
+        It shuts down the ONOS, drops keyspace, starts ONOS...
+        Then it evenly points all mininet switches to all ONOS nodes, but only one node, and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
+        '''
+        import time
+        main.log.report("Time convergence for switches -> one of all nodes in cluster")
+        main.case("Timing Onos Convergence for even single controller distribution")
+        main.step("Bringing ONOS down...") 
+        main.log.info("all switch no controllers") 
+        main.Mininet1.ctrl_none()
+        main.log.info("bringing ONOS down") 
+        main.ONOS1.stop()
+        main.ONOS2.stop()
+        main.ONOS3.stop()
+        main.ONOS4.stop()
+        main.log.info("Dropping keyspace...")
+        main.ONOS1.drop_keyspace()
+        time.sleep(5)
+        main.log.info("Bringing ONOS up")
+        main.ONOS1.start()
+        time.sleep(5) 
+        main.ONOS2.start()
+        main.ONOS3.start()
+        main.ONOS4.start()
+        main.ONOS1.isup()
+        main.ONOS2.isup()
+        main.ONOS3.isup()
+        main.ONOS4.isup()
+        main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+        main.log.info("Pointing the Switches to alternating controllers... then BEGIN time") 
+        main.Mininet1.ctrl_divide()
+        t1 = time.time()
+        for i in range(9) : 
+            result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+            if result == 1 : 
+                break
+            else : 
+                time.sleep(1)
+        t2 = time.time()
+        conv_time = t2 - t1
+        main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+        if result == 1 : 
+            main.log.report( "Convergence time of : %f seconds" % conv_time ) 
+            if float(conv_time) < float(main.params['TargetTime']) :
+                test=main.TRUE
+                main.log.info("Time is less then supplied target time")
+            else:
+                test=main.FALSE
+                main.log.info("Time is greater then supplied target time")
+        else : 
+            main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time ) 
+            test=main.FALSE
+ 
+        main.ONOS1.stop()
+        utilities.assert_equals(expect=main.TRUE,actual=test)
+
diff --git a/TestON/tests/OnosScale4nodes/OnosScale4nodes.topo b/TestON/tests/OnosScale4nodes/OnosScale4nodes.topo
new file mode 100644
index 0000000..69ba473
--- /dev/null
+++ b/TestON/tests/OnosScale4nodes/OnosScale4nodes.topo
@@ -0,0 +1,87 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOS1>
+            <host>10.128.100.1</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>7</connect_order>
+        </ONOS1>
+        <ONOS2>
+            <host>10.128.100.4</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>8</connect_order>
+        </ONOS2>
+        <ONOS3>
+            <host>10.128.100.5</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>9</connect_order>
+        </ONOS3>
+        <ONOS4>
+            <host>10.128.100.6</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>10</connect_order>
+        </ONOS4>
+
+        <Zookeeper1>
+            <host>10.128.100.1</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>ZookeeperCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </Zookeeper1>
+
+        <Cassandra1>
+            <host>10.128.100.1</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>CassandraCliDriver</type>
+            <connect_order>3</connect_order>
+        </Cassandra1>
+        <Cassandra2>
+            <host>10.128.100.4</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>CassandraCliDriver</type>
+            <connect_order>4</connect_order>
+        </Cassandra2>
+        <Cassandra3>
+            <host>10.128.100.5</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>CassandraCliDriver</type>
+            <connect_order>5</connect_order>
+        </Cassandra3>
+        <Cassandra4>
+            <host>10.128.100.6</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>CassandraCliDriver</type>
+            <connect_order>6</connect_order>
+        </Cassandra4>
+
+        <Mininet1>
+            <host>10.128.100.4</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>25</connect_order>
+            <COMPONENTS>
+                # Specify the Option for mininet
+                <arg1> </arg1>
+                <arg2> --topo linear,100 </arg2>
+                <controller> remote </controller>
+             </COMPONENTS>
+        </Mininet1>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/OnosScale4nodes/__init__.py b/TestON/tests/OnosScale4nodes/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/OnosScale4nodes/__init__.py
diff --git a/TestON/tests/OnosScale4nodes/check_status.py b/TestON/tests/OnosScale4nodes/check_status.py
new file mode 100755
index 0000000..c725cec
--- /dev/null
+++ b/TestON/tests/OnosScale4nodes/check_status.py
@@ -0,0 +1,111 @@
+#! /usr/bin/env python
+import json
+import os
+import sys
+
+# http://localhost:8080/wm/core/topology/switches/all/json
+# http://localhost:8080/wm/core/topology/links/json
+# http://localhost:8080/wm/registry/controllers/json
+# http://localhost:8080/wm/registry/switches/json"
+
+def get_json(url):
+  try:
+    command = "curl -s %s" % (url)
+    result = os.popen(command).read()
+    parsedResult = json.loads(result)
+  except:
+    print "REST IF %s has issue" % command
+    parsedResult = ""
+
+  if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
+    print "REST %s returned code %s" % (command, parsedResult['code'])
+    parsedResult = ""
+
+  return parsedResult 
+
+def check_switch(RestIP,correct_nr_switch ):
+  buf = ""
+  retcode = 0
+  RestPort="8080"
+
+  url="http://%s:%s/wm/core/topology/switches/all/json" % (RestIP, RestPort)
+  parsedResult = get_json(url)
+
+  if parsedResult == "":
+    retcode = 1
+    return (retcode, "Rest API has an issue")
+
+  url = "http://%s:%s/wm/registry/switches/json" % (RestIP, RestPort)
+  registry = get_json(url)
+
+  if registry == "":
+    retcode = 1
+    return (retcode, "Rest API has an issue")
+
+
+  buf += "switch: total %d switches\n" % len(parsedResult)
+  cnt = 0
+  active = 0
+
+  for s in parsedResult:
+    cnt += 1
+
+    if s['state']  == "ACTIVE":
+      active += 1
+
+    if not s['dpid'] in registry:
+      buf += "switch:  dpid %s lost controller\n" % (s['dpid'])
+
+  buf += "switch: network %d : %d switches %d active\n" % (0+1, cnt, active)
+  if correct_nr_switch != cnt:
+    buf += "switch fail: network %d should have %d switches but has %d\n" % (1, correct_nr_switch, cnt)
+    retcode = 1
+
+  if correct_nr_switch != active:
+    buf += "switch fail: network %d should have %d active switches but has %d\n" % (1, correct_nr_switch, active)
+    retcode = 1
+
+  return (retcode, buf)
+
+def check_link(RestIP, nr_links):
+  RestPort = "8080"
+  buf = ""
+  retcode = 0
+
+  url = "http://%s:%s/wm/core/topology/links/json" % (RestIP, RestPort)
+  parsedResult = get_json(url)
+
+  if parsedResult == "":
+    retcode = 1
+    return (retcode, "Rest API has an issue")
+
+  buf += "link: total %d links (correct : %d)\n" % (len(parsedResult), nr_links)
+  intra = 0
+  interlink=0
+
+  for s in parsedResult:
+    intra = intra + 1 
+
+  if intra != nr_links:
+    buf += "link fail: network %d should have %d intra links but has %d\n" % (1, nr_links, intra)
+    retcode = 1
+
+  return (retcode, buf)
+
+#if __name__ == "__main__":
+def check_status(ip, numoswitch, numolink):
+
+  switch = check_switch(ip, numoswitch)
+  link = check_link(ip, numolink)
+  value = switch[0]
+  value += link[0]
+  if value != 0:
+    print "FAIL"
+    return 0
+  else: 
+    print "PASS"
+    return 1
+  print "%s" % switch[1]
+  print "%s" % link[1]
+ # print "%s" % check_switch_local()[1]
+ # print "%s" % check_controllers(8)[1]