blob: 229f338558ab4a91a76f19b33679151b61fd55c3 [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",
Eric Newberry7745c1a2017-04-20 00:23:05 -070020 4 : "nfdc face list 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
Junxiao Shif9ecac22015-08-28 10:02:51 -070032 def test_multicast(self):
33 print ">>> Testing with Multicast Strategy <<<"
34 ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/multicast multicast"], 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])