Method, apparatus and device for detecting automated testing of vrrp traffic switching
By automating the configuration of virtual gateways and priorities on switches, VRRP traffic switching tests are simplified to be performed on a single computer, solving the problem that manual testing in existing technologies is cumbersome and affects network operation, and achieving efficient fault detection and switching.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN FENGRUNDA TECH CO LTD
- Filing Date
- 2025-01-23
- Publication Date
- 2026-05-29
AI Technical Summary
In existing VRRP technology, the method of manually creating fault detection VRRP traffic switching has an impact on network operation and is cumbersome, making it difficult to achieve fast and efficient fault detection and switching.
By employing automated testing methods and configuring virtual gateways and priorities on switches, testing can be simplified to a single computer, automating traffic switching detection and avoiding the impact of manually created faults on the network.
It enables rapid fault detection and switching, improves the detection efficiency of VRRP traffic switching, and avoids the impact of manual operation on normal network operation.
Smart Images

Figure CN119945933B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of network communication technology, and in particular to an automated testing method, apparatus and equipment for detecting VRRP traffic switching. Background Technology
[0002] In existing VRRP (Virtual Router Redundancy Protocol) technology, at least two devices (such as routers or switches) are typically required to achieve redundancy backup. These devices form a virtual router, which uses a virtual IP address as the default gateway to achieve redundant management of network traffic. Under normal circumstances, one device acts as the Master, handling all traffic, while the other device remains in standby mode as the Backup.
[0003] To verify the proper functioning of VRRP's redundancy, it's typically necessary to artificially create faults to trigger master-slave failover. For example, this can be done by shutting down the master device's interface or simulating a link failure, observing whether the backup device can correctly take over traffic. In actual testing, technicians manually disable the master device's uplink interface or configure interface tracing to lower the master device's priority, thus triggering preemption by the backup device. Additionally, testing the network access of terminal devices can verify whether traffic is correctly forwarded to the new master device. While this testing method effectively verifies VRRP's redundancy, it has some limitations. For instance, artificially creating faults may impact normal network operation, 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 an urgent problem to be solved.
[0005] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention
[0006] The main objective of this application is to provide an automated testing method, apparatus, 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 VRRP traffic switching detection.
[0007] To achieve the above objectives, this application proposes an automated testing method for detecting VRRP traffic switching, the method comprising:
[0008] An automated testing method for detecting VRRP traffic switching is provided. This method is applied to an automated testing terminal in an automated testing system for detecting VRRP traffic switching. The automated testing system includes several switches and the automated testing terminal. The several switches include a first switch, a second switch, a third switch, and a fourth switch. The outputs of the first and second switches are respectively connected to the input of the third switch, the output of the third switch is connected to the automated testing terminal, and the inputs of the first and second switches are respectively connected to the output of the fourth switch.
[0009] The automated test terminal, the first switch, the second switch, the third switch, and the fourth switch are all equipped with multiple virtual gateways and are connected through the virtual gateways corresponding to each switch. The first switch and the second switch are respectively assigned priorities, and the fourth switch is also equipped 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] Configure the first switch and the second switch to be primary and backup to each other according to the VRRP protocol;
[0013] Link detection is performed on the interfaces connecting the first switch, the second switch, and the third switch to obtain the first link detection result;
[0014] Link detection is performed on the interfaces connecting the first switch, the second switch, and the fourth switch to obtain the second link detection result.
[0015] In one embodiment, the step of establishing Layer 3 routing connections between the automated test terminal, the first switch, the second switch, the third switch, and the fourth switch according to preset routing configuration rules includes:
[0016] Configure the interfaces connected to each switch to trunk mode;
[0017] Allow all virtual subnets and configure a static route for the fourth switch to receive traffic with all unknown destination addresses;
[0018] Within the first virtual subnet, IP addresses are assigned to the first switch, the second switch, the third switch, the fourth switch, and the automated test terminal.
[0019] Within the second virtual subnet, IP addresses are assigned to the first switch, the second switch, the third switch, and the automated test terminal.
[0020] Within the third virtual subnet, IP addresses are assigned to the first switch, the second switch, the fourth switch, and the automated test terminal;
[0021] Within the fourth virtual subnet, IP addresses are assigned to the first and fourth switches;
[0022] Within the fifth virtual subnet, IP addresses are assigned to the second and fourth switches.
[0023] In one embodiment, configuring the first switch and the second switch to be mutually primary and backup according to the VRRP protocol includes:
[0024] Within the second virtual subnet, the first switch is designated as the master switch, and the second switch is designated as the backup switch.
[0025] Within the third virtual subnet, the second switch is designated as the master switch, and the first switch is designated as the backup switch.
[0026] In one embodiment, the link detection for the interfaces connecting the first switch, the second switch, and the third switch includes:
[0027] Configure the interface of the third switch that connects to the automated test terminal to access mode;
[0028] Within the second virtual subnet, detect the status of the first switch;
[0029] Within the third virtual subnet, the status of the second switch is detected.
[0030] In one embodiment, detecting the status of the first switch within 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] Send a signal to the simulated external network address to detect whether communication is possible;
[0033] During normal communication, disconnect the first link between the first switch and the third switch;
[0034] Send a signal to the simulated external network address to detect whether communication is possible;
[0035] During normal communication, check the status of the second switch.
[0036] In one embodiment, detecting the status of the second switch within 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] Send a signal to the simulated external network address to detect whether communication is possible;
[0039] During normal communication, disconnect the second link between the second switch and the third switch;
[0040] Send a signal to the simulated external network address to detect whether they can communicate with each other;
[0041] During normal communication, check the status of the first switch.
[0042] In one embodiment, the link detection for the interfaces connecting the first switch, the second switch, and the fourth switch includes:
[0043] Enable uplink detection on the first and second switches;
[0044] Configure the interfaces connecting the first and fourth switches, and the interfaces connecting the second and fourth switches, as uplink detection ports.
[0045] Disconnect the third link between the first switch and the fourth switch;
[0046] Send a signal to the simulated external network address to detect whether they can communicate with each other;
[0047] During normal communication, the primary / backup preemption mechanism is confirmed to be in 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] Send a signal to the simulated external network address to detect whether they can communicate with each other;
[0050] During normal communication, the primary / backup preemption mechanism is confirmed to be in effect.
[0051] In one embodiment, the first link detection result and the second link detection result are communication results obtained by 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] Record the communication results to help troubleshoot the problem.
[0054] Furthermore, to achieve the above objectives, this application also proposes an automated testing device for detecting VRRP traffic switching, the automated testing device for detecting VRRP traffic switching comprising:
[0055] The configuration module is used to establish Layer 3 routing settings for the automated test terminal, the first switch, the second switch, the third switch, and the fourth switch according to preset routing configuration rules.
[0056] The configuration module is also used to configure the first switch and the second switch to be primary and backup to each other according to the VRRP protocol;
[0057] The detection module is used to perform link detection on the interfaces connecting the first switch, the second switch and the third switch, and obtain the first link detection result;
[0058] The detection module is also used to perform link detection on the interfaces connecting the first switch, the second switch and the fourth switch, and obtain a second link detection result.
[0059] Furthermore, to achieve the above objectives, this application also proposes an automated testing device for detecting VRRP traffic switching, the device comprising: a memory, a processor, and a computer program stored in 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 objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the automated test method for detecting VRRP traffic switching as described above.
[0061] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, 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 this application 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 includes several switches and the automated testing terminal. The several switches include a first switch, a second switch, a third switch, and a fourth switch. The outputs of the first and second switches are respectively connected to the inputs of the third switch, and the output of the third switch is connected to the automated testing terminal. The inputs of the first and second switches are respectively connected to the outputs of the fourth switch. The automated testing terminal, the first switch, the second switch, the third switch, and the fourth switch are all equipped with multiple virtual gateways, which are interconnected through the corresponding virtual gateways of each switch. The first and second switches are respectively equipped with... Priority is given to the fourth switch, which is also equipped with a simulated external network address. According to preset routing configuration rules, the Layer 3 routing settings of the automated test terminal, the first switch, the second switch, the third switch, and the fourth switch are established. The first switch and the second switch are configured as primary and backup switches according to the VRRP protocol. Link detection is performed on the interfaces connecting the first switch, the second switch, and the third switch to obtain the first link detection result. Link detection is also performed on the interfaces connecting the first switch, the second switch, and the fourth switch to obtain the second link detection result. This application simplifies the common two-computer VRRP test to a single computer test, and uses an automated method for traffic switching testing, avoiding the potential impact of manually created faults on normal network operation, achieving rapid fault detection and switching, thereby improving the efficiency of VRRP traffic switching detection. Attached Figure Description
[0063] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0064] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0065] Figure 1 A flowchart illustrating an embodiment of the automated testing method for detecting VRRP traffic switching in this application;
[0066] Figure 2 The network diagram provided in Embodiment 1 of the automated testing method for detecting VRRP traffic switching in this application;
[0067] Figure 3 This is a schematic diagram of the module structure of an automated testing device for detecting VRRP traffic switching in an embodiment of this application;
[0068] Figure 4 This is a schematic diagram of the hardware operating environment involved in the automated testing method for detecting VRRP traffic switching in the embodiments of this application.
[0069] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0070] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0071] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0072] The main solution of this application embodiment is: 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 includes a plurality of switches and the automated testing terminal. The plurality of switches includes a first switch, a second switch, a third switch, and a fourth switch. The output terminals of the first switch and the second switch are respectively connected to the input terminal of the third switch. The output terminal of the third switch is connected to the automated testing terminal. The input terminals of the first switch and the second switch are respectively connected to the output terminal of the fourth switch.
[0073] The automated test terminal, the first switch, the second switch, the third switch, and the fourth switch are all equipped with multiple virtual gateways, and are interconnected through the virtual gateways corresponding to each switch. The first switch and the second switch are respectively assigned priorities, and the fourth switch is also equipped with a simulated external network address. The method includes: setting up the Layer 3 routing settings of the automated test terminal, the first switch, the second switch, the third switch, and the fourth switch according to preset routing configuration rules; configuring the first switch and the second switch to be mutually primary and backup 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; and 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 ease of description, the following description will use the identification of an automated computer as the execution subject.
[0075] Current technologies typically require artificially created faults to trigger master-slave failover. For example, this can be achieved by disabling the master device's interface or simulating a link failure to observe whether the backup device can correctly take over traffic. In actual testing, technicians manually disable the master device's uplink interface or configure interface tracking to lower the master device's priority, thereby triggering preemption by the backup device. Additionally, testing the network access of terminal devices can verify whether traffic has been correctly forwarded to the new master device. While this testing method effectively verifies VRRP's redundancy function, it has limitations: artificially created faults may affect normal network operation, and the testing process is relatively cumbersome.
[0076] This application provides a solution that simplifies the common two-computer VRRP test to a single computer test, and uses an automated method to perform traffic switching tests. This avoids the impact that manual fault-causing may have on the normal operation of the network, and enables rapid fault detection and switching, thereby improving the efficiency of detecting VRRP traffic switching.
[0077] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device capable of performing the above functions. The following description uses a computer as an example to illustrate this embodiment and the subsequent embodiments.
[0078] Based on this, embodiments of this application provide an automated testing method for detecting VRRP traffic switching, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the automated testing method for detecting VRRP traffic switching in this 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, enable the Layer 3 routing settings of the automated test terminal, the first switch, the second switch, the third switch and the fourth switch;
[0081] It should be noted that the preset routing configuration rules can be the rules used in network devices (such as routers or Layer 3 switches) to guide the forwarding of data packets. Layer 3 routing settings can refer to configuring routing functions on Layer 3 network devices (such as Layer 3 switches or routers) to enable communication between different networks (such as VLANs, subnets, or external networks).
[0082] Understandably, by configuring the switch's IP address according to preset routing rules, the default or specific path of network traffic can be specified, thereby ensuring that data packets can correctly reach their destination.
[0083] In one feasible implementation, step S10 may include: setting the interfaces connected to each switch to trunk mode; allowing access to all virtual subnets and configuring a static route for the fourth switch to receive traffic with all unknown destination addresses; assigning IP addresses to the first switch, second switch, third switch, fourth switch, and automated test terminal within the first virtual subnet; assigning IP addresses to the first switch, second switch, third switch, and automated test terminal within the second virtual subnet; assigning IP addresses to the first switch, second switch, fourth switch, and automated test terminal within the third virtual subnet; assigning IP addresses to the first switch and fourth switch within the fourth virtual subnet; and assigning IP addresses to the second switch and fourth switch within the fifth virtual subnet.
[0084] For example, the automation computer connects to the switch command line via the paramiko module. The interface connected to the switch is configured in trunk mode, allowing VLANs 1-10 (all virtual subnets), and configured as follows. Figure 2 The three Layer 3 interface IP addresses are configured as follows: SW1 (first switch) and SW2 (second switch) each have a static route to the simulated external network; SW4 (fourth switch) also has a 0.0.0.0 static route pointing to all return routes. All Layer 3 routing settings are enabled. Within the first virtual subnet corresponding to VLANIF1, IP addresses are assigned to SW1, SW2, SW3 (third switch), SW4, and the automated computer (automated test terminal); within VLANIF2 and the second virtual subnet corresponding to VLAN2, IP addresses are assigned to SW1, SW2, SW3, and the automated computer; within VLANIF3 and the third virtual subnet corresponding to VLAN3, IP addresses are assigned to SW1, SW2, SW4, and the automated computer; within the fourth virtual subnet corresponding to VLANIF4, IP addresses are assigned to SW1 and SW4; and within the fifth virtual subnet corresponding to VLANIF5, IP addresses are assigned to SW2 and SW4.
[0085] The above is only one feasible implementation of step S10 provided in this embodiment. This embodiment does not specifically limit the specific implementation of step S10.
[0086] Step S20: Configure the first switch and the second switch to be primary and backup to each other 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 primary device fails, the backup device can automatically take over the work, thereby ensuring the continuity and reliability of network communication. The primary and backup refer to the routing devices in the status of primary and backup devices.
[0088] Understandably, configuring the first and second switches to act as primary and backup switches can save bandwidth, ensure seamless switching in the event of device failure, and guarantee network continuity and stability.
[0089] In one feasible implementation, step S20 may include: setting the first switch as the master switch and the second switch as the backup switch in the second virtual subnet; setting the second switch as the master switch and the first switch as the backup switch in the third virtual subnet.
[0090] For example, within the second virtual subnet corresponding to vlanif2, 2, configure the VRRP virtual gateway of the vlanif2 interface in sw1 and sw2 as 192.168.2.254 with a priority of 120, and configure the VRRP virtual gateway of the interface in vlanif3 as 192.168.3.254 with a priority of 120. The default priority is 100. The higher the priority, the more likely it is to be the primary device. In vlanif2, sw1 is the primary device and sw2 is the backup device. In vlanif3, sw2 is the primary device and sw1 is the backup device. sw1 and sw2 are mutually primary and backup, without wasting bandwidth.
[0091] The above is only one feasible implementation of step S20 provided in this embodiment. This embodiment does not specifically limit the specific implementation of step S20.
[0092] Step S30: Perform link detection on the interfaces connecting the first switch, the second switch, and the third switch to obtain the first link detection result;
[0093] It should be noted that link detection can be performed by sending signals to a simulated external network address through an automated testing terminal to confirm whether normal communication is possible. The first link detection result can be the communication result, including both normal communication and non-normal communication.
[0094] Understandably, disconnecting the link creates a link failure to automatically trigger VRRP primary / backup switching. If the switch is successful, normal communication is possible; if the switch fails, normal communication is impossible. The communication results can be recorded for subsequent troubleshooting. This ensures that the network can switch normally when a real fault occurs, avoiding service interruption, effectively verifying the correctness of the VRRP configuration, and providing important evidence for subsequent network optimization and troubleshooting.
[0095] In one feasible implementation, step S30 may include: setting the interface of the third switch connecting 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; 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, 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; 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 mutual communication is possible; during normal communication, checking the role of the first switch.
[0096] For example, such as Figure 2 As shown, the interface connecting the automation computer in SW3 is configured to access mode, allowing VLAN 2. The automation computer's IP address can be changed using the subprocess module in Python. Figure 2 The VLAN 2 address is set to 192.168.2.50 (the second VLAN address), and the gateway is set to the VLAN 2 virtual address 192.168.2.254 (the second VLAN virtual address). Then, the subprocess module is used to call cmd (command line) to ping the VLAN. Figure 2 The L0 address of the simulated external network is disconnected when communication between sw1 and sw3 is possible via command line shutdown (the first link).
[0097] ping Figure 2 If the L0 address of the simulated external network can communicate with each other, use the VRRP command to check whether the status of device sw2 has become the master device;
[0098] Log in to the sw3 device to restore the first link, and change the interface connected to the automation computer to VLAN 3. Then, change the IP address of the automation computer to the VLAN 3 address 192.168.3.50 (third VLAN address) shown in the figure, and set the gateway to the VLAN 3 virtual address 192.168.3.254 (third VLAN virtual address).
[0099] ping Figure 2 If the L0 address of the simulated external network can communicate with each other, then disconnect the link (second link) connecting sw1 and sw2 by shutting down the command line.
[0100] ping Figure 2 If the L0 address of the simulated external network can communicate with each other, use the VRRP command to check whether the backup device sw1 has become the master device.
[0101] The above is only one feasible implementation of step S30 provided in this embodiment. This embodiment does not specifically limit the specific implementation of step S30.
[0102] Step S40: Perform link detection on the interfaces connecting the first switch, the second switch, and the fourth switch to obtain the second link detection result.
[0103] It should be noted that link detection can be performed by sending signals to a simulated external network address through an automated test terminal to confirm whether normal communication is possible. The second link detection result can be the communication result of the signals sent by the automated test terminal to the simulated external network address, including both normal communication and non-normal communication.
[0104] Understandably, this step tests the interfaces connecting the first switch, the second switch, and the fourth switch. When the uplink fails, VRRP will detect this and lower the priority of the corresponding virtual gateway interface, making the backup device the primary device to participate in forwarding.
[0105] In one feasible implementation, step S40 may include: enabling uplink detection for the first switch and the second switch; setting the interfaces connecting the first switch and the fourth switch, and the interfaces 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; if normal communication is achieved, determining that the primary / backup 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; if normal communication is achieved, determining that the primary / backup preemption mechanism is in effect.
[0106] For example, such as Figure 2 As shown, configure uplink detection for VRRP SW1, SW2, and SW4, and enable a priority preemption mechanism. When the uplink of SW1, SW2, or SW4 fails, the priority of that link is reduced, triggering a master-slave switchover mechanism. Enable uplink detection for SW1 and SW2, set the port connecting SW1, SW2, and SW4 as the uplink detection port, and shut down the interface connecting SW1 and SW4. Ping the port. Figure 2 If the L0 address of the simulated external network cannot be pinged, it indicates that the primary / backup preemption mechanism is not working. If communication is possible, after the third link is restored, modify the connection between SW3 and the automation computer. Figure 2 In the configuration, change the address of the automation computer to the same subnet as VLAN 3, set the gateway to the VLAN 3 virtual address, shut down the interface connecting SW2 and SW4, and ping... Figure 2 If the L0 address of the simulated external network is not accessible, a successful ping indicates that the primary / backup preemption mechanism is not in effect.
[0107] The above is only one feasible implementation of step S40 provided in this embodiment. This embodiment does not specifically limit the specific implementation of step S10.
[0108] This embodiment provides an automated testing method for detecting VRRP traffic switching. The method is applied to an automated testing terminal in an automated testing system for detecting VRRP traffic switching. The automated testing system includes several switches and the automated testing terminal. The switches include a first switch, a second switch, a third switch, and a fourth switch. The outputs of the first and second switches are connected to the inputs of the third switch, and the output of the third switch is connected to the automated testing terminal. The inputs of the first and second switches are connected to the outputs of the fourth switch. The automated testing terminal, the first switch, the second switch, the third switch, and the fourth switch each have multiple virtual gateways, which are interconnected. The first switch and the fourth switch... The two switches are each assigned a priority, and the fourth switch is also assigned a simulated external network address. The method includes: establishing Layer 3 routing settings for the automated test terminal, the first switch, the second switch, the third switch, and the fourth switch according to preset routing configuration rules; configuring the first switch and the second switch to be mutually primary and backup 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; and 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. This application simplifies the common two-computer VRRP test to a single computer test, and uses an automated method for traffic switching testing, avoiding the potential impact of manually created faults on the normal operation of the network, 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; please refer to [reference needed]. Figure 3 The automated testing device for detecting VRRP traffic switching includes:
[0110] Configuration module 10 is used to establish Layer 3 routing settings for the automated test terminal, the first switch, the second switch, the third switch, and the fourth switch according to preset routing configuration rules.
[0111] Configuration module 10 is also used to configure the first switch and the second switch to be primary and backup to each other according to the VRRP protocol;
[0112] The detection module 20 is used to perform link detection on the interfaces connecting the first switch, the second switch and the third switch, and obtain the first link detection result;
[0113] The detection module 20 is also used to perform link detection on the interfaces connecting the first switch, the second switch and the fourth switch, and obtain a second link detection result.
[0114] The automated testing device for detecting VRRP traffic switching provided in this application employs the automated testing method for detecting VRRP traffic switching in the above embodiments, 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 in this application are the same as the beneficial effects of the automated testing method for detecting VRRP traffic switching provided in the above embodiments, and other technical features in the automated testing device for detecting VRRP traffic switching are the same as the features disclosed in the methods of the above embodiments, and will not be repeated here.
[0115] The configuration module 10 is further configured to set the interfaces connected to each switch to trunk mode; allow all virtual subnets; configure a static route for the fourth switch to receive traffic with all unknown destination addresses; allocate IP addresses to the first switch, second switch, third switch, fourth switch, and automated test terminal within the first virtual subnet; allocate IP addresses to the first switch, second switch, third switch, and automated test terminal within the second virtual subnet; allocate IP addresses to the first switch, second switch, third switch, and automated test terminal within the third virtual subnet; allocate IP addresses to the first switch and fourth switch within the fourth virtual subnet; and allocate IP addresses to the second switch and fourth switch within the fifth virtual subnet.
[0116] The configuration module 10 is further configured to set the first switch as the master switch and the second switch as the backup switch in the second virtual subnet; and to set the second switch as the master switch and the first switch as the backup switch in the third virtual subnet.
[0117] The detection module 20 is also used to set the interface of the third switch connected to the automated test terminal to access mode; detect the status of the first switch within the second virtual subnet; and detect the status of the second switch within 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; disconnect the first link between the first switch and the third switch during normal communication; send a signal to the simulated external network address to detect whether communication is possible; and check the status of the second switch during normal communication.
[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, 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; disconnect the second link between the second switch and the third switch during normal communication; send a signal to the simulated external network address to detect whether mutual communication is possible; and check the status of the first switch during normal communication.
[0120] The detection module 20 is further configured to: enable uplink detection for the first and second switches; set the interfaces connecting the first and fourth switches, and the interfaces connecting the second and fourth switches, as uplink detection ports; disconnect the third link between the first and fourth switches; send a signal to the simulated external network address to detect whether they can communicate with each other; if normal communication is achieved, determine that the primary / backup 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; disconnect the fourth link between the second and fourth switches; send a signal to the simulated external network address to detect whether they can communicate with each other; if normal communication is achieved, determine that the primary / backup preemption mechanism is in effect.
[0121] The detection module 20 is also used to record the communication results of sending signals to the simulated external network address and detecting whether communication is possible in order to troubleshoot problems.
[0122] This application provides an automated testing device for detecting VRRP traffic switching. The automated testing device for detecting VRRP traffic switching includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the automated testing method for detecting VRRP traffic switching in the above embodiment 1.
[0123] The following is for reference. Figure 4This document illustrates a structural schematic of an automated test device suitable for implementing the embodiments of this application to detect VRRP traffic switching. The automated test device for detecting VRRP traffic switching in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 4 The automated test device for detecting VRRP traffic switching shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0124] like Figure 4 As shown, the automated test device for detecting VRRP flow switching may include a processing unit 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 read-only memory (ROM) 1002 or a program loaded from storage device 1003 into random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the automated test device for detecting VRRP flow switching. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected 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 I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the automated test equipment for detecting VRRP flow switching to exchange data wirelessly or via wired communication with other devices. Although the figure shows an automated test equipment for detecting VRRP flow switching with various systems, it should be understood that it is not required to implement or possess all the systems shown. More or fewer systems can be implemented alternatively.
[0125] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0126] The automated testing device for detecting VRRP traffic switching provided in this application employs the automated testing method for detecting VRRP traffic switching in the above embodiments, 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 in this application are the same as the beneficial effects of the automated testing method for detecting VRRP traffic switching provided in the above embodiments, and other technical features in the automated testing device for detecting VRRP traffic switching are the same as those disclosed in the method of the previous embodiment, and will not be repeated here.
[0127] It should be understood that the various parts disclosed in this application can be implemented using 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 suitable manner in one or more embodiments or examples.
[0128] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0129] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the automated test method for detecting VRRP traffic switching in the above embodiments.
[0130] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. 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 conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0131] The aforementioned computer-readable storage medium may be included in an automated test device for detecting VRRP traffic switching; or it may exist independently and not be assembled into an automated test device for detecting VRRP traffic switching.
[0132] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by an automated testing device for detecting VRRP traffic switching, the automated testing device for detecting VRRP traffic switching causes the following to occur: According to preset routing configuration rules, it establishes Layer 3 routing settings for the automated testing terminal, the first switch, the second switch, the third switch, and the fourth switch; it configures the first switch and the second switch to be mutually primary and backup according to the VRRP protocol; it performs link detection on the interfaces connecting the first switch, the second switch, and the third switch to obtain a first link detection result; and it performs link detection on the interfaces connecting 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 this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0134] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0135] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0136] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described automated testing method for detecting VRRP traffic switching, thereby solving 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 in this application are the same as those of the automated testing method for detecting VRRP traffic switching provided in the above embodiments, and will not be repeated here.
[0137] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the automated testing method for detecting VRRP traffic switching as described above.
[0138] The computer program product provided in this application can solve the technical problem of automated testing for detecting VRRP traffic switching. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the automated testing method for detecting VRRP traffic switching provided in the above embodiments, and will not be repeated here.
[0139] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. An automated testing method for detecting VRRP traffic switching, characterized in that, 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 includes several switches and the automated testing terminal. The several switches include a first switch, a second switch, a third switch, and a fourth switch. The output terminals of the first switch and the second switch are respectively connected to the input terminal of the third switch. The output terminal of the third switch is connected to the automated testing terminal. The input terminals of the first switch and the second switch are respectively connected to the output terminal of the fourth switch. The automated test terminal, the first switch, the second switch, the third switch, and the fourth switch are all equipped with multiple virtual gateways and are connected through the virtual gateways corresponding to each switch. The first switch and the second switch are respectively assigned priorities, and the fourth switch is also equipped 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; Configure the first switch and the second switch to be primary and backup to each other according to the VRRP protocol; Link detection is performed on the interfaces connecting the first switch, the second switch, and the third switch to obtain the first link detection result; Link detection is performed on the interfaces connecting the first switch, the second switch, and the fourth switch to obtain the second link detection result.
2. The method as described in claim 1, characterized in that, The step of establishing Layer 3 routing connections between the automated test terminal, the first switch, the second switch, the third switch, and the fourth switch according to preset routing configuration rules includes: Configure the interfaces connected to each switch to trunk mode; Allow all virtual subnets and configure a static route for the fourth switch to receive traffic with all unknown destination addresses; Within the first virtual subnet, IP addresses are assigned to the first switch, the second switch, the third switch, the fourth switch, and the automated test terminal. Within the second virtual subnet, IP addresses are assigned to the first switch, the second switch, the third switch, and the automated test terminal. Within the third virtual subnet, IP addresses are assigned to the first switch, the second switch, the fourth switch, and the automated test terminal; Within the fourth virtual subnet, IP addresses are assigned to the first and fourth switches; Within the fifth virtual subnet, IP addresses are assigned to the second and fourth switches.
3. The method as described in claim 2, characterized in that, The step of configuring the first switch and the second switch to be mutually primary and backup according to the VRRP protocol includes: Within the second virtual subnet, the first switch is designated as the master switch, and the second switch is designated as the backup switch. Within the third virtual subnet, the second switch is designated as the master switch, and the first switch is designated as the backup switch.
4. The method as described in claim 2, characterized in that, The link detection for the interfaces connecting the first switch, the second switch, and the third switch includes: Configure the interface of the third switch that connects to the automated test terminal to access mode; Within the second virtual subnet, detect the status of the first switch; Within the third virtual subnet, the status of the second switch is detected.
5. The method as described in claim 4, characterized in that, Detecting the status of the first switch within 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; 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.
6. The method as described in claim 4, characterized in that, Detecting the status of the second switch within 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; 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 they can communicate with each other; During normal communication, check the status of the first switch.
7. The method as described in claim 1, characterized in that, The link detection for the interfaces connecting the first switch, the second switch, and the fourth switch includes: Enable uplink detection on the first and second switches; Configure the interfaces connecting the first and fourth switches, and the interfaces connecting the second and fourth switches, 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; During normal communication, the primary / backup preemption mechanism is confirmed to be 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; During normal communication, the primary / backup preemption mechanism is confirmed to be in 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: Record the communication results to help troubleshoot the problem.
9. An automated testing device for detecting VRRP traffic switching, characterized in that, The device includes: The configuration module is used to establish Layer 3 routing settings for the automated test terminal, the first switch, the second switch, the third switch, and the fourth switch according to preset routing configuration rules. The configuration module is also used to configure the first switch and the second switch to be primary and backup to each other according to the VRRP protocol; The detection module is used to perform link detection on the interfaces connecting the first switch, the second switch and the third switch, and obtain the first link detection result; The detection module is also used to perform link detection on the interfaces connecting the first switch, the second switch and the fourth switch, and obtain a second link detection result.
10. An automated testing device for detecting VRRP traffic switching, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the automated test method for detecting VRRP traffic switching as claimed in any one of claims 1 to 8.