Eric Newberry | dbf14b1 | 2016-12-27 12:18:53 +0000 | [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_mobility_link(unittest.TestCase): |
| 14 | """Test case for Mobility with Link""" |
| 15 | |
| 16 | def setUp(self): |
| 17 | print "\nTesting Mobility with Link" |
| 18 | print "*****************" |
| 19 | os.chdir("test_mobility_link") |
| 20 | |
| 21 | def tearDown(self): |
| 22 | print "*****************" |
| 23 | os.chdir("..") |
| 24 | |
| 25 | def test_mobility_link(self): |
| 26 | ret = subprocess.call(["./mobility-link-test.sh"], shell=True) |
| 27 | print "Test script return value:", ret |
| 28 | errormsg = { |
| 29 | 1 : "Failed to create required routes", |
| 30 | 2 : "Interest /net/ndnsim/www/index.html not answered with Data containing payload 'DDDDDDDD'", |
| 31 | 3 : "Interest /net/ndnsim/www/news.html not answered with Nack with reason 'NoRoute'", |
| 32 | 4 : "Interest /net/ndnsim/www/contact.html not answered with Data containing payload 'BBBBBBBB'", |
| 33 | 5 : "Interest /net/ndnsim/www/about.html not answered with Data containing payload 'CCCCCCCC'", |
| 34 | 6 : "Interest /net/ndnsim/www/info.html not answered with Data containing payload 'CCCCCCCC'", |
| 35 | 7 : "Interest /net/ndnsim/www/logo.jpg not answered with Nack with reason 'NoRoute'", |
| 36 | } |
| 37 | if (ret != 0): |
| 38 | self.fail(errormsg[ret]) |