Adding shell push test intent to onosdriver, modifying pexpect maxread and timeout
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index feca717..3a33619 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -468,11 +468,12 @@
             main.cleanup()
             main.exit()
         
-    def devices(self, json_format=True, grep_str=""):
+    def devices(self, json_format=True, grep_str="",node_ip=""):
         '''
         Lists all infrastructure devices or switches
         Optional argument:
-            * grep_str - pass in a string to grep
+            * grep_str : pass in a string to grep
+            * node_ip : used to reattempt CLI connection
         '''
         try:
             self.handle.sendline("")
@@ -482,12 +483,36 @@
                 if not grep_str:
                     self.handle.sendline("devices -j")
                     self.handle.expect("devices -j")
-                    self.handle.expect("onos>")
+                    i = self.handle.expect([
+                        "onos>", "\$", pexpect.TIMEOUT])
+                    if (i == 1 or i == 2) and node_ip:
+                        self.handle.sendline("onos -w "+node_ip)
+                        self.handle.expect("onos>")
+                        self.handle.sendline("devices -j")
+                        self.handle.expect("devices -j")
+                    elif not node_ip and i == 2: 
+                        main.log.info("ONOS CLI exited. Please "+
+                            "provide node_ip in the function to "+
+                            "attempt to reconnect")
                 else:
                     self.handle.sendline("devices -j | grep '"+
                         str(grep_str)+"'")
                     self.handle.expect("devices -j | grep '"+str(grep_str)+"'")
-                    self.handle.expect("onos>")
+                    i = self.handle.expect([
+                        "onos>","\$", pexpect.TIMEOUT])
+
+                    if (i == 1 or i == 2) and node_ip:
+                        main.log.info("CLI dropped. Logging back into"+
+                            " ONOS")
+                        self.handle.sendline("onos -w "+node_ip)
+                        self.handle.expect("onos>")
+                        self.handle.sendline("devices -j")
+                        self.handle.expect("devices -j")
+                    elif not node_ip and i == 2:
+                        main.log.info("ONOS CLI exited. Please "+
+                            "provide node_ip in the function to "+
+                            "attempt to reconnect")
+                
                 handle = self.handle.before
                 '''
                 handle variable here contains some ANSI escape color code sequences at the end which are invisible in the print command output
@@ -1250,8 +1275,8 @@
             main.cleanup()
             main.exit()
 
-    def push_test_intents(self, dpid_src, dpid_dst, num_intents,
-            report=True):
+    def push_test_intents(self, dpid_src, dpid_dst, num_intents, 
+            num_mult="", app_id="", report=True):
         '''
         Description:
             Push a number of intents in a batch format to 
@@ -1261,12 +1286,22 @@
             * dpid_dst: specify destination dpid
             * num_intents: specify number of intents to push
         Optional:
+            * num_mult: number multiplier for multiplying
+              the number of intents specified
+            * app_id: specify the application id init to further
+              modularize the intents
             * report: default True, returns latency information
         '''
         try:
             cmd = "push-test-intents "+\
                   str(dpid_src)+" "+str(dpid_dst)+" "+\
                   str(num_intents)
+            
+            if num_mult:
+                cmd += " " + str(num_mult)
+                if app_id:
+                    cmd += " " + str(app_id)
+            
             self.handle.sendline(cmd)
             self.handle.expect(cmd)
             self.handle.expect("onos>")
@@ -1278,8 +1313,20 @@
             handle = ansi_escape.sub('', handle)
     
             if report:
+                lat_result = []
                 main.log.info(handle)
-                return handle
+                #Split result by newline
+                newline = handle.split("\r\r\n")
+                #Ignore the first object of list, which is empty
+                newline = newline[1:]
+                #Some sloppy parsing method to get the latency
+                for result in newline:
+                    result = result.split(": ")
+                    #Append the first result of second parse
+                    lat_result.append(result[1].split(" ")[0])
+
+                print lat_result 
+                return lat_result 
             else:
                 return main.TRUE
 
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 8489c98..0c01e9f 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -955,6 +955,52 @@
             main.cleanup()
             main.exit()
 
+    def push_test_intents_shell(self, dpid_src, dpid_dst, num_intents,
+            dir_file, onos_ip, num_mult="", app_id="", report=True):    
+        '''  
+        Description:
+            Use the linux prompt to push test intents to 
+            better parallelize the results than the CLI
+        Required:
+            * dpid_src: specify source dpid
+            * dpid_dst: specify destination dpid
+            * num_intents: specify number of intents to push
+            * dir_file: specify directory and file name to save
+              results
+            * onos_ip: specify the IP of ONOS to install on
+        NOTE: 
+            You must invoke this command at linux shell prompt
+        '''
+        try: 
+            #Create the string to sendline 
+            base_cmd = "onos "+str(onos_ip)+" push-test-intents "
+            add_dpid = base_cmd + str(dpid_src) + " " + str(dpid_dst)  
+            if not num_mult:
+                add_intents = add_dpid + " " + str(num_intents)
+            elif num_mult:
+                add_intents = add_dpid + " " + str(num_intents) + " " +\
+                              str(num_mult)
+                if app_id:
+                    add_app = add_intents + " " + str(app_id) 
+                else:
+                    add_app = add_intents
+
+            send_cmd = add_app + " > " + str(dir_file) + " &" 
+            main.log.info("Send cmd: "+send_cmd)
+
+            self.handle.sendline(send_cmd)
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit() 
 
     def get_topology(self,topology_output):
         '''
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index 9ae90fb..797473d 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -50,7 +50,7 @@
         if self.port:
             self.handle =pexpect.spawn('ssh -p '+self.port+' '+self.user_name+'@'+self.ip_address,maxread=50000)
         else :
-            self.handle =pexpect.spawn('ssh -X '+self.user_name+'@'+self.ip_address,maxread=50000)
+            self.handle =pexpect.spawn('ssh -X '+self.user_name+'@'+self.ip_address,maxread=1000000,timeout=60)
 
         self.handle.logfile = self.logfile_handler
 	i = 5