route-expiration-test: Add route expiration test
refs: #1717
Change-Id: If8901d086b7f54ae6fbf42a2168bc4967ed9bc58
diff --git a/test_route_expiration/route-expiration-test.sh b/test_route_expiration/route-expiration-test.sh
new file mode 100755
index 0000000..42361a5
--- /dev/null
+++ b/test_route_expiration/route-expiration-test.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+source include.sh
+
+HOST_B=$IP4_B1
+HOST_C=$IP4_C1
+
+set_up
+
+echo "Registering routes..."
+
+P_TO_B_FACE=$(register "/P" 10 $HOST_B)
+P_TO_C_FACE=$(register "/P" 20 $HOST_C)
+Q_TO_B_FACE=$(register "/Q" 20 $HOST_B)
+R_TO_C_FACE=$(register "/R" 10 $HOST_C)
+S_TO_B_FACE=$(register "/S" 3600 $HOST_B)
+
+sleep_for_seconds 5
+
+is_expiration_period_correct "/P" $P_TO_B_FACE 3 8
+is_expiration_period_correct "/P" $P_TO_C_FACE 13 18
+is_expiration_period_correct "/Q" $Q_TO_B_FACE 13 18
+is_expiration_period_correct "/R" $R_TO_C_FACE 3 8
+is_expiration_period_correct "/S" $S_TO_B_FACE 3000 3600
+
+sleep_for_seconds 10
+
+is_expiration_period_correct "/P" $P_TO_C_FACE 3 8
+expect_route_does_not_exist "/P" $P_TO_B_FACE
+is_expiration_period_correct "/Q" $Q_TO_B_FACE 3 8
+expect_entry_does_not_exist "/R"
+is_expiration_period_correct "/S" $S_TO_B_FACE 3000 3600
+
+sleep_for_seconds 8
+
+expect_entry_does_not_exist "/P"
+expect_entry_does_not_exist "/Q"
+expect_entry_does_not_exist "/R"
+is_expiration_period_correct "/S" $S_TO_B_FACE 3000 3600
+
+clean_up