Automatic testing method, device and equipment for detecting vrrp flow switching

By automatically configuring the virtual gateway and priority of the switch, and using automated testing terminals for link detection, the network impact and cumbersome testing problems caused by artificial manufacturing failures in the prior art are solved, rapid fault detection and switching are achieved, and detection efficiency is improved.

CN119945933AActive Publication Date: 2025-05-06SHENZHEN FENGRUNDA TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510106037.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-05-06
Estimated Expiration
2045-01-23

AI Technical Summary

Technical Problem

In the prior art, when detecting VRRP traffic switching, artificial failures are required, resulting in the normal operation of the network and the testing process is cumbersome, making it difficult to achieve rapid fault detection and switching.

Method used

An automated testing method is proposed, by configuring the virtual gateway and priority of the switch, using an automated test terminal for link detection, and realizing automated testing of VRRP traffic switching.

Benefits of technology

Fast fault detection and switching are realized, avoiding the impact of artificial failures on the network, and improving the efficiency of detecting VRRP traffic switching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119945933A_ABST
    Figure CN119945933A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic test method, device and equipment for detecting vrrp flow switching, and relates to the technical field of network communication, and the method comprises the steps: getting through three-layer routing settings of an automatic test terminal, a first switch, a second switch, a third switch and a fourth switch according to a preset routing configuration rule; the first switch and the second switch are configured to be main and standby; according to the method, link detection is carried out on the interfaces connected with the first switch, the second switch and the third switch and the interfaces connected with the first switch, the second switch and the fourth switch to obtain a link detection result, and a common vrrp two-computer test is simplified into a one-computer test. The flow switching test is carried out in an automatic mode, so that partial influence on normal operation of a network possibly caused by manual fault manufacturing is avoided, rapid fault detection and switching are realized, and the vrrp flow switching detection efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network communication technology, and in particular to an automated testing method, device and equipment for detecting VRRP traffic switching. Background Art

[0002] In the existing VRRP (Virtual Routing Redundancy Protocol) technology, at least two devices (such as routers or switches) are usually required to implement the redundant backup function. These devices form a virtual router, and by configuring a virtual IP address as the default gateway, redundant management of network traffic is implemented. Under normal circumstances, one device acts as the Master to handle all traffic, while the other device is on standby as the Backup.

[0003] In order to verify whether the redundancy function of VRRP is working properly, it is usually necessary to artificially create a fault to trigger the master-slave switch. For example, you can shut down the interface of the master device or simulate a link failure to observe whether the backup device can correctly take over the traffic. In actual testing, technicians will manually shut down the uplink interface of the master device, or configure the interface tracking function to lower the priority of the master device, thereby triggering the preemption of the backup device. In addition, you can also verify whether the traffic has been correctly forwarded to the new Master device by testing the network access of the terminal device. Although this test method can effectively verify the redundancy function of VRRP, it has some limitations. For example, artificially creating faults may have a certain impact on the normal operation of the network, and the testing process is relatively cumbersome.

[0004] Therefore, how to achieve rapid fault detection and switching, thereby improving the efficiency of detecting VRRP traffic switching, is a problem that needs to be solved urgently.

[0005] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0006] The main purpose of this application is to provide an automated testing method, device and equipment for detecting VRRP traffic switching, aiming to solve the technical problem of how to achieve rapid fault detection and switching, thereby improving the efficiency of detecting VRRP traffic switching.

[0007] To achieve the above objectives, the present application proposes an automated testing method for detecting VRRP traffic switching, the method comprising:

[0008] An automated test method for detecting VRRP traffic switching, the automated test method for detecting VRRP traffic switching being applied to an automated test terminal in an automated test system for detecting VRRP traffic switching, the automated test system for detecting VRRP traffic switching comprising a plurality of switches and the automated test terminal, the plurality of switches comprising a first switch, a second switch, a third switch and a fourth switch, wherein the output ends of the first switch and the second switch are respectively connected to the input end of the third switch, the output end of the third switch is connected to the automated test terminal, and the input ends of the first switch and the second switch are respectively connected to the output end of the fourth switch;

[0009] The automated test terminal, the first switch, the second switch, the third switch and the fourth switch are all provided with a plurality of virtual gateways, and are connected through the virtual gateways corresponding to the switches. The first switch and the second switch are respectively provided with priorities, and the fourth switch is also provided with a simulated external network address;

[0010] The method includes:

[0011] According to the preset routing configuration rules, the three-layer routing settings of the automated test terminal, the first switch, the second switch, the third switch and the fourth switch are connected;

[0012] According to the VRRP protocol, configure the first switch and the second switch to be active / standby with each other;

[0013] Performing link detection on interfaces connected to the first switch, the second switch, and the third switch to obtain a first link detection result;

[0014] Link detection is performed on interfaces connected to the first switch, the second switch, and the fourth switch to obtain a second link detection result.

