Exemplo n.º 1
0
    def test_tx_disable(self, duthost, localhost, platform_api_conn):
        """This function tests both the get_tx_disable() and tx_disable() APIs"""
        for i in range(self.num_sfps):
            # First ensure that the transceiver type supports setting TX disable
            info_dict = sfp.get_transceiver_info(platform_api_conn, i)
            if not self.expect(
                    info_dict is not None,
                    "Unable to retrieve transceiver {} info".format(i)):
                continue

            if not self.is_xcvr_optical(info_dict):
                logger.warning(
                    "test_tx_disable: Skipping transceiver {} (not applicable for this transceiver type)"
                    .format(i))
                continue

            for state in [True, False]:
                ret = sfp.tx_disable(platform_api_conn, i, state)
                if self.expect(
                        ret is True,
                        "Failed to {} TX disable for transceiver {}".format(
                            "set" if state is True else "clear", i)):
                    tx_disable = sfp.get_tx_disable(platform_api_conn, i)
                    if self.expect(
                            tx_disable is not None,
                            "Unable to retrieve transceiver {} TX disable data"
                            .format(i)):
                        self.expect(
                            isinstance(tx_disable, list)
                            and (all(item == state) for item in tx_disable),
                            "Transceiver {} TX disable data is incorrect".
                            format(i))
        self.assert_expectations()
Exemplo n.º 2
0
    def test_tx_disable(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn):
        """This function tests both the get_tx_disable() and tx_disable() APIs"""
        duthost = duthosts[enum_rand_one_per_hwsku_hostname]
        skip_release_for_platform(duthost, ["202012"], ["arista", "mlnx"])

        for i in self.sfp_setup["sfp_test_port_indices"]:
            # First ensure that the transceiver type supports setting TX disable
            info_dict = sfp.get_transceiver_info(platform_api_conn, i)
            if not self.expect(info_dict is not None, "Unable to retrieve transceiver {} info".format(i)):
                continue

            if not self.is_xcvr_optical(info_dict):
                logger.warning("test_tx_disable: Skipping transceiver {} (not applicable for this transceiver type)".format(i))
                continue

            for state in [True, False]:
                ret = sfp.tx_disable(platform_api_conn, i, state)
                if self.expect(ret is True, "Failed to {} TX disable for transceiver {}".format("set" if state is True else "clear", i)):
                    tx_disable = sfp.get_tx_disable(platform_api_conn, i)
                    if self.expect(tx_disable is not None, "Unable to retrieve transceiver {} TX disable data".format(i)):
                        self.expect(isinstance(tx_disable, list) and (all(item == state) for item in tx_disable),
                                    "Transceiver {} TX disable data is incorrect".format(i))
        self.assert_expectations()