CN116112413A - Network equipment testing method, system, device, storage medium and electronic equipment - Google Patents

Network equipment testing method, system, device, storage medium and electronic equipment Download PDF

Info

Publication number
CN116112413A
CN116112413A CN202310179870.9A CN202310179870A CN116112413A CN 116112413 A CN116112413 A CN 116112413A CN 202310179870 A CN202310179870 A CN 202310179870A CN 116112413 A CN116112413 A CN 116112413A
Authority
CN
China
Prior art keywords
message
virtual
network
sending
server
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.)
Pending
Application number
CN202310179870.9A
Other languages
Chinese (zh)
Inventor
陈晓江
陈翔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202310179870.9A priority Critical patent/CN116112413A/en
Publication of CN116112413A publication Critical patent/CN116112413A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/12Discovery or management of network topologies

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the application provides a method, a system, a device, a storage medium and an electronic device for testing network equipment, wherein the method comprises the following steps: obtaining topology information of network equipment, wherein the topology information at least comprises interface information and connection information of the network equipment; creating a virtual test environment corresponding to the network equipment based on the topology information, wherein the virtual test environment at least comprises: a plurality of virtual interfaces and virtual bridges; and the data message is forwarded in parallel through a plurality of virtual interfaces and virtual bridges, and the network equipment is tested, so that a test result of the network equipment is obtained. Through the method and the device, the technical problem that the testing efficiency is low due to the fact that the testing process is complex and the testing cost is high in the related art when the network is tested is solved, and then the technical effect of improving the efficiency of testing the network equipment is achieved.

Description

