Scenario to test the CLI 'maps' command
This scenario is used as an example in the STC wiki page
Change-Id: Iaef719ee53c8ad9fa2ca467aee5cf23684855968
diff --git a/tools/test/scenarios/bin/onos-find-and-check-map b/tools/test/scenarios/bin/onos-find-and-check-map
new file mode 100755
index 0000000..b419ca1
--- /dev/null
+++ b/tools/test/scenarios/bin/onos-find-and-check-map
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+
+# -----------------------------------------------------------------------------
+# Invokes the ONOS CLI and looks for a 'maps' entry with the given name
+# -----------------------------------------------------------------------------
+
+import subprocess
+import json
+import sys
+
+if len(sys.argv) != 4:
+ print "usage: onos-find-and-check-map onos-node map-name should-be-zero"
+ sys.exit(1)
+
+node = sys.argv[1]
+mapName = sys.argv[2]
+shouldBeZero = sys.argv[3]
+
+cli = subprocess.Popen(["onos", node, "maps", "-j"], stdout=subprocess.PIPE)
+json = json.loads(cli.communicate()[0])
+
+for map in json:
+ foundMapName = map["name"]
+ foundMapSize = map["size"]
+
+ print foundMapName
+ print foundMapSize
+
+ if foundMapName == mapName:
+ if (shouldBeZero == 'yes' and foundMapSize == 0) or \
+ (shouldBeZero != 'yes' and foundMapSize != 0):
+ sys.exit(0)
+ else:
+ sys.exit(1)
+
+sys.exit(1)