Sample app activation functionality platform test
diff --git a/TestON/tests/FuncPlatform/Dependency/App.py b/TestON/tests/FuncPlatform/Dependency/App.py
new file mode 100644
index 0000000..f6fecd6
--- /dev/null
+++ b/TestON/tests/FuncPlatform/Dependency/App.py
@@ -0,0 +1,42 @@
+
+def __init__( self ):
+    self.ip = '127.0.0.1'
+
+def activate( apps, nodeToActivateFrom=0 ):
+    """
+    Activate specified applications from node specified
+
+    Ex) apps = ['metrics', 'fwd']
+        nodeToActivateFrom = range( 0, nodes )
+    """
+    if isinstance( apps, ( int, basestring ) ):
+        main.log.error( "Please pass in a list of strings for args" )
+        return main.FALSE
+
+    if not isinstance( nodeToActivateFrom, ( int ) ) or \
+            nodeToActivateFrom < 0:
+        main.log.error( "Incorrect node specified" )
+        return main.FALSE
+
+    for app in apps:
+        # Check if app str in appList is in the main scope
+        # definition main.appList
+        if app not in main.appList:
+            main.log.error( "Invalid app name given" )
+            return main.FALSE
+      
+        # NOTE: assumes node 1 is always activating application
+        appOutput = main.CLIs[nodeToActivateFrom].activateApp( 
+                main.appList[app] ) 
+
+    return main.TRUE
+
+def isAppInstallSuccess():
+    """
+    Check the app list across clusters to determine
+    that apps have been installed successfully
+
+    """
+
+    main.log.report( "isAppInstallSuccess" )
+
diff --git a/TestON/tests/FuncPlatform/Dependency/Startup.py b/TestON/tests/FuncPlatform/Dependency/Startup.py
index 665be7f..3096eee 100644
--- a/TestON/tests/FuncPlatform/Dependency/Startup.py
+++ b/TestON/tests/FuncPlatform/Dependency/Startup.py
@@ -8,6 +8,7 @@
     * Return main.TRUE on success or comprehensive error message 
       on failure (TBD)
 """
+import time
 
 def __init__( self ):
     self.ip = '127.0.0.1' 
@@ -35,17 +36,41 @@
         # TODO: Comprehensive error message
         return 'git pull and mci failed'
 
-def initOnosStartupSequence( cellName, appsStr, benchIp, onosIps ):
+def initOnosStartupSequence( cellName, appStr, benchIp, mnIp, onosIps ):
     """
     Startup sequence includes the following:
-        * 
+        * Create cell file
+        * Set cell variables on ONOS bench
+        * Verify cell
+        * Create ONOS package
+        * Force install ONOS package
+        * Start ONOS service
+        * Start ONOS cli
     """
-    main.log.info( 'Initiating ONOS startup sequence' )
 
-def isOnosNormal( onosIps ):
-    """
-    Quick and comprehensive check for 'normality'
+    # NOTE: leave out create cell file until bug addressed
+    #cf = main.ONOSbench.createCellFile( benchIp, cellName, mnIp, 
+    #        str(appStr), *onosIps )
+    numNodes = len(onosIps) 
 
-    Definition of function TBD
-    """
-    main.log.info( 'isOnosNormal' )
+    sc = main.ONOSbench.setCell( cellName )
+    vc = main.ONOSbench.verifyCell()
+    op = main.ONOSbench.onosPackage()
+    for addr in onosIps:
+        oi = main.ONOSbench.onosInstall( node = addr )
+    
+    time.sleep( 5 )
+   
+    iu = main.TRUE
+    for node in onosIps:
+        iu = iu and main.ONOSbench.isup( node )
+   
+    cli = main.TRUE
+    for node in range( 0, numNodes ):
+        cli = cli and main.CLIs[node].startOnosCli( onosIps[node] )
+
+    if sc and vc and op and oi and iu and cli == main.TRUE:
+        return main.TRUE
+    else:
+        return main.FALSE
+
diff --git a/TestON/tests/FuncPlatform/FuncPlatform.params b/TestON/tests/FuncPlatform/FuncPlatform.params
index e0c40aa..eb274ae 100644
--- a/TestON/tests/FuncPlatform/FuncPlatform.params
+++ b/TestON/tests/FuncPlatform/FuncPlatform.params
@@ -1,11 +1,20 @@
 <PARAMS>
-    <testcases>1,2</testcases>
-    <startupSrc>
-        /home/admin/ONLabTest/TestON/tests/FuncPlatform/Dependency/Startup.py
-    </startupSrc>
-    <startupClassName>
-        Startup
-    </startupClassName>
+    <testcases>1,2,3</testcases>
+    <DEP>
+        <startupSrc>
+            /home/admin/ONLabTest/TestON/tests/FuncPlatform/Dependency/Startup.py
+        </startupSrc>
+        <startupClassName>
+            Startup
+        </startupClassName>
+        
+        <appSrc>
+            /home/admin/ONLabTest/TestON/tests/FuncPlatform/Dependency/App.py
+        </appSrc>
+        <appClassName>
+            App
+        </appClassName>
+    </DEP> 
 
     <CTRL>
         <num>3</num>
@@ -14,7 +23,20 @@
         <ip2>10.128.174.2</ip2>
         <ip3>10.128.174.3</ip3>
     </CTRL>
-    
+  
+    <MN>
+        <ip>10.128.10.90</ip>
+    </MN>
+
+    <BENCH>
+        <ip>10.128.174.10</ip>
+    </BENCH>
+
+    <CELL>
+        <name>func_plat</name>
+        <appStr>"drivers,openflow"</appStr>
+    </CELL>
+
     <GIT>
         <branchName>master</branchName>
         <pull>off</pull>
diff --git a/TestON/tests/FuncPlatform/FuncPlatform.py b/TestON/tests/FuncPlatform/FuncPlatform.py
index f846131..6bcb06c 100644
--- a/TestON/tests/FuncPlatform/FuncPlatform.py
+++ b/TestON/tests/FuncPlatform/FuncPlatform.py
@@ -2,11 +2,23 @@
 FuncPlatform
 
 A functional test designed to test the environment and 
-gather startup / shutdown related issues.
+gather information on startup -> shutdown related issues.
 
 Future works may also include security mode startup /
 shutdown check and cfg get and set.
 
+Abstracting the collection of commands that go hand in hand 
+should allow easy rearrangement of steps to replicate or 
+create scenarios. 
+For example:
+    CASE N - Represents a particular scenario
+        Steps - Represents abstraction methods called from 
+                dependency
+        1. Bring ONOS 1 up
+        2. Activate application X
+        3. Activate application Y
+        4. Deactivate application X
+
 contributers to contact for help:
 andrew@onlab.us
 """
