Adding ability to get borrowed cell definition without changing the existing reservation.
Change-Id: Ib1fba430371f49f3c928998af98a6d347fabd93d
diff --git a/tools/dev/bash_profile b/tools/dev/bash_profile
index b43ac32..1c449a2 100644
--- a/tools/dev/bash_profile
+++ b/tools/dev/bash_profile
@@ -120,13 +120,17 @@
export ONOS_INSTANCES=$(env | grep 'OC[0-9]*=' | sort | cut -d= -f2)
setPrimaryInstance 1 >/dev/null
cell
+ onos-verify-cell
;;
"return")
curl -sS -X DELETE "http://$CELL_WARDEN:4321/?user=$(id -un)"
+ unset ONOS_CELL ONOS_NIC ONOS_IP ONOS_APPS ONOS_BOOT_FEATURES
+ unset OCI OCN OCT ONOS_INSTANCES ONOS_FEATURES
+ unset $(env | sed -n 's:\(^OC[0-9]\{1,\}\)=.*:\1 :g p')
;;
"status")
- curl -sS "http://$CELL_WARDEN:4321/"
+ curl -sS "http://$CELL_WARDEN:4321/" | sort
;;
"")
diff --git a/tools/test/bin/onos-cell b/tools/test/bin/onos-cell
new file mode 100755
index 0000000..45a68b9
--- /dev/null
+++ b/tools/test/bin/onos-cell
@@ -0,0 +1,9 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# List available ONOS cells configuration.
+# -----------------------------------------------------------------------------
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/dev/bash_profile
+
+cell "$@"
\ No newline at end of file
diff --git a/utils/warden/src/main/java/org/onlab/warden/Warden.java b/utils/warden/src/main/java/org/onlab/warden/Warden.java
index b1e4c71..0e09def 100644
--- a/utils/warden/src/main/java/org/onlab/warden/Warden.java
+++ b/utils/warden/src/main/java/org/onlab/warden/Warden.java
@@ -55,7 +55,6 @@
private static final long TIMEOUT = 10; // 10 seconds
private static final int MAX_MINUTES = 240; // 4 hours max
private static final int MINUTE = 60_000; // 1 minute
- private static final int DEFAULT_MINUTES = 60;
private final File log = new File("warden.log");
@@ -158,10 +157,11 @@
long now = System.currentTimeMillis();
Reservation reservation = currentUserReservation(userName);
if (reservation == null) {
+ checkArgument(minutes > 0, "Number of minutes must be positive");
Set<String> cells = getAvailableCells();
checkState(!cells.isEmpty(), "No cells are presently available");
String cellName = ImmutableList.copyOf(cells).get(random.nextInt(cells.size()));
- reservation = new Reservation(cellName, userName, now, minutes == 0 ? DEFAULT_MINUTES : minutes);
+ reservation = new Reservation(cellName, userName, now, minutes);
} else if (minutes == 0) {
// If minutes are 0, simply return the cell definition
return getCellDefinition(reservation.cellName);