Add some interlocks to intents test
Change-Id: I1d4b7509b2e038a1d2d123dfb9324234abcfd916
Showing
2 changed files
with
40 additions
and
5 deletions
tools/test/bin/onos-check-intent
0 → 100755
1 | +#!/bin/bash | ||
2 | +# ----------------------------------------------------------------------------- | ||
3 | +# Checks that all intents in the system have a given state. | ||
4 | +# ----------------------------------------------------------------------------- | ||
5 | + | ||
6 | +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | ||
7 | +. $ONOS_ROOT/tools/build/envDefaults | ||
8 | + | ||
9 | +aux=/tmp/stc-$$.log | ||
10 | +trap "rm -f $aux 2>/dev/null" EXIT | ||
11 | +target=${1:-$OCI} | ||
12 | + | ||
13 | +set -x | ||
14 | +for i in 1 2 3; do | ||
15 | + onos $target "onos:intents" | grep "state=$2" >> $aux && cat $aux && exit 0 | ||
16 | + sleep 1 | ||
17 | +done | ||
18 | + | ||
19 | +cat $aux | ||
20 | +exit 1 | ||
21 | + |
... | @@ -25,12 +25,26 @@ | ... | @@ -25,12 +25,26 @@ |
25 | exec="onos-mininet sendAndExpect h4 ping -c1 h1 --expect ."/> | 25 | exec="onos-mininet sendAndExpect h4 ping -c1 h1 --expect ."/> |
26 | 26 | ||
27 | <step name="Create-Intent" requires="^" | 27 | <step name="Create-Intent" requires="^" |
28 | - exec="onos ${OCI} add-host-intent 00:00:00:00:00:01/-1 00:00:00:00:00:04/-1"/> | 28 | + exec="onos ${OC1} add-host-intent 00:00:00:00:00:01/-1 00:00:00:00:00:04/-1"/> |
29 | + <step name="Validate-Intent-Installed" exec="onos-check-intent ${OC1} INSTALLED" | ||
30 | + requires="Create-Intent" /> | ||
29 | 31 | ||
30 | <import file="${ONOS_SCENARIOS}/net-link-down-up.xml" namespace="Host-Intent"/> | 32 | <import file="${ONOS_SCENARIOS}/net-link-down-up.xml" namespace="Host-Intent"/> |
31 | - <dependency name="Host-Intent.Net-Link-Down-Up" requires="Create-Intent"/> | 33 | + <dependency name="Host-Intent.Net-Link-Down-Up" requires="Validate-Intent-Installed"/> |
34 | + <step name="Validate-Intent-Installed-Still" exec="onos-check-intent ${OC1} INSTALLED" | ||
35 | + requires="Host-Intent.Link-1-Down" /> | ||
36 | + | ||
37 | + <step name="Validate-Intent-Failed" exec="onos-check-intent ${OC1} FAILED" | ||
38 | + requires="Host-Intent.Link-2-Down" /> | ||
39 | + | ||
40 | + <step name="Validate-Intent-Installed-Again" exec="onos-check-intent ${OC1} INSTALLED" | ||
41 | + requires="Host-Intent.Link-1-Up" /> | ||
42 | + <dependency name="Host-Intent.Ping-4" requires="Validate-Intent-Installed-Again" /> | ||
43 | + | ||
44 | + <step name="Remove-Intent" requires="~Host-Intent.Net-Link-Down-Up" | ||
45 | + exec="onos ${OC1} remove-intent -p"/> | ||
46 | + | ||
47 | + | ||
32 | 48 | ||
33 | - <step name="Remove-Intent" requires="Host-Intent.Net-Link-Down-Up" | ||
34 | - exec="onos ${OCI} remove-intent --purge"/> | ||
35 | </group> | 49 | </group> |
36 | -</scenario> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
50 | +</scenario> | ... | ... |
-
Please register or login to post a comment