rewrite Python tests as Bash tests
correct University of Arizona copyright statements
refs #4410
Change-Id: I2e34b28698336d39b64030f68984b711f4bdbd0d
diff --git a/library_helpers/process_manager.py b/library_helpers/process_manager.py
index db686f6..78a8f62 100644
--- a/library_helpers/process_manager.py
+++ b/library_helpers/process_manager.py
@@ -1,7 +1,7 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2014 University of Arizona
+# Copyright (C) 2014 Arizona Board of Regents.
# Author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
# See COPYING for copyright and distribution information.
#
diff --git a/run-vagrant-tests.sh b/run-vagrant-tests.sh
index 9681797..041b492 100755
--- a/run-vagrant-tests.sh
+++ b/run-vagrant-tests.sh
@@ -5,7 +5,7 @@
#
# --
#
-# Copyright (c) 2014-2017, Regents of the University of California,
+# Copyright (c) 2014-2018, Regents of the University of California,
# Arizona Board of Regents,
# Colorado State University,
# University Pierre & Marie Curie, Sorbonne University,
@@ -33,18 +33,13 @@
mkdir -p temp
ssh-keygen -t ecdsa -f temp/sshkey -q -N ""
-vagrant up router
-
vagrant up template
vagrant ssh template -c "sudo apt-get clean"
vagrant package --output nfd-integ.box template
vagrant box remove nfd-integ
vagrant box add --name nfd-integ nfd-integ.box
-vagrant up A
-vagrant up B
-vagrant up C
-vagrant up D
+vagrant up router A B C D
vagrant ssh A -c "cd integration-tests && ./run_tests.py test_all 2>&1 | tee run.log"
vagrant ssh A -c "integration-tests/collect-logs.sh A"
diff --git a/test_congestionmark/test_congestionmark.py b/test_congestionmark/test_congestionmark.py
index e9d5a0a..1d1f7df 100644
--- a/test_congestionmark/test_congestionmark.py
+++ b/test_congestionmark/test_congestionmark.py
@@ -1,7 +1,7 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2017 The University of Arizona
+# Copyright (C) 2017 Arizona Board of Regents.
# Author: Eric Newberry <enewberry@cs.arizona.edu>
# See COPYING for copyright and distribution information.
#
diff --git a/test_cs_freshness/test_cs_freshness.py b/test_cs_freshness/test_cs_freshness.py
index 4cd6b3e..ef9ce39 100644
--- a/test_cs_freshness/test_cs_freshness.py
+++ b/test_cs_freshness/test_cs_freshness.py
@@ -1,7 +1,7 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2014 University of Arizona
+# Copyright (C) 2014 Arizona Board of Regents.
# Author: Yi Huang <ltr120@email.arizona.edu>
# See COPYING for copyright and distribution information.
#
diff --git a/test_fib_matching/README.md b/test_fib_matching/README.md
index 25b3ec6..5db5212 100644
--- a/test_fib_matching/README.md
+++ b/test_fib_matching/README.md
@@ -1,35 +1,37 @@
-Test Case - fib-matching
+Test Case - fib_matching
========================
## Objective ##
-To test NFD's fib matching on a single host.
+Test NFD's FIB matching mechanism on a single host.
## Description ##
-This test case will run the NFD, ndn-traffic and ndn-traffic-server to test NFD's fib matching. The following steps will be followed:
+This test case will run NFD, ndn-traffic, and ndn-traffic-server to test NFD's FIB matching mechanism.
-1. Start NFD.
-2. Start ndn-traffic-server to serve ndn:/ with Content "Z", FreshnessPeriod=10ms.
-3. Start ndn-traffic-server to serve ndn:/A with Content "A", FreshnessPeriod=10ms.
-4. Start ndn-traffic-server to serve ndn:/A/B/C with Content "C", FreshnessPeriod=10ms.
-5. Start ndn-traffic-server to serve ndn:/D/E with Content "E", FreshnessPeriod=10ms.
-6. Invoke ndn-traffic to request ndn:/ MustBeFresh=yes. Fail if unanswered. Fail if Content is not "Z".
-7. Wait 100ms.
-8. Invoke ndn-traffic to request ndn:/F MustBeFresh=yes. Fail if unanswered. Fail if Content is not "Z".
-9. Wait 100ms.
-10. Invoke ndn-traffic to request ndn:/A MustBeFresh=yes. Fail if unanswered. Fail if Content is not "A".
+## Steps ##
+
+1. Start NFD.
+2. Start ndn-traffic-server to serve / with Content "Z" with FreshnessPeriod=10ms.
+3. Start ndn-traffic-server to serve /A with Content "A" with FreshnessPeriod=10ms.
+4. Start ndn-traffic-server to serve /A/B/C with Content "C" with FreshnessPeriod=10ms.
+5. Start ndn-traffic-server to serve /D/E with Content "E" with FreshnessPeriod=10ms.
+6. Invoke ndn-traffic to request / with MustBeFresh=true. Fail if unanswered or if received content is not "Z".
+7. Wait 100ms.
+8. Invoke ndn-traffic to request /F with MustBeFresh=true. Fail if unanswered or if received content is not "Z".
+9. Wait 100ms.
+10. Invoke ndn-traffic to request /A with MustBeFresh=true. Fail if unanswered or if received content is not "A".
11. Wait 100ms.
-12. Invoke ndn-traffic to request ndn:/a MustBeFresh=yes. Fail if unanswered. Fail if Content is not "Z".
+12. Invoke ndn-traffic to request /a with MustBeFresh=true. Fail if unanswered or if received content is not "Z".
13. Wait 100ms.
-14. Invoke ndn-traffic to request ndn:/A/B MustBeFresh=yes. Fail if unanswered. Fail if Content is not "A".
+14. Invoke ndn-traffic to request /A/B with MustBeFresh=true. Fail if unanswered or if received content is not "A".
15. Wait 100ms.
-16. Invoke ndn-traffic to request ndn:/A/B/G MustBeFresh=yes. Fail if unanswered. Fail if Content is not "A".
+16. Invoke ndn-traffic to request /A/B/G with MustBeFresh=true. Fail if unanswered or if received content is not "A".
17. Wait 100ms.
-18. Invoke ndn-traffic to request ndn:/A/B/C MustBeFresh=yes. Fail if unanswered. Fail if Content is not "C".
+18. Invoke ndn-traffic to request /A/B/C with MustBeFresh=true. Fail if unanswered or if received content is not "C".
19. Wait 100ms.
-20. Invoke ndn-traffic to request ndn:/A/B/C/P/Q/R/S/T/U/V/W/X/Y/Z MustBeFresh=yes. Fail if unanswered. Fail if Content is not "C".
+20. Invoke ndn-traffic to request /A/B/C/P/Q/R/S/T/U/V/W/X/Y/Z with MustBeFresh=true. Fail if unanswered or if received content is not "C".
21. Wait 100ms.
-22. Invoke ndn-traffic to request ndn:/D MustBeFresh=yes Exclude=[...,D] (... is a zero-length generic component). Fail if unanswered. Fail if Content is not "Z".
+22. Invoke ndn-traffic to request /D with MustBeFresh=true and Exclude=[...,D] (... is a zero-length generic component). Fail if unanswered or if received content is not "Z".
23. Wait 100ms.
-24. Invoke ndn-traffic to request ndn:/D MustBeFresh=yes Exclude=[...,E] (... is a zero-length generic component). Fail if unanswered. Fail if Content is not "Z".
+24. Invoke ndn-traffic to request /D with MustBeFresh=true and Exclude=[...,E] (... is a zero-length generic component). Fail if unanswered or if received content is not "Z".
diff --git a/test_fib_matching/fib-matching-test.sh b/test_fib_matching/fib-matching-test.sh
new file mode 100755
index 0000000..eb0dc9e
--- /dev/null
+++ b/test_fib_matching/fib-matching-test.sh
@@ -0,0 +1,169 @@
+#!/bin/bash
+source ../multi-host.conf
+
+clean_up() {
+ r=$(sudo killall ndn-traffic-server 2>&1)
+ r=$(sudo killall ndn-traffic 2>&1)
+ r=$(sudo killall nfd 2>&1)
+}
+
+# A: Start NFD
+workdir=$(pwd)
+echo "Starting nfd on A..."
+mkdir -p $workdir/logs; sudo nfd &> $workdir/logs/nfd.log &
+sleep 1
+
+# A: Start instances of ndn-traffic-server
+echo "Starting Traffic Server 1 (Prefix=/, FreshnessPeriod=10ms, Data=Z)..."
+ndn-traffic-server $workdir/test-traffic-server-1.conf &> $workdir/logs/server-1.log &
+sleep 0.1
+echo "Starting Traffic Server 2 (Prefix=/A, FreshnessPeriod=10ms, Data=A)..."
+ndn-traffic-server $workdir/test-traffic-server-2.conf &> $workdir/logs/server-2.log &
+sleep 0.1
+echo "Starting Traffic Server 3 (Prefix=/A/B/C, FreshnessPeriod=10ms, Data=C)..."
+ndn-traffic-server $workdir/test-traffic-server-3.conf &> $workdir/logs/server-3.log &
+sleep 0.1
+echo "Starting Traffic Server 4 (Prefix=/D/E, FreshnessPeriod=10ms, Data=E)..."
+ndn-traffic-server $workdir/test-traffic-server-4.conf &> $workdir/logs/server-4.log &
+sleep 0.1
+
+# A: Request / with MustBeFresh=true. Fail if unanswered or if received content is not "Z".
+echo "Starting Traffic Client 1 (Prefix=/, MustBeFresh=true, ExpectedContent=Z, MaxSuffixComponents=2)..."
+ndn-traffic -c 1 $workdir/test-traffic-client-1.conf &> $workdir/logs/client-1.log
+outcode=$?
+if [[ $outcode -ne 0 ]]; then
+ echo "Received non-zero exit code from Traffic Client 1. Actual: $outcode"
+ clean_up
+ exit 1
+fi
+echo "Traffic Client 1 received Data with Content=Z"
+
+# Sleep for 100ms
+sleep 0.1
+
+# A: Request /F with MustBeFresh=true. Fail if unanswered or if received content is not "Z".
+echo "Starting Traffic Client 2 (Prefix=/F, MustBeFresh=true, ExpectedContent=Z)..."
+ndn-traffic -c 1 $workdir/test-traffic-client-2.conf &> $workdir/logs/client-2.log
+outcode=$?
+if [[ $outcode -ne 0 ]]; then
+ echo "Received non-zero exit code from Traffic Client 2. Actual: $outcode"
+ clean_up
+ exit 1
+fi
+echo "Traffic Client 2 received Data with Content=Z"
+
+# Sleep for 100ms
+sleep 0.1
+
+# A: Request /A with MustBeFresh=true. Fail if unanswered or if received content is not "A"
+echo "Starting Traffic Client 3 (Prefix=/A, MustBeFresh=true, ExpectedContent=A)..."
+ndn-traffic -c 1 $workdir/test-traffic-client-3.conf &> $workdir/logs/client-3.log
+outcode=$?
+if [[ $outcode -ne 0 ]]; then
+ echo "Received non-zero exit code from Traffic Client 3. Actual: $outcode"
+ clean_up
+ exit 1
+fi
+echo "Traffic Client 3 received Data with Content=A"
+
+# Sleep for 100ms
+sleep 0.1
+
+# A: Request /a with MustBeFresh=true. Fail if unanswered or if received content is not "Z".
+echo "Starting Traffic Client 4 (Prefix=/a, MustBeFresh=true, ExpectedContent=Z)..."
+ndn-traffic -c 1 $workdir/test-traffic-client-4.conf &> $workdir/logs/client-4.log
+outcode=$?
+if [[ $outcode -ne 0 ]]; then
+ echo "Received non-zero exit code from Traffic Client 4. Actual: $outcode"
+ clean_up
+ exit 1
+fi
+echo "Traffic Client 4 received Data with Content=Z"
+
+# Sleep for 100ms
+sleep 0.1
+
+# A: Request /A/B with MustBeFresh=true. Fail if unanswered or if received content is not "A".
+echo "Starting Traffic Client 5 (Prefix=/A/B, MustBeFresh=true, ExpectedContent=A)..."
+ndn-traffic -c 1 $workdir/test-traffic-client-5.conf &> $workdir/logs/client-5.log
+outcode=$?
+if [[ $outcode -ne 0 ]]; then
+ echo "Received non-zero exit code from Traffic Client 5. Actual: $outcode"
+ clean_up
+ exit 1
+fi
+echo "Traffic Client 5 received Data with Content=A"
+
+# Sleep for 100ms
+sleep 0.1
+
+# A: Request /A/B/G with MustBeFresh=true. Fail if unanswered or if received content is not "A".
+echo "Starting Traffic Client 6 (Prefix=/A/B/G, MustBeFresh=true, ExpectedContent=A)..."
+ndn-traffic -c 1 $workdir/test-traffic-client-6.conf &> $workdir/logs/client-6.log
+outcode=$?
+if [[ $outcode -ne 0 ]]; then
+ echo "Received non-zero exit code from Traffic Client 6. Actual: $outcode"
+ clean_up
+ exit 1
+fi
+echo "Traffic Client 6 received Data with Content=A"
+
+# Sleep for 100ms
+sleep 0.1
+
+# A: Request /A/B/C with MustBeFresh=true. Fail if unanswered or if received content is not "C".
+echo "Starting Traffic Client 7 (Prefix=/A/B/C, MustBeFresh=true, ExpectedContent=C)..."
+ndn-traffic -c 1 $workdir/test-traffic-client-7.conf &> $workdir/logs/client-7.log
+outcode=$?
+if [[ $outcode -ne 0 ]]; then
+ echo "Received non-zero exit code from Traffic Client 7. Actual: $outcode"
+ clean_up
+ exit 1
+fi
+echo "Traffic Client 7 received Data with Content=C"
+
+# Sleep for 100ms
+sleep 0.1
+
+# A: Request /A/B/C/P/Q/R/S/T/U/V/W/X/Y/Z with MustBeFresh=true. Fail if unanswered or if received
+# content is not "C".
+echo "Starting Traffic Client 8 (Prefix=/A/B/C/P/Q/R/S/T/U/V/W/X/Y/Z, MustBeFresh=true, ExpectedContent=C)..."
+ndn-traffic -c 1 $workdir/test-traffic-client-8.conf &> $workdir/logs/client-8.log
+outcode=$?
+if [[ $outcode -ne 0 ]]; then
+ echo "Received non-zero exit code from Traffic Client 8. Actual: $outcode"
+ clean_up
+ exit 1
+fi
+echo "Traffic Client 8 received Data with Content=C"
+
+# Sleep for 100ms
+sleep 0.1
+
+# A: Request /D with MustBeFresh=true and Exclude=[...,D]. Fail if unanswered or if received content
+# is not "Z".
+echo "Starting Traffic Client 9 (Prefix=/D, MustBeFresh=true, ExcludeRange=...,D, ExpectedContent=Z)..."
+ndn-traffic -c 1 $workdir/test-traffic-client-9.conf &> $workdir/logs/client-9.log
+outcode=$?
+if [[ $outcode -ne 0 ]]; then
+ echo "Received non-zero exit code from Traffic Client 9. Actual: $outcode"
+ clean_up
+ exit 1
+fi
+echo "Traffic Client 9 received Data with Content=Z"
+
+# Sleep for 100ms
+sleep 0.1
+
+# A: Request /D with MustBeFresh=true and Exclude=[...,E]. Fail if unanswered or if received content
+# is not "Z".
+echo "Starting Traffic Client 10 (Prefix=/D MustBeFresh=true, ExcludeRange=...,E, ExpectedContent=Z)..."
+outcode=$?
+if [[ $outcode -ne 0 ]]; then
+ echo "Received non-zero exit code from Traffic Client 10. Actual: $outcode"
+ clean_up
+ exit 1
+fi
+echo "Traffic Client 10 received Data with Content=Z"
+
+clean_up
diff --git a/test_fib_matching/test_fib_matching.py b/test_fib_matching/test_fib_matching.py
index 55c4788..afa23ed 100644
--- a/test_fib_matching/test_fib_matching.py
+++ b/test_fib_matching/test_fib_matching.py
@@ -1,240 +1,33 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2014 University of Arizona
+# Copyright (C) 2014-2018 Arizona Board of Regents.
# Author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
+# Author: Eric Newberry <enewberry@cs.arizona.edu>
# See COPYING for copyright and distribution information.
#
import os
-import time
import unittest
-import process_manager
+import subprocess
-class test_fib_matching(unittest.TestCase, process_manager.ProcessManager):
- """Test case for testing fib matching"""
+class test_fib_matching(unittest.TestCase):
+ """Test case for testing FIB matching"""
def setUp(self):
print "\nTesting FIB Matching"
print "********************"
+ os.chdir("test_fib_matching")
def tearDown(self):
- self.killNfd()
- try:
- self.killProcess("ndn-traffic-server-1")
- self.killProcess("ndn-traffic-server-2")
- self.killProcess("ndn-traffic-server-3")
- self.killProcess("ndn-traffic-server-4")
- self.killProcess("ndn-traffic-client-1")
- self.killProcess("ndn-traffic-client-2")
- self.killProcess("ndn-traffic-client-3")
- self.killProcess("ndn-traffic-client-4")
- self.killProcess("ndn-traffic-client-5")
- self.killProcess("ndn-traffic-client-6")
- self.killProcess("ndn-traffic-client-7")
- self.killProcess("ndn-traffic-client-8")
- self.killProcess("ndn-traffic-client-9")
- self.killProcess("ndn-traffic-client-10")
- self.cleanupProcesses()
- except IOError as e:
- self.cleanupProcesses()
- pass
+ print "********************"
+ os.chdir("..")
- def checkAndReportFailure(self, processKey, processName):
- if self.hasProcessCompleted(processKey):
- if self.getProcessReturnCode(processKey) != 0:
- print self.getProcessOutput(processKey)
- print self.getProcessError(processKey)
- self.fail(">> TEST FAILED - received non-zero return code from " + processName)
- else:
- self.fail(">> TEST FAILED - " + processName + " failed to complete")
-
- def test_matching(self):
-
- #Start NFD
- self.startNfd()
- time.sleep(1)
-
- #Start ndn-traffic-server to serve ndn:/ with Content "Z", FreshnessPeriod=10ms
- #Prefix registration using NFD FibMgmt
- serverConfigurationFile = os.path.abspath(
- "test_fib_matching/test-traffic-server-1.conf")
- self.startProcess("ndn-traffic-server-1",
- ["ndn-traffic-server", serverConfigurationFile],
- "-> Starting Traffic Server 1 (Prefix=ndn:/, FreshnessPeriod=10ms, Data=Z)")
- time.sleep(0.1)
-
- #Start ndn-traffic-server to serve ndn:/A with Content "A", FreshnessPeriod=10ms
- #Prefix registration using NFD FibMgmt
- serverConfigurationFile = os.path.abspath(
- "test_fib_matching/test-traffic-server-2.conf")
- self.startProcess("ndn-traffic-server-2",
- ["ndn-traffic-server", serverConfigurationFile],
- "-> Starting Traffic Server 2 (Prefix=ndn:/A, FreshnessPeriod=10ms, Data=A)")
- time.sleep(0.1)
-
- #Start ndn-traffic-server to serve ndn:/A/B/C with Content "C", FreshnessPeriod=10ms
- #Prefix registration using NFD FibMgmt
- serverConfigurationFile = os.path.abspath(
- "test_fib_matching/test-traffic-server-3.conf")
- self.startProcess("ndn-traffic-server-3",
- ["ndn-traffic-server", serverConfigurationFile],
- "-> Starting Traffic Server 3 (Prefix=ndn:/A/B/C, FreshnessPeriod=10ms, Data=C)")
- time.sleep(0.1)
-
- #Start ndn-traffic-server to serve ndn:/D/E with Content "E", FreshnessPeriod=10ms
- #Prefix registration using NFD FibMgmt
- serverConfigurationFile = os.path.abspath(
- "test_fib_matching/test-traffic-server-4.conf")
- self.startProcess("ndn-traffic-server-4",
- ["ndn-traffic-server", serverConfigurationFile],
- "-> Starting Traffic Server 4 (Prefix=ndn:/D/E, FreshnessPeriod=10ms, Data=E)")
- time.sleep(0.1)
-
- #Invoke ndn-traffic to request ndn:/ MustBeFresh=yes
- #Fail if unanswered. Fail if Content is not "Z".
- clientConfigurationFile = os.path.abspath(
- "test_fib_matching/test-traffic-client-1.conf")
- self.startProcess("ndn-traffic-client-1",
- ["ndn-traffic", "-c 1", clientConfigurationFile],
- ("-> Starting Traffic Client 1 (Prefix=ndn:/, MustBeFresh=Yes,"
- " ExpectedContent=Z, MaxSuffixComponents=2)"))
- self.waitForProcessCompletion("ndn-traffic-client-1", 10)
- self.checkAndReportFailure("ndn-traffic-client-1", "Traffic Client 1")
- print "-> Traffic Client 1 received data with Content=Z"
-
- #Wait 100ms
- time.sleep(0.1)
-
- #Invoke ndn-traffic to request ndn:/F MustBeFresh=yes
- #Fail if unanswered. Fail if Content is not "Z".
- clientConfigurationFile = os.path.abspath(
- "test_fib_matching/test-traffic-client-2.conf")
- self.startProcess("ndn-traffic-client-2",
- ["ndn-traffic", "-c 1", clientConfigurationFile],
- "-> Starting Traffic Client 2 (Prefix=ndn:/F, MustBeFresh=Yes, ExpectedContent=Z)")
- self.waitForProcessCompletion("ndn-traffic-client-2", 10)
- self.checkAndReportFailure("ndn-traffic-client-2", "Traffic Client 2")
- print "-> Traffic Client 2 received data with Content=Z"
-
- #Wait 100ms
- time.sleep(0.1)
-
- #Invoke ndn-traffic to request ndn:/A MustBeFresh=yes
- #Fail if unanswered. Fail if Content is not "A".
- clientConfigurationFile = os.path.abspath(
- "test_fib_matching/test-traffic-client-3.conf")
- self.startProcess("ndn-traffic-client-3",
- ["ndn-traffic", "-c 1", clientConfigurationFile],
- "-> Starting Traffic Client 3 (Prefix=ndn:/A, MustBeFresh=Yes, ExpectedContent=A)")
- self.waitForProcessCompletion("ndn-traffic-client-3", 10)
- self.checkAndReportFailure("ndn-traffic-client-3", "Traffic Client 3")
- print "-> Traffic Client 3 received data with Content=A"
-
- #Wait 100ms
- time.sleep(0.1)
-
- #Invoke ndn-traffic to request ndn:/a MustBeFresh=yes
- #Fail if unanswered. Fail if Content is not "Z".
- clientConfigurationFile = os.path.abspath(
- "test_fib_matching/test-traffic-client-4.conf")
- self.startProcess("ndn-traffic-client-4",
- ["ndn-traffic", "-c 1", clientConfigurationFile],
- "-> Starting Traffic Client 4 (Prefix=ndn:/a, MustBeFresh=Yes, ExpectedContent=Z)")
- self.waitForProcessCompletion("ndn-traffic-client-4", 10)
- self.checkAndReportFailure("ndn-traffic-client-4", "Traffic Client 4")
- print "-> Traffic Client 4 received data with Content=Z"
-
- #Wait 100ms
- time.sleep(0.1)
-
- #Invoke ndn-traffic to request ndn:/A/B MustBeFresh=yes
- #Fail if unanswered. Fail if Content is not "A".
- clientConfigurationFile = os.path.abspath(
- "test_fib_matching/test-traffic-client-5.conf")
- self.startProcess("ndn-traffic-client-5",
- ["ndn-traffic", "-c 1", clientConfigurationFile],
- "-> Starting Traffic Client 5 (Prefix=ndn:/A/B, MustBeFresh=Yes, ExpectedContent=A)")
- self.waitForProcessCompletion("ndn-traffic-client-5", 10)
- self.checkAndReportFailure("ndn-traffic-client-5", "Traffic Client 5")
- print "-> Traffic Client 5 received data with Content=A"
-
- #Wait 100ms
- time.sleep(0.1)
-
- #Invoke ndn-traffic to request ndn:/A/B/G MustBeFresh=yes
- #Fail if unanswered. Fail if Content is not "A".
- clientConfigurationFile = os.path.abspath(
- "test_fib_matching/test-traffic-client-6.conf")
- self.startProcess("ndn-traffic-client-6",
- ["ndn-traffic", "-c 1", clientConfigurationFile],
- "-> Starting Traffic Client 6 (Prefix=ndn:/A/B/G, MustBeFresh=Yes, ExpectedContent=A)")
- self.waitForProcessCompletion("ndn-traffic-client-6", 10)
- self.checkAndReportFailure("ndn-traffic-client-6", "Traffic Client 6")
- print "-> Traffic Client 6 received data with Content=A"
-
- #Wait 100ms
- time.sleep(0.1)
-
- #Invoke ndn-traffic to request ndn:/A/B/C MustBeFresh=yes
- #Fail if unanswered. Fail if Content is not "C".
- clientConfigurationFile = os.path.abspath(
- "test_fib_matching/test-traffic-client-7.conf")
- self.startProcess("ndn-traffic-client-7",
- ["ndn-traffic", "-c 1", clientConfigurationFile],
- "-> Starting Traffic Client 7 (Prefix=ndn:/A/B/C, MustBeFresh=Yes, ExpectedContent=C)")
- self.waitForProcessCompletion("ndn-traffic-client-7", 10)
- self.checkAndReportFailure("ndn-traffic-client-7", "Traffic Client 7")
- print "-> Traffic Client 7 received data with Content=C"
-
- #Wait 100ms
- time.sleep(0.1)
-
- #Invoke ndn-traffic to request ndn:/A/B/C/P/Q/R/S/T/U/V/W/X/Y/Z MustBeFresh=yes
- #Fail if unanswered. Fail if Content is not "C".
- clientConfigurationFile = os.path.abspath(
- "test_fib_matching/test-traffic-client-8.conf")
- self.startProcess("ndn-traffic-client-8",
- ["ndn-traffic", "-c 1", clientConfigurationFile],
- ("-> Starting Traffic Client 8 (Prefix=ndn:/A/B/C/P/Q/R/S/T/U/V/W/X/Y/Z,"
- " MustBeFresh=Yes, ExpectedContent=C)"))
- self.waitForProcessCompletion("ndn-traffic-client-8", 10)
- self.checkAndReportFailure("ndn-traffic-client-8", "Traffic Client 8")
- print "-> Traffic Client 8 received data with Content=C"
-
- #Wait 100ms
- time.sleep(0.1)
-
- #Invoke ndn-traffic to request ndn:/D MustBeFresh=yes Exclude=[...,D]
- #Fail if unanswered. Fail if Content is not "Z".
- clientConfigurationFile = os.path.abspath(
- "test_fib_matching/test-traffic-client-9.conf")
- self.startProcess("ndn-traffic-client-9",
- ["ndn-traffic", "-c 1", clientConfigurationFile],
- ("-> Starting Traffic Client 9 (Prefix=ndn:/D, MustBeFresh=Yes,"
- " ExcludeRange=...,D, ExpectedContent=Z)"))
- self.waitForProcessCompletion("ndn-traffic-client-9", 10)
- self.checkAndReportFailure("ndn-traffic-client-9", "Traffic Client 9")
- print "-> Traffic Client 9 received data with Content=Z"
-
- #Wait 100ms
- time.sleep(0.1)
-
- #Invoke ndn-traffic to request ndn:/D MustBeFresh=yes Exclude=[...,E]
- #Fail if unanswered. Fail if Content is not "Z".
- clientConfigurationFile = os.path.abspath(
- "test_fib_matching/test-traffic-client-10.conf")
- self.startProcess("ndn-traffic-client-10",
- ["ndn-traffic", "-c 1", clientConfigurationFile],
- ("-> Starting Traffic Client 10 (Prefix=ndn:/E, MustBeFresh=Yes,"
- " ExcludeRange=...,E, ExpectedContent=Z)"))
- self.waitForProcessCompletion("ndn-traffic-client-10", 10)
- self.checkAndReportFailure("ndn-traffic-client-10", "Traffic Client 10")
- print "-> Traffic Client 10 received data with Content=Z"
-
- #Stop all four traffic servers
- self.killProcess("ndn-traffic-server-1")
- self.killProcess("ndn-traffic-server-2")
- self.killProcess("ndn-traffic-server-3")
- self.killProcess("ndn-traffic-server-4")
- print ">> TEST SUCCESSFUL"
+ def test_fib_matching(self):
+ ret = subprocess.call(["./fib-matching-test.sh"], shell=True)
+ print "Test script return value:", ret
+ errormsg = {
+ 1 : "Traffic Client did not receive a Data or received Data did not contain expected content",
+ }
+ if (ret != 0):
+ self.fail(errormsg[ret])
diff --git a/test_interest_aggregation/README.md b/test_interest_aggregation/README.md
index 33f9551..df57f8e 100644
--- a/test_interest_aggregation/README.md
+++ b/test_interest_aggregation/README.md
@@ -1,22 +1,24 @@
-Test Case - interest-aggregation
+Test Case - interest_aggregation
================================
## Objective ##
-To test NFD's interest aggregation on a single host.
+Test NFD's Interest aggregation mechanism on a single host.
## Description ##
-This test case will run NFD, ndnpeek and ndn-traffic-server to check aggregation of interests by NFD. The following steps will be followed:
+This test case will run NFD, ndnpeek, and ndn-traffic-server to check for the proper aggregation of Interests by NFD.
-1. Start NFD.
-2. Set NFD to use the best-route v1 strategy.
-3. Start ndn-traffic-server to serve ndn:/test-agg, with -d 2000 flag to delay response for 2000ms.
-4. Start two instances of ndnpeek to request ndn:/test-agg/A. Wait until they terminate. Fail if either is unanswered.
-5. Stop ndn-traffic-server. Fail if total served Interest does not equal 1.
-6. Start ndn-traffic-server to serve ndn:/test-agg, with -d 2000 flag to delay response for 2000ms.
-7. Start ndnpeek to request ndn:/test-agg/B ChildSelector=leftmost, and another instance to request ndn:/test-agg/B ChildSelector=rightmost. Wait until they terminate. Fail if either is unanswered.
-8. Stop ndn-traffic-server. Fail if total served Interest does not equal 2.
-9. Start ndn-traffic-server to serve ndn:/test-agg, with -d 2000 flag to delay response for 2000ms.
-10. Start ndnpeek to request ndn:/test-agg/C InterestLifetime=6000ms, and another instance to request ndn:/test-agg/C InterestLifetime=8000ms. Wait until they terminate. Fail if either is unanswered.
-11. Stop ndn-traffic-server. Fail if total served Interest does not equal 1.
+## Steps ##
+
+1. Start NFD.
+2. Set NFD to use the best-route v1 strategy on the / prefix.
+3. Start ndn-traffic-server to serve /test-agg, with -d 2000 flag to delay response for 2000ms.
+4. Start two instances of ndnpeek to request /test-agg/A. Fail if either instance fails to exit or if either Interest goes unanswered.
+5. Stop ndn-traffic-server. Fail if total number of served Interests does not equal 1.
+6. Start ndn-traffic-server to serve /test-agg, with -d 2000 flag to delay response for 2000ms.
+7. Start ndnpeek to request /test-agg/B with CanBePrefix=false, and another instance to request /test-agg/B with CanBePrefix=true. Fail if either instance fails to exit or if either Interest goes unanswered.
+8. Stop ndn-traffic-server. Fail if total number of served Interests does not equal 2.
+9. Start ndn-traffic-server to serve /test-agg, with -d 2000 flag to delay response for 2000ms.
+10. Start ndnpeek to request /test-agg/C with InterestLifetime=6000ms, and another instance to request /test-agg/C with InterestLifetime=8000ms. Fail if either is instance fails to exit or if either Interest goes unanswered.
+11. Stop ndn-traffic-server. Fail if total number of served Interests does not equal 1.
diff --git a/test_interest_aggregation/__init__.py b/test_interest_aggregation/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/test_interest_aggregation/__init__.py
+++ /dev/null
diff --git a/test_interest_aggregation/interest-aggregation-test.sh b/test_interest_aggregation/interest-aggregation-test.sh
new file mode 100755
index 0000000..c0e3935
--- /dev/null
+++ b/test_interest_aggregation/interest-aggregation-test.sh
@@ -0,0 +1,140 @@
+#!/bin/bash
+source ../multi-host.conf
+
+clean_up() {
+ r=$(sudo killall ndn-traffic-server 2>&1)
+ r=$(sudo killall ndnpeek 2>&1)
+ r=$(sudo killall nfd 2>&1)
+}
+
+check_peek_exit() {
+ ps -p $2 > /dev/null
+ if [[ $? -ne 1 ]]; then
+ echo "Peek Client $1 did not exit"
+ clean_up
+ exit 1
+ fi
+}
+
+check_peek_output() {
+ local out=$(cat $2)
+ if [[ "$out" != "$3" ]]; then
+ echo "Peek Client $1 did not receive a Data containing '$3'. Actual: $out"
+ clean_up
+ exit 2
+ fi
+}
+
+check_server_receive_count() {
+ local actual=$(cat $2 | grep "Total Interests Received" | head -1 | cut -d"=" -f2 | tr -d " ")
+ if [[ $actual -ne $3 ]]; then
+ echo "Traffic Server $1 did not received expected $3 Interests. Actual: $actual"
+ clean_up
+ exit 3
+ fi
+}
+
+# A: Start NFD
+workdir=$(pwd)
+echo "Starting nfd on A..."
+mkdir -p $workdir/logs; sudo nfd &> $workdir/logs/nfd.log &
+sleep 1
+
+# A: Set NFD to use best-route v1 strategy
+echo "Setting strategy to best-route v1"
+nfdc strategy set / /localhost/nfd/strategy/best-route/%FD%01
+sleep 1
+
+# A: Start ndn-traffic-server (Prefix=/text-agg, ContentDelay=2000ms)
+echo "Starting Traffic Server 1 (Prefix=/test-agg, ContentDelay=2000ms)..."
+ndn-traffic-server $workdir/test-traffic-server.conf &> $workdir/logs/test-server-output-1.txt &
+sleep 1
+
+# A: Start two instances of ndnpeek to request /test-agg/A
+echo "Starting Peek Client 1 (Prefix=/test-agg/A)..."
+ndnpeek -p /test-agg/A &> $workdir/logs/test-peek-output-1.txt &
+peek1pid=$!
+echo "Starting Peek Client 2 (Prefix=/test-agg/A)..."
+ndnpeek -p /test-agg/A &> $workdir/logs/test-peek-output-2.txt &
+peek2pid=$!
+sleep 1
+
+# A: Stop ndn-traffic-server instance
+echo "Stopping Traffic Server 1..."
+sudo killall ndn-traffic-server 2>&1
+sleep 2
+
+# A: Ensure ndnpeek instances have quit
+check_peek_exit 1 $peek1pid
+check_peek_exit 2 $peek2pid
+
+# A: Ensure ndnpeek instances both received Data packets with correct payloads in response to their Interests
+check_peek_output 1 $workdir/logs/test-peek-output-1.txt AAAAAAAA
+check_peek_output 2 $workdir/logs/test-peek-output-2.txt AAAAAAAA
+
+# A: Ensure that Traffic Server 1 received only one Interest
+check_server_receive_count 1 $workdir/logs/test-server-output-1.txt 1
+
+# A: Start ndn-traffic-server (Prefix=/test-agg, ContentDelay=2000ms)
+echo "Starting Traffic Server 2 (Prefix=/test-agg, ContentDelay=2000ms)..."
+ndn-traffic-server $workdir/test-traffic-server.conf &> $workdir/logs/test-server-output-2.txt &
+sleep 1
+
+# A: Start two instances of ndnpeek to request /test-agg/B, with one setting CanBePrefix=false and
+# the other setting CanBePrefix=true
+echo "Starting Peek Client 3 (Prefix=/test-agg/B, CanBePrefix=false)..."
+ndnpeek -p /test-agg/B &> $workdir/logs/test-peek-output-3.txt &
+peek3pid=$!
+echo "Starting Peek Client 4 (Prefix=/test-agg/B, CanBePrefix=true)..."
+ndnpeek -P -p /test-agg/B &> $workdir/logs/test-peek-output-4.txt &
+peek4pid=$!
+sleep 1
+
+# A: Stop ndn-traffic-server instance
+echo "Stopping Traffic Server 2..."
+sudo killall ndn-traffic-server 2>&1
+sleep 2
+
+# A: Ensure ndnpeek instances have quit
+check_peek_exit 3 $peek3pid
+check_peek_exit 4 $peek4pid
+
+# A: Ensure ndnpeek instances both received Data packets with correct payload in response to their interests
+check_peek_output 3 $workdir/logs/test-peek-output-3.txt AAAAAAAA
+check_peek_output 4 $workdir/logs/test-peek-output-4.txt AAAAAAAA
+
+# A: Ensure that Traffic Server 2 received two Interests
+check_server_receive_count 2 $workdir/logs/test-server-output-2.txt 2
+
+# A: Start ndn-traffic-server (Prefix=/test-agg, ContentDelay=2000ms)
+echo "Starting Traffic Server 3 (Prefix=/test-agg, ContentDelay=2000ms)..."
+ndn-traffic-server $workdir/test-traffic-server.conf &> $workdir/logs/test-server-output-3.txt &
+sleep 1
+
+# A: Start two instances of ndnpeek to request /test-agg/C, with one setting InterestLifetime=6000ms
+# and the other setting InterestLifetime=8000ms
+echo "Starting Peek Client 5 (Prefix=/test-agg/C, InterestLifetime=6000ms)"
+ndnpeek --lifetime 6000 -p /test-agg/C > $workdir/logs/test-peek-output-5.txt &
+peek5pid=$!
+echo "Starting Peek Client 6 (Prefix=/test-agg/C, InterestLifetime=8000ms)..."
+ndnpeek --lifetime 8000 -p /test-agg/C > $workdir/logs/test-peek-output-6.txt &
+peek6pid=$!
+sleep 1
+
+# A: Stop ndn-traffic-server instance
+echo "Stopping Traffic Server 3..."
+sudo killall ndn-traffic-server 2>&1
+sleep 2
+
+# A: Ensure ndnpeek instances have quit
+check_peek_exit 5 $peek5pid
+check_peek_exit 6 $peek6pid
+
+# A: Ensure ndnpek instances both received Data packets with correct payload in response to their Interests
+check_peek_output 5 $workdir/logs/test-peek-output-5.txt AAAAAAAA
+check_peek_output 6 $workdir/logs/test-peek-output-6.txt AAAAAAAA
+
+# A: Ensure that Traffic Server 3 received only one Interest
+check_server_receive_count 3 $workdir/logs/test-server-output-3.txt 1
+
+clean_up
diff --git a/test_interest_aggregation/test-traffic-server.conf b/test_interest_aggregation/test-traffic-server.conf
index 4fd7531..b3ff461 100644
--- a/test_interest_aggregation/test-traffic-server.conf
+++ b/test_interest_aggregation/test-traffic-server.conf
@@ -1,2 +1,3 @@
Name=ndn:/test-agg
ContentDelay=2000
+Content=AAAAAAAA
diff --git a/test_interest_aggregation/test_interest_aggregation.py b/test_interest_aggregation/test_interest_aggregation.py
index 4b1fbe2..ed54fe9 100644
--- a/test_interest_aggregation/test_interest_aggregation.py
+++ b/test_interest_aggregation/test_interest_aggregation.py
@@ -1,169 +1,35 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2014 University of Arizona
+# Copyright (C) 2014-2018 Arizona Board of Regents.
# Author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
+# Author: Eric Newberry <enewberry@cs.arizona.edu>
# See COPYING for copyright and distribution information.
#
import os
-import time
import unittest
-import process_manager
+import subprocess
-class test_interest_aggregation(unittest.TestCase, process_manager.ProcessManager):
- """Test case for testing interest aggregation"""
+class test_interest_aggregation(unittest.TestCase):
+ """Test case for testing Interest aggregation"""
def setUp(self):
print "\nTesting Interest Aggregation"
print "****************************"
- self.logFolder = "test_interest_aggregation/logs/"
- if not os.path.exists(self.logFolder):
- os.system("mkdir " + self.logFolder)
+ os.chdir("test_interest_aggregation")
def tearDown(self):
- self.killNfd()
- self.killProcess("ndn-traffic-server-1")
- self.killProcess("ndnpeek-1")
- self.killProcess("ndnpeek-2")
- self.killProcess("ndn-traffic-server-2")
- self.killProcess("ndnpeek-3")
- self.killProcess("ndnpeek-4")
- self.killProcess("ndn-traffic-server-3")
- self.killProcess("ndnpeek-5")
- self.killProcess("ndnpeek-6")
- self.cleanupProcesses()
-
- def checkAndReportFailure(self, processKey, processName):
- if self.hasProcessCompleted(processKey):
- if self.getProcessReturnCode(processKey) != 0:
- print self.getProcessOutput(processKey)
- print self.getProcessError(processKey)
- self.fail(">> TEST FAILED - received non-zero return code from " + processName)
- else:
- self.fail(">> TEST FAILED - " + processName + " failed to complete")
-
-
- def checkServerReceiveCount(self, processKey, processName, expectedCount):
- serverOutput = self.getProcessOutput(processKey).splitlines()
- isTestSuccessful = False
- receivedCount = 0
- for logLine in serverOutput:
- if "Total Interests Received" in logLine:
- for value in logLine.split():
- if value.isdigit():
- receivedCount = int(value)
- break
- if receivedCount == expectedCount:
- isTestSuccessful = True
- break
- if not isTestSuccessful:
- self.fail(">> TEST FAILED - " + processName +
- " expected to receive only " + str(expectedCount) +
- " interest(s) but received " + str(receivedCount) + " interest(s)" )
- else:
- print "-> " + processName + " received " + str(receivedCount) + " interest(s)"
+ print "****************************"
+ os.chdir("..")
def test_aggregation(self):
-
- #Start NFD
- self.startNfd()
- time.sleep(1)
-
- #Set NFD to use best-route v1 strategy
- self.startProcess("nfdc",
- ["nfdc", "strategy", "set", "/", "/localhost/nfd/strategy/best-route/%FD%01"],
- "-> Setting strategy to best-route v1")
- time.sleep(1)
-
- #Start ndn-traffic-server to serve /test-agg, with content delay set to 2000ms
- serverConfigurationFile = os.path.abspath(
- "test_interest_aggregation/test-traffic-server.conf")
- self.startProcess("ndn-traffic-server-1",
- ["ndn-traffic-server", serverConfigurationFile],
- "-> Starting Traffic Server 1 (Prefix=/test-agg, ContentDelay=2000ms)")
- time.sleep(1)
-
- #Start two instances of ndnpeek to request /test-agg/A. Wait until they
- #terminate. Fail if either is unanswered.
- peekOutputFile = os.path.abspath(self.logFolder + "test-peek-output-1.txt")
- self.startProcess("ndnpeek-1",
- ["ndnpeek", "/test-agg/A"],
- "-> Starting Peek Client 1 (Prefix=/test-agg/A)",
- outputFile=peekOutputFile)
- peekOutputFile = os.path.abspath(self.logFolder + "test-peek-output-2.txt")
- self.startProcess("ndnpeek-2",
- ["ndnpeek", "/test-agg/A"],
- "-> Starting Peek Client 2 (Prefix=/test-agg/A)",
- outputFile=peekOutputFile)
- self.waitForProcessCompletion("ndnpeek-1", 10)
- self.waitForProcessCompletion("ndnpeek-2", 10)
-
- #Stop ndn-traffic-server. Fail if total served Interest does not equal 1.
- self.killProcess("ndn-traffic-server-1")
- time.sleep(1)
- print "-> Stopping Traffic Server 1"
- self.checkAndReportFailure("ndnpeek-1", "Peek Client 1")
- self.checkAndReportFailure("ndnpeek-2", "Peek Client 2")
- self.checkServerReceiveCount("ndn-traffic-server-1", "Traffic Server 1", 1)
-
- #Start ndn-traffic-server to serve /test-agg, with content delay set to 2000ms
- self.startProcess("ndn-traffic-server-2",
- ["ndn-traffic-server", serverConfigurationFile],
- "-> Starting Traffic Server 2 (Prefix=/test-agg, ContentDelay=2000ms)")
- time.sleep(1)
-
- #Start ndnpeek to request /test-agg/B ChildSelector=leftmost, and another
- #instance to request /test-agg/B ChildSelector=rightmost. Wait until they terminate.
- #Fail if either is unanswered.
- peekOutputFile = os.path.abspath(self.logFolder + "test-peek-output-3.txt")
- self.startProcess("ndnpeek-3",
- ["ndnpeek", "/test-agg/B"],
- "-> Starting Peek Client 3 (Prefix=/test-agg/B, ChildSelector=leftmost)",
- outputFile=peekOutputFile)
- peekOutputFile = os.path.abspath(self.logFolder + "test-peek-output-4.txt")
- self.startProcess("ndnpeek-4",
- ["ndnpeek", "-r", "/test-agg/B"],
- "-> Starting Peek Client 4 (Prefix=/test-agg/B, ChildSelector=rightmost)",
- outputFile=peekOutputFile)
- self.waitForProcessCompletion("ndnpeek-3", 10)
- self.waitForProcessCompletion("ndnpeek-4", 10)
-
- #Stop ndn-traffic-server. Fail if total served Interest does not equal 2.
- self.killProcess("ndn-traffic-server-2")
- time.sleep(1)
- print "-> Stopping Traffic Server 2"
- self.checkAndReportFailure("ndnpeek-3", "Peek Client 3")
- self.checkAndReportFailure("ndnpeek-4", "Peek Client 4")
- self.checkServerReceiveCount("ndn-traffic-server-2", "Traffic Server 2", 2)
-
- #Start ndn-traffic-server to serve /test-agg, with content delay set to 2000ms
- self.startProcess("ndn-traffic-server-3",
- ["ndn-traffic-server", serverConfigurationFile],
- "-> Starting Traffic Server 3 (Prefix=/test-agg, ContentDelay=2000ms)")
- time.sleep(1)
-
- #Start ndnpeek to request /test-agg/C InterestLifetime=6000ms, and another
- #instance to request /test-agg/C. InterestLifetime=8000ms. Wait until they terminate.
- #Fail if either is unanswered.
- peekOutputFile = os.path.abspath(self.logFolder + "test-peek-output-5.txt")
- self.startProcess("ndnpeek-5",
- ["ndnpeek", "--lifetime", "6000", "/test-agg/C"],
- "-> Starting Peek Client 5 (Prefix=/test-agg/C, InterestLifetime=6000ms)",
- outputFile=peekOutputFile)
- peekOutputFile = os.path.abspath(self.logFolder + "test-peek-output-6.txt")
- self.startProcess("ndnpeek-6",
- ["ndnpeek", "--lifetime", "8000", "/test-agg/C"],
- "-> Starting Peek Client 6 (Prefix=/test-agg/C, InterestLifetime=8000ms)",
- outputFile=peekOutputFile)
- self.waitForProcessCompletion("ndnpeek-5", 10)
- self.waitForProcessCompletion("ndnpeek-6", 10)
-
- #Stop ndn-traffic-server. Fail if total served Interest does not equal 1.
- self.killProcess("ndn-traffic-server-3")
- time.sleep(1)
- print "-> Stopping Traffic Server 3"
- self.checkAndReportFailure("ndnpeek-5", "Peek Client 5")
- self.checkAndReportFailure("ndnpeek-6", "Peek Client 6")
- self.checkServerReceiveCount("ndn-traffic-server-3", "Traffic Server 3", 1)
- print ">> TEST SUCCESSFUL"
+ ret = subprocess.call(["./interest-aggregation-test.sh"], shell=True)
+ print "Test script return value:", ret
+ errormsg = {
+ 1 : "Peek Client did not exit",
+ 2 : "Peek Client did not Data packet or received Data packet containing incorrect content",
+ 3 : "Traffic Server did not received correct count of Interests",
+ }
+ if (ret != 0):
+ self.fail(errormsg[ret])
diff --git a/test_interest_loop/test_interest_loop.py b/test_interest_loop/test_interest_loop.py
index 229f338..4719671 100644
--- a/test_interest_loop/test_interest_loop.py
+++ b/test_interest_loop/test_interest_loop.py
@@ -1,7 +1,7 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2014 University of Arizona
+# Copyright (C) 2014 Arizona Board of Regents.
# Author: Yi Huang <ltr120@email.arizona.edu>
# See COPYING for copyright and distribution information.
#
diff --git a/test_localhop/test_localhop.py b/test_localhop/test_localhop.py
index a2789c8..70db1a2 100644
--- a/test_localhop/test_localhop.py
+++ b/test_localhop/test_localhop.py
@@ -1,7 +1,7 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2014 University of Arizona
+# Copyright (C) 2014 Arizona Board of Regents.
# Author: Yi Huang <ltr120@email.arizona.edu>
# See COPYING for copyright and distribution information.
#
diff --git a/test_localhost_scope/test_localhost_scope.py b/test_localhost_scope/test_localhost_scope.py
index cbc014e..94af576 100644
--- a/test_localhost_scope/test_localhost_scope.py
+++ b/test_localhost_scope/test_localhost_scope.py
@@ -1,7 +1,7 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2014 University of Arizona
+# Copyright (C) 2014 Arizona Board of Regents.
# Author: Yi Huang <ltr120@email.arizona.edu>
# See COPYING for copyright and distribution information.
#
diff --git a/test_mobility_link/test_mobility_link.py b/test_mobility_link/test_mobility_link.py
index b1c9d19..a41d3af 100644
--- a/test_mobility_link/test_mobility_link.py
+++ b/test_mobility_link/test_mobility_link.py
@@ -1,7 +1,7 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2016 University of Arizona
+# Copyright (C) 2016 Arizona Board of Regents.
# Author: Eric Newberry <enewberry@cs.arizona.edu>
# See COPYING for copyright and distribution information.
#
diff --git a/test_multicast/test_multicast.py b/test_multicast/test_multicast.py
index 2b87789..a72d74e 100644
--- a/test_multicast/test_multicast.py
+++ b/test_multicast/test_multicast.py
@@ -1,7 +1,7 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2014 University of Arizona
+# Copyright (C) 2014 Arizona Board of Regents.
# Author: Yi Huang <ltr120@email.arizona.edu>
# See COPYING for copyright and distribution information.
#
diff --git a/test_ndnpeekpoke/README.md b/test_ndnpeekpoke/README.md
index 145953c..9a652a8 100644
--- a/test_ndnpeekpoke/README.md
+++ b/test_ndnpeekpoke/README.md
@@ -3,10 +3,10 @@
## Objective ##
-To test the ndnpeek and ndnpoke applications on a single host.
+Test the ndnpeek and ndnpoke applications on a single host.
## Description ##
-This test case will run NFD, ndnpeek and ndnpoke.
-This will report SUCCESS if one interest/data is successfully exchanged between ndnpeek and ndnpoke.
-In all other scenarios, the test case will report FAILURE
+This test case will run NFD, ndnpeek, and ndnpoke.
+It will succeed if one Interest/Data exchange is completed between the instances of ndnpeek and ndnpoke.
+Otherwise, it will fail.
diff --git a/test_ndnpeekpoke/__init__.py b/test_ndnpeekpoke/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/test_ndnpeekpoke/__init__.py
+++ /dev/null
diff --git a/test_ndnpeekpoke/ndnpeekpoke-test.sh b/test_ndnpeekpoke/ndnpeekpoke-test.sh
new file mode 100755
index 0000000..9dff5b1
--- /dev/null
+++ b/test_ndnpeekpoke/ndnpeekpoke-test.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+source ../multi-host.conf
+
+clean_up() {
+ r=$(sudo killall ndnpeek 2>&1)
+ r=$(sudo killall ndnpoke 2>&1)
+ r=$(sudo killall nfd 2>&1)
+}
+
+# A: Start NFD
+workdir=$(pwd)
+echo "Starting nfd on A..."
+mkdir -p $workdir/logs; sudo nfd &> $workdir/logs/nfd.log &
+sleep 1
+
+# A: Start ndnpoke
+echo "Starting ndnpoke on A..."
+ndnpoke /test/peekpoke < $workdir/test-poke-input.txt &
+pokepid=$!
+sleep 1
+
+# A: Run ndnpeek
+echo "Running ndnpeek on A..."
+ndnpeek /test/peekpoke > $workdir/logs/test-peek-output.txt
+exitcode=$?
+
+if [[ $exitcode -ne 0 ]]; then
+ echo "Received non-zero exit code from ndnpeek - actual: $exitcode"
+ clean_up
+ exit 1
+fi
+
+sleep 1
+
+# Verify that ndnpoke has exited
+# ps -p returns 1 if no matching process is found
+ps -p $pokepid > /dev/null
+if [[ $? -ne 1 ]]; then
+ echo "ndnpoke did not exit"
+ clean_up
+ exit 2
+fi
+
+clean_up
diff --git a/test_ndnpeekpoke/test_ndnpeekpoke.py b/test_ndnpeekpoke/test_ndnpeekpoke.py
index 9f218e9..f2ea543 100644
--- a/test_ndnpeekpoke/test_ndnpeekpoke.py
+++ b/test_ndnpeekpoke/test_ndnpeekpoke.py
@@ -1,59 +1,34 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2014 University of Arizona
+# Copyright (C) 2014-2018 Arizona Board of Regents.
# Author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
+# Author: Eric Newberry <enewberry@cs.arizona.edu>
# See COPYING for copyright and distribution information.
#
import os
-import time
import unittest
-import process_manager
+import subprocess
-class test_ndnpeekpoke(unittest.TestCase, process_manager.ProcessManager):
- """Test case for testing ndnpeek and ndnpoke applications"""
+class test_ndnpeekpoke(unittest.TestCase):
+ """Test case for the ndnpeek and ndnpoke applications"""
def setUp(self):
- print "\nTesting ndnpeek & ndnpoke"
- print "***********************************"
- os.system("mkdir -p test_ndnpeekpoke/logs/")
+ print "\nTesting ndnpeek and ndnpoke"
+ print "***************************"
+ os.chdir("test_ndnpeekpoke")
def tearDown(self):
- self.killNfd()
- self.killProcess("ndnpoke")
- self.killProcess("ndnpeek")
- self.cleanupProcesses()
+ print "***************************"
+ os.chdir("..")
- def test_peekpoke(self):
- self.startNfd()
- time.sleep(1)
- pokeInputFile = os.path.abspath("test_ndnpeekpoke/test-poke-input.txt")
- self.startProcess("ndnpoke",
- ["ndnpoke", "ndn:/test/peekpoke"],
- "-> Starting Poke",
- inputFile=pokeInputFile)
- time.sleep(1)
- peekOutputFile = os.path.abspath("test_ndnpeekpoke/logs/test-peek-output.txt")
- self.startProcess("ndnpeek",
- ["ndnpeek", "ndn:/test/peekpoke"],
- "-> Starting Peek",
- outputFile=peekOutputFile)
- time.sleep(1)
- self.waitForProcessCompletion("ndnpeek", 10)
- self.waitForProcessCompletion("ndnpoke", 10)
- if self.hasProcessCompleted("ndnpeek"):
- if self.getProcessReturnCode("ndnpeek") != 0:
- print self.getProcessReturnCode("ndnpeek")
- print self.getProcessError("ndnpeek")
- print self.getProcessOutput("ndnpeek")
- self.fail(">> TEST FAILED - received non-zero return code from ndnpeek")
- else:
- self.fail(">> TEST FAILED - ndnpeek failed to complete")
- if self.hasProcessCompleted("ndnpoke"):
- if self.getProcessReturnCode("ndnpoke") != 0:
- print self.getProcessError("ndnpoke")
- self.fail(">> TEST FAILED - received non-zero return code from ndnpoke")
- else:
- self.fail(">> TEST FAILED - ndnpoke failed to complete")
- print ">> TEST SUCCESSFUL"
+ def test_ndnpeekpoke(self):
+ ret = subprocess.call(["./ndnpeekpoke-test.sh"], shell=True)
+ print "Test script return value:", ret
+ errormsg = {
+ 1 : "ndnpeek did not receive a Data packet satisfying its Interest",
+ 2 : "ndnpoke did not exit after sending a Data packet",
+ }
+ if (ret != 0):
+ self.fail(errormsg[ret])
diff --git a/test_ndnping/README.md b/test_ndnping/README.md
index 46a5ebb..4120e49 100644
--- a/test_ndnping/README.md
+++ b/test_ndnping/README.md
@@ -3,10 +3,10 @@
## Objective ##
-To test the ndnping application on a single host.
+Test the ndnping and ndnpingserver applications on a single host.
## Description ##
-This test case will run NFD, ndnping and ndnpingserver.
-This will report SUCCESS if one ping interest/data is successfully exchanged between the ndnping and ndnpingserver.
-In all other scenarios, the test case will report FAILURE
+This test case will run NFD, ndnping, and ndnpingserver.
+It will succeed if five ping Interest/Data exchanges are completed between the instances of ndnping and ndnpingserver.
+Otherwise, it will fail.
diff --git a/test_ndnping/__init__.py b/test_ndnping/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/test_ndnping/__init__.py
+++ /dev/null
diff --git a/test_ndnping/ndnping-test.sh b/test_ndnping/ndnping-test.sh
new file mode 100755
index 0000000..ae3ac17
--- /dev/null
+++ b/test_ndnping/ndnping-test.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+source ../multi-host.conf
+
+clean_up() {
+ r=$(sudo killall ndnpingserver 2>&1)
+ r=$(sudo killall ndnping 2>&1)
+ r=$(sudo killall nfd 2>&1)
+}
+
+# A: Start NFD
+workdir=$(pwd)
+echo "Starting nfd on A..."
+mkdir -p $workdir/logs; sudo nfd &> $workdir/logs/nfd.log &
+sleep 1
+
+# A: Start ndnpingserver
+echo "Starting ndnpingserver on A..."
+ndnpingserver -p5 /test/ndnping &> $workdir/logs/ndnpingserver.log &
+serverpid=$!
+sleep 1
+
+# A: Run ndnping
+echo "Running ndnping on A..."
+ndnping -c5 /test/ndnping
+exitcode=$?
+sleep 1
+
+# An exit code of zero indicates the number of received Data packets equals the number of sent Interests
+if [[ $exitcode -ne 0 ]]; then
+ echo "Received non-zero exit code from ndnping - actual: $exitcode"
+ clean_up
+ exit 1
+fi
+
+# Verify that ndnpingserver has exited
+# ps -p returns 1 if no matching process is found
+ps -p $serverpid > /dev/null
+if [[ $? -ne 1 ]]; then
+ echo "ndnpingserver did not exit"
+ clean_up
+ exit 2
+fi
+
+clean_up
+
+nReceivedInterests=$(grep -c "interest received" $workdir/logs/ndnpingserver.log)
+if [[ $nReceivedInterests -ne 5 ]]; then
+ echo "ndnpingserver did not receive 5 Interests - actual: $nReceivedInterests"
+ clean_up
+ exit 3
+fi
diff --git a/test_ndnping/test_ndnping.py b/test_ndnping/test_ndnping.py
index 4ee2c3d..b88ed59 100644
--- a/test_ndnping/test_ndnping.py
+++ b/test_ndnping/test_ndnping.py
@@ -1,50 +1,35 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2014 University of Arizona
+# Copyright (C) 2014-2018 Arizona Board of Regents.
# Author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
+# Author: Eric Newberry <enewberry@cs.arizona.edu>
# See COPYING for copyright and distribution information.
#
-import time
+import os
import unittest
-import process_manager
+import subprocess
-class test_ndnping(unittest.TestCase, process_manager.ProcessManager):
- """Test case for testing ndnping application"""
+class test_ndnping(unittest.TestCase):
+ """Test case for the ndnping application"""
def setUp(self):
print "\nTesting ndnping"
- print "********************"
+ print "***************"
+ os.chdir("test_ndnping")
def tearDown(self):
- self.killNfd()
- self.killProcess("ndnpingserver")
- self.killProcess("ndnping")
- self.cleanupProcesses()
+ print "***************"
+ os.chdir("..")
- def test_ping(self):
- self.startNfd()
- time.sleep(1)
- time.sleep(1)
- self.startProcess("ndnpingserver",
- ["ndnpingserver", "-p1", "/test/ndnping"], "-> Starting Ping Server")
- time.sleep(1)
- self.startProcess("ndnping",
- ["ndnping", "-c1", "/test/ndnping"], "-> Starting Ping Client")
- time.sleep(1)
- self.waitForProcessCompletion("ndnping", 10)
- self.waitForProcessCompletion("ndnpingserver", 10)
- if self.hasProcessCompleted("ndnping"):
- if self.getProcessReturnCode("ndnping") != 0:
- print self.getProcessError("ndnping")
- self.fail(">> TEST FAILED - received non-zero return code from ndnping")
- else:
- self.fail(">> TEST FAILED - ndnping failed to complete")
- if self.hasProcessCompleted("ndnpingserver"):
- if self.getProcessReturnCode("ndnpingserver") != 0:
- print self.getProcessError("ndnpingserver")
- self.fail(">> TEST FAILED - received non-zero return code from ndnpingserver")
- else:
- self.fail(">> TEST FAILED - ndnpingserver failed to complete")
- print ">> TEST SUCCESSFUL"
+ def test_ndnping(self):
+ ret = subprocess.call(["./ndnping-test.sh"], shell=True)
+ print "Test script return value:", ret
+ errormsg = {
+ 1 : "ndnping did not receive a Data packet satisfying its Interest",
+ 2 : "ndnpingserver did not exit after sending 5 Data packets",
+ 3 : "ndnpingserver did not receive 5 Interests",
+ }
+ if (ret != 0):
+ self.fail(errormsg[ret])
diff --git a/test_ndntraffic/README.md b/test_ndntraffic/README.md
index 531c651..85384f0 100644
--- a/test_ndntraffic/README.md
+++ b/test_ndntraffic/README.md
@@ -3,10 +3,10 @@
## Objective ##
-To test the ndn-traffic-generator application on a single host.
+Test ndn-traffic-generator application on a single host.
## Description ##
-This test case will run NFD, ndn-traffic and ndn-traffic-server.
-This will report SUCCESS if one interest/data is successfully exchanged without any data inconsistency between ndn-traffic and ndn-traffic-server.
-In all other scenarios, the test case will report FAILURE
+This test case will run NFD, ndn-traffic, and ndn-traffic-server.
+This will report SUCCESS if one Interest/Data exchange is completed without any data inconsistency between ndn-traffic and ndn-traffic-server.
+Otherwise, it will fail.
diff --git a/test_ndntraffic/__init__.py b/test_ndntraffic/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/test_ndntraffic/__init__.py
+++ /dev/null
diff --git a/test_ndntraffic/ndntraffic-test.sh b/test_ndntraffic/ndntraffic-test.sh
new file mode 100755
index 0000000..3f494cd
--- /dev/null
+++ b/test_ndntraffic/ndntraffic-test.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+source ../multi-host.conf
+
+clean_up() {
+ r=$(sudo killall ndn-traffic-server 2>&1)
+ r=$(sudo killall ndn-traffic 2>&1)
+ r=$(sudo killall nfd 2>&1)
+}
+
+# A: Start NFD
+workdir=$(pwd)
+echo "starting nfd on A..."
+mkdir -p $workdir/logs; sudo nfd &> $workdir/logs/nfd.log &
+sleep 1
+
+# A: Start ndn-traffic-server
+echo "starting ndn-traffic-server on A..."
+ndn-traffic-server -c 1 $workdir/test-traffic-server.conf &> $workdir/logs/ndn-traffic-server.log &
+serverpid=$!
+sleep 1
+
+# A: Run ndn-traffic
+echo "Running ndn-traffic on A..."
+ndn-traffic -c 1 $workdir/test-traffic-client.conf &> $workdir/logs/ndn-traffic.log
+exitcode=$?
+
+if [[ $exitcode -ne 0 ]]; then
+ echo "Received non-zero exit code from ndn-traffic - actual: $exitcode"
+ clean_up
+ exit 1
+fi
+
+sleep 1
+
+# Verify that ndn-traffic-server has exited
+# ps -p returns 1 if no matching process is found
+ps -p $serverpid > /dev/null
+if [[ $? -ne 1 ]]; then
+ echo "ndn-traffic-server did not exit"
+ clean_up
+ exit 2
+fi
+
+clean_up
diff --git a/test_ndntraffic/test_ndntraffic.py b/test_ndntraffic/test_ndntraffic.py
index 632c4fe..e81c2cc 100644
--- a/test_ndntraffic/test_ndntraffic.py
+++ b/test_ndntraffic/test_ndntraffic.py
@@ -1,54 +1,34 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2014 University of Arizona
+# Copyright (C) 2014-2018 Arizona Board of Regents.
# Author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
+# Author: Eric Newberry <enewberry@cs.arizona.edu>
# See COPYING for copyright and distribution information.
#
import os
-import time
import unittest
-import process_manager
+import subprocess
-class test_ndntraffic(unittest.TestCase, process_manager.ProcessManager):
- """Test case for testing ndn-traffic-generator application"""
+class test_ndntraffic(unittest.TestCase):
+ """Test case for ndn-traffic-generator"""
def setUp(self):
print "\nTesting ndn-traffic-generator"
print "*****************************"
+ os.chdir("test_ndntraffic")
def tearDown(self):
- self.killNfd()
- self.killProcess("ndn-traffic-server")
- self.killProcess("ndn-traffic")
- self.cleanupProcesses()
+ print "*****************************"
+ os.chdir("..")
- def test_traffic(self):
- self.startNfd()
- time.sleep(1)
- serverConfigurationFile = os.path.abspath("test_ndntraffic/test-traffic-server.conf")
- self.startProcess("ndn-traffic-server",
- ["ndn-traffic-server", "-c 1", serverConfigurationFile],
- "-> Starting Traffic Server")
- time.sleep(1)
- clientConfigurationFile = os.path.abspath("test_ndntraffic/test-traffic-client.conf")
- self.startProcess("ndn-traffic",
- ["ndn-traffic", "-c 1", clientConfigurationFile],
- "-> Starting Traffic Client")
- time.sleep(1)
- self.waitForProcessCompletion("ndn-traffic", 10)
- self.waitForProcessCompletion("ndn-traffic-server", 10)
- if self.hasProcessCompleted("ndn-traffic"):
- if self.getProcessReturnCode("ndn-traffic") != 0:
- print self.getProcessError("ndn-traffic")
- self.fail(">> TEST FAILED - received non-zero return code from ndn-traffic")
- else:
- self.fail(">> TEST FAILED - ndn-traffic failed to complete")
- if self.hasProcessCompleted("ndn-traffic-server"):
- if self.getProcessReturnCode("ndn-traffic-server") != 0:
- print self.getProcessError("ndn-traffic-server")
- self.fail(">> TEST FAILED - received non-zero return code from ndn-traffic-server")
- else:
- self.fail(">> TEST FAILED - ndn-traffic-server failed to complete")
- print ">> TEST SUCCESSFUL"
+ def test_ndntraffic(self):
+ ret = subprocess.call(["./ndntraffic-test.sh"], shell=True)
+ print "Test script return value:", ret
+ errormsg = {
+ 1 : "ndn-traffic did not receive a Data satisfying its Interest",
+ 2 : "ndn-traffic-server did not exit after sending a Data packet",
+ }
+ if (ret != 0):
+ self.fail(errormsg[ret])
diff --git a/test_nexthopfaceid/test_nexthopfaceid.py b/test_nexthopfaceid/test_nexthopfaceid.py
index 7b56df9..00a229b 100644
--- a/test_nexthopfaceid/test_nexthopfaceid.py
+++ b/test_nexthopfaceid/test_nexthopfaceid.py
@@ -1,7 +1,7 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2016 University of Arizona
+# Copyright (C) 2016 Arizona Board of Regents.
# Author: Eric Newberry <enewberry@cs.arizona.edu>
# See COPYING for copyright and distribution information.
#
diff --git a/test_nrd/test_nrd.py b/test_nrd/test_nrd.py
index b64909b..0d3d73b 100644
--- a/test_nrd/test_nrd.py
+++ b/test_nrd/test_nrd.py
@@ -1,7 +1,7 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2014 University of Arizona
+# Copyright (C) 2014 Arizona Board of Regents.
# Author: Yi Huang <ltr120@email.arizona.edu>
# See COPYING for copyright and distribution information.
#
diff --git a/test_tcp_udp_tunnel/test_tcp_udp_tunnel.py b/test_tcp_udp_tunnel/test_tcp_udp_tunnel.py
index 50195e1..1e0baec 100644
--- a/test_tcp_udp_tunnel/test_tcp_udp_tunnel.py
+++ b/test_tcp_udp_tunnel/test_tcp_udp_tunnel.py
@@ -1,7 +1,7 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2014 University of Arizona
+# Copyright (C) 2014 Arizona Board of Regents.
# Author: Yi Huang <ltr120@email.arizona.edu>
# See COPYING for copyright and distribution information.
#
diff --git a/test_unixface/test_unixface.py b/test_unixface/test_unixface.py
index 0dbfaeb..171f850 100644
--- a/test_unixface/test_unixface.py
+++ b/test_unixface/test_unixface.py
@@ -1,7 +1,7 @@
#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2014 University of Arizona
+# Copyright (C) 2014 Arizona Board of Regents.
# Author: Yi Huang <ltr120@email.arizona.edu>
# See COPYING for copyright and distribution information.
#