コード例 #1
0
    def test_hierarchy(self):
        cls = self.__class__
        t1 = TcOpsPyRoute2()
        # First queue

        iface1 = cls.IFACE
        qid1 = "0xae"
        max_bw = 10000
        rate = 1000
        parent_qid1 = '1:fffe'

        err1 = t1.create(iface1, qid1, max_bw, rate, parent_qid1)
        self.assertTrue(self.check_qid_in_tc(qid1))

        # Second queue

        qid2 = "0x1ae"
        max_bw = 10000
        rate = 1000
        parent_qid2 = '1:' + qid1

        err1 = t1.create(iface1, qid2, max_bw, rate, parent_qid2)
        self.assertTrue(self.check_qid_in_tc(qid2))
        # t1._print_classes(iface1)
        # t1._print_filters(iface1)

        err = t1.delete(iface1, qid2)
        self.assertEqual(err, 0)
        self.assertFalse(self.check_qid_in_tc(qid2))

        err = t1.delete(iface1, qid1)
        self.assertFalse(self.check_qid_in_tc(qid1))

        self.assertEqual(err, 0)
        self.assertEqual(err1, 0)
コード例 #2
0
    def test_mix2(self):
        cls = self.__class__
        t1 = TcOpsPyRoute2()
        t2 = TcOpsCmd()
        iface = cls.IFACE
        qid = "0xae"
        max_bw = 10000
        rate = 1000
        parent_qid = '1:fffe'

        err1 = t2.create_htb(iface, qid, max_bw, rate, parent_qid)
        self.assertEqual(err1, 0)
        err1 = t2.create_filter(iface, qid, qid)
        self.assertEqual(err1, 0)

        self.assertTrue(self.check_qid_in_tc(qid))

        err = t1.del_filter(iface, qid, qid)
        self.assertEqual(err, 0)
        err = t1.del_htb(iface, qid)
        self.assertEqual(err, 0)

        self.assertFalse(self.check_qid_in_tc(qid))
        self.assertEqual(err, 0)
        self.assertEqual(err1, 0)
コード例 #3
0
    def test_basic6(self):
        cls = self.__class__
        t1 = TcOpsPyRoute2()
        iface = cls.IFACE
        qid = "0xae"
        max_bw = 10000
        rate = 1000
        parent_qid = '1:fffe'

        err1 = t1.create(iface, qid, max_bw, rate, parent_qid, proto=0x86DD)
        self.assertTrue(self.check_qid_in_tc(qid))
        err = t1.delete(iface, qid, proto=0x86DD)
        self.assertFalse(self.check_qid_in_tc(qid))
        self.assertEqual(err, 0)
        self.assertEqual(err1, 0)