blob: cbc014eab2d9730eecc2a3d1742055d0b960a1f2 [file] [log] [blame]
Junxiao Shia59f2072014-04-27 20:52:25 -07001#!/usr/bin/python2
2# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
3#
4# Copyright (C) 2014 University of Arizona
5# Author: Yi Huang <ltr120@email.arizona.edu>
6# See COPYING for copyright and distribution information.
7#
8
9import os
10import unittest
11import subprocess
12import ConfigParser
13
14class test_localhost_scope(unittest.TestCase):
15 """Test case for testing /localhost scope control"""
16
17 def setUp(self):
18 print "\nTesting /localhost scope control"
19 print "********************************"
20 os.chdir("test_localhost_scope")
21
22 def tearDown(self):
23 print "********************************"
24 os.chdir("..")
25
26 def test_localhost_scope_in(self):
27 ret = subprocess.call(["./in-master.sh"], shell=True)
28 errormsg = {
29 2 : "Data packet came back to A (expected no data come back)",
30 3 : "Interest from A was received on B",
31 }
32 if (ret != 0):
33 self.fail(errormsg[ret])
34
35 def test_localhost_scope_out(self):
36 ret = subprocess.call(["./out-master.sh"], shell=True)
37 errormsg = {
38 4 : "Fail to add nexthop to A on B",
39 7 : "/localhost Interest reaches remote host.",
40 9 : "non-/localhost Interest does not reach remote host.",
41 }
42 if (ret != 0):
43 self.fail(errormsg[ret])