Skip to content

Commit

Permalink
paradigm shift
Browse files Browse the repository at this point in the history
  • Loading branch information
oncilla committed Jan 30, 2019
1 parent 45b3e6c commit 965c309
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions acceptance/topo_invalid_reloads_acceptance/test
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ TEST_TOPOLOGY="topology/Tiny.topo"

IA=${IA:-1-ff00:0:112}
IA_FILE="$(ia_file $IA)"
SRC_AS_FILE="$(as_file $IA)"
AS_FILE="$(as_file $IA)"

TOPO="gen/ISD1/AS$SRC_AS_FILE/topology.json"
TOPO="gen/ISD1/AS$AS_FILE/topology.json"

test_setup() {
set -e
Expand All @@ -26,37 +26,37 @@ test_setup() {

test_run() {
set -e
cp "gen/ISD1/AS$SRC_AS_FILE/ps$IA_FILE-1/topology.json" "gen/ISD1/AS$SRC_AS_FILE/"
test_ps_immutable "ps1-ff00_0_111-1" "gen/ISD1/AS$SRC_AS_FILE/ps$IA_FILE-1/topology.json"
test_immutable "sd1-ff00_0_111" "gen/ISD1/AS$SRC_AS_FILE/endhost/topology.json"
cp "gen/ISD1/AS$AS_FILE/ps$IA_FILE-1/topology.json" "$TOPO"
test_ps_immutable "ps$IA_FILE-1" "gen/ISD1/AS$AS_FILE/ps$IA_FILE-1/topology.json" "PS"
test_immutable "sd$IA_FILE" "gen/ISD1/AS$AS_FILE/endhost/topology.json" "SD"

}

test_ps_immutable() {
test_immutable $1 $2
test_immutable $1 $2 "$3"
jq '.PathService[].Addrs.IPv4.Public.Addr = "242.42.42.42"' $TOPO | sponge $2
check_no_reload $1 "Addr"
check_no_reload $1 5 "$3: Addr"
jq '.PathService[].Addrs.IPv4.Public.L4Port = 42424' $TOPO | sponge $2
check_no_reload $1 "L4Port"
check_no_reload $1 6 "$3: L4Port"
}

test_immutable() {
jq '.ISD_AS = "1-ff00:0:111"' $TOPO | sponge $2
check_no_reload "$1" "ISD_AS"
jq '.Core = true' $TOPO | sponge $2
check_no_reload "$1" "Core"
jq '.Overlay = "IPv6"' $TOPO | sponge $2
check_no_reload "$1" "Overlay"
check_no_reload "$1" 1 "$3: ISD_AS"
jq '.Core = true | del( .BorderRouters[].Interfaces )' $TOPO | sponge $2
check_no_reload "$1" 2 "$3: Core"
jq '.Overlay = "UDP/IPv4+6"' $TOPO | sponge $2
check_no_reload "$1" 3 "$3: Overlay"
jq '.MTU = 42' $TOPO | sponge $2
check_no_reload "$1" "MTU"
check_no_reload "$1" 4 "$3: MTU"
}

check_no_reload() {
./tools/dc scion kill -s HUP scion_"$1"
sleep 1
grep -q "Reloaded topology" "logs/$1.log" || local failed=$?
if [ -z ${failed+x} ]; then
echo "FAIL: Successful reload should not be possible. step=( $2 )"
sleep 2
local errors=$( grep "Unable to set topology" "logs/$1.log" | wc -l )
if [ "$errors" != $2 ]; then
echo "FAIL: Successful reload should not be possible. step=( $3 ) expErrCount=$2 actErrCount=$errors "
return 1
fi
}
Expand Down

0 comments on commit 965c309

Please sign in to comment.