Committed by
Gerrit Code Review
Reverting changes to onos-cell & cell
Change-Id: Ieb35fe2d51c1981f1d560bdfe072d5ccc6a26f90
Showing
2 changed files
with
55 additions
and
55 deletions
| ... | @@ -106,7 +106,57 @@ function setPrimaryInstance { | ... | @@ -106,7 +106,57 @@ function setPrimaryInstance { |
| 106 | # ON.Lab shared test cell warden address | 106 | # ON.Lab shared test cell warden address |
| 107 | export CELL_WARDEN="10.254.1.19" | 107 | export CELL_WARDEN="10.254.1.19" |
| 108 | 108 | ||
| 109 | -alias cell='onos-cell' | 109 | +# Applies the settings in the specified cell file or lists current cell definition |
| 110 | +# if no cell file is given. | ||
| 111 | +function cell { | ||
| 112 | + cell=$1 | ||
| 113 | + case "$cell" in | ||
| 114 | + "borrow") | ||
| 115 | + aux="/tmp/cell-$$" | ||
| 116 | + curl -sS -X POST "http://$CELL_WARDEN:4321/?duration=${2:-0}&user=${3:-$(id -un)}" \ | ||
| 117 | + -d "$(cat ~/.ssh/id_rsa.pub)" > $aux | ||
| 118 | + . $aux | ||
| 119 | + rm -f $aux | ||
| 120 | + export ONOS_INSTANCES=$(env | grep 'OC[0-9]*=' | sort | cut -d= -f2) | ||
| 121 | + setPrimaryInstance 1 >/dev/null | ||
| 122 | + onos-verify-cell | ||
| 123 | + ;; | ||
| 124 | + "return") | ||
| 125 | + curl -sS -X DELETE "http://$CELL_WARDEN:4321/?user=${2:-$(id -un)}" | ||
| 126 | + unset ONOS_CELL ONOS_NIC ONOS_IP ONOS_APPS ONOS_BOOT_FEATURES | ||
| 127 | + unset OCI OCN OCT ONOS_INSTANCES ONOS_FEATURES | ||
| 128 | + unset $(env | sed -n 's:\(^OC[0-9]\{1,\}\)=.*:\1 :g p') | ||
| 129 | + ;; | ||
| 130 | + | ||
| 131 | + "status") | ||
| 132 | + curl -sS "http://$CELL_WARDEN:4321/" | sort | ||
| 133 | + ;; | ||
| 134 | + | ||
| 135 | + "") | ||
| 136 | + env | egrep "ONOS_CELL" | ||
| 137 | + env | egrep "OCI" | ||
| 138 | + env | egrep "OC[0-9]+" | sort | ||
| 139 | + env | egrep "OC[NT]" | ||
| 140 | + env | egrep "ONOS_" | egrep -v 'ONOS_ROOT|ONOS_CELL|ONOS_INSTANCES' | sort | ||
| 141 | + ;; | ||
| 142 | + | ||
| 143 | + *) | ||
| 144 | + [ ! -f $ONOS_ROOT/tools/test/cells/$1 ] && \ | ||
| 145 | + echo "No such cell: $1" >&2 && return 1 | ||
| 146 | + unset ONOS_CELL ONOS_NIC ONOS_IP ONOS_APPS ONOS_BOOT_FEATURES | ||
| 147 | + unset OCI OCN OCT ONOS_INSTANCES ONOS_FEATURES | ||
| 148 | + unset $(env | sed -n 's:\(^OC[0-9]\{1,\}\)=.*:\1 :g p') | ||
| 149 | + export ONOS_USER=${ONOS_USER:-sdn} | ||
| 150 | + export ONOS_GROUP=${ONOS_GROUP:-sdn} | ||
| 151 | + export ONOS_WEB_USER=onos | ||
| 152 | + export ONOS_WEB_PASS=rocks | ||
| 153 | + export ONOS_CELL=$1 | ||
| 154 | + . $ONOS_ROOT/tools/test/cells/$1 | ||
| 155 | + export ONOS_INSTANCES=$(env | grep 'OC[0-9]*=' | sort | cut -d= -f2) | ||
| 156 | + setPrimaryInstance 1 >/dev/null | ||
| 157 | + cell | ||
| 158 | + esac | ||
| 159 | +} | ||
| 110 | 160 | ||
| 111 | [ -n "$ONOS_CELL" -a "$ONOS_CELL" != "borrow" ] && cell $ONOS_CELL > /dev/null | 161 | [ -n "$ONOS_CELL" -a "$ONOS_CELL" != "borrow" ] && cell $ONOS_CELL > /dev/null |
| 112 | 162 | ... | ... |
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- | 2 | # ----------------------------------------------------------------------------- |
| 3 | -# Applies the settings in the specified cell file or lists current cell | 3 | +# List available ONOS cells configuration. |
| 4 | -# definition if no cell file is given. | ||
| 5 | # ----------------------------------------------------------------------------- | 4 | # ----------------------------------------------------------------------------- |
| 6 | 5 | ||
| 7 | -# Sets the primary instance to the specified instance number. | 6 | +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 8 | -function setPrimaryInstance { | 7 | +. $ONOS_ROOT/tools/dev/bash_profile |
| 9 | - export OCI=$(env | egrep "OC[0-9]+" | sort | egrep OC${1:-1} | cut -d= -f2) | ||
| 10 | - echo $OCI | ||
| 11 | -} | ||
| 12 | 8 | ||
| 13 | -cell=$1 | ||
| 14 | -case "$cell" in | ||
| 15 | -"borrow") | ||
| 16 | - aux="/tmp/cell-$$" | ||
| 17 | - curl -sS -X POST "http://$CELL_WARDEN:4321/?duration=${2:-0}&user=${3:-$(id -un)}" \ | ||
| 18 | - -d "$(cat ~/.ssh/id_rsa.pub)" > $aux | ||
| 19 | - . $aux | ||
| 20 | - rm -f $aux | ||
| 21 | - export ONOS_INSTANCES=$(env | grep 'OC[0-9]*=' | sort | cut -d= -f2) | ||
| 22 | - setPrimaryInstance 1 >/dev/null | ||
| 23 | - onos-verify-cell | ||
| 24 | - ;; | ||
| 25 | -"return") | ||
| 26 | - curl -sS -X DELETE "http://$CELL_WARDEN:4321/?user=${2:-$(id -un)}" | ||
| 27 | - unset ONOS_CELL ONOS_NIC ONOS_IP ONOS_APPS ONOS_BOOT_FEATURES | ||
| 28 | - unset OCI OCN OCT ONOS_INSTANCES ONOS_FEATURES | ||
| 29 | - unset $(env | sed -n 's:\(^OC[0-9]\{1,\}\)=.*:\1 :g p') | ||
| 30 | - ;; | ||
| 31 | - | ||
| 32 | -"status") | ||
| 33 | - curl -sS "http://$CELL_WARDEN:4321/" | sort | ||
| 34 | - ;; | ||
| 35 | - | ||
| 36 | -"") | ||
| 37 | - env | egrep "ONOS_CELL" | ||
| 38 | - env | egrep "OCI" | ||
| 39 | - env | egrep "OC[0-9]+" | sort | ||
| 40 | - env | egrep "OC[NT]" | ||
| 41 | - env | egrep "ONOS_" | egrep -v 'ONOS_ROOT|ONOS_CELL|ONOS_INSTANCES' | sort | ||
| 42 | - ;; | ||
| 43 | - | ||
| 44 | -*) | ||
| 45 | - [ ! -f $ONOS_ROOT/tools/test/cells/$1 ] && \ | ||
| 46 | - echo "No such cell: $1" >&2 && return 1 | ||
| 47 | - unset ONOS_CELL ONOS_NIC ONOS_IP ONOS_APPS ONOS_BOOT_FEATURES | ||
| 48 | - unset OCI OCN OCT ONOS_INSTANCES ONOS_FEATURES | ||
| 49 | - unset $(env | sed -n 's:\(^OC[0-9]\{1,\}\)=.*:\1 :g p') | ||
| 50 | - export ONOS_USER=${ONOS_USER:-sdn} | ||
| 51 | - export ONOS_GROUP=${ONOS_GROUP:-sdn} | ||
| 52 | - export ONOS_WEB_USER=onos | ||
| 53 | - export ONOS_WEB_PASS=rocks | ||
| 54 | - export ONOS_CELL=$1 | ||
| 55 | - . $ONOS_ROOT/tools/test/cells/$1 | ||
| 56 | - export ONOS_INSTANCES=$(env | grep 'OC[0-9]*=' | sort | cut -d= -f2) | ||
| 57 | - setPrimaryInstance 1 >/dev/null | ||
| 58 | - onos-cell | ||
| 59 | -esac | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 9 | +cell "$@" | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment