Testing methods, systems, devices, storage media, and electronic equipment for network devices

By creating multiple virtual interfaces and bridges in a virtual testing environment to forward data messages in parallel, the problem of low testing efficiency of network devices is solved, efficient multi-port parallel sending and receiving is achieved, and testing costs are reduced.

CN116112413BActive Publication Date: 2026-01-30INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310179870.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-28
Publication Date
2026-01-30
Estimated Expiration
2043-02-28

AI Technical Summary

Technical Problem

Among existing network device testing tools, hardware testers are complex and costly to automate, while open-source testing software supports a limited number of message types, resulting in low testing efficiency.

Method used

By acquiring the topology information of network devices, multiple virtual interfaces and virtual bridges are created in a virtual test environment to forward data messages in parallel. Virtualization technology is used to implement a multi-port parallel sending and receiving mechanism, and RPC message format is used to control message sending and capturing.

Benefits of technology

It improves the efficiency of network device testing, reduces reliance on hardware testers, lowers testing costs, and enables parallel transmission and reception across multiple ports, thus shortening testing time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116112413B_ABST
    Figure CN116112413B_ABST
Patent Text Reader

Abstract

This application provides a method, system, apparatus, storage medium, and electronic device for testing network devices. The method includes: acquiring topology information of the network device, which includes at least interface information and connection information; creating a virtual test environment corresponding to the network device based on the topology information, wherein the virtual test environment includes at least multiple virtual interfaces and virtual bridges; and testing the network device by parallel forwarding data messages through the multiple virtual interfaces and virtual bridges to obtain test results. This application solves the technical problem of low testing efficiency caused by the complexity and high cost of network testing in related technologies, thereby improving the efficiency of network device testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and more specifically, to a method, system, apparatus, storage medium, and electronic device for testing network devices. Background Technology

[0002] Switches, routers, firewalls, and other network devices, as fundamental network equipment responsible for data forwarding in data centers, are key factors affecting overall network performance. Their ability to forward and process various network packets is a crucial metric for evaluating these devices. Network equipment providers invest significant resources in comprehensive testing of product functionality and performance during the product development phase. Therefore, network equipment testing tools play a vital role in both product development and production. Network testing equipment in related technologies includes hardware testers and open-source testing software. However, the automation of hardware testers is complex and costly, while open-source testing software supports a limited range of packet data types. Consequently, the testing efficiency of network devices in related technologies is relatively low.

[0003] There is currently no effective solution to the above problems. Summary of the Invention

[0004] This application provides a method, system, apparatus, storage medium, and electronic device for testing network devices, in order to at least solve the technical problem of low testing efficiency for network devices in related technologies.

[0005] According to one embodiment of this application, a method for testing a network device is provided, comprising: acquiring topology information of the network device, the topology information including at least interface information and connection information of the network device; creating a virtual test environment corresponding to the network device based on the topology information, wherein the virtual test environment includes at least: multiple virtual interfaces and virtual bridges; testing the network device by forwarding data messages in parallel through multiple virtual interfaces and virtual bridges, and obtaining test results of the network device.

[0006] In one exemplary embodiment, creating multiple virtual interfaces and a virtual bridge based on topology information includes: using virtualization technology to create multiple virtual interfaces within a container and creating a virtual bridge; and adding the multiple virtual interfaces to the virtual bridge based on topology information.

[0007] In an exemplary embodiment, the virtual test environment further includes a client and a server, which test the network device by forwarding data messages in parallel through multiple virtual interfaces and virtual bridges, and obtain the test results of the network device. This includes: creating a message polling thread between the client and the server, which is used to receive messages sent by the client or the server; sending control messages to the server through the client; and testing the network device by forwarding data messages in parallel through multiple virtual interfaces and virtual bridges based on the control messages, and obtaining the test results.

