blob: e08b733cfc7bf5e86d175c4950bbf126a25460cc [file] [log] [blame]
Yi Huang3d230672014-04-26 04:25:24 -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
12
13class test_interest_loop(unittest.TestCase):
14 """Test case for Interest loop scenario"""
15
16 errormsg = {
17 1 : "Counter for incoming interest is greater than 200.",
18 2 : "Counter for outgoing interest is greater than 200.",
19 }
20
21 def setUp(self):
22 print "\nTesting Interest loop scenario"
23 print "******************************"
24 os.chdir("test_interest_loop")
25
26 def tearDown(self):
27 print "******************************"
28 os.chdir("..")
29
30 def test_broadcast(self):
31 print ">>> Testing with Broadcast Strategy <<<"
Eric Newberry6fc88222015-06-19 10:43:24 -070032 ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/broadcast broadcast"], shell=True)
Yi Huang3d230672014-04-26 04:25:24 -070033 print "Test script return value:", ret
34 if ret != 0:
35 self.fail(self.errormsg[ret])
36
37 def test_best_route(self):
38 print ">>> Testing with Best-route Strategy <<<"
Eric Newberry6fc88222015-06-19 10:43:24 -070039 ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/best-route best-route"], shell=True)
Yi Huang3d230672014-04-26 04:25:24 -070040 print "Test script return value:", ret
41 if ret != 0:
42 self.fail(self.errormsg[ret])
43
44 def test_client_control(self):
45 print ">>> Testing with Client Control Strategy <<<"
Eric Newberry6fc88222015-06-19 10:43:24 -070046 ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/client-control client-control"], shell=True)
Yi Huang3d230672014-04-26 04:25:24 -070047 print "Test script return value:", ret
48 if ret != 0:
49 self.fail(self.errormsg[ret])
50
51 def test_ncc(self):
52 print ">>> Testing with NCC Strategy <<<"
Eric Newberry6fc88222015-06-19 10:43:24 -070053 ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/ncc ncc"], shell=True)
Yi Huang3d230672014-04-26 04:25:24 -070054 print "Test script return value:", ret
55 if ret != 0:
56 self.fail(self.errormsg[ret])