Method for autonomously obtaining Ethernet ring network Owner node based on improved ERPS protocol

By adding fields such as switch node number and packet number in the ERPS protocol, combined with hash ring algorithm and preset unique identifiers, the independent Owner node election and fault recovery of the Ethernet ring network is realized, and the network instability caused by Owner node failure in the existing technology is solved, and the fault tolerance and robustness of the industrial control system is improved.

CN120238510AActive Publication Date: 2025-07-01CSSC SYST ENG RES INST
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510430213.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-08
Publication Date
2025-07-01
Estimated Expiration
2045-04-08

AI Technical Summary

Technical Problem

In the prior art, the ERPS protocol integrated in the Ethernet Ring switch node only supports pre-configuration of fixed network nodes as Owner nodes. Once the Owner node fails, it cannot recover independently, causing the Ethernet Ring network to fall into unpredictable errors and affect the operation of the industrial control system.

Method used

By improving the ERPS protocol, fields such as switch node number, group number and alternative identification are added to the switch node, and corresponding operation codes are added, so that each switch node can independently traverse the ring network, packet and elect Owner nodes, and use hash ring algorithm and preset unique identification to select the group and global master switch nodes.

Benefits of technology

The Ethernet ring network is automatically recovered after the Owner node failure, which improves the fault tolerance and robustness of the industrial control system, reduces the computational complexity and recovery time, and ensures the stability and management efficiency of the network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120238510A_ABST
    Figure CN120238510A_ABST
Patent Text Reader

Abstract

The invention relates to a method for autonomously obtaining an Ethernet ring network Owner node based on an improved ERPS protocol, and belongs to the technical field of industrial internets, the improved ERPS protocol is obtained by adding a field in an ERPS protocol reserved field and adding a corresponding operation code, so that an Ethernet ring network composed of switch nodes supporting the improved ERPS protocol is compatible with and supports the existing ERPS protocol communication, and the ERPS protocol communication efficiency is improved. The method also has the capability of autonomously obtaining an Ethernet ring network Owner node, switch nodes supporting an improved ERPS protocol form an Ethernet ring network, each switch node firstly traverses the Ethernet ring network to obtain the total number of the switch nodes, a hash ring is applied to each switch node to obtain a packet number corresponding to each switch node, and the packet number is sent to the Ethernet ring network. And finally, a global main switch node is selected from all the grouped main switch nodes to serve as the Owner node, so that the problems of poor robustness and poor fault tolerance of a network platform due to the fact that the Owner node of the Ethernet ring network cannot be autonomously recovered after a fault occurs in the Owner node in the prior art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of industrial Internet, and particularly to a method for autonomously obtaining an Owner node of an Ethernet ring network based on an improved ERPS protocol. Background Art

[0002] A ring network (also known as an Ethernet ring network) is a ring network topology widely used in the field of industrial Internet. It is composed of switch nodes and communicates through end-to-end transmission, realizing applications in industrial control, telecommunications networks, robots, etc.; ERPS (G.8032) is a layer-2 ring-breaking protocol standard defined by ITU-T and belongs to a general Ethernet ring network protection protocol; ERPS selectively blocks network redundant links to prevent phenomena such as broadcast storms, data loops, and unstable MAC address tables in the network, thereby ensuring the communication quality of the Ethernet ring network. At the same time, ERPS is a master-slave structure protocol, which defines Owner nodes, Neighbour nodes, Normal nodes, RPL links, port types, and related protocol messages, and can meet the basic requirements of Ethernet ring network protection.

[0003] However, in the prior art, the ERPS protocol integrated in Ethernet ring network switch nodes only supports pre-configuring fixed network nodes as Owner nodes in the Ethernet ring network. Once the Owner node fails, it cannot be autonomously restored, and the ring network cannot autonomously obtain an Owner node, causing the Ethernet ring network to immediately fall into unpredictable errors and resulting in the obstruction of the operation of the industrial control system. Summary of the Invention

[0004] In view of the above analysis, an embodiment of the present invention aims to provide a method for autonomously obtaining an Owner node of an Ethernet ring network based on an improved ERPS protocol to solve the problem that the operation of the industrial control system is blocked due to the inability to autonomously restore the Owner node of the Ethernet ring network after a failure in the prior art.

[0005] An embodiment of the present invention provides a method for autonomously obtaining an Owner node of an Ethernet ring network based on an improved ERPS protocol. An Ethernet ring network is composed of switch nodes supporting the improved ERPS protocol. In the Ethernet ring network, each switch node executes the following process to finally obtain an Owner node. The process specifically includes:

[0006] S1: Traverse the Ethernet ring network to obtain the total number of switch nodes and save it;

[0007] S2: Apply a hash ring to obtain the group number corresponding to each switch node and save it;

[0008] S3: Group each switch node based on the corresponding group number of each switch node, and then elect and save the primary switch node within each group of switch nodes;

[0009] S4: Elect the global primary switch node from the primary switch nodes within each group as the Owner node and save it.

[0010] Based on a further improvement of the above method, it is characterized in that the improved ERPS protocol specifically refers to adding the switch node number, group number, and alternative identifier used for electing the Owner node to the reserved field of the existing ERPS protocol message, and adding the corresponding operation code.

[0011] Based on a further improvement of the above method, each switch node uses itself as the starting node and traverses the Ethernet ring through the following process to obtain the total number of switch nodes. The process specifically includes:

[0012] S31: Use the starting node as the current node and generate a probe message for node counting;

[0013] S32: Send the probe message from the current node to the adjacent switch node on one side;

[0014] When the probe message enters the adjacent switch, it will be counted once and the probe message will be updated when it exits the adjacent switch. Then, use the adjacent switch as the current node, use the updated probe message as the probe message, and return to execute S32 until the probe message returns to the starting node. Then, the probe message stops being sent, and the node counting result in the probe message is used as the total number of switch nodes in the Ethernet ring.

[0015] Based on a further improvement of the above method, the application of the hash ring to group each switch node specifically means that each switch node executes the following process:

[0016] Generate multiple virtual nodes for each switch node;

[0017] Determine the number of hash ring groups based on the number of switch nodes;

[0018] For each virtual node, concatenate the switch node MAC address and the group number of the virtual node and input them into the selected hash function to obtain the output result. Based on the output result, obtain the hash value of each virtual node;

[0019] Determine the corresponding group number for each virtual node based on the hash value of each virtual node, the length of the hash ring, and the number of groups;

[0020] Obtain the number of virtual nodes included in each group, and use the group number with the largest number of virtual nodes as the switch node group number.

[0021] Based on further improvements to the above method, the number of hash ring groups is calculated through the following formula, which is specifically expressed as:

[0022] In the formula,

[0023] G is the number of groups, and N is the total number of switch nodes. represents rounding up, represents rounding down.

[0024] Based on further improvements to the above method, the selected hash function is SHA-1.

[0025] Based on further improvements to the above method, the corresponding group numbers are calculated respectively through the following formula based on the hash value of each virtual node, the length of the hash ring, and the number of groups. The formula is specifically expressed as:

[0026] In the formula,

[0027] CLASS-ID is the group number, and H virtual is the hash value of the virtual node, and 2 preset-length is the length of the hash ring.

[0028] Based on further improvements to the above method, each switch includes its own preset unique identifier; the initial value of the alternative identifier of each switch is set to its own preset unique identifier; starting from each switch node, the following process is performed on each switch. After all switches are completed, the switches with the same preset unique identifier and alternative identifier within each group are used as the main switch nodes within the group. The specific process includes:

[0029] S81: Use the starting node as the current node to generate a detection message including the preset unique identifier, alternative identifier, and group number;

[0030] S82: Send the detection message from the current node to the adjacent switch node on one side;

[0031] S83: After the adjacent node receives the detection message, determine whether the group number in the detection message is the same as the group number of the adjacent node.

[0032] S831: If so, determine whether the alternative identifier in the detection message is less than the alternative identifier of the adjacent node.

[0033] If so, update the alternative identifier of the adjacent node to the alternative identifier in the detection message;

[0034] Otherwise, if the alternative identifier in the detection message is greater than the alternative identifier of the adjacent node, update the alternative identifier in the detection message to the alternative identifier of the adjacent node.

[0035] Otherwise, send the detection message from the adjacent node to the next node of the adjacent node along the sending direction, and use the next node as the adjacent node, then return to execute S83 until the detection message returns to the starting node.

[0036] S84: Determine whether the alternative identifier in the detection message is equal to the preset unique identifier of the starting node. If so, use the starting node as the main switch within the group.

[0037] Otherwise, update the alternative identifier of the starting node to the alternative identifier in the detection message.

[0038] Based on a further improvement of the above method, taking each main switch node within the group as the starting node, perform the following process for each main switch node within the group. After all switch nodes have completed the execution, use the main switch node within the group with the same preset unique identifier and alternative identifier as the global main switch node. The process specifically includes:

[0039] S91: Use the starting node as the current node and generate a global main switch node election detection message including the preset unique identifier, alternative identifier, and group number.

[0040] S92: Send the detection message from the current node to an adjacent switch node on one side.

[0041] S93: The adjacent node determines whether it is the main switch node within the group.

[0042] If so, determine whether the alternative identifier in the detection message is less than its own alternative identifier.

[0043] If so, update its own alternative identifier to the alternative identifier in the detection message.

[0044] Otherwise, if the alternative identifier in the detection message is greater than the alternative identifier of the adjacent node, update the alternative identifier in the detection message to its own alternative identifier and then generate an updated detection message.

[0045] Otherwise, do not perform any processing on the detection message.

[0046] S94: Send the detection message from the adjacent node to the next node of the adjacent node along the sending direction, and use the next node as the adjacent node, then return to execute S93 until the detection message returns to the starting node.

[0047] S95: Determine whether the alternative identifier in the detection message is equal to the preset unique identifier of the starting node. If so, mark the starting node as the global master switch.

[0048] Otherwise, update the alternative identifier of the starting node to the alternative identifier in the detection message.

[0049] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:

[0050] 1. An Ethernet ring network composed of switch nodes supporting the improved ERPS protocol, based on the switch node numbers, packet numbers, alternative identifiers, and corresponding operation codes added to the reserved fields of the ERPS protocol for electing the Owner node, enables the switch nodes supporting the improved ERPS protocol to support obtaining the total number of switch nodes and switch numbers by traversing the Ethernet ring network, grouping the switch nodes using a hash ring, obtaining the packet number of each switch node group, then electing the master switch within each group, and further electing the global master switch node as the Owner node from the master switches within each group. Compared with the prior art, there is no need to manually pre-configure a certain node as the Owner node fixed, but the Owner node is autonomously selected from all switch nodes in the network, realizing the automatic configuration of the Owner node in the Ethernet ring network.

[0051] 2. When the Owner node fails, the remaining switch nodes in the group where the failed Owner node is located first elect a new master switch node within the group, and then elect a new global master switch node as the new Owner node from the master switch nodes within each group. Compared with the prior art, it realizes the autonomous election of a new Owner node to achieve network self-recovery, significantly improving the fault tolerance and robustness of the industrial control system applying the Ethernet ring network.