[0008] In one exemplary embodiment, the network device is tested by a server based on control messages and forwarding data messages in parallel through multiple virtual interfaces and virtual bridges to obtain test results. This includes: parsing the message transmission message and message capture message respectively, where the control message contains both, to obtain message transmission information and message capture information. The message transmission information includes at least a first data message and transmission parameters, and the message capture information includes at least a target virtual interface. The server then sends the first data message to the network device based on the transmission parameters through multiple virtual interfaces and virtual bridges. The server receives the second data message sent by the network device through the target virtual interface and virtual bridge. Finally, the test results are determined based on the first and second data messages.

[0009] In one exemplary embodiment, a server sends a first data message to a network device through multiple virtual interfaces and a virtual bridge based on sending parameters, including: creating a sending thread based on the sending parameters; and calling a sending function based on the sending thread to send the first data message through the virtual bridge.

[0010] In one exemplary embodiment, receiving a second data message sent by a network device via a target virtual interface and a virtual bridge by a server includes: creating a capture thread based on the target virtual interface; and calling a capture function based on the capture thread to capture the second data message via the virtual bridge.

[0011] In one exemplary embodiment, determining a test result based on a first data message and a second data message includes: generating feedback data on the server based on the first data message and the second data message; sending the feedback data to the client through a message polling thread; and determining the test result on the client based on the feedback data.

[0012] According to another embodiment of this application, a network device testing system is provided, comprising: a control device connected to the network device for testing the network device; and a network device for receiving message transmission messages and message capture messages sent by the control device.

[0013] In one exemplary embodiment, a control device includes: a client connected to a server, configured to send message sending messages and message capture messages to the server, wherein the message sending information includes at least: a first data message and sending parameters, and the message capture information includes at least: a target virtual interface; and a server connected to a network device, configured to send the first data message to the network device through multiple virtual interfaces and virtual bridges based on the sending parameters.

[0014] According to another embodiment of this application, a testing apparatus for a network device is provided, comprising: an acquisition module for acquiring topology information of the network device, wherein the topology information includes at least interface information and connection information of the network device; a creation module for creating a virtual test environment corresponding to the network device based on the topology information, wherein the virtual test environment includes at least: multiple virtual interfaces and virtual bridges; and a testing module for testing the network device by forwarding data messages in parallel through multiple virtual interfaces and virtual bridges, thereby obtaining test results of the network device.

[0015] According to yet another embodiment of this application, a computer-readable storage medium is also provided, in which a computer program is stored, wherein the computer program is configured to execute the steps in any of the above-described network device test method embodiments when running.

[0016] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above-described network device testing method embodiments.

[0017] This application utilizes multiple virtual interfaces and virtual bridges created based on the network device's interface and connection information. Data messages are then forwarded in parallel through these virtual interfaces and bridges, thereby enabling network device testing. Notably, the parallel processing of multiple ports reduces testing time, and the use of virtualized interfaces allows for multi-port parallel transmission and reception, further improving testing efficiency. Therefore, this addresses the low efficiency of network device testing in related technologies, achieving a significant improvement in testing efficiency. Attached Figure Description

[0018] Figure 1 This is a hardware structure block diagram of a mobile terminal for a network device testing method according to an embodiment of this application.

[0019] Figure 2 This is a flowchart of a test of a network device according to an embodiment of this application;

[0020] Figure 3 This is a schematic diagram of a virtual testing environment according to an embodiment of this application;

[0021] Figure 4 This is a schematic diagram of a test system framework according to an embodiment of this application;

[0022] Figure 5 This is a schematic diagram of an RPC message format according to an embodiment of this application;

[0023] Figure 6 This is a schematic diagram of a message interaction according to an embodiment of this application;

[0024] Figure 7 This is a flowchart of server-side sending and receiving according to an embodiment of this application;

[0025] Figure 8 This is a schematic diagram of a network device testing system according to an embodiment of this application;

[0026] Figure 9 This is a structural block diagram of a network device detection apparatus according to an embodiment of this application. Detailed Implementation

[0027] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.

[0028] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0029] First, some nouns or terms that appear in the description of the embodiments of this application shall be interpreted as follows:

[0030] VLAN: Virtual Local Area Network, used to represent a virtual local area network.

[0031] RPC: Remote Procedure Call, is a message format used to represent remote program calls.

[0032] Ethernet: refers to Ethernet.

[0033] Socket: refers to a socket.

[0034] Trunk: refers to the main trunk or trunk.

[0035] DUT: Device Under Test, used to refer to the device under test.

[0036] Current network testing equipment includes hardware testers and open-source testing software. Both of these methods have the following drawbacks:

[0037] Hardware testers typically consist of control software, a chassis, and interface cards, physically enabling parallel transmission and reception across multiple ports. They can perform functional and performance testing on DUTs (Device Under Test), as well as extensive protocol conformance testing. The main drawbacks of hardware-based tester solutions are: firstly, they are limited by hardware board design, resulting in a fixed number of interfaces that cannot be dynamically adjusted according to testing needs; secondly, automation is complex, involving multiple layers of encapsulation and numerous interfaces, making it difficult to master; and thirdly, the cost is enormous, ranging from tens of thousands to hundreds of thousands of yuan for a single tester, including software, hardware, services, and licenses, consuming a significant portion of the R&D budget.

[0038] Network testing using open-source testing software typically employs a client / server architecture to achieve point-to-point traffic sending and receiving. However, open-source testing software cannot achieve parallel sending and receiving control across multiple ports, and the types of protocols or simulated packets it supports are also very limited.

[0039] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a network device testing method according to an embodiment of this application. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0040] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the network device testing method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0041] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0042] This embodiment provides a method that runs on the aforementioned mobile terminal. Figure 2 This is a flowchart of a test for a network device according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:

[0043] Step S202: Obtain the topology information of the network devices, which includes at least the interface information and connection information of the network devices.

[0044] The aforementioned network devices can be switches, routers, or other network devices connected via switches, or other network devices not connected via switches. Optionally, the network devices can be connected to a virtual testing environment, which is used to connect to the network devices and interact with data to test the network connected to the network devices. The aforementioned network can be a distributed network.

[0045] The aforementioned topology information can be created by the user in advance and stored in the network device. Optionally, the aforementioned topology information can also be created by the control device in the virtual test environment based on the information of the network device. The information of the network device may include the interface type, number of interfaces, and connection method of the interface.

[0046] The interface information mentioned above may include the number of interfaces, the types of interfaces, and the traffic of data sent and received by the interfaces.

[0047] The connection information mentioned above can include the connection methods and relationships of the network device's interfaces. Connection methods can include serial connections, parallel connections, etc. Connection relationships can include the connection relationships between each interface on the network device and other interfaces on the network device, as well as the connection relationships between each interface on the network device and interfaces on external devices.

[0048] In one alternative embodiment, the number and type of interfaces in a network device, as well as the connection method of the interfaces, can be obtained through a control device in a virtual testing environment. This allows the network speed, network strength, and other network conditions of the network connected to the network device to be tested using the virtual testing environment.

[0049] Step S204: Create a virtual test environment corresponding to the network device based on the topology information. The virtual test environment includes at least: multiple virtual interfaces and virtual bridges.

[0050] The virtual interface mentioned above can be a test interface in a virtual testing environment. Optionally, the virtual interface can be connected to the interface of a network device through a virtual bridge.

[0051] The aforementioned virtual bridge can be used to connect virtual interfaces and network device interfaces, enabling data exchange between the virtual interfaces and network device interfaces, and further enabling testing of network devices.

[0052] In one optional embodiment, after obtaining the topology information of the network device, multiple virtual interfaces and virtual bridges corresponding to the virtual test environment can be created based on the interface information and connection information of the interface in the network device, and the original virtual test environment can be personalized to generate a virtual test environment corresponding to the network device.

[0053] In another alternative embodiment, the system's control device can directly obtain the topology information of the network device and create a virtual test environment based on the interface information and connection information of the interface in the network device, thereby enabling the network device to be tested using the virtual test environment.