[0015] In one embodiment, the step of connecting the three-layer routing settings of the automated test terminal, the first switch, the second switch, the third switch, and the fourth switch according to the preset routing configuration rule includes:

[0016] Set the interfaces connected to each switch to trunk mode;

[0017] Release all virtual subnets, and configure a static route for the fourth switch to receive all traffic with unknown destination addresses;

[0018] In the first virtual subnet, IP addresses are allocated to the first switch, the second switch, the third switch, the fourth switch and the automated test terminal;

[0019] In the second virtual subnet, IP addresses are allocated to the first switch, the second switch, the third switch and the automated test terminal;

[0020] In the third virtual subnet, IP addresses are allocated to the first switch, the second switch, the fourth switch and the automated test terminal;

[0021] In the fourth virtual subnet, assigning IP addresses to the first switch and the fourth switch;

[0022] In the fifth virtual subnet, IP addresses are allocated to the second switch and the fourth switch.

[0023] In one embodiment, configuring the first switch and the second switch to be mutually active and standby according to the VRRP protocol includes:

[0024] In the second virtual subnet, the first switch is set as a main switch, and the second switch is set as a standby switch;

[0025] In the third virtual subnet, the second switch is set as a main switch, and the first switch is set as a standby switch.

[0026] In one embodiment, the performing link detection on interfaces connected to the first switch, the second switch, and the third switch includes:

[0027] Setting the interface of the third switch connected to the automated test terminal to access mode;

[0028] In the second virtual subnet, detecting the state of the first switch;

[0029] In the third virtual subnet, a state of the second switch is detected.

[0030] In one embodiment, detecting the state of the first switch in the second virtual subnet includes:

[0031] Modify the IP address of the automated test terminal to the second VLAN address, and set the address of the virtual gateway to the second VLAN virtual address;

[0032] Sending a signal to the simulated external network address to detect whether communication is possible;

[0033] During normal communication, disconnecting the first link between the first switch and the third switch;

[0034] Sending a signal to the simulated external network address to detect whether communication is possible;

[0035] During normal communication, the status of the second switch is checked.

[0036] In one embodiment, detecting the state of the second switch in the third virtual subnet includes:

[0037] Restore the first link, modify the IP address of the automated test terminal to the third VLAN address, and set the address of the virtual gateway to the third VLAN virtual address;

[0038] Sending a signal to the simulated external network address to detect whether communication is possible;

[0039] During normal communication, disconnecting the second link between the second switch and the third switch;

[0040] Sending a signal to the simulated external network address to detect whether they can communicate with each other;

[0041] During normal communication, the state of the first switch is checked.

[0042] In one embodiment, the performing link detection on the interfaces connected to the first switch, the second switch, and the fourth switch includes:

[0043] Enable uplink detection of the first switch and the second switch;

[0044] Setting the interface connecting the first switch and the fourth switch and the interface connecting the second switch and the fourth switch as uplink detection ports;

[0045] disconnecting the third link between the first switch and the fourth switch;

[0046] Sending a signal to the simulated external network address to detect whether they can communicate with each other;

[0047] During normal communication, it is determined that the master-slave preemption mechanism takes effect;

[0048] Restore the third link, modify the IP address of the automated test terminal to the third VLAN address, set the virtual gateway address to the third VLAN virtual address, and disconnect the fourth link between the second switch and the fourth switch;

[0049] Sending a signal to the simulated external network address to detect whether they can communicate with each other;

[0050] During normal communication, it is determined that the master-slave preemption mechanism takes effect.

[0051] In one embodiment, the first link detection result and the second link detection result are communication results of sending a signal to the simulated external network address to detect whether communication is possible;

[0052] After sending a signal to the simulated external network address and detecting whether communication is possible, the method further includes:

[0053] The communication results are recorded to facilitate troubleshooting.

[0054] In addition, to achieve the above-mentioned purpose, the present application also proposes an automated testing device for detecting VRRP traffic switching, wherein the automated testing device for detecting VRRP traffic switching comprises:

[0055] A configuration module, used to open up the three-layer routing settings of the automated test terminal, the first switch, the second switch, the third switch and the fourth switch according to a preset routing configuration rule;

[0056] The configuration module is further used to configure the first switch and the second switch to be active / standby with each other according to the VRRP protocol;

[0057] a detection module, configured to perform link detection on interfaces connected to the first switch, the second switch, and the third switch to obtain a first link detection result;

[0058] The detection module is further used to perform link detection on the interfaces connected to the first switch, the second switch and the fourth switch to obtain a second link detection result.

[0059] In addition, to achieve the above-mentioned purpose, the present application also proposes an automated testing device for detecting VRRP traffic switching, the device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the automated testing method for detecting VRRP traffic switching as described above.

[0060] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the automated testing method for detecting VRRP traffic switching as described above are implemented.

[0061] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the automated testing method for detecting VRRP traffic switching as described above.

[0062] The automated testing method for detecting VRRP traffic switching proposed in the present application is applied to an automated testing terminal in an automated testing system for detecting VRRP traffic switching, wherein the automated testing system for detecting VRRP traffic switching comprises a plurality of switches and the automated testing terminal, wherein the plurality of switches comprises a first switch, a second switch, a third switch and a fourth switch, wherein the output ends of the first switch and the second switch are respectively connected to the input end of the third switch, the output end of the third switch is connected to the automated testing terminal, and the input ends of the first switch and the second switch are respectively connected to the output end of the fourth switch; the automated testing terminal, the first switch, the second switch, the third switch and the fourth switch are all provided with a plurality of virtual gateways, which are connected through the virtual gateways corresponding to the respective switches, and the first switch and the second switch are respectively provided with priority, the fourth switch is also provided with a simulated external network address; according to the preset routing configuration rules, the three-layer routing settings of the automated test terminal, the first switch, the second switch, the third switch and the fourth switch are opened; according to the VRRP protocol, the first switch and the second switch are configured to be mutually active and standby; a link detection is performed on the interface connected to the first switch, the second switch and the third switch to obtain a first link detection result; a link detection is performed on the interface connected to the first switch, the second switch and the fourth switch to obtain a second link detection result. This application simplifies the common VRRP test of two computers into one computer for testing, and uses an automated method to perform traffic switching testing, thereby avoiding some of the impact that artificial faults may have on the normal operation of the network, and achieving rapid fault detection and switching, thereby improving the efficiency of detecting VRRP traffic switching. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0064] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0065] Figure 1 A flow chart of the first embodiment of the automated testing method for detecting VRRP traffic switching provided by the present application;

[0066] Figure 2 A network diagram provided for the first embodiment of the automated testing method for detecting VRRP traffic switching of the present application;

[0067] Figure 3 A schematic diagram of the module structure of an automated testing device for detecting VRRP traffic switching according to an embodiment of the present application;

[0068] Figure 4 This is a schematic diagram of the device structure of the hardware operating environment involved in the automated testing method for detecting VRRP traffic switching in an embodiment of the present application.

[0069] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0070] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0071] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0072] The main solution of the embodiment of the present application is: an automated test method for detecting VRRP traffic switching, the automated test method for detecting VRRP traffic switching is applied to an automated test terminal in an automated test system for detecting VRRP traffic switching, the automated test system for detecting VRRP traffic switching comprises a plurality of switches and the automated test terminal, the plurality of switches comprises a first switch, a second switch, a third switch and a fourth switch, wherein the output ends of the first switch and the second switch are respectively connected to the input end of the third switch, the output end of the third switch is connected to the automated test terminal, and the input ends of the first switch and the second switch are respectively connected to the output end of the fourth switch;

[0073] The automated test terminal, the first switch, the second switch, the third switch and the fourth switch are all provided with a plurality of virtual gateways, and are connected through the virtual gateways corresponding to the respective switches. The first switch and the second switch are respectively provided with priorities, and the fourth switch is also provided with a simulated external network address. The method described includes: according to a preset routing configuration rule, opening up the three-layer routing settings of the automated test terminal, the first switch, the second switch, the third switch and the fourth switch; configuring the first switch and the second switch to be mutually active and standby according to the VRRP protocol; performing link detection on the interfaces connected to the first switch, the second switch and the third switch to obtain a first link detection result; performing link detection on the interfaces connected to the first switch, the second switch and the fourth switch to obtain a second link detection result.

[0074] In this embodiment, for the convenience of description, the following description is made by taking the identification automation computer as the execution subject.

[0075] In the prior art, it is usually necessary to artificially create a fault to trigger the master-slave switch. For example, the interface of the master device can be shut down or a link failure can be simulated to observe whether the backup device can correctly take over the traffic. In actual testing, the technician will manually shut down the uplink interface of the master device, or configure the interface tracking function to lower the priority of the master device, thereby triggering the preemption of the backup device. In addition, the network access of the terminal device can be tested to verify whether the traffic has been correctly forwarded to the new Master device. Although this test method can effectively verify the redundancy function of VRRP, it has some limitations. Artificially created faults may have a certain impact on the normal operation of the network, and the test process is relatively cumbersome.

[0076] The present application provides a solution that simplifies the common VRRP two-computer test into a single-computer test, and uses an automated method to perform traffic switching tests, thereby avoiding some of the impacts that artificial faults may have on the normal operation of the network, achieving rapid fault detection and switching, and thus improving the efficiency of detecting VRRP traffic switching.

[0077] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, etc. The following takes a computer as an example to illustrate this embodiment and the following embodiments.

[0078] Based on this, the embodiment of the present application provides an automated testing method for detecting VRRP traffic switching, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the automated testing method for detecting VRRP traffic switching in the present application.

[0079] In this embodiment, the automated testing method for detecting VRRP traffic switching includes steps S10 to S40:

[0080] Step S10, according to the preset routing configuration rules, the three-layer routing settings of the automated test terminal, the first switch, the second switch, the third switch and the fourth switch are connected;

