ptf/saiqosmap.py [4309:4399]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        tc_list = [0, 1, 2, 3, 4, 5, 6, 7]
        tc_pg_list = [0, 1, 2, 3, 4, 5, 6, 7]
        self.test_dev_ports = [self.dev_port0]
        self.test_pfc_to_pg_map_id = [0] * 4
        self.test_tc_to_pg_map_id = [0] * 4
        self.test_mapping = [0] * 4
        pfc_pg_list = [0] * 4
        # different pfc -> ppg on different ingress ports
        self.test_case_name = ("various pfc -> ppg map on many ingress " +
                               "ports")
        pfc_list = [0, 1, 2, 3, 4, 5, 6, 7]
        pfc_pg_list[0] = [0, 0, 0, 0, 1, 1, 1, 1]
        pfc_pg_list[1] = [2, 2, 2, 2, 3, 3, 3, 3]
        pfc_pg_list[2] = [4, 4, 4, 4, 5, 5, 5, 5]
        pfc_pg_list[3] = [6, 6, 6, 6, 7, 7, 7, 7]
        # this mapping works on model
        pfc_pg_list[0] = [0, 1, 2, 3, 4, 5, 6, 7]
        pfc_pg_list[1] = [0, 1, 2, 3, 4, 5, 6, 7]
        pfc_pg_list[2] = [0, 1, 2, 3, 4, 5, 6, 7]
        pfc_pg_list[3] = [0, 1, 2, 3, 4, 5, 6, 7]
        self.test_dev_ports = [self.dev_port0, self.dev_port1,
                               self.dev_port2, self.dev_port3]
        for ingress_port in range(0, len(self.test_dev_ports)):
            mapping = combine_ingress_pfc_tc_to_pg_mapping(
                pfc_list, pfc_pg_list[ingress_port], tc_pg_list)
            self.test_mapping[ingress_port] = mapping
            self.test_pfc_to_pg_map_id[
                ingress_port] = self.pfc_to_pg_map_id[ingress_port]
            self.test_tc_to_pg_map_id[ingress_port] = self.tc_to_pg_map_id[
                ingress_port]
        qos_map_dict = {
            "qos_pfc_priority_to_priority_group_map": 0,
            "qos_dot1p_to_tc_map": 0,
            "qos_tc_to_priority_group_map": 0,
            "qos_dscp_to_tc_map": 0}
        for port in self.test_ports:
            self.setPortMultipleQosMapIds(
                port,
                qos_map_dict)
        for ingress_port in range(0, len(self.test_dev_ports)):
            # for L2 set the SAI_PORT_ATTR_QOS_DOT1P_TO_TC_MAP
            pfc_to_pg_map_id = self.test_pfc_to_pg_map_id[ingress_port]
            tc_to_pg_map_id = self.test_tc_to_pg_map_id[ingress_port]
            if (pfc_to_pg_map_id == 0) or (tc_to_pg_map_id == 0):
                continue
            if pfc_pg_list[ingress_port] == 0:
                continue
            # update QOS MAP PFC TO PRIORITY GROUP
            self.assertEqual(
                update_and_verify_qos_map(
                    self.client, pfc_to_pg_map_id,
                    SAI_QOS_MAP_TYPE_PFC_PRIORITY_TO_PRIORITY_GROUP, pfc_list,
                    pfc_pg_list[ingress_port]), True,
                "Failed verify updated qos_map attribute")
            # update QOS MAP TC TO PRIORITY GROUP
            self.assertEqual(
                update_and_verify_qos_map(
                    self.client, tc_to_pg_map_id,
                    SAI_QOS_MAP_TYPE_TC_TO_PRIORITY_GROUP,
                    tc_list, tc_pg_list), True,
                "Failed verify updated qos_map attribute")
        p = 0
        for port in self.test_ports:
            if self.test_pfc_to_pg_map_id[p] == 0:
                continue
            if qos_map_type == SAI_QOS_MAP_TYPE_DOT1P_TO_TC:
                sai_thrift_set_port_attribute(
                    self.client,
                    port,
                    qos_dot1p_to_tc_map=self.dot1_to_tc_map_id)
            else:
                sai_thrift_set_port_attribute(
                    self.client,
                    port,
                    qos_dscp_to_tc_map=self.qos_dscp_tc_map_id)
            sai_thrift_set_port_attribute(
                self.client,
                port,
                qos_tc_to_priority_group_map=self.test_tc_to_pg_map_id[p])
            # set the QOS PFC TO PRIORITY GROUP mapping
            sai_thrift_set_port_attribute(
                self.client,
                port,
                qos_pfc_priority_to_priority_group_map=self.
                test_pfc_to_pg_map_id[p])
            p += 1
        # get the initial counters
        expected_cnt = self.getPortPPGStats(self.test_dev_ports)
        for port in range(0, len(self.test_dev_ports)):
            ingress_port = self.test_dev_ports[port]
            for key, ppg in self.test_mapping[port]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