[0054] Step S206: Test the network device by forwarding data messages in parallel through multiple virtual interfaces and virtual bridges, and obtain the test results of the network device.

[0055] In one optional embodiment, multiple virtual interfaces can transmit messages in parallel. After obtaining multiple virtual interfaces and a virtual bridge, the multiple virtual interfaces and network device interfaces can be placed into the virtual bridge, thereby connecting the multiple virtual interfaces and network device interfaces. Furthermore, data can be transmitted through the connected multiple virtual interfaces and network device interfaces, and the data transmitted through the multiple virtual interfaces and network device interfaces can be analyzed to achieve testing of the network device.

[0056] By employing the technical solutions disclosed in this application, testers and developers can be freed from their reliance on hardware testing equipment when testing network devices, thereby significantly reducing testing costs. Furthermore, the use of virtualization technology makes topology management more flexible and efficient, enabling the generation of a distributed parallel interface transmission and reception mechanism, further greatly improving testing efficiency. Moreover, the technical methods disclosed in this application can also be applied to cloud computing network testing or to testing network interface cards (NICs).

[0057] This application utilizes multiple virtual interfaces and virtual bridges created based on the network device's interface and connection information. Data messages are then forwarded in parallel through these virtual interfaces and bridges, thereby enabling network device testing. Notably, the parallel processing of multiple ports reduces testing time, and the use of virtualized interfaces allows for multi-port parallel transmission and reception, further improving testing efficiency. Therefore, this addresses the low efficiency of network device testing in related technologies, achieving a significant improvement in testing efficiency.

[0058] In one exemplary embodiment, creating multiple virtual interfaces and a virtual bridge based on topology information includes: using virtualization technology to create multiple virtual interfaces within a container and creating a virtual bridge; and adding the multiple virtual interfaces to the virtual bridge based on topology information.

[0059] In subsequent optional embodiments, the above-described virtualization technology enables computing units to run on a virtual basis, thereby creating multiple virtual interfaces and virtual bridges in the virtual testing environment. This allows for dynamic changes in network topology and further enables testing to be conducted without relying on hardware testing equipment, achieving the effect of parallel testing of a large number of network device ports.

[0060] In one optional embodiment, assuming the network device is a switch, when the test begins, the obtained topology information can be read first, and then the automated program can create multiple virtual interfaces for sending traffic in the socket container and create a virtual bridge. At the same time, the multiple virtual interfaces and the switch ports are added to the bridge, and the corresponding switch addresses are configured, thereby realizing the dynamic physical connection between the test interface and the switch port.

[0061] Figure 3 This is a schematic diagram of a virtual testing environment according to an embodiment of this application, such as... Figure 3 As shown, in a virtual testing environment, virtual interfaces and switches are connected via virtual bridges. Multiple network devices can be connected to the other end of the switch, allowing the network devices to be tested using the virtual testing environment.

[0062] In an exemplary embodiment, the virtual test environment further includes a client and a server, which test the network device by forwarding data messages in parallel through multiple virtual interfaces and virtual bridges, and obtain the test results of the network device. This includes: creating a message polling thread between the client and the server, which is used to receive messages sent by the client or the server; sending control messages to the server through the client; and testing the network device by forwarding data messages in parallel through multiple virtual interfaces and virtual bridges based on the control messages, and obtaining the test results.

[0063] The aforementioned client can be a control plane program for sending and receiving traffic. Optionally, the client can decide when to send messages, when to receive messages, and what kind of messages to send. Furthermore, the client can send message commands to the server to instruct the server to perform message sending and message capture.

[0064] The aforementioned server can be a data plane program for sending and receiving traffic. Optionally, the server can execute commands issued by the client to send and capture messages.

[0065] The aforementioned message polling thread can be used to connect the client and the server, thereby enabling message transmission between them.