[0052] 3. Select a hash function using the hash ring algorithm, achieve load balancing by adding virtual nodes for each switch node, then group and number the hash ring to obtain the packet number where each virtual node is located, then splice the MAC address of the switch node and the number of each virtual node and input them into the selected hash function to obtain the output result, and then obtain the hash value of each virtual node based on the output result. Further, obtain the corresponding packet number based on the hash value of each virtual node, and then obtain the number of virtual nodes included in each packet. Take the packet number with the most virtual nodes as the switch node group number. It not only realizes load balancing of each switch node in the ring network by adding virtual nodes, but also ensures the uniqueness of the hash value of each virtual node by selecting a suitable hash function, basically achieving load balancing of each switch node, and also helps to improve network management efficiency and reduce the computational complexity.

[0053] 4. The preset unique identifier in each switch node is used to select the master node within the group and the master node within the network. By comparing one by one within the group, the node with the smallest preset unique identifier is selected as the master node within the group. Then, the node with the smallest preset unique identifier is selected from the master nodes within each group as the master node within the network, i.e., the Owner node. This realizes the automatic acquisition of the Owner node, and the election process has a fast execution speed and low computational complexity, greatly shortening the suspension time of the industrial control system from the failure of the Owner node to autonomous recovery, and having almost no impact on the industrial control process.

[0054] In the present invention, the above technical solutions can also be combined with each other to achieve more preferred combined solutions. Other features and advantages of the present invention will be described in the subsequent description, and some advantages can be made obvious from the description, or understood by implementing the present invention. The purpose and other advantages of the present invention can be realized and obtained through the content specifically pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] The drawings are only for the purpose of showing specific embodiments and are not considered as a limitation of the present invention. Throughout the drawings, the same reference signs represent the same components;

[0056] Figure 1 It is a flowchart of the method according to the embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0057] The following will specifically describe the preferred embodiments of the present invention with reference to the drawings. The drawings form a part of this application and are used together with the embodiments of the present invention to explain the principle of the present invention, and are not used to limit the scope of the present invention.

[0058] A specific embodiment of the present invention discloses a method for autonomously obtaining an Ethernet ring network Owner node based on an improved ERPS protocol, as Figure 1 shown.

[0059] An Ethernet ring network is composed of switch nodes supporting the improved ERPS protocol. In the Ethernet ring network, each switch node executes the following process to finally obtain the Owner node. The process specifically includes:

[0060] S1: Traverse the Ethernet ring network to obtain the total number of switch nodes and save it;

[0061] S2: Apply a hash ring to obtain the group number corresponding to each switch node and save it;

[0062] S3: Based on the group numbers corresponding to each switch node, obtain the groups of each switch node, and then elect the master switch node within the group from the groups of each switch node and save it;

[0063] S4: Elect a global master switch node from the master switch nodes within each group as the Owner node and save it.

[0064] In the prior art, there is only one type of ERPS protocol message format, namely the R-APS (Ring Auto Protection Switching) PDU message. The content of the R-APS PDU format is shown in Table 1 below:

[0065] Table 1: Prior ERPS protocol frame message format and content

[0066]

[0067]

[0068] In Table 1, bytes 26 - 52 are used to save R-APS specific information. Among them, the Reserved2 field in the R-APS Specific Information is a reserved field with a length of 24 octets.

[0069] In this embodiment, by adding a field for electing the Owner node from each switch node in the Ethernet ring network in the Reserved2 field of the existing ERPS protocol message, an improved ERPS protocol is obtained.

[0070] Further, the improved ERPS protocol specifically refers to adding the switch node number, group number, and alternative identifier used for electing the Owner node in the reserved field of the existing ERPS protocol message, and adding corresponding operation codes.

[0071] In a specific embodiment, the following new fields shown in Table 2 are added to the Reserved2 field in the R-APS Specific Information of the existing ERPS protocol message:

[0072] Table 2: Content and meaning of the new fields

[0073]

[0074] Among them, the CLASS-ID has a length of 4 bytes. The high 2 bytes (16 bits) are used to identify the group number where the switch node is located, and the low 2 bytes (16 bits) are used to represent the role of the switch node. The specific switch roles include: non-alternative switch node, in-group alternative switch node, in-group master switch node, and global master switch node.

[0075] In a specific embodiment, by adding the following operation codes shown in Table 3, the new message types in the improved ERPS protocol are defined:

[0076] Table 3: Operation Codes Corresponding to New Message Types in the Improved ERPS Protocol

[0077]

[0078] In the above specific embodiments, new fields in Table 2 are added to the Reserved2 field in the R-APSSpecificInformation of the existing ERPS protocol message, and operation codes corresponding to the new message types in Table 3 are added to obtain the improved ERPS protocol message.

[0079] When switches supporting the improved ERPS protocol and switches supporting the existing technology ERPS protocol form an Ethernet ring network, the switches supporting the improved ERPS protocol can be compatible with and identify the existing technology ERPS protocol messages, but the switches supporting the existing technology ERPS protocol do not recognize the new operation codes and fields of the improved ERPS protocol. Therefore, they cannot participate in the autonomous election process of the Owner node and cannot identify the autonomously elected Owner node.

[0080] In this embodiment, switch nodes supporting the improved ERPS protocol form an Ethernet ring network. When no Owner node has been autonomously elected or manually configured in the Ethernet ring network, the following process is executed by each switch node in the Ethernet ring network to finally obtain the Owner node, which specifically includes:

[0081] Step S1: Traverse the Ethernet ring network to obtain the total number of switch nodes and save it.

[0082] Specifically, an Ethernet ring network is formed by switch nodes supporting the improved ERPS protocol. After all switches are powered on and enabled, each performs node self-checking.

[0083] Specifically, each switch node takes itself as the starting node and traverses the Ethernet ring network through the following process to obtain the total number of switch nodes. The process specifically includes:

[0084] S31: Take the starting node as the current node and generate a probe message for node counting.

[0085] S32: Send the probe message from the current node to the adjacent switch node on one side.

[0086] S33: The detection message is input into the adjacent switch. When it is output from the adjacent switch, it will be counted once and then the detection message is updated. Then, the adjacent switch is used as the current node, and the updated detection message is used as the detection message. Return to execute S32 until the detection message returns to the starting node, then the detection message stops being sent, and the node count result in the detection message is used as the total number of Ethernet ring network switch nodes.

[0087] After the switch node is powered on, the newly added fields in the improved ERPS protocol field, namely the switch node number and the total number of switch nodes, are both empty.

[0088] Specifically, based on the operation mechanism of the ERPS protocol in the Ethernet ring network, each switching node serves as an initial switch node. The initial switch node sends a detection message for counting the total number of nodes to an adjacent switch node at one end from one side port. The detection message also records a preset unique identifier of the initial switch node.

[0089] Optionally, the preset unique identifier is the MAC address of the switch node itself, or a 12-bit hexadecimal random number with the same length as the MAC address is added to the newly added field in the improved ERPS protocol field to be used as the uniqueness identifier of the switch node.

[0090] When the detection message passes through each switch node, it will read the preset unique identifier of the switch node passed through and compare it with the preset unique identifier it carries. If they are inconsistent, a count is made. Based on the characteristics of the Ethernet ring network, after the detection message passes through all switch nodes, it will return to the initial switch node that sent the corresponding detection message again, and is received and read by the other side port of the initial switch node. If the preset unique identifier of the initial switch node recorded in the detection message is consistent with the preset unique identifier of the initial switch node, the total number of nodes recorded in the detection message is read and saved in the initial switch node.

[0091] In a specific embodiment, when the initial switch node sends a detection message for counting the total number of nodes, the total number of nodes is initially set to 1. Each time it is input into an adjacent switch node, the node count is incremented by 1. Specifically, a count field can be newly added to the newly added field in the improved ERPS protocol for the detection message to count the nodes passed through.

[0092] In a specific embodiment, the TTL (Time To Live) network data packet count can also be used. An initial switch node sends out a TTL probe message including a preset initial value. Each time the probe message passes through an adjacent switch node, the value is decremented by 1. When the probe message returns to the initial switch node, the node count result is obtained by subtracting the TTL value saved in the probe message from the initial TTL value recorded by the initial switch node and then adding 1. The node count result is used as the total number of switch nodes.

[0093] The purpose of step S1 is to enable each switch node supporting the improved ERPS protocol in the Ethernet ring network to obtain and save the total number of switch nodes by traversing each node in the Ethernet ring network, so as to execute subsequent steps. Each switch node obtains the same total number of switch nodes from the probe message sent by itself.

[0094] Preferably, the preset unique identifier of the path node can also be recorded when the probe message passes through each node, which is convenient for subsequent processing.

[0095] Step S2: Use a hash ring to obtain and save the group number corresponding to each switch node.

[0096] Specifically, the application of the hash ring to group each switch node specifically means that each switch node executes the following process:

[0097] Generate multiple virtual nodes for each switch node;

[0098] Based on the number of switch nodes, determine the number of hash ring groups. For each virtual node, after splicing the switch node MAC address and the virtual node group number, input them into the selected hash function to obtain the output result, and obtain the hash value of each virtual node based on the output result;

[0099] Based on the hash value of each virtual node, the length of the hash ring, and the number of groups, determine their respective corresponding group numbers;

[0100] Obtain the number of virtual nodes included in each group, and use the group number with the largest number of virtual nodes as the switch node group number.

[0101] The principle of step S2 is that each switch node constructs a hash ring through the selected hash function, divides all switch nodes into multiple groups, and each switch node obtains the corresponding group number. The purpose is to distribute all switch nodes as evenly as possible to avoid the problem of uneven load.

[0102] Specifically, preset a hash ring value range space, group the hash ring, and then set several virtual nodes for the switch nodes, map the virtual nodes to the hash ring, so as to find out the group corresponding to the switch nodes on the hash ring, specifically by executing the following process:

[0103] Step 1: Generate multiple virtual nodes for each switch node.

[0104] Principally, the more virtual nodes there are, the better the uniform distribution on the hash ring. However, too many virtual nodes will lead to redundant computation and unnecessary overhead for switch nodes.

[0105] Preferably, the number of virtual nodes is 1000.

[0106] In this embodiment, each switch node generates 1000 virtual nodes.

[0107] Step 2: Determine the number of hash ring groups based on the number of switch nodes.

[0108] Furthermore, it is characterized in that the number of hash ring groups is calculated by the following formula:

[0109]

[0110] G is the number of groups, N is the total number of switch nodes, represents rounding up, represents rounding down.

[0111] Exemplarily, when N = 50, then G = 8; when N = 1000, then G = 316.

[0112] For an Ethernet ring network, different network scales adopt different grouping methods. Usually, 100 switch nodes are used as the critical point. The Ethernet ring network with more than 100 switch nodes has more groups than the Ethernet ring network with less than 100 switch nodes, so as to obtain a relatively balanced correspondence between the number of groups and the number of nodes in the group and obtain the optimal computational time complexity.

[0113] Next, group the virtual nodes of the switch nodes based on the obtained number of groups and the range of the hash ring value domain.

[0114] Divide the hash ring value domain evenly by the number of groups to obtain the same number of numerical intervals on the hash ring as the number of groups. Among them, each numerical interval corresponds to one of the groups.

[0115] Exemplarily, assume that the total number N of Ethernet ring network switch nodes is 50, the number of groups G is 8, each switch node sets 1000 virtual nodes, and the length of the hash ring is 2 128 , then the hash ring is evenly divided into 8 intervals, which are in turn:

[0116] Interval 0: [0, 2 125 )

[0117] Interval 1: [2 125 , 1×2 125 );

[0118] Interval 2: [1×2 125 , 2×2 125 );

[0119] Interval 0: [2×2 125 , 3×2 125 );

[0120] Interval 1: [3×2 125 , 4×2 125 );

[0121] Interval 2: [4×2 125 , 5×2 125 );

[0122] Interval 0: [5×2 125 , 6×2 125 );

[0123] Interval 1: [6×2 125 , 7×2 125 ).

[0124] The length of each interval is 2 128 / 8 = 2 125 .

[0125] For all switch nodes in the Ethernet ring network, the same number of virtual nodes are set for each switch node and mapped to the hash ring. When all virtual nodes of all switch nodes are mapped to the hash ring, it can be considered that uniform distribution is basically achieved. The purpose of such processing is to improve the distribution balance of virtual nodes on the hash ring. Moreover, when the number of virtual nodes is large enough, even if virtual nodes are concentrated in a small area, or some virtual nodes fail (for example, all virtual nodes corresponding to a certain switch node disappear from the hash ring), but due to the overall uniform distribution of virtual nodes, it is equivalent to removing a small number of virtual nodes in each group, and it will not affect the overall distribution balance. Therefore, there is no need to re-execute step S2 to make the switch node re-obtain the grouping number, reducing the processing complexity when the network changes locally and improving the response efficiency.

[0126] Step 3: For each virtual node, concatenate the MAC address of the switch node and the grouping number of the virtual node and input them into the selected hash function to obtain the output result, and obtain the hash value of each virtual node based on the output result

[0127] Further, the selected hash function is SHA-1.

[0128] Specifically, SHA-1 is used as the selected hash function. The output result of SHA-1 is a 160-bit value. In this embodiment, preferably, the first 128 bits of the SHA-1 output result are intercepted as the hash value. For an Ethernet ring network, SHA-1 is used as the selected hash function, and 0 to 2 128 -1 is used as the total length of the hash ring, which can meet the requirements of hash value uniqueness and uniform distribution, and will not cause redundant computational complexity.

[0129] The MAC address of the switch node and each virtual node number are concatenated and then input into SHA-1, and the first 128 bits are intercepted from the output calculation result as the virtual node hash value.

[0130] Specifically, first calculate the output result of the selected hash function corresponding to the virtual node through the following formula, and the formula is specifically expressed as:

[0131] In the formula,

[0132] i is the virtual node number, is the hash value of the i-th virtual node, k is the total number of virtual nodes, ||i means concatenating i and the switch node MAC address, and SHA-1(MAC||i)[0:127] is the switch node hash value.

[0133] The first 128 bits of the output result are intercepted as the hash value of the corresponding virtual node.

[0134] Exemplarily, assume that the MAC address of a switch node in an Ethernet ring network is "00:1A:2B:3C:4D:5E", and the formula for calculating the 50th virtual node of this switch node is expressed as:

[0135]

[0136] The first 128 bits are intercepted from the calculated output result, and the hash value of the 50th virtual node is obtained.

[0137] Step 4: Determine the corresponding group number for each virtual node based on the hash value of each virtual node, the length of the hash ring, and the number of groups.

[0138] Furthermore, based on the hash value of each virtual node, the length of the hash ring, and the number of groups, the corresponding group number is calculated respectively through the following formula, and the formula is specifically expressed as:

[0139] In the formula,

[0140] CLASS-ID is the group number, and 2 preset-length is the length of the hash ring.

[0141] Specifically, for the purpose of evenly mapping virtual nodes to the hash ring, in the first step, the length of the hash ring has been evenly divided into multiple equal-length intervals by the total number of groups. Then, after obtaining the hash value of the virtual node, by taking the floor of the quotient obtained by dividing the hash value of the virtual node by the length of a single interval, the group number corresponding to the virtual node is obtained.

[0142] Exemplarily, assume that the hash value of the 50th virtual node of the switch node is 3 * 2 125 , then the calculation process of the group number of the 50th virtual node of this switch node is as follows:

[0143]

[0144] Then the group number of the 50th virtual node of this switch node is 12.

[0145] According to the same method, the group numbers of each virtual node of the switch node can be calculated.

[0146] Fifth step: Obtain the number of virtual nodes included in each group, and use the group number with the largest number of virtual nodes as the group number of the switch node.

[0147] Based on the group numbers of each virtual node of the switch node obtained in the fourth step, the number of virtual nodes belonging to the same group number can be counted.

[0148] Use the group number with the largest number of virtual nodes with the same group number as the group number of the switch node.

[0149] In step S2, each switch node in the Ethernet ring network calculates its own group number and saves it to the CLASS-ID field of the newly added field of its improved ERPS protocol for subsequent processing.

[0150] Step S3: Obtain the groups of each switch node based on the corresponding group numbers of each switch node, and then elect and save the master switch node within each group.

[0151] Furthermore, each switch includes its own preset unique identifier; the initial value of the alternative identifier of each switch is set to its own preset unique identifier; starting from each switch node, the following process is executed for each switch. After all switches are executed, the switches with the same preset unique identifier and alternative identifier within each group are used as the master switch nodes within the group; the specific process includes:

[0152] S81: Use the starting node as the current node, and generate a detection message including the preset unique identifier, alternative identifier, and group number.

[0153] S82: Send the detection message from the current node to an adjacent switch node on one side;

[0154] S83: After the adjacent node receives the detection message, determine whether the packet number in the detection message is the same as the packet number of the adjacent node.

