From 5757394b4fc5a7a4cead5aee2052c1fcf013162e Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Mon, 14 Apr 2025 11:37:21 +0000 Subject: [PATCH] Change the QoS comparison method in the ``QosTestOvn`` class The methods to check the bandwidth limits and DSCP values in the QoS and LSP.options registers now check each parameter individually, as long as the keys stored in these dictionaries should not keep the same order always. This patch also fixes the rate values in ``_validate_bw_limit_nbdb_lsp``, that are stored in the LSP.options dictionary in bits per second. Change-Id: I6813ec05237bf58c626d72add88b05d9d711e172 --- .../tests/scenario/test_qos.py | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/whitebox_neutron_tempest_plugin/tests/scenario/test_qos.py b/whitebox_neutron_tempest_plugin/tests/scenario/test_qos.py index f1e7ca3..b954b69 100644 --- a/whitebox_neutron_tempest_plugin/tests/scenario/test_qos.py +++ b/whitebox_neutron_tempest_plugin/tests/scenario/test_qos.py @@ -1243,7 +1243,7 @@ class QosTestSriovMinBwPlacementEnforcementTest(QosTestSriovBaseTest): class QosTestOvn(base.BaseTempestTestCaseOvn, QosBaseTest): MAX_KBPS = 1000 - MAX_BURST_KBPS = 0.8 * MAX_KBPS + MAX_BURST_KBPS = int(0.8 * MAX_KBPS) DSCP_MARK_OPTION = QosBaseTest.dscp_mark_net def _create_qos_policy_bw_and_dscp(self): @@ -1267,40 +1267,42 @@ class QosTestOvn(base.BaseTempestTestCaseOvn, QosBaseTest): return policy_id def _validate_bw_limit_nbdb_qos(self, qos_settings): + bandwidth_settings = '' for line in qos_settings.splitlines(): if line.startswith('bandwidth'): bandwidth_settings = line break - self.assertTrue( - '{burst=%d, rate=%d}' % (self.MAX_BURST_KBPS, self.MAX_KBPS) - in bandwidth_settings, - 'Bandwidth options are not set as expected') + self.assertIn(f'rate={self.MAX_KBPS:.0f}', bandwidth_settings, + 'Bandwidth options are not set as expected') + self.assertIn(f'burst={self.MAX_BURST_KBPS:.0f}', bandwidth_settings, + 'Bandwidth options are not set as expected') LOG.debug('BW limit options found') def _validate_bw_limit_nbdb_lsp(self, lsp_settings): + bandwidth_settings = '' for line in lsp_settings.splitlines(): if line.startswith('options'): bandwidth_settings = line break - self.assertTrue( - 'qos_burst="%d", qos_max_rate="%d"' % ( - self.MAX_BURST_KBPS, self.MAX_KBPS) - in bandwidth_settings, - 'Bandwidth options are not set as expected') + self.assertIn(f'qos_max_rate="{self.MAX_KBPS * 1000:.0f}"', + bandwidth_settings, + 'Bandwidth options are not set as expected') + self.assertIn(f'qos_burst="{self.MAX_BURST_KBPS * 1000:.0f}"', + bandwidth_settings, + 'Bandwidth options are not set as expected') LOG.debug('BW limit options found') def _validate_dscp_nbdb_qos(self, qos_settings): + dscp_settings = '' for line in qos_settings.splitlines(): if line.startswith('action'): dscp_settings = line break - self.assertTrue( - '{dscp=%s}' % (self.DSCP_MARK_OPTION,) - in dscp_settings, - 'DSCP options are not set as expected') + self.assertIn(f'dscp={self.DSCP_MARK_OPTION}', dscp_settings, + 'DSCP options are not set as expected') LOG.debug('DSCP options found') def _validate_qos_rules_nbdb(