Testing method and device based on virtual network element, testing method and device based on multiple virtual network elements, equipment and readable storage medium
By obtaining the configuration information of the virtual network element and generating configuration parameter values, reliability tests and functional tests are carried out on the virtual network element in the NFV scenario, the positioning difficulties in multiple virtual network element collaborative tests are solved, and the precise positioning and fault diagnosis of each virtual network element is realized, which improves the flexibility and reliability of the test.
Patent Information
- Application Number
- CN202510401176.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-07-08
AI Technical Summary
In the NFV scenario, it is difficult for the prior art to accurately locate abnormal virtual network elements during the collaborative testing of multiple virtual network elements, resulting in difficulty in testing and positioning.
By obtaining the configuration information of the virtual network element, generating configuration parameter values, conducting reliability tests on the configuration interface, and constructing test packets for forwarding and sending functions, each virtual network element is independently tested, and the network elements in the link are decoupled.
Accurate positioning and fault diagnosis of each virtual network element is realized, which improves the flexibility and reliability of testing, and reduces the complexity and cost of testing.
Smart Images

Figure CN120281635A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of virtual network element-based testing, and particularly to a cloud network method, apparatus, computer device, computer-readable storage medium, and computer program product. Background Art
[0002] Network Functions Virtualization (NFV) is an important technology in the telecommunications industry in recent years. By migrating network functions from dedicated hardware to general-purpose hardware, the virtualization of network functions is achieved, making NFV more flexible and scalable. In a complete NFV link, packets often pass through multiple virtual network elements, and the collaboration of multiple network elements completes the service process.
[0003] In the related art, the packet forwarding link in the NFV scenario determines that general testing methods often rely on multiple virtual network elements. Specifically, through a test program, the sending end sends packets, and these packets are forwarded by multiple virtual network elements and finally reach the receiving end. The test program verifies whether the forwarding behavior of the packets during the whole process meets the pre-set requirements. This kind of test is usually used to verify whether the functions and performance in the virtualized network environment are normal.
[0004] However, since the test process requires the collaboration of multiple virtual network elements, this will inevitably introduce coupling to the test, resulting in difficult positioning. Summary of the Invention
[0005] Based on this, it is necessary to provide a virtual network element-based testing method, apparatus, computer device, computer-readable storage medium, and computer program product for accurately locating abnormal virtual network elements in view of the above technical problems.
[0006] In a first aspect, this application provides a virtual network element-based testing method, including:
[0007] Obtain the configuration information of the current virtual network element;
[0008] Generate a configuration parameter value according to the configuration information, and perform a reliability test on the configuration interface of the current virtual network element based on the configuration parameter value;
[0009] In the case where the reliability test passes, construct a test packet, and perform a test on the forwarding function and / or sending function of the current virtual network element based on the test packet;
[0010] Obtain a test result based on the first flow table entry configuration information sent by the current virtual network element and / or the second flow table entry configuration information received by the current virtual network element; the first flow table entry configuration information is generated during the process of the current virtual network element sending a response message to a target virtual network element; the second flow table entry configuration information is generated during the process of the current virtual network element receiving the test message; the response message is a message that the current virtual network element forwards after receiving the test message.
[0011] In one embodiment, the generating configuration parameter values according to the configuration information includes:
[0012] Obtain a preset configuration numerical range;
[0013] Generate the configuration parameter values within the preset configuration numerical range based on the configuration information; the configuration information includes one or more of an IP address, a forwarding policy, a mac address, a flow table rule, and a protocol type.
[0014] In one embodiment, the configuration information further includes a scenario identifier; after obtaining the configuration information of the current virtual network element, it further includes:
[0015] When the scenario identifier represents an abnormal scenario, obtain corresponding abnormal type information according to the scenario identifier;
[0016] Determine abnormal simulation parameter values according to the abnormal type information; the abnormal simulation parameter values are used to construct an abnormal simulation scenario, and the abnormal simulation scenario is used to test the current virtual network element under abnormal conditions.
[0017] In one embodiment, the reliability test of the configuration interface of the current virtual network element based on the configuration parameter values includes:
[0018] Send the configuration parameter values to the current virtual network element through a preset interface to obtain a feedback result of configuration distribution; the feedback result is obtained after the configuration interface of the virtual network element executes corresponding configuration commands according to the configuration parameter values;
[0019] When the feedback result meets the preset configuration result, determine that the reliability test of the configuration interface passes.
[0020] In one embodiment, the testing of the sending function of the current virtual network element based on the test message includes:
[0021] Send the test message to the target virtual network element through a preset data packet processing framework;
[0022] The testing of the forwarding function of the current virtual network element based on the test message includes:
[0023] Send the test message to the current virtual network element, and the current virtual network element generates the response message according to the test message and forwards the response message to the target virtual network element.
[0024] In a second aspect, the present application provides a test method based on multiple virtual network elements, including:
[0025] Generate scenario identifiers for different test scenarios and write the scenario identifiers into the configuration files of each virtual network element;
[0026] When a test instruction is received, test each of the virtual network elements according to the test method based on virtual network elements in any of the above embodiments to obtain test results corresponding to each of the virtual network elements; each of the virtual network elements runs on the same device by switching network element processes.
[0027] In a third aspect, the present application further provides a test device based on virtual network elements, including:
[0028] An acquisition module, configured to acquire configuration information of the current virtual network element;
[0029] An interface test module, configured to generate configuration parameter values according to the configuration information and perform reliability tests on the configuration interfaces of the current virtual network element based on the configuration parameter values;
[0030] A function test module, configured to construct a test message and perform tests on the forwarding function and / or sending function of the current virtual network element based on the test message when the reliability test passes;
[0031] A result generation module, configured to obtain test results based on the first flow table entry configuration information sent by the current virtual network element and / or the second flow table entry configuration information received by the current virtual network element; the first flow table entry configuration information is generated during the process of the current virtual network element sending the test message to the target virtual network element; the second flow table entry configuration information is generated during the process of the current virtual network element receiving the test message.
[0032] In a fourth aspect, the present application further provides a test device based on multiple virtual network elements, including:
[0033] A configuration module, configured to generate scenario identifiers for different test scenarios and write the scenario identifiers into the configuration files of each virtual network element;
[0034] A test module, configured to, when receiving a test instruction, test each of the virtual network elements according to the virtual-network-element-based test device described in any one of the above embodiments, so as to obtain test results corresponding to the virtual network elements; each of the virtual network elements runs on the same device by switching network element processes.
[0035] In a fifth aspect, the present application further provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps of the method in any one of the above embodiments are implemented.
[0036] In a sixth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method in any one of the above embodiments are implemented.
[0037] In a seventh aspect, the present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the method in any one of the above embodiments are implemented.
[0038] For the above virtual-network-element-based test method, device, computer device, computer-readable storage medium, and computer program product, first, configuration parameter values are generated according to configuration information to perform a reliability test on the configuration interface of the current virtual network element, and then the forwarding function and / or sending function of the current virtual network element are tested according to test messages. By testing the configuration interface, forwarding function, and / or sending function separately in this way, each virtual network element can be decoupled from the link to test each virtual network element independently without relying on other virtual network elements, thereby accurately locating faults. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] To more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for describing the embodiments of the present application or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can obtain other related drawings without creative efforts based on these drawings.
[0040] Figure 1 It is an application environment diagram of the virtual-network-element-based test method in an embodiment;
[0041] Figure 2 It is a flowchart of the virtual-network-element-based test method in an embodiment;
[0042] Figure 3 It is a test flowchart of the virtual-network-element-based test in an embodiment;
[0043] Figure 4 Schematic flow chart of a test method based on multiple virtual network elements in an embodiment;
[0044] Figure 5 Flow chart of steps for testing based on virtual network elements in another embodiment;
[0045] Figure 6 Block diagram of the structure of a test device based on virtual network elements in an embodiment;
[0046] Figure 7 A test device based on virtual network elements in an embodiment;
[0047] Figure 8 Internal structure diagram of a computer device in an embodiment. Detailed implementation manners
[0048] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0049] The test method based on virtual network elements provided by the embodiments of the present application can be applied to an application environment as Figure 1 shown. Figure 1It includes multiple virtual network elements. A virtual network element refers to a software-defined network function running on a general-purpose server or cloud platform, replacing traditional dedicated hardware devices. For example, a firewall and a router are hardware, while a virtual network element is software. They have the same functions, but the virtual network element can be flexibly deployed in a cloud environment. The test device obtains the configuration information of the current virtual network element, generates configuration parameter values based on the configuration information, and performs reliability testing on the configuration interface of the current virtual network element based on the configuration parameter values; in the case where the reliability testing passes, constructs test packets, and performs testing on the forwarding function and / or sending function of the current virtual network element based on the test packets; obtains test results based on the first flow table entry configuration information sent by the current virtual network element and / or the second flow table entry configuration information received by the current virtual network element; the first flow table entry configuration information is generated during the process of the current virtual network element sending a response packet to a target virtual network element; the second flow table entry configuration information is generated during the process of the current virtual network element receiving a test packet. Among them, the response packet is a packet that the current virtual network element forwards after receiving the test packet. Among them, the test device can be, but is not limited to, various personal computers, laptop computers, smartphones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, projection devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted device can be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The test device can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0050] In an exemplary embodiment, as Figure 2 shown, a method based on virtual network elements is provided. Taking the test device applied to Figure 1 as an example for illustration, it includes the following steps 202 to step 206.
[0051] Among them:
[0052] Step 202, obtain the configuration information of the current virtual network element.
[0053] Among them, the configuration information refers to the parameters required for the operation of the VNF, such as IP addresses, forwarding policies, mac addresses, flow table rules, etc.
[0054] Exemplarily, in combination with Figure 1 , Figure 1 test virtual network element B. Then virtual network element B is the current virtual network element. In other embodiments, if testing virtual network element A or virtual network element N, then the current virtual network element is virtual network element A or virtual network element B.
[0055] Optionally, the configuration information of the current VNF can be obtained through the API (Application Programming Interface), CLI (Command-Line Interface), or configuration file.
[0056] Step 204: Generate configuration parameter values based on the configuration information, and perform reliability testing on the configuration interface of the current virtual network element based on the configuration parameter values.
[0057] Among them, performing reliability testing on the configuration interface means verifying whether the configuration interface of the virtual network element can correctly parse and execute configuration commands and remain stable in abnormal or extreme situations. This can ensure that the configuration interface of the VNF will not cause incorrect behavior or crashes due to abnormal inputs or high-concurrency calls, improving the stability of the system.
[0058] Optionally, the configuration parameter values can be generated based on default values. For network parameters that need to be initialized, such as MTU (Maximum Transmission Unit), QoS (Quality of Service) thresholds, etc., the default values can be extracted from the default configuration file or database as test parameter values.
[0059] Optionally, the configuration parameter values can also be generated based on a rule range. For firewall policies, ACL rules, etc., legal IP address segments, port ranges, etc. can be generated according to the preset range, and test parameters can be randomly selected.
[0060] Optionally, the configuration parameter values can be generated based on random or extreme values. In reliability testing, extremely large or extremely small parameter values can be generated, such as the maximum number of flow table entries, extremely long configuration commands, etc., to test the exception handling ability of the VNF.
[0061] Optionally, the way to perform reliability testing can be to send configuration commands in the correct format and verify whether they are correctly issued through the query interface.
[0062] Optionally, the way to perform reliability testing can also be to input parameters in an illegal format, such as illegal IP addresses, unsupported protocol types, observe whether the system returns error messages, and prevent the configuration from taking effect.
[0063] Step 206: When the reliability test passes, construct test packets and perform testing on the forwarding function and / or sending function of the current virtual network element based on the test packets.
[0064] Among them, the test packet refers to a data packet in a specific format used to verify the network function of the VNF, which can be an ICMP (Internet Control Message Protocol) packet, a TCP SYN (Transmission Control Protocol Synchronize) packet, a UDP (User Datagram Protocol) flow, an HTTP (Hypertext Transfer Protocol) request packet, a control packet of a specific protocol, etc. In this embodiment, the test packet is constructed according to the test scenario.
[0065] If the reliability test of the configuration interface passes, it proves that the VNF can correctly parse and apply the configured information sent down. Subsequent network function tests can be based on this configuration. Therefore, it is necessary to actually verify the data processing ability of the VNF next, including the ability to receive and send packets.
[0066] Optionally, the test packet can be sent to the input end of the VNF, and observe whether the VNF correctly receives and forwards it, so as to test the forwarding function of the virtual network element.
[0067] Optionally, the test packet can be sent out from the output port of the VNF, and detect whether the packet is forwarded or modified as expected, so as to test the sending function of the virtual network element.
[0068] It should be noted that the forwarding logic depends on the configuration logic. Therefore, before performing the forwarding test, it is first necessary to perform a reliability test on the configuration interface. This can ensure that the configuration parameters are sent down correctly, and the network element can load and parse the configuration as expected, thus avoiding test errors or abnormal situations caused by configuration errors.
[0069] Step 208, obtain a test result based on the first flow table entry configuration information sent by the current virtual network element and / or the second flow table entry configuration information received by the current virtual network element; the first flow table entry configuration information is generated during the process that the current virtual network element sends a response packet to the target virtual network element; the second flow table entry configuration information is generated during the process that the current virtual network element receives the test packet; the response packet is the packet that the current virtual network element forwards after receiving the test packet.
[0070] Among them, the first flow table entry configuration information is the flow table information generated by the VNF after receiving the test packet, taking the test packet as the response packet and generating it according to its own forwarding policy. For example, the SDN (Software Defined Networking) switch updates the flow table entries according to the OpenFlow (OpenFlow Protocol) rules to forward the data packets along the specified path; the second flow table entry configuration information is the flow table entry generated by the VNF based on the current configuration when processing the received test packet. For example, the firewall dynamically generates allow / deny rules, etc. The test system will check the flow table information inside the VNF through commands to ensure that it is consistent with the target configuration. If the flow table entry matches the test packet processing logic, the test is considered passed; otherwise, the abnormal situation is recorded for further analysis.
[0071] Among them, the target virtual network element is the next node in the network topology.
[0072] Furthermore, the target configuration refers to the flow table rules and data processing behaviors that the VNF should generate under correct configuration and testing conditions.
[0073] Exemplarily, considering the flow table test of the SDN switch, the target configuration can be the following flow table rules. For example, priority = 100, in_port = 1, ip, nw_dst = 192.168.1.100, actions = output:2. The packets flowing to 192.168.1.100 should be sent out from port 2. During the test, a test packet with the IP destination address of 192.168.1.100 is sent to switch port 1. Finally, check the current flow table. If it correctly matches the above rules, the test passes.
[0074] It should be noted that during the test, the current virtual network element is isolated from the current topology and does not depend on the complete network topology. The forwarding function and / or sending function of the current virtual network element are tested. Therefore, during the test, it is necessary to simulate the previous node of the current network element to construct a test packet and send it to the current virtual network element. So the first flow table entry configuration information is generated during the process of sending it to the current virtual network element.
[0075] In the above test method based on virtual network elements, first, configuration parameter values are generated according to the configuration information, and the reliability of the configuration interface of the current virtual network element is tested. Then, according to the test packet, the forwarding function and / or sending function of the current virtual network element are tested. By testing the configuration interface, forwarding function, and / or sending function separately in this way, each virtual network element can be decoupled from the link to test each virtual network element independently without depending on other virtual network elements, thereby accurately locating the faults.
[0076] In one embodiment, generating configuration parameter values based on the configuration information includes: obtaining a preset configuration value range; generating configuration parameter values within the preset configuration value range based on the configuration information; the configuration information includes one or more of an IP address, a forwarding policy, a MAC address, a flow table rule, and a protocol type.
[0077] Optionally, obtaining a preset configuration range refers to the range of values that a configuration item can take, and these ranges are usually preset to ensure that the generated configuration parameter values are legal.
[0078] Exemplarily, the IP address range can be 192.168.1.0 / 24, indicating that the IP can only be selected from this network segment; the MAC address range: can be 00:1A:2B:XX:XX:XX, ensuring compliance with the device MAC address rule, etc.
[0079] Exemplarily, assuming that the IP address in the configuration information of the current virtual network element is 192.168.1.10, then according to the preset configuration value range, the generated IP addresses can be 192.168.1.20, 192.168.1.30, and 10.0.0.4, etc.
[0080] Combined with the actual configuration of the current virtual network element, generate configuration parameter values suitable for testing within this range to ensure that the test can cover normal situations and can also test abnormal and boundary values.
[0081] This process can reduce manual intervention to ensure that the test configuration is both logical and can discover potential errors through testing.
[0082] In one embodiment, the above configuration information further includes a scenario identifier; after obtaining the configuration information of the current virtual network element, it further includes: when the scenario identifier represents an abnormal scenario, obtaining corresponding abnormal type information according to the scenario identifier; determining abnormal simulation parameter values according to the abnormal type information; the abnormal simulation parameter values are used to construct an abnormal simulation scenario, and the abnormal simulation scenario is used to test the current virtual network element under abnormal conditions.
[0083] Among them, the scenario identifier is a type indicating the current test scenario. If there is a scenario identifier, it is necessary to simulate error situations, such as network packet loss, CPU (Central Processing Unit) overload, and configuration errors, etc.
[0084] Optionally, when the scenario identifier represents an abnormal scenario, obtain the corresponding abnormal type information according to the scenario identifier. The abnormal type information refers to specific abnormal types, such as configuration errors, network anomalies, resource anomalies, and software anomalies. A configuration error refers to an incorrect IP address, MAC address, or flow table rule; a network anomaly refers to packet loss, latency, jitter, etc.; a resource anomaly refers to CPU overload, insufficient memory, etc.; a software anomaly refers to the crash of a key process.
[0085] Furthermore, if simulating an IP configuration error, the abnormal simulation parameter value can be an invalid IP; if simulating packet loss, the abnormal simulation parameter value can be the packet loss rate; if simulating CPU overload, the abnormal simulation parameter value can set the CPU usage rate to 100%.
[0086] In this embodiment, the abnormal simulation parameter value is to impose an anomaly in the VNF operating environment to detect whether the VNF can handle it correctly.
[0087] Exemplarily, for the network anomaly corresponding to the scenario identifier, the corresponding abnormal type information can be packet loss, and the abnormal simulation parameter value is set to a packet loss rate of 50%. In the test scenario, create packet loss, let the VNF process the traffic, and detect whether it will erroneously discard legitimate traffic and whether it will automatically retransmit, etc.
[0088] Optionally, the abnormal simulation parameter value can be generated through a Hook module.
[0089] In one embodiment, the reliability test of the configuration interface of the current virtual network element based on the configuration parameter value includes: sending the configuration parameter value to the current virtual network element through a preset interface to obtain the feedback result of configuration distribution; the feedback result is obtained after the configuration interface of the virtual network element executes the corresponding configuration command according to the configuration parameter value; when the feedback result conforms to the preset configuration result, it is determined that the reliability test of the configuration interface passes.
[0090] Among them, the preset interface refers to the configuration interface directly exposed by the network element, such as in the form of a command line or some SDK forms.
[0091] During the process of performing reliability testing on the configuration interface of the current virtual network element based on the configuration parameter values, first, the configuration parameter values are sent to the virtual network element through a preset interface to enable it to perform corresponding configuration operations, such as setting the IP address, modifying the forwarding policy, or updating the flow table rules. After receiving the configuration instruction, the configuration interface of the virtual network element will parse the parameters and execute the corresponding commands, and then return a feedback result, which reflects whether the configuration has been successfully applied. For example, when the configuration interface is correctly executed, the feedback result may contain "success" or specific configuration information; if the configuration fails, error messages such as "invalid configuration" or "exceeding the parameter range" may be returned. Finally, the feedback result is compared with the preset expected result. If the two are consistent, it is determined that the reliability test of the configuration interface passes, indicating that the configuration instruction can be correctly issued and take effect; if the two are inconsistent, it means that there may be an abnormality in the configuration interface.
[0092] In one embodiment, the above-mentioned testing of the sending function of the current virtual network element based on test packets includes: sending the test packets to the current virtual network element through a preset packet processing framework;
[0093] In this embodiment, in order to test the sending function of the current virtual network element, the system will control the virtual network element to use a preset packet processing framework, such as DPDK (Data Plane Development Kit), VPP (Vector Packet Processing), or a Linux kernel-based network stack to send the test packets to the target virtual network element. The purpose of this test is to verify whether the current virtual network element can correctly send the data packets to the target address according to the expected forwarding policy, flow table rules, or routing configuration, and ensure that the data is not lost or tampered with during the forwarding process. The test system can determine whether the sending function meets the expectations by capturing the packets received by the target virtual network element or checking the forwarding status of the intermediate switching device.
[0094] Exemplarily, the test packets are sent to the current virtual network element, and the response packets of the current virtual network element are detected, that is, the packets sent by the current virtual network element to the next node in the real topology.
[0095] In one embodiment, the above-mentioned testing of the forwarding function of the current virtual network element based on test packets includes: sending the test packets to the current virtual network element, and the current virtual network element generates response packets according to the test packets and forwards the response packets to the target virtual network element.
[0096] In this embodiment, to test the forwarding function of the current virtual network element, the test system constructs specific test packets and sends them to the current virtual network element. After receiving the test packets, the current virtual network element parses and processes the prediction packets according to the pre-configured forwarding flow table, generates corresponding response packets, and sends the response packets to the target virtual network element, simulating the data transmission process in a real network environment. The purpose of this test is to verify whether the virtual network element can correctly receive, parse, and forward incoming network data, and accurately perform the routing and forwarding behavior of data packets based on the forwarding policy.
[0097] In an exemplary embodiment, as shown in Figure 3 shown Figure 3 is a schematic diagram of the test process based on virtual network elements in an embodiment.
[0098] In this test architecture, the test environment is located in a virtual machine (VM) and includes a DPDK virtual network element and a test program, which are used to verify the receiving and sending capabilities of network element B. During the test, the DPDK virtual network element (NIC0) is responsible for high-speed processing of service traffic and providing flow table matching information, while the test program (NIC1) is responsible for generating test packets and monitoring the data processing situation of network element B. In the receive test, the test program sends data packets to network element B and analyzes its receiving situation; in the send test, the test program checks whether the data packets sent by network element B conform to the expected flow table rules. Finally, by comparing the first flow table entry and the second flow table entry, it is determined whether the data forwarding of network element B meets the expectations.
[0099] In this embodiment, the process of network element receiving and sending various types of packets is simulated on a single node, so as to evaluate whether the network element behavior meets the expectations, without relying on the entire network topology. This not only improves the flexibility and reliability of the test, but also facilitates quick problem location, reducing the test cost and complexity.
[0100] In an exemplary embodiment, as shown in Figure 4 shown, a test method based on multiple virtual network elements is provided, including the following steps 402 to step 404. Among them:
[0101] Step 404, generate scenario identifiers for different test scenarios and write the scenario identifiers into the configuration files of each virtual network element.
[0102] First, generate scenario identifiers for multiple test scenarios. These identifiers are used to distinguish different test conditions, such as normal forwarding, abnormal simulation, traffic surge, etc. Then, the system writes these scenario identifiers into the configuration files of each virtual network element to ensure that each network element can load the corresponding test environment and parameters when performing the test.
[0103] Step 406: When a test instruction is received, each virtual network element is tested according to the virtual-network-element-based test method of any of the above, and the test results corresponding to each virtual network element are obtained; each virtual network element runs on the same device by switching the network element process.
[0104] When a test instruction is received, each virtual network element is tested according to the virtual-network-element-based test method in any of the above embodiments.
[0105] In this embodiment, the functional tests of multiple network elements are implemented in a single development vm. Therefore, the network element process is switched to switch the network element to be tested in the test program, and different configuration files are switched according to different test network elements, including the configuration files required for the network element to execute and the configuration files on which the test program depends, to ensure the normal switching of the network element process. Then, each virtual network element is tested in turn.
[0106] If there is no network element to be tested, the test ends. Multiple test results and test logs are obtained according to different test network elements. If there are still network elements to be tested, continue to test according to the virtual-network-element-based test method in any of the above embodiments.
[0107] In an exemplary embodiment, as Figure 5 shown, Figure 5 is the step flowchart of the virtual-network-element-based test in another embodiment.
[0108] In this embodiment, it includes virtual network elements A and B. Network element B receives user packets, and then network element A receives the reported packets sent by network element B and issues a flow table to network element B after processing. There is a test network card eth0 on the virtual machines where network elements A and B are located. The functional process of testing the network elements is as follows:
[0109] The first step: Hook determination and issuance: Determine whether Hook is required according to different test scenarios. If Hook needs to be issued, enter the second step; otherwise, enter the third step.
[0110] The second step: Hook module. The automated test module issues Hook configurations according to the test scenarios that need to be simulated and switched. For example, modify the __is_pointer_null() function to simulate the exception situation where the pointer is null during the configuration issuance process. That is, when the scenario identifier represents an abnormal scenario, according to the abnormal type information, the abnormal simulation parameter value is determined. The abnormal simulation parameter value in this embodiment is the exception where the pointer is null.
[0111] Step 3: Configuration Download Test: According to the configurations of Network Element A and Network Element B, the automated test module generates configuration parameters. The configuration download test module calls the configuration interface of Network Element A to verify the reliability of the test verification interface before forwarding the test.
[0112] Step 4: Determine whether to continue the forwarding test. To test the configuration download, abnormal parameters or extreme parameters will be constructed, which are generally not used for forwarding. If the configuration parameters are applicable to the forwarding logic verification, proceed to Step 5; otherwise, proceed to Step 6. The configuration test generally calls the configuration interface of the VNF, usually in the form of a command line. Configuration commands are used to add, update, and delete configurations, and query commands are used to check whether the configuration download and modification meet the expectations.
[0113] Step 5: Forwarding Test: The automated test module switches the test scenario and provides the parameters required to construct the specified data packet. The forwarding test module sends the packet to Network Elements A and B (DPDK network cards) through eth0 (Ethernet port) and receives the packets sent by the VNF to verify the forwarding behavior. Using the statistical query interface of the VNF, such as the number of incoming and outgoing packets, the forwarding behavior is further verified. For Network Element A, during the test, the reported packets of Network Element B will be simulated and it will be verified whether the packets forwarded by Network Element A are the expected downloaded flow table packets. For Network Element B, a user packet will be constructed and sent to Network Element B, and it will be verified whether the forwarded packet is the expected reported packet.
[0114] Step 6: The automated test module collects the test results and logs, and the test ends.
[0115] It should be understood that although each step in the flowcharts involved in the above-described embodiments is shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless clearly stated in this article, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0116] Based on the same inventive concept, embodiments of the present application also provide a virtual network element-based test apparatus for implementing the above-mentioned virtual network element-based test method, as well as a multiple virtual network element-based test apparatus for testing multiple virtual network elements. The solution provided by this apparatus for solving problems is similar to the solution described in the above method. Therefore, the specific limitations in one or more of the following virtual network element-based test apparatuses and multiple virtual network element-based test embodiments can refer to the limitations on the virtual network element-based test method and the multiple virtual network element-based test method in the above text, and will not be repeated here.
[0117] In an exemplary embodiment, as Figure 6 shown, a virtual network element-based test apparatus is provided, including: an acquisition module, an interface test module, a function test module, and a result generation module, where:
[0118] The acquisition module is used to acquire the configuration information of the current virtual network element;
[0119] The interface test module is used to generate configuration parameter values according to the configuration information, and perform reliability tests on the configuration interfaces of the current virtual network element based on the configuration parameter values;
[0120] The function test module is used to construct test packets and test the forwarding function and / or sending function of the current virtual network element based on the test packets when the reliability test passes;
[0121] The result generation module is used to obtain test results based on the first flow table entry configuration information sent by the current virtual network element and / or the second flow table entry configuration information received by the current virtual network element; the first flow table entry configuration information is generated during the process of the current virtual network element sending a response packet to the target virtual network element; the second flow table entry configuration information is generated during the process of the current virtual network element receiving a test packet. Among them, the response packet is a packet forwarded by the current virtual network element after receiving the test packet.
[0122] In one embodiment, the above interface test module includes:
[0123] The range acquisition sub-module is used to acquire a preset configuration value range;
[0124] The configuration generation sub-module is used to generate configuration parameter values within the preset configuration value range based on the configuration information; the configuration information includes one or more of an IP address, a forwarding policy, a mac address, a flow table rule, and a protocol type.
[0125] In one embodiment, the above apparatus further includes an exception module, and the exception module includes:
[0126] An exception information acquisition sub-module, configured to obtain corresponding exception type information according to the scenario identifier when the scenario identifier represents an abnormal scenario.
[0127] A simulation value generation sub-module, configured to determine an abnormal simulation parameter value according to the exception type information; the abnormal simulation parameter value is used to construct an abnormal simulation scenario, and the abnormal simulation scenario is used to test the current virtual network element in case of an exception.
[0128] In one embodiment, the above interface test module includes:
[0129] A sending sub-module, configured to send a configuration parameter value to the current virtual network element through a preset interface to obtain a feedback result of configuration distribution; the feedback result is obtained after the configuration interface of the virtual network element executes a corresponding configuration command according to the configuration parameter value.
[0130] A determination sub-module, configured to determine that the reliability test of the configuration interface passes when the feedback result conforms to a preset configuration result.
[0131] In one embodiment, the above function test module includes:
[0132] A sending function test sub-module, configured to send a test message to the current virtual network element through a preset data packet processing framework.
[0133] A forwarding function test sub-module, configured to send a test message to the current virtual network element, and the current virtual network generates a response message according to the test message and forwards the response message to a target virtual network element.
[0134] In an exemplary embodiment, as Figure 7 shown, a test device based on a virtual network element is provided, including: a configuration module and a test module, where:
[0135] The configuration module is configured to generate scenario identifiers for different test scenarios and write the scenario identifiers into the configuration files of each virtual network element;
[0136] The test module is configured to, when receiving a test instruction, test each virtual network element according to the test device based on a virtual network element in any of the above embodiments to obtain a test result corresponding to each virtual network element; each virtual network element runs on the same device by switching the network element process.
[0137] Each module in the above test device based on a virtual network element and the test device based on multiple virtual network elements can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0138] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows Figure 8 shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store configuration information. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements a test method based on virtual network elements.
[0139] Those skilled in the art can understand that Figure 8 the structure shown in
[0140] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, it implements the steps of the method in any of the above embodiments.
[0141] In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, it implements the steps of the method in any of the above embodiments.
[0142] In an embodiment, a computer program product is provided, including a computer program. When the computer program is executed by the processor, it implements the steps of the method in any of the above embodiments.
[0143] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, artificial intelligence (AI) processors, etc., without limitation.
[0144] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered to be within the scope recorded in the present application.
[0145] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation to the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims
1. A test method based on virtual network elements, characterized in that, The method includes: Obtaining the configuration information of the current virtual network element; Generating a configuration parameter value according to the configuration information, and performing a reliability test on the configuration interface of the current virtual network element based on the configuration parameter value; When the reliability test passes, constructing a test message, and performing a test on the forwarding function and / or sending function of the current virtual network element based on the test message; Obtaining a test result based on the first flow table entry configuration information sent by the current virtual network element and / or the second flow table entry configuration information received by the current virtual network element; the first flow table entry configuration information is generated during the process of the current virtual network element sending a response message to the target virtual network element; the second flow table entry configuration information is generated during the process of the current virtual network element receiving the test message; the response message is a message forwarded by the current virtual network element after receiving the test message.
2. The method according to claim 1, characterized in that, The generating the configuration parameter value according to the configuration information includes: Obtaining a preset configuration value range; Generating the configuration parameter value within the preset configuration value range based on the configuration information; the configuration information includes one or more of an IP address, a forwarding policy, a mac address, a flow table rule, and a protocol type.
3. The method according to claim 1, wherein The configuration information further includes a scenario identifier; after obtaining the configuration information of the current virtual network element, it further includes: When the scenario identifier represents an abnormal scenario, obtaining corresponding abnormal type information according to the scenario identifier; Determining an abnormal simulation parameter value according to the abnormal type information; the abnormal simulation parameter value is used to construct an abnormal simulation scenario, and the abnormal simulation scenario is used to test the current virtual network element in an abnormal situation.
4. The method according to claim 1, wherein The performing the reliability test on the configuration interface of the current virtual network element based on the configuration parameter value includes: Sending the configuration parameter value to the current virtual network element through a preset interface, and obtaining a feedback result of configuration distribution; the feedback result is obtained after the configuration interface of the virtual network element executes a corresponding configuration command according to the configuration parameter value; When the feedback result conforms to a preset configuration result, determining that the reliability test of the configuration interface passes.
5. The method according to claim 1, wherein The performing the test on the sending function of the current virtual network element based on the test message includes: Sending the test message to the current virtual network element through a preset data packet processing framework; The performing the test on the forwarding function of the current virtual network element based on the test message includes: Sending the test message to the current virtual network element, and the current virtual network element generates the response message according to the test message and forwards the response message to the target virtual network element.
6. A test method based on multiple virtual network elements, characterized in that, The method includes: Generating scenario identifiers for different test scenarios, and writing the scenario identifiers into the configuration files of each virtual network element; When receiving a test instruction, testing each of the virtual network elements according to the virtual network element-based test method according to any one of claims 1-5, to obtain test results corresponding to each of the virtual network elements; each of the virtual network elements runs on the same device by switching network element processes.
7. A test device based on a virtual network element, characterized in that The device includes: An acquisition module, configured to acquire configuration information of a current virtual network element; An interface test module, configured to generate configuration parameter values according to the configuration information, and perform a reliability test on a configuration interface of the current virtual network element based on the configuration parameter values; A function test module, configured to construct a test message and perform a test on a forwarding function and / or a sending function of the current virtual network element based on the test message when the reliability test passes; A result generation module, configured to obtain a test result based on first flow table entry configuration information sent by the current virtual network element and / or second flow table entry configuration information received by the current virtual network element; the first flow table entry configuration information is generated during the process that the current virtual network element sends a response message to a target virtual network element; the second flow table entry configuration information is generated during the process that the current virtual network element receives the test message; the response message is a message that the current virtual network element forwards after receiving the test message.
8. A test device based on multiple virtual network elements, characterized in that, The apparatus includes: A configuration module, configured to generate scenario identifiers for different test scenarios, and write the scenario identifiers into configuration files of respective virtual network elements; A test module, configured to, when receiving a test instruction, test each of the virtual network elements according to the test apparatus based on virtual network elements according to claim 7, and obtain test results corresponding to the respective virtual network elements; each of the virtual network elements runs on the same device by switching network element processes.
9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 or 6 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 or 6 are implemented.
Citation Information
Cited By
Virtual switch deployment and test method and device
CN121239653A
A virtual switch deployment, testing method and apparatus
CN121239653B