Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 1 | #!/usr/bin/python2 |
| 2 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 3 | # |
| 4 | # Copyright (C) 2016 University of Arizona |
| 5 | # Author: Eric Newberry <enewberry@cs.arizona.edu> |
| 6 | # See COPYING for copyright and distribution information. |
| 7 | # |
| 8 | |
| 9 | import os |
| 10 | import unittest |
| 11 | import subprocess |
| 12 | |
| 13 | class test_nexthopfaceid(unittest.TestCase): |
| 14 | """Test case for NextHopFaceId field""" |
| 15 | |
| 16 | def setUp(self): |
| 17 | print "\nTesting NextHopFaceId" |
| 18 | print "*****************" |
| 19 | os.chdir("test_nexthopfaceid") |
| 20 | |
| 21 | def tearDown(self): |
| 22 | print "*****************" |
| 23 | os.chdir("..") |
| 24 | |
| 25 | def test_nexthopfaceid(self): |
| 26 | ret = subprocess.call(["./nexthopfaceid-test.sh"], shell=True) |
| 27 | print "Test script return value:", ret |
| 28 | errormsg = { |
| 29 | 1 : "Failed to create required routes", |
| 30 | 2 : "Interest ndn:/P/1 not answered with Data containing payload 'BBBBBBBB'", |
| 31 | 3 : "Interest ndn:/P/2 not answered with Data containing payload 'BBBBBBBB'", |
| 32 | 4 : "Interest ndn:/P/3 not answered with Data containing payload 'CCCCCCCC'", |
| 33 | 5 : "Interest ndn:/P/4 was not answered with a Nack and did not time out", |
| 34 | 6 : "Interest ndn:/P/5 was not answered with Data containing payload 'BBBBBBBB' and did not time out", |
| 35 | } |
| 36 | if (ret != 0): |
| 37 | self.fail(errormsg[ret]) |