Network equipment testing method, system, device, storage medium and electronic equipment
Technical Field
The embodiment of the application relates to the field of computers, in particular to a method, a system, a device, a storage medium and electronic equipment for testing network equipment.
Background
Network devices such as a switch, a router, a firewall and the like are used as basic network devices responsible for data forwarding in a data center, which are key problems affecting the overall performance of the network, and forwarding and processing capabilities of various network messages are important indexes for measuring the network devices. Network equipment providers can input a large amount of resources to comprehensively test the functions and performances of products in the research and development stage of the products, so that testing tools of the network equipment play a very important role in the research and development stage and the production stage of the products. The network test equipment in the related art comprises a hardware tester and open source test software, wherein the automation of the hardware tester is complex, the cost is high, and the type of message data supported by the open source test software is limited, so that the test efficiency of the network equipment in the related art is low.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the application provides a method, a system, a device, a storage medium and electronic equipment for testing network equipment, which are used for at least solving the technical problem of low test efficiency of the network equipment in the related technology.
According to one embodiment of the present application, there is provided a method for testing a network device, including: obtaining topology information of network equipment, wherein the topology information at least comprises interface information and connection information of the network equipment; creating a virtual test environment corresponding to the network equipment based on the topology information, wherein the virtual test environment at least comprises: a plurality of virtual interfaces and virtual bridges; and the data message is forwarded in parallel through a plurality of virtual interfaces and virtual bridges, and the network equipment is tested, so that a test result of the network equipment is obtained.
In one exemplary embodiment, creating a plurality of virtual interfaces and virtual bridges based on topology information includes: creating a plurality of virtual interfaces in the container and creating a virtual bridge by using a virtualization technology; a plurality of virtual interfaces are added to the virtual bridge based on the topology information.
In an exemplary embodiment, the virtual test environment further includes a client and a server, and the data message is forwarded in parallel through a plurality of virtual interfaces and virtual bridges, and the network device is tested to obtain a test result of the network device, including: creating a message polling thread between the client and the server, wherein the message polling thread is used for receiving a message sent by the client or the server; sending a control message to a server through a client; and the server side forwards the data message in parallel through a plurality of virtual interfaces and virtual bridges based on the control message, and tests the network equipment to obtain a test result.
In an exemplary embodiment, the server side forwards data messages in parallel through a plurality of virtual interfaces and virtual bridges based on the control messages, tests the network device to obtain test results, and the method includes: under the condition that the control message comprises a message sending message and a message capturing message, respectively analyzing the message sending message and the message capturing message to obtain the message sending message and the message capturing message, wherein the message sending message at least comprises: the first data message and the sending parameter, the message capturing information at least comprises: a target virtual interface; transmitting, by the server, a first data message to the network device through the plurality of virtual interfaces and the virtual bridge based on the transmission parameters; receiving a second data message sent by the network equipment through the target virtual interface and the virtual network bridge by the server; a test result is determined based on the first data message and the second data message.
In one exemplary embodiment, sending, by a server, a first data message to a network device over a plurality of virtual interfaces and virtual bridges based on a sending parameter, comprises: creating a sending thread based on the sending parameters; based on the sending thread, a sending function is called to send a first data message through the virtual bridge.
In an exemplary embodiment, receiving, by a server, a second data message sent by a network device through a target virtual interface and a virtual bridge, includes: creating a capture thread based on the target virtual interface; based on the capture thread, a capture function is invoked to capture the second data message through the virtual bridge.
In one exemplary embodiment, determining a test result based on the first data message and the second data message includes: generating feedback data based on the first data message and the second data message through the server; sending feedback data to the client through a message polling thread; and determining a test result based on the feedback data by the client.
According to another embodiment of the present application, there is provided a test system for a network device, including: the control equipment is connected with the network equipment and used for testing the network equipment; the network equipment is used for receiving the message sending information and the message capturing information sent by the control equipment.
In one exemplary embodiment, a control apparatus includes: the client is connected with the server and is used for sending a message sending message and a message capturing message to the server, wherein the message sending message at least comprises: the first data message and the sending parameter, the message capturing information at least comprises: a target virtual interface; the server is connected with the network equipment and is used for sending the first data message to the network equipment through a plurality of virtual interfaces and virtual bridges based on the sending parameters.
According to another embodiment of the present application, there is provided a test apparatus for a network device, including: the acquisition module is used for acquiring topology information of the network equipment, wherein the topology information at least comprises interface information and connection information of the network equipment; the creating module is configured to create a virtual test environment corresponding to the network device based on the topology information, where the virtual test environment at least includes: a plurality of virtual interfaces and virtual bridges; and the test module is used for forwarding the data message in parallel through a plurality of virtual interfaces and virtual bridges, testing the network equipment and obtaining the test result of the network equipment.
According to a further embodiment of the present application, there is also provided a computer readable storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of the test method embodiment of any of the above-mentioned network devices when run.
According to a further embodiment of the present application, there is also provided an electronic device comprising a memory, in which a computer program is stored, and a processor, which is arranged to run the computer program to perform the steps of the test method embodiment of any of the above-mentioned network devices.
According to the method and the device, the network equipment is tested because the plurality of virtual interfaces and the virtual bridges corresponding to the network equipment are created based on the interface information and the connection information of the network equipment, and the data messages are forwarded in parallel through the plurality of virtual interfaces and the virtual bridges. It is easy to notice that, because of adopting a plurality of ports to process in parallel, thus can shorten the detection time, because of adopting the virtualized interface, can realize the parallel transceiver mechanism of multiport, further promote the detection efficiency to the network equipment, therefore, can solve the technical problem that the efficiency to the network equipment test is lower in the related art, reach the technological effect to promote the efficiency to the network equipment test.
Drawings
Fig. 1 is a hardware block diagram of a mobile terminal of a test method of a network device according to an embodiment of the present application;
FIG. 2 is a flow chart of a test of a network device according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a virtual test environment, according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a test system framework according to an embodiment of the present application;
FIG. 5 is a schematic diagram of an RPC message format according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a message interaction according to an embodiment of the present application;
FIG. 7 is a flow chart of server transceiving according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a test system for a network device according to an embodiment of the present application;
fig. 9 is a block diagram of a detection apparatus of a network device according to an embodiment of the present application.
Detailed Description
Embodiments of the present application will be described in detail below with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
First, partial terms or terminology appearing in describing embodiments of the present application are applicable to the following explanation:
VLAN: virtual Local Area Network for representing a virtual local area network.
RPC: remote Procedure Call, a message format, is used to represent remote procedure calls.
Ethernet: refers to ethernet.
Socket: refers to a socket.
Trunk: refers to the trunk.
DUT: device Under Test for representing the device under test.
The existing network test equipment comprises a hardware tester and open-source test software, and the two methods have the following defects:
The hardware tester is generally composed of control software and a machine frame plus interface card, and is used for physically realizing parallel transceiving of multiple ports. The function and performance test of the DUT can be realized, and the test of a large number of protocol consistencies can be realized. The scheme of the hardware-based tester has the defects that firstly, the scheme is limited by a hardware edition card, the number of interfaces is fixed, and the scheme cannot be dynamically adjusted according to test requirements. And secondly, the automation is complex to realize, and the interfaces are numerous and difficult to master through multi-layer packaging. Again, the cost investment is huge, and the purchase cost of one tester comprises software, hardware, service, license and the like, from tens of thousands to hundreds of thousands, and occupies most of the budget of research and development.
Network testing is performed by using testing software based on open source, and a client/server architecture is generally adopted to realize point-to-point traffic transmission and reception. However, network testing based on open source test software cannot realize parallel transceiving control of multiple ports, and meanwhile, the types of protocols or simulated messages which can be supported are very limited.
The method embodiments provided in the embodiments of the present application may be performed in a mobile terminal, a computer terminal or similar computing device. Taking the mobile terminal as an example, fig. 1 is a block diagram of a hardware structure of the mobile terminal of a method for testing a network device according to an embodiment of the present application. As shown in fig. 1, a mobile terminal may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the structure shown in fig. 1 is merely illustrative and not limiting of the structure of the mobile terminal described above. For example, the mobile terminal may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1.
The memory 104 may be used to store computer programs, such as software programs of application software and modules, such as computer programs corresponding to the test methods of the network device in the embodiments of the present application, and the processor 102 executes the computer programs stored in the memory 104, thereby performing various functional applications and data processing, that is, implementing the methods described above. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, which may be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is configured to communicate with the internet wirelessly.
In this embodiment, a method for operating on the mobile terminal is provided, and fig. 2 is a flowchart of a test of a network device according to an embodiment of the present application, as shown in fig. 2, where the flowchart includes the following steps:
step S202, obtaining topology information of network equipment, wherein the topology information at least comprises interface information and connection information of the network equipment.
The network device may be a switch, a router, or other network devices connected through the switch, and other network devices not connected through the switch, and optionally, the network devices may be connected to a virtual test environment, where the virtual test environment is used to connect to the network devices and perform data interaction, so as to test a network connected to the network devices, where the network may be a distributed network.
The topology information can be created in advance by a user and stored in the network device, and optionally, the topology information can also be created by a control device in the virtual test environment according to the acquired information of the network device and according to the information of the network device, wherein the information of the network device can include the interface type, the number of interfaces and the connection mode of the interfaces of the network device.
The interface information may include information such as the number of interfaces, the type of interfaces, and the traffic of data transmitted and received by the interfaces.
The connection information may include a connection manner of the interface of the network device, and a connection relationship, where the connection manner may include serial connection, parallel connection, and the like. The connection relationship may include a connection relationship of each interface on the network device with other interfaces on the network device, and a connection relationship of an interface on each network device with an interface on an external device.
In an alternative embodiment, the number and type of the interfaces in the network device and the connection mode of the interfaces can be obtained through the control device in the virtual test environment, so that the virtual test environment can be utilized to test the network conditions such as the network speed, the network strength and the like of the network connected with the network device.
Step S204, creating a virtual test environment corresponding to the network equipment based on the topology information, wherein the virtual test environment at least comprises: a plurality of virtual interfaces and virtual bridges.
The virtual interface may be a test interface in a virtual test environment, and optionally, the virtual interface may be connected through an interface between a virtual bridge and a network device.
The virtual network bridge can be used for connecting the virtual interface with the interface of the network equipment, so that the virtual interface and the interface of the network equipment can perform data interaction, and further the network equipment can be tested.
In an alternative embodiment, after obtaining topology information of the network device, a plurality of virtual interfaces and virtual bridges corresponding to the virtual test environment may be created according to interface information in the network device and connection information of the interfaces, and personalized adjustment is performed on the original virtual test environment, so as to generate a virtual test environment corresponding to the network device.
In another alternative embodiment, after the topology information of the network device is directly acquired by the control device of the system, a virtual test environment is created according to the interface information in the network device and the connection information of the interface, so that the network device can be tested by using the virtual test environment.
Step S206, the data message is forwarded in parallel through a plurality of virtual interfaces and virtual bridges, and the network equipment is tested, so that a test result of the network equipment is obtained.
In an alternative embodiment, message transmission can be performed in parallel between multiple virtual interfaces, and after multiple virtual interfaces and virtual bridges are obtained, multiple virtual interfaces and interfaces of network devices can be put into the virtual bridges, so that multiple virtual interfaces and interfaces of network devices can be connected. Further, data transmission can be performed through the connected multiple virtual interfaces and the interfaces of the network equipment, and the test of the network equipment is realized according to analysis of the data transmitted by the multiple virtual interfaces and the interfaces of the network equipment.
By adopting the technical scheme disclosed in the application, a test or a developer can get rid of the dependence on a hardware tester when testing network equipment, so that the cost input of the test is greatly reduced. Furthermore, due to the adoption of the virtualization technology, topology management is more flexible and efficient, so that a parallel interface receiving and transmitting mechanism based on a distributed type can be generated, and further, the testing efficiency is greatly improved. Furthermore, the technical method disclosed by the application can be also applied to testing the cloud computing network or testing the network card.
According to the method and the device, the network equipment is tested because the plurality of virtual interfaces and the virtual bridges corresponding to the network equipment are created based on the interface information and the connection information of the network equipment, and the data messages are forwarded in parallel through the plurality of virtual interfaces and the virtual bridges. It is easy to notice that, because of adopting a plurality of ports to process in parallel, thus can shorten the detection time, because of adopting the virtualized interface, can realize the parallel transceiver mechanism of multiport, further promote the detection efficiency to the network equipment, therefore, can solve the technical problem that the efficiency to the network equipment test is lower in the related art, reach the technological effect to promote the efficiency to the network equipment test.
In one exemplary embodiment, creating a plurality of virtual interfaces and virtual bridges based on topology information includes: creating a plurality of virtual interfaces in the container and creating a virtual bridge by using a virtualization technology; a plurality of virtual interfaces are added to the virtual bridge based on the topology information.
In a general optional embodiment, the above virtualization technology is adopted to enable the computing unit to run on a virtual basis, so that a plurality of virtual interfaces and virtual bridges are created in a virtual test environment, network topology can be dynamically changed, a hardware tester is not relied on in the test process, and the effect of parallel testing of a large number of ports of the network device is achieved.
In an alternative embodiment, assuming that the network device is a switch, when the test is started, the acquired topology information can be read first, then an automation program creates a plurality of virtual interfaces corresponding to the transmission traffic in the socket container, creates a virtual bridge, adds the plurality of virtual interfaces and ports of the switch to the bridge, and configures the addresses of the corresponding switch, so that the dynamic physical connection between the test interface and the ports of the switch is realized.
Fig. 3 is a schematic diagram of a virtual testing environment according to an embodiment of the present application, as shown in fig. 3, in the virtual testing environment, a virtual interface and a switch are connected through a virtual bridge, and the other end of the switch may be connected to a plurality of network devices, so that the network devices may be tested by using the virtual testing environment.
In an exemplary embodiment, the virtual test environment further includes a client and a server, and the data message is forwarded in parallel through a plurality of virtual interfaces and virtual bridges, and the network device is tested to obtain a test result of the network device, including: creating a message polling thread between the client and the server, wherein the message polling thread is used for receiving a message sent by the client or the server; sending a control message to a server through a client; and the server side forwards the data message in parallel through a plurality of virtual interfaces and virtual bridges based on the control message, and tests the network equipment to obtain a test result.
The client may be a control plane program for receiving and transmitting traffic, and optionally, the client may determine when to send a message, when to receive a message, and what kind of message to send.
The server may be a data plane program for receiving and transmitting traffic, and optionally, the server may execute a command sent by the client to send a message and capture the message.
The message polling thread can be used for connecting the client and the server, so that message transmission can be performed between the client and the server.
Fig. 4 is a schematic diagram of a test system framework according to an embodiment of the present application, as shown in fig. 4, where the test system may be divided into a control plane and a data plane, where the control plane may represent a client, and the client may perform packet sending control and packet receiving control based on a message polling thread by an automatic master control program, so as to control a server to perform packet sending and packet capturing. The data plane may represent a server, and the server may receive data sent by the client based on a message polling thread, and send and capture a message by establishing different sending threads and receiving threads through multiple virtual interfaces. Alternatively, the client and the server may use a bidirectional communication connection to perform message transmission through a message polling thread.
In an alternative embodiment, the client may send the message to the server through an RPC (Remote Procedure Call remote procedure call) message format, and fig. 5 is a schematic diagram of an RPC message format according to an embodiment of the present application, where, as shown in fig. 5, the RPC message format may include information about a message length, a message type, a port type, a character, a protocol, and so on.
By way of example, the type of message sent by the client may be:
RPC_MSG_START_SEND, wherein RPC_MSG_START_SEND may indicate that the START is an indication of the START of the server to SEND a message;
RPC_MSG_STOP_SEND, wherein RPC_MSG_STOP_SEND may be expressed as an indication that the server STOPs sending messages;
RPC_MSG_START_CAPTURE, where RPC_MSG_START_CAPTURE may be expressed as an indication to the server to START capturing messages;
rpc_msg_stop_capture, wherein rpc_msg_stop_capture may be expressed as an indication to the server to STOP capturing messages.
Furthermore, as the control plane and the data plane are decoupled, the data plane server adopts multithreading to control the message transmission and the message reception of each interface, thereby realizing the distributed parallel transmission and the receiving of multiple ports without mutual influence among the ports. Optionally, the network device may be tested by parsing the messages sent and captured by the server.
In the automatic test environment disclosed by the application, a multi-port distributed network test environment is simulated by utilizing socket and virtual network bridge technology in a software mode, so that dynamic change of network topology can be realized. Aiming at network equipment such as a switch, a router and the like, a virtualization technology is adopted, and a multi-port distributed network testing environment is simulated based on an RPC message model, so that a hardware tester is not relied on in the testing process, and the effect of parallel testing of a large number of ports of the network equipment is further realized.
In an exemplary embodiment, the server side forwards data messages in parallel through a plurality of virtual interfaces and virtual bridges based on the control messages, tests the network device to obtain test results, and the method includes: under the condition that the control message comprises a message sending message and a message capturing message, respectively analyzing the message sending message and the message capturing message to obtain the message sending message and the message capturing message, wherein the message sending message at least comprises: the first data message and the sending parameter, the message capturing information at least comprises: a target virtual interface; transmitting, by the server, a first data message to the network device through the plurality of virtual interfaces and the virtual bridge based on the transmission parameters; receiving a second data message sent by the network equipment through the target virtual interface and the virtual network bridge by the server; a test result is determined based on the first data message and the second data message.
The first data message may be a message sent by the server to the network device.
The above-described transmission parameters may be used to represent information such as character protocols.
The target virtual interface may be a virtual interface used when capturing a message.
The second data message may be data of the network device captured by the server.
Fig. 6 is a schematic diagram of message interaction according to an embodiment of the present application, as shown in fig. 6, after a client establishes a connection with a server, the client may send an indication to the server in an RPC message format, which indicates that the server needs to start sending a message to a network device, and the server may create a sending thread after receiving the indication, so that the sending thread may be used to send a message, and further, after the sending is completed, feedback data for indicating that the sending is completed needs to be sent to the client, where the feedback data for indicating that the sending is completed may be sent in the RPC message format. Optionally, the client may further send an indication to the server in the form of an RPC message format, which indicates that the server needs to start capturing a message sent by the network device, and the server creates a capturing thread after receiving the indication, so that capturing of the message can be performed by using the capturing thread.
Optionally, after each receiving or capturing thread is finished, the server returns the sending or receiving result of each interface to the client, so that statistics on the sending or receiving condition of each interface can be realized, whether the final result is correct or not is judged according to the input of the automation script, and the purpose of testing the network equipment is achieved.
In one exemplary embodiment, sending, by a server, a first data message to a network device over a plurality of virtual interfaces and virtual bridges based on a sending parameter, comprises: creating a sending thread based on the sending parameters; based on the sending thread, a sending function is called to send a first data message through the virtual bridge.
In an alternative embodiment, the server may send the first data message to the network device through a plurality of virtual interfaces and virtual bridges based on the sending parameters, so as to implement sending of the message. Optionally, after the server receives the instruction of the client, a sending thread may be created first, where the sending thread may be used to send the message, and after the sending thread is created successfully, a sending function in the related art may be called to send the message based on the sending thread, where the sending function may be a send function, and optionally, the send function may be used to send the message to the socket.
In the data plane, when the server polls the RPC message, when receiving the transmission message rpc_msg_start_send, a transmission thread can be created for each interface according to the port type information of the message field, and a transmission function is called to SEND a message, and optionally, a transmission status message can be fed back to the client to notify that the task being transmitted by the port has been finished.
In an exemplary embodiment, receiving, by a server, a second data message sent by a network device through a target virtual interface and a virtual bridge, includes: creating a capture thread based on the target virtual interface; based on the capture thread, a capture function is invoked to capture the second data message through the virtual bridge.
In an alternative embodiment, the server may capture the second data message in the network device through a plurality of virtual interfaces and virtual bridges based on the transmission parameters, thereby implementing the capturing of the message. Optionally, after the server receives the instruction from the client, a capturing thread may be created first, where the capturing thread may be used to capture a packet, and after the sending thread is created successfully, a capturing function in the related art may be called to capture the packet based on the sending thread, where the capturing function may be a sniffer function, and optionally, the sniffer function (also referred to as a capturer function) is a method for collecting data.
For example, when a message capturing message rpc_msg_start_capture is received, a capturing thread may be created for each interface to CAPTURE a message according to port type information of a message field, and a capturing function may be called to CAPTURE the message at the interface. Meanwhile, after the capturing is completed, a capturing status message can be fed back to the client to notify the port that the capturing task has been completed.
In one exemplary embodiment, determining a test result based on the first data message and the second data message includes: generating feedback data based on the first data message and the second data message through the server; sending feedback data to the client through a message polling thread; and determining a test result based on the feedback data by the client.
In an alternative embodiment, after the server side completes the sending of the message or the capturing of the message, feedback needs to be made to the client side, and optionally, feedback can be made to the client side through an RPC message format.
Fig. 7 is a flowchart of server transceiving according to an embodiment of the present application, as shown in fig. 7, after the server receives an instruction from the client, a main thread may be used to create multiple threads, optionally, multiple threads may be scheduled, so as to obtain different sending threads and receiving threads, for example, sending thread 1, sending thread 2, sending thread n, receiving thread 1, receiving thread 2, receiving thread n, and optionally, after creating multiple sending threads and receiving threads, the server may return to the main thread through scheduling again.
In the application, a distributed network testing environment with multiple ports is simulated based on an RPC message format by adopting a virtualization technology. A multi-port distributed network test environment is created by utilizing virtual interfaces and virtual network bridge technology, so that the network topology can be dynamically changed. Furthermore, the receiving and transmitting messages of each port are controlled through the RPC message format, so that an automatic script control plane is decoupled from a data forwarding plane, and further, the distributed parallel data transmission or reception of each port is realized.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the related art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), including several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method described in the embodiments of the present application.
The embodiment also provides a system for detecting network devices, which is used for implementing the foregoing embodiments and preferred embodiments, and is not described in detail. Fig. 8 is a schematic diagram of a test system of a network device according to an embodiment of the present application, as shown in fig. 8, the system includes the following components:
the control device 82 and the network device 84, wherein the control device 82 comprises a client 8201 and a server 8201.
The control device 82 is connected to the network device 84, and is used for testing the network device, and the network device 84 is used for receiving the message sending message and the message capturing message sent by the control device. The client 8210 is connected to the server 8202, and configured to send a message sending message and a message capturing message to the server 8202, where the message sending message at least includes: the first data message and the sending parameter, the message capturing information at least comprises: a target virtual interface; the server 8202, the server 8202 is connected to the network device 84, and is configured to send a first data message to the network device 84 through a plurality of virtual interfaces and virtual bridges based on the sending parameters.
The embodiment also provides a device for detecting a network device, which is used for implementing the foregoing embodiments and preferred embodiments, and is not described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
Fig. 9 is a block diagram of a detection apparatus of a network device according to an embodiment of the present application, as shown in fig. 9, including:
the obtaining module 902 is configured to obtain topology information of the network device, where the topology information at least includes interface information and connection information of the network device.
The creating module 904 is configured to create a virtual test environment corresponding to the network device based on the topology information, where the virtual test environment at least includes: a plurality of virtual interfaces and virtual bridges.
And the testing module 906 is configured to forward the data message in parallel through a plurality of virtual interfaces and virtual bridges, and test the network device to obtain a test result of the network device.
In one exemplary embodiment, the creation module 904 includes: a first creation unit for creating a plurality of virtual interfaces within the container and creating a virtual bridge using a virtualization technique; and the adding unit is used for adding a plurality of virtual interfaces into the virtual network bridge based on the topology information.
In one exemplary embodiment, the test module 906 includes: the second creating unit is used for creating a message polling thread between the client and the server, and the message polling thread is used for receiving the message sent by the client or the server; the control unit is used for sending a control message to the server through the client; and the test unit is used for transmitting the data message in parallel through a plurality of virtual interfaces and virtual bridges based on the control message through the server side, and testing the network equipment to obtain a test result.
In one exemplary embodiment, a test unit includes: the analysis subunit is configured to, when the control message includes a message sending message and a message capturing message, analyze the message sending message and the message capturing message respectively, and obtain message sending information and message capturing information, where the message sending information at least includes: the first data message and the sending parameter, the message capturing information at least comprises: a target virtual interface; a transmitting subunit, configured to transmit, by the server, the first data message to the network device through the plurality of virtual interfaces and the virtual bridge based on the transmission parameters; a receiving subunit, configured to receive, through the server, a second data message sent by the network device through the target virtual interface and the virtual bridge; and the determining subunit is used for determining a test result based on the first data message and the second data message.
In an exemplary embodiment, the sending subunit is further configured to create a sending thread based on the sending parameter; based on the sending thread, a sending function is called to send a first data message through the virtual bridge.
In one exemplary embodiment, the receiving subunit is further configured to create a capture thread based on the target virtual interface; based on the capture thread, a capture function is invoked to capture the second data message through the virtual bridge.
In an exemplary embodiment, the determining subunit is further configured to generate, by the server, feedback data based on the first data message and the second data message; sending feedback data to the client through a message polling thread; and determining a test result based on the feedback data by the client.
According to a further embodiment of the present application, there is also provided a computer readable storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of the test method embodiment of any of the above-mentioned network devices when run.
According to a further embodiment of the present application, there is also provided an electronic device comprising a memory, in which a computer program is stored, and a processor, which is arranged to run the computer program to perform the steps of the test method embodiment of any of the above-mentioned network devices.
It should be noted that each of the above modules may be implemented by software or hardware, and for the latter, it may be implemented by, but not limited to: the modules are all located in the same processor; alternatively, the above modules may be located in different processors in any combination.
Embodiments of the present application also provide a computer readable storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
In one exemplary embodiment, the computer readable storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
Embodiments of the present application also provide an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
In an exemplary embodiment, the electronic device may further include a transmission device connected to the processor, and an input/output device connected to the processor.
Specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the exemplary implementation, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the modules or steps of the application described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them may be fabricated into a single integrated circuit module. Thus, the present application is not limited to any specific combination of hardware and software.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the same, but rather, various modifications and variations may be made by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application should be included in the protection scope of the present application.

