blob: 2b8778914a9080d0fc8e73ae6db77acb579306a1 [file] [log] [blame]
Yi Huang4a4566b2014-04-26 23:59:48 -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_multicast(unittest.TestCase):
14 """Test case for multicast scenario"""
15
16 errormsg = {
17 1 : "Interest ndn:/test-mcast/B/1 is unanswered.",
18 2 : "Interest ndn:/test-mcast/C/1 is unanswered.",
19 3 : "Interest ndn:/test-mcast/Z/1 is unanswered.",
20 4 : "Interest ndn:/test-mcast/Z/2 is unanswered.",
21 }
22
23 def setUp(self):
24 print "\nTesting Multicast"
25 print "*****************"
26 os.chdir("test_multicast")
27
28 def tearDown(self):
29 print "*****************"
30 os.chdir("..")
31
32 def test_udp_multicast(self):
33 print ">>> Test UDP multicast <<<"
34 ret = subprocess.call(["./multicast-test.sh udp"], shell=True)
35 print "Test script return value:", ret
36 if ret != 0:
37 self.fail(self.errormsg[ret])
38
39 def test_eth_multicast(self):
40 print ">>> Test Ethernet multicast <<<"
41 ret = subprocess.call(["./multicast-test.sh eth"], shell=True)
42 print "Test script return value:", ret
43 if ret != 0:
44 self.fail(self.errormsg[ret])