Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the embodiments of the present invention will be described in detail with reference to the accompanying drawings.
In the embodiment of the invention, in order to fully utilize the existing resources, when the protection switching between the head node and the tail node is established, one tunnel between the head node and the tail node is taken as a main tunnel, other tunnels between the head node and the tail node are all added into one tunnel backup group, and the protection switching between the head node and the tail node is realized by utilizing the tunnels in the main tunnel and the tunnel backup group.
The protection switching method provided by the embodiment of the invention is suitable for various networks, such as MPLS TP networking, Ethernet Virtual Interconnection (EVI) networking and the like, under the MPLS TP networking, the head node and the tail node are routing switching equipment connected through an MPLS TP tunnel, and under the EVI networking, the head node and the tail node are two-layer access equipment connected through a GRE tunnel.
Referring to fig. 2, fig. 2 is a schematic flowchart of a protection switching method according to an embodiment of the present invention, including the following steps:
step 201, the head node implements protection switching on service transmission between the head node and the tail node through a main tunnel and a backup tunnel selected from a tunnel backup group;
in this embodiment, the protection switching may be 1:1 protection switching, or 1+1 protection switching.
When the protection is switched to 1:1, implementing protection switching on service transmission between a head node and a tail node through a main tunnel and a backup tunnel selected from a tunnel backup group comprises: the head node sends the service message to the tail node through the main tunnel, and the tail node receives the service message from the main tunnel.
When the protection is switched to 1+1, implementing the protection switching on the service transmission between the head node and the tail node through the main tunnel and the standby tunnel selected from the tunnel backup group comprises: the head node sends the service message to the tail node through the main tunnel and the standby tunnel, and the tail node selectively receives the service message from the main tunnel.
Step 202, when detecting that the main tunnel fails, selecting two tunnels from the tunnel backup group, using one of the two tunnels as a secondary main tunnel and the other tunnel as a secondary standby tunnel, and implementing protection switching on service transmission between the head node and the tail node through the secondary main tunnel and the secondary standby tunnel.
When the protection is switched to 1:1, implementing protection switching on service transmission between a head node and a tail node through a secondary main tunnel and a secondary standby tunnel comprises: the head node sends the service message to the tail node through the secondary main tunnel, and the tail node receives the service message from the secondary main tunnel.
When the protection is switched to 1+1, implementing protection switching on service transmission between the head node and the tail node through the secondary main tunnel and the secondary standby tunnel comprises: the head node sends service messages to the tail node through the secondary main tunnel and the secondary standby tunnel, and the tail node selectively receives the service messages from the secondary main tunnel.
In this step, after the main tunnel between the head node and the tail node fails, the protection switching is implemented for the service transmission between the head node and the tail node through the secondary main tunnel and the secondary backup tunnel selected from the tunnel backup group, and at this time, if the selected secondary main tunnel fails, there are two cases:
first, the main tunnel between the head node and the tail node has been recovered from the failure, in this case, the service transmission may be switched back to the main tunnel, and the protection switching may be performed on the service transmission between the head node and the tail node through the main tunnel and the backup tunnel selected from the tunnel backup group again.
And secondly, the main tunnel between the head node and the tail node is still in a failure state and is not recovered from the failure, and under the condition, a secondary main tunnel and a secondary standby tunnel which are reselected from the tunnel backup group are required, and protection switching is carried out on service transmission between the head node and the tail node through the newly selected secondary main tunnel and the secondary standby tunnel.
In practical applications, since a tunnel is unstable when it is just recovered from a failure, a jitter may occur, and in order to avoid a problem caused by repeated switching of service transmission between two tunnels, a tunnel back-switching time may be preset. In this way, under the first condition, before performing protection switching on service transmission between the head node and the tail node through the main tunnel and the backup tunnel selected from the tunnel backup group again, it may be further determined whether the time for failure recovery of the main tunnel is greater than the preset tunnel switching time, if so, the service transmission may be switched back to the main tunnel, and protection switching on service transmission between the head node and the tail node through the main tunnel and the backup tunnel selected from the tunnel backup group again, otherwise, the protection switching may be performed on service transmission between the head node and the tail node through the newly selected secondary main tunnel and the secondary backup tunnel.
In the embodiment of the present invention shown in fig. 2, in order to select an appropriate backup tunnel, a secondary main tunnel, and a secondary backup tunnel from a tunnel backup group, and implement protection switching on traffic transmission between a head node and a tail node by using the main tunnel and the backup tunnel, or implement protection switching on traffic transmission between the head node and the tail node by using the secondary main tunnel and the secondary backup tunnel, all tunnels between the head node and the tail node except the main tunnel may be sorted according to a preset rule after all tunnels between the head node and the tail node are added to the tunnel backup group. Correspondingly, when a backup tunnel corresponding to the main tunnel is selected from the tunnel backup group, the first tunnel without failure in the sequencing sequence can be selected as the backup tunnel, so that the main tunnel and the backup tunnel selected from the tunnel backup group can be used for implementing protection switching on service transmission between the head node and the tail node. The method for selecting two tunnels from the tunnel backup group and taking one tunnel of the two tunnels as a secondary main tunnel and the other tunnel as a secondary standby tunnel comprises the following steps: and selecting the first tunnel without failure in the sequencing sequence as a secondary main tunnel, and selecting the first tunnel without failure in the sequencing sequence as a secondary standby tunnel.
Taking fig. 1 as an example, assuming that the path PE1-P1-PE2 carries tunnel 1 and is a main tunnel between PE1 and PE2, the paths PE1-P2-PE2, PE1-P3-PE2, and PE1-P4-PE2 respectively carry tunnels 2, 3, and 4, and tunnel 2, tunnel 3, and tunnel 4 may be added to the tunnel backup group, and it is assumed that the tunnels in the tunnel backup group are sorted according to a preset rule to obtain a sorting result as follows: tunnel 2, tunnel 3, tunnel 4, when none of tunnel 1, tunnel 2, tunnel 3, tunnel 4 fails, tunnel 2 may be selected from the tunnel backup group as a backup tunnel for tunnel 1, so that 1 is performed between PE1 and PE2 through tunnel 1 and tunnel 2: 1 protection switching or 1+1 protection switching; when tunnel 1 fails, tunnel 2 may be selected from the tunnel backup group as the secondary primary tunnel and tunnel 3 as the secondary backup tunnel, so that 1:1 protection switching or 1+1 protection switching. If tunnel 2 also fails when tunnel 1 fails, tunnel 3 may be selected from the tunnel backup group as the secondary main tunnel and tunnel 4 may be selected as the secondary backup tunnel, so that PE1 and PE2 perform 1:1 protection switching or 1+1 protection switching.
Here, it should be noted that, when selecting the secondary main tunnel and the secondary backup tunnel from the tunnel backup group, based on the problem of avoiding repeated switching of tunnels (for example, the selected secondary main tunnel is just recovered from a failure, in this case, the failure recovery condition of the secondary main tunnel is unstable, and network jitter may occur), especially when selecting a tunnel as the secondary main tunnel, it may be determined first whether the failure recovery time of the main tunnel in the tunnel pair with the highest priority is greater than the preset tunnel switching-back time, if so, the tunnel may be selected as the secondary main tunnel, otherwise, it may be determined continuously whether the next tunnel in the sorting order is failed, and whether the failure recovery time of the next tunnel without a failure is greater than the preset tunnel switching-back time (if no failure is occurring, the failure recovery time is infinite), thereby determining whether the next tunnel meets the selected condition of the secondary main tunnel (i.e. has no failure and the failure recovery time is greater than the preset tunnel switching-back time).
The above method for sorting all tunnels in the tunnel backup group according to the preset rule may be various, for example: and sorting according to the tunnel priority, or sorting according to the tunnel identifier, or sorting according to the tunnel priority and the tunnel identifier when the tunnel priorities are the same, and the like.
Taking fig. 1 as an example, the following are respectively given for 1: the service transmission under the 1 and 1+1 protection switching mechanisms is illustrated.
Assume that none of tunnel 2, tunnel 3, and tunnel 4 in fig. 1 failed.
If 1:1, protection switching mechanism, then,
under normal conditions, tunnel 2 is selected as the backup tunnel of tunnel 1, PE1 sends a service packet to PE2 through tunnel 1, and PE2 also receives the service packet from tunnel 1.
When tunnel 1 fails, PE1 selects tunnel 2 from the tunnel backup group as the secondary main tunnel and tunnel 3 as the secondary backup tunnel, and sends a service packet to PE2 through tunnel 2, and PE2 also receives the service packet from tunnel 2.
If PE1 and PE2 do 1 with tunnel 2 and tunnel 3: 1, when protection switching occurs, if tunnel 2 fails again and tunnel 1 is not recovered from the failure, PE1 selects tunnel 3 from the tunnel backup group as the secondary main tunnel and tunnel 4 as the secondary backup tunnel, and sends a service packet to PE2 through tunnel 3, and PE2 also receives the service packet from tunnel 3.
If a 1+1 protection switching mechanism is adopted between PE1 and PE2, then,
under normal conditions, the tunnel 2 is selected as a backup tunnel of the tunnel 1, the PE1 sends a service packet to the PE2 through the tunnel 1 and the tunnel 2, and the PE2 selects to receive the service packet from the tunnel 1.
When tunnel 1 fails, PE1 selects tunnel 2 from the tunnel backup group as the secondary main tunnel and tunnel 3 as the secondary backup tunnel, and sends a service packet to PE2 through tunnel 2 and tunnel 3, and PE2 selects to receive the service packet from tunnel 2.
If PE1 and PE2 perform 1+1 protection switching using tunnel 2 and tunnel 3, and if tunnel 2 fails again and tunnel 1 is not recovered from the failure, PE1 selects tunnel 3 from the tunnel backup group as a secondary main tunnel and tunnel 4 as a secondary standby tunnel, and sends a service packet to PE2 through tunnel 3 and tunnel 4, and PE2 receives the service packet from tunnel 3.
The protection switching method provided by the embodiment of the present invention is explained in detail above, and the present invention also provides a protection switching device, which is explained below with reference to fig. 3,
fig. 3 is a schematic structural diagram of a protection switching device according to an embodiment of the present invention, and as shown in fig. 3, the device includes a grouping unit 301, a detecting unit 302, a protection switching unit 303, and a selecting unit 304; wherein,
a grouping unit 301, configured to add all tunnels between the device serving as a head node and a tail node, except for the main tunnel, to a tunnel backup group when establishing protection switching with the tail node;
a detecting unit 302, configured to detect whether the device is a failure in a main tunnel between a head node and a tail node;
a protection switching unit 303, configured to implement protection switching on service transmission between the device serving as the head node and the tail node through the main tunnel and the backup tunnel selected from the tunnel backup group; when the detecting unit 302 detects that the device is used as a main tunnel between the head node and the tail node, it notifies the selecting unit 304 to select two tunnels from the tunnel backup group, uses one tunnel of the two tunnels as a secondary main tunnel and the other tunnel as a secondary standby tunnel, and implements protection switching on service transmission between the device used as the head node and the tail node through the secondary main tunnel and the secondary standby tunnel selected by the selecting unit 304.
In the protection switching device described above, the protection switching device,
the detecting unit 302 is further configured to detect whether each tunnel in the tunnel backup group fails; the method comprises the steps of detecting whether the device is used as a main tunnel between a head node and a tail node to recover from a fault;
after the protection switching unit 303 implements protection switching on the service transmission between the head node and the tail node through the secondary main tunnel and the secondary standby tunnel, the protection switching unit is further configured to: if the detection unit 302 detects that the secondary main tunnel fails, if the device is used as a main tunnel between the head node and the tail node for failure recovery, the device implements protection switching on service transmission between the head node and the tail node through the main tunnel and a backup tunnel selected from the tunnel backup group; if the failure of the device serving as the main tunnel between the head node and the tail node is not recovered, the device notifies the selection unit 304 to reselect two tunnels from the tunnel backup group, uses one tunnel of the two newly selected tunnels as a new secondary main tunnel and the other tunnel as a new secondary standby tunnel, and implements protection switching on service transmission between the head node and the tail node through the secondary main tunnel and the secondary standby tunnel newly selected by the selection unit 304.
In the protection switching device described above, the protection switching device,
after the detecting unit 302 determines that the device is used as a main tunnel between the head node and the tail node and recovers from the failure, the protection switching unit 303 is further configured to: judging whether the main tunnel recovery time is greater than the preset tunnel switching-back time, if so, implementing protection switching on service transmission between the head node and the tail node through the main tunnel and the standby tunnel selected from the tunnel backup group, otherwise, informing the selection unit 304 to reselect two tunnels from the tunnel backup group, taking one tunnel of the two newly selected tunnels as a new secondary main tunnel and the other tunnel as a new secondary standby tunnel, and implementing protection switching on service transmission between the head node and the tail node through the secondary main tunnel and the secondary standby tunnel newly selected by the selection unit 304.
In the protection switching device described above, the protection switching device,
the grouping unit 301, after adding all tunnels between the head node and the tail node except the primary tunnel into the tunnel backup group, is further configured to: sequencing all tunnels in the tunnel backup group according to a preset rule;
the selecting unit 304, when the backup tunnel selected from the tunnel backup group is used for: selecting a first tunnel without failure in the sequencing sequence as a standby tunnel of the main tunnel;
the selecting unit 304 is configured to, when two tunnels are selected from the tunnel backup group, and one of the two tunnels is used as a new secondary main tunnel, and the other tunnel is used as a new secondary standby tunnel: and selecting the first tunnel without failure in the sequencing sequence as a secondary main tunnel, and selecting the second tunnel without failure as a secondary standby tunnel.
In the protection switching device described above, the protection switching device,
when sorting all tunnels in the tunnel backup group according to a preset rule, the grouping unit 301 is configured to: and sequencing according to the tunnel priority, or sequencing according to the tunnel identifier, or sequencing according to the tunnel priority and sequencing according to the tunnel identifier when the tunnel priorities are the same.
In the protection switching device described above, the protection switching device,
the protection is switched to 1:1 protection switching or 1+1 protection switching.
It can be known from the technical solutions provided in the embodiments of the present invention that, when a plurality of tunnels exist between a head node and a tail node, all tunnels except a main tunnel are added to a tunnel backup group and allocated to different tunnel pairs, and the main tunnel is protected by using each tunnel pair, so that all tunnels between the head node and the tail node can be fully utilized, on one hand, existing resources are fully utilized, on the other hand, the robustness of protection switching between the head node and the tail node is also ensured, and the stability of service transmission between the head node and the tail node is improved.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.