Claims (12)

1. A method for testing a network device, comprising:
Obtaining topology information of network equipment, wherein the topology information at least comprises interface information and connection information of the network equipment;
creating a virtual test environment corresponding to the network equipment based on the topology information, wherein the virtual test environment at least comprises: a plurality of virtual interfaces and virtual bridges;
and the network equipment is tested by forwarding data messages in parallel through the plurality of virtual interfaces and the virtual network bridge, so that a test result of the network equipment is obtained.
2. The method of claim 1, wherein creating a plurality of virtual interfaces and virtual bridges based on the topology information comprises:
creating the plurality of virtual interfaces within the container and creating the virtual bridge using virtualization techniques;
the plurality of virtual interfaces are added 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, wherein the network device is tested by forwarding data messages in parallel through the plurality of virtual interfaces and the virtual bridge, and wherein the testing result of the network device is obtained, comprising:
Creating a message polling thread between the client and the server, wherein the message polling thread is used for receiving a message sent by the client or the server;
sending a control message to the server through the client;
and the server side forwards data messages in parallel through a plurality of virtual interfaces and the virtual network bridge based on the control messages, and tests the network equipment to obtain the test result.
4. The method of claim 3, wherein testing the network device by the server based on the control message by forwarding data messages in parallel through a plurality of virtual interfaces and the virtual bridge to obtain the test result comprises:
under the condition that the control message comprises a message sending message and a message capturing message, respectively analyzing the message sending message and the message capturing message to obtain message sending information and message capturing information, wherein the message sending information at least comprises: the first data message and the sending parameter, the message capturing information at least includes: a target virtual interface;
transmitting, by the server, the first data message to the network device through a plurality of virtual interfaces and the virtual bridge based on the transmission parameter;
Receiving a second data message sent by the network device through the target virtual interface and the virtual network bridge by the server;
the test result is determined based on the first data message and the second data message.
5. The method of claim 4, wherein transmitting, by the server, the first data message to the network device via a plurality of virtual interfaces and the virtual bridge based on the transmission parameters, comprises:
creating a sending thread based on the sending parameters;
and calling a sending function to send the first data message through the virtual network bridge based on the sending thread.
6. The method of claim 4, wherein receiving, by the server, the second data message sent by the network device through the target virtual interface and the virtual bridge, comprises:
creating a capture thread based on the target virtual interface;
and calling a capture function to capture the second data message through the virtual network 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 comprises:
Generating feedback data based on the first data message and the second data message through the server;
sending the feedback data to the client through the message polling thread;
and determining the test result based on the feedback data by the client.
8. A system for testing network devices, comprising:
the control equipment is connected with the network equipment and used for testing the network equipment;
the network equipment is used for receiving the message sending information and the message capturing information sent by the control equipment.
9. The system of claim 8, wherein the control device comprises:
the client is connected with the server and is used for sending a message sending message and a message capturing message to the server, wherein the message sending message at least comprises the following components: the first data message and the sending parameter, the message capturing information at least includes: a target virtual interface;
the server is connected with the network equipment and is used for sending the first data message to the network equipment through a plurality of virtual interfaces and the virtual network bridge based on the sending parameters.
10. A test apparatus for a network device, comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring topology information of network equipment, and the topology information at least comprises interface information and connection information of the network equipment;
the creating module is configured to create a virtual test environment corresponding to the network device based on the topology information, where the virtual test environment at least includes: a plurality of virtual interfaces and virtual bridges;
and the test module is used for forwarding data messages in parallel through the plurality of virtual interfaces and the virtual network bridge, testing the network equipment and obtaining a test result of the network equipment.
11. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program, wherein the computer program, when executed by a processor, implements the steps of the method for testing a network device according to any of the claims 1 to 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, when executing the computer program, implements the steps of the method for testing a network device according to any one of claims 1 to 7.
CN202310179870.9A 2023-02-28 2023-02-28 Network equipment testing method, system, device, storage medium and electronic equipment Pending CN116112413A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310179870.9A CN116112413A (en) 2023-02-28 2023-02-28 Network equipment testing method, system, device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310179870.9A CN116112413A (en) 2023-02-28 2023-02-28 Network equipment testing method, system, device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN116112413A true CN116112413A (en) 2023-05-12

