Beispiel #1
0
    def test_multiple_vlans(self):
        with vlan_device(self.device_name, tag=16) as vlan1:
            with vlan_device(self.device_name, tag=17) as vlan2:
                for v in (vlan1, vlan2):
                    qos.configure_outbound(HOST_QOS_OUTBOUND,
                                           self.device_name, v.tag)

                tc_classes, tc_filters, tc_qdiscs = \
                    self._analyse_qos_and_general_assertions()
                self.assertEqual(len(tc_classes.classes), 2)

                self.assertEqual(len(tc_qdiscs.leaf_qdiscs), 3)
                v1_qdisc = self._vlan_qdisc(tc_qdiscs.leaf_qdiscs, vlan1.tag)
                v2_qdisc = self._vlan_qdisc(tc_qdiscs.leaf_qdiscs, vlan2.tag)
                v1_class = self._vlan_class(tc_classes.classes, vlan1.tag)
                v2_class = self._vlan_class(tc_classes.classes, vlan2.tag)
                self._assert_parent([v1_qdisc], v1_class)
                self._assert_parent([v2_qdisc], v2_class)

                self.assertEqual(len(tc_filters.tagged_filters), 2)
                current_tagged_filters_flow_id = set(
                    f['basic']['flowid'] for f in tc_filters.tagged_filters)
                expected_flow_ids = set(
                    '%s%x' % (qos._ROOT_QDISC_HANDLE, v.tag)
                    for v in (vlan1, vlan2))
                self.assertEqual(current_tagged_filters_flow_id,
                                 expected_flow_ids)
Beispiel #2
0
    def test_multiple_vlans(self):
        with vlan_device(self.device_name, tag=16) as vlan1:
            with vlan_device(self.device_name, tag=17) as vlan2:
                for v in (vlan1, vlan2):
                    qos.configure_outbound(HOST_QOS_OUTBOUND, self.device_name,
                                           v.tag)

                tc_classes, tc_filters, tc_qdiscs = \
                    self._analyse_qos_and_general_assertions()
                self.assertEqual(len(tc_classes.classes), 2)

                self.assertEqual(len(tc_qdiscs.leaf_qdiscs), 3)
                v1_qdisc = self._vlan_qdisc(tc_qdiscs.leaf_qdiscs, vlan1.tag)
                v2_qdisc = self._vlan_qdisc(tc_qdiscs.leaf_qdiscs, vlan2.tag)
                v1_class = self._vlan_class(tc_classes.classes, vlan1.tag)
                v2_class = self._vlan_class(tc_classes.classes, vlan2.tag)
                self._assert_parent([v1_qdisc], v1_class)
                self._assert_parent([v2_qdisc], v2_class)

                self.assertEqual(len(tc_filters.tagged_filters), 2)
                current_tagged_filters_flow_id = set(
                    f['basic']['flowid'] for f in tc_filters.tagged_filters)
                expected_flow_ids = set('%s%x' %
                                        (qos._ROOT_QDISC_HANDLE, v.tag)
                                        for v in (vlan1, vlan2))
                self.assertEqual(current_tagged_filters_flow_id,
                                 expected_flow_ids)
Beispiel #3
0
    def test_single_vlan(self, repeating_calls):
        with vlan_device(self.device_name) as vlan:
            for _ in range(repeating_calls):
                qos.configure_outbound(HOST_QOS_OUTBOUND, self.device_name,
                                       vlan.tag)
            tc_classes, tc_filters, tc_qdiscs = \
                self._analyse_qos_and_general_assertions()
            self.assertEqual(len(tc_classes.classes), 1)

            self.assertEqual(len(tc_qdiscs.leaf_qdiscs), 2)
            vlan_qdisc = self._vlan_qdisc(tc_qdiscs.leaf_qdiscs, vlan.tag)
            vlan_class = self._vlan_class(tc_classes.classes, vlan.tag)
            self._assert_parent([vlan_qdisc], vlan_class)

            self.assertEqual(len(tc_filters.tagged_filters), 1)
            self.assertEqual(
                int(tc_filters.tagged_filters[0]['basic']['value']), vlan.tag)
Beispiel #4
0
    def test_single_vlan(self, repeating_calls):
        with vlan_device(self.device_name) as vlan:
            for _ in range(repeating_calls):
                qos.configure_outbound(HOST_QOS_OUTBOUND, self.device_name,
                                       vlan.tag)
            tc_classes, tc_filters, tc_qdiscs = \
                self._analyse_qos_and_general_assertions()
            self.assertEqual(len(tc_classes.classes), 1)

            self.assertEqual(len(tc_qdiscs.leaf_qdiscs), 2)
            vlan_qdisc = self._vlan_qdisc(tc_qdiscs.leaf_qdiscs, vlan.tag)
            vlan_class = self._vlan_class(tc_classes.classes, vlan.tag)
            self._assert_parent([vlan_qdisc], vlan_class)

            self.assertEqual(len(tc_filters.tagged_filters), 1)
            self.assertEqual(
                int(tc_filters.tagged_filters[0]['basic']['value']),
                vlan.tag)