blob: b4b1bf7715b1a00afab1c34cfb0d3e1458b7454a [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.",
Eric Newberry4aeadeb2015-06-23 21:21:12 -070019 3 : "add-nexthop failed",
20 4 : "nfd-status failed",
Yi Huang3d230672014-04-26 04:25:24 -070021 }
22
23 def setUp(self):
24 print "\nTesting Interest loop scenario"
25 print "******************************"
26 os.chdir("test_interest_loop")
27
28 def tearDown(self):
29 print "******************************"
30 os.chdir("..")
31
32 def test_broadcast(self):
33 print ">>> Testing with Broadcast Strategy <<<"
Eric Newberry6fc88222015-06-19 10:43:24 -070034 ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/broadcast broadcast"], shell=True)
Yi Huang3d230672014-04-26 04:25:24 -070035 print "Test script return value:", ret
36 if ret != 0:
37 self.fail(self.errormsg[ret])
38
39 def test_best_route(self):
40 print ">>> Testing with Best-route Strategy <<<"
Eric Newberry6fc88222015-06-19 10:43:24 -070041 ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/best-route best-route"], shell=True)
Yi Huang3d230672014-04-26 04:25:24 -070042 print "Test script return value:", ret
43 if ret != 0:
44 self.fail(self.errormsg[ret])
45
46 def test_client_control(self):
47 print ">>> Testing with Client Control Strategy <<<"
Eric Newberry6fc88222015-06-19 10:43:24 -070048 ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/client-control client-control"], shell=True)
Yi Huang3d230672014-04-26 04:25:24 -070049 print "Test script return value:", ret
50 if ret != 0:
51 self.fail(self.errormsg[ret])
52
53 def test_ncc(self):
54 print ">>> Testing with NCC Strategy <<<"
Eric Newberry6fc88222015-06-19 10:43:24 -070055 ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/ncc ncc"], shell=True)
Yi Huang3d230672014-04-26 04:25:24 -070056 print "Test script return value:", ret
57 if ret != 0:
58 self.fail(self.errormsg[ret])