| #!/usr/bin/python2 |
| # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| # |
| # Copyright (C) 2016 University of Arizona |
| # Author: Eric Newberry <enewberry@cs.arizona.edu> |
| # See COPYING for copyright and distribution information. |
| # |
| |
| import os |
| import unittest |
| import subprocess |
| |
| class test_mobility_link(unittest.TestCase): |
| """Test case for Mobility with Link""" |
| |
| def setUp(self): |
| print "\nTesting Mobility with Link" |
| print "*****************" |
| os.chdir("test_mobility_link") |
| |
| def tearDown(self): |
| print "*****************" |
| os.chdir("..") |
| |
| def test_mobility_link(self): |
| ret = subprocess.call(["./mobility-link-test.sh"], shell=True) |
| print "Test script return value:", ret |
| errormsg = { |
| 1 : "Failed to create required routes", |
| 2 : "Interest /net/ndnsim/www/index.html not answered with Data containing payload 'DDDDDDDD'", |
| 3 : "Interest /net/ndnsim/www/news.html not answered with Nack with reason 'NoRoute'", |
| 4 : "Interest /net/ndnsim/www/contact.html not answered with Data containing payload 'BBBBBBBB'", |
| 5 : "Interest /net/ndnsim/www/about.html not answered with Data containing payload 'CCCCCCCC'", |
| 6 : "Interest /net/ndnsim/www/info.html not answered with Data containing payload 'CCCCCCCC'", |
| 7 : "Interest /net/ndnsim/www/logo.jpg not answered with Nack with reason 'NoRoute'", |
| } |
| if (ret != 0): |
| self.fail(errormsg[ret]) |