[0066] Figure 4 This is a schematic diagram of a test system framework according to an embodiment of this application, such as... Figure 4As shown, the test system can be divided into a control plane and a data plane. The control plane represents the client, which can control packet sending and receiving via an automated main control program based on a message polling thread, controlling the server to send and capture messages. The data plane represents the server, which can receive data sent by the client based on a message polling thread and send and capture messages through multiple virtual interfaces using different sending and receiving threads. Optionally, the client and server can communicate via a bidirectional communication connection using a message polling thread.

[0067] In one alternative embodiment, the client can send messages to the server using the RPC (Remote Procedure Call) message format. Figure 5 This is a schematic diagram of an RPC message format according to an embodiment of this application, such as... Figure 5 As shown, the RPC message format can include information such as message length, message type, port type, characters, and protocol.

[0068] The following example illustrates that the types of messages sent by the client can be:

[0069] RPC_MSG_START_SEND, where RPC_MSG_START_SEND can indicate the start, indicating that the server has begun sending messages;

[0070] RPC_MSG_STOP_SEND, where RPC_MSG_STOP_SEND can be interpreted as instructing the server to stop sending messages;

[0071] RPC_MSG_START_CAPTURE, where RPC_MSG_START_CAPTURE can be interpreted as indicating that the server should begin capturing messages;

[0072] RPC_MSG_STOP_CAPTURE, where RPC_MSG_STOP_CAPTURE can be interpreted as instructing the server to stop capturing messages.

[0073] Furthermore, due to the decoupling of the control plane and data plane, the data plane server uses multi-threading to control the sending and receiving of messages on each interface, thus enabling distributed parallel sending and receiving across multiple ports without interference between them. Optionally, by parsing the messages sent and captured by the server, network devices can be tested.

[0074] The automated testing environment disclosed in this application simulates a multi-port distributed network testing environment using software, leveraging socket and virtual bridge technologies, enabling dynamic changes to the network topology. For network devices such as switches and routers, virtualization technology based on an RPC message model is employed to simulate a multi-port distributed network testing environment. This allows testing to proceed without relying on hardware testing equipment, further achieving the effect of parallel testing of a large number of ports on network devices.

[0075] In one exemplary embodiment, the network device is tested by a server based on control messages and forwarding data messages in parallel through multiple virtual interfaces and virtual bridges to obtain test results. This includes: parsing the message transmission message and message capture message respectively, where the control message contains both, to obtain message transmission information and message capture information. The message transmission information includes at least a first data message and transmission parameters, and the message capture information includes at least a target virtual interface. The server then sends the first data message to the network device based on the transmission parameters through multiple virtual interfaces and virtual bridges. The server receives the second data message sent by the network device through the target virtual interface and virtual bridge. Finally, the test results are determined based on the first and second data messages.

[0076] The first data message mentioned above can be a message sent by the server to the network device.

[0077] The aforementioned sending parameters can be used to represent information such as character protocols.

[0078] The target virtual interface mentioned above can be the virtual interface used when capturing packets.

[0079] The second data message mentioned above can be data captured by the server from network devices.

[0080] Figure 6 This is a schematic diagram of a message interaction according to an embodiment of this application, such as... Figure 6As shown, after the client and server establish a connection, the client can send an instruction to the server in RPC message format, indicating that the server needs to start sending messages to the network device. Upon receiving the instruction, the server will create a sending thread, which can then be used to send packets. Furthermore, after sending is complete, the server needs to send feedback data to the client indicating completion, which can also be sent in RPC message format. Optionally, the client can also send an instruction to the server in RPC message format, indicating that the server needs to start capturing messages sent by the network device. Upon receiving the instruction, the server will create a capture thread, which can then be used to capture packets. Furthermore, after capturing packets, the server needs to send feedback data to the client indicating completion, which can also be sent in RPC message format.

[0081] Optionally, after each receive or capture thread ends, the server returns the sending or receiving results of each interface to the client, thereby enabling the statistics of the sending or receiving status of each interface, and determining whether the final result is correct based on the input of the automated script, thus achieving the purpose of testing the network device.

