Claudine Chiu

ONOS-737: regexp for grabbing OC* variables changed

Change-Id: Id5651ffb41230a39c6ed68e1605feaf3c0aa337b
...@@ -8,7 +8,7 @@ set -e ...@@ -8,7 +8,7 @@ set -e
8 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 8 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
9 . $ONOS_ROOT/tools/build/envDefaults 9 . $ONOS_ROOT/tools/build/envDefaults
10 10
11 -nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2) 11 +nodes=$(env | sort | egrep "^OC[0-9]+" | cut -d= -f2)
12 12
13 onos-package && stc prerequisites && stc setup 13 onos-package && stc prerequisites && stc setup
14 14
......
...@@ -30,7 +30,7 @@ fi ...@@ -30,7 +30,7 @@ fi
30 30
31 # Select the target 31 # Select the target
32 if [ "${1}" = "--cell" ]; then 32 if [ "${1}" = "--cell" ]; then
33 - nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2) 33 + nodes=$(env | sort | egrep "^OC[0-9]+" | cut -d= -f2)
34 else 34 else
35 nodes=${1:-$OCI} 35 nodes=${1:-$OCI}
36 fi 36 fi
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
6 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 6 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7 . $ONOS_ROOT/tools/build/envDefaults 7 . $ONOS_ROOT/tools/build/envDefaults
8 8
9 -nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2) 9 +nodes=$(env | sort | egrep "^OC[0-9]+" | cut -d= -f2)
10 10
11 for node in $nodes; do 11 for node in $nodes; do
12 echo "fetching from ${node}..." 12 echo "fetching from ${node}..."
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
4 #------------------------------------------------------------------------------- 4 #-------------------------------------------------------------------------------
5 5
6 cellName=$ONOS_CELL 6 cellName=$ONOS_CELL
7 -nodeCount=$(env | egrep "OC[0-9]+" | wc -l | tr -d ' ') 7 +nodeCount=$(env | egrep "^OC[0-9]+" | wc -l | tr -d ' ')
8 8
9 osascript -e " 9 osascript -e "
10 tell application \"iTerm\" 10 tell application \"iTerm\"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
4 #------------------------------------------------------------------------------- 4 #-------------------------------------------------------------------------------
5 5
6 cellName=$ONOS_CELL 6 cellName=$ONOS_CELL
7 -nodeCount=$(env | egrep "OC[0-9]+" | wc -l | tr -d ' ') 7 +nodeCount=$(env | egrep "^OC[0-9]+" | wc -l | tr -d ' ')
8 8
9 osascript -e " 9 osascript -e "
10 tell application \"iTerm\" 10 tell application \"iTerm\"
......
...@@ -14,7 +14,7 @@ shift ...@@ -14,7 +14,7 @@ shift
14 echo "Pushing to proxy $node..." 14 echo "Pushing to proxy $node..."
15 onos-push-bits $node 15 onos-push-bits $node
16 16
17 -others=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2 | grep -vE "^$OCT\$") 17 +others=$(env | sort | egrep "^OC[0-9]+" | cut -d= -f2 | grep -vE "^$OCT\$")
18 18
19 for other in $others; do 19 for other in $others; do
20 echo "Pushing to $other..." 20 echo "Pushing to $other..."
......
...@@ -15,7 +15,7 @@ bundle=$(echo $(basename $jar .jar) | sed 's/-[0-9].*//g') ...@@ -15,7 +15,7 @@ bundle=$(echo $(basename $jar .jar) | sed 's/-[0-9].*//g')
15 15
16 echo "pushing bundle: $bundle" 16 echo "pushing bundle: $bundle"
17 17
18 -nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2) 18 +nodes=$(env | sort | egrep "^OC[0-9]+" | cut -d= -f2)
19 for node in $nodes; do 19 for node in $nodes; do
20 scp -q $jar $ONOS_USER@$node:.m2/repository/$jar 20 scp -q $jar $ONOS_USER@$node:.m2/repository/$jar
21 scp -q $jar $ONOS_USER@$node:$ONOS_INSTALL_DIR/$KARAF_DIST/system/$jar 21 scp -q $jar $ONOS_USER@$node:$ONOS_INSTALL_DIR/$KARAF_DIST/system/$jar
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
6 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 6 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7 . $ONOS_ROOT/tools/build/envDefaults 7 . $ONOS_ROOT/tools/build/envDefaults
8 8
9 -nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2) 9 +nodes=$(env | sort | egrep "^OC[0-9]+" | cut -d= -f2)
10 10
11 onos-service --cell stop 11 onos-service --cell stop
12 12
......
...@@ -17,7 +17,7 @@ password=${password:-$user} # password defaults to the user if not specified ...@@ -17,7 +17,7 @@ password=${password:-$user} # password defaults to the user if not specified
17 let OPC=$OPTIND-1 17 let OPC=$OPTIND-1
18 shift $OPC 18 shift $OPC
19 19
20 -nodes=${1:-$(env | sort | egrep "OC[0-9]+" | cut -d= -f2)} 20 +nodes=${1:-$(env | sort | egrep "^OC[0-9]+" | cut -d= -f2)}
21 21
22 for node in $nodes; do 22 for node in $nodes; do
23 # Prune the node entry from the known hosts file since server key changes 23 # Prune the node entry from the known hosts file since server key changes
......
...@@ -36,7 +36,7 @@ case $2 in ...@@ -36,7 +36,7 @@ case $2 in
36 start|stop|restart|status) 36 start|stop|restart|status)
37 # Select the target 37 # Select the target
38 if [ "${1}" = "--cell" ]; then 38 if [ "${1}" = "--cell" ]; then
39 - nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2) 39 + nodes=$(env | sort | egrep "^OC[0-9]+" | cut -d= -f2)
40 else 40 else
41 nodes=$(find_node ${1:-$OCI}) 41 nodes=$(find_node ${1:-$OCI})
42 fi 42 fi
......
...@@ -43,7 +43,7 @@ fi ...@@ -43,7 +43,7 @@ fi
43 echo "ONOS_CELL=${ONOS_CELL}" 43 echo "ONOS_CELL=${ONOS_CELL}"
44 echo "ONOS_NIC=${ONOS_NIC}" 44 echo "ONOS_NIC=${ONOS_NIC}"
45 # get number of OC variables 45 # get number of OC variables
46 -max=$( env | egrep 'OC[0-9]+' | wc -l ) 46 +max=$( env | egrep '^OC[0-9]+' | wc -l )
47 for n in $( seq 0 ${max} ); do 47 for n in $( seq 0 ${max} ); do
48 ocn="OC${n}" 48 ocn="OC${n}"
49 if [ -n "${!ocn}" ]; then 49 if [ -n "${!ocn}" ]; then
......
...@@ -36,4 +36,4 @@ $SSHCMD -n $ONOS_USER@$OCN mkdir -p topos ...@@ -36,4 +36,4 @@ $SSHCMD -n $ONOS_USER@$OCN mkdir -p topos
36 $SCPCMD $ONOS_ROOT/tools/test/topos/* $ONOS_USER@$OCN:topos/ 36 $SCPCMD $ONOS_ROOT/tools/test/topos/* $ONOS_USER@$OCN:topos/
37 37
38 echo "Starting Network." 38 echo "Starting Network."
39 -$SSHCMD -t $ONOS_USER@$OCN sudo python $topo $(env | sort | egrep "OC[0-9]+" | cut -d= -f2) 39 +$SSHCMD -t $ONOS_USER@$OCN sudo python $topo $(env | sort | egrep "^OC[0-9]+" | cut -d= -f2)
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
8 8
9 echo "This facility has been deprecated and will be removed in 1.6.0 (Goldeneye) release!!!" 9 echo "This facility has been deprecated and will be removed in 1.6.0 (Goldeneye) release!!!"
10 10
11 -nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2) 11 +nodes=$(env | sort | egrep "^OC[0-9]+" | cut -d= -f2)
12 12
13 for node in $nodes; do 13 for node in $nodes; do
14 printf "$node..." 14 printf "$node..."
......
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
6 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 6 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7 . $ONOS_ROOT/tools/build/envDefaults 7 . $ONOS_ROOT/tools/build/envDefaults
8 8
9 -for node in $OCT $OCN $(env | sort | egrep "OC[0-9]+" | cut -d= -f2); do 9 +for node in $OCT $OCN $(env | sort | egrep "^OC[0-9]+" | cut -d= -f2); do
10 printf "%s: " $node; ssh -n -o StrictHostKeyChecking=no -o PasswordAuthentication=no $ONOS_USER@$node hostname 10 printf "%s: " $node; ssh -n -o StrictHostKeyChecking=no -o PasswordAuthentication=no $ONOS_USER@$node hostname
11 done 11 done
......