Enhanced cell & cells tools.
Provided initial sketch of the Annotated concept for the model attributes.
Showing
11 changed files
with
63 additions
and
26 deletions
| 1 | package org.onlab.onos.net; | 1 | package org.onlab.onos.net; |
| 2 | 2 | ||
| 3 | +import com.google.common.collect.ImmutableSet; | ||
| 4 | +import com.google.common.collect.Maps; | ||
| 3 | import org.onlab.onos.net.provider.ProviderId; | 5 | import org.onlab.onos.net.provider.ProviderId; |
| 4 | 6 | ||
| 7 | +import java.util.Map; | ||
| 8 | +import java.util.Set; | ||
| 9 | + | ||
| 5 | /** | 10 | /** |
| 6 | * Base implementation of a network model entity. | 11 | * Base implementation of a network model entity. |
| 7 | */ | 12 | */ |
| 8 | -public class AbstractModel implements Provided { | 13 | +public class AbstractModel implements Provided, Annotated { |
| 9 | 14 | ||
| 10 | private final ProviderId providerId; | 15 | private final ProviderId providerId; |
| 11 | 16 | ||
| 17 | + // FIXME: figure out whether to make this concurrent or immutable | ||
| 18 | + private final Map<String, String> annotations = Maps.newHashMap(); | ||
| 19 | + | ||
| 12 | // For serialization | 20 | // For serialization |
| 13 | public AbstractModel() { | 21 | public AbstractModel() { |
| 14 | providerId = null; | 22 | providerId = null; |
| ... | @@ -28,4 +36,13 @@ public class AbstractModel implements Provided { | ... | @@ -28,4 +36,13 @@ public class AbstractModel implements Provided { |
| 28 | return providerId; | 36 | return providerId; |
| 29 | } | 37 | } |
| 30 | 38 | ||
| 39 | + @Override | ||
| 40 | + public Set<String> annotationKeys() { | ||
| 41 | + return ImmutableSet.copyOf(annotations.keySet()); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + @Override | ||
| 45 | + public String annotation(String key) { | ||
| 46 | + return annotations.get(key); | ||
| 47 | + } | ||
| 31 | } | 48 | } | ... | ... |
| 1 | +package org.onlab.onos.net; | ||
| 2 | + | ||
| 3 | +import java.util.Set; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Represents an entity that carries arbitrary annotations. | ||
| 7 | + */ | ||
| 8 | +public interface Annotated { | ||
| 9 | + | ||
| 10 | + /** | ||
| 11 | + * Returns the set of annotation keys currently available. | ||
| 12 | + * | ||
| 13 | + * @return set of annotation keys | ||
| 14 | + */ | ||
| 15 | + Set<String> annotationKeys(); | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * Returns the annotation value for the specified key. | ||
| 19 | + * | ||
| 20 | + * @param key annotation key | ||
| 21 | + * @return annotation value; null if there is no annotation | ||
| 22 | + */ | ||
| 23 | + String annotation(String key); | ||
| 24 | + | ||
| 25 | +} |
| ... | @@ -9,5 +9,9 @@ | ... | @@ -9,5 +9,9 @@ |
| 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-package | 11 | onos-package |
| 12 | -for node in $nodes; do (printf "%s: %s\n" "$node" "`onos-install -f $node`")& done | 12 | +for node in $nodes; do onos-install -f $node 1>/dev/null & done |
| 13 | + | ||
| 14 | +# Wait for shutdown before waiting for restart | ||
| 15 | +sleep 3 | ||
| 16 | + | ||
| 13 | for node in $nodes; do onos-wait-for-start $node; done | 17 | for node in $nodes; do onos-wait-for-start $node; done | ... | ... |
| ... | @@ -57,6 +57,7 @@ function cell { | ... | @@ -57,6 +57,7 @@ function cell { |
| 57 | if [ -n "$1" ]; then | 57 | if [ -n "$1" ]; then |
| 58 | [ ! -f $ONOS_ROOT/tools/test/cells/$1 ] && \ | 58 | [ ! -f $ONOS_ROOT/tools/test/cells/$1 ] && \ |
| 59 | echo "No such cell: $1" >&2 && return 1 | 59 | echo "No such cell: $1" >&2 && return 1 |
| 60 | + unset OC1 OC2 OC3 OC4 OC5 OC6 OC7 OC8 OC9 OCN OCI | ||
| 60 | . $ONOS_ROOT/tools/test/cells/$1 | 61 | . $ONOS_ROOT/tools/test/cells/$1 |
| 61 | export OCI=$OC1 | 62 | export OCI=$OC1 |
| 62 | export ONOS_CELL=$1 | 63 | export ONOS_CELL=$1 |
| ... | @@ -74,7 +75,11 @@ cell local >/dev/null # Default cell is the local VMs | ... | @@ -74,7 +75,11 @@ cell local >/dev/null # Default cell is the local VMs |
| 74 | 75 | ||
| 75 | # Lists available cells | 76 | # Lists available cells |
| 76 | function cells { | 77 | function cells { |
| 77 | - ls -1 $ONOS_ROOT/tools/test/cells | 78 | + for cell in $(ls -1 $ONOS_ROOT/tools/test/cells); do |
| 79 | + printf "%-12s %s\n" \ | ||
| 80 | + "$([ $cell = $ONOS_CELL ] && echo $cell '*' || echo $cell)" \ | ||
| 81 | + "$(grep '^#' $ONOS_ROOT/tools/test/cells/$cell | head -n 1)" | ||
| 82 | + done | ||
| 78 | } | 83 | } |
| 79 | 84 | ||
| 80 | # Miscellaneous | 85 | # Miscellaneous | ... | ... |
tools/test/cells/.reset
deleted
100644 → 0
| 1 | -unset OC1 OC2 OC3 OC4 OC5 OC6 OC7 OC8 OC9 OCN ONOS_NIC ONOS_FEATURES |
| 1 | -# Default virtual box ONOS instances 1,2 & ONOS mininet box | 1 | +# Local VirtualBox-based ONOS instances 1,2 & ONOS mininet box |
| 2 | -. $ONOS_ROOT/tools/test/cells/.reset | ||
| 3 | 2 | ||
| 4 | export ONOS_NIC=192.168.56.* | 3 | export ONOS_NIC=192.168.56.* |
| 5 | - | ||
| 6 | export OC1="192.168.56.101" | 4 | export OC1="192.168.56.101" |
| 7 | export OC2="192.168.56.102" | 5 | export OC2="192.168.56.102" |
| 8 | 6 | ... | ... |
| 1 | -# ProxMox-based cell of ONOS instances 1,2 & ONOS mininet box | 1 | +# ProxMox-based cell of ONOS instance; no mininet-box |
| 2 | -. $ONOS_ROOT/tools/test/cells/.reset | ||
| 3 | 2 | ||
| 4 | export ONOS_FEATURES="webconsole,onos-api,onos-core-trivial,onos-cli,onos-openflow,onos-app-fwd,onos-app-mobility,onos-app-tvue" | 3 | export ONOS_FEATURES="webconsole,onos-api,onos-core-trivial,onos-cli,onos-openflow,onos-app-fwd,onos-app-mobility,onos-app-tvue" |
| 5 | 4 | ||
| 6 | export ONOS_NIC="10.128.4.*" | 5 | export ONOS_NIC="10.128.4.*" |
| 7 | - | ||
| 8 | export OC1="10.128.4.60" | 6 | export OC1="10.128.4.60" |
| 9 | 7 | ... | ... |
| 1 | # ProxMox-based cell of ONOS instances 1,2 & ONOS mininet box | 1 | # ProxMox-based cell of ONOS instances 1,2 & ONOS mininet box |
| 2 | -. $ONOS_ROOT/tools/test/cells/.reset | ||
| 3 | 2 | ||
| 4 | export ONOS_NIC="10.1.9.*" | 3 | export ONOS_NIC="10.1.9.*" |
| 5 | - | ||
| 6 | export OC1="10.1.9.94" | 4 | export OC1="10.1.9.94" |
| 7 | export OC2="10.1.9.82" | 5 | export OC2="10.1.9.82" |
| 8 | 6 | ... | ... |
tools/test/cells/single
0 → 100644
tools/test/cells/tom
deleted
100644 → 0
| 1 | -# Default virtual box ONOS instances 1,2 & ONOS mininet box | 1 | +# Local VirtualBox-based ONOS instances 1,2,3 & ONOS mininet box |
| 2 | 2 | ||
| 3 | export ONOS_NIC=192.168.56.* | 3 | export ONOS_NIC=192.168.56.* |
| 4 | - | ||
| 5 | -export ONOS_FEATURES="webconsole,onos-api,onos-core-trivial,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-fwd,onos-app-foo" | ||
| 6 | - | ||
| 7 | export OC1="192.168.56.101" | 4 | export OC1="192.168.56.101" |
| 8 | export OC2="192.168.56.102" | 5 | export OC2="192.168.56.102" |
| 9 | export OC3="192.168.56.104" | 6 | export OC3="192.168.56.104" | ... | ... |
-
Please register or login to post a comment