Fixing & enhancing STC test scenarios.

Change-Id: Ieff7ce5350a69d8ebb215a2344c67e41479cf371
diff --git a/tools/test/bin/onos-mininet b/tools/test/bin/onos-mininet
index 44d489b..ef2c8ea 100755
--- a/tools/test/bin/onos-mininet
+++ b/tools/test/bin/onos-mininet
@@ -6,7 +6,7 @@
 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
 . $ONOS_ROOT/tools/build/envDefaults
 
-export MAX_WAIT=45
+export MAX_WAIT=60
 
 cmd="$1" && shift
 log="screenlog.0"
diff --git a/tools/test/scenarios/net-pingall.xml b/tools/test/scenarios/net-pingall.xml
index 49ed6e6..41d7354 100644
--- a/tools/test/scenarios/net-pingall.xml
+++ b/tools/test/scenarios/net-pingall.xml
@@ -16,8 +16,14 @@
 <scenario name="net-pingall" description="Network pingall test">
     <!-- TODO: parametrize this via recipes -->
     <group name="Net-Pingall">
-        <step name="Ping-All-And-Verify"
-              exec="onos-mininet sendAndExpect py net.pingAll(1) --expect Results: [0-5]% dropped"/>
+        <step name="Install-Apps"
+              exec="onos ${OC1} app activate org.onosproject.openflow org.onosproject.proxyarp org.onosproject.fwd"/>
+
+        <step name="Check-Apps" requires="Install-Apps"
+              exec="onos-check-apps ${OC1} drivers,openflow,proxyarp,fwd"/>
+
+        <step name="Ping-All-And-Verify" requires="Check-Apps"
+              exec="onos-mininet sendAndExpect py net.pingAll(1) --expect Results: .% dropped"/>
 
         <step name="Check-Summary-For-Hosts" requires="~Ping-All-And-Verify"
               exec="onos-check-summary ${OC1} [0-9]* 25 140 25"/>
diff --git a/tools/test/scenarios/net-setup.xml b/tools/test/scenarios/net-setup.xml
index 6df7aa3..8a2fd33 100644
--- a/tools/test/scenarios/net-setup.xml
+++ b/tools/test/scenarios/net-setup.xml
@@ -19,13 +19,7 @@
         <step name="Push-Topos" exec="onos-push-topos ${OCN}"/>
         <step name="Stop-Mininet-If-Needed" env="~" exec="onos-mininet stop"/>
 
-        <step name="Install-Apps"
-              exec="onos ${OC1} app activate org.onosproject.openflow org.onosproject.proxyarp org.onosproject.fwd"/>
-
-        <step name="Check-Apps" requires="Install-Apps"
-              exec="onos-check-apps ${OC1} drivers,openflow,proxyarp,fwd"/>
-
-        <step name="Wipe-Out-Data-Before" requires="~Check-Apps" exec="onos-wipe-out"/>
+        <step name="Wipe-Out-Data-Before" exec="onos-wipe-out"/>
 
         <step name="Initial-Summary-Check" requires="~Wipe-Out-Data-Before"
               exec="onos-check-summary ${OC1} [0-9]* 0 0 0"/>
@@ -42,5 +36,8 @@
 
         <step name="Balance-Masters" requires="Check-Summary"
               exec="onos ${OC1} balance-masters"/>
+
+        <step name="Pause-For-Masters" requires="Balance-Masters"
+              exec="sleep 10"/>
     </group>
 </scenario>
\ No newline at end of file
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/MainIndexResource.java b/web/gui/src/main/java/org/onosproject/ui/impl/MainIndexResource.java
index 9013fed..2797f33 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/MainIndexResource.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/MainIndexResource.java
@@ -17,6 +17,7 @@
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableList.Builder;
+import org.onlab.osgi.ServiceNotFoundException;
 import org.onosproject.ui.UiExtensionService;
 
 import javax.ws.rs.GET;
@@ -38,6 +39,7 @@
 public class MainIndexResource extends AbstractInjectionResource {
 
     private static final String INDEX = "index.html";
+    private static final String NOT_READY = "not-ready.html";
 
     private static final String INJECT_CSS_START = "<!-- {INJECTED-STYLESHEETS-START} -->";
     private static final String INJECT_CSS_END = "<!-- {INJECTED-STYLESHEETS-END} -->";
@@ -48,8 +50,15 @@
     @GET
     @Produces(MediaType.TEXT_HTML)
     public Response getMainIndex() throws IOException {
-        UiExtensionService service = get(UiExtensionService.class);
-        InputStream indexTemplate = getClass().getClassLoader().getResourceAsStream(INDEX);
+        ClassLoader classLoader = getClass().getClassLoader();
+        UiExtensionService service;
+        try {
+            service = get(UiExtensionService.class);
+        } catch (ServiceNotFoundException e) {
+            return Response.ok(classLoader.getResourceAsStream(NOT_READY)).build();
+        }
+
+        InputStream indexTemplate = classLoader.getResourceAsStream(INDEX);
         String index = new String(toByteArray(indexTemplate));
 
         int p1s = split(index, 0, INJECT_JS_START);
diff --git a/web/gui/src/main/resources/not-ready.html b/web/gui/src/main/resources/not-ready.html
new file mode 100644
index 0000000..7843ca4
--- /dev/null
+++ b/web/gui/src/main/resources/not-ready.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<!--
+  ~ Copyright 2015 Open Networking Laboratory
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<html>
+<head>
+    <meta charset="utf-8">
+    <link rel="shortcut icon" href="data/img/onos-logo.png">
+
+    <link rel="apple-touch-icon" href="data/img/apple-touch-icon.png">
+    <meta name="apple-mobile-web-app-capable" content="yes">
+    <meta name="apple-mobile-web-app-status-bar-style" content="black">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+    <meta http-equiv="refresh" content="5;URL=/onos/ui">
+
+    <title>ONOS</title>
+
+</head>
+<body>
+<h1>ONOS GUI not ready yet... stand by...</h1>
+</body>
+</html>