[0082] In one exemplary embodiment, a server sends a first data message to a network device through multiple virtual interfaces and a virtual bridge based on sending parameters, including: creating a sending thread based on the sending parameters; and calling a sending function based on the sending thread to send the first data message through the virtual bridge.

[0083] In one optional embodiment, the server can send a first data message to the network device through multiple virtual interfaces and virtual bridges based on sending parameters, thereby realizing message transmission. Optionally, after receiving an instruction from the client, the server can first create a sending thread, which can be used to send messages. After the sending thread is successfully created, a sending function in related technologies can be called to send messages based on the sending thread. The sending function can be the `send` function, and optionally, the `send` function can be used to send messages to a socket.

[0084] To illustrate, in the data plane, when the server polls for RPC messages and receives the message RPC_MSG_START_SEND, it can create a sending thread for each interface based on the port type information in the message field, call the sending function to send the message, and optionally, send a sending status message back to the client to notify that the task being sent on that port has been completed.

[0085] In one exemplary embodiment, receiving a second data message sent by a network device via a target virtual interface and a virtual bridge by a server includes: creating a capture thread based on the target virtual interface; and calling a capture function based on the capture thread to capture the second data message via the virtual bridge.

[0086] In one optional embodiment, the server can capture second data messages from network devices through multiple virtual interfaces and virtual bridges based on sending parameters, thereby achieving packet capture. Optionally, after receiving an instruction from the client, the server can first create a capture thread, which can be used to capture packets. After the sending thread is successfully created, a capture function in related technologies can be called to capture packets based on the sending thread. The capture function can be a sniffer function, and optionally, the sniffer function (also called a capturer function) is a method for collecting data.

[0087] To illustrate, when the message `RPC_MSG_START_CAPTURE` is received, a capture thread can be created for each interface to be captured, based on the port type information in the message field. The capture function is then called to capture messages on that interface. Simultaneously, once the capture is complete, a capture status message can be sent back to the client, notifying them that the task of capturing messages on that port has been finished.

[0088] In one exemplary embodiment, determining a test result based on a first data message and a second data message includes: generating feedback data on the server based on the first data message and the second data message; sending the feedback data to the client through a message polling thread; and determining the test result on the client based on the feedback data.

[0089] In one optional embodiment, after the server has completed sending or capturing a message, it needs to provide feedback to the client. Optionally, the feedback can be provided to the client using an RPC message format.

[0090] Figure 7 This is a flowchart of a server-side sending and receiving process according to an embodiment of this application, such as... Figure 7 As shown, when the server receives the client's instruction, it can use the main thread to create multiple threads. Optionally, the multiple threads can be scheduled to obtain different sending and receiving threads, such as sending thread 1, sending thread 2, sending thread n, receiving thread 1, receiving thread 2, receiving thread n, etc. Optionally, after creating multiple sending and receiving threads, the main thread can be returned through scheduling.

[0091] This application employs virtualization technology and, based on the RPC message format, simulates a multi-port distributed network testing environment. By utilizing virtual interfaces and virtual bridge technologies, a multi-port distributed network testing environment is created, enabling dynamic changes to the network topology. Furthermore, the sending and receiving of messages on each port is controlled using the RPC message format, thereby decoupling the automated script control plane from the data forwarding plane, and thus achieving distributed parallel data sending or receiving on each port.

[0092] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the related technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0093] This embodiment also provides a network device detection system, which is used to implement the above embodiments and preferred embodiments. Details that have been described will not be repeated here. Figure 8 This is a schematic diagram of a network device testing system according to an embodiment of this application, such as... Figure 8 As shown, the system includes the following components:

[0094] Control device 82 and network device 84, wherein control device 82 includes client 8201 and server 8202.

[0095] The control device 82 is connected to the network device 84 and is used to test the network device. The network device 84 is used to receive message sending messages and message capture messages sent by the control device. The client 8210 is connected to the server 8202 and is used to send message sending messages and message capture messages to the server 8202. The message sending information includes at least a first data message and sending parameters, and the message capture information includes at least a target virtual interface. The server 8202 is connected to the network device 84 and is used to send the first data message to the network device 84 through multiple virtual interfaces and virtual bridges based on the sending parameters.

