Network card testing method, device, equipment and storage medium
By obtaining and parsing network card configuration files, running a unified test script to test different models of network cards, solving the problem of poor universality of test scripts in the existing technology, and achieving efficient unified testing of different models of network cards.
Patent Information
- Application Number
- CN202411161622.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-08-22
AI Technical Summary
In the prior art, different test scripts are required to be set up for testing different models of network cards, which leads to poor universality of test scripts and it is difficult to achieve unified testing of different models of network cards.
By obtaining the configuration file of the network card, parse out the test items and configuration information that need to be executed, and run pre-set test scripts to conduct various tests on the network card to determine the test results. This method allows the loading of configuration files of different network cards of different models through a unified test script to realize the testing of different network cards.
It improves the universality of network card test scripts, so that different models of network card can be tested through unified scripts, simplifying the testing process and improving testing efficiency.
Smart Images

Figure CN118694681B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a network card testing method, device, equipment and storage medium. Background Art
[0002] Different types of network cards have different hardware and motherboards, and the corresponding test items and configuration information corresponding to the test items are also different. At present, when testing different types of network cards, it is necessary to first write the test items and configuration information of different types of network cards to different disk areas of the test equipment, and in the same test equipment, different disk areas need to set different read instructions to read the test information. Therefore, it is necessary to set corresponding test scripts for different types of network cards to realize the reading and testing of the corresponding test information, that is, different types of network cards need to set different test scripts for testing, and the universality of the test scripts is poor. Therefore, how to improve the universality of network card test scripts is a technical problem that technical personnel need to solve urgently. Summary of the invention
[0003] In view of this, the present disclosure proposes a network card testing method, apparatus, device and storage medium, which can improve the versatility of test scripts.
[0004] According to a first aspect of the present disclosure, a network card testing method is provided, comprising:
[0005] Obtain a configuration file of the network card to be tested, and parse the configuration file to obtain the test items to be executed by the network card to be tested and the configuration information for each test configuration;
[0006] A pre-set test script is run to perform various tests on the network card to be tested, to obtain test parameter information of each test, and based on the test parameter information and configuration information of each test item, a test result of each test item is determined.
[0007] In one possible implementation, the test items that need to be executed on the network card to be tested include: electronic label verification, network card firmware version verification, network card MCU version verification, PCI rate verification, PCI device number verification, chip model verification, PHY chip model verification, bridge chip model verification, bypass function test, loopback test, link rate test, network port status test and at least one of LED light state change test.
[0008] In a possible implementation, when a preset test script is run to perform the electronic label verification on the network card to be tested, the following steps are included:
[0009] Reading the electronic label of the network card to be tested from the preset storage address of the network card to be tested;
[0010] Parsing the character string constituting the electronic label to obtain the network card parameter information recorded in the electronic label, wherein the network card parameter information includes at least one of the number of optical ports, the number of electrical ports, the link rate, the number of bypasses, the chip model, and the manufacturer name;
[0011] Based on the network card parameter information and corresponding configuration information, determine whether the electronic label is correct.
[0012] In a possible implementation, the network card to be tested includes a first electronic label used by the manufacturer and a second electronic label used by the demander, wherein the first electronic label is stored in a preset first storage address, and the second electronic label is stored in a preset second storage address.
[0013] In a possible implementation, when a preset test script is run to perform the loopback test on the network card to be tested, the method includes:
[0014] Identify each network port of the network card to be tested;
[0015] For each of the network ports, a corresponding loopback connection network port is selected from other network ports of the network card to be tested, and a loopback connection is established between each of the network ports and the corresponding loopback connection network port;
[0016] Based on the loopback connection between each of the network ports and the corresponding loopback connection network port, a loopback test is performed.
[0017] In a possible implementation, when establishing a loopback connection between each network port and a corresponding loopback connection network port, the process includes:
[0018] Based on each of the network ports and the corresponding loopback connection network ports, create a loopback test wiring diagram;
[0019] The loopback test wiring diagram is pushed and displayed on a test interface to prompt a tester to establish a loopback connection between each network port and a corresponding loopback connection network port according to the loopback test wiring diagram.
[0020] In a possible implementation, based on the loopback connection between each of the network ports and the corresponding loopback connection network port, performing a loopback test includes:
[0021] Creating a corresponding data packet sending program for each network port;
[0022] Each of the network ports sends a data packet to the loopback connection network port connected thereto in a loopback manner according to a preset frequency and packet length through a corresponding data packet sending program;
[0023] The data packet statistics tool is called to count the data packet sending and receiving data of each network port to obtain the loopback test results of each network port.
[0024] According to a second aspect of the present disclosure, a network card testing device is provided, comprising:
[0025] A configuration file parsing module is used to obtain a configuration file of the network card to be tested, and parse the configuration file to obtain various test items that need to be executed by the network card to be tested and configuration information for each test configuration;
[0026] The test module is used to run a preset test script to perform various tests on the network card to be tested, obtain test parameter information of each test, and determine the test result of each test item based on the test parameter information and configuration information of each test item.
[0027] According to a third aspect of the present disclosure, a network card testing device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the method described in the first aspect of the present disclosure.
[0028] According to a fourth aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, wherein the computer program instructions, when executed by a processor, implement the method described in the first aspect of the present disclosure.
[0029] The present disclosure provides a network card testing method, device, equipment and storage medium, the method comprising: obtaining a configuration file of a network card to be tested, and parsing the configuration file to obtain the various test items that the network card to be tested needs to execute and the configuration information for each test configuration; running a pre-set test script to perform various tests on the network card to be tested, obtaining the test parameter information of each test, and comparing the test parameter information of each test item with the corresponding configuration information to obtain the test result of each test item. In the present disclosure, the test items of network cards of different models and the configuration information of each test item can be configured through a configuration file, so that the configuration files of network cards of different models can be loaded through a unified test script to implement the testing of network cards of different models, thereby improving the versatility of the test script.
[0030] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.
[0032] Figure 1A flowchart of a network card testing method according to an embodiment of the present disclosure is shown.
[0033] Figure 2 A schematic block diagram of a network card testing device according to an embodiment of the present disclosure is shown.
[0034] Figure 3 A schematic block diagram of a network card testing device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0035] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0036] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0037] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0038] <Method Example>
[0039] Figure 1 FIG. 1 is a flow chart showing a method for testing a network card according to an embodiment of the present disclosure. Figure 1 As shown, the method includes steps S1100-S1200.
[0040] S1100, obtain the configuration file of the network card to be tested, and parse the configuration file to obtain the test items that need to be executed by the network card to be tested and the configuration information for each test configuration. Among them, the network card to be tested is the network card to be tested currently. The number of the network cards to be tested can be one or more, which is not specifically limited here. When the amount of data of the network cards to be tested is multiple, it is necessary to ensure that the multiple network cards to be tested that participate in the test at the same time have the same model, and insert the multiple network cards to be tested with the same model into the multiple card slots of the same test motherboard respectively, so that the batch test of the network cards of the same model can be realized based on the same configuration file, thereby improving the test efficiency of the network cards.
[0041] Since the testing method of one network card to be tested is the same as the testing method of multiple network cards to be tested, the present disclosure takes one network card to be tested as an example to describe the network card testing method in detail.
[0042] Before testing the network card to be tested, it is necessary to first determine the test items of the network card to be tested, and configure the corresponding configuration information for each test item. Then, the configuration file of the network card to be tested is constructed based on the determined test items of the network card to be tested and the corresponding configuration information. Among them, the test items that need to be executed by the network card to be tested include: electronic label verification, network card firmware version verification, network card MCU version verification, PCI rate verification, PCI device number verification, chip model verification, phy chip model verification, bridge chip model verification, bypass function test, loopback test, link rate test, network port status test and LED light state change test.
[0043] It should be noted here that the configuration file sets corresponding configuration instructions and configuration item names for each test item. The configuration instructions can guide testers to accurately determine the configuration information corresponding to the current test item, and fill in the determined configuration information into the corresponding configuration item name, thereby completing the configuration of each test item configuration information.
[0044] For the chip model verification test, the chip model configuration description and the first configuration item name are set in the configuration file. The chip model configuration description includes all chip models that the network card may use. When configuring the configuration information for the chip model verification test, the tester can select a chip model that is consistent with the chip model of the network card to be tested from the multiple chip models specified in the chip model configuration description and fill it in after the first configuration item name as the configuration information for the chip model verification test. For example, when the chip models that may be used by the network card include Netcom and Intel, the first configuration item name is Extended Network Card Category, and the actual chip model of the network card to be tested is Intel, the text content of the chip model verification test in the configuration file can be as follows:
[0045] #Network card classification, network communication / Inte1 / etc.
[0046] Expansion network card type: Intel.
[0047] For the phy chip model verification test, the configuration file sets the phy chip model configuration description and the second configuration item name. The phy chip model configuration description includes all phy chip models that the network card may use. When configuring the configuration information for the phy chip model verification test, the tester can select a phy chip model that is consistent with the phy chip model of the network card to be tested from the multiple phy chip models specified in the phy chip model configuration description and fill it in after the second configuration item name as the configuration information for the phy chip model verification test. For example, the phy chip model that the network card may use can be identified by the manufacturer name. For example, the manufacturers of phy chips include A (such as Marvell) and B (such as Yutai), then the phy chip models that the network card may use include A and B, and the second configuration item name is Extended Network Card Phy Chip Type. If the actual phy chip model of the network card to be tested is B, the text content of the phy chip model verification test in the configuration file can be as follows:
[0048] #phy chip type. Currently, only the four-electric and four-optical network cards and eight-optical network cards in the short card have been replaced with phy chips. The phy chip types are divided into two types: A and B
[0049] Expansion network card phy chip type: B.
[0050] For the bridge chip model verification test, the configuration file sets the bridge chip model configuration description and the third configuration item name. The bridge chip model configuration description includes all bridge chip models that may be used by the network card. When configuring the configuration information for the bridge chip model verification test, the tester can select a bridge chip model that is consistent with the bridge chip model of the network card to be tested from the multiple bridge chip models specified in the bridge chip model configuration description and fill it in after the third configuration item name as the configuration information for the bridge chip model verification test. For example, when the possible bridge chip models of the network card include 8619 and 8618, the third configuration item name is the extended network card bridge chip type, and the actual bridge chip model of the network card to be tested is 8619, the text content of the bridge chip model verification test in the configuration file can be as follows:
[0051] #Bridge chip type. Currently, only the four-electric and four-optical network cards, eight-optical network cards, and eight-grid network cards in short-distance cards have bridge chip 8619. The bridge chip of other network cards should be 8618.
[0052] Expansion network card bridge chip type: 8619.
[0053] For the electronic label verification test, the configuration file sets the electronic label configuration description and the fourth configuration item name. The electronic label configuration description includes the storage location of the electronic label. The fourth configuration item name is determined based on the name of the manufacturer to which the electronic label belongs. When configuring the configuration information of the electronic label verification test, the tester can directly fill in the electronic label set by the manufacturer for the network card to be tested after the fourth configuration item name.
[0054] In a possible implementation, the network card to be tested may include a first electronic tag used by the manufacturer and a second electronic tag used by the demander, wherein the first electronic tag is stored in a preset first storage address, and the second electronic tag is stored in a preset second storage address, so that when the network card electronic tag is verified, the first electronic tag and the second electronic tag to be verified can be read out respectively through different storage addresses. The first storage location and the second storage location are different storage locations in the eeprom.
[0055] In this embodiment, the electronic label verification test is divided into a first electronic label verification test and a second electronic label verification test. For the first electronic label verification test, the first electronic label configuration description and the fifth configuration item name are set in the configuration file. The first electronic label configuration description includes the storage location of the first electronic label, and the fifth configuration item name is determined based on the manufacturer's name. When configuring the configuration information of the first electronic label verification test, the tester can directly fill in the electronic label set by the manufacturer for the network card to be tested after the name of the fifth configuration item as the configuration information of the first electronic label verification test. For example, when the network card uses the 0x02 address of eeprom to store the manufacturer's basic electronic label, the manufacturer is Jizhida, and the electronic label of the network card to be tested recorded by Jizhida is 20821, the text content of the configuration file for the first electronic label verification test can be as follows:
[0056] #Basic electronic label, storage address 0x02 in eeprom, must be present, "direct overwrite" means directly overwriting the original content; "prompt overwrite" means asking a question first, confirming and then overwriting (assuming there is already content)
[0057] Expansion network card Jizhida electronic label: 20821.
[0058] For the second electronic tag verification test, the second electronic tag configuration description and the name of the sixth configuration item are set in the configuration file. The second electronic tag configuration description includes the storage location of the second electronic tag, and the name of the sixth configuration item is determined based on the name of the demander. When configuring the configuration information for the second electronic tag verification test, the tester can directly fill in the electronic tag set by the demander for the network card to be tested after the name of the sixth configuration item as the configuration information for the second electronic tag verification test. For example, when the network card uses the 0x80 address of eeprom to store the electronic tag of the demander, and the demander (ie, the user) is Green Alliance, and the electronic tag of the network card to be tested recorded by Green Alliance is M, the text content of the second electronic tag verification test in the configuration file can be as follows:
[0059] #User electronic label, storage address 0x80 in eeprom, must be present, leave blank to indicate no write
[0060] Expanded network card NRSM electronic label: M.
[0061] For the network card firmware version verification test, the network card firmware version configuration description and the name of the seventh configuration item are set in the configuration file. Since there are inconsistencies in the firmware versions of the optical port card and the electrical port card in the network card, the network card firmware version configuration description states that when the network card is a four-electric and four-optical network card, two firmware versions need to be filled in at the same time. For other types of network cards, only one firmware version is filled in, and the other is left blank. The name of the seventh configuration item includes two versions: the extended network card electrical port firmware version and the extended network card optical port firmware version. When configuring the configuration information of the network card firmware version verification test, the tester can directly fill in the firmware version corresponding to the network card electrical port to be tested after the configuration item name of the extended network card electrical port firmware version, and fill in the firmware version corresponding to the network card optical port to be tested after the configuration item name of the extended network card optical port firmware version. For example, when the network card to be tested is a four-optical and four-electric network card, and the firmware version corresponding to the electrical port is 0x8000090e, and the firmware version corresponding to the optical port is 0x80000a00, the text content of the test for the network card firmware version verification in the configuration file can be as follows:
[0062] #Firmware version: For the four-electric and four-optical network cards, please fill in two firmware versions at the same time. For other network cards, only one firmware version should be filled in and the other should be left blank.
[0063] Expanded network card electrical port firmware version: 0x8000090e
[0064] The firmware version of the expansion network card optical port is 0x80000a00.
[0065] For the PCI rate verification test, the PCI rate configuration description and the eighth configuration item name are set in the configuration file. The PCI rate configuration description indicates that the PCI rate test is for the network port of the network card, not the onboard network port. The eighth configuration item name is the extended network card PCI rate. When configuring the configuration information of the PCI rate verification test, the tester can directly fill in the actual PCI rate of the network card to be tested after the eighth configuration item name as the configuration information of the PCI rate verification test. For example, when the actual PCI rate of the network card to be tested is 5, the text content of the PCI rate verification test in the configuration file can be as follows:
[0066] #Network card PCI rate, excluding onboard network port
[0067] Extended network card PCI rate: 5.
[0068] For the PCI device number verification test, the PCI device number configuration instructions and the ninth configuration item name are set in the configuration file. The PCI device number configuration instructions include the master and slave device numbers corresponding to various types of network cards. The ninth configuration item name is the extended network card master device number, extended network card optical port master device number, extended network card electrical port slave device number, and extended network card optical port slave device number. When configuring the PCI device number, the tester can refer to the PCI device number configuration instructions and fill in the actual PCI device number of the network card to be tested after the corresponding ninth configuration item name. For example, when the network card to be tested is a gigabit Intel network card, its electrical port master device number is 8086:1521, and its optical port master device number is 8086:1522, and both the electrical port slave device number and the optical port slave device number are none, the text content of the PCI device number verification test in the configuration file can be as follows:
[0069] #Network card device number
[0070] #Netxun Mawellphy Gigabit network card master device number is (8088:0103) slave device number is divided into electrical port device number (8088:0401) optical port device number (8088:0403)
[0071] #Netxon Mawell phy 10G network card master device number is (8088:1001) slave device number optical port device number (8088:0000)
[0072] #Netxun Yutaiphy Gigabit network card master device number is (8088:0103) and slave device number is divided into electrical port device number (8088:0401) and optical port device number (8088:0460)
[0073] #intel Gigabit Ethernet card electrical port main device number is (8086:1521) Gigabit Ethernet card optical port main device number is (8086:1522) (The above content is the PCI device number configuration description, the following content is the ninth configuration item name and corresponding configuration information)
[0074] Extended network card main device number: 8086:1521
[0075] The main device number of the extended network card optical port: 8086:1522
[0076] Extended network card electrical port slave device number: None
[0077] Extended network card optical port slave device number: None
[0078] Since the NIC bypass function is controlled by mounting an MCU chip, there are slight differences in the functions of different versions of MCU, so it is necessary to verify the NIC MCU version. For the NIC MCU version verification test, the NIC MCU version configuration description and the name of the tenth configuration item are set in the configuration file. The NIC MCU version configuration description includes instructions for filling in the NIC MCU version numbers of different demanders. The name of the tenth configuration item is Extended NIC MCU version. When configuring the configuration information for the NIC MCU version number verification test, the tester can refer to the NIC MCU version configuration description to fill in the actual NIC MCU version number of the NIC to be tested after the NIC MCU version number configuration item name. For example, when the NIC MCU version number of the NIC to be tested is 1.5.1, the text content of the NIC MCU version number verification test in the configuration file can be as follows:
[0079] # Expand the NIC MCU version number. Before filling in the number, confirm the NIC shipping customer, i.e. the NIC demander. For example, if Green Alliance does not have a minor version number, then just fill in '1.5'. If customers such as AsiaInfo have minor version numbers, then fill in the complete version number.
[0080] Extended network card MCU version: 1.5.1
[0081] For the bypass function test, the bypass function test configuration instructions and the eleventh configuration item name are set in the configuration file. The bypass function test configuration instructions include the content that needs to be configured for this test. The eleventh configuration item name includes the number of extended network card electrical ports, the number of extended network card optical ports, and the number of extended network card bypasses. When configuring the configuration information for the bypass function test, the tester can refer to the bypass function test configuration instructions and fill in the actual number of optical ports, electrical ports, and bypass number of the network card after the eleventh configuration item name. For example, when the number of optical ports of the network card to be tested is 4, the number of electrical ports is 4, and the number of bypasses is 2, the text content for the bypass function test in the configuration file can be as follows:
[0082] #Expand the number of electrical ports, optical ports, and bypass ports on the network card
[0083] Expansion network card electrical port: 4
[0084] Expansion network card optical port: 4
[0085] Expanded network card bypass: 2
[0086] For the link rate test, the configuration file sets the link rate test configuration description and the name of the twelfth configuration item. The link rate test configuration description includes the test content of the test, and the name of the twelfth configuration item is the extended network card link rate. When configuring the configuration information of the link rate test, the tester can refer to the link rate test configuration description and fill in the actual link rate of the network card to be tested after the name of the twelfth configuration item. For example, when the actual link rate of the network card to be tested is 1000Mb / s, the text content for the link rate test in the configuration file can be as follows:
[0087] #Expand the network card connection rate, expand the network card in the link state of Gigabit or 10 Gigabit rate
[0088] Expansion network card link rate: 1000Mb / s
[0089] For loopback test, network port status test and LED light status change test, the configuration file also sets the configuration instructions and corresponding configuration item names. Testers can refer to the configuration instructions of the current test item to determine the actual configuration information of the network card to be tested for the current test item, and fill it in after the configuration item name corresponding to the current test item, thereby completing the configuration of its configuration information. The specific configuration method can be found in the various tests above, and will not be elaborated here.
[0090] After completing the configuration of the configuration information of each test item in the configuration file, a configuration file including each test item and the configuration information corresponding to each test item can be obtained.
[0091] When testing the network card to be tested, first load the configuration file for the network card to be tested, and parse the loaded configuration file to obtain the test items to be executed by the network card to be tested and the configuration information for each test configuration.
[0092] After parsing the test items that need to be executed on the network card to be tested and the configuration information for each test configuration, step S1200 can be executed to run the pre-set test script to perform various tests on the network card to be tested, obtain the test parameter information of each test, and determine the test results of each test item based on the test parameter information and configuration information of each test item.
[0093] It should be noted here that only a unique test script is set for different types of network cards in the public, and the test script can adjust the test items and the test result judgment based on the configuration file. Specifically, the test script includes test programs for all test items that the network card may perform. After parsing the configuration file to obtain the various test items (i.e., target test items) that the network card to be tested needs to execute, the test programs corresponding to the target test items are extracted from all test programs, and the test programs corresponding to the target test items are combined in sequence to obtain a test script adapted to the network card to be tested.
[0094] Furthermore, after obtaining the test script adapted to the network card to be tested, the test script is run to obtain the test parameter information of each test that needs to be performed on the network card to be tested. For each test, after obtaining the test parameter information corresponding to the current test item, the configuration information configured for the current test item will be read from the configuration file, and the test parameter information of the current test item will be compared with the corresponding configuration information: if the results are consistent, the test result of the current test item is determined to be passed, and the test evaluation of the next test item is performed; if the current test result is inconsistent, the test is exited and an alarm is prompted. After completing all the tests that need to be performed on the network card to be tested, the test results of each test that has been executed will be summarized, and the summarized results will be pushed for display.
[0095] In a possible implementation, when running a preset test script to perform electronic label verification on a network card to be tested, the following steps may be included:
[0096] First, the electronic tag of the network card to be tested is read from the preset storage address of the network card to be tested. Specifically, the storage address of the electronic tag is recorded in the configuration file of the network card to be tested, so when executing this test, the electronic tag of the network card to be tested can be read according to the storage address of the electronic tag recorded in the configuration file.
[0097] It should be noted here that when a test motherboard is plugged with multiple network cards of the same model to be tested, different network cards to be tested are connected to the test motherboard through different i2c buses. In this way, the electronic tags of different network cards to be tested can be read and written through different i2c buses.
[0098] Second, the character string constituting the electronic tag is parsed to obtain the network card parameter information recorded in the electronic tag, wherein the network card parameter information includes at least one of the number of optical ports, the number of electrical ports, the link rate, the number of bypasses, the chip model, and the manufacturer name.
[0099] Third, based on the network card parameter information and the corresponding configuration information, determine whether the electronic label is correct. Specifically, after obtaining the parameter information of each network card, traverse the parameter information of each network card in order, and for the current network card parameter information traversed, read the configuration information corresponding to the current network card parameter information from the configuration file. When the parameter information of the current network card is consistent with the corresponding configuration information, it is determined that the characters corresponding to the current network card parameter information are correct. When the parameter information of the current network card is inconsistent with the corresponding configuration information, it is determined that the characters corresponding to the current network card parameter information are incorrect. After the traversal is completed, it can be determined whether each character of the electronic label is correct. If all characters are correct, it is determined that the electronic label verification has passed. If any character is incorrect, it is determined that the electronic label verification has failed, and the tester is reminded to adjust the incorrect character.
[0100] In a possible implementation, when a preset test script is run to perform a loopback test on the network card to be tested, the following steps may be included:
[0101] First, identify each network port of the network card to be tested. Specifically, a network card to be tested may include multiple network ports. When performing a loopback test, all network ports of the network card to be tested need to be identified first to perform a loopback test on each network port. Furthermore, after identifying each network port, the identified network ports will also be classified and identified. For example, when the network card to be tested is a four-optical four-network network card, 4 electrical ports and 4 optical ports will be identified, and the 4 electrical ports will be marked as E1, E2, E3, and E4 respectively, and the 4 optical ports will be marked as L1, L2, L3, and L4.
[0102] Second, for each network port, select the corresponding loopback connection network port from the other network ports of the network card to be tested, and establish a loopback connection between each network port and the corresponding loopback connection network port. Specifically, for each network port, it is necessary to select a loopback connection network port of the same type as that of the network port and for which a corresponding loopback connection network port has not yet been established from other network ports as the corresponding loopback connection network port. Continuing with the above embodiment, for electrical port E1, any one of the three electrical ports E2, E3 and E4 can be selected as the loopback connection network port corresponding to electrical port E1. For example, E2 is selected as the loopback connection network port corresponding to electrical port E1. After a set of loopback connection relationships are established, the two network ports with a loopback connection relationship are corresponding loopback connection network ports to each other. That is, for electrical port E1, its corresponding loopback connection network port is E2, and for electrical port E2, its corresponding loopback connection network port is E1. At this time, it is no longer necessary to select the corresponding loopback connection network port for E2. Furthermore, for electrical port E3, the same type as that of the electrical port E3 and the corresponding loopback connection network port that has not yet been established is E4. At this time, electrical port E4 is used as the loopback connection network port corresponding to electrical port E3. Similarly, for electrical port E4, electrical port E3 is its corresponding loopback connection network port. At this point, the loopback connection network port corresponding to each electrical port is determined. Similarly, optical ports L1 and L2 can be loopback connection network ports to each other, and optical ports L3 and L4 can be loopback connection network ports to each other.
[0103] In one possible implementation, when establishing a loopback connection between each network port and the corresponding loopback connection network port, it also includes: creating a loopback test wiring diagram based on each network port and the corresponding loopback connection network port; pushing the loopback test wiring diagram to display on the test interface to prompt the tester to establish a loopback connection between each network port and the corresponding loopback connection network port according to the loopback test wiring diagram.
[0104] Third, based on the loopback connection between each network port and the corresponding loopback connection network port, a loopback test is performed. Specifically, the steps for performing the loopback test are as follows:
[0105] First, create a corresponding data packet sending program for each network port. That is to say, an independent data packet sending program will be established for each network port. Each data packet sending program is responsible for the loopback connection test of a network port. During the loopback connection test, the data packet sending program is run, and the data packet sending program will send data packets to the corresponding loopback connection network port through the network port according to the preset frequency and packet length. Among them, the sending frequency and packet length of the data packet can be adjusted according to the specific application scenario, and are not specifically limited here. The data packet is a broadcast data packet.
[0106] Secondly, each network port sends a data packet to the loopback connection network port connected to it through the corresponding data packet sending program according to the preset frequency and packet length. Specifically, when performing a loopback test, each network port can simultaneously start the corresponding data packet sending program to send data packets to improve the efficiency of the loopback test.
[0107] Finally, call the data packet statistics tool to count the data packet transmission and reception data of each network port to obtain the loopback test results of each network port. Specifically, the netstat tool will be used to count the traffic, success rate and packet loss rate of each network port over a period of time to obtain the loopback test results of each network port. The results of the loopback test of each network port include the traffic, success rate and packet loss rate of the network port over a period of time.
[0108] After obtaining the loopback test structure of each network port, the nominal loopback test data configured for each network port will be read from the configuration file, and the actual loopback test result of each network port will be compared with the nominal loopback test result. If they are consistent, the loopback test result of the network port is determined to be passed. If they are inconsistent, the loopback test result of the network port is determined to be failed, the loopback test is exited and an alarm is prompted.
[0109] In this embodiment, it is only necessary to establish a loopback connection between the network ports of the network card to be tested, so as to implement the loopback test of each network port to be tested, thereby making the loopback test simpler and more efficient.
[0110] It should be noted here that, for multiple network cards to be tested mounted on the same test motherboard, in addition to selecting the corresponding loopback connection network port from the same type of network ports of their own, you can also select the corresponding loopback connection network port from the same type of network ports of other network cards to be tested under the same test motherboard, and no specific limitation is made here.
[0111] It can be seen that the loopback connection test in the present disclosure only requires one test motherboard to be implemented, and there is no need to use the network ports under other motherboards to implement the loopback connection test, thereby simplifying the loopback connection test and improving the efficiency of the loopback connection test.
[0112] When performing chip model verification, the chip model of the network card to be tested will be read, and then the read chip model will be compared with the chip model after the first configuration item name filled in the configuration file. If they are consistent, the chip model test passes, otherwise the test will exit and an alarm will be prompted.
[0113] When performing phy chip model verification, the slave device number of the network card to be tested will be read, and the corresponding slave device number will be found in the PCI device number configuration description of the configuration file. In this way, the phy chip model of the network card to be tested will be determined based on the PCI device number configuration description to which the slave device number belongs. The determined phy chip model will then be compared with the phy chip model filled in after the second configuration item name in the configuration file. If they are consistent, the phy chip model test passes, otherwise the test will exit and an alarm will be prompted.
[0114] For example, when the slave device number of the network card to be tested is read as 8808:0403, the PCI device number configuration description is searched. By searching the PCI device number configuration description, it can be determined that the PHY chip model including the slave device number is Marvell, and the PHY chip model filled in after the second configuration item name is also Marvell. If the two are consistent, the PHY chip model verification passes.
[0115] For example, when the slave device number of the network card to be tested is read as 8808:0460, the PCI device number configuration description is searched. By searching the PCI device number configuration description, it can be determined that the PHY chip model including the slave device number is Yutai, and the PHY chip model filled in after the second configuration item name is also Yutai. If the two are consistent, the PHY chip model verification passes.
[0116] When verifying the bridge chip model, the bridge chip model of the network card to be tested will be read, and then the read bridge chip model will be compared with the bridge chip model after the third configuration item name is filled in the configuration file. If they are consistent, the bridge chip model test passes, otherwise the test will be exited and an alarm will be prompted.
[0117] When checking the network card firmware version, the firmware version of the network card to be tested will be read, and then the read firmware version will be compared with the firmware version after the seventh configuration item name is filled in the configuration file. If they are consistent, the firmware version verification passes, otherwise the verification fails and an alarm prompts.
[0118] When verifying the PCI rate of the network card, you need to read the PCI rate of the network card to be tested, and then compare the read PCI rate with the PCI rate after the eighth configuration item name is filled in the configuration file. If they are consistent, the PCI rate verification passes, otherwise the verification fails and an alarm prompts.
[0119] When verifying the PCI device number of the network card, it is necessary to read the PCI device number of the network card to be tested, and then compare the read PCI device number with the PCI device number after the ninth configuration item name filled in the configuration file. If they are consistent, the PCI device number verification passes, otherwise the verification fails and an alarm prompts.
[0120] In a possible implementation, the total number of PCI device numbers of the network cards will also be compared. Specifically, the total number of PCI device numbers of the network cards to be tested is calculated based on the PCI device number of the network cards to be tested, and the calculated total number of PCI device numbers is compared with the calculation result of (number of electrical ports + number of optical ports) * number of network cards to be tested in the configuration file. If they are consistent, the total number of PCI device numbers is verified to pass, otherwise the verification fails and an alarm is issued. The number of network cards to be tested is the number of network cards to be tested in the same batch of tests plugged into the same test motherboard. This data can be pre-configured in the configuration file, that is, when configuring the configuration file, it is also necessary to count the number of network cards to be tested plugged into the same test motherboard, and configure this data in the configuration file.
[0121] When verifying the NIC MCU version, you need to read the NIC MCU version of the NIC to be tested, and then compare the read NIC MCU version with the NIC MCU version after the name of the tenth configuration item in the configuration file. If they are consistent, the NIC MCU version verification passes, otherwise the verification fails and an alarm prompts.
[0122] When performing the bypass function test, it is necessary to test the bypass function of each network port, count the number of network ports with the bypass function, and compare the number of network ports with the bypass function with the bypass number written after the name of the eleventh configuration item in the configuration file. If they are consistent, the bypass function test passes; otherwise, the exit verification fails and an alarm prompts.
[0123] When performing a link rate test, you need to test the link rate of the network card to be tested, and compare the link rate of the network card to be tested with the link rate written after the name of the twelfth configuration item in the configuration file. If they are consistent, the link rate test passes; otherwise, the test fails and an alarm is prompted.
[0124] The network port status test and LED light state change test methods refer to the other test concepts mentioned above and will not be described in detail here.
[0125] It should be noted here that the order of the above tests can be set according to specific needs and is not specifically limited here.
[0126] In the current existing technology, when checking the test results of each test item, the tester is required to manually input a command to read the test results, and then push and display the test results after executing the input command. In order to simplify the query of test results, a program for displaying test results is embedded in the test program of each test. In this way, the program for displaying results in the test program will be run after each test result to display the test results of the test.
[0127] It should be further explained that before executing each test, the corresponding configuration file needs to be loaded first. After loading the configuration file, the configuration information configured in the configuration file needs to be checked. After the verification is correct, the test can be performed to provide the accuracy of the test.
[0128] The present disclosure provides a network card testing method, including: obtaining a configuration file of a network card to be tested, and parsing the configuration file to obtain various test items that need to be executed by the network card to be tested and configuration information for each test configuration; running a pre-set test script to perform various tests on the network card to be tested, obtaining test parameter information for each test, and comparing the test parameter information of each test item with the corresponding configuration information to obtain the test result of each test item. In the present disclosure, the test items of network cards of different models and the configuration information of each test item can be configured through the configuration file. In this way, the configuration files of network cards of different models can be loaded through a unified test script to implement the testing of network cards of different models, thereby improving the versatility of the test script.
[0129] <Device Example>
[0130] Figure 2 FIG. 1 is a schematic block diagram of a network card testing device according to an embodiment of the present disclosure. Figure 2 As shown, the network card testing device 100 includes:
[0131] The configuration file parsing module 110 is used to obtain the configuration file of the network card to be tested, and parse the configuration file to obtain the test items to be executed by the network card to be tested and the configuration information for each test configuration;
[0132] The testing module 120 is used to run a preset test script to perform various tests on the network card to be tested, obtain test parameter information of each test, and determine the test result of each test item based on the test parameter information and configuration information of each test item.
[0133] <Equipment Embodiment>
[0134] Figure 3 FIG. 1 is a schematic block diagram of a network card testing device according to an embodiment of the present disclosure. Figure 3 As shown, the network card testing device 200 includes: a processor 210 and a memory 220 for storing executable instructions of the processor 210. The processor 210 is configured to implement any of the above-mentioned network card testing methods when executing the executable instructions.
[0135] Here, it should be noted that the number of processors 210 may be one or more. Meanwhile, the network card test device 200 of the embodiment of the present disclosure may also include an input device 230 and an output device 240. The processor 210, the memory 220, the input device 230 and the output device 240 may be connected via a bus or in other ways, which are not specifically limited here.
[0136] The memory 220 is a computer-readable storage medium that can be used to store software programs, computer executable programs, and various modules, such as the program or module corresponding to the network card testing method of the embodiment of the present disclosure. The processor 210 executes various functional applications and data processing of the network card testing device 200 by running the software programs or modules stored in the memory 220.
[0137] The input device 230 may be used to receive input numbers or signals. The signals may be key signals related to user settings and function control of the device / terminal / server. The output device 240 may include display devices such as display screens.
[0138] <Storage Medium Embodiment>
[0139] According to a fourth aspect of the present disclosure, a non-volatile computer-readable storage medium is also provided, on which computer program instructions are stored. When the computer program instructions are executed by the processor 210, any of the above-mentioned network card testing methods is implemented.
[0140] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A network card testing method, characterized in that: include: Obtain a configuration file of the network card to be tested, and parse the configuration file to obtain the test items to be executed by the network card to be tested and the configuration information for each test configuration; Run a pre-set test script to perform various tests on the network card to be tested, obtain test parameter information of each test, and determine the test result of each test item based on the test parameter information and configuration information of each test item; The configuration file sets corresponding configuration instructions and configuration item names for each of the test items. The configuration instructions can guide the tester to accurately determine the configuration information corresponding to the current test item, and fill the determined configuration information into the corresponding configuration item name, thereby completing the configuration of the configuration information of each of the test items; When determining the test result of the test item based on the test parameter information and configuration information of the test item, it includes: comparing the test parameter information of the test item with the corresponding configuration information: when the results are consistent, determining that the test result of the test item is passed, and performing the test evaluation of the next test item; In case the test results are inconsistent, the test is exited and an alarm is prompted; The test script can adjust the test items and the test result judgment based on the configuration file. Specifically, the test script includes test programs for all test items that the network card may perform. After parsing the configuration file to obtain various target test items that need to be executed by the network card to be tested, the test programs corresponding to each target test item are extracted from all test programs, and the test programs corresponding to each target test item are combined in sequence to obtain a test script adapted to the network card to be tested.
2. The method according to claim 1, characterized in that: The test items that need to be performed on the network card to be tested include: electronic label verification, network card firmware version verification, network card MCU version verification, PCI rate verification, PCI device number verification, chip model verification, PHY chip model verification, bridge chip model verification, bypass function test, loopback test, link rate test, network port status test and at least one of LED light status change test.
3. The method according to claim 2, characterized in that When running a preset test script to perform the electronic label verification on the network card to be tested, it includes: Reading the electronic label of the network card to be tested from the preset storage address of the network card to be tested; Parsing the character string constituting the electronic label to obtain the network card parameter information recorded in the electronic label, wherein the network card parameter information includes at least one of the number of optical ports, the number of electrical ports, the link rate, the number of bypasses, the chip model, and the manufacturer name; Based on the network card parameter information and corresponding configuration information, determine whether the electronic label is correct.
4. The method according to claim 3, characterized in that The network card to be tested includes a first electronic label used by the manufacturer and a second electronic label used by the demander, wherein the first electronic label is stored in a preset first storage address, and the second electronic label is stored in a preset second storage address.
5. The method according to claim 2, characterized in that: When running a preset test script to perform the loopback test on the network card to be tested, it includes: Identify each network port of the network card to be tested; For each of the network ports, a corresponding loopback connection network port is selected from other network ports of the network card to be tested, and a loopback connection is established between each of the network ports and the corresponding loopback connection network port; Based on the loopback connection between each of the network ports and the corresponding loopback connection network port, a loopback test is performed.
6. The method according to claim 5, characterized in that When establishing a loopback connection between each of the network ports and the corresponding loopback connection network port, it includes: Based on each of the network ports and the corresponding loopback connection network ports, create a loopback test wiring diagram; The loopback test wiring diagram is pushed and displayed on a test interface to prompt a tester to establish a loopback connection between each network port and a corresponding loopback connection network port according to the loopback test wiring diagram.
7. The method according to claim 5, characterized in that Based on the loopback connection between each of the network ports and the corresponding loopback connection network port, the loopback test includes: Creating a corresponding data packet sending program for each network port; Each of the network ports sends a data packet to the loopback connection network port connected thereto in a loopback manner according to a preset frequency and packet length through a corresponding data packet sending program; The data packet statistics tool is called to count the data packet receiving and sending data of each network port to obtain the loopback test results of each network port.
8. A network card testing device, characterized in that: include: A configuration file parsing module is used to obtain a configuration file of the network card to be tested, and parse the configuration file to obtain various test items that need to be executed by the network card to be tested and configuration information for each test configuration; The test module is used to run a preset test script to perform various tests on the network card to be tested, obtain test parameter information of each test, and determine the test result of each test item based on the test parameter information and configuration information of each test item; The configuration file sets corresponding configuration instructions and configuration item names for each of the test items. The configuration instructions can guide the tester to accurately determine the configuration information corresponding to the current test item, and fill the determined configuration information into the corresponding configuration item name, thereby completing the configuration of the configuration information of each of the test items; The test module, when determining the test result of the test item based on the test parameter information and configuration information of the test item, is specifically used to: compare the test parameter information of the test item with the corresponding configuration information; if the results are consistent, determine that the test result of the test item is passed, and perform test evaluation of the next test item; In case the test results are inconsistent, the test is exited and an alarm is prompted; The test script can adjust the test items and the test result judgment based on the configuration file. Specifically, the test script includes test programs for all test items that the network card may perform. After parsing the configuration file to obtain various target test items that need to be executed by the network card to be tested, the test programs corresponding to each target test item are extracted from all test programs, and the test programs corresponding to each target test item are combined in sequence to obtain a test script adapted to the network card to be tested.
9. A network card testing device, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement the method described in any one of claims 1 to 7 when executing the executable instructions.
10. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
