Fix a few more app startup/shutdown problems

Change-Id: Ideb48a1e845ae345306fa10ec55499c471566ce7
diff --git a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
index 6ee27a3..eb3d873 100644
--- a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
+++ b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
@@ -84,6 +84,7 @@
 
     private DeviceListener deviceListener;
     private IcmpHandler icmpHandler;
+    private BgpConfig bgpConfig = null;
 
     private static List<String> components = new ArrayList<>();
     static {
@@ -100,11 +101,10 @@
         components.forEach(name -> componentService.activate(appId, name));
 
         ApplicationId routerAppId = coreService.getAppId(RoutingService.ROUTER_APP_ID);
-        BgpConfig bgpConfig =
-                networkConfigService.getConfig(routerAppId, RoutingService.CONFIG_CLASS);
+        bgpConfig = networkConfigService.getConfig(routerAppId, RoutingService.CONFIG_CLASS);
 
         if (bgpConfig == null) {
-            log.error("No BgpConfig found");
+            log.warn("No BgpConfig found");
             return;
         }
 
@@ -137,9 +137,11 @@
 
         RoutingConfiguration.unregister(networkConfigService);
 
-        connectivityManager.stop();
-        icmpHandler.stop();
-        deviceService.removeListener(deviceListener);
+        if (bgpConfig != null) {
+            connectivityManager.stop();
+            icmpHandler.stop();
+            deviceService.removeListener(deviceListener);
+        }
 
         log.info("BgpRouter stopped");
     }
diff --git a/apps/castor/src/main/java/org/onosproject/castor/CastorArpManager.java b/apps/castor/src/main/java/org/onosproject/castor/CastorArpManager.java
index 3d6e7d0..ff7ec6b 100644
--- a/apps/castor/src/main/java/org/onosproject/castor/CastorArpManager.java
+++ b/apps/castor/src/main/java/org/onosproject/castor/CastorArpManager.java
@@ -116,10 +116,12 @@
      * Withdraws the requested ARP packets.
      */
     private void withdrawIntercepts() {
-        TrafficSelector.Builder selectorBuilder =
+        if (deviceID != null && deviceID.isPresent()) {
+            TrafficSelector.Builder selectorBuilder =
                 DefaultTrafficSelector.builder();
-        selectorBuilder.matchEthType(TYPE_ARP);
-        packetService.cancelPackets(selectorBuilder.build(), CONTROL, appId, deviceID);
+            selectorBuilder.matchEthType(TYPE_ARP);
+            packetService.cancelPackets(selectorBuilder.build(), CONTROL, appId, deviceID);
+        }
     }
 
     /**
diff --git a/apps/graphitemetrics/BUILD b/apps/graphitemetrics/BUILD
index a7ca902..0d3ea56 100644
--- a/apps/graphitemetrics/BUILD
+++ b/apps/graphitemetrics/BUILD
@@ -3,9 +3,10 @@
     "@metrics_graphite//jar",
 ]
 
-EXCLUDED_BUNDLES = [
+INCLUDED_BUNDLES = [
     "@gmetric4j//jar",
     "@metrics_graphite//jar",
+    "@remotetea_oncrpc//jar",
 ]
 
 osgi_jar_with_tests(
@@ -15,7 +16,7 @@
 onos_app(
     category = "Monitoring",
     description = "Performance metric service reporter and retriever for graphite",
-    excluded_bundles = EXCLUDED_BUNDLES,
+    included_bundles = INCLUDED_BUNDLES,
     title = "Graphite Report and Query",
     url = "http://onosproject.org",
 )
diff --git a/core/net/src/main/java/org/onosproject/cfg/impl/ConfigPropertyDefinitions.java b/core/net/src/main/java/org/onosproject/cfg/impl/ConfigPropertyDefinitions.java
index 8027287..0ecbf7e 100644
--- a/core/net/src/main/java/org/onosproject/cfg/impl/ConfigPropertyDefinitions.java
+++ b/core/net/src/main/java/org/onosproject/cfg/impl/ConfigPropertyDefinitions.java
@@ -18,6 +18,7 @@
 import com.google.common.collect.ImmutableSet;
 import org.onosproject.cfg.ConfigProperty;
 import org.onosproject.cfg.ConfigProperty.Type;
+import org.slf4j.Logger;
 
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -29,6 +30,7 @@
 import java.util.Set;
 
 import static org.onosproject.cfg.ConfigProperty.defineProperty;
+import static org.slf4j.LoggerFactory.getLogger;
 
 /**
  * Utility for writing and reading configuration property definition file.
@@ -39,6 +41,8 @@
     private static final String SEP = "\\|";
     private static final String COMMENT = "#";
 
+    private static final Logger log = getLogger(ConfigPropertyDefinitions.class);
+
     private ConfigPropertyDefinitions() {
     }
 
@@ -71,6 +75,7 @@
             while ((line = br.readLine()) != null) {
                 if (!line.isEmpty() && !line.startsWith(COMMENT)) {
                     String[] f = line.split(SEP, 4);
+                    log.info("Line is: {} length of array is: {}", line, f.length);
                     builder.add(defineProperty(f[0], Type.valueOf(f[1]), f[2], f[3]));
                 }
             }
diff --git a/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/Controller.java b/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/Controller.java
index 8e1006e..381109e 100644
--- a/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/Controller.java
+++ b/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/Controller.java
@@ -77,7 +77,9 @@
     public void isisDeactivate() {
         disconnectExecutor();
         processes = null;
-        peerExecFactory.shutdown();
+        if (peerExecFactory != null) {
+            peerExecFactory.shutdown();
+        }
     }
 
     /**
diff --git a/protocols/isis/ctl/src/test/java/org/onosproject/isis/controller/impl/ControllerTest.java b/protocols/isis/ctl/src/test/java/org/onosproject/isis/controller/impl/ControllerTest.java
index e78077d..a5396605 100644
--- a/protocols/isis/ctl/src/test/java/org/onosproject/isis/controller/impl/ControllerTest.java
+++ b/protocols/isis/ctl/src/test/java/org/onosproject/isis/controller/impl/ControllerTest.java
@@ -101,7 +101,7 @@
     /**
      * Tests isisDeactivate() method.
      */