[0155] S831: If so, determine whether the alternative identifier in the detection message is less than the alternative identifier of the adjacent node.

[0156] If so, update the alternative identifier of the adjacent node to the alternative identifier in the detection message;

[0157] Otherwise, if the alternative identifier in the detection message is greater than the alternative identifier of the adjacent node, update the alternative identifier in the detection message to the alternative identifier of the adjacent node.

[0158] Otherwise, send the detection message from the adjacent node to the next node of the adjacent node along the sending direction, and use the next node as the adjacent node, and return to execute S83 until the detection message returns to the starting node;

[0159] S84: Determine whether the alternative identifier in the detection message is equal to the preset unique identifier of the starting node. If so, use the starting node as the group master switch.

[0160] Otherwise, update the alternative identifier of the starting node to the alternative identifier in the detection message.

[0161] The principle of electing the Owner node in this embodiment is to select the switch node with the smallest preset unique identifier as the Owner node by comparing the preset unique identifiers of each switch node. To achieve this goal, each switch node obtains a list including the preset unique identifiers of all switch nodes in the Ethernet ring network after step S1 is executed. When the network scale is very large, the time complexity of traversing the entire network and comparing one by one to select the Owner node is N 2 , and the network overhead and time consumption are very large; by first selecting the group master switch nodes of each group and then selecting the Owner node from the group master switch nodes, the time complexity is reduced to Group management is convenient for reducing the management overhead and processing complexity of network nodes.

[0162] To achieve this goal, by executing step S2, each switch node obtains its own packet number. Then, each switch node generates a detection message including the preset unique identifier, alternative identifier, and packet number.

[0163] When the switch node obtains the packet number, the switch node becomes the current node and starts to execute step S81 to generate an intra-group election detection message. The functions of the intra-group election detection message include transmitting the packet number of the initial node, finding nodes in the same packet and recording them, and then transmitting them back to the initial node through the ring network communication process to maintain the information of nodes in the same group. Moreover, an election process is executed to select the node with the smallest preset unique identifier in the same group. After the one-by-one comparison of each node in the group is completed through the ring network communication process, it is then transmitted back to the initial node for storage and recording.

[0164] Exemplarily, Table 4 below is the format of the intra-group election detection message.

[0165] Table 4: Format of Intra-Group Election Detection Message