[0081] It should be noted that the preset routing configuration rules can be the rules used in network devices (such as routers or three-layer switches) to guide data packet forwarding, and the three-layer routing settings can refer to configuring the routing function on a three-layer network device (such as a three-layer switch or router) to achieve communication between different networks (such as VLANs, subnets or external networks).

[0082] It can be understood that by configuring the IP address of the switch according to the preset routing rules, a default path or a specific path for network traffic is specified, thereby ensuring that the data packet can correctly reach the destination.

[0083] In a feasible implementation, step S10 may include: setting the interfaces connected to each switch to trunk mode; releasing all virtual subnets, and configuring a static route for the fourth switch to receive all traffic with unknown destination addresses; in the first virtual subnet, allocating IP addresses to the first switch, the second switch, the third switch, the fourth switch and the automated test terminal; in the second virtual subnet, allocating IP addresses to the first switch, the second switch, the third switch and the automated test terminal; in the third virtual subnet, allocating IP addresses to the first switch, the second switch, the fourth switch and the automated test terminal; in the fourth virtual subnet, allocating IP addresses to the first switch and the fourth switch; in the fifth virtual subnet, allocating IP addresses to the second switch and the fourth switch.

[0084] For example, the automation computer connects to the switch command line through the paramiko module, and the interface connected to the switch is configured in trunk mode, allowing vlan1-10 (all virtual subnets) to pass. The configuration is as follows Figure 2 As shown in the three-layer interface IP address, sw1 (the first switch) and sw2 (the second switch) are each configured with a static route to the simulated external network, and sw4 (the fourth switch) is also configured with a 0.0.0.0 static route pointing to all returns, opening up all three-layer routing settings, in the first virtual subnet corresponding to vlanif1, IP addresses are allocated to sw1, sw2, sw3 (the third switch), sw4 and the automation computer (automatic test terminal); in the second virtual subnet corresponding to vlanif2 and vlan2, IP addresses are allocated to sw1, sw2, sw3 and the automation computer; in the third virtual subnet corresponding to vlanif3 and vlan3, IP addresses are allocated to sw1, sw2, sw4 and the automation computer; in the fourth virtual subnet corresponding to vlanif4, IP addresses are allocated to sw1 and sw4; in the fifth virtual subnet corresponding to vlanif5, IP addresses are allocated to sw2 and sw4.

[0085] The above is only a feasible implementation of step S10 provided in this embodiment, and this embodiment does not specifically limit the specific implementation of step S10.

[0086] Step S20, configuring the first switch and the second switch to be mutually active and standby according to the VRRP protocol;

[0087] It should be noted that the VRRP (Virtual Router Redundancy Protocol) protocol combines multiple routing devices into a virtual router. VRRP can ensure that when the main device fails, the backup device can automatically take over the work, thereby ensuring the continuity and reliability of network communications. The main and backup refer to routing devices that are in the main and backup states.

[0088] It can be understood that by configuring the first switch and the second switch to serve as a primary and a backup for each other, bandwidth can be saved, ensuring that the network can be seamlessly switched when a device fails, thereby ensuring the continuity and stability of the network.

[0089] In a feasible implementation, step S20 may include: in the second virtual subnet, setting the first switch as the main switch and the second switch as the backup switch; in the third virtual subnet, setting the second switch as the main switch and the first switch as the backup switch.

[0090] For example, in the second virtual subnet corresponding to vlanif2, 2, the virtual gateway of the vrrp interface of sw1 and sw2 is configured to be 192.168.2.254, with a priority of 120, and the virtual gateway of the interface vrrp of vlanif3 is configured to be 192.168.3.254, with a priority of 120. The default priority is 100. The larger the priority, the higher the priority. In vlanif2, sw1 is the main device and sw2 is the backup device. In vlanif3, sw2 is the main device and sw1 is the backup device. sw1 and sw2 are mutually main and backup devices, and no bandwidth is wasted.

[0091] The above is only a feasible implementation of step S20 provided in this embodiment, and this embodiment does not specifically limit the specific implementation of step S20.

[0092] Step S30, performing link detection on interfaces connected to the first switch, the second switch, and the third switch to obtain a first link detection result;

[0093] It should be noted that the link detection can be performed by sending a signal to the simulated external network address through the automated test terminal to confirm whether normal communication is possible, and the first link detection result can be a communication result, including two situations: normal communication and abnormal communication.

[0094] It can be understood that by disconnecting the link and creating a link failure to automatically trigger the active-standby switching of VRRP, if the switching is successful, normal communication can be achieved. If the switching fails, normal communication cannot be achieved. The communication results can be recorded for subsequent troubleshooting to ensure that the network can switch normally when an actual failure occurs, avoiding business interruption, effectively verifying the correctness of the VRRP configuration, and providing an important basis for subsequent network optimization and troubleshooting.

