localhost-scope-control-test: /localhost scope control scenario
refs #1391
Change-Id: I5c437dd234f929bcb41d78a8b68f93cad171af42
diff --git a/test_localhost_scope/test_localhost_scope.py b/test_localhost_scope/test_localhost_scope.py
new file mode 100644
index 0000000..cbc014e
--- /dev/null
+++ b/test_localhost_scope/test_localhost_scope.py
@@ -0,0 +1,43 @@
+#!/usr/bin/python2
+# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+#
+# Copyright (C) 2014 University of Arizona
+# Author: Yi Huang <ltr120@email.arizona.edu>
+# See COPYING for copyright and distribution information.
+#
+
+import os
+import unittest
+import subprocess
+import ConfigParser
+
+class test_localhost_scope(unittest.TestCase):
+ """Test case for testing /localhost scope control"""
+
+ def setUp(self):
+ print "\nTesting /localhost scope control"
+ print "********************************"
+ os.chdir("test_localhost_scope")
+
+ def tearDown(self):
+ print "********************************"
+ os.chdir("..")
+
+ def test_localhost_scope_in(self):
+ ret = subprocess.call(["./in-master.sh"], shell=True)
+ errormsg = {
+ 2 : "Data packet came back to A (expected no data come back)",
+ 3 : "Interest from A was received on B",
+ }
+ if (ret != 0):
+ self.fail(errormsg[ret])
+
+ def test_localhost_scope_out(self):
+ ret = subprocess.call(["./out-master.sh"], shell=True)
+ errormsg = {
+ 4 : "Fail to add nexthop to A on B",
+ 7 : "/localhost Interest reaches remote host.",
+ 9 : "non-/localhost Interest does not reach remote host.",
+ }
+ if (ret != 0):
+ self.fail(errormsg[ret])