| #!/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 |
| |
| class test_interest_loop(unittest.TestCase): |
| """Test case for Interest loop scenario""" |
| |
| errormsg = { |
| 1 : "Counter for incoming interest is greater than 200.", |
| 2 : "Counter for outgoing interest is greater than 200.", |
| } |
| |
| def setUp(self): |
| print "\nTesting Interest loop scenario" |
| print "******************************" |
| os.chdir("test_interest_loop") |
| |
| def tearDown(self): |
| print "******************************" |
| os.chdir("..") |
| |
| def test_broadcast(self): |
| print ">>> Testing with Broadcast Strategy <<<" |
| ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/broadcast broadcast"], shell=True) |
| print "Test script return value:", ret |
| if ret != 0: |
| self.fail(self.errormsg[ret]) |
| |
| def test_best_route(self): |
| print ">>> Testing with Best-route Strategy <<<" |
| ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/best-route best-route"], shell=True) |
| print "Test script return value:", ret |
| if ret != 0: |
| self.fail(self.errormsg[ret]) |
| |
| def test_client_control(self): |
| print ">>> Testing with Client Control Strategy <<<" |
| ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/client-control client-control"], shell=True) |
| print "Test script return value:", ret |
| if ret != 0: |
| self.fail(self.errormsg[ret]) |
| |
| def test_ncc(self): |
| print ">>> Testing with NCC Strategy <<<" |
| ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/ncc ncc"], shell=True) |
| print "Test script return value:", ret |
| if ret != 0: |
| self.fail(self.errormsg[ret]) |