[0095] In a feasible implementation, step S30 may include: setting the interface of the third switch connected to the automated test terminal to access mode; modifying the IP address of the automated test terminal to the second VLAN address, and setting the address of the virtual gateway to the second VLAN virtual address; sending a signal to the simulated external network address to detect whether communication is possible; in normal communication, disconnecting the first link between the first switch and the third switch; sending a signal to the simulated external network address to detect whether communication is possible; in normal communication, checking the role of the second switch; restoring the first link, modifying the IP address of the automated test terminal to the third VLAN address, and setting the address of the virtual gateway to the third VLAN virtual address; sending a signal to the simulated external network address to detect whether communication is possible; in normal communication, disconnecting the second link between the second switch and the third switch; sending a signal to the simulated external network address to detect whether communication is possible; in normal communication, checking the role of the first switch.

[0096] For example, Figure 2 As shown, configure the interface connected to the automation computer in sw3 to access mode and release vlan2. You can use the subprocess module in Python to change the automation computer IP address to Figure 2 The vlan2 address is 192.168.2.50 (the second vlan address), the gateway is set to the vlan2 virtual address 192.168.2.254 (the second vlan virtual address), and the subprocess module is used to call the cmd (command line) to ping Figure 2 In the simulation, the L0 address of the external network is used. When they can communicate with each other, the link (the first link) between sw1 and sw3 is shut down through the command line.

[0097] ping Figure 2 In the simulation, if the L0 address of the external network can communicate with each other, use the vrrp command to check whether the status of device sw2 becomes the master device;

[0098] Log in to the sw3 device to restore the first link, and modify the interface connected to the automation computer to vlan3, and continue to modify the ip address of the automation computer to the vlan3 address 192.168.3.50 (the third vlan address) in the figure, and set the gateway to the vlan3 virtual address 192.168.3.254 (the third vlan virtual address);

[0099] ping Figure 2 Simulate the L0 address of the external network. If they can communicate with each other, then disconnect the link (the second link) between sw1 and sw2 through the command line shutdown;

[0100] ping Figure 2 Simulate the L0 address of the external network. If they can communicate with each other, use the vrrp command to check whether the backup device sw1 becomes the master device.

[0101] The above is only a feasible implementation of step S30 provided in this embodiment, and this embodiment does not specifically limit the specific implementation of step S30.

[0102] Step S40: performing link detection on interfaces connected to the first switch, the second switch, and the fourth switch to obtain a second link detection result.

[0103] It should be noted that the link detection can be performed by sending a signal from the automated test terminal to the simulated external network address to confirm whether normal communication is possible. The second link detection result can be the communication result of the automated test terminal sending a signal to the simulated external network address, including both normal communication and non-normal communication.

[0104] It can be understood that this step tests the interfaces connecting the first switch, the second switch and the fourth switch. When the uplink fails, VRRP will detect and reduce the priority of the interface of the corresponding virtual gateway, so that the backup device becomes the main device to participate in forwarding.

[0105] In a feasible implementation, step S40 may include: starting uplink detection of the first switch and the second switch; setting the interface connecting the first switch and the fourth switch, and the interface connecting the second switch and the fourth switch as uplink detection ports; disconnecting the third link between the first switch and the fourth switch; sending a signal to the simulated external network address to detect whether they can communicate with each other; in normal communication, determining that the master-slave preemption mechanism is in effect; restoring the third link, modifying the IP address of the automated test terminal to the third VLAN address, setting the virtual gateway address to the third VLAN virtual address, and disconnecting the fourth link between the second switch and the fourth switch; sending a signal to the simulated external network address to detect whether they can communicate with each other; in normal communication, determining that the master-slave preemption mechanism is in effect.

[0106] For example, Figure 2 As shown, configure the uplink detection of sw1, sw2 and sw4 of VRRP, and enable the priority preemption mechanism. When the uplink of sw1, sw2 and sw4 fails, the priority of the link is reduced to trigger the active-standby switchover mechanism. Enable the uplink detection of sw1 and sw2, set the port connected to sw1, sw2 and sw4 as the uplink detection port, and shut down the interface connected to sw1 and sw4. Ping Figure 2 If the L0 address of the simulated external network cannot be pinged, it means that the master-slave preemption mechanism is not effective. If they can communicate with each other, after the third link is restored, modify the connection between sw3 and the automation computer to Figure 2 In vlan3, change the address of the automation computer to the same network segment address of vlanif3, set the gateway to the vlan3 virtual address, shut down the interface connected to sw2 and sw4, and ping Figure 2 If the L0 address of the simulated external network cannot be pinged but can be pinged successfully, it means that the master-slave preemption mechanism is not effective.

[0107] The above is only a feasible implementation of step S40 provided in this embodiment, and this embodiment does not specifically limit the specific implementation of step S10.

