CORD-272 exposed micro services ports on head node and add simply cord command scripts

Change-Id: I43755761c983707f42b1955819ac6234896e55d9
diff --git a/roles/head-node/files/commands/cord-switch b/roles/head-node/files/commands/cord-switch
new file mode 100755
index 0000000..2f92137
--- /dev/null
+++ b/roles/head-node/files/commands/cord-switch
@@ -0,0 +1,53 @@
+#!/bin/bash
+#D provides access to the CORD POD swtich identification service
+
+PROG=$(echo $(basename $0) | sed -e 's/^cord-/cord /g')
+
+usage() {
+    echo "usage: $PROG <sub-command> [options]"
+    echo "    list    display the known switches"
+    echo "    help    this message"
+}
+
+COMMAND=$1; shift
+case $COMMAND in
+    list)
+        DO_JSON=0
+        DO_MAP=0
+        while [ $# -gt 0 ]; do
+            case $1 in
+                json|--json|-j)
+                    DO_JSON=1
+                    ;;
+                help|--help|-h)
+                    echo "usage: $PROG list [--json|-j]"
+                    echo "    json    display output as JSON object"
+                    exit 0
+                    ;;
+                *)
+                    >&2 "Unknown option '$1'"
+                    echo "usage: $PROG list [--json|-j]"
+                    echo "    json    display output as JSON object"
+                    exit 1
+                    ;;
+            esac
+            shift
+        done
+	if [ $DO_JSON -eq 1 ]; then
+            curl -sSL http://$CORD_HEAD_NODE:4244/switch/
+        else
+            for LINE in "NAME,MAC,IP" $(curl -sSL http://$CORD_HEAD_NODE:4244/switch/ | jq '.[] | .name+","+.mac+","+.ip'); do
+                echo $LINE | sed -e 's/^"//;s/"$//'
+            done | column -s , -t
+        fi
+        ;;
+    help|-h|--help)
+        usage
+        exit 0
+        ;;
+    *)
+        >&2 echo "Unknown subcommand '$COMMAND'"
+        usage
+        exit 1
+        ;;
+esac