-    @Test(expected = Exception.class)
+    @Test
     public void testIsisDeactivate() throws Exception {
         controller.isisDeactivate();
         assertThat(controller, is(notNullValue()));
diff --git a/protocols/isis/ctl/src/test/java/org/onosproject/isis/controller/impl/DefaultIsisControllerTest.java b/protocols/isis/ctl/src/test/java/org/onosproject/isis/controller/impl/DefaultIsisControllerTest.java
index 8ca412e..1ae1e58 100644
--- a/protocols/isis/ctl/src/test/java/org/onosproject/isis/controller/impl/DefaultIsisControllerTest.java
+++ b/protocols/isis/ctl/src/test/java/org/onosproject/isis/controller/impl/DefaultIsisControllerTest.java
@@ -87,7 +87,7 @@
     /**
      * Tests deactivate() method.
      */
-    @Test(expected = Exception.class)
+    @Test()
     public void testDeactivate() throws Exception {
         defaultIsisController.activate();
         defaultIsisController.deactivate();
diff --git a/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/impl/LispControllerImpl.java b/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/impl/LispControllerImpl.java
index 9fd5200..95535ad 100644
--- a/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/impl/LispControllerImpl.java
+++ b/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/impl/LispControllerImpl.java
@@ -75,18 +75,10 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected ComponentConfigService cfgService;
 
-    /**
-     * Authentication key which is used to calculate authentication data for
-     * LISP control message; default value is onos.
-     */
+    /** Authentication key which is used to calculate authentication data. */
     private String lispAuthKey = LISP_AUTH_KEY_DEFAULT;
 
-    /**
-     * Authentication key id which denotes the authentication method
-     * that ONOS uses to calculate the authentication data;
-     * 1 denotes HMAC SHA1 encryption, 2 denotes HMAC SHA256 encryption;
-     * default value is 1.
-     */
+    /** Authentication key id which denotes the authentication method used to calculate the authentication data. */
     private int lispAuthKeyId = LISP_AUTH_KEY_ID_DEFAULT;
 
     /** Enable to send SMR(Solicit Map Request) by map server; by default SMR is not activated. */
diff --git a/tools/package/features/BUILD b/tools/package/features/BUILD
index 451d707..6f3532c4 100644
--- a/tools/package/features/BUILD
+++ b/tools/package/features/BUILD
@@ -56,6 +56,7 @@
         "@sigar//jar",
         "@org_osgi_util_function//jar",
         "@org_osgi_util_promise//jar",
+        "@jaxb_api//jar",
     ],
     required_features = [],
     visibility = ["//visibility:public"],
diff --git a/tools/test/bin/onos-activate-all-scenario-default-app-list b/tools/test/bin/onos-activate-all-scenario-default-app-list
index 217f780..c990237 100644
--- a/tools/test/bin/onos-activate-all-scenario-default-app-list
+++ b/tools/test/bin/onos-activate-all-scenario-default-app-list
@@ -90,7 +90,7 @@
 simplefabric
 flowanalyzer
 null
-# throws rejected execution exception
+# Application cannot be shut down
 #transaction-perf
 drivers.server
 drivers.gnmi
@@ -101,9 +101,8 @@
 sdnip
 artemis
 flow-perf
-# app crashes on startup
-#lisp
-#drivers.lisp
+lisp
+drivers.lisp
 rabbitmq
 snmp
 newoptical
@@ -113,12 +112,10 @@
 routescale
 mcast
 segmentrouting
-# crashes during shutdown
-#bgprouter
+bgprouter
 protocols.xmpp
 openstacktelemetry
-# crashes during shutdown
-#castor
+castor
 drivers.ciena.c5162
 netcfg-monitor
 xmpp.device
@@ -135,8 +132,7 @@
 gangliametrics
 drivers.ciena.c5170
 drivers.oplink
-# missing dependency on startup
-# isis
+isis
 drivers.hp
 drivers.cisco.rest
 roadm
@@ -150,8 +146,7 @@
 drivers.fujitsu
 drivers.polatis.openflow
 layout
-# missing a dependency
-#graphitemetrics
+graphitemetrics
 powermanagement
 optical-rest
 tl1
diff --git a/tools/test/scenarios/app-activate-all.xml b/tools/test/scenarios/app-activate-all.xml
index 191673c..e1ab4e9 100644
--- a/tools/test/scenarios/app-activate-all.xml
+++ b/tools/test/scenarios/app-activate-all.xml
@@ -2400,9 +2400,57 @@
         </group>
 
 
-        <group name="App-Activate-All.rabbitmq" requires="App-Activate-All.flow-perf">
+        <group name="App-Activate-All.lisp" requires="App-Activate-All.flow-perf">
+           <step name="App-Activate-All.Activate-lisp"
+                 exec="onos ${OCI} app activate org.onosproject.lisp" requires="App-Activate-All.flow-perf"/>
+           <group name="App-Activate-All.App-Check-lisp" requires="App-Activate-All.Activate-lisp">
+              <parallel var="${OC#}">
+                 <step name="App-Activate-All.App-Check-${#}-lisp"
+                       exec="onos-check-apps ${OC#} lisp includes"/>
+                 <step name="App-Activate-All.Check-Logs-${#}-lisp" exec="onos-check-logs ${OC#}"/>
+              </parallel>
+           </group>
+           <step name="App-Activate-All.App-Deactivate-lisp"
+                 exec="onos ${OCI} app deactivate org.onosproject.lisp" requires="App-Activate-All.App-Check-lisp"/>
+           <step name="App-Activate-All.Wait-For-Deactivate-lisp"
+                 exec="onos-check-apps ${OCI} org.onosproject.drivers" requires="App-Activate-All.App-Deactivate-lisp"/>      
+           <group name="App-Activate-All.App-Check-After-lisp" requires="App-Activate-All.Wait-For-Deactivate-lisp">
+              <parallel var="${OC#}">
+                 <step name="App-Activate-All.Check-Logs-After-${#}-lisp" exec="onos-check-logs ${OC#}"/>
+              </parallel>
+           </group>
+           <step name="App-Activate-All.Minimal-Apps-lisp" requires="App-Activate-All.App-Deactivate-lisp"
+                 exec="onos-set-up-minimal-apps ${OCI}"/>
+        </group>
+
+
+        <group name="App-Activate-All.drivers.lisp" requires="App-Activate-All.lisp">
+           <step name="App-Activate-All.Activate-drivers.lisp"
+                 exec="onos ${OCI} app activate org.onosproject.drivers.lisp" requires="App-Activate-All.lisp"/>
+           <group name="App-Activate-All.App-Check-drivers.lisp" requires="App-Activate-All.Activate-drivers.lisp">
+              <parallel var="${OC#}">
+                 <step name="App-Activate-All.App-Check-${#}-drivers.lisp"
+                       exec="onos-check-apps ${OC#} drivers.lisp includes"/>
+                 <step name="App-Activate-All.Check-Logs-${#}-drivers.lisp" exec="onos-check-logs ${OC#}"/>
+              </parallel>
+           </group>
+           <step name="App-Activate-All.App-Deactivate-drivers.lisp"
+                 exec="onos ${OCI} app deactivate org.onosproject.drivers.lisp" requires="App-Activate-All.App-Check-drivers.lisp"/>
+           <step name="App-Activate-All.Wait-For-Deactivate-drivers.lisp"
+                 exec="onos-check-apps ${OCI} org.onosproject.drivers" requires="App-Activate-All.App-Deactivate-drivers.lisp"/>      
+           <group name="App-Activate-All.App-Check-After-drivers.lisp" requires="App-Activate-All.Wait-For-Deactivate-drivers.lisp">
+              <parallel var="${OC#}">
+                 <step name="App-Activate-All.Check-Logs-After-${#}-drivers.lisp" exec="onos-check-logs ${OC#}"/>
+              </parallel>
+           </group>
+           <step name="App-Activate-All.Minimal-Apps-drivers.lisp" requires="App-Activate-All.App-Deactivate-drivers.lisp"
+                 exec="onos-set-up-minimal-apps ${OCI}"/>
+        </group>
+
+
+        <group name="App-Activate-All.rabbitmq" requires="App-Activate-All.drivers.lisp">
            <step name="App-Activate-All.Activate-rabbitmq"
-                 exec="onos ${OCI} app activate org.onosproject.rabbitmq" requires="App-Activate-All.flow-perf"/>
+                 exec="onos ${OCI} app activate org.onosproject.rabbitmq" requires="App-Activate-All.drivers.lisp"/>
            <group name="App-Activate-All.App-Check-rabbitmq" requires="App-Activate-All.Activate-rabbitmq">
               <parallel var="${OC#}">
                  <step name="App-Activate-All.App-Check-${#}-rabbitmq"
@@ -2616,9 +2664,33 @@
         </group>
 
 
-        <group name="App-Activate-All.protocols.xmpp" requires="App-Activate-All.segmentrouting">
+        <group name="App-Activate-All.bgprouter" requires="App-Activate-All.segmentrouting">
+           <step name="App-Activate-All.Activate-bgprouter"
+                 exec="onos ${OCI} app activate org.onosproject.bgprouter" requires="App-Activate-All.segmentrouting"/>
+           <group name="App-Activate-All.App-Check-bgprouter" requires="App-Activate-All.Activate-bgprouter">
+              <parallel var="${OC#}">
+                 <step name="App-Activate-All.App-Check-${#}-bgprouter"
+                       exec="onos-check-apps ${OC#} bgprouter includes"/>
+                 <step name="App-Activate-All.Check-Logs-${#}-bgprouter" exec="onos-check-logs ${OC#}"/>
+              </parallel>
+           </group>
+           <step name="App-Activate-All.App-Deactivate-bgprouter"
+                 exec="onos ${OCI} app deactivate org.onosproject.bgprouter" requires="App-Activate-All.App-Check-bgprouter"/>
+           <step name="App-Activate-All.Wait-For-Deactivate-bgprouter"
+                 exec="onos-check-apps ${OCI} org.onosproject.drivers" requires="App-Activate-All.App-Deactivate-bgprouter"/>      
+           <group name="App-Activate-All.App-Check-After-bgprouter" requires="App-Activate-All.Wait-For-Deactivate-bgprouter">
+              <parallel var="${OC#}">
+                 <step name="App-Activate-All.Check-Logs-After-${#}-bgprouter" exec="onos-check-logs ${OC#}"/>
+              </parallel>
+           </group>
+           <step name="App-Activate-All.Minimal-Apps-bgprouter" requires="App-Activate-All.App-Deactivate-bgprouter"
+                 exec="onos-set-up-minimal-apps ${OCI}"/>
+        </group>
+
+
+        <group name="App-Activate-All.protocols.xmpp" requires="App-Activate-All.bgprouter">
            <step name="App-Activate-All.Activate-protocols.xmpp"
-                 exec="onos ${OCI} app activate org.onosproject.protocols.xmpp" requires="App-Activate-All.segmentrouting"/>
+                 exec="onos ${OCI} app activate org.onosproject.protocols.xmpp" requires="App-Activate-All.bgprouter"/>
            <group name="App-Activate-All.App-Check-protocols.xmpp" requires="App-Activate-All.Activate-protocols.xmpp">
               <parallel var="${OC#}">
                  <step name="App-Activate-All.App-Check-${#}-protocols.xmpp"
@@ -2664,9 +2736,33 @@
         </group>
 
 
-        <group name="App-Activate-All.drivers.ciena.c5162" requires="App-Activate-All.openstacktelemetry">
+        <group name="App-Activate-All.castor" requires="App-Activate-All.openstacktelemetry">
+           <step name="App-Activate-All.Activate-castor"
+                 exec="onos ${OCI} app activate org.onosproject.castor" requires="App-Activate-All.openstacktelemetry"/>
+           <group name="App-Activate-All.App-Check-castor" requires="App-Activate-All.Activate-castor">
+              <parallel var="${OC#}">
+                 <step name="App-Activate-All.App-Check-${#}-castor"
+                       exec="onos-check-apps ${OC#} castor includes"/>
+                 <step name="App-Activate-All.Check-Logs-${#}-castor" exec="onos-check-logs ${OC#}"/>
+              </parallel>
+           </group>
+           <step name="App-Activate-All.App-Deactivate-castor"
+                 exec="onos ${OCI} app deactivate org.onosproject.castor" requires="App-Activate-All.App-Check-castor"/>
+           <step name="App-Activate-All.Wait-For-Deactivate-castor"
+                 exec="onos-check-apps ${OCI} org.onosproject.drivers" requires="App-Activate-All.App-Deactivate-castor"/>      
+           <group name="App-Activate-All.App-Check-After-castor" requires="App-Activate-All.Wait-For-Deactivate-castor">
+              <parallel var="${OC#}">
+                 <step name="App-Activate-All.Check-Logs-After-${#}-castor" exec="onos-check-logs ${OC#}"/>
+              </parallel>
+           </group>
+           <step name="App-Activate-All.Minimal-Apps-castor" requires="App-Activate-All.App-Deactivate-castor"
+                 exec="onos-set-up-minimal-apps ${OCI}"/>
+        </group>
+
+
+        <group name="App-Activate-All.drivers.ciena.c5162" requires="App-Activate-All.castor">
            <step name="App-Activate-All.Activate-drivers.ciena.c5162"
-                 exec="onos ${OCI} app activate org.onosproject.drivers.ciena.c5162" requires="App-Activate-All.openstacktelemetry"/>
+                 exec="onos ${OCI} app activate org.onosproject.drivers.ciena.c5162" requires="App-Activate-All.castor"/>
            <group name="App-Activate-All.App-Check-drivers.ciena.c5162" requires="App-Activate-All.Activate-drivers.ciena.c5162">
               <parallel var="${OC#}">
                  <step name="App-Activate-All.App-Check-${#}-drivers.ciena.c5162"
@@ -3048,9 +3144,33 @@
         </group>
 
 
-        <group name="App-Activate-All.drivers.hp" requires="App-Activate-All.drivers.oplink">
+        <group name="App-Activate-All.isis" requires="App-Activate-All.drivers.oplink">
+           <step name="App-Activate-All.Activate-isis"
+                 exec="onos ${OCI} app activate org.onosproject.isis" requires="App-Activate-All.drivers.oplink"/>
+           <group name="App-Activate-All.App-Check-isis" requires="App-Activate-All.Activate-isis">
+              <parallel var="${OC#}">
+                 <step name="App-Activate-All.App-Check-${#}-isis"
+                       exec="onos-check-apps ${OC#} isis includes"/>
+                 <step name="App-Activate-All.Check-Logs-${#}-isis" exec="onos-check-logs ${OC#}"/>
+              </parallel>
+           </group>
+           <step name="App-Activate-All.App-Deactivate-isis"
+                 exec="onos ${OCI} app deactivate org.onosproject.isis" requires="App-Activate-All.App-Check-isis"/>
+           <step name="App-Activate-All.Wait-For-Deactivate-isis"
+                 exec="onos-check-apps ${OCI} org.onosproject.drivers" requires="App-Activate-All.App-Deactivate-isis"/>      
+           <group name="App-Activate-All.App-Check-After-isis" requires="App-Activate-All.Wait-For-Deactivate-isis">
+              <parallel var="${OC#}">
+                 <step name="App-Activate-All.Check-Logs-After-${#}-isis" exec="onos-check-logs ${OC#}"/>
+              </parallel>
+           </group>
+           <step name="App-Activate-All.Minimal-Apps-isis" requires="App-Activate-All.App-Deactivate-isis"
+                 exec="onos-set-up-minimal-apps ${OCI}"/>
+        </group>
+
+
+        <group name="App-Activate-All.drivers.hp" requires="App-Activate-All.isis">
            <step name="App-Activate-All.Activate-drivers.hp"
-                 exec="onos ${OCI} app activate org.onosproject.drivers.hp" requires="App-Activate-All.drivers.oplink"/>
+                 exec="onos ${OCI} app activate org.onosproject.drivers.hp" requires="App-Activate-All.isis"/>
            <group name="App-Activate-All.App-Check-drivers.hp" requires="App-Activate-All.Activate-drivers.hp">
               <parallel var="${OC#}">
                  <step name="App-Activate-All.App-Check-${#}-drivers.hp"
@@ -3360,9 +3480,33 @@
         </group>
 
 
-        <group name="App-Activate-All.powermanagement" requires="App-Activate-All.layout">
+        <group name="App-Activate-All.graphitemetrics" requires="App-Activate-All.layout">
+           <step name="App-Activate-All.Activate-graphitemetrics"
+                 exec="onos ${OCI} app activate org.onosproject.graphitemetrics" requires="App-Activate-All.layout"/>
+           <group name="App-Activate-All.App-Check-graphitemetrics" requires="App-Activate-All.Activate-graphitemetrics">
+              <parallel var="${OC#}">
+                 <step name="App-Activate-All.App-Check-${#}-graphitemetrics"
+                       exec="onos-check-apps ${OC#} graphitemetrics includes"/>
+                 <step name="App-Activate-All.Check-Logs-${#}-graphitemetrics" exec="onos-check-logs ${OC#}"/>
+              </parallel>
+           </group>
+           <step name="App-Activate-All.App-Deactivate-graphitemetrics"
+                 exec="onos ${OCI} app deactivate org.onosproject.graphitemetrics" requires="App-Activate-All.App-Check-graphitemetrics"/>
+           <step name="App-Activate-All.Wait-For-Deactivate-graphitemetrics"
+                 exec="onos-check-apps ${OCI} org.onosproject.drivers" requires="App-Activate-All.App-Deactivate-graphitemetrics"/>      
+           <group name="App-Activate-All.App-Check-After-graphitemetrics" requires="App-Activate-All.Wait-For-Deactivate-graphitemetrics">
+              <parallel var="${OC#}">
+                 <step name="App-Activate-All.Check-Logs-After-${#}-graphitemetrics" exec="onos-check-logs ${OC#}"/>
+              </parallel>
+           </group>
+           <step name="App-Activate-All.Minimal-Apps-graphitemetrics" requires="App-Activate-All.App-Deactivate-graphitemetrics"
+                 exec="onos-set-up-minimal-apps ${OCI}"/>
+        </group>
+
+
+        <group name="App-Activate-All.powermanagement" requires="App-Activate-All.graphitemetrics">
            <step name="App-Activate-All.Activate-powermanagement"
-                 exec="onos ${OCI} app activate org.onosproject.powermanagement" requires="App-Activate-All.layout"/>
+                 exec="onos ${OCI} app activate org.onosproject.powermanagement" requires="App-Activate-All.graphitemetrics"/>
            <group name="App-Activate-All.App-Check-powermanagement" requires="App-Activate-All.Activate-powermanagement">
               <parallel var="${OC#}">
                  <step name="App-Activate-All.App-Check-${#}-powermanagement"