[0108] The present embodiment provides an automated testing method for detecting VRRP traffic switching, the automated testing method for detecting VRRP traffic switching is applied to an automated testing terminal in an automated testing system for detecting VRRP traffic switching, the automated testing system for detecting VRRP traffic switching comprises a plurality of switches and the automated testing terminal, the plurality of switches comprising a first switch, a second switch, a third switch and a fourth switch, wherein the output ends of the first switch and the second switch are respectively connected to the input end of the third switch, the output end of the third switch is connected to the automated testing terminal, and the input ends of the first switch and the second switch are respectively connected to the output end of the fourth switch; the automated testing terminal, the first switch, the second switch, the third switch and the fourth switch are all provided with a plurality of virtual gateways, which are connected through the virtual gateways corresponding to the respective switches, the first switch and the fourth switch are connected to the third switch and the output end of the third switch is connected to the automated testing terminal, and the input ends of the first switch and the second switch are respectively connected to the output end of the fourth switch; the automated testing terminal, the first switch, the second switch, the third switch and the fourth switch are all provided with a plurality of virtual gateways, which are connected through the virtual gateways corresponding to the respective switches, The first and second switches are respectively provided with priorities, and the fourth switch is also provided with a simulated external network address; the method described includes: according to the preset routing configuration rules, opening up the three-layer routing settings of the automated test terminal, the first switch, the second switch, the third switch and the fourth switch; configuring the first switch and the second switch to be mutually active and standby according to the VRRP protocol; performing link detection on the interfaces connected to the first switch, the second switch and the third switch to obtain a first link detection result; performing link detection on the interfaces connected to the first switch, the second switch and the fourth switch to obtain a second link detection result. The present application simplifies the common VRRP test of two computers into one computer for testing, and uses an automated method to perform traffic switching testing, thereby avoiding the partial impact of artificial faults on the normal operation of the network, and achieving rapid fault detection and switching, thereby improving the efficiency of detecting VRRP traffic switching.

[0109] This application also provides an automated testing device for detecting VRRP traffic switching. Figure 3 , the automated testing device for detecting VRRP traffic switching comprises:

[0110] The configuration module 10 is used to open the three-layer routing settings of the automated test terminal, the first switch, the second switch, the third switch and the fourth switch according to the preset routing configuration rules;

[0111] The configuration module 10 is further used to configure the first switch and the second switch to be mutually active and standby according to the VRRP protocol;

[0112] A detection module 20, configured to perform link detection on interfaces connected to the first switch, the second switch, and the third switch to obtain a first link detection result;

[0113] The detection module 20 is further configured to perform link detection on interfaces connected to the first switch, the second switch, and the fourth switch to obtain a second link detection result.

[0114] The automated testing device for detecting VRRP traffic switching provided by the present application adopts the automated testing method for detecting VRRP traffic switching in the above-mentioned embodiment, and can solve the technical problem of automated testing for detecting VRRP traffic switching. Compared with the prior art, the beneficial effects of the automated testing device for detecting VRRP traffic switching provided by the present application are the same as the beneficial effects of the automated testing method for detecting VRRP traffic switching provided by the above-mentioned embodiment, and other technical features in the automated testing device for detecting VRRP traffic switching are the same as the features disclosed in the above-mentioned embodiment method, which will not be described in detail here.

[0115] The configuration module 10 is also used to set the interfaces connected to each switch to trunk mode; release all virtual subnets, and configure a static route for the fourth switch to receive all traffic with unknown destination addresses; in the first virtual subnet, allocate IP addresses to the first switch, the second switch, the third switch, the fourth switch and the automated test terminal; in the second virtual subnet, allocate IP addresses to the first switch, the second switch, the third switch and the automated test terminal; in the third virtual subnet, allocate IP addresses to the first switch, the second switch, the fourth switch and the automated test terminal; in the fourth virtual subnet, allocate IP addresses to the first switch and the fourth switch; in the fifth virtual subnet, allocate IP addresses to the second switch and the fourth switch.

[0116] The configuration module 10 is further configured to set the first switch as the main switch and the second switch as the backup switch in the second virtual subnet; and set the second switch as the main switch and the first switch as the backup switch in the third virtual subnet.

[0117] The detection module 20 is further used to set the interface of the third switch connected to the automated test terminal to access mode; detect the state of the first switch in the second virtual subnet; and detect the state of the second switch in the third virtual subnet.

[0118] The detection module 20 is also used to modify the IP address of the automated test terminal to the second VLAN address, set the address of the virtual gateway to the second VLAN virtual address; send a signal to the simulated external network address to detect whether communication is possible; during normal communication, disconnect the first link between the first switch and the third switch; send a signal to the simulated external network address to detect whether communication is possible; during normal communication, check the status of the second switch.

[0119] The detection module 20 is also used to restore the first link, modify the IP address of the automated test terminal to the third VLAN address, and set the address of the virtual gateway to the third VLAN virtual address; send a signal to the simulated external network address to detect whether communication is possible; during normal communication, disconnect the second link between the second switch and the third switch; send a signal to the simulated external network address to detect whether mutual communication is possible; during normal communication, check the status of the first switch.

