#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
# Copyright (C) 2017 Arizona Board of Regents.
# Author: Eric Newberry <enewberry@cs.arizona.edu>
# See COPYING for copyright and distribution information.
#

import os
import unittest
import subprocess

class test_congestionmark(unittest.TestCase):
    """Test case for CongestionMark field"""

    def setUp(self):
        print "\nTesting CongestionMark"
        print "*****************"
        os.chdir("test_congestionmark")

    def tearDown(self):
        print "*****************"
        os.chdir("..")

    def test_congestionmark(self):
        ret = subprocess.call(["./congestionmark-test.sh"], shell=True)
        print "Test script return value:", ret
        errormsg = {
            1 : "Failed to create required routes",
            2 : "Failed to set CongestionMarkStrategy",
            3 : "Interest /arizona/cs timed out, was nacked, or did not contain a congestion mark with a value of 1",
            4 : "Interest /ucla/cs timed out, was nacked, or contained a congestion mark",
            5 : "Interest /ucsd/caida timed out, was nacked, or did not contain a congestion mark with a value of 3",
            6 : "Consumer did not exit with status 0",
        }
        if (ret != 0):
            self.fail(errormsg[ret])
