A request message response method and device, electronic equipment and storage medium
By simulating server list management and response message construction, the problem of high resource consumption in network testing is solved, and efficient and accurate network testing is achieved.
Patent Information
- Application Number
- CN202310420285.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-18
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2043-04-18
AI Technical Summary
Existing technologies require the deployment of a large number of real servers or virtual machines in network testing, resulting in high resource consumption and complex management, which cannot meet the needs of complex network testing.
By managing a list of simulated servers, response messages are constructed based on the protocol type and parameter information of the request messages. Multiple simulated servers are used to simulate network test requests and respond to them. Real servers are called to handle actual requests when necessary.
It reduces the resource consumption of real servers, improves the efficiency and accuracy of network testing, and meets the needs of large-scale network testing.
Smart Images

Figure CN116418689B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network testing technology, and in particular to a request message response method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the surge in online traffic and the continuous segmentation of business systems, the number of servers for backend business systems is becoming increasingly large, thus requiring more and more servers when performing network tests.
[0003] In existing technologies, when deploying a test environment, it is often necessary to deploy a large number of servers or run multiple virtual machines on each server to meet network testing requirements.
[0004] However, as the testing environment becomes increasingly complex, the above server deployment methods can no longer meet the needs of network testing. At the same time, using real servers or running virtual machines on real servers not only requires configuring and managing a large number of servers, but also consumes a lot of server resources. Summary of the Invention
[0005] This invention provides a request message response method, apparatus, electronic device, and storage medium to solve the problem of excessive server resource consumption during network testing.
[0006] According to one aspect of the present invention, a request message response method is provided, comprising:
[0007] In response to receiving the first request message, obtain the access server of the first request message;
[0008] Determine whether there is a target simulated server in the simulated server list that matches the access server; wherein, the simulated server list includes multiple simulated servers;
[0009] If a target simulation server is determined to exist, a first response message is constructed based on the first protocol type and parameter information of the first request message, and the first response message is sent back to the device that sent the first request message.
[0010] After sending the first response message back to the device that sent the first request message, the method further includes: obtaining a second protocol type that has a business relationship with the first protocol type according to business testing requirements; and pre-constructing a second response message based on the second protocol type and the address information of the target simulation server. This not only pre-fills some parameter items in the predicted response message, improving the message response speed, but also ensures the accuracy of the variable parameter items in the predicted response message. Alternatively, a third response message can be pre-constructed based on the second protocol type, the address information of the target simulation server, and the address information of the device that sent the first request message. This yields a predicted response message with complete parameter information, further improving the message response speed and network testing efficiency.
[0011] After pre-constructing a second response message based on the second protocol type and the address information of the target simulation server, the method further includes: in response to obtaining a second request message of the second protocol type, filling the parameter items of the second response message according to the second request message, and feeding back the filled second response message to the device that sent the second request message; this allows the second response message to be sent directly without parameter item information verification, ensuring timely sending of the second response message. Alternatively, after pre-constructing a third response message based on the second protocol type, the address information of the target simulation server, and the address information of the device that sent the first request message, the method further includes: in response to obtaining a third request message of the second protocol type, verifying the parameter items of the third response message according to the third request message, and feeding back the verified third response message to the device that sent the third request message; this ensures accurate filling of parameter item information in the third response message and ensures the accuracy of network test results.
[0012] After confirming the existence of a target simulation server, the process further includes: obtaining a matching target response message template from a set of response message templates based on the address information of the target simulation server and the first protocol type of the first request message; and constructing a first response message based on the target response message template and the parameter information of the first request message. By obtaining a pre-constructed target response message template, only some parameter items need to be filled in based on the first request message to obtain a first response message with complete parameter information, which greatly improves the construction efficiency of the first response message and thus improves the efficiency of network testing.
[0013] After determining whether a target simulated server matching the access server exists in the simulated server list, the method further includes: if it is determined that no target simulated server exists, adding the access server to the simulated server list, and constructing a first response message based on the first protocol type and parameter information of the first request message, so as to send the first response message back to the device that sent the first request message; to ensure that the feedback response to all obtained request messages maximizes the satisfaction of network testing requirements. The request message response method further includes: according to a first preset period, traversing each simulated server in the simulated server list to delete simulated servers in the simulated server list that do not have a connection session; or when the number of simulated servers in the simulated server list reaches a preset number threshold, traversing each simulated server in the simulated server list to delete simulated servers in the simulated server list that do not have a connection session; so as to facilitate effective management of the simulated server list, avoid the existence of inactive simulated servers, and reduce the efficiency of response message construction.
[0014] After determining the existence of a target simulation server, the process further includes: determining whether a real server matches the target simulation server; if a real server is determined to exist, sending the first request message to the real server to obtain a first response message from the real server; this avoids the simulation server mistaking a test request for a test request when it cannot distinguish between test requests and actual business requests, thus failing to provide accurate message body content. Simultaneously, the real server can alleviate the message processing pressure on the current electronic device, improving the processing capacity of request messages; the step of constructing the first response message based on the first protocol type and parameter information of the first request message includes: if a real server is determined not to exist, constructing the first response message based on the first protocol type and parameter information of the first request message; the current electronic device completes the construction of the first response message to ensure timely response to test requests and orderly execution of network testing.
[0015] The request message response method further includes: sending a fourth request message to each simulated server in the simulated server list according to a second preset period; if a fourth response message is received from the current simulated server in response to the fourth request message, the current simulated server is marked as a real server; if no fourth response message is received from the current simulated server in response to the fourth request message, the current simulated server is marked as a non-real server. This achieves effective management of real and non-real servers in the simulated server list, facilitates the differentiated execution of different types of request messages, and thus ensures the orderly and efficient execution of network testing.
[0016] According to another aspect of the present invention, a request message response apparatus is provided, comprising:
[0017] The access server acquisition module is used to acquire the access server of the first request message in response to the acquisition of the first request message;
[0018] The simulated server acquisition module is used to determine whether there is a target simulated server in the simulated server list that matches the access server; wherein, the simulated server list includes multiple simulated servers;
[0019] The first response message construction module is used to construct a first response message based on the first protocol type and parameter information of the first request message if it is determined that a target simulation server exists, so as to send the first response message back to the device that sent the first request message.
[0020] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0021] At least one processor; and
[0022] A memory communicatively connected to the at least one processor; wherein,
[0023] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the request message response method according to any embodiment of the present invention.
[0024] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the request message response method according to any embodiment of the present invention.
[0025] The technical solution of this invention, upon obtaining the access server of the first request message and determining that a corresponding target simulated server exists in the list of simulated servers, constructs a first response message based on the first protocol type and parameter information of the first request message. This realizes the message response of the simulated server to the network test request. While ensuring the effective execution of the network test, it can simulate a large number of servers as needed to meet the server requirements of large-scale network testing. In addition, by sending response messages through the simulated server, it is not necessary to configure and manage a large number of servers, and it avoids the resource occupation of the physical server.
[0026] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 This is a flowchart of a request message response method provided in Embodiment 1 of the present invention;
[0029] Figure 2 This is a flowchart of a request message response method provided in Embodiment 2 of the present invention;
[0030] Figure 3 This is a flowchart of a request message response method provided in Embodiment 3 of the present invention;
[0031] Figure 4 This is a schematic diagram of a request message response device according to Embodiment 4 of the present invention;
[0032] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the request message response method of the present invention. Detailed Implementation
[0033] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0034] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0035] Example 1
[0036] Figure 1 This is a flowchart of a request message response method provided in Embodiment 1 of the present invention. This embodiment is applicable to responding to network test requests by creating a simulated server. This method can be executed by a request message response device, which can be implemented in hardware and / or software. The request message response device is configured in electronic devices such as servers, typically in the management server of a server cluster. Figure 1 As shown, the method includes:
[0037] S101. In response to obtaining the first request message, obtain the access server of the first request message.
[0038] When a first request message is received, the address information of the accessed object (i.e., the accessing server) is obtained from the first request message according to its protocol type (i.e., the first protocol type). The address information includes an IP (Internet Protocol) address and / or a MAC (Media Access Control) address. For example, in Address Resolution Protocol (ARP), "Target HardwareAdd" and "Target Proto Add" are the MAC address and IP address of the accessing server, respectively; in Internet Control Message Protocol (ICMP), "DIP" is the IP address of the accessing server; and in Bidirectional Forwarding Detection (BFD), "DIP" and "DMAC" are the IP address and MAC address of the accessing server, respectively.
[0039] S102. Determine whether there is a target simulation server in the simulation server list that matches the access server; wherein, the simulation server list includes multiple simulation servers.
[0040] The list of simulated servers records the address information of multiple simulated servers, including IP addresses and MAC addresses. These simulated servers can be actual, existing real servers (i.e., their address information is recorded in the list), virtual machines on real servers (each virtual machine acts as a simulated server and is recorded in the list), or completely virtual servers that do not actually exist. The address information of the accessing server is compared with the address information of each simulated server in the list. If a matching simulated server is found, it is selected as the target simulated server; otherwise, no matching simulated server exists.
[0041] S103. If it is determined that a target simulation server exists, a first response message is constructed based on the first protocol type and parameter information of the first request message, so as to send the first response message back to the device that sent the first request message.
[0042] If it is determined that the target simulation server does not exist, the first request message is considered invalid and no response is given. If it is determined that the target simulation server exists, the first request message is considered valid. In this case, the parameter composition of the first response message is determined according to the first protocol type of the first request message, and then the parameter items of the first response message are filled in according to the parameter item information in the first request message. Among them, the parameter items such as "sender MAC address", "destination MAC address", "sender IP address", "destination IP address", "source port" and "destination port" in the first response message correspond to the parameter items such as "destination MAC address", "sender MAC address", "destination IP address", "sender IP address", "destination port" and "source port" in the first request message, respectively.
[0043] Taking the above technical solution as an example, if the first protocol type is the ABR protocol, the "DMAC (Destination MAC Address)" and "SMAC (Source MAC Address)" in the Ethernet header of the first response message are the same as "SMAC" and "DMAC" in the first request message; the "Ether Type" in the Ethernet header of the first response message is consistent with the "Frame Type" in the first request message; the "Hardware Type", "Protocol Type", "Hardware Address Length", and "Protocol Address Type" in the ARP header of the first response message are consistent with the "Hardware Type", "Protocol Type", "Hardware Address Length", and "Protocol Address Type" in the first request message, respectively; the "Operation" in the first request message is 0x0001, and the "Operation" in the corresponding first response message is 0x0002; the "Sender MAC Address", "Sender IP Address", "Destination MAC Address", and "Target IP Address" in the first response message correspond to the "Destination MAC Address", "Target IP Address", "Sender MAC Address", and "Sender IP Address" in the first request message, respectively.
[0044] If the first protocol type is ICMP, the “DMAC” and “SMAC” in the Ethernet header of the first response message are the same as “SMAC” and “DMAC” in the first request message; the “Frame Type” in the Ethernet header of the first response message is consistent with the “Frame Type” in the first request message; the “SIP (Source IP Address)” and “DIP (Destination IP Address)” in the IP header of the first response message are the same as “DIP” and “SIP” in the first request message; the “Proto” in the first request message is 0x01, and the “Proto” in the corresponding first response message is also 0x01; the “Type” in the ICMP header of the first request message is 0x08, and the “Type” in the corresponding first response message is 0x00.
[0045] If the first protocol type is BFD, the “DMAC” and “SMAC” in the Ethernet header of the first response message are the same as “SMAC” and “DMAC” in the first request message, respectively; the “Frame Type” in the Ethernet header of the first response message is consistent with the “Frame Type” in the first request message; the “SIP” and “DIP” in the IP header of the first response message are the same as “DIP” and “SIP” in the first request message, respectively; the “Proto” in the IP header of the first response message is consistent with the “Proto” in the first request message; the “Sport (Source Port)” and “Dport (Destination Port)” in the UDP header of the first response message correspond to “Dport” and “Sport” in the first request message, respectively.
[0046] Optionally, in this embodiment of the invention, after determining that a target simulation server exists, the method further includes: obtaining a matching target response message template from a set of response message templates based on the address information of the target simulation server and the first protocol type of the first request message; and constructing a first response message based on the target response message template and the parameter information of the first request message. Since the simulation server list contains the address information of each simulation server, and all protocol types supported by the network test are known in advance, a corresponding response message template can be configured and generated for each simulation server under each protocol type. For example, if the simulation server list includes 100 simulation servers, and the network test supports 3 communication protocols, 300 response message templates can be created. The parameter information such as "source IP address," "source MAC address," "sender IP address," and "sender MAC address" in each response message template are all the address information of the current simulation server.
[0047] Therefore, based on the target simulation server and the first protocol type, a uniquely matching response message template (i.e., the target response message template) can be determined. Since the aforementioned parameter items in the target response message template have already been filled in, the "destination IP address" and "destination MAC address" in the first response message are then filled in according to the "sender IP address" and "sender MAC address" information obtained from the first request message, thus completing the construction of the first response message. By obtaining a pre-constructed target response message template, only a portion of the parameter items need to be filled in based on the first request message to obtain a first response message with complete parameter information, greatly improving the efficiency of first response message construction and consequently improving network testing efficiency.
[0048] Optionally, in this embodiment of the invention, after determining whether there is a target simulated server matching the access server in the simulated server list, the method further includes: if it is determined that there is no target simulated server, then adding the access server to the simulated server list, and constructing a first response message according to the first protocol type and parameter information of the first request message, so as to send the first response message back to the device that sent the first request message; the request message response method further includes: according to a first preset period, traversing each simulated server in the simulated server list to delete simulated servers in the simulated server list that do not have a connection session; or when it is detected that the number of simulated servers in the simulated server list reaches a preset number threshold, traversing each simulated server in the simulated server list to delete simulated servers in the simulated server list that do not have a connection session.
[0049] Specifically, response messages can be constructed for all obtained request messages. Thus, when the first request message is obtained, if the access server in the first request message is not in the list of simulated servers, the address information of the access server is added to the list of simulated servers, and a first response message is generated. This ensures feedback responses to all obtained request messages and maximizes the satisfaction of network testing requirements. At the same time, each simulated server can be traversed periodically according to a first preset period, or when the number of simulated servers reaches a preset threshold, each simulated server can be traversed and simulated servers with no established session connections can be deleted. This facilitates effective management of the simulated server list, avoids the existence of inactive simulated servers, and reduces the efficiency of response message construction.
[0050] The technical solution of this invention, upon obtaining the access server of the first request message and determining that a corresponding target simulated server exists in the list of simulated servers, constructs a first response message based on the first protocol type and parameter information of the first request message. This realizes the message response of the simulated server to the network test request. While ensuring the effective execution of the network test, it can simulate a large number of servers as needed to meet the server requirements of large-scale network testing. In addition, by sending response messages through the simulated server, it is not necessary to configure and manage a large number of servers, and it avoids the resource occupation of the physical server.
[0051] Example 2
[0052] Figure 2 This is a flowchart of a request message response method provided in Embodiment 2 of the present invention. The relationship between this embodiment and the above embodiments is that, after feeding back the first response message, a second response message with incomplete parameter information or a third response message with complete parameter information is pre-constructed. Figure 2 As shown, the method includes:
[0053] S201. In response to obtaining the first request message, obtain the access server of the first request message.
[0054] S202. Determine whether there is a target simulation server in the simulation server list that matches the access server; wherein, the simulation server list includes multiple simulation servers.
[0055] S203. If it is determined that a target simulation server exists, a first response message is constructed based on the first protocol type and parameter information of the first request message, so as to send the first response message back to the device that sent the first request message.
[0056] S204. Based on business testing requirements, obtain a second protocol type that has a business relationship with the first protocol type.
[0057] Taking the above technical solution as an example, in order to build an ICMP communication network between the sending device cluster and the simulation server, the sending device cluster will usually complete the construction of the complete ICMP communication network by sending ARP protocol requests, ICMP protocol requests and BFD protocol requests in sequence. Therefore, after obtaining the ARP protocol request message, the ICMP protocol can be regarded as the second protocol type that is associated with the ARP protocol (i.e., the first protocol type).
[0058] S205. Based on the second protocol type and the address information of the target simulation server, a second response message is pre-constructed; or based on the second protocol type, the address information of the sending device, and the address information of the target simulation server, a third response message is pre-constructed.
[0059] Since the second protocol type is known, the composition of the parameters of the second response message can be determined. Then, the address information of the target simulated server is filled into the "source address" and "initiator address" parameters of the second response message to complete the initial filling of the second response message. Obviously, the information related to the "destination address" in the second response message is temporarily missing. After obtaining the second request message under the second protocol type actually sent by the sending device cluster, the "destination address" in the second response message will be filled according to the "source address" or "initiator address" in the second request message to complete the complete response message. This can both pre-fill some parameters in the predicted response message, improve the message response speed, and ensure the accuracy of the filling of variable parameters in the predicted response message.
[0060] In addition, as described in the above technical solution, a communication service is usually sent by the same initiating device. Alternatively, a third response message can be pre-constructed based on the second protocol type, the address information of the sending device of the first request message, and the address information of the target simulation server. That is, based on the second response message, the "destination address" of the third response message is filled in with the address information of the sending device of the first request message. This allows for the acquisition of a predictive response message with complete parameter information, further improving message response speed and network testing efficiency.
[0061] Optionally, in this embodiment of the invention, after pre-constructing the second response message according to the second protocol type and the address information of the target simulation server, the method further includes: in response to obtaining the second request message of the second protocol type, filling the parameter items of the second response message according to the second request message, and feeding back the filled second response message to the device that sent the second request message; or after pre-constructing the third response message according to the second protocol type, the address information of the target simulation server, and the address information of the device that sent the first request message, the method further includes: in response to obtaining the third request message of the second protocol type, verifying the parameter items of the third response message according to the third request message, and feeding back the verified third response message to the device that sent the third request message.
[0062] Specifically, since the parameters pre-filled in the second response message are all accurate, after obtaining the second request message under the second protocol type, the "source address" or "initiator address" in the second request message can be directly used to fill in the "destination address" in the second response message. This allows the second response message to be sent directly without verifying the parameter information, ensuring that the second response message is sent in a timely manner.
[0063] Meanwhile, since the third response message is predicted and filled in based on the first request message, the "source address" or "initiator address" in the third request message may differ from the "source address" or "initiator address" in the first request message. Therefore, before sending the third response message, it is checked again to ensure that the parameter information in the third response message is filled in accurately and to ensure the accuracy of the network test results. If the check is correct, it indicates that the first request message and the third request message come from the same sending device, and the third response request can be sent directly. If the check is incorrect, the "destination address" in the third response message is modified according to the "source address" or "initiator address" in the third request message.
[0064] The technical solution of this invention, after obtaining a second protocol type that has a business relationship with the first protocol type according to business testing requirements, pre-constructs a second response message based on the second protocol type and the address information of the target simulation server. This can pre-fill some parameter items in the predicted response message, improving the message response speed, and also ensure the accuracy of filling in the variable parameter items in the predicted response message. Alternatively, based on the second protocol type, the address information of the target simulation server, and the address information of the device that sent the first request message, a third response message is pre-constructed, thereby obtaining a predicted response message with complete parameter item information, further improving the message response speed and network testing efficiency.
[0065] Example 3
[0066] Figure 3 This is a flowchart of a request message response method provided in Embodiment 3 of the present invention. In this embodiment, after determining that a target simulated server exists, the method further includes determining whether a real server matching the target simulated server exists. Figure 3 As shown, the method includes:
[0067] S301. In response to obtaining the first request message, obtain the access server of the first request message;
[0068] S302. Determine whether there is a target simulation server in the simulation server list that matches the access server; wherein, the simulation server list includes multiple simulation servers.
[0069] S303. If it is determined that a target simulation server exists, determine whether there is a real server that matches the target simulation server; if yes, proceed to S304; if no, proceed to S305.
[0070] As described in the above technical solution, the simulated servers recorded in the simulated server list can include actual existing real servers, virtual machines created on real servers, or non-real servers that do not actually exist, i.e., completely virtual servers. Therefore, after determining that a target simulated server exists, it is determined whether the target simulated server is a real server or a virtual machine on a real server.
[0071] S304. Send the first request message to the real server to obtain the first response message from the real server; execute S306.
[0072] S305. Construct a first response message based on the first protocol type and parameter information of the first request message; execute S306.
[0073] The simulated servers in current electronic devices can only respond to test requests. For actual business requests, since the simulated servers lack real business processing capabilities, the message body in the response message deviates significantly from the actual business content. Therefore, if the target simulated server is a real server or a virtual machine on a real server, the first request message is sent to the corresponding real server for processing. This prevents the simulated server from mistaking a test request for a real business request when it cannot distinguish between test and actual business requests, thus failing to provide accurate message body content. Simultaneously, the real server can alleviate some of the message processing pressure on the current electronic device, improving its message processing capabilities. If the target simulated server is not a real server or a virtual machine on a real server, the current electronic device constructs the first response message to ensure timely response to test requests and the orderly execution of network testing.
[0074] S306. The first response message is sent back to the device that sent the first request message.
[0075] Optionally, in this embodiment of the invention, the request message response method further includes: sending a fourth request message to each simulated server in the simulated server list according to a second preset period; if a fourth response message is received from the current simulated server in response to the fourth request message, then the current simulated server is marked as a real server; if no fourth response message is received from the current simulated server in response to the fourth request message, then the current simulated server is marked as a non-real server.
[0076] Specifically, as network testing requirements evolve, the number and address information of the required simulation servers also change. Therefore, the current electronic device can act as the sender of the fourth request message, sending the fourth request message to each simulation server in the simulation server list based on the address information of each simulation server. If a fourth response message is received from the current simulation server in response to the fourth request message, it indicates that the current simulation server is a real server or a virtual machine on a real server. If no fourth response message is received from the current simulation server in response to the fourth request message, it indicates that the current simulation server is not a real server. This achieves effective management of real and non-real servers in the simulation server list, facilitates the differentiated execution of different types of request messages, and thus ensures the orderly and efficient execution of network testing.
[0077] The technical solution of this invention, when it is determined that a target simulation server exists and that the target simulation server is a real server, sends a first request message to the real server and obtains a first response message from the real server. This avoids the simulation server mistaking a real business request for a test request when it cannot distinguish between test requests and actual business requests, thus failing to provide accurate message body content. Simultaneously, the real server can alleviate the message processing pressure on the current electronic devices, improving the processing capacity of request messages. When it is determined that no real server exists, a first response message is constructed based on the first protocol type and parameter information of the first request message to ensure a timely response to the test request message and the orderly execution of network testing.
[0078] Example 4
[0079] Figure 4 This is a structural block diagram of a request message response device provided in Embodiment 4 of the present invention. The device specifically includes:
[0080] Access server acquisition module 401 is used to acquire the access server of the first request message in response to acquiring the first request message;
[0081] The simulated server acquisition module 402 is used to determine whether there is a target simulated server in the simulated server list that matches the access server; wherein, the simulated server list includes multiple simulated servers;
[0082] The first response message construction module 403 is used to construct a first response message based on the first protocol type and parameter information of the first request message if it is determined that a target simulation server exists, so as to send the first response message back to the device that sent the first request message.
[0083] The technical solution of this invention, upon obtaining the access server of the first request message and determining that a corresponding target simulated server exists in the list of simulated servers, constructs a first response message based on the first protocol type and parameter information of the first request message. This realizes the message response of the simulated server to the network test request. While ensuring the effective execution of the network test, it can simulate a large number of servers as needed to meet the server requirements of large-scale network testing. In addition, by sending response messages through the simulated server, it is not necessary to configure and manage a large number of servers, and it avoids the resource occupation of the physical server.
[0084] Optionally, the request message response device further includes:
[0085] The predictive response message acquisition module is used to acquire a second protocol type that has a business relationship with the first protocol type according to business testing requirements; to pre-construct a second response message according to the second protocol type and the address information of the target simulation server; or to pre-construct a third response message according to the second protocol type, the address information of the target simulation server, and the address information of the device that sent the first request message.
[0086] Optionally, the request message response device further includes:
[0087] The response message sending module is used to, in response to receiving a second request message of the second protocol type, fill in the parameter items of the second response message according to the second request message, and send the filled second response message back to the sending device of the second request message; or in response to receiving a third request message of the second protocol type, check the parameter items of the third response message according to the third request message, and send the checked third response message back to the sending device of the third request message.
[0088] Optionally, the request message response device further includes:
[0089] The response message acquisition module is used to obtain a matching target response message template from the response message template set according to the address information of the target simulated server and the first protocol type of the first request message, and to construct a first response message according to the target response message template and the parameter information of the first request message.
[0090] Optionally, the request message response device further includes:
[0091] The response message feedback execution module is used to add the access server to the list of simulated servers if it is determined that there is no target simulated server, and to construct a first response message according to the first protocol type and parameter item information of the first request message, so as to feed back the first response message to the device that sent the first request message;
[0092] The traversal execution module is used to traverse each simulated server in the simulated server list according to a first preset period, so as to delete the simulated server in the simulated server list that does not have a connection session; or when the number of simulated servers in the simulated server list reaches a preset number threshold, it traverses each simulated server in the simulated server list to delete the simulated server in the simulated server list that does not have a connection session.
[0093] Optionally, the request message response device further includes:
[0094] The real server determination module is used to determine whether there is a real server that matches the target simulated server; if it is determined that there is a real server, the first request message is sent to the real server to obtain the first response message from the real server.
[0095] Optionally, the first response message construction module 403 is specifically used to construct a first response message based on the first protocol type and parameter information of the first request message if it is determined that no real server exists.
[0096] Optionally, the request message response device further includes:
[0097] The labeling execution module is used to send a fourth request message to each simulated server in the simulated server list according to a second preset period; if a fourth response message is obtained from the current simulated server in response to the fourth request message, the current simulated server is labeled as a real server; if no fourth response message is obtained from the current simulated server in response to the fourth request message, the current simulated server is labeled as a non-real server.
[0098] The above-described apparatus can execute the request message response method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the request message response method provided in any embodiment of the present invention.
[0099] Example 5
[0100] Figure 5 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0101] like Figure 5As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0102] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0103] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as request message response methods.
[0104] In some embodiments, the request message response method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as a storage unit. In some embodiments, part or all of the computer program may be loaded and / or mounted on a heterogeneous hardware accelerator via ROM and / or a communication unit. When the computer program is loaded into RAM and executed by a processor, one or more steps of the request message response method described above may be performed. Alternatively, in other embodiments, the processor may be configured to perform the request message response method by any other suitable means (e.g., by means of firmware).
[0105] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0106] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0107] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0108] To provide user interaction, the systems and techniques described herein can be implemented on a heterogeneous hardware accelerator, which includes: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the heterogeneous hardware accelerator. Other types of devices can also be used to provide user interaction; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or haptic feedback); and input from the user can be received in any form (including sound input, voice input, or haptic input).
[0109] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0110] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0111] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0112] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A request message response method, characterized in that, include: In response to receiving the first request message, obtain the access server of the first request message; Determine whether there is a target simulated server in the simulated server list that matches the access server; wherein, the simulated server list includes multiple simulated servers; If a target simulation server is determined to exist, a first response message is constructed based on the first protocol type and parameter information of the first request message, and the first response message is sent back to the device that sent the first request message. Based on business testing requirements, obtain a second protocol type that has a business relationship with the first protocol type; Based on the second protocol type and the address information of the target simulation server, a second response message is pre-constructed; wherein, the destination address of the second response message is missing. Alternatively, a third response message may be pre-constructed based on the second protocol type, the address information of the target simulation server, and the address information of the device that sent the first request message; wherein the destination address of the third response message is filled with the address information of the device that sent the first request message.
2. The method according to claim 1, characterized in that, After pre-constructing the second response message based on the second protocol type and the address information of the target simulation server, the method further includes: In response to receiving a second request message of the second protocol type, the second response message is filled with parameters according to the second request message, and the filled second response message is sent back to the device that sent the second request message; Alternatively, after pre-constructing a third response message based on the second protocol type, the address information of the target simulation server, and the address information of the device that sent the first request message, the method further includes: In response to receiving a third request message of the second protocol type, the third response message is checked against the parameters of the third request message, and the checked third response message is fed back to the device that sent the third request message.
3. The method according to claim 1, characterized in that, After confirming the existence of the target simulation server, the following steps are also included: Based on the address information of the target simulation server and the first protocol type of the first request message, a matching target response message template is obtained from the response message template set, and a first response message is constructed based on the target response message template and the parameter information of the first request message.
4. The method according to claim 1, characterized in that, After determining whether a target simulated server matching the access server exists in the list of simulated servers, the process further includes: If it is determined that there is no target simulation server, the access server is added to the simulation server list, and a first response message is constructed according to the first protocol type and parameter information of the first request message, so as to send the first response message back to the device that sent the first request message; The request message response method further includes: According to the first preset period, each simulated server in the simulated server list is traversed to delete simulated servers in the simulated server list that do not have a connection session. Alternatively, when the number of simulated servers in the simulated server list reaches a preset threshold, each simulated server in the simulated server list is traversed to delete simulated servers that do not have connection sessions in the simulated server list.
5. The method according to claim 1, characterized in that, After confirming the existence of the target simulation server, the following steps are also included: Determine whether a real server matches the target simulated server; If a real server is determined to exist, the first request message is sent to the real server to obtain the first response message from the real server. The step of constructing the first response message based on the first protocol type and parameter information of the first request message includes: If it is determined that no real server exists, a first response message is constructed based on the first protocol type and parameter information of the first request message.
6. The method according to claim 5, characterized in that, The request message response method further includes: According to the second preset period, a fourth request message is sent to each of the simulation servers in the simulation server list; If a fourth response message is obtained from the current simulated server in response to the fourth request message, then the current simulated server is marked as a real server. If the current simulated server does not receive a fourth response message in response to the fourth request message, then the current simulated server will be marked as a non-real server.
7. A request message response device, characterized in that, include: The access server acquisition module is used to acquire the access server of the first request message in response to the acquisition of the first request message; The simulated server acquisition module is used to determine whether there is a target simulated server in the simulated server list that matches the access server; wherein, the simulated server list includes multiple simulated servers; The first response message construction module is used to construct a first response message based on the first protocol type and parameter information of the first request message if it is determined that a target simulation server exists, so as to send the first response message back to the device that sent the first request message. The predictive response message acquisition module is used to acquire a second protocol type that has a business relationship with the first protocol type according to business testing requirements; pre-construct a second response message according to the second protocol type and the address information of the target simulation server; or pre-construct a third response message according to the second protocol type, the address information of the target simulation server, and the address information of the device that sent the first request message; wherein the destination address of the second response message is empty; and the destination address of the third response message is filled with the address information of the device that sent the first request message.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the request message response method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the request message response method according to any one of claims 1-6.
Citation Information
Patent Citations
Test request response method, system and equipment and storage medium
CN115203048A