[0120] The detection module 20 is also used to start uplink detection of the first switch and the second switch; set the interface connecting the first switch and the fourth switch, and the interface connecting the second switch and the fourth switch as uplink detection ports; disconnect the third link between the first switch and the fourth switch; send a signal to the simulated external network address to detect whether they can communicate with each other; when communicating normally, determine that the master-slave preemption mechanism is in effect; restore the third link, modify the IP address of the automated test terminal to the third VLAN address, set the virtual gateway address to the third VLAN virtual address, and disconnect the fourth link between the second switch and the fourth switch; send a signal to the simulated external network address to detect whether they can communicate with each other; when communicating normally, determine that the master-slave preemption mechanism is in effect.

[0121] The detection module 20 is further used to record the step of sending a signal to the simulated external network address to detect whether communication is possible in order to troubleshoot the problem.

[0122] The present application provides an automated testing device for detecting VRRP traffic switching, the automated testing device for detecting VRRP traffic switching comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the automated testing method for detecting VRRP traffic switching in the above-mentioned embodiment one.

[0123] Reference below Figure 4, which shows a schematic diagram of the structure of an automated test device for detecting VRRP traffic switching suitable for implementing the embodiment of the present application. The automated test device for detecting VRRP traffic switching in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 4 The automated testing equipment for detecting VRRP traffic switching shown is merely an example and should not impose any limitation on the functions and scope of use of the embodiments of the present application.

[0124] like Figure 4 As shown, the automated test equipment for detecting VRRP traffic switching may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. Various programs and data required for the operation of the automated test equipment for detecting VRRP traffic switching are also stored in RAM1004. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the automated test equipment for detecting VRRP traffic switching to communicate wirelessly or wired with other devices to exchange data. Although the figure shows an automated test equipment for detecting VRRP traffic switching with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have instead.

[0125] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0126] The automated test equipment for detecting VRRP traffic switching provided by the present application adopts the automated test method for detecting VRRP traffic switching in the above-mentioned embodiment, and can solve the technical problem of automated testing for detecting VRRP traffic switching. Compared with the prior art, the beneficial effects of the automated test equipment for detecting VRRP traffic switching provided by the present application are the same as the beneficial effects of the automated test method for detecting VRRP traffic switching provided by the above-mentioned embodiment, and other technical features in the automated test equipment for detecting VRRP traffic switching are the same as the features disclosed in the method of the previous embodiment, and will not be described in detail here.

[0127] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0128] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0129] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, the computer-readable program instructions being used to execute the automated testing method for detecting VRRP traffic switching in the above-mentioned embodiment.

[0130] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0131] The computer-readable storage medium may be included in an automated testing device for detecting VRRP traffic switching; or may exist independently without being assembled into an automated testing device for detecting VRRP traffic switching.

[0132] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by an automated test device for detecting VRRP traffic switching, the automated test device for detecting VRRP traffic switching: opens up the three-layer routing settings of the automated test terminal, the first switch, the second switch, the third switch and the fourth switch according to a preset routing configuration rule; configures the first switch and the second switch to be mutually active and standby according to the VRRP protocol; performs link detection on the interfaces connected to the first switch, the second switch and the third switch to obtain a first link detection result; performs link detection on the interfaces connected to the first switch, the second switch and the fourth switch to obtain a second link detection result.

[0133] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0134] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0135] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0136] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned automated testing method for detecting VRRP traffic switching, and can solve the technical problem of automated testing for detecting VRRP traffic switching. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the automated testing method for detecting VRRP traffic switching provided by the above-mentioned embodiment, and will not be elaborated here.

[0137] The present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned automated testing method for detecting VRRP traffic switching.

[0138] The computer program product provided by the present application can solve the technical problem of automatic testing for detecting VRRP traffic switching. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the automatic testing method for detecting VRRP traffic switching provided by the above embodiment, which will not be described in detail here.

[0139] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. An automated testing method for detecting VRRP traffic switching, characterized in that: The automated test method for detecting VRRP traffic switching is applied to an automated test terminal in an automated test system for detecting VRRP traffic switching, wherein the automated test system for detecting VRRP traffic switching comprises a plurality of switches and the automated test terminal, wherein the plurality of switches comprises a first switch, a second switch, a third switch and a fourth switch, wherein the output ends of the first switch and the second switch are respectively connected to the input end of the third switch, the output end of the third switch is connected to the automated test terminal, and the input ends of the first switch and the second switch are respectively connected to the output end of the fourth switch; The automated test terminal, the first switch, the second switch, the third switch and the fourth switch are all provided with a plurality of virtual gateways, and are connected through the virtual gateways corresponding to the switches. The first switch and the second switch are respectively provided with priorities, and the fourth switch is also provided with a simulated external network address; The method includes: According to the preset routing configuration rules, the three-layer routing settings of the automated test terminal, the first switch, the second switch, the third switch and the fourth switch are connected; According to the VRRP protocol, configure the first switch and the second switch to be active / standby with each other; Performing link detection on interfaces connected to the first switch, the second switch, and the third switch to obtain a first link detection result; Link detection is performed on interfaces connected to the first switch, the second switch, and the fourth switch to obtain a second link detection result.

