From patchwork Wed Sep 28 22:52:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, ZhiminX" X-Patchwork-Id: 117065 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7C4E8A00C4; Wed, 28 Sep 2022 16:41:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 78C914113C; Wed, 28 Sep 2022 16:41:07 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id EE9D9410FA for ; Wed, 28 Sep 2022 16:41:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664376066; x=1695912066; h=from:to:cc:subject:date:message-id; bh=9BddlYQTmT6MoWUqpxyay0PWziAErM/zJE7mXJ4sm94=; b=YO/fZVkooRp1Wqv+8CKVFhAUrXPnsjHSSs98fK5ypjKHiizhjvkZ4OsO 40W+rmFcK37QgG84/QFWY60mqgR1vIqWhPi/SGQMBVCtb5xk6sYCOpFl0 WnCx7si7GiN+dSbNkVXY+MJL3CclebiRuhF9qmxrQ/csUgv3MKMT/CSdC 0nk3rjliPmP+WZvOcVvPqxZXLW5+g4cYVqa4ykW/u4PwkaU9fEfCoMkEC q0EyNYBPhE6hPmXU+NeYrCBbhmvtvJGZp8FKn7ucnhz+htN8Top9wj4No jTXyadpy3bCXlgZibmUUOX9ofsBCQdKUVicmcoXcrkQQIwoVWBeiEyl8A Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10484"; a="387900548" X-IronPort-AV: E=Sophos;i="5.93,352,1654585200"; d="scan'208";a="387900548" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2022 07:41:04 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10484"; a="747452165" X-IronPort-AV: E=Sophos;i="5.93,352,1654585200"; d="scan'208";a="747452165" Received: from unknown (HELO localhost.localdomain) ([10.239.252.93]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2022 07:41:03 -0700 From: Zhimin Huang To: dts@dpdk.org Cc: Zhimin Huang Subject: [dts][PATCH V5 1/2] test_plans/telemetry:add cases to check laser power in dpdk Date: Thu, 29 Sep 2022 06:52:52 +0800 Message-Id: <20220928225253.20539-1-zhiminx.huang@intel.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org the customer need to get the laser power values in dpdk. so a new telemtry command '/ethdev/module_eeprom' to show module EEPROM for each port in dpdk22.07. we add new test cases to check laser power value. 1.check the laser power values same as that of 'ethtool -m'. 2.check different/same optical modules have different/same laser power values. Signed-off-by: Zhimin Huang Acked-by: Peng, Yuan --- v5: -add command '/ethdev/module_eeprom' output in testplan v4: -optimized code in testcase. v3: -detail subject and comments. test_plans/telemetry_test_plan.rst | 107 ++++++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 1 deletion(-) diff --git a/test_plans/telemetry_test_plan.rst b/test_plans/telemetry_test_plan.rst index 16568cd3..949280e0 100644 --- a/test_plans/telemetry_test_plan.rst +++ b/test_plans/telemetry_test_plan.rst @@ -200,4 +200,109 @@ Test case: Stats of 4 ports for testpmd and telemetry with different type nic a. Ensure # of ports stats being returned == # of ports b. Ensure packet counts (eg rx_good_packets) is 0 c. Ensure extended NIC stats are shown (depends on PMD used for testing, refer to ixgbe/i40e tests for PMD xstats) - d. Ensure extended NIC stats are 0 (eg: rx_q0_packets == 0) \ No newline at end of file + d. Ensure extended NIC stats are 0 (eg: rx_q0_packets == 0) + +Test case: read nic Laser Power via dpdk +======================================== + +1.Bind ports to dpdk:: + + ./usertools/dpdk-devbind.py --bind=vfio-pci 18:00.0 18.00.1 + +2.Launch the dpdk testpmd with teltmetry:: + + ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd --telemetry -- -i + +3.Launch the telemetry client:: + + python ./usertools/dpdk-telemetry.py + +4.Excute command in telemtry client:: + + --> /ethdev/module_eeprom, + + take a example:/ethdev/module_eeprom,0 + {"/ethdev/module_eeprom": {"Identifier": "0x03 (SFP)", "Extended identifier": "0x04 (GBIC/SFP defined by 2-wire + interface ID)", "Connector": "0x07 (LC)", "Transceiver codes": "0x10 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x00", + "Transceiver type": "10G Ethernet: 10G Base-SR; Ethernet: 1000BASE-SX", "Encoding": "0x06 (64B/66B)", "BR, + Nominal": "10300MBd", "Rate identifier": "0x00 (unspecified)", "Length (SMF,km)": "0km", "Length (SMF)": + "0m", "Length (50um)": "80m", "Length (62.5um)": "30m", "Length (Copper)": "0m", "Length (OM3)": "300m", + "Laser wavelength": "850nm", "Vendor name": "Intel Corp", "Vendor OUI": "00:1b:21", "Vendor PN": + "AFBR-703SDZ-IN2", "Vendor rev": "G2.3", "Option values": "0x00 0x3a", "Option": "RX_LOS implemented; + TX_FAULT implemented; TX_DISABLE implemented; RATE_SELECT implemented", "BR margin, max": "0%", "BR margin, + min": "0%", "Vendor SN": "AD1345A04JR", "Date code": "131108", "Optical diagnostics support": "Yes", "Laser + bias current": "5.942 mA", "Laser output power": "0.6703 mW / -1.74 dBm", "Receiver signal average optical + power": "0.8002 mW / -0.97 dBm", "Module temperature": "38.50 degrees C / 101.30 degrees F", "Module + voltage": "3.3960 V", "Alarm/warning flags implemented": "Yes", "Laser bias current high alarm": "Off", + "Laser bias current low alarm": "Off", "Laser bias current high warning": "Off", "Laser bias current low + warning": "Off", "Laser output power high alarm": "Off", "Laser output power low alarm": "Off", "Laser output + power high warning": "Off", "Laser output power low warning": "Off", "Module temperature high alarm": "Off", + "Module temperature low alarm": "Off", "Module temperature high warning": "Off", "Module temperature low + warning": "Off", "Module voltage high alarm": "Off", "Module voltage low alarm": "Off", "Module voltage + high warning": "Off", "Module voltage low warning": "Off", "Laser rx power high alarm": "Off", "Laser rx + power low alarm": "Off", "Laser rx power high warning": "On", "Laser rx power low warning": "Off", "Laser + bias current high alarm threshold": "10.500 mA", "Laser bias current low alarm threshold": "2.500 mA", + "Laser bias current high warning threshold": "10.500 mA", "Laser bias current low warning threshold": "2 + .500 mA", "Laser output power high alarm threshold": "2.0000 mW / 3.01 dBm", "Laser output power low alarm + threshold": "0.0600 mW / -12.22 dBm", "Laser output power high warning threshold": "0.7900 mW / -1.02 dBm", + "Laser output power low warning threshold": "0.0850 mW / -10.71 dBm", "Module temperature high alarm + threshold": "85.00 degrees C / 185.00 degrees F", "Module temperature low alarm threshold": "-5.00 degrees + C / 23.00 degrees F", "Module temperature high warning threshold": "80.00 degrees C / 176.00 degrees F", + "Module temperature low warning threshold": "0.00 degrees C / 32.00 degrees F", "Module voltage high + alarm threshold": "3.6000 V", "Module voltage low alarm threshold": "3.1300 V", "Module voltage high + warning threshold": "3.4600 V", "Laser rx power high alarm threshold": "2.0000 mW / 3.01 dBm", "Laser rx + power low alarm threshold": "0.0000 mW / -inf dBm", "Laser rx power high warning threshold": "0.7900 mW / + -1.02 dBm", "Laser rx power low warning threshold": "0.0200 mW / -16.99 dBm"}} + +5.check the testpmd and telemetry show info same as 'ethtool -m':: + + ethtool -m ens25f1 | grep 'Laser output power' + Laser output power : 0.6703 mW / -1.74 dBm + +.. note:: + + refer to command 'ethtool -m' of ethtool v5.4 + +Test case: check Laser Power in different optical modules +========================================================= + +1.set port 0 and port 1 with diffent optical modules + +2.Launch the dpdk testpmd with teltmetry:: + + ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd --telemetry -- -i + +3.Launch the telemetry client:: + + python ./usertools/dpdk-telemetry.py + +4.Excute command in telemtry client:: + + --> /ethdev/module_eeprom,0 + --> /ethdev/module_eeprom,1 + +5.check port 0 and port 1 have different Laser Power + +Test case: check Laser Power in same optical modules +==================================================== + +1.set port 0 and port 1 with same optical modules + +2.Launch the dpdk testpmd with teltmetry:: + + ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd --telemetry -- -i + +3.Launch the telemetry client:: + + python ./usertools/dpdk-telemetry.py + +4.Excute command in telemtry client:: + + --> /ethdev/module_eeprom,0 + --> /ethdev/module_eeprom,1 + +5.check port 0 and port 1 have same Laser Power + +.. note:: + + the laser power will change slightly with the voltage and temperature From patchwork Wed Sep 28 22:52:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, ZhiminX" X-Patchwork-Id: 117066 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A14BDA00C4; Wed, 28 Sep 2022 16:41:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D8AF42686; Wed, 28 Sep 2022 16:41:10 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id B40B8410FA for ; Wed, 28 Sep 2022 16:41:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664376066; x=1695912066; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=viZCQfa1KdVlhvxBmPAeZgIyLeDd9H9aWpprDcJA+00=; b=ZH3/Ns4z5Dtfy+9Exx1GCa73Tltiogo8E6RkfeaT1lepUJ/Y+Aru7DrG hhXlRhTxRDpyCfnRppuRuaP3cM11YjhSvOCZwrVdjhxOnN4LNOotLJZV5 4p2tojKHXTU2RT0JjwDnPH/+8CyneBqcNI02/PdVyL/o9ZgJmcpABu9YR 3QFqbCo2ga/7K9rRzFQ/9sK58p0lTwnIKBFxyWA3ZJYeo5mMspMbFBAKl Axc3XoWauuQR6JA6f708DqSKgiPocx3elJnCJobrD+W1/OnFByEYag1fw dc8ul83XLBeQXttttr8KqNIHqwq2k8d1G56F5rHVBHEgCULDmG/NkMTud A==; X-IronPort-AV: E=McAfee;i="6500,9779,10484"; a="387900553" X-IronPort-AV: E=Sophos;i="5.93,352,1654585200"; d="scan'208";a="387900553" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2022 07:41:06 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10484"; a="747452169" X-IronPort-AV: E=Sophos;i="5.93,352,1654585200"; d="scan'208";a="747452169" Received: from unknown (HELO localhost.localdomain) ([10.239.252.93]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2022 07:41:04 -0700 From: Zhimin Huang To: dts@dpdk.org Cc: Zhimin Huang Subject: [dts][PATCH V5 2/2] tests/telemetry:add cases to check laser power in dpdk Date: Thu, 29 Sep 2022 06:52:53 +0800 Message-Id: <20220928225253.20539-2-zhiminx.huang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220928225253.20539-1-zhiminx.huang@intel.com> References: <20220928225253.20539-1-zhiminx.huang@intel.com> X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org the customer need to get the laser power values in dpdk. so a new telemtry command '/ethdev/module_eeprom' to show module EEPROM for each port in dpdk22.07. we add new test cases to check laser power value. 1.check the laser power values same as that of 'ethtool -m'. 2.check different/same optical modules have different/same laser power values. Signed-off-by: Zhimin Huang Acked-by: Peng, Yuan Tested-by: Jiale Song < songx.jiale@intel.com> Acked-by: Lijuan Tu --- v5: -add command '/ethdev/module_eeprom' output in testplan v4: -fix hard code, use defined variable instead. -restore the interface status,avoid affecting other suite. v3: -add more comments in testplan tests/TestSuite_telemetry.py | 185 ++++++++++++++++++++++++++++++++++- 1 file changed, 183 insertions(+), 2 deletions(-) diff --git a/tests/TestSuite_telemetry.py b/tests/TestSuite_telemetry.py index 97c1c748..736ae7ed 100644 --- a/tests/TestSuite_telemetry.py +++ b/tests/TestSuite_telemetry.py @@ -539,6 +539,126 @@ class TestTelemetry(TestCase): self.close_telemetry_server() raise Exception(e) + def start_telemetry_server_and_get_module_eeprom(self, port_id): + try: + self.change_flag = True + self.dut.bind_interfaces_linux(self.drivername) + out = self.start_telemetry_server() + self.tester.is_interface_up(self.tester_iface0) + p = re.search("socket /var/run/dpdk/(.+?)/", out) + self.start_dpdk_telemetry(p.group(1)) + module_eeprom_output = self.dut_telemetry.send_expect( + "/ethdev/module_eeprom,{}".format(port_id), "--> " + ) + self.close_telemetry_server() + return module_eeprom_output + except Exception as e: + self.close_telemetry_server() + raise Exception(e) + + def start_dpdk_telemetry(self, *args): + self.dut_telemetry = self.dut.new_session() + dpdk_tool = os.path.join(self.target_dir, "usertools/dpdk-telemetry.py") + self.dut_telemetry.send_expect( + "python3 " + dpdk_tool + " -f {}".format(args[0]), "--> ", 5 + ) + + def verify_nic_laser_power_via_dpdk(self, laser_powers, *ports): + for laser_power, port in zip(laser_powers, ports): + laser_power_via_dpdk = self.get_nic_laser_power_via_dpdk(port) + dpdk_float_values = self.get_float_laser_power_values(laser_power_via_dpdk) + eth_float_values = self.get_float_laser_power_values(laser_power) + test_flag = [ + abs(v_d - v_e) for v_d, v_e in zip(dpdk_float_values, eth_float_values) + ] + self.logger.info( + "dpdk:{} eth:{}".format(dpdk_float_values, eth_float_values) + ) + self.verify( + [flag <= 0.1 for flag in test_flag], + "dpdk:{} eth:{},get the incorrect laser power values".format( + dpdk_float_values, eth_float_values + ), + ) + + def verify_laser_Power_in_different_optical_modules(self, laser_powers, *ports): + laser_power_via_dpdk = self.get_nic_laser_power_via_dpdk(ports[-1]) + dpdk_float_values = self.get_float_laser_power_values(laser_power_via_dpdk) + eth_float_values = self.get_float_laser_power_values(laser_powers[0]) + self.logger.info( + "dpdk port 1: {} eth port 0: {}".format( + dpdk_float_values, eth_float_values + ) + ) + test_flag = [ + abs(v_d - v_e) for v_d, v_e in zip(dpdk_float_values, eth_float_values) + ] + self.verify( + [flag > 0.1 for flag in test_flag], + "different optical modules should have different laser power values", + ) + + def verify_laser_Power_in_same_optical_modules(self, laser_powers, *ports): + laser_power_via_dpdk = self.get_nic_laser_power_via_dpdk(ports[-1]) + dpdk_float_values = self.get_float_laser_power_values(laser_power_via_dpdk) + eth_float_values = self.get_float_laser_power_values(laser_powers[0]) + self.logger.info( + "dpdk port 1: {} eth port 0: {}".format( + dpdk_float_values, eth_float_values + ) + ) + test_flag = [ + abs(v_d - v_e) for v_d, v_e in zip(dpdk_float_values, eth_float_values) + ] + self.verify( + [flag <= 0.1 for flag in test_flag], + "same optical modules should have same laser power values", + ) + + def get_float_laser_power_values(self, output): + p = re.findall(r"(\d+\.\d+.)", output) + float_list = list(map(float, p)) + return float_list + + def get_nic_laser_power_via_ethtool(self, intf): + output = self.d_a_console( + "ethtool -m {} | grep 'Laser output power'".format(intf) + ) + rex_output = re.search(r"Laser output power\s+:.*", output) + if not rex_output: + return False + return rex_output.group() + + def get_nic_laser_power_via_dpdk(self, port): + out = self.start_telemetry_server_and_get_module_eeprom(port) + laser_power_via_dpdk = self.get_nic_laser_power_via_dpdk_rex(out) + return laser_power_via_dpdk + + def get_nic_laser_power_via_dpdk_rex(self, output): + rex_output = re.search(r'"Laser output power":.*?dBm"', output) + if not rex_output: + return False + return rex_output.group() + + def check_interface_link_up(self, intf): + try: + self.d_a_console("ifconfig {} up".format(intf)) + link = self.dut.is_interface_up(intf) + self.verify(link, "link is down") + except Exception as e: + self.d_a_console("ifconfig {} up".format(intf)) + finally: + time.sleep(3) + + def skip_unsupported_get_laser_power(self, *intfs): + laser_power_list = [] + for intf in intfs: + output = self.get_nic_laser_power_via_ethtool(intf) + if not output: + return False + laser_power_list.append(output) + return laser_power_list + # # Test cases. # @@ -550,6 +670,11 @@ class TestTelemetry(TestCase): # get ports information self.dut_ports = self.dut.get_ports() self.verify(len(self.dut_ports) >= 2, "Insufficient ports") + self.pf0_intf = self.dut.ports_info[self.dut_ports[0]]["intf"] + self.pf1_intf = self.dut.ports_info[self.dut_ports[1]]["intf"] + self.tester_iface0 = self.tester.get_interface( + self.tester.get_local_port(self.dut_ports[0]) + ) self.init_test_binary_files() self.nic_grp = self.get_ports_by_nic_type() self.used_ports = [] @@ -559,7 +684,7 @@ class TestTelemetry(TestCase): """ Run before each test case. """ - pass + self.dut.bind_interfaces_linux(self.drivername) def tear_down(self): """ @@ -571,7 +696,7 @@ class TestTelemetry(TestCase): """ Run after each test suite. """ - pass + self.dut.bind_interfaces_linux(self.drivername) def test_basic_connection(self): """ @@ -585,3 +710,59 @@ class TestTelemetry(TestCase): Stats of 2 ports for testpmd and telemetry with same type nic """ self.verify_same_nic_with_2ports() + + def test_read_nic_laser_power_via_dpdk(self): + """ + read laser power, check testpmd show correct laser power + """ + self.dut.bind_interfaces_linux(self.kdriver) + self.check_interface_link_up(self.pf0_intf) + laser_power_list = self.skip_unsupported_get_laser_power(self.pf0_intf) + self.skip_case(laser_power_list, "The test need Optical module to support") + self.verify_nic_laser_power_via_dpdk(laser_power_list, self.dut_ports[0]) + + def test_check_laser_power_in_different_optical_modules(self): + """ + set different optical modules in two ports and check the testpmd show different laser power + """ + self.dut.bind_interfaces_linux(self.kdriver) + [self.check_interface_link_up(i) for i in [self.pf0_intf, self.pf1_intf]] + laser_power_list = self.skip_unsupported_get_laser_power( + self.pf0_intf, self.pf1_intf + ) + self.skip_case(laser_power_list, "The test need Optical module to support") + float_list = [ + self.get_float_laser_power_values(laser_power) + for laser_power in laser_power_list + ] + self.skip_case( + abs(float_list[0][0] - float_list[1][0]) > 0.1 + and abs(float_list[0][1] - float_list[1][1]) > 0.1, + "The test need different optical module in two ports", + ) + self.verify_laser_Power_in_different_optical_modules( + laser_power_list, self.dut_ports[0], self.dut_ports[1] + ) + + def test_check_laser_power_in_same_optical_modules(self): + """ + set same optical modules in two ports and check the testpmd show same laser power + """ + self.dut.bind_interfaces_linux(self.kdriver) + [self.check_interface_link_up(i) for i in [self.pf0_intf, self.pf1_intf]] + laser_power_list = self.skip_unsupported_get_laser_power( + self.pf0_intf, self.pf1_intf + ) + self.skip_case(laser_power_list, "The test need Optical module to support") + float_list = [ + self.get_float_laser_power_values(laser_power) + for laser_power in laser_power_list + ] + self.skip_case( + abs(float_list[0][0] - float_list[1][0]) <= 0.1 + and abs(float_list[0][1] - float_list[1][1]) <= 0.1, + "The test need same optical module in two ports", + ) + self.verify_laser_Power_in_same_optical_modules( + laser_power_list, self.dut_ports[0], self.dut_ports[1] + )