add case 7 for I2, add new drivers

Change-Id: Idf2b06b1a80989f0c7a61435b84f05a1a50aae34
diff --git a/TestON/tests/USECASE_SdnipI2/Dependency/Functions.py b/TestON/tests/USECASE_SdnipI2/Dependency/Functions.py
index 16c8bf1..732ff41 100644
--- a/TestON/tests/USECASE_SdnipI2/Dependency/Functions.py
+++ b/TestON/tests/USECASE_SdnipI2/Dependency/Functions.py
@@ -10,17 +10,32 @@
     utilities.assertEquals( \
         expect = routeNumExpected, actual = routeNumActual,
         onpass = "***Route number is correct!***",
-        onfail = "***Routes number is wrong!***" )
+        onfail = "***Route number is wrong!***" )
 
 def checkM2SintentNum( main, intentNumExpected ):
     main.step( "Check M2S intents installed" )
     main.log.info( "Intent number expected:" )
     main.log.info( intentNumExpected )
     main.log.info( "Intent number from ONOS CLI:" )
-    intentNumActual = main.ONOScli.m2SIntentInstalledNumber()
+    jsonResult = main.ONOScli.intents( jsonFormat = True, summary = True,
+                                       TYPE = "multiPointToSinglePoint" )
+    intentNumActual = jsonResult['installed']
     main.log.info( intentNumActual )
     utilities.assertEquals( \
         expect = intentNumExpected, actual = intentNumActual,
-        onpass = "***Intents number is correct!***",
-        onfail = "***Intents number is wrong!***" )
+        onpass = "***M2S intent number is correct!***",
+        onfail = "***M2S intent number is wrong!***" )
 
+def checkP2PintentNum( main, intentNumExpected ):
+    main.step( "Check P2P intents installed" )
+    main.log.info( "Intent number expected:" )
+    main.log.info( intentNumExpected )
+    main.log.info( "Intent number from ONOS CLI:" )
+    jsonResult = main.ONOScli.intents( jsonFormat = True, summary = True,
+                                       TYPE = "pointToPoint" )
+    intentNumActual = jsonResult['installed']
+    main.log.info( intentNumActual )
+    utilities.assertEquals( \
+        expect = intentNumExpected, actual = intentNumActual,
+        onpass = "***P2P intent number is correct!***",
+        onfail = "***P2P intent number is wrong!***" )
diff --git a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.params b/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.params
index 15a4941..fd65488 100644
--- a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.params
+++ b/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.params
@@ -1,6 +1,6 @@
 <PARAMS>
 
-    <testcases>100, 101, 102, 5, 6</testcases>
+    <testcases>100, 101, 102, 7, 8, 1, 4</testcases>
 
     #Environment variables
     <ENV>
diff --git a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.py b/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.py
index 14d5cb8..6808576 100644
--- a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.py
+++ b/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.py
@@ -329,6 +329,63 @@
         else:
             main.log.info( "Bring up link failed!!!" )
             main.exit();
+        '''
+        Note: at the end of this test case, we should carry out ping test.
+        So we run CASE4 again after CASE6
+        '''
+
+
+    def CASE7(self, main):
+        '''
+        shut down a edge switch, check P-2-P and M-2-S intents, ping test
+        '''
+        import time
+        main.case( "This case is to stop 1 edge switch,\
+        check P-2-P and M-2-S intents, ping test")
+        main.step( "Stop sw32" )
+        result = main.Mininet.switch( SW = "sw32", OPTION = "stop" )
+        if result == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 2 )
+            main.Functions.checkM2SintentNum( main, 2 )
+            main.Functions.checkP2PintentNum( main, 12 )
+        else:
+            main.log.info( "Stop switch failed!!!" )
+            main.exit();
+
+        '''
+        main.step( "Stop sw8" )
+        result = main.Mininet.switch( SW = "sw8", OPTION = "stop" )
+        if result == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 1 )
+
+            # Note: there should be 0 M2S intent, not 1.
+            main.Functions.checkM2SintentNum( main, 0 )
+            main.Functions.checkP2PintentNum( main, 6 )
+        else:
+            main.log.info( "Stop switch failed!!!" )
+            main.exit();
+
+        main.step( "Stop sw28" )
+        result = main.Mininet.switch( SW = "sw28", OPTION = "stop" )
+        if result == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 0 )
+            main.Functions.checkM2SintentNum( main, 0 )
+            main.Functions.checkP2PintentNum( main, 0 )
+        else:
+            main.log.info( "Stop switch failed!!!" )
+            main.exit();
+        '''
+        '''
+        ping test between BGP speaker and BGP peers, ping test between hosts
+        behind BGP peers ===
+        '''
+
+    def CASE8( self, main ):
+        main.case( "This case is to bring up 1 edge switch,\
+        check P-2-P and M-2-S intents, ping test" )
 
 
     def CASE20( self, main ):