| #!/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]) |