| #!/usr/bin/python2 |
| # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| # |
| # Copyright (C) 2014 University of Arizona |
| # Author: Yi Huang <ltr120@email.arizona.edu> |
| # See COPYING for copyright and distribution information. |
| # |
| |
| import os |
| import unittest |
| import subprocess |
| |
| class test_multicast(unittest.TestCase): |
| """Test case for multicast scenario""" |
| |
| errormsg = { |
| 1 : "Interest ndn:/test-mcast/B/1 is unanswered.", |
| 2 : "Interest ndn:/test-mcast/C/1 is unanswered.", |
| 3 : "Interest ndn:/test-mcast/Z/1 is unanswered.", |
| 4 : "Interest ndn:/test-mcast/Z/2 is unanswered.", |
| } |
| |
| def setUp(self): |
| print "\nTesting Multicast" |
| print "*****************" |
| os.chdir("test_multicast") |
| |
| def tearDown(self): |
| print "*****************" |
| os.chdir("..") |
| |
| def test_udp_multicast(self): |
| print ">>> Test UDP multicast <<<" |
| ret = subprocess.call(["./multicast-test.sh udp"], shell=True) |
| print "Test script return value:", ret |
| if ret != 0: |
| self.fail(self.errormsg[ret]) |
| |
| def test_eth_multicast(self): |
| print ">>> Test Ethernet multicast <<<" |
| ret = subprocess.call(["./multicast-test.sh eth"], shell=True) |
| print "Test script return value:", ret |
| if ret != 0: |
| self.fail(self.errormsg[ret]) |