mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-18 19:01:06 +02:00
- bidrectional vnet link creation
- optionally specify expected number of intents in "onos-check-intent" Change-Id: I523a7fd9e1aaa72b441d2428fb9ebb692b07bdd0 - bidrectional vnet link creation (when using ssh) - optionally specify expected number of intents in "onos-check-intent" Change-Id: I5c6fe1f269eddeaa70dfec819853d42af59fbd8e
This commit is contained in:
parent
95b416cd12
commit
b0d0ada02b
@ -6,10 +6,11 @@
|
|||||||
function _usage () {
|
function _usage () {
|
||||||
cat << _EOF_
|
cat << _EOF_
|
||||||
usage:
|
usage:
|
||||||
$(basename $0) [-w] [node]
|
$(basename $0) [-w] [-f] [node]
|
||||||
|
|
||||||
flags:
|
flags:
|
||||||
- -w : Waits for ONOS instance to reach run-level 100, i.e. to be fully started.
|
- -w : Waits for ONOS instance to reach run-level 100, i.e. to be fully started.
|
||||||
|
- -f : (Affects non-secure client only) - use bash's IFS expansion of positional parameters
|
||||||
|
|
||||||
options:
|
options:
|
||||||
- [node] : the node to attach to
|
- [node] : the node to attach to
|
||||||
@ -29,13 +30,18 @@ _EOF_
|
|||||||
. $ONOS_ROOT/tools/test/bin/find-node.sh
|
. $ONOS_ROOT/tools/test/bin/find-node.sh
|
||||||
|
|
||||||
[ "$1" = "-w" ] && shift && onos-wait-for-start $1
|
[ "$1" = "-w" ] && shift && onos-wait-for-start $1
|
||||||
|
[ "$1" = "-f" ] && shift && flat=1
|
||||||
|
|
||||||
[ -n "$1" ] && OCI=$(find_node $1) && shift
|
[ -n "$1" ] && OCI=$(find_node $1) && shift
|
||||||
|
|
||||||
if which client 1>/dev/null 2>&1 && [ -z "$ONOS_USE_SSH" ]; then
|
if which client 1>/dev/null 2>&1 && [ -z "$ONOS_USE_SSH" ]; then
|
||||||
# Use Karaf client only if we can and are allowed to
|
# Use Karaf client only if we can and are allowed to
|
||||||
unset KARAF_HOME
|
unset KARAF_HOME
|
||||||
|
if [ -z "$flat" ]; then
|
||||||
client -h $OCI -u karaf "$@" 2>/dev/null
|
client -h $OCI -u karaf "$@" 2>/dev/null
|
||||||
|
else
|
||||||
|
client -h $OCI -u karaf "$*" 2>/dev/null
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# Otherwise use raw ssh; strict checking is off for dev environments only
|
# Otherwise use raw ssh; strict checking is off for dev environments only
|
||||||
ssh -p 8101 -o StrictHostKeyChecking=no $OCI "$@"
|
ssh -p 8101 -o StrictHostKeyChecking=no $OCI "$@"
|
||||||
|
@ -13,9 +13,29 @@ target=${1:-$OCI}
|
|||||||
echo onos-check-intent: $*
|
echo onos-check-intent: $*
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
# $1: target host
|
||||||
|
# $2: intent key
|
||||||
|
# $3: intent state
|
||||||
|
# $4: number of expected intents
|
||||||
|
re='^[0-9]+$'
|
||||||
|
[[ $4 =~ $re ]] && numIntentsExpected=$4 # silently ignore if not positive
|
||||||
|
|
||||||
for i in {1..15}; do
|
for i in {1..15}; do
|
||||||
|
echo "Attempt #$i"
|
||||||
onos $target "onos:intents" | tee $aux
|
onos $target "onos:intents" | tee $aux
|
||||||
|
if [ -z "$numIntentsExpected" ]; then
|
||||||
( cat $aux | grep "key=$2" | grep "state=$3" ) && cat $aux && exit 0
|
( cat $aux | grep "key=$2" | grep "state=$3" ) && cat $aux && exit 0
|
||||||
|
else
|
||||||
|
# exit 0 only if expected number of intents (with required key)
|
||||||
|
# are present and all intents match state (if expected no. of intents > 0)
|
||||||
|
numIntents=`grep "key=$2" $aux | wc -l`
|
||||||
|
numIntentsOfState=0
|
||||||
|
[ $numIntentsExpected -gt 0 ] && numIntentsOfState=`grep "key=$2" $aux | grep "state=$3" | wc -l`
|
||||||
|
[ $numIntents -eq $numIntentsOfState ] \
|
||||||
|
&& [ $numIntents -eq $numIntentsExpected ] \
|
||||||
|
&& cat $aux && exit 0
|
||||||
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -46,19 +46,14 @@
|
|||||||
<step name="Create-Port-2" requires="^"
|
<step name="Create-Port-2" requires="^"
|
||||||
exec="onos ${OCI} vnet-create-port ${networkId} device2 2 of:0000000000000009 1"/>
|
exec="onos ${OCI} vnet-create-port ${networkId} device2 2 of:0000000000000009 1"/>
|
||||||
|
|
||||||
<step name="Create-Link-1" requires="^"
|
<step name="Create-Bidirectional-Link" requires="^"
|
||||||
exec="onos ${OCI} vnet-create-link ${networkId} device1 1 device2 2"/>
|
exec="onos -f ${OCI} vnet-create-link --bidirectional ${networkId} device2 2 device1 1"/>
|
||||||
|
|
||||||
<step name="Create-Link-2" requires="^"
|
<step name="Check-intents-installed" requires="^"
|
||||||
exec="onos ${OCI} vnet-create-link ${networkId} device2 2 device1 1"/>
|
exec="onos-check-intent ${OCI} networkId=${networkId} INSTALLED 2"/>
|
||||||
|
|
||||||
<step name="Check-intents-installed" requires="^" env="~"
|
<step name="Ping-hosts-1" requires="^"
|
||||||
exec="onos-check-intent ${OCI} networkId=${networkId} INSTALLED"/>
|
|
||||||
<!-- TODO: ignore return code once intent is working -->
|
|
||||||
|
|
||||||
<step name="Ping-hosts-1" requires="^" env="~"
|
|
||||||
exec="onos-mininet sendAndExpect h4 ping -c1 h9 --expect \ 0% packet loss"/>
|
exec="onos-mininet sendAndExpect h4 ping -c1 h9 --expect \ 0% packet loss"/>
|
||||||
<!-- TODO: ignore return code once intent is working -->
|
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
</scenario>
|
</scenario>
|
||||||
|
@ -22,11 +22,11 @@
|
|||||||
<step name="Check-Vnet-Link" requires="^"
|
<step name="Check-Vnet-Link" requires="^"
|
||||||
exec="onos ${OCI} vnet-links ${networkId}"/>
|
exec="onos ${OCI} vnet-links ${networkId}"/>
|
||||||
|
|
||||||
<step name="Remove-Link-1" requires="^"
|
<step name="Remove-Bidirectional-Link" requires="^"
|
||||||
exec="onos ${OCI} vnet-remove-link ${networkId} device1 1 device2 2"/>
|
exec="onos -f ${OCI} vnet-remove-link --bidirectional ${networkId} device2 2 device1 1"/>
|
||||||
|
|
||||||
<step name="Remove-Link-2" requires="^"
|
<step name="Check-intents-removed" requires="^"
|
||||||
exec="onos ${OCI} vnet-remove-link ${networkId} device2 2 device1 1"/>
|
exec="onos-check-intent ${OCI} networkId=${networkId} IGNORE_STATE 0"/>
|
||||||
|
|
||||||
<step name="Ping-hosts-2" requires="^"
|
<step name="Ping-hosts-2" requires="^"
|
||||||
exec="onos-mininet sendAndExpect h4 ping -c1 h9 --expect \ 100% packet loss"/>
|
exec="onos-mininet sendAndExpect h4 ping -c1 h9 --expect \ 100% packet loss"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user