CN113489625B - Network card testing method and device, electronic equipment and computer readable storage medium - Google Patents
Network card testing method and device, electronic equipment and computer readable storage medium Download PDFInfo
- Publication number
- CN113489625B CN113489625B CN202110826711.4A CN202110826711A CN113489625B CN 113489625 B CN113489625 B CN 113489625B CN 202110826711 A CN202110826711 A CN 202110826711A CN 113489625 B CN113489625 B CN 113489625B
- Authority
- CN
- China
- Prior art keywords
- terminal
- parameters
- test
- data packet
- network
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/50—Testing arrangements
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/50—Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The application relates to a network card testing method, a network card testing device, electronic equipment and a computer readable storage medium, and belongs to the technical field of computers. The method comprises the steps of obtaining pre-configured basic parameters for network communication and customized parameters for defining a network data packet and a forwarding mode thereof; remotely logging in a second terminal according to the basic parameters, and installing a network driving component required by testing on the first terminal; sending a data packet defined based on the customization parameters to the second terminal for customization testing, and controlling the second terminal to forward the data packet to the first terminal based on a forwarding mode in the customization parameters; and receiving the data packet forwarded by the second terminal and counting related data, and ending the test until the set test time is reached to obtain a test result. The method can automatically acquire the configured test parameters, automatically install the required drive components, start the test and collect the result, automatically realize the customized test of the network card, and save the test time and the hardware cost of using the bale-issuing machine.
Description
Technical Field
The application belongs to the technical field of computers, and particularly relates to a network card testing method, a network card testing device, electronic equipment and a computer readable storage medium.
Background
With the advent of the internet era, operators have made higher and higher demands on network service performance. In such an environment, detecting the network capability of the operating platform infrastructure (server network) becomes a key technical index for acceptance. The network card pressure and performance test is an important test for judging the network quality of the server. At present, a professional wrapper tool (physical hardware) is mainly used for testing the network card, so that the cost is high.
Disclosure of Invention
In view of the above, an object of the present application is to provide a network card testing method, an apparatus, an electronic device and a readable storage medium, so as to solve the problem of high hardware cost in the conventional network card testing using a chartered plane tool.
The embodiment of the application is realized as follows:
in a first aspect, an embodiment of the present application provides a network card testing method, which is applied to a first terminal, and the method includes: acquiring pre-configured basic parameters for network communication and customized parameters for defining a network data packet and a forwarding mode thereof; remotely logging in a second terminal according to the basic parameters, and installing a network driving component required by testing on the first terminal; sending a data packet defined based on the customization parameters to the second terminal for customization test, and controlling the second terminal to forward the data packet to the first terminal based on a forwarding mode in the customization parameters; and receiving the data packet forwarded by the second terminal and counting related data until the set test time is reached, and ending the test to obtain a test result. In the embodiment of the application, the customized test of the network card is automatically realized by automatically acquiring the configured test parameters (basic parameters for network communication and customized parameters for defining a network data packet and a forwarding mode thereof), remotely logging in the second terminal, automatically installing the required driving component, and starting the test and result collection, so that the test time and the hardware cost of a packaging machine are saved.
With reference to a possible implementation manner of the embodiment of the first aspect, the forwarding manner in the customized parameter is forwarding through a forwarding tool or forwarding through a kernel. In the embodiment of the application, the forwarding modes can be defined as required, so that the influence caused by different forwarding modes can be tested, and the applicability of the scheme is improved.
With reference to a possible implementation manner of the embodiment of the first aspect, if the forwarding manner in the customized parameter is forwarding through a kernel, before sending the data packet defined based on the customized parameter to the second terminal, the method further includes: and establishing an ARP binding relationship between the IP address and the MAC address of the second terminal on the first terminal based on the basic parameters, and establishing an ARP binding relationship between the IP address and the MAC address of the first terminal on the second terminal. In the embodiment of the application, if the forwarding mode in the customized parameters is forwarding through the kernel, before sending a data packet defined based on the customized parameters to the second terminal, an ARP binding relationship between the IP address and the MAC address of the second terminal is established on the first terminal based on the basic parameters, and an ARP binding relationship between the IP address and the MAC address of the first terminal is established on the second terminal, so that ARP resolution actions in a test process can be saved, and network performance can be improved.
With reference to a possible implementation manner of the embodiment of the first aspect, if a forwarding manner in the customized parameter is forwarding through a forwarding tool, before sending a data packet defined based on the customized parameter to the second terminal, the method further includes: and installing a DPDK environment required by data transmission on the second terminal, wherein the DPDK environment comprises the forwarding tool. In this embodiment, if the forwarding manner in the customized parameter is forwarding through a forwarding tool, before sending the data packet defined based on the customized parameter to the second terminal, a DPDK environment required for data transmission is installed on the second terminal, where the DPDK environment includes the forwarding tool, so as to ensure that data can be correctly forwarded.
With reference to a possible implementation manner of the embodiment of the first aspect, before sending the data packet defined based on the customized parameter to the second terminal, the method further includes: and determining that the first terminal and the second terminal can normally communicate with each other. In the embodiment of the present application, before sending the data packet defined based on the customized parameter to the second terminal, it is necessary to ensure that the first terminal and the second terminal can normally communicate with each other, so as to ensure that the scheme can be correctly implemented, and improve the testing efficiency.
With reference to one possible implementation manner of the embodiment of the first aspect, the customized test includes one of a network card function test, a performance test, and a pressure test. In the embodiment of the application, the method can realize various tests such as network card function test, performance test and pressure test, so that the use cost of the scheme is lower, and the tool use threshold is reduced.
In a second aspect, an embodiment of the present application further provides a network card testing apparatus, which is applied to a first terminal, and the apparatus includes: the device comprises a parameter acquisition module, a login module and a test module; the parameter acquisition module is used for acquiring pre-configured basic parameters for network communication and customized parameters for defining a network data packet and a forwarding mode thereof; the login module is used for remotely logging in the second terminal according to the basic parameters; and the test module is used for installing a network driving component required by the test on the first terminal, sending a data packet defined based on the customization parameters to the second terminal for customization test, controlling the second terminal to forward the data packet to the first terminal based on a forwarding mode in the customization parameters, receiving the data packet forwarded by the second terminal and counting related data, and ending the test until a set test time is reached to obtain a test result.
With reference to a possible implementation manner of the embodiment of the second aspect, if the forwarding manner in the customized parameter is forwarding through a kernel, before sending the data packet defined based on the customized parameter to the second terminal, the test module is further configured to: and establishing an ARP binding relationship between the IP address and the MAC address of the second terminal on the first terminal based on the basic parameters, and establishing an ARP binding relationship between the IP address and the MAC address of the first terminal on the second terminal.
In a third aspect, an embodiment of the present application further provides an electronic device, including: a memory and a processor, the processor coupled to the memory; the memory is used for storing programs; the processor is configured to invoke a program stored in the memory to perform the method according to the first aspect embodiment and/or any possible implementation manner of the first aspect embodiment.
In a fourth aspect, this application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the method in the foregoing first aspect and/or any possible implementation manner of the first aspect.
Additional features and advantages of the present application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the present application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and drawings.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts. The foregoing and other objects, features and advantages of the application will be apparent from the accompanying drawings. Like reference numerals refer to like parts throughout the drawings. The drawings are not necessarily to scale, emphasis instead being placed upon illustrating the principles of the application.
Fig. 1 shows a schematic usage flow diagram of a network card testing method provided in an embodiment of the present application.
Fig. 2 shows a schematic flowchart of a network card testing method provided in an embodiment of the present application.
Fig. 3 is a schematic diagram illustrating a test result of the network card testing method provided in the embodiment of the present application.
Fig. 4 shows a schematic module diagram of a network card testing device according to an embodiment of the present application.
Fig. 5 shows a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined or explained in subsequent figures. Meanwhile, relational terms such as "first," "second," and the like may be used solely in the description herein to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
Further, the term "and/or" in the present application is only one kind of association relationship describing the associated object, and means that three kinds of relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone.
The embodiment of the application provides a network card testing method based on a TRex tool, the TRex tool is developed based on Python language and is used for customized testing of a network card, wherein the TRex tool is an open source pushed by DPDK, and is a low-cost stateful and stateless flow generator which can generate flows of L3-L7 layers in a simulation mode, namely, flows of an application layer, a presentation layer, a session layer, a transmission layer and a network layer can be generated in a simulation mode. The customized test may be a function test, a performance test (e.g., RFC2544 test), a stress test, and the like of the network card. The following describes a hardware environment required by the network card testing method of the present application. The network card testing method needs to involve two terminals, namely a first terminal and a second terminal, wherein the two terminals are connected back to back. For convenience of description, it is specified that a terminal running the TRex tool is a first terminal or a Server (Server) terminal, and an opposite terminal is a second terminal or a Client (Client) terminal.
The following describes a usage flow of the network card testing method of the present application, as shown in fig. 1. Before the TRex tool is applied, the first terminal and the second terminal need to be manually configured, including: the method comprises the steps of installing a Linux system (such as installing a Centos 76-bit system), installing a network card driver, configuring a fixed IP for a network port to be tested, closing a system firewall function and configuring a large memory page (aiming at replacing the traditional 4kb memory page by using a large-page memory so as to adapt to the larger and larger system memory and enable an operating system to support the large-page capacity function), and restarting the machine after configuration is completed. When a fixed IP is configured for the portal to be tested, the IPs configured by the first terminal and the second terminal should belong to the same network segment, for example, the IP configured by the first terminal is "192.168.1.11", and the IP configured by the second terminal is "192.168.1.10".
Before the first terminal runs the test program, it needs to configure test parameters, the test parameters include two parts, which are basic parameters for network communication and customized parameters for defining network data packet and its forwarding mode, when the customized parameters are not modified, the initial values defined by the program are used by default, and the customized parameters can be modified according to the customized test requirements. Py file may be saved in the test parameters. And then, running a test program at the first terminal, automatically connecting to an opposite terminal according to the test parameters, carrying out customized test based on a TRex tool, and outputting a test result to a screen and storing the test result in a file after the test is finished.
With reference to fig. 2, a test flow of the network card test method provided in the embodiment of the present application will be described below. The execution main body of the network card testing method is a first terminal.
S1: the method comprises the steps of obtaining pre-configured basic parameters for network communication and customized parameters for defining network data packets and forwarding modes thereof.
After the first terminal runs the test program, the program can automatically acquire the pre-configured basic parameters for network communication and the customized parameters for defining the network data packet and the forwarding mode thereof.
Wherein, the basic parameters comprise:
(1) A Client port IP (Client _ IP);
(2) A Client port name (Client _ INTERFACE);
(3) A Client port MAC address (Client _ MAC);
(4) A Client end system login user name (Client _ USERNAME);
(5) A Client end system login PASSWORD (Client _ PASSWORD);
(6) A Server port IP (Server _ IP);
(7) A Server-side port name (Server _ INTERFACE);
(8) A Server port MAC address (Server _ MAC).
Examples of basic parameters are as follows:
Client_IP=“192.168.1.10”;
Client_INTERFACE=“etho”;
Client_MAC=“00:00:00:00:00:01”;
Client_USERNAME=“root”;
Client_PASSWORD=“password”;
Server_IP=“192.168.1.11”;
Server_INTERFACE“etho”;
Server_MAC=“00:00:00:00:00:02”。
the support customization parameters are as follows:
(1) FORWARDING MODE (forward _ MODE): a Client terminal forwarding mode which comprises two modes, wherein a data packet is forwarded through a forwarding tool (such as a testpmd tool) or a kernel (kernel);
(2) DURATION of test (DURATION): the unit is second;
(3) RFC2544 tests whether enabled (RFC 2544): whether a standard RFC2544 throughput rate test is executed, if the test is False, the test is not started, and if the test is True, the test is started;
(4) Packet SIZE (SIZE);
(5) Magnitude of pressure (multipressure): there are three ways to set the pressure, which can specify one of bps (bit per second, i.e. number of bits transmitted per second), pps (packets per second, i.e. sending multiple packets per second), and bandwidth percentage;
(6) Packet format (PKT _ TYPE): specifying a data packet in a UDP (User Datagram Protocol)/TCP (Transmission Control Protocol) format;
(7) Number of data STREAMs (STREAM _ NUM): number of data streams for multiple streams;
(8) Multi-stream TYPE (TUPLE _ TYPE): whether the 4-tuple change mode is sequential change (inc) or random change (random) in the case of multiple data streams;
(9) Data STREAM TYPE (STREAM _ TYPE): designating a data stream as a continuous stream (Cont) or a multi-burst (MultiBurst);
(10) BURST number (MULTI _ BURST _ consts): total number of bursts;
(11) BURST PPS (MULTI _ BURST _ PPS): number of pps per burst;
(12) BURST number PER BURST (MULTI _ BURST _ PKTS _ PER _ BURST): total number of packets per burst;
(13) BURST stream BURST interval (MULTI _ BURST _ IBG) each time: the time interval between each burst, in microseconds;
(14) CAPTURE packet enabled (CAPTURE): a switch for capturing a data packet, wherein the format of the captured data packet is pcap, if False, the captured data packet is not started, and if True, the captured data packet is started;
(15) Number of captured packets (CAPTURE _ PKTS _ NUM): total number of captured packets;
(16) Captured packet SIZE limit (CAPTURE _ PKTS _ SIZE): the size of the captured data packet is set, and the data packet larger than or equal to the set size is captured.
The customization parameters are exemplified as follows:
FORWARDING_MODE=“testpmd”#<testpmd/kernel>;
DURATION=10 #test time;
RFC2544=False #<False/True>;
SIZE=[64,128];
MULTIPLIER='100%'#<10gbps/1mbps/5kpps/85%>;
PKT_TYPE='UDP'#<UDP/TCP>;
STREAM_NUM=4;
TUPLE_TYPE='inc'#<inc/random>;
STREAM_TYPE='Cont'#<Cont/MultiBurst>;
MULTI _ BURST _ configurations =5 # this parameter is in effect when the 'STREAM _ TYPE' value is set to 'MultiBurst';
MULTI _ BURST _ PPS =10 # this parameter is effective when the 'STREAM _ TYPE' value is set to 'MultiBurst';
MULTI _ BURST _ PKTS _ PER _ BURST =4 # this parameter is in effect when the 'STREAM _ TYPE' value is set to 'MultiBurst';
MULTI _ BURST _ IBG =1000000.0 # this parameter is in effect when the 'STREAM _ TYPE' value is set to 'MultiBurst';
CAPTURE=False #<False/True>;
CAPTURE _ PKTS _ NUM =20 # this parameter is effective when 'CAPTURE' is set to 'True';
CAPTURE _ PKTS _ SIZE =60 # this parameter is valid when 'CAPTURE' is set to 'True'.
S2: and remotely logging in a second terminal according to the basic parameters, and installing a network driving component required by testing on the first terminal.
After the basic parameters for network communication and the customized parameters for defining the network data packet and the forwarding mode thereof are obtained, the second terminal can be remotely logged in according to the basic parameters, for example, the second terminal can be remotely logged in according to three parameters, namely Client _ IP, client _ user and Client _ PASSWORD, in the basic parameters. And installing network driving components required for data transmission on the first terminal, such as installing a DPDK component (the Trex tool needs to depend on the DPDK environment) and mounting a large memory page (improving the system performance). In addition, three parameters of Server _ INTERFACE, server _ IP and Client _ IP in the basic parameters need to be called to modify a configuration file (Trex _ cfg.yaml) of Trex, the IP addresses of the network port and the two ends in the configuration file are modified to the IP addresses of the network port and the two ends defined in the basic parameters, and the IP addresses are copied to/etc directory, the IP addresses of the network port and the two ends for testing are defined in Trex _ cfg.yaml, and the Trex tool depends on the configuration file during execution.
S3: and sending a data packet defined based on the customization parameters to the second terminal for customization test, and controlling the second terminal to forward the data packet to the first terminal based on a forwarding mode in the customization parameters.
After logging in a second terminal remotely according to the basic parameters and installing a network driving component required by the test on the first terminal, the test program calls a Trex tool, sends a data packet defined based on the customized parameters to the second terminal for customized test, and controls the second terminal to forward the data packet to the first terminal based on a forwarding mode (forwarding through a forwarding tool or forwarding through a kernel) in the customized parameters. The size, format, number of data streams, type of multi-stream, type of data stream, and amount of pressure generated, etc. of the data packet are consistent with the parameters defined in the customized parameters.
And the forwarding mode in the customized parameters is forwarding through a forwarding tool or forwarding through a kernel. If the forwarding manner in the customized parameter is forwarding through the kernel, in an optional implementation manner, before sending the data packet defined based on the customized parameter to the second terminal, the network card testing method further includes: establishing an ARP (Address Resolution Protocol) binding relationship between the IP Address and the MAC Address of the second terminal on the first terminal based on the basic parameters, and establishing an ARP binding relationship between the IP Address and the MAC Address of the first terminal on the second terminal. After the IP address and the MAC address are ARP bound, ARP analysis actions in the test process can be saved, and network performance is improved.
For example, if the IP address of the a host is 192.168.0.1, which needs to communicate with the host B with IP of 192.168.0.8, the following actions will be performed:
1.A host inquires an ARP cache list of the host, if finding that the host has an MAC address item corresponding to a destination IP address of 192.168.0.8, the host directly uses the MAC address item to construct and send an Ethernet data packet, and if the host does not find the corresponding MAC address item, the host continues the next step;
2.A host sends out ARP analysis request broadcast, the destination MAC address is FF, and the request IP is 192.168.0.8 host reply MAC address;
after receiving the ARP analysis request broadcast, the B host replies an ARP response data packet to the A host, wherein the ARP response data packet comprises the IP address and the MAC address of the B host;
after the A host receives the ARP reply of the B host, the MAC address of the B host is put into an ARP cache list of the A host, then the MAC address of the B host is used as a target MAC address, and the IP address (192.168.0.8) of the B host is used as a target IP address, so that an Ethernet data packet is constructed and sent;
5. if the a-host still sends a packet to 192.168.0.8, since the MAC address of the IP address 192.168.0.8 is already in the ARP cache list, the a-host sends the packet directly using this MAC address without sending any ARP resolution request broadcast.
After the IP address and the MAC address are ARP bound, ARP analysis action in the test process can be saved, and network performance is improved.
If the forwarding mode in the customized parameters is forwarding through a forwarding tool, before sending the data packet defined based on the customized parameters to the second terminal, the network card testing method further comprises the following steps: and installing a DPDK environment required for data transmission on the second terminal, wherein the DPDK environment comprises a forwarding tool, such as a testpmd tool. In this embodiment, after acquiring the customized parameters defining the network packet and its forwarding mode, based on the forwarding mode defined in the customized parameters, it may be determined whether a DPDK environment required for data transmission needs to be installed on the second terminal, and if the forwarding mode in the customized parameters is forwarding through a forwarding tool, after logging in the second terminal remotely according to the basic parameters, the DPDK environment required for data transmission needs to be installed on the second terminal, the DPDK environment is dependent on the DPDK environment, and a large memory page is mounted (system performance is improved).
The customized test comprises one of a network card function test, a performance test and a pressure test. The specific testing process is consistent with the existing testing process by the packaging machine, is well known to those skilled in the art, and is not described herein.
In an optional implementation manner, before sending the data packet defined based on the customized parameter to the second terminal, the network card testing method further includes: and determining that the first terminal and the second terminal can normally communicate with each other, for example, determining that the first terminal and the second terminal can normally ping and ssh communicate with each other. Only if it is determined that the first terminal and the second terminal can ping and ssh communicate with each other, the first terminal sends a packet defined based on the customized parameters to the second terminal. Wherein, ping is an internet packet explorer, a program for testing network connection amount. ssh is an abbreviation for secure shell, a protocol specific to security for telnet sessions and other network services.
It should be noted that, the process of checking whether the first terminal and the second terminal can ping and ssh communicate with each other may also be checking when the first terminal and the second terminal are manually configured, that is, when the first terminal and the second terminal are manually configured, and checking whether the first terminal and the second terminal can ping and ssh communicate with each other through the fixed IP configured in the above step.
S4: and receiving the data packet forwarded by the second terminal and counting related data until the set test time is reached, and ending the test to obtain a test result.
And then, the first terminal receives the data packet forwarded by the second terminal and counts related data until the set test time is reached, and then the test is finished to obtain a test result. The test time may be obtained from "DURATION" in the customized parameters. In the process, the first terminal continuously sends the data packet defined based on the customized parameter to the second terminal, controls the second terminal to forward the data packet to the first terminal based on the forwarding mode in the customized parameter, and receives the data packet forwarded by the second terminal and counts related data until the test is finished. And then outputting the test result to a screen and saving the test result to a file, wherein the test result is shown in figure 3. When the first terminal performs the correlation data statistics, it will count the data shown in fig. 3, and the main parameters in the test result are explained as follows:
port statistics is port statistics, owner is a system user, link is a network card connection State, state is a transmission State, speed is a network card rated bandwidth, CPU util is CPU utilization, line util is network port bandwidth utilization, tx (Transport) represents transmitted data, rx (Receive) represents received data, bps represents a number of transmission bits per second, pps represents how many packet data packets are transmitted per second, tx bps L2 represents data (including packet header, frame interval and the like) obtained by counting all bytes of the transmitted packet data, tx bps L1 pointer only counts bytes of the transmitted packet data per se, opengrams is transmitted packet data, ackpies is received packet data, bytes is total transmitted packet data, ibes represents total received packet data, tx-pkts represents number of transmission messages, rx-pkts represents number of reception messages, tx-bytes is number of transmission messages, txx-bytes is number of transmission messages, rew represents number of transmission packets per second, rewet represents number of transmission packets per second, and is transfer packet transfer rate of transmission packets per second.
By the network card testing method, automatic testing environment configuration, starting test and result collection can be achieved, customized test of the network card is automatically achieved, tool use doorways are reduced, quick starting test is achieved, testing time is saved, and hardware cost of a package issuing machine is saved.
Based on the same inventive concept, the embodiment of the present application further provides a network card testing apparatus 100 applied to the first terminal, as shown in fig. 4. The network card testing apparatus 100 includes: an acquisition parameter module 110, a login module 120, and a test module 130.
The parameter obtaining module 110 is configured to obtain preconfigured basic parameters for network communication and customized parameters for defining a network packet and a forwarding manner thereof.
A login module 120, configured to log in the second terminal remotely according to the basic parameter.
The test module 130 is configured to install a network driver component required for testing on the first terminal, send a data packet defined based on the customization parameters to the second terminal for performing customization testing, control the second terminal to forward the data packet to the first terminal based on a forwarding manner in the customization parameters, receive the data packet forwarded by the second terminal and count related data, and end the testing until a set test time is reached to obtain a test result.
Wherein, the forwarding manner in the customized parameter is forwarding through a forwarding tool or forwarding through a kernel, and if the forwarding manner in the customized parameter is forwarding through the kernel, the test module is further configured to, before sending the data packet defined based on the customized parameter to the second terminal: and establishing an ARP binding relationship between the IP address and the MAC address of the second terminal on the first terminal based on the basic parameters, and establishing an ARP binding relationship between the IP address and the MAC address of the first terminal on the second terminal. If the forwarding manner in the customized parameter is forwarding through a forwarding tool, before sending the data packet defined based on the customized parameter to the second terminal, the test module is further configured to: and installing a DPDK environment required by data transmission on the second terminal, wherein the DPDK environment comprises the forwarding tool.
Optionally, before sending the data packet defined based on the customized parameter to the second terminal, the testing module is further configured to: and determining that the first terminal and the second terminal can normally communicate with each other.
The network card testing device 100 provided in the embodiment of the present application has the same implementation principle and technical effect as those of the foregoing method embodiments, and for brief description, reference may be made to corresponding contents in the foregoing method embodiments for the parts of the device embodiments that are not mentioned.
As shown in fig. 5, fig. 5 is a block diagram illustrating a structure of an electronic device 200 according to an embodiment of the present disclosure. The electronic device 200 includes: a transceiver 210, a memory 220, a communication bus 230, and a processor 240.
The elements of the transceiver 210, the memory 220, and the processor 240 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, the components may be electrically coupled to each other via one or more communication buses 230 or signal lines. The transceiver 210 is used for transceiving data. The memory 220 is used for storing a computer program, such as the software functional module shown in fig. 4, i.e., the network card testing apparatus 100. The network card testing apparatus 100 includes at least one software functional module, which may be stored in the memory 220 in the form of software or Firmware (Firmware) or solidified in an Operating System (OS) of the electronic device 200. The processor 240 is configured to execute executable modules stored in the memory 220, such as software functional modules or computer programs included in the network card testing apparatus 100. For example, the processor 240 is configured to obtain preconfigured basic parameters for network communication and customized parameters for defining a network packet and a forwarding manner thereof; remotely logging in a second terminal according to the basic parameters, and installing a network driving component required by testing on the first terminal; sending a data packet defined based on the customization parameters to the second terminal for customization testing, and controlling the second terminal to forward the data packet to the first terminal based on a forwarding mode in the customization parameters; and receiving the data packet forwarded by the second terminal and counting related data until the set test time is reached, and ending the test to obtain a test result.
The Memory 220 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like.
The processor 240 may be an integrated circuit chip having signal processing capabilities. The processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor 240 may be any conventional processor or the like.
The electronic device 200 includes, but is not limited to, a computer, and may be a server or the like.
The embodiment of the present application further provides a non-volatile computer-readable storage medium (hereinafter, referred to as a storage medium), where the storage medium stores a computer program, and the computer program is executed by the computer, such as the electronic device 200, to execute the network card testing method described above.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the present application, or portions thereof, may be substantially or partially embodied in the form of a software product stored in a computer-readable storage medium, which includes several instructions for causing a computer device (which may be a personal computer, a notebook computer, a server, or an electronic device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned computer-readable storage media comprise: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (10)
1.A network card testing method is characterized by being applied to a first terminal provided with a TRex tool, and comprises the following steps:
acquiring pre-configured basic parameters for network communication and customized parameters for defining a network data packet and a forwarding mode thereof, wherein the basic parameters comprise a first terminal internet access IP, a first terminal internet access name, a second terminal internet access IP, a second terminal internet access name, a second terminal system login user name and a second terminal system login password;
remotely logging in a second terminal according to a second terminal internet access name, a second terminal system login user name and a second terminal system login password in the basic parameters, installing a network driving component required by testing on the first terminal, modifying the internet access name in the configuration file of the TRex tool into the first terminal internet access name defined in the basic parameters, and modifying the IP addresses of two ends in the configuration file of the TRex tool into the first terminal internet access IP and the second terminal internet access IP defined in the basic parameters; the first terminal and the second terminal are connected back to back and have IP addresses belonging to the same network segment;
calling the TRex tool to send a data packet defined based on the customization parameters to the second terminal for customization testing, and controlling the second terminal to forward the data packet to the first terminal based on a forwarding mode in the customization parameters;
and receiving the data packet forwarded by the second terminal and counting related data until the set test time is reached, and ending the test to obtain a test result.
2. The method of claim 1, wherein the customized parameters are forwarded by a forwarding tool or by a kernel.
3. The method of claim 2, wherein the basic parameters further comprise: a first terminal network port MAC address and a second terminal network port MAC address; if the forwarding mode in the customized parameter is forwarding through a kernel, before sending a data packet defined based on the customized parameter to the second terminal, the method further includes:
and establishing an ARP binding relationship between the IP address and the MAC address of the second terminal on the first terminal based on the basic parameters, and establishing an ARP binding relationship between the IP address and the MAC address of the first terminal on the second terminal.
4. The method according to claim 2, wherein if the forwarding manner in the customized parameters is forwarding by a forwarding tool, before sending the data packet defined based on the customized parameters to the second terminal, the method further comprises:
and installing a DPDK environment required by data transmission on the second terminal, wherein the DPDK environment comprises the forwarding tool.
5. The method of claim 1, wherein before sending the data packet defined based on the customization parameters to the second terminal, the method further comprises:
and determining that the first terminal and the second terminal can normally communicate with each other.
6. The method of claim 1, wherein the customized test comprises one of a network card function test, a performance test, and a stress test.
7. The utility model provides a network card testing arrangement which characterized in that is applied to the first terminal of installing the TRex instrument, the device includes:
the system comprises an acquisition parameter module, a forwarding module and a parameter setting module, wherein the acquisition parameter module is used for acquiring a preconfigured basic parameter for network communication and a customized parameter for defining a network data packet and a forwarding mode thereof, and the basic parameter comprises a first terminal internet access IP, a first terminal internet access name, a second terminal internet access IP, a second terminal internet access name, a second terminal system login user name and a second terminal system login password;
the login module is used for remotely logging in a second terminal according to a second terminal internet access name, a second terminal system login user name and a second terminal system login password in the basic parameters, and the first terminal and the second terminal are connected back to back and have IP addresses belonging to the same network segment;
the testing module is used for installing a network driving component required by testing on the first terminal, modifying the network port name in the configuration file of the TRex tool into the first terminal network port name defined in the basic parameters, and modifying the IP addresses of two ends in the configuration file of the TRex tool into the first terminal network port IP and the second terminal network port IP defined in the basic parameters; and calling the TRex tool to send a data packet defined based on the customization parameters to the second terminal for customization testing, controlling the second terminal to forward the data packet to the first terminal based on a forwarding mode in the customization parameters, receiving the data packet forwarded by the second terminal and counting related data, and ending the testing until a set testing time is reached to obtain a testing result.
8. The network card testing device of claim 7, wherein the basic parameters further comprise: a first terminal network port MAC address and a second terminal network port MAC address; if the forwarding manner in the customized parameter is forwarding through a kernel, before sending the data packet defined based on the customized parameter to the second terminal, the test module is further configured to: and establishing an ARP binding relationship between the IP address and the MAC address of the second terminal on the first terminal based on the basic parameters, and establishing an ARP binding relationship between the IP address and the MAC address of the first terminal on the second terminal.
9. An electronic device, comprising:
a memory and a processor, the processor coupled to the memory;
the memory is used for storing programs;
the processor to invoke a program stored in the memory to perform the method of any of claims 1-6.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110826711.4A CN113489625B (en) | 2021-07-21 | 2021-07-21 | Network card testing method and device, electronic equipment and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110826711.4A CN113489625B (en) | 2021-07-21 | 2021-07-21 | Network card testing method and device, electronic equipment and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113489625A CN113489625A (en) | 2021-10-08 |
CN113489625B true CN113489625B (en) | 2023-04-07 |
Family
ID=77941907
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110826711.4A Active CN113489625B (en) | 2021-07-21 | 2021-07-21 | Network card testing method and device, electronic equipment and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113489625B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114020618B (en) * | 2021-10-30 | 2023-10-03 | 江苏信而泰智能装备有限公司 | High availability test method and system based on FPGA and DPDK |
CN114900450A (en) * | 2022-04-27 | 2022-08-12 | 北京计算机技术及应用研究所 | Network forwarding performance testing method based on high-speed data processing platform |
CN115022215B (en) * | 2022-05-25 | 2023-06-02 | 四川九州电子科技股份有限公司 | Method and system for testing MAC address of optical network unit |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107547299B (en) * | 2017-06-01 | 2020-12-25 | 新华三信息安全技术有限公司 | Test method and system |
CN107547304A (en) * | 2017-07-13 | 2018-01-05 | 紫光华山信息技术有限公司 | Network card testing method, device and machinable medium |
CN110351156B (en) * | 2018-04-03 | 2021-10-01 | 大唐移动通信设备有限公司 | Test method and device |
CN111786855B (en) * | 2020-06-30 | 2022-06-28 | 曙光信息产业(北京)有限公司 | Network card pressure testing method and device, electronic equipment and storage medium |
-
2021
- 2021-07-21 CN CN202110826711.4A patent/CN113489625B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN113489625A (en) | 2021-10-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113489625B (en) | Network card testing method and device, electronic equipment and computer readable storage medium | |
CN113411313B (en) | Data transmission method, device and system | |
Rosen | Linux kernel networking: Implementation and theory | |
US7742415B1 (en) | Non-intrusive knowledge suite for evaluation of latencies in IP networks | |
WO2013163852A1 (en) | Home gateway and method for analyzing network accessing behavior of user and monitoring network quality | |
US9473346B2 (en) | System and method for network path validation | |
CN101595686A (en) | Trigger the flow analysis at intermediate equipment place | |
WO2020135429A1 (en) | Traffic analysis method and apparatus, and traffic detection method and apparatus | |
CN115002008B (en) | Method, device, equipment and storage medium for measuring network delay | |
CN115277806A (en) | Cloud desktop connection method, device and equipment | |
CN112019407A (en) | Forwarding equipment data testing method and device, computer equipment and storage medium | |
CN113067810A (en) | Network packet capturing method, device, equipment and medium | |
US20160292245A1 (en) | Method and Device for Implementing Matching Between Acquisition System and Analysis System | |
CN115801629B (en) | Bidirectional forwarding detection method and device, electronic equipment and readable storage medium | |
WO2023173876A1 (en) | Data communication method and apparatus, device and medium | |
CN111786932A (en) | Account login method and device, electronic equipment and computer storage medium | |
CN112068784B (en) | Method for automatically switching multiple network cards of cloud printing equipment and cloud printing equipment | |
CN106301832B (en) | Method and device for processing system log message | |
CN108173717A (en) | A kind of method under User space by obtaining ICMP error message monitoring network situations | |
CN114598675A (en) | Control method, device, equipment and medium for realizing host blocking based on ARP | |
CN113890838A (en) | Network connectivity judgment method based on ICMP (Internet control protocol) | |
CN114095398A (en) | Method and device for determining detection time delay, electronic equipment and storage medium | |
CN113285904A (en) | RDP-based method for analyzing disk mapping file information | |
KR101777812B1 (en) | Network data processing speed measuring method and apparatus | |
Kim et al. | Entry Merging Method for Load Reduction on SOME/IP Service Discovery |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |