#!/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])