[0096] This embodiment also provides a network device detection apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0097] Figure 9 This is a structural block diagram of a network device detection apparatus according to an embodiment of this application, such as... Figure 9 As shown, the device includes:

[0098] The acquisition module 902 is used to acquire the topology information of the network device, which includes at least the interface information and connection information of the network device.

[0099] Module 904 is used to create virtual test environments for network devices based on topology information. The virtual test environment includes at least multiple virtual interfaces and virtual bridges.

[0100] Test module 906 is used to test network devices by forwarding data messages in parallel through multiple virtual interfaces and virtual bridges, and to obtain the test results of the network devices.

[0101] In an exemplary embodiment, the creation module 904 includes: a first creation unit, configured to create multiple virtual interfaces within a container using virtualization technology, and to create a virtual bridge; and an addition unit, configured to add the multiple virtual interfaces to the virtual bridge based on topology information.

[0102] In one exemplary embodiment, the test module 906 includes: a second creation unit, configured to create a message polling thread between the client and the server, the message polling thread being used to receive messages sent by the client or the server; a control unit, configured to send control messages to the server through the client; and a test unit, configured to test the network device by forwarding data messages in parallel through multiple virtual interfaces and virtual bridges based on the control messages through the server, and obtain test results.

[0103] In one exemplary embodiment, the testing unit includes: a parsing subunit, configured to parse the message sending message and the message capturing message respectively, to obtain message sending information and message capturing information, wherein the message sending information includes at least: a first data message and sending parameters, and the message capturing information includes at least: a target virtual interface; a sending subunit, configured to send the first data message to the network device through multiple virtual interfaces and virtual bridges based on the sending parameters via a server; a receiving subunit, configured to receive the second data message sent by the network device through the target virtual interface and virtual bridge via a server; and a determining subunit, configured to determine the test result based on the first data message and the second data message.

[0104] In one exemplary embodiment, the sending subunit is further configured to create a sending thread based on sending parameters; and based on the sending thread, call a sending function to send a first data message through a virtual bridge.

[0105] In one exemplary embodiment, the receiving subunit is further configured to create a capture thread based on the target virtual interface; and based on the capture thread, call a capture function to capture a second data message through a virtual bridge.

[0106] In one exemplary embodiment, the determined subunit is further configured to generate feedback data via the server based on the first data message and the second data message; send the feedback data to the client via a message polling thread; and determine the test result via the client based on the feedback data.

[0107] According to yet another embodiment of this application, a computer-readable storage medium is also provided, in which a computer program is stored, wherein the computer program is configured to execute the steps in any of the above-described network device test method embodiments when running.

[0108] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above-described network device testing method embodiments.

[0109] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0110] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.

[0111] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0112] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0113] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0114] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0115] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0116] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.

Claims

1. A test method of a network device, characterized by, The method comprises: obtaining topology information of a network device, wherein the topology information at least comprises interface information and connection information of the network device, and the connection information comprises a connection relationship between each interface on the network device and other interfaces on the network device and a connection relationship between each interface and an interface on an external device; creating a virtual test environment corresponding to the network device based on the topology information, wherein the virtual test environment at least comprises a plurality of virtual interfaces and a virtual bridge, the virtual bridge is determined based on the topology information and the plurality of virtual interfaces, the virtual interface and a switch are connected through the virtual bridge, one end of the switch is connected to the virtual bridge, and the other end of the switch is connected to a plurality of network devices; performing testing on the network device by forwarding data messages through the plurality of virtual interfaces and the virtual bridge in parallel to obtain a test result of the network device.

2. The method of claim 1, wherein, creating a plurality of virtual interfaces and a virtual bridge based on the topology information comprises: creating the plurality of virtual interfaces and the virtual bridge in a container by using virtualization technology; adding the plurality of virtual interfaces to the virtual bridge based on the topology information.

