Committed by
Gerrit Code Review
Check that the DHCP Manager is active before testing its configuration
Change-Id: Id760d58df005060c0f1d0c2ebdde90fe356d2c9f
Showing
2 changed files
with
28 additions
and
3 deletions
tools/test/bin/onos-check-component
0 → 100755
| 1 | +#!/bin/bash | ||
| 2 | +# ----------------------------------------------------------------------------- | ||
| 3 | +# Checks whether the given ONOS component has a given state. | ||
| 4 | +# ----------------------------------------------------------------------------- | ||
| 5 | + | ||
| 6 | +aux=/tmp/stc-$$.log | ||
| 7 | +trap "rm -f $aux 2>/dev/null" EXIT | ||
| 8 | + | ||
| 9 | +node=$1 | ||
| 10 | +component=$2 | ||
| 11 | +state=$3 | ||
| 12 | + | ||
| 13 | +for attempt in {1..30}; do | ||
| 14 | + onos ${node:-$OCI} scr:list | grep $component > $aux | ||
| 15 | + | ||
| 16 | + if grep -q $state $aux; then | ||
| 17 | + exit 0 | ||
| 18 | + else | ||
| 19 | + sleep 1 | ||
| 20 | + fi | ||
| 21 | +done | ||
| 22 | + | ||
| 23 | +cat $aux && exit 1 |
| ... | @@ -25,8 +25,10 @@ | ... | @@ -25,8 +25,10 @@ |
| 25 | <!-- Check that the activation was successful --> | 25 | <!-- Check that the activation was successful --> |
| 26 | <group name="Netcfg.Check-Dhcp-App-Activated" requires="Netcfg.Activate-Dhcp"> | 26 | <group name="Netcfg.Check-Dhcp-App-Activated" requires="Netcfg.Activate-Dhcp"> |
| 27 | <parallel var="${OC#}"> | 27 | <parallel var="${OC#}"> |
| 28 | - <step name="Netcfg.Check-Dhcp-App-Activated-${#}" delay="2" | 28 | + <step name="Netcfg.Check-Dhcp-App-Activated-${#}" |
| 29 | exec="onos-check-apps ${OC#} drivers,openflow,proxyarp,dhcp includes"/> | 29 | exec="onos-check-apps ${OC#} drivers,openflow,proxyarp,dhcp includes"/> |
| 30 | + <step name="Netcfg.Check-Dhcp-Component-Active-${#}" | ||
| 31 | + exec="onos-check-component ${OC#} org.onosproject.dhcp.impl.DhcpManager ACTIVE"/> | ||
| 30 | </parallel> | 32 | </parallel> |
| 31 | </group> | 33 | </group> |
| 32 | 34 | ||
| ... | @@ -37,7 +39,7 @@ | ... | @@ -37,7 +39,7 @@ |
| 37 | <group name="Query1" requires="Netcfg.Post-1"> | 39 | <group name="Query1" requires="Netcfg.Post-1"> |
| 38 | <parallel var="${OC#}" starts="Netcfg.Query-1-${#}"> | 40 | <parallel var="${OC#}" starts="Netcfg.Query-1-${#}"> |
| 39 | <!-- Check that the values made it into the config for the DHCP server --> | 41 | <!-- Check that the values made it into the config for the DHCP server --> |
| 40 | - <step name="Netcfg.QueryDhcp-1-${#}" delay="2" | 42 | + <step name="Netcfg.QueryDhcp-1-${#}" |
| 41 | exec="check-dhcp-netcfg.py ${OC#} ttl=1 lease=2 renew=3 rebind=4 delay=5 timeout=6"/> | 43 | exec="check-dhcp-netcfg.py ${OC#} ttl=1 lease=2 renew=3 rebind=4 delay=5 timeout=6"/> |
| 42 | </parallel> | 44 | </parallel> |
| 43 | </group> | 45 | </group> |
| ... | @@ -50,7 +52,7 @@ | ... | @@ -50,7 +52,7 @@ |
| 50 | <group name="Query2" requires="Netcfg.Post-2"> | 52 | <group name="Query2" requires="Netcfg.Post-2"> |
| 51 | <parallel var="${OC#}" starts="Netcfg.Query-2-${#}"> | 53 | <parallel var="${OC#}" starts="Netcfg.Query-2-${#}"> |
| 52 | <!-- Check that the values made it into the config for the DHCP server --> | 54 | <!-- Check that the values made it into the config for the DHCP server --> |
| 53 | - <step name="Netcfg.QueryDhcp-2-${#}" delay="2" | 55 | + <step name="Netcfg.QueryDhcp-2-${#}" |
| 54 | exec="check-dhcp-netcfg.py ${OC#} ttl=21 lease=22 renew=23 rebind=24 delay=25 timeout=26"/> | 56 | exec="check-dhcp-netcfg.py ${OC#} ttl=21 lease=22 renew=23 rebind=24 delay=25 timeout=26"/> |
| 55 | </parallel> | 57 | </parallel> |
| 56 | </group> | 58 | </group> | ... | ... |
-
Please register or login to post a comment