[0166] Field Description Type Message type (indicating the start of electing the master switch node within the group) CLASSID Current packet number SenderMAC Sender MAC address CandidateMAC MAC address of the current candidate node within the group (initially the sender's own MAC) TTL Time to live, used to count the nodes within the group Direction Propagation direction

[0167] Exemplarily, in the preferred intra-group election detection message of Table 4, the MAC address is used as the preset unique identifier. Among them, SenderMAC is the MAC address of the initial node as the preset unique identifier of the initial node; the CandidateMAC field is the alternative identifier, which stores the MAC addresses of candidate nodes in the group. Among them, the initial value of CandiadateMAC is the MAC address of the initial node; TTL is used to count the number of nodes in the same group.

[0168] When an adjacent node receives the intra-group election detection message, it first determines whether it is in the same group as the initial node that sent the detection message by comparing whether its own packet number is the same as the packet number in the detection message.

[0169] If not, the adjacent node forwards the detection message to the next adjacent node in the same direction without performing any processing on the detection message and its own information.

[0170] If the adjacent node and the current node are in the same group, it is determined whether the alternative identifier in the detection message is less than the alternative identifier of the adjacent node. Based on the election principle, the smaller alternative identifier is preferentially retained. Therefore, if the alternative identifier of the adjacent node is smaller, the alternative identifier in the detection message is updated to the alternative identifier of the adjacent node; if the alternative identifier in the detection message is smaller, the alternative identifier of the adjacent node is updated to the alternative identifier in the detection message. The purpose is to find the node with the smallest alternative identifier and save it in the alternative identifier node field of each node in the group after the detection message traverses each node in the group; after each switch node in the group sends a detection message to traverse each node in the group, the smallest alternative identifier is finally found and saved in all nodes in the group; the smallest alternative identifier corresponds to the switch node with the smallest preset unique identifier in the group. When the group election detection message sent by this switch node traverses all nodes in the group and returns, if the switch node compares the alternative identifier saved in the detection message with its own preset unique identifier and they are the same, then the switch node marks itself as the main switch node in the group; other non-main switch nodes in the group send detection messages, traverse each node in the group, save the main switch node in the group in the list of switch nodes in the group maintained by themselves, and mark themselves as alternative nodes in the group.

[0171] Optionally, each switch node in the same group can also save a list of switch nodes in the same group. The list of switch nodes in the same group stores the MAC addresses of the other switch nodes in the same group except itself, which helps to improve the network management efficiency.

[0172] When the main switch node in the group is elected, that is, the switch node with the smallest preset unique identifier receives the detection message sent by itself and completes the self-setting of the main switch node in the group, the subsequent process is immediately executed to elect the global main switch node.

[0173] Step S4: Elect a global main switch node from the main switch nodes in each group as the Owner node and save it.

[0174] Furthermore, starting from each main switch node in the group, the following process is executed for each main switch node in the group. After all switch nodes have completed the execution, the main switch node in the group with the same preset unique identifier and alternative identifier is used as the global main switch node. The specific process includes:

[0175] S91: Take the starting node as the current node and generate a global main switch node election detection message including the preset unique identifier, alternative identifier, and group number.

[0176] S92: Send the detection message from the current node to the adjacent switch node on one side.

[0177] S93: The adjacent node determines whether itself is the master switch node within the group.

[0178] If so, it determines whether the alternative identifier in the probe packet is less than its own alternative identifier.

[0179] If so, it updates its own alternative identifier to the alternative identifier in the probe packet.

[0180] Otherwise, if the alternative identifier in the probe packet is greater than the alternative identifier of the adjacent node, it updates the alternative identifier in the probe packet to its own alternative identifier and then generates an updated probe packet.

[0181] Otherwise, it does not perform any processing on the probe packet.

[0182] S94: It sends the probe packet from the adjacent node in the sending direction to the next node of the adjacent node, and takes the next node as the adjacent node, then returns to execute S93 until the probe packet returns to the starting node.

[0183] S95: It determines whether the alternative identifier in the probe packet is equal to the preset unique identifier of the starting node. If so, it marks the starting node as the global master switch.

[0184] Otherwise, it updates the alternative identifier of the starting node to the alternative identifier in the probe packet.

[0185] Specifically, the election process of the global master switch node is executed by each master switch node within the group respectively, and the remaining switch nodes do not participate. The purpose of the global master switch node election is to find the master switch node within the group with the smallest preset unique identifier from all master switch nodes within the group.

[0186] Exemplarily, Table 5 below is the format of the global election probe packet.

[0187] Table 5: Format of the Global Election Probe Packet

[0188]

[0189] When each master switch node within the group has completed step S4, the global master switch node is elected. Moreover, all master switch nodes within the group already know the election result, but other non-master switch nodes within the group do not participate in the global master switch node election process and do not know the election result yet. Therefore, the global master switch node periodically sends a broadcast packet declaring the status of the Owner node to all other switch nodes in the Ethernet ring network to notify all other switch nodes that the global master switch node is the Owner node.

[0190] So far, the entire process of the Ethernet ring network composed of switch nodes supporting the improved ERPS protocol to autonomously elect the Owner node has been completed.

[0191] Furthermore, when the Owner node fails, the remaining switch nodes in the group where the faulty Owner node is located first elect a new master switch node within the group, and then elect a new global master switch node from the master switch nodes within each group as the new Owner node and save it.

[0192] Specifically, when the Owner node fails and stops periodically sending broadcast messages to all other switch nodes in the Ethernet ring network, the remaining switch nodes in the Ethernet ring network cannot receive the broadcast message declaring the status of the Owner node sent by the Owner node, so the Ethernet ring network communication is suspended. Then, the remaining switch nodes in the group where the faulty Owner node is located first elect a new master switch node within the group, and then elect a new global master switch node from the master switch nodes within each group as the new Owner node and save it.

[0193] In a specific embodiment, after the remaining switch nodes in the Ethernet ring network wait for the broadcast message declaring the status of the Owner node sent by the Owner node to time out, they respectively send Owner node status query messages periodically and wait for a reply. When the status query messages for consecutive multiple cycles all time out in the reply, the remaining switch nodes in the Ethernet ring network all update the total number of switch nodes they save. The remaining switch nodes in the group where the faulty Owner node is located all remove the faulty Owner node from the switch node list they save, and execute S3 to elect a new master switch node within the group and mark it; when the new master switch node within the group is elected in the group where the faulty Owner node is located, the new master switch node within the group immediately executes S4 to be the global master switch node.

[0194] A method for an Ethernet ring network to autonomously obtain an Owner node based on an improved ERPS protocol disclosed in this embodiment forms an Ethernet ring network with switch nodes supporting the improved ERPS protocol. Each switch node first traverses the Ethernet ring network to obtain the total number of switch nodes and the number of each switch node. Then, each switch node obtains the corresponding group number through its own application of the hash ring. Next, the master switch node within the group is selected from the switch nodes in the same group. Finally, the global master switch node is selected from the master switch nodes of each group as the Owner node. Compared with the prior art, in this embodiment, corresponding fields for election are newly added in the reserved fields of the ERPS protocol, and corresponding message type operation codes are added to obtain the improved ERPS protocol. The Ethernet ring network composed of switch nodes supporting the improved ERPS protocol not only supports communication between switch nodes of the existing ERPS protocol but also has the ability to autonomously obtain the Owner node of the Ethernet ring network, solving the problems of poor fault tolerance and poor robustness of the network platform caused by the inability of the existing ERPS protocol Ethernet ring network to autonomously recover after the failure of the Owner node.

[0195] Those skilled in the art can understand that all or part of the processes of implementing the method in the above embodiment can be completed by instructing relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. Among them, the computer-readable storage medium is a magnetic disk, an optical disk, a read-only memory, or a random access memory, etc.

[0196] The above is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered by the protection scope of the present invention.

Claims

1. A method for autonomously obtaining an Ethernet ring network Owner node based on an improved ERPS protocol, characterized in that: An Ethernet ring network is formed by switch nodes supporting the improved ERPS protocol. In the Ethernet ring network, each switch node performs the following process to finally obtain an Owner node. The process specifically includes: S1: traverse the Ethernet ring network to obtain the total number of switch nodes and save it; S2: Apply the hash ring to obtain the group number corresponding to each switch node and save it; S3: Group the switch nodes based on the group number corresponding to each switch node, and then select the main switch node in the group from each switch node group and save it; S4: Select a global master switch node from the master switch nodes in each group as the owner node and save it.

2. According to claim 1, a method for autonomously obtaining an Ethernet ring network Owner node based on an improved ERPS protocol is characterized in that: The improved ERPS protocol specifically refers to adding the switch node number, group number, and candidate identifier used for electing the owner node in the reserved field of the existing ERPS protocol message, and adding the corresponding operation code.

3. The method for autonomously obtaining the Owner node of an Ethernet ring network based on the improved ERPS protocol according to claim 3 is characterized in that: Each switch node takes itself as the starting node and traverses the Ethernet ring network to obtain the total number of switch nodes through the following process, wherein the process specifically includes: S31: Taking the starting node as the current node, generating a detection message for node counting; S32: Sending the detection message from the current node to one of the adjacent switch nodes on one side; S33: The detection message is input into the adjacent switch, and when it is output from the adjacent switch, a count is performed and the detection message is updated. Then the adjacent switch is used as the current node, and the updated detection message is used as the detection message. The process returns to S32 and executes until the detection message returns to the starting node. Then, the detection message stops being sent, and the node counting result in the detection message is used as the total number of Ethernet ring switch nodes.

4. The method for autonomously obtaining the Owner node of an Ethernet ring network based on the improved ERPS protocol according to claim 3, characterized in that: The application of the hash ring to group the switch nodes specifically refers to each switch node performing the following process: Generate multiple virtual nodes for each switch node; Determine the number of hash ring groups based on the number of switch nodes; For each virtual node, the switch node MAC address and the group number of the virtual node are concatenated and input into a selected hash function to obtain an output result, and a hash value of each virtual node is obtained based on the output result; Determine the corresponding group number based on the hash value, hash ring length and group number of each virtual node; The number of virtual nodes included in each group is obtained based on the group number of each virtual node, and the group number with the largest number of virtual nodes is used as the switch node group number.

5. The method for autonomously obtaining the Owner node of an Ethernet ring network based on the improved ERPS protocol according to claim 4, characterized in that: The number of hash ring groups is calculated by the following formula, which is specifically expressed as: In the formula, G is the number of groups, N is the total number of switch nodes, represents rounding up, Represents round down.

6. The method for autonomously obtaining the Owner node of an Ethernet ring network based on the improved ERPS protocol according to claim 5, characterized in that: The selected hash function is SHA-1.

7. The method for autonomously obtaining the Owner node of an Ethernet ring network based on the improved ERPS protocol according to claim 6, characterized in that: Based on the hash value of each virtual node, the length of the hash ring, and the number of groups, the corresponding group number is calculated by the following formula, which is specifically expressed as: In the formula, CLASS-ID is the group number, H virtual is the virtual node hash value, 2 preset-length is the hash ring length.

8. The method for autonomously obtaining the Owner node of an Ethernet ring network based on the improved ERPS protocol according to claim 1, characterized in that: Each switch includes its own preset unique identifier; the initial value of the candidate identifier of each switch is set to the preset unique identifier of the switch; each switch node is taken as the starting node, and the following process is performed on each switch. After all switches are executed, the switch with the same preset unique identifier and the candidate identifier in each group is taken as the main switch node in the group; the process specifically includes: S81: Taking the starting node as the current node, generating a detection message including a preset unique identifier, an alternative identifier, and a group number; S82: Send the detection message from the current node to an adjacent switch node on one side; S83: After receiving the detection message, the neighboring node determines whether the group number in the detection message is the same as the group number of the neighboring node. S831: If yes, determine whether the candidate identifier in the detection message is smaller than the candidate identifier of the neighboring node. If yes, updating the candidate identifier of the neighboring node to the candidate identifier in the detection message; Otherwise, if the candidate identifier in the detection message is greater than the candidate identifier of the neighboring node, the candidate identifier in the detection message is updated to the candidate identifier of the neighboring node, Otherwise, the detection message is sent from the adjacent node along the sending direction to the next node of the adjacent node, and the next node is used as the adjacent node, and the process returns to S83 until the detection message returns to the starting node; S84: Determine whether the candidate identifier in the detection message is equal to the preset unique identifier of the starting node. If yes, use the starting node as the master switch in the group. Otherwise, the starting node candidate identifier is updated to the candidate identifier in the detection message.

9. The method for autonomously obtaining the Owner node of an Ethernet ring network based on the improved ERPS protocol according to claim 8, characterized in that: Taking each master switch node in the group as the starting node, the following process is performed on each master switch node in the group. After all switch nodes are executed, the master switch node in the group with the same preset unique identifier and the candidate identifier is used as the global master switch node. The process specifically includes: S91: Taking the starting node as the current node, generating a global master switch node election detection message including a preset unique identifier, an alternative identifier, and a group number; S92: Send the detection message from the current node to an adjacent switch node on one side; S93: The adjacent node determines whether it is the master switch node in the group. If yes, then determine whether the candidate identifier in the detection message is smaller than its own candidate identifier, If yes, then update the candidate identifier of the self to the candidate identifier in the detection message, Otherwise, if the candidate identifier in the detection message is greater than the candidate identifier of the neighboring node, the candidate identifier in the detection message is updated to its own candidate identifier and then an updated detection message is generated; Otherwise, no processing is done on the detection message; S94: sending the detection message from the adjacent node along the sending direction to the next node of the adjacent node, taking the next node as the adjacent node, and returning to execute S93 until the detection message returns to the starting node; S95: Determine whether the candidate identifier in the detection message is equal to the preset unique identifier of the starting node. If yes, mark the starting node as the global master switch. Otherwise, the starting node candidate identifier is updated to the candidate identifier in the detection message.

10. The method for autonomously obtaining the Owner node of an Ethernet ring network based on the improved ERPS protocol according to claim 1, characterized in that: When the Owner node fails, the remaining switch nodes in the group where the failed Owner node is located first select a new master switch node in the group, and then select a new global master switch node from the master switch nodes in each group as the new Owner node and save it.

Citation Information

Patent Citations

  • Service packet transmission method, and node apparatus

    CN109691031A

  • Cluster management method and device

    CN110071978A

  • Subring network link protection method and device based on ERPS protocol

    CN113645312A

  • Heterogeneous identity alliance risk assessment system and method based on block chain, and terminal

    CN114139203A

  • Virtual machine arrangement device and virtual machine arrangement method

    JP2017033337A