Merging conflicts
Merge branch 'ONOS-Next' of https://github.com/OPENNETWORKINGLAB/ONLabTest into ONOS-Next
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index c03db3d..9c225f1 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -17,8 +17,6 @@
 
 '''
 
-#TODO: Document
-
 import sys
 import time
 import pexpect
@@ -428,6 +426,52 @@
             main.cleanup()
             main.exit()
 
+    def onos_cli(self, ONOS_ip, cmdstr):
+        '''
+        Uses 'onos' command to send various ONOS CLI arguments.
+        Required:
+            * ONOS_ip: specify the ip of the cell machine
+            * cmdstr: specify the command string
+        '''
+        try:
+            if not ONOS_ip:
+                main.log.error("You must specify the IP address")
+                return main.FALSE
+            if not cmdstr:
+                main.log.error("You must specify the command string")
+                return main.FALSE
+
+            cmdstr = str(cmdstr)
+            self.handle.sendline("")
+            self.handle.expect("\$")
+
+            self.handle.sendline("onos -w " + ONOS_ip + " " + cmdstr)
+            self.handle.expect("\$")
+
+            handle_before = str(self.handle.before)
+            handle_after = str(self.handle.after)
+            
+            self.handle.sendline("")
+            self.handle.expect("\$")
+            handle_more = str(self.handle.before)
+
+            main.log.info("Command sent successfully")
+
+            return_string = handle_before + handle_after + handle_more
+
+            return return_string
+
+        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 onos_install(self, options="-f", node = ""):
         '''
@@ -650,3 +694,5 @@
             main.log.info(self.name+" ::::::")
             main.cleanup()
             main.exit()
+
+
diff --git a/TestON/tests/ONOSNextTest/ONOSNextTest.params b/TestON/tests/ONOSNextTest/ONOSNextTest.params
index 14ecfbc..0d7ff11 100755
--- a/TestON/tests/ONOSNextTest/ONOSNextTest.params
+++ b/TestON/tests/ONOSNextTest/ONOSNextTest.params
@@ -1,6 +1,6 @@
 <PARAMS>
     
-    <testcases>1,2</testcases>
+    <testcases>1,3</testcases>
 
     #Environment variables
     <ENV>
diff --git a/TestON/tests/ONOSNextTest/ONOSNextTest.py b/TestON/tests/ONOSNextTest/ONOSNextTest.py
index 6f24483..c812295 100755
--- a/TestON/tests/ONOSNextTest/ONOSNextTest.py
+++ b/TestON/tests/ONOSNextTest/ONOSNextTest.py
@@ -84,7 +84,7 @@
                 onpass="Test startup successful",
                 onfail="Test startup NOT successful")
 
-    def CASE2(self, main):
+    def CASE11(self, main):
         '''
         Cleanup sequence:
         onos-service <node_ip> stop
@@ -107,3 +107,16 @@
         main.step("Uninstalling ONOS service") 
         uninstall_result = main.ONOSbench.onos_uninstall()
 
+    def CASE3(self, main):
+        '''
+        Test 'onos' command and its functionality in driver
+        '''
+        
+        ONOS1_ip = main.params['CTRL']['ip1']
+        cmdstr = "system:name"
+
+        main.case("Testing 'onos' command")
+
+        main.step("Sending command 'onos -w <onos-ip> system:name")
+        cmd_result = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr) 
+        print cmd_result