Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@PRIORITY_MEDIUM
@pytest.mark.rdt_supported("cdp_l2")
def test_pqos_l2cat_cdp_detection(self, iface):
(stdout, _, exitstatus) = self.run_pqos(iface, "-s -v")
assert exitstatus == 0
assert "INFO: L2 CAT details: CDP support=1" in stdout
@PRIORITY_MEDIUM
@pytest.mark.rdt_supported("cat_l2")
def test_pqos_l2cat_set_negative(self, iface):
(stdout, _, exitstatus) = self.run_pqos(iface, "-e l2:2=0xffffffff")
assert exitstatus == 1
assert "L2CA COS2 - FAILED" in stdout
assert "Allocation configuration error!" in stdout
@PRIORITY_MEDIUM
@pytest.mark.rdt_unsupported("cat_l3")
def test_pqos_l3cat_detection_negative(self, iface):
(stdout, _, exitstatus) = self.run_pqos(iface, "-s -v")
assert exitstatus == 0
assert "L3CA capability not detected" in stdout
@PRIORITY_MEDIUM
@pytest.mark.rdt_supported("cdp_l2")
def test_pqos_l2cat_set_data(self, iface):
self.run_pqos(iface, "-R l2cdp-on")
default_mask = (1 << Env().get('cat', 'l2', 'ways')) - 1
(stdout, _, exitstatus) = self.run_pqos(iface, "-e l2:3d=0xf")
assert exitstatus == 0
assert ("L2ID 1 L2CA COS3 => DATA 0xf,CODE {}").format(hex(default_mask)) in stdout
@PRIORITY_MEDIUM
@pytest.mark.rdt_supported("cat_l2")
def test_pqos_l2cat_association_core_negative(self, iface):
(stdout, _, exitstatus) = self.run_pqos(iface, "-a llc:1=1000")
assert exitstatus == 1
assert "Core number or class id is out of bounds!" in stdout
@PRIORITY_MEDIUM
@pytest.mark.rdt_supported("cdp_l2")
def test_pqos_l2cat_set_code(self, iface):
self.run_pqos(iface, "-R l2cdp-on")
default_mask = (1 << Env().get('cat', 'l2', 'ways')) - 1
(stdout, _, exitstatus) = self.run_pqos(iface, "-e l2:4c=0xf")
assert exitstatus == 0
assert ("L2ID 1 L2CA COS4 => DATA {},CODE 0xf").format(hex(default_mask)) in stdout
@PRIORITY_MEDIUM
@pytest.mark.iface_os
@pytest.mark.rdt_supported("cat_l2")
def test_pqos_l2cat_association_tasks_negative(self, iface):
(stdout, _, exitstatus) = self.run_pqos(iface, "-a pid:2=9999999999")
assert exitstatus == 1
assert "Task ID number or class id is out of bounds!" in stdout
@PRIORITY_MEDIUM
@pytest.mark.rdt_supported("cat_l2")
def test_pqos_l2cat_detection(self, iface):
(stdout, _, exitstatus) = self.run_pqos(iface, "-s -v")
assert exitstatus == 0
assert "L2CA capability detected" in stdout
@PRIORITY_MEDIUM
@pytest.mark.rdt_supported("cat_l2")
def test_pqos_l2cat_association_core(self, iface):
(stdout, _, exitstatus) = self.run_pqos(iface, "-a llc:1=1,3")
assert exitstatus == 0
assert "Allocation configuration altered." in stdout
(stdout, _, exitstatus) = self.run_pqos(iface, "-s")
assert exitstatus == 0
assert re.search("Core 1, L2ID [0-9]+ => COS1", stdout)
assert re.search("Core 3, L2ID [0-9]+ => COS1", stdout)
@PRIORITY_MEDIUM
@pytest.mark.rdt_supported("cat_l2")
def test_pqos_l2cat_set(self, iface):
(stdout, _, exitstatus) = self.run_pqos(iface, "-e l2:1=0xf;l2:2=0xf0")
assert exitstatus == 0
assert "L2ID 0 L2CA COS1 => MASK 0xf" in stdout
assert "L2ID 0 L2CA COS2 => MASK 0xf0" in stdout
assert "Allocation configuration altered" in stdout
(stdout, _, exitstatus) = self.run_pqos(iface, "-s")
assert exitstatus == 0
assert "L2CA COS1 => MASK 0xf" in stdout
assert "L2CA COS2 => MASK 0xf0" in stdout