Adding command to add routes and to generate flows from them.

Enhanced FlowRuleStore and FlowRuleService with a new method.

Change-Id: I011371c1931294448e361fc1ceb120d89c14489d
diff --git a/tools/test/topos/access-null b/tools/test/topos/access-null
new file mode 100755
index 0000000..0d9a13f
--- /dev/null
+++ b/tools/test/topos/access-null
@@ -0,0 +1,123 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Creates a spine-leaf fabric with large number of hosts using null providers
+#
+# Default setup as follows:
+#   2 spines, can potentially be few more
+#   12 leaves in total
+#       2 leaf pair
+#       8 non-paired
+#   Host per leaf up to 1K
+#
+# -----------------------------------------------------------------------------
+
+function usage {
+    echo "usage: $(basename $0) [options] [onos-ip]"
+    echo ""
+    echo "Options:"
+    echo "  -s spines"
+    echo "  -l spineLinks"
+    echo "  -S serviceHosts"
+    echo "  -a accessLeaves"
+    echo "  -A accessHosts"
+    exit 1
+}
+
+spines=2
+spineLinks=2
+serviceLeafGroups="A B"
+serviceHosts=10
+accessLeaves=8
+accessHosts=100
+
+# Scan arguments for user/password or other options...
+while getopts s:l:a:A:S:?h o; do
+    case "$o" in
+        s) spines=$OPTARG;;
+        l) spineLinks=$OPTARG;;
+        a) accessLeaves=$OPTARG;;
+        A) accessHosts=$OPTARG;;
+        S) serviceHosts=$OPTARG;;
+        *) usage $0;;
+    esac
+done
+
+spinePorts=48
+let leafPorts=serviceHosts+8     # derive service ports from service hosts
+let accessPorts=accessHosts+8    # derive access ports from access hosts
+
+let OPC=$OPTIND-1
+shift $OPC
+
+# config
+node=${1:-$OCI}
+
+
+# Create the script of ONOS commands first and then execute it all at once.
+export CMDS="/tmp/fab-onos.cmds"
+rm $CMDS
+
+function sim {
+    echo "$@" >> $CMDS
+}
+
+# Create spines
+for spine in $(seq 1 $spines); do
+    sim "null-create-device switch Spine-${spine} ${spinePorts}"
+done
+
+# Create 2 leaf pairs with dual links to the spines and a link between the pair
+for pair in $serviceLeafGroups; do
+    sim "null-create-device switch Leaf-${pair}1 ${leafPorts}"
+    sim "null-create-device switch Leaf-${pair}2 ${leafPorts}"
+    sim "null-create-link direct Leaf-${pair}1 Leaf-${pair}2"
+
+    for spine in $(seq 1 $spines); do
+        for link in $(seq 1 $spineLinks); do
+            sim "null-create-link direct Spine-${spine} Leaf-${pair}1"
+            sim "null-create-link direct Spine-${spine} Leaf-${pair}2"
+        done
+    done
+
+    # Create hosts for each leaf group; multi-homed to each leaf in the pair
+    [ $pair = A ] && pn=1 || pn=2
+    for host in $(seq 1 $serviceHosts); do
+        sim "null-create-host Leaf-${pair}1,Leaf-${pair}2 10.${pn}.1.${host}"
+    done
+done
+
+# Create single access leafs with dual links to the spines
+for access in $(seq $accessLeaves); do
+    sim "null-create-device switch Access-${access} ${accessPorts}"
+
+    for spine in $(seq 1 $spines); do
+        for link in $(seq 1 $spineLinks); do
+            sim "null-create-link direct Spine-${spine} Access-${access}"
+        done
+    done
+
+    # Create hosts for each access single leaf
+    sim "null-create-hosts Access-${access} 10.1${access}.1.*" $accessHosts
+    # sim "null-create-hosts Access-${access} 10.1${access}.2.*" $accessHosts
+done
+
+
+# make sure null providers are activated and any running simulation is stopped
+onos ${node} app activate org.onosproject.null
+sleep 2
+onos ${node} null-simulation stop
+
+# wait until the masterships clear-out across the cluster
+while onos ${node} masters | grep -qv " 0 devices"; do sleep 1; done
+
+# clean-up
+onos ${node} wipe-out please
+sleep 1
+
+# start custom simulation..
+onos ${node} null-simulation start custom
+sleep 2
+
+# Add devices, links, and hosts
+cat $CMDS | onos ${node}
+
diff --git a/tools/test/topos/cfab-null b/tools/test/topos/cfab-null
deleted file mode 100755
index f8eb3f0..0000000
--- a/tools/test/topos/cfab-null
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/bash
-# -----------------------------------------------------------------------------
-# Creates a spine-leaf fabric with large number of hosts using null providers
-# -----------------------------------------------------------------------------
-
-# config
-node=${1:-$OCI}
-
-# Create the script of ONOS commands first and then execute it all at once.
-export CMDS="/tmp/fab-onos.cmds"
-rm $CMDS
-
-function sim {
-    echo "$@" >> $CMDS
-}
-
-# Generate the recipe using the following:
-# 2 spines, can potentially be few more
-# 12 leaves in total
-#     2 leaf pair
-#     8 non-paired
-# Host per leaf up to 1K
-
-spinePorts=48
-leafPorts=64
-accessPorts=128
-
-# Create spines
-for spine in {1..2}; do
-    sim "null-create-device switch Spine-${spine} ${spinePorts}"
-done
-
-# Create 2 leaf pairs with dual links to the spines and a link between the pair
-for pair in A B; do
-    sim "null-create-device switch Leaf-${pair}1 ${leafPorts}"
-    sim "null-create-device switch Leaf-${pair}2 ${leafPorts}"
-    sim "null-create-link direct Leaf-${pair}1 Leaf-${pair}2"
-
-    for spine in {1..2}; do
-        for link in {1..2}; do
-            sim "null-create-link direct Spine-${spine} Leaf-${pair}1"
-            sim "null-create-link direct Spine-${spine} Leaf-${pair}2"
-        done
-    done
-
-    # Create hosts for each leaf group; multi-homed to each leaf in the pair
-    [ $pair = A ] && pn=1 || pn=2
-    for host in {1..10}; do
-        sim "null-create-host Leaf-${pair}1,Leaf-${pair}2 10.${pn}.1.${host}"
-    done
-done
-
-# Create 8 single leafs with dual links to the spines
-for access in {1..8}; do
-    sim "null-create-device switch Access-${access} ${accessPorts}"
-
-    for spine in {1..2}; do
-        for link in {1..2}; do
-            sim "null-create-link direct Spine-${spine} Access-${access}"
-        done
-    done
-
-    # Create hosts for each single leaf
-    for host in {1..50}; do
-        sim "null-create-host Access-${access} 10.0.${access}.${host}"
-    done
-done
-
-
-# make sure null providers are activated and any running simulation is stopped
-onos ${node} app activate org.onosproject.null
-sleep 2
-onos ${node} null-simulation stop
-
-# wait until the masterships clear-out across the cluster
-while onos ${node} masters | grep -qv " 0 devices"; do sleep 1; done
-
-# clean-up
-onos ${node} wipe-out please
-sleep 1
-
-# start custom simulation..
-onos ${node} null-simulation start custom
-sleep 2
-
-# Add devices, links, and hosts
-cat $CMDS | onos ${node}
-