示例#1
0
def test_voq_switch_create(duthosts):
    """Compare the config facts with the asic db for switch:
    * Verify ASIC_DB get all system ports referenced in configDB created on all hosts and ASICs.
    * Verify object creation and values of port attributes.
    """

    switch_id_list = []
    for per_host in duthosts.frontend_nodes:

        for asic in per_host.asics:
            cfg_facts = asic.config_facts(source="persistent")['ansible_facts']
            dev_facts = cfg_facts['DEVICE_METADATA']['localhost']
            asicdb = AsicDbCli(asic)

            switchkey = asicdb.get_switch_key()
            logger.info("Checking switch %s", switchkey)
            check_list = {
                "max_cores": "SAI_SWITCH_ATTR_MAX_SYSTEM_CORES",
                "switch_id": "SAI_SWITCH_ATTR_SWITCH_ID"
            }
            for k in check_list:
                asicdb.get_and_check_key_value(switchkey,
                                               dev_facts[k],
                                               field=check_list[k])

            pytest_assert(
                dev_facts["switch_id"] not in switch_id_list,
                "Switch ID: %s has been used more than once" %
                dev_facts["switch_id"])
            switch_id_list.append(dev_facts["switch_id"])

            asicdb.get_and_check_key_value(switchkey,
                                           "SAI_SWITCH_TYPE_VOQ",
                                           field="SAI_SWITCH_ATTR_TYPE")
示例#2
0
    def test_voq_switch_create(self, duthosts, enum_frontend_dut_hostname,
                               enum_asic_index, all_cfg_facts):
        """Compare the config facts with the asic db for switch:
        * Verify ASIC_DB get all system ports referenced in configDB created on all hosts and ASICs.
        * Verify object creation and values of port attributes.
        """
        per_host = duthosts[enum_frontend_dut_hostname]
        asic = per_host.asics[
            enum_asic_index if enum_asic_index is not None else 0]
        cfg_facts = all_cfg_facts[per_host.hostname][
            asic.asic_index]['ansible_facts']

        dev_facts = cfg_facts['DEVICE_METADATA']['localhost']
        asicdb = AsicDbCli(asic)

        switchkey = asicdb.get_switch_key()
        logger.info("Checking switch %s", switchkey)
        check_list = {
            "max_cores": "SAI_SWITCH_ATTR_MAX_SYSTEM_CORES",
            "switch_id": "SAI_SWITCH_ATTR_SWITCH_ID"
        }
        for k in check_list:
            asicdb.get_and_check_key_value(switchkey,
                                           dev_facts[k],
                                           field=check_list[k])

        pytest_assert(
            dev_facts["switch_id"] not in TestVoqSwitch.SWITCH_ID_LIST,
            "Switch ID: %s has been used more than once" %
            dev_facts["switch_id"])
        TestVoqSwitch.SWITCH_ID_LIST.append(dev_facts["switch_id"])

        asicdb.get_and_check_key_value(switchkey,
                                       "SAI_SWITCH_TYPE_VOQ",
                                       field="SAI_SWITCH_ATTR_TYPE")