Adding support for topology recipes and cleaning up topologies.

Cleaned-up a few STC scenarios.

Change-Id: I4ffa61953d8cf289406fa572ab7603d996e26a85
diff --git a/tools/dev/bash_profile b/tools/dev/bash_profile
index 3135bf7..c67a98d 100644
--- a/tools/dev/bash_profile
+++ b/tools/dev/bash_profile
@@ -97,6 +97,47 @@
 alias sshnet='onos-ssh $OCN'
 
 
+
+# Applies the settings in the specified topology recipe file or lists current
+# topo recipe definition if no topo recipe file is given.
+function topo {
+    topo=${1:-""}
+    case "$topo" in
+    "")
+        env | egrep "ONOS_TOPO"
+        env | egrep "(OTD|OTL|OTH)="
+        ;;
+
+    *)
+        [ ! -f $ONOS_ROOT/tools/test/topos/$1.recipe ] && echo "No such topo recipe: $1" >&2 && return 1
+        unset ONOS_TOPO OTD OTL OTH ONOS_DEVICES ONOS_HOSTS
+        unset $(env | sed -n 's:\(^OT[DLH][0-9]\{1,\}\)=.*:\1 :g p')
+        export ONOS_TOPO=$1
+        . $ONOS_ROOT/tools/test/topos/$1.recipe
+        let d=1; while [ $d -le $OTD ]; do
+            dev="$(printf 'of:%016x' $d)"
+            export OTD$d=$dev; export ONOS_DEVICES="$ONOS_DEVICES $dev"
+            let d=d+1;
+        done
+        let h=1; while [ $h -le $OTH ]; do
+            host="$(printf '00:00:00:00:00:%02x/-1' $h)"
+            export OTH$h=$host; export ONOS_HOSTS="$ONOS_HOSTS $host"
+            let h=h+1
+        done
+        topo
+    esac
+}
+
+# Lists available topo recipes
+function topos {
+    for topo in $(ls -1 $ONOS_ROOT/tools/test/topos/*.recipe); do
+        name=$(basename $topo .recipe)
+        printf "%-16s  %s\n" \
+            "$([ $name = $ONOS_TOPO ] && echo $name '*' || echo $name)" \
+            "$(grep '^#' $topo | head -n 1)"
+    done
+}
+
 # Sets the primary instance to the specified instance number.
 function setPrimaryInstance {
     export ONOS_INSTANCES=$(env | grep 'OC[0-9]*=' | sort | cut -d= -f2)
@@ -132,6 +173,7 @@
         rm -f $aux
         setPrimaryInstance 1 >/dev/null
         onos-verify-cell
+        topo default >/dev/null
         ;;
     "return")
         curl -sS -X DELETE "http://$CELL_WARDEN:4321/?user=${2:-$(id -un)}"
@@ -147,7 +189,7 @@
         env | egrep "OCI"
         env | egrep "OC[0-9]+" | sort
         env | egrep "OC[NT]"
-        env | egrep "ONOS_" | egrep -v 'ONOS_ROOT|ONOS_CELL|ONOS_INSTANCES' | sort
+        env | egrep "ONOS_" | egrep -v 'ONOS_ROOT|ONOS_CELL|ONOS_INSTANCES|ONOS_DEVICES|ONOS_HOSTS' | sort
         ;;
 
     *)
@@ -161,6 +203,7 @@
         . $ONOS_ROOT/tools/test/cells/$1
         setPrimaryInstance 1 >/dev/null
         cell
+        topo default >/dev/null
     esac
 }
 
diff --git a/tools/test/bin/ogroup-opts b/tools/test/bin/ogroup-opts
index dd92944..fe35be2 100644
--- a/tools/test/bin/ogroup-opts
+++ b/tools/test/bin/ogroup-opts
@@ -46,6 +46,16 @@
 
 complete -F _cell-opts cell vicell
 
+# Tab completion settings for topo recipes
+function _topo-opts () {
+  local cur=${COMP_WORDS[COMP_CWORD]}
+  if [ $COMP_CWORD -eq 1 ]; then
+    COMPREPLY=( $( compgen -W "$(cd $ONOS_ROOT/tools/test/topos && ls -1 *.recipe | sed 's/\.recipe//g')" -- $cur ) )
+  fi
+}
+
+complete -F _topo-opts topo
+
 
 # Tab completion settings for onos-create-app.
 function _ocapp-opts () {
diff --git a/tools/test/scenarios/net-activate-fwd.xml b/tools/test/scenarios/net-activate-fwd.xml
index 6b3f9cb..88122f7 100644
--- a/tools/test/scenarios/net-activate-fwd.xml
+++ b/tools/test/scenarios/net-activate-fwd.xml
@@ -15,62 +15,14 @@
   -->
 <scenario name="net-activate-fwd" description="Activate forwarding apps">
     <group name="Net-Activate-Fwd">
-        <!-- TODO: parametrize this via recipes -->
-
-        <step name="Install-Fwd-Apps"
+        <step name="Activate-Fwd-Apps"
               exec="onos ${OC1} app activate org.onosproject.openflow org.onosproject.proxyarp org.onosproject.fwd"/>
-        <step name="Check-Fwd-Apps" requires="Install-Fwd-Apps"
+        <step name="Check-Fwd-Apps-Activated" requires="Activate-Fwd-Apps"
               exec="onos-check-apps ${OC1} drivers,openflow,proxyarp,fwd includes"/>
 
-        <step name="Check-Fwd-Flows1" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000001 present"/>
-        <step name="Check-Fwd-Flows2" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000002 present"/>
-        <step name="Check-Fwd-Flows3" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000003 present"/>
-        <step name="Check-Fwd-Flows4" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000004 present"/>
-        <step name="Check-Fwd-Flows5" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000005 present"/>
-        <step name="Check-Fwd-Flows6" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000006 present"/>
-        <step name="Check-Fwd-Flows7" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000007 present"/>
-        <step name="Check-Fwd-Flows8" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000008 present"/>
-        <step name="Check-Fwd-Flows9" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000009 present"/>
-        <step name="Check-Fwd-Flowsa" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:000000000000000a present"/>
-        <step name="Check-Fwd-Flowsb" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:000000000000000b present"/>
-        <step name="Check-Fwd-Flowsc" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:000000000000000c present"/>
-        <step name="Check-Fwd-Flowsd" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:000000000000000d present"/>
-        <step name="Check-Fwd-Flowse" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:000000000000000e present"/>
-        <step name="Check-Fwd-Flowsf" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:000000000000000f present"/>
-        <step name="Check-Fwd-Flows10" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000010 present"/>
-        <step name="Check-Fwd-Flows11" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000011 present"/>
-        <step name="Check-Fwd-Flows12" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000012 present"/>
-        <step name="Check-Fwd-Flows13" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000013 present"/>
-        <step name="Check-Fwd-Flows14" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000014 present"/>
-        <step name="Check-Fwd-Flows15" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000015 present"/>
-        <step name="Check-Fwd-Flows16" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000016 present"/>
-        <step name="Check-Fwd-Flows17" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000017 present"/>
-        <step name="Check-Fwd-Flows18" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000018 present"/>
-        <step name="Check-Fwd-Flows19" requires="Check-Fwd-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000019 present"/>
+        <parallel var="${OTD#}">
+            <step name="Check-Fwd-Flows-${#}" requires="Check-Fwd-Apps-Activated"
+                  exec="onos-check-ipv4-flows ${OC1} ${OTD#} present"/>
+        </parallel>
     </group>
 </scenario>
diff --git a/tools/test/scenarios/net-deactivate-fwd.xml b/tools/test/scenarios/net-deactivate-fwd.xml
index 4c1b0fa..168a270 100644
--- a/tools/test/scenarios/net-deactivate-fwd.xml
+++ b/tools/test/scenarios/net-deactivate-fwd.xml
@@ -15,61 +15,14 @@
   -->
 <scenario name="net-deactivate-fwd" description="Deactivate forwarding apps">
     <group name="Net-Deactivate-Fwd">
-        <!-- TODO: parametrize this via recipes -->
-        <step name="Net-Deactivate-Fwd.Uninstall-Reactive-Forwarding"
+        <step name="Deactivate-Fwd-Apps"
               exec="onos ${OC1} app deactivate org.onosproject.fwd org.onosproject.ifwd"/>
-        <step name="Net-Deactivate-Fwd.Check-Apps" requires="Net-Deactivate-Fwd.Uninstall-Reactive-Forwarding"
+        <step name="Check-Fwd-Apps-Deactivated" requires="Deactivate-Fwd-Apps"
               exec="onos-check-apps ${OC1} fwd,ifwd excludes"/>
 
-        <step name="Check-DFwd-Flows1" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000001 not-present"/>
-        <step name="Check-DFwd-Flows2" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000002 not-present"/>
-        <step name="Check-DFwd-Flows3" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000003 not-present"/>
-        <step name="Check-DFwd-Flows4" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000004 not-present"/>
-        <step name="Check-DFwd-Flows5" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000005 not-present"/>
-        <step name="Check-DFwd-Flows6" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000006 not-present"/>
-        <step name="Check-DFwd-Flows7" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000007 not-present"/>
-        <step name="Check-DFwd-Flows8" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000008 not-present"/>
-        <step name="Check-DFwd-Flows9" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000009 not-present"/>
-        <step name="Check-DFwd-Flowsa" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:000000000000000a not-present"/>
-        <step name="Check-DFwd-Flowsb" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:000000000000000b not-present"/>
-        <step name="Check-DFwd-Flowsc" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:000000000000000c not-present"/>
-        <step name="Check-DFwd-Flowsd" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:000000000000000d not-present"/>
-        <step name="Check-DFwd-Flowse" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:000000000000000e not-present"/>
-        <step name="Check-DFwd-Flowsf" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:000000000000000f not-present"/>
-        <step name="Check-DFwd-Flows10" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000010 not-present"/>
-        <step name="Check-DFwd-Flows11" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000011 not-present"/>
-        <step name="Check-DFwd-Flows12" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000012 not-present"/>
-        <step name="Check-DFwd-Flows13" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000013 not-present"/>
-        <step name="Check-DFwd-Flows14" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000014 not-present"/>
-        <step name="Check-DFwd-Flows15" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000015 not-present"/>
-        <step name="Check-DFwd-Flows16" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000016 not-present"/>
-        <step name="Check-DFwd-Flows17" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000017 not-present"/>
-        <step name="Check-DFwd-Flows18" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000018 not-present"/>
-        <step name="Check-DFwd-Flows19" requires="Net-Deactivate-Fwd.Check-Apps"
-              exec="onos-check-ipv4-flows ${OC1} of:0000000000000019 not-present"/>
+        <parallel var="${OTD#}">
+            <step name="Check-DFwd-Flows-${#}" requires="Check-Fwd-Apps-Deactivated"
+                  exec="onos-check-ipv4-flows ${OC1} ${OTD#} not-present"/>
+        </parallel>
     </group>
 </scenario>
diff --git a/tools/test/scenarios/net-link-down-up.xml b/tools/test/scenarios/net-link-down-up.xml
index 506fbd9..07398ec 100644
--- a/tools/test/scenarios/net-link-down-up.xml
+++ b/tools/test/scenarios/net-link-down-up.xml
@@ -14,31 +14,31 @@
   ~ limitations under the License.
   -->
 <scenario name="net-link-down-up" description="Network link up-down test">
-    <!-- TODO: parametrize this via recipes -->
+    <!-- Note: This scenario is tailored using 'topo' recipe mechanism; see topos/*.recipe files -->
     <group name="Net-Link-Down-Up">
         <step name="Ping-1"
-              exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/>
+              exec="onos-mininet sendAndExpect ${OPS} ping -c1 ${OPD} --expect \ 0% packet loss"/>
         <step name="Link-1-Down" requires="~Ping-1"
-              exec="onos-mininet sendAndExpect link s4 s7 down --expect ."/>
+              exec="onos-mininet sendAndExpect link ${OPL1} down --expect ."/>
         <step name="Ping-2-Prep" requires="~Link-1-Down"
-              exec="onos-mininet sendAndExpect h1 ping -c5 h4 --expect ."/>
+              exec="onos-mininet sendAndExpect ${OPS} ping -c5 ${OPD} --expect ."/>
         <step name="Ping-2" requires="~Ping-2-Prep"
-              exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/>
+              exec="onos-mininet sendAndExpect ${OPS} ping -c1 ${OPD} --expect \ 0% packet loss"/>
         <step name="Link-2-Down" requires="~Ping-2"
-              exec="onos-mininet sendAndExpect link s4 s5 down --expect ."/>
+              exec="onos-mininet sendAndExpect link ${OPL2} down --expect ."/>
         <step name="Ping-3" requires="~Link-2-Down"
-              exec="onos-mininet sendAndExpect h1 ping -c1 -w1 h4 --expect 100% packet loss"/>
+              exec="onos-mininet sendAndExpect ${OPS} ping -c1 -w1 ${OPD} --expect 100% packet loss"/>
         <step name="Link-1-Up" requires="~Ping-3"
-              exec="onos-mininet sendAndExpect link s4 s7 up --expect ."/>
+              exec="onos-mininet sendAndExpect link ${OPL1} up --expect ."/>
         <step name="Ping-4-Prep" requires="~Link-1-Up"
-              exec="onos-mininet sendAndExpect h1 ping -c5 h4 --expect ."/>
+              exec="onos-mininet sendAndExpect ${OPS} ping -c5 ${OPD} --expect ."/>
         <step name="Ping-4" requires="~Ping-4-Prep"
-              exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/>
+              exec="onos-mininet sendAndExpect ${OPS} ping -c1 ${OPD} --expect \ 0% packet loss"/>
         <step name="Link-2-Up" requires="~Ping-4"
-              exec="onos-mininet sendAndExpect link s4 s5 up --expect ."/>
+              exec="onos-mininet sendAndExpect link ${OPL2} up --expect ."/>
         <step name="Ping-5-Prep" requires="~Link-2-Up"
-              exec="onos-mininet sendAndExpect h1 ping -c5 h4 --expect ."/>
+              exec="onos-mininet sendAndExpect ${OPS} ping -c5 ${OPD} --expect ."/>
         <step name="Ping-5" requires="~Ping-5-Prep"
-              exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/>
+              exec="onos-mininet sendAndExpect ${OPS} ping -c1 ${OPD} --expect \ 0% packet loss"/>
     </group>
 </scenario>
diff --git a/tools/test/scenarios/net-pingall.xml b/tools/test/scenarios/net-pingall.xml
index 2eab5a7..863224a 100644
--- a/tools/test/scenarios/net-pingall.xml
+++ b/tools/test/scenarios/net-pingall.xml
@@ -14,14 +14,13 @@
   ~ limitations under the License.
   -->
 <scenario name="net-pingall" description="Network pingall test">
-    <!-- TODO: parametrize this via recipes -->
+    <!-- Note: This scenario is tailored using 'topo' recipe mechanism; see topos/*.recipe files -->
     <group name="Net-Pingall">
 
         <step name="Ping-All" requires="Check-Apps"
-              exec="onos-mininet sendAndExpect pingall --expect 600/600 received"/>
+              exec="onos-mininet sendAndExpect pingall --expect ${OPALL}/${OPALL} received"/>
 
         <step name="Check-Summary-For-Hosts" requires="~Ping-All"
-              exec="onos-check-summary ${OC1} [0-9]* 25 140 25"/>
-
+              exec="onos-check-summary ${OC1} [0-9]* ${OTD} ${OTL} ${OTH}"/>
     </group>
 </scenario>
diff --git a/tools/test/scenarios/net-reactive-fwd.xml b/tools/test/scenarios/net-reactive-fwd.xml
index 12831a4..5a7f926 100644
--- a/tools/test/scenarios/net-reactive-fwd.xml
+++ b/tools/test/scenarios/net-reactive-fwd.xml
@@ -14,18 +14,16 @@
   ~ limitations under the License.
   -->
 <scenario name="net-reactive-fwd" description="Network reactive forwarding test">
-    <!-- TODO: parametrize this via recipes -->
     <group name="Net-Reactive-Fwd">
         <import file="${ONOS_SCENARIOS}/net-activate-fwd.xml" namespace="Net-Reactive-Fwd"/>
-        <dependency name="Net-Reactive-Fwd.Net-Activate-Fwd" requires="Net-Setup"/>
 
         <import file="${ONOS_SCENARIOS}/net-pingall.xml" namespace="Net-Reactive-Fwd"/>
         <dependency name="Net-Reactive-Fwd.Net-Pingall" requires="Net-Reactive-Fwd.Net-Activate-Fwd"/>
 
         <import file="${ONOS_SCENARIOS}/net-link-down-up.xml" namespace="Net-Reactive-Fwd"/>
-        <dependency name="Net-Reactive-Fwd.Net-Link-Down-Up" requires="Net-Setup,~Net-Reactive-Fwd.Net-Pingall"/>
+        <dependency name="Net-Reactive-Fwd.Net-Link-Down-Up" requires="~Net-Reactive-Fwd.Net-Pingall"/>
 
         <import file="${ONOS_SCENARIOS}/net-deactivate-fwd.xml" namespace="Net-Reactive-Fwd"/>
-        <dependency name="Net-Reactive-Fwd.Net-Deactivate-Fwd" requires="Net-Reactive-Fwd.Net-Link-Down-Up"/>
+        <dependency name="Net-Reactive-Fwd.Net-Deactivate-Fwd" requires="~Net-Reactive-Fwd.Net-Link-Down-Up"/>
     </group>
 </scenario>
diff --git a/tools/test/scenarios/net-setup-geant.xml b/tools/test/scenarios/net-setup-geant.xml
deleted file mode 100644
index c668347..0000000
--- a/tools/test/scenarios/net-setup-geant.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<!--
-  ~ Copyright 2016-present 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.
-  -->
-<scenario name="net-setup-geant" description="Network setup steps">
-    <!-- TODO: parametrize this via recipes -->
-    <group name="Net-Setup">
-        <step name="Push-Topos" exec="onos-push-topos ${OCN}"/>
-
-        <step name="Stop-Mininet-If-Needed" env="~" exec="onos-mininet stop"/>
-        <step name="Wipe-Out-Data-Before" exec="onos-wipe-out" requires="^"/>
-
-        <step name="Initial-Summary-Check" requires="~Wipe-Out-Data-Before"
-              exec="onos-check-summary ${OC1} [0-9]* 0 0 0"/>
-
-        <step name="Config-Topo" requires="~Initial-Summary-Check"
-              exec="onos-netcfg ${OC1} ${ONOS_ROOT}/tools/test/topos/geantmpls-cfg.json"/>
-
-        <step name="Start-Mininet"
-              requires="Install-Apps,Config-Topo,Push-Topos,Stop-Mininet-If-Needed"
-              exec="onos-mininet start topos/topo geantmpls.py ${ONOS_INSTANCES}"/>
-
-        <step name="Wait-For-Mininet" requires="Start-Mininet"
-              exec="onos-mininet wait 10"/>
-
-        <step name="ARP-Hosts" requires="~Wait-For-Mininet"
-              exec="onos-mininet sendAndExpect gratuitousArp --expect ."/>
-
-        <step name="Check-Summary" requires="ARP-Hosts"
-              exec="onos-check-summary ${OC1} [0-9]* 31 108 31"/>
-
-        <step name="Balance-Masters" requires="~Check-Summary" if="${OC2}"
-              exec="onos ${OC1} balance-masters"/>
-
-        <step name="Check-Flows" requires="~Balance-Masters,~Check-Summary" delay="5"
-              exec="onos-check-flows ${OC1}"/>
-    </group>
-</scenario>
diff --git a/tools/test/scenarios/net-setup-uk.xml b/tools/test/scenarios/net-setup-uk.xml
deleted file mode 100644
index 0a192a9..0000000
--- a/tools/test/scenarios/net-setup-uk.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<!--
-  ~  Copyright 2016-present 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.
-  -->
-<scenario name="net-setup-uk" description="Network setup steps">
-    <!-- TODO: parametrize this via recipes -->
-    <!-- Customized for the UK topology -->
-    <group name="Net-Setup-UK">
-
-        <step name="Push-Topos" exec="onos-push-topos ${OCN}"/>
-
-        <step name="Stop-Mininet-If-Needed" env="~" exec="onos-mininet stop"/>
-        <step name="Wipe-Out-Data-Before" exec="onos-wipe-out" requires="^"/>
-
-        <step name="Initial-Summary-Check" requires="~Wipe-Out-Data-Before"
-              exec="onos-check-summary ${OC1} [0-9]* 0 0 0"/>
-
-        <step name="Config-Topo" requires="~Initial-Summary-Check"
-              exec="onos-netcfg ${OC1} ${ONOS_ROOT}/tools/test/topos/uk-cfg.json"/>
-
-        <step name="Start-Mininet"
-              requires="Install-Apps,Config-Topo,Push-Topos,Stop-Mininet-If-Needed"
-              exec="onos-mininet start topos/topo uk-onos.py ${ONOS_INSTANCES}"/>
-
-        <step name="Wait-For-Mininet" requires="Start-Mininet"
-              exec="onos-mininet wait 10"/>
-
-        <step name="Check-Summary" requires="~Wait-For-Mininet"
-              exec="onos-check-summary ${OC1} [0-9]* 12 46 12"/>
-
-        <step name="Balance-Masters" requires="~Check-Summary" if="${OC2}"
-              exec="onos ${OC1} balance-masters"/>
-
-        <step name="Check-Flows" requires="~Balance-Masters,~Check-Summary" delay="5"
-              exec="onos-check-flows ${OC1}"/>
-    </group>
-</scenario>
diff --git a/tools/test/scenarios/net-setup.xml b/tools/test/scenarios/net-setup.xml
index 5e8244a..1856f57 100644
--- a/tools/test/scenarios/net-setup.xml
+++ b/tools/test/scenarios/net-setup.xml
@@ -14,7 +14,7 @@
   ~ limitations under the License.
   -->
 <scenario name="net-setup" description="Network setup steps">
-    <!-- TODO: parametrize this via recipes -->
+    <!-- Note: This scenario is tailored using 'topo' recipe mechanism; see topos/*.recipe files -->
     <group name="Net-Setup">
         <step name="Push-Topos" exec="onos-push-topos ${OCN}"/>
 
@@ -25,11 +25,11 @@
               exec="onos-check-summary ${OC1} [0-9]* 0 0 0"/>
 
         <step name="Config-Topo" requires="~Initial-Summary-Check"
-              exec="onos-netcfg ${OC1} ${ONOS_ROOT}/tools/test/topos/attmpls-cfg.json"/>
+              exec="onos-netcfg ${OC1} ${ONOS_ROOT}/tools/test/topos/${ONOS_TOPO}.json"/>
 
         <step name="Start-Mininet"
               requires="Install-Apps,Config-Topo,Push-Topos,Stop-Mininet-If-Needed"
-              exec="onos-mininet start topos/topo attmplsfast.py ${ONOS_INSTANCES}"/>
+              exec="onos-mininet start topos/topo ${ONOS_TOPO}.py ${ONOS_INSTANCES}"/>
 
         <step name="Wait-For-Mininet" requires="Start-Mininet"
               exec="onos-mininet wait 10"/>
@@ -38,7 +38,7 @@
               exec="onos-mininet sendAndExpect gratuitousArp --expect ."/>
 
         <step name="Check-Summary" requires="ARP-Hosts"
-              exec="onos-check-summary ${OC1} [0-9]* 25 140 25"/>
+              exec="onos-check-summary ${OC1} [0-9]* ${OTD} ${OTL} ${OTH}"/>
 
         <step name="Balance-Masters" requires="~Check-Summary" if="${OC2}"
               exec="onos ${OC1} balance-masters"/>
diff --git a/tools/test/topos/attmpls-cfg.json b/tools/test/topos/default.json
similarity index 100%
rename from tools/test/topos/attmpls-cfg.json
rename to tools/test/topos/default.json
diff --git a/tools/test/topos/attmplsfast.py b/tools/test/topos/default.py
similarity index 95%
rename from tools/test/topos/attmplsfast.py
rename to tools/test/topos/default.py
index 1c30ba6..16e8788 100644
--- a/tools/test/topos/attmplsfast.py
+++ b/tools/test/topos/default.py
@@ -3,14 +3,6 @@
 """
 """
 from mininet.topo import Topo
-from mininet.net import Mininet
-from mininet.node import RemoteController
-from mininet.node import Node
-from mininet.node import CPULimitedHost
-from mininet.link import TCLink
-from mininet.cli import CLI
-from mininet.log import setLogLevel
-from mininet.util import dumpNodeConnections
 
 class AttMplsTopo( Topo ):
     "Internet Topology Zoo Specimen."
diff --git a/tools/test/topos/default.recipe b/tools/test/topos/default.recipe
new file mode 100644
index 0000000..b08c896
--- /dev/null
+++ b/tools/test/topos/default.recipe
@@ -0,0 +1,14 @@
+# Default US MPLS topology recipe
+export OTD=25
+export OTL=140
+export OTH=25
+
+
+# Variables for the pingall scenario.
+export OPALL=600
+
+# Variables for link-up-down-up scenario.
+export OPS=h1
+export OPD=h4
+export OPL1="s4 s7"
+export OPL2="s4 s5"
\ No newline at end of file
diff --git a/tools/test/topos/geantmpls-cfg.json b/tools/test/topos/geant.json
similarity index 100%
rename from tools/test/topos/geantmpls-cfg.json
rename to tools/test/topos/geant.json
diff --git a/tools/test/topos/geantmpls.py b/tools/test/topos/geant.py
similarity index 99%
rename from tools/test/topos/geantmpls.py
rename to tools/test/topos/geant.py
index 9a1fa12..e2e6fb7 100644
--- a/tools/test/topos/geantmpls.py
+++ b/tools/test/topos/geant.py
@@ -118,8 +118,8 @@
         self.addLink( HAM , HAM_host )
         self.addLink( AMS , AMS_host )
         self.addLink( STO , STO_host )
-        self.addLink( HEL , HEL_host )
         self.addLink( OSL , OSL_host )
+        self.addLink( HEL , HEL_host )
 
         # add edges between switches
         self.addLink( ATH , MIL, bw=10 )
diff --git a/tools/test/topos/geant.recipe b/tools/test/topos/geant.recipe
new file mode 100644
index 0000000..5a2c5bf
--- /dev/null
+++ b/tools/test/topos/geant.recipe
@@ -0,0 +1,13 @@
+# GEANT & Nordnet topology recipe
+export OTD=31
+export OTL=108
+export OTH=31
+
+# Variables for the pingall scenario.
+export OPALL=930
+
+# Variables for link-up-down-up scenario.
+export OPS=h3
+export OPD=h31
+export OPL1="s31 s14"
+export OPL2="s31 s30"
\ No newline at end of file
diff --git a/tools/test/topos/uk-cfg.json b/tools/test/topos/uk.json
similarity index 100%
rename from tools/test/topos/uk-cfg.json
rename to tools/test/topos/uk.json
diff --git a/tools/test/topos/uk.recipe b/tools/test/topos/uk.recipe
new file mode 100644
index 0000000..07a5c75
--- /dev/null
+++ b/tools/test/topos/uk.recipe
@@ -0,0 +1,13 @@
+# Simple UK topology recipe
+export OTD=12
+export OTL=46
+export OTH=12
+
+# Variables for the pingall scenario.
+export OPALL=132
+
+# Variables for link-up-down-up scenario.
+export OPS=h6
+export OPD=h11
+export OPL1="s11 s7"
+export OPL2="s11 s9"
\ No newline at end of file
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/UiExtensionManager.java b/web/gui/src/main/java/org/onosproject/ui/impl/UiExtensionManager.java
index 293b442..110cde2 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/UiExtensionManager.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/UiExtensionManager.java
@@ -172,11 +172,11 @@
                         new UiTopoMap("americas", "North, Central and South America", "*americas", 0.7),
                         new UiTopoMap("n_america", "North America", "*n_america", 0.9),
                         new UiTopoMap("s_america", "South America", "*s_america", 0.9),
-                        new UiTopoMap("usa", "United States", "*continental_us", 1.0),
+                        new UiTopoMap("usa", "United States", "*continental_us", 1.3),
                         new UiTopoMap("bayareaGEO", "Bay Area, California", "*bayarea", 1.0),
-                        new UiTopoMap("europe", "Europe", "*europe", 9.0),
+                        new UiTopoMap("europe", "Europe", "*europe", 10.0),
                         new UiTopoMap("italy", "Italy", "*italy", 0.8),
-                        new UiTopoMap("uk", "United Kingdom and Ireland", "*uk", 0.6),
+                        new UiTopoMap("uk", "United Kingdom and Ireland", "*uk", 2.0),
                         new UiTopoMap("japan", "Japan", "*japan", 0.8),
                         new UiTopoMap("s_korea", "South Korea", "*s_korea", 0.75),
                         new UiTopoMap("taiwan", "Taiwan", "*taiwan", 0.7),