add case 7 for I2, add new drivers

Change-Id: Idf2b06b1a80989f0c7a61435b84f05a1a50aae34
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 1d75ae4..1e22267 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -1235,6 +1235,29 @@
             main.exit()
         return main.TRUE
 
+    def switch( self, **switchargs ):
+        """
+           start/stop a switch
+        """
+        args = utilities.parse_args( [ "SW", "OPTION" ], **switchargs )
+        sw = args[ "SW" ] if args[ "SW" ] is not None else ""
+        option = args[ "OPTION" ] if args[ "OPTION" ] is not None else ""
+        command = "switch " + str( sw ) + " " + str( option )
+        main.log.info( command )
+        try:
+            self.handle.sendline( command )
+            self.handle.expect( "mininet>" )
+        except pexpect.TIMEOUT:
+            main.log.error( self.name + ": pexpect.TIMEOUT found" )
+            main.cleanup()
+            main.exit()
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        return main.TRUE
+
     def yank( self, **yankargs ):
         """
            yank a mininet switch interface to a host"""
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index a361aca..32aef33 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1787,43 +1787,35 @@
             main.cleanup()
             main.exit()
 
-    def intents( self, jsonFormat=True ):
+    def intents( self, jsonFormat = True, summary = False, **intentargs):
         """
         Optional:
             * jsonFormat: enable output formatting in json
+            * summary: whether only output the intent summary
+            * type: only output a certain type of intent
+              This options is valid only when jsonFormat is true and summary is
+              true
         Description:
-            Obtain intents currently installed
+            Obtain intents
         """
         try:
             cmdStr = "intents"
+            if summary:
+                cmdStr += " -s"
             if jsonFormat:
                 cmdStr += " -j"
             handle = self.sendline( cmdStr )
-            return handle
-        except TypeError:
-            main.log.exception( self.name + ": Object not as expected" )
-            return None
-        except pexpect.EOF:
-            main.log.error( self.name + ": EOF exception found" )
-            main.log.error( self.name + ":    " + self.handle.before )
-            main.cleanup()
-            main.exit()
-        except Exception:
-            main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
-
-    def m2SIntentInstalledNumber( self ):
-        """
-        Description:
-            Obtain the number of multiple point to single point intents
-            installed
-        """
-        try:
-            cmdStr = "intents -s -j"
-            handle = self.sendline( cmdStr )
-            jsonResult = json.loads( handle )
-            return jsonResult['multiPointToSinglePoint']['installed']
+            args = utilities.parse_args( [ "TYPE" ], **intentargs )
+            type = args[ "TYPE" ] if args[ "TYPE" ] is not None else ""
+            if jsonFormat and summary and ( type != "" ):
+                jsonResult = json.loads( handle )
+                if type in jsonResult.keys():
+                    return jsonResult[ type ]
+                else:
+                    main.log.error( "unknown TYPE, return all types of intents" )
+                    return handle
+            else:
+                return handle
 
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
@@ -1838,6 +1830,7 @@
             main.cleanup()
             main.exit()
 
+
     def getIntentState(self, intentsId, intentsJson=None):
         """
             Check intent state.