ptf/saiqosmap.py [4418:4508]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        tc_list = [0, 1, 2, 3, 4, 5, 6, 7]
        tc_pg_list = [0, 1, 2, 3, 4, 5, 6, 7]
        self.test_dev_ports = [self.dev_port0]
        self.test_pfc_to_pg_map_id = [0] * 4
        self.test_tc_to_pg_map_id = [0] * 4
        self.test_mapping = [0] * 4
        pfc_pg_list = [0] * 4
        # different pfc -> ppg on different ingress ports
        self.test_case_name = ("various pfc -> ppg map on many ingress " +
                               "ports")
        pfc_list = [0, 1, 2, 3, 4, 5, 6, 7]
        pfc_pg_list[0] = [0, 0, 0, 0, 1, 1, 1, 1]
        pfc_pg_list[1] = [2, 2, 2, 2, 3, 3, 3, 3]
        pfc_pg_list[2] = [4, 4, 4, 4, 5, 5, 5, 5]
        pfc_pg_list[3] = [6, 6, 6, 6, 7, 7, 7, 7]
        # this mapping works on model
        pfc_pg_list[0] = [0, 1, 2, 3, 4, 5, 6, 7]
        pfc_pg_list[1] = [0, 1, 2, 3, 4, 5, 6, 7]
        pfc_pg_list[2] = [0, 1, 2, 3, 4, 5, 6, 7]
        pfc_pg_list[3] = [0, 1, 2, 3, 4, 5, 6, 7]
        self.test_dev_ports = [self.dev_port0, self.dev_port1,
                               self.dev_port2, self.dev_port3]
        for ingress_port in range(0, len(self.test_dev_ports)):
            mapping = combine_ingress_pfc_tc_to_pg_mapping(
                pfc_list, pfc_pg_list[ingress_port], tc_pg_list)
            self.test_mapping[ingress_port] = mapping
            self.test_pfc_to_pg_map_id[
                ingress_port] = self.pfc_to_pg_map_id[ingress_port]
            self.test_tc_to_pg_map_id[ingress_port] = self.tc_to_pg_map_id[
                ingress_port]
        qos_map_dict = {
            "qos_pfc_priority_to_priority_group_map": 0,
            "qos_dot1p_to_tc_map": 0,
            "qos_tc_to_priority_group_map": 0,
            "qos_dscp_to_tc_map": 0}
        for port in self.test_ports:
            self.setPortMultipleQosMapIds(
                port,
                qos_map_dict)
        for ingress_port in range(0, len(self.test_dev_ports)):
            # for L2 set the SAI_PORT_ATTR_QOS_DOT1P_TO_TC_MAP
            pfc_to_pg_map_id = self.test_pfc_to_pg_map_id[ingress_port]
            tc_to_pg_map_id = self.test_tc_to_pg_map_id[ingress_port]
            if (pfc_to_pg_map_id == 0) or (tc_to_pg_map_id == 0):
                continue
            if pfc_pg_list[ingress_port] == 0:
                continue
            # update QOS MAP PFC TO PRIORITY GROUP
            self.assertEqual(
                update_and_verify_qos_map(
                    self.client, pfc_to_pg_map_id,
                    SAI_QOS_MAP_TYPE_PFC_PRIORITY_TO_PRIORITY_GROUP, pfc_list,
                    pfc_pg_list[ingress_port]), True,
                "Failed verify updated qos_map attribute")
            # update QOS MAP TC TO PRIORITY GROUP
            self.assertEqual(
                update_and_verify_qos_map(
                    self.client, tc_to_pg_map_id,
                    SAI_QOS_MAP_TYPE_TC_TO_PRIORITY_GROUP,
                    tc_list, tc_pg_list), True,
                "Failed verify updated qos_map attribute")
        p = 0
        for port in self.test_ports:
            if self.test_pfc_to_pg_map_id[p] == 0:
                continue
            if qos_map_type == SAI_QOS_MAP_TYPE_DOT1P_TO_TC:
                sai_thrift_set_port_attribute(
                    self.client,
                    port,
                    qos_dot1p_to_tc_map=self.dot1_to_tc_map_id)
            else:
                sai_thrift_set_port_attribute(
                    self.client,
                    port,
                    qos_dscp_to_tc_map=self.qos_dscp_tc_map_id)
            sai_thrift_set_port_attribute(
                self.client,
                port,
                qos_tc_to_priority_group_map=self.test_tc_to_pg_map_id[p])
            # set the QOS PFC TO PRIORITY GROUP mapping
            sai_thrift_set_port_attribute(
                self.client,
                port,
                qos_pfc_priority_to_priority_group_map=self.
                test_pfc_to_pg_map_id[p])
            p += 1
        # get the initial counters
        expected_cnt = self.getPortPPGStats(self.test_dev_ports)
        for port in range(0, len(self.test_dev_ports)):
            ingress_port = self.test_dev_ports[port]
            for key, ppg in self.test_mapping[port]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