Family

ID=86261587

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310179870.9A Pending CN116112413A (en) 2023-02-28 2023-02-28 Network equipment testing method, system, device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN116112413A (en)

Similar Documents

Publication Publication Date Title
CN112714047A (en) Industrial control protocol flow based test method, device, equipment and storage medium
CN108228444B (en) Test method and device
US10461990B2 (en) Diagnostic traffic generation for automatic testing and troubleshooting
CN104579822A (en) Automatic performance test system and method of mobile application based on Http protocol
US11405302B1 (en) Methods, systems, and computer readable media for network testing using configurable test infrastructure
CN112653600A (en) Network card performance testing method and device based on USB network card and electronic equipment
CN111190755B (en) Application program function exception handling method and device
CN111400127A (en) Service log monitoring method and device, storage medium and computer equipment
CN111092767B (en) Method and device for debugging equipment
CN111522727A (en) Simulation object test method, device and system
WO2015084140A1 (en) A system and method for emulating multiple independent wireless client devices in the cloud
CN110876155B (en) Simulation system and method for wireless mesh network
CN109471763B (en) Method, device, equipment and system for grabbing trace of NVME (network video management entity) hard disk
CN117176802B (en) Full-link monitoring method and device for service request, electronic equipment and medium
CN112463511B (en) Automatic test system and test method for serial port equipment of Internet of things
CN117041111A (en) Vehicle cloud function test method and device, electronic equipment and storage medium
CN116647490A (en) Aviation AFDX network data detection system
CN116112413A (en) Network equipment testing method, system, device, storage medium and electronic equipment
CN115904388A (en) Application program protocol analysis method, device, equipment and storage medium
CN113032054B (en) Service execution method and device, storage medium and electronic device
CN113031569B (en) Monitoring method, system, terminal and medium of nuclear fusion control system
CN112838938B (en) Test system of Internet of things platform
CN114338347A (en) Ampere platform-based fault information out-of-band acquisition method and device
CN111221687B (en) Cloud storage testing system and method
CN111294250B (en) Pressure testing method, device and system

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