Yuta HIGUCHI | c1e5f80 | 2017-02-13 16:49:59 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | function _usage () { |
| 4 | cat << _EOF_ |
| 5 | usage: |
| 6 | $(basename $0) (ONOS CLI commands) |
| 7 | |
| 8 | summary: |
| 9 | Issue ONOS CLI commands to all the nodes defined in the current cell. |
| 10 | |
| 11 | _EOF_ |
| 12 | } |
| 13 | |
| 14 | nodes=$(env | sort | egrep "^OC[0-9]+" | cut -d= -f2) |
| 15 | |
| 16 | if [ "$#" -eq 0 ]; then |
| 17 | echo "Expecting ONOS CLI commands" |
| 18 | _usage |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | [ "$1" = "-h" ] && _usage && exit 0 |
| 23 | [ "$1" = "--help" ] && _usage && exit 0 |
| 24 | |
| 25 | for node in $nodes; do |
| 26 | echo "Issuing command on $node.." |
You Wang | dafd5b7 | 2017-09-08 14:23:15 -0700 | [diff] [blame^] | 27 | ssh -q -p 8101 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $node "$@" |
Yuta HIGUCHI | c1e5f80 | 2017-02-13 16:49:59 -0800 | [diff] [blame] | 28 | done |