Thomas Vachuska
Committed by Gerrit Code Review

Adding ability to get borrowed cell definition without changing the existing reservation.

Change-Id: Ib1fba430371f49f3c928998af98a6d347fabd93d
...@@ -120,13 +120,17 @@ function cell { ...@@ -120,13 +120,17 @@ function cell {
120 export ONOS_INSTANCES=$(env | grep 'OC[0-9]*=' | sort | cut -d= -f2) 120 export ONOS_INSTANCES=$(env | grep 'OC[0-9]*=' | sort | cut -d= -f2)
121 setPrimaryInstance 1 >/dev/null 121 setPrimaryInstance 1 >/dev/null
122 cell 122 cell
123 + onos-verify-cell
123 ;; 124 ;;
124 "return") 125 "return")
125 curl -sS -X DELETE "http://$CELL_WARDEN:4321/?user=$(id -un)" 126 curl -sS -X DELETE "http://$CELL_WARDEN:4321/?user=$(id -un)"
127 + unset ONOS_CELL ONOS_NIC ONOS_IP ONOS_APPS ONOS_BOOT_FEATURES
128 + unset OCI OCN OCT ONOS_INSTANCES ONOS_FEATURES
129 + unset $(env | sed -n 's:\(^OC[0-9]\{1,\}\)=.*:\1 :g p')
126 ;; 130 ;;
127 131
128 "status") 132 "status")
129 - curl -sS "http://$CELL_WARDEN:4321/" 133 + curl -sS "http://$CELL_WARDEN:4321/" | sort
130 ;; 134 ;;
131 135
132 "") 136 "")
......
1 +#!/bin/bash
2 +# -----------------------------------------------------------------------------
3 +# List available ONOS cells configuration.
4 +# -----------------------------------------------------------------------------
5 +
6 +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7 +. $ONOS_ROOT/tools/dev/bash_profile
8 +
9 +cell "$@"
...\ No newline at end of file ...\ No newline at end of file
...@@ -55,7 +55,6 @@ class Warden { ...@@ -55,7 +55,6 @@ class Warden {
55 private static final long TIMEOUT = 10; // 10 seconds 55 private static final long TIMEOUT = 10; // 10 seconds
56 private static final int MAX_MINUTES = 240; // 4 hours max 56 private static final int MAX_MINUTES = 240; // 4 hours max
57 private static final int MINUTE = 60_000; // 1 minute 57 private static final int MINUTE = 60_000; // 1 minute
58 - private static final int DEFAULT_MINUTES = 60;
59 58
60 private final File log = new File("warden.log"); 59 private final File log = new File("warden.log");
61 60
...@@ -158,10 +157,11 @@ class Warden { ...@@ -158,10 +157,11 @@ class Warden {
158 long now = System.currentTimeMillis(); 157 long now = System.currentTimeMillis();
159 Reservation reservation = currentUserReservation(userName); 158 Reservation reservation = currentUserReservation(userName);
160 if (reservation == null) { 159 if (reservation == null) {
160 + checkArgument(minutes > 0, "Number of minutes must be positive");
161 Set<String> cells = getAvailableCells(); 161 Set<String> cells = getAvailableCells();
162 checkState(!cells.isEmpty(), "No cells are presently available"); 162 checkState(!cells.isEmpty(), "No cells are presently available");
163 String cellName = ImmutableList.copyOf(cells).get(random.nextInt(cells.size())); 163 String cellName = ImmutableList.copyOf(cells).get(random.nextInt(cells.size()));
164 - reservation = new Reservation(cellName, userName, now, minutes == 0 ? DEFAULT_MINUTES : minutes); 164 + reservation = new Reservation(cellName, userName, now, minutes);
165 } else if (minutes == 0) { 165 } else if (minutes == 0) {
166 // If minutes are 0, simply return the cell definition 166 // If minutes are 0, simply return the cell definition
167 return getCellDefinition(reservation.cellName); 167 return getCellDefinition(reservation.cellName);
......