2. The method according to claim 1, characterized in that The step of connecting the three-layer routing settings of the automated test terminal, the first switch, the second switch, the third switch, and the fourth switch according to the preset routing configuration rules includes: Set the interfaces connected to each switch to trunk mode; Release all virtual subnets, and configure a static route for the fourth switch to receive all traffic with unknown destination addresses; In the first virtual subnet, IP addresses are allocated to the first switch, the second switch, the third switch, the fourth switch and the automated test terminal; In the second virtual subnet, IP addresses are allocated to the first switch, the second switch, the third switch and the automated test terminal; In the third virtual subnet, IP addresses are allocated to the first switch, the second switch, the fourth switch and the automated test terminal; In the fourth virtual subnet, assigning IP addresses to the first switch and the fourth switch; In the fifth virtual subnet, IP addresses are allocated to the second switch and the fourth switch.

3. The method according to claim 1, characterized in that The configuring the first switch and the second switch to mutually be a master-slave relationship according to the VRRP protocol includes: In the second virtual subnet, the first switch is set as a main switch, and the second switch is set as a standby switch; In the third virtual subnet, the second switch is set as a main switch, and the first switch is set as a standby switch.

4. The method according to claim 1, characterized in that The performing link detection on the interfaces connected to the first switch, the second switch, and the third switch includes: Setting the interface of the third switch connected to the automated test terminal to access mode; In the second virtual subnet, detecting the state of the first switch; In the third virtual subnet, a state of the second switch is detected.

5. The method according to claim 4, characterized in that The step of detecting the state of the first switch in the second virtual subnet includes: Modify the IP address of the automated test terminal to the second VLAN address, and set the address of the virtual gateway to the second VLAN virtual address; Sending a signal to the simulated external network address to detect whether communication is possible; During normal communication, disconnecting the first link between the first switch and the third switch; Sending a signal to the simulated external network address to detect whether communication is possible; During normal communication, the status of the second switch is checked.

6. The method according to claim 4, characterized in that The step of detecting the state of the second switch in the third virtual subnet includes: Restore the first link, modify the IP address of the automated test terminal to the third VLAN address, and set the address of the virtual gateway to the third VLAN virtual address; Sending a signal to the simulated external network address to detect whether communication is possible; During normal communication, disconnecting the second link between the second switch and the third switch; Sending a signal to the simulated external network address to detect whether they can communicate with each other; During normal communication, the state of the first switch is checked.

7. The method according to claim 1, characterized in that The performing link detection on the interfaces connected to the first switch, the second switch, and the fourth switch includes: Enable uplink detection of the first switch and the second switch; Setting the interface connecting the first switch and the fourth switch and the interface connecting the second switch and the fourth switch as uplink detection ports; disconnecting the third link between the first switch and the fourth switch; Sending a signal to the simulated external network address to detect whether they can communicate with each other; During normal communication, it is determined that the master-slave preemption mechanism takes effect; Restore the third link, modify the IP address of the automated test terminal to the third VLAN address, set the virtual gateway address to the third VLAN virtual address, and disconnect the fourth link between the second switch and the fourth switch; Sending a signal to the simulated external network address to detect whether they can communicate with each other; During normal communication, it is determined that the master-slave preemption mechanism takes effect.

8. The method according to any one of claims 5 to 7, characterized in that The first link detection result and the second link detection result are the communication results of sending a signal to the simulated external network address to detect whether communication is possible; After sending a signal to the simulated external network address and detecting whether communication is possible, the method further includes: The communication results are recorded to facilitate troubleshooting.

9. An automated testing device for detecting VRRP traffic switching, characterized in that: The device comprises: A configuration module, used to open up the three-layer routing settings of the automated test terminal, the first switch, the second switch, the third switch and the fourth switch according to a preset routing configuration rule; The configuration module is further used to configure the first switch and the second switch to be active / standby with each other according to the VRRP protocol; a detection module, configured to perform link detection on interfaces connected to the first switch, the second switch, and the third switch to obtain a first link detection result; The detection module is further configured to perform link detection on interfaces connected to the first switch, the second switch, and the fourth switch to obtain a second link detection result.

10. An automated testing device for detecting VRRP traffic switching, characterized in that: The device comprises: a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the automated testing method for detecting VRRP traffic switching as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • A method for releasing routing, and a virtual router redundancy protocol backup group and network

    CN104579953A

  • Redundancy protection method and device between gateway nodes, gateway equipment and storage medium

    CN110677339A

  • Route switching method, control equipment, multi-route network system and storage medium

    CN111614554A

  • Dual-core local area network redundancy reliability test system and method

    CN113014451A

  • Automated test system and method for switching time of SmartLink redundancy protocol

    CN117354215A