@@ -16,8 +28,48 @@
         self.default = ''
 
     def CASE1( self, main ):
+        """
+        Main scope initialization case
+        """   
+        main.appList = { 
+            'bgprouter' : 'org.onosproject.bgprouter',
+            'config' : 'org.onosproject.config',
+            'cordfabric' : 'org.onosproject.cordfabric',
+            'demo' : 'org.onosproject.demo',
+            'distributedprimitives' : 'org.onosproject.distributedprimitives',
+            'election' : 'org.onosproject.election',
+            'flowrule' : 'org.onosproject.flowrule',
+            'fwd' : 'org.onosproject.fwd',
+            'intentperf' : 'org.onosproject.intentperf',
+            'messagingperf' : 'org.onosproject.messagingperf',
+            'metrics' : 'org.onosproject.metrics',
+            'mobility' : 'org.onosproject.mobility',
+            'netconf' : 'org.onosproject.netconf', 
+            'null' : 'org.onosproject.null',
+            'optical' : 'org.onosproject.optical'
+            } 
+        # List of ONOS ip's specififed in params
+        main.ONOSips = [] 
+        main.CLIs = []
+
+        for node in range( 0, int(main.params['CTRL']['num']) ):
+            main.ONOSips.append( main.params['CTRL']['ip'+str(node+1)] )
+            main.CLIs.append(
+                    getattr( main, 'ONOS' + str(node+1) + 'cli' ) )
+       
+    def CASE2( self, main ):
         import time
         import imp
+
+        startupSrc = main.params['DEP']['startupSrc']
+        startupClassName = main.params['DEP']['startupClassName']
+        cellName = main.params['CELL']['name']
+        appStr = main.params['CELL']['appStr']
+        benchIp = main.params['BENCH']['ip']
+        branchName = main.params['GIT']['branchName']
+        gitPull = main.params['GIT']['pull']
+        mnIp = main.params['MN']['ip']
+
         # importing dependency class(es)
         # Refer to source files in Dependency folder to
         # make changes to its respective methods
@@ -29,23 +81,6 @@
             main.cleanup()
             main.exit()
 
-        # List of ONOS ip's specififed in params
-        global ONOSips
-        # CLIs handle for each ONOS CLI client specified in .topo file
-        global CLIs
-
-        ONOSips = []
-        CLIs = []
-
-        for node in range( 0, int(main.params['CTRL']['num']) ):
-            ONOSips.append( main.params['CTRL']['ip'+str(node+1)] )
-            CLIs.append( getattr( main, 'ONOS' + str(i) + 'cli' ) )
-
-        startupSrc = main.params['startupSrc']
-        startupClassName = main.params['startupClassName']
-        branchName = main.params['GIT']['branchName']
-        gitPull = main.params['GIT']['pull']
-
         main.case( 'Setup environment and install ONOS' )
         if gitPull == 'on': 
             main.step( 'Git pull and clean install' )
@@ -57,12 +92,41 @@
                             str(gitPullResult) )
         
         main.step( 'Initiate ONOS startup sequence' )    
-        startupResult = startup.initOnosStartupSequence()
+        startupResult = startup.initOnosStartupSequence(
+                cellName, appStr, benchIp, mnIp, main.ONOSips )
         utilities.assert_equals( expect=main.TRUE,
                         actual=startupResult,
                         onpass='ONOS startup sequence successful',
                         onfail='ONOS startup sequence failed: ' +
                             str(startupResult) )
+        
+    def CASE3( self, main ):
+        import time
+        import imp
 
-    def CASE2( self, main ):
-        main.log.info( "Case 2" )
+        main.case( 'Activate applications and check installation' )
+        # Activate applications and check consistency 
+        # across clusters
+        appClassName = main.params['DEP']['appClassName']
+        appSrc = main.params['DEP']['appSrc']
+
+        # Import application file to use its methods
+        try:
+            app = imp.load_source( appClassName, appSrc )
+        except ImportError:
+            main.log.error( "Error importing class " +
+                    str(startupClassName) + " from " + str(startupSrc) )
+            main.cleanup()
+            main.exit()
+
+        # Sample app activation
+        main.step( 'Activating applications metrics and fwd' ) 
+        appList = ['metrics', 'fwd']
+        appResult = app.activate( appList ) 
+        utilities.assert_equals( expect=main.TRUE,
+                actual=appResult,
+                onpass= 'App activation of ' + str(appList) + ' successful',
+                onfail= 'App activation failed ' + str(appResult) )
+
+
+