3. The method of claim 1, wherein, The virtual test environment further comprises a client and a server, and the method of performing testing on the network device by forwarding data messages through the plurality of virtual interfaces and the virtual bridge in parallel to obtain a test result of the network device comprises: creating a message polling thread between the client and the server, wherein the message polling thread is used to receive a message sent by the client or the server; sending a control message from the client to the server; performing testing on the network device by forwarding data messages through the plurality of virtual interfaces and the virtual bridge in parallel based on the control message by the server to obtain the test result.

4. The method of claim 3, wherein, Performing testing on the network device by forwarding data messages through the plurality of virtual interfaces and the virtual bridge in parallel based on the control message by the server to obtain the test result comprises: in a case where the control message comprises a packet sending message and a packet capturing message, respectively analyzing the packet sending message and the packet capturing message to obtain packet sending information and packet capturing information, wherein the packet sending information at least comprises a first data message and sending parameters, and the packet capturing information at least comprises a target virtual interface; sending the first data message to the network device through the plurality of virtual interfaces and the virtual bridge based on the sending parameters by the server; receiving a second data message sent by the network device through the target virtual interface and the virtual bridge by the server; determining the test result based on the first data message and the second data message.

5. The method of claim 4, wherein, Sending the first data message to the network device through the plurality of virtual interfaces and the virtual bridge based on the sending parameters by the server comprises: creating a sending thread based on the sending parameters; calling a sending function to send the first data message through the virtual bridge based on the sending thread.

6. The method of claim 4, wherein, receiving, by the service end, a second data message sent by the network device through the target virtual interface and the virtual bridge, comprising: creating a capture thread based on the target virtual interface; calling a capture function to capture the second data message through the virtual bridge based on the capture thread.

7. The method of claim 4, wherein, determining the test result based on the first data message and the second data message, comprising: generating feedback data by the service end based on the first data message and the second data message; sending the feedback data to the client by the message polling thread; determining the test result by the client based on the feedback data.

8. A test system for network devices, characterized by comprising: a control device and a network device, the control device being connected with the network device; the control device is used to test the network device by executing the method in any one of claims 1-7.

9. The system of claim 8, wherein, the control device creates a virtual test environment, the virtual test environment comprising: a client connected with a service end, used to send a message sending message and a message capturing message to the service end to instruct the service end to analyze the message sending message and the message capturing message respectively to obtain message sending information and message capturing information, wherein the message sending information at least includes a first data message and sending parameters, and the message capturing information at least includes a target virtual interface; a service end connected with the network device, used to send the first data message to the network device through a plurality of virtual interfaces and a virtual bridge based on the sending parameters.

10. A testing apparatus for a network device, the testing apparatus comprising: comprising: an acquisition module, used to acquire topology information of a network device, the topology information at least including interface information and connection information of the network device, wherein the connection information includes a connection relationship between each interface on the network device and other interfaces on the network device, and a connection relationship between each interface and an interface on an external device; a creation module, used to create a virtual test environment corresponding to the network device based on the topology information, wherein the virtual test environment at least includes a plurality of virtual interfaces and a virtual bridge, the virtual bridge being determined based on the topology information and the plurality of virtual interfaces, the virtual interface and a switch being connected through the virtual bridge, one end of the switch being connected with the virtual bridge, and the other end being connected with a plurality of network devices; a test module, used to test the network device by forwarding data messages in parallel through the plurality of virtual interfaces and the virtual bridge to obtain a test result of the network device.

11. A computer readable storage medium characterized by, The computer readable storage medium stores a computer program, wherein the computer program is executed by the processor to implement the steps of the network device test method in any one of claims 1-7.

12. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the network device test method in any one of claims 1-7.

Citation Information

Patent Citations

  • Equipment performance test method and system, computer equipment and storage medium

    CN108632110A

  • Test method and device

    CN110351156A

  • Test case based virtual machine (VM) template generation

    US20170155569A1