A method for autonomously obtaining Ethernet ring network owner nodes based on an improved ERPS protocol

By improving the ERPS protocol by adding number and identification fields to the switch nodes and combining them with the hash ring algorithm, autonomous owner node election and fault recovery in Ethernet ring networks were achieved. This solves the problem that owner node faults cannot be autonomously recovered in existing technologies, and improves the fault tolerance and robustness of industrial control systems.

CN120238510BActive Publication Date: 2025-10-31CSSC SYST ENG RES INST
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing technologies, the ERPS protocol integrated in Ethernet ring network switch nodes only supports pre-configured fixed network nodes as Owner nodes. Once the Owner node fails, it cannot recover autonomously, causing the Ethernet ring network to fall into unpredictable errors and affecting the operation of industrial control systems.

Method used

By improving the ERPS protocol, fields such as switch node number, group number, and candidate identifier are added to the switch node. Combined with the hash ring algorithm and probe message mechanism, the switch node can autonomously elect the owner node, including traversing the total number of nodes, group number, and the master switch election process, ensuring that it can recover autonomously in the event of owner node failure.

Benefits of technology

It enables automated owner node configuration and autonomous recovery in Ethernet ring networks, improving the fault tolerance and robustness of industrial control systems, reducing fault recovery time, and enhancing network management efficiency and load balancing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120238510B_ABST
    Figure CN120238510B_ABST
Patent Text Reader

Abstract

This invention relates to a method for autonomously obtaining the Owner node of an Ethernet ring network based on an improved ERPS protocol, belonging to the field of industrial internet technology. By adding a new field to the reserved fields of the ERPS protocol and adding corresponding opcodes, an improved ERPS protocol is obtained. This enables an Ethernet ring network composed of switch nodes supporting the improved ERPS protocol to not only be compatible with and support existing ERPS protocol communication, but also to have the ability to autonomously obtain the Owner node. In an Ethernet ring network composed of switch nodes supporting the improved ERPS protocol, each switch node first traverses the Ethernet ring network to obtain the total number of switch nodes, then applies a hash ring to obtain the corresponding group number for each switch node, then selects the master switch node within the same group, and finally selects the global master switch node as the Owner node from all group master switch nodes. This solves the problem in existing technologies where the Owner node of an Ethernet ring network cannot autonomously recover after a failure, resulting in poor robustness and fault tolerance of the network platform.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial internet technology, and in particular to a method for autonomously obtaining an Ethernet ring network owner node based on an improved ERPS protocol. Background Technology

[0002] Ring networks (also known as Ethernet ring networks) are a widely used ring network topology in the Industrial Internet field. They consist of switch nodes that communicate end-to-end, enabling applications in industrial control, telecommunications networks, and robotics. ERPS (G.8032) is a Layer 2 loop-breaking protocol standard defined by ITU-T, belonging to a general Ethernet ring network protection protocol. ERPS selectively blocks redundant network links to prevent broadcast storms, data loops, and MAC address table instability, thus ensuring Ethernet ring network communication quality. Furthermore, ERPS is a master-slave structure protocol, specifying Owner nodes, Neighbor nodes, Normal nodes, RPL links, port types, and related protocol messages, fulfilling the basic requirements for Ethernet ring network protection.

[0003] However, in the existing technology, the ERPS protocol integrated in the Ethernet ring network switch node only supports the pre-configuration of fixed network nodes as the owner nodes in the Ethernet ring network. Once the owner node fails, it cannot recover on its own, and the ring network cannot obtain the owner node on its own. This causes the Ethernet ring network to fall into unpredictable errors immediately, resulting in the obstruction of the operation of the industrial control system. Summary of the Invention

[0004] Based on the above analysis, the present invention aims to provide a method for autonomously obtaining Ethernet ring network owner nodes based on the improved ERPS protocol, in order to solve the problem in the prior art that the failure of Ethernet ring network owner nodes to autonomously recover after failure leads to the obstruction of industrial control system operation.

[0005] This invention provides a method for autonomously obtaining an Owner node in an Ethernet ring network based on an improved ERPS protocol. The Ethernet ring network consists of switch nodes supporting the improved ERPS protocol. In this Ethernet ring network, each switch node performs the following process to ultimately obtain the Owner node. The specific process includes:

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

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

[0008] S3: Group each switch node based on the corresponding group number, and then elect and save the master switch node in each group.

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

[0010] A further improvement to the above method 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 to the reserved field of the existing ERPS protocol message, and adding the corresponding operation code.

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

[0012] S31: Set 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 one of the adjacent switch nodes on one side;

[0014] S33: When the probe message is input to the adjacent switch, it will be updated after a count when it is output from the adjacent switch. Then, the adjacent switch will be used as the current node, and the updated probe message will be used as the probe message. Then, S32 will be executed again until the probe message returns to the starting node. Then, the probe message will stop being sent, and the node count result in the probe message will be used as the total number of nodes of the Ethernet ring network switch.

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

[0016] Multiple virtual nodes are generated for each switch node;

[0017] The number of hash ring packets is determined based on the number of switch nodes.

[0018] For each virtual node, the MAC address of the switch node and the group number of the virtual node are concatenated and then input into the selected hash function to obtain the output result. The hash value of each virtual node is obtained based on the output result.

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

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

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

[0022] In the formula,

[0023] G is the number of packets, and N is the total number of switch nodes. It represents rounding up. This represents rounding down to the nearest integer.

[0024] Based on a further improvement of the above method, the selected hash function is SHA-1.

[0025] Based on a further improvement of the above method, the corresponding group number is calculated using the following formula based on the hash value, hash ring length, and number of groups for each virtual node. The formula is specifically expressed as follows:

[0026] In the formula,

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

[0028] Based on a further improvement of the above method, each switch includes its own preset unique identifier; the initial value of the candidate identifier for each switch is set to its own preset unique identifier; taking each switch node as the starting node, the following process is executed for each switch; after all switches have completed the process, the switch in each group whose preset unique identifier is the same as the candidate identifier is designated as the master switch node in the group; the process specifically includes:

[0029] S81: Using the starting node as the current node, generate a probe message including a preset unique identifier, alternative identifiers, and a group number;

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

[0031] S83: After receiving the probe message, the adjacent node determines whether the group number in the probe message is the same as the group number of the adjacent node.

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

[0033] If so, the candidate identifier of the adjacent node is updated to the candidate identifier in the probe message;

[0034] Otherwise, if the candidate identifier in the probe message is greater than the candidate identifier of the adjacent node, then the candidate identifier in the probe message is updated to the candidate identifier of the adjacent node.

[0035] Otherwise, the probe message is sent from the adjacent node along the sending direction to the next node of the adjacent node, and the next node is taken as the adjacent node. Then, S83 is executed again until the probe message returns to the starting node.

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

[0037] Otherwise, update the starting node candidate identifier to the candidate identifier in the probe message.

[0038] Based on a further improvement of the above method, taking the master switch node within each group as the starting node, the following process is executed on each master switch node within the group. After all switch nodes have completed the process, the master switch node within the group whose preset unique identifier is the same as the candidate identifier is selected as the global master switch node. The process specifically includes:

[0039] S91: Using the starting node as the current node, generate a global master switch node election probe message including a preset unique identifier, candidate identifier, and group number;

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

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

[0042] If so, determine whether the candidate identifier in the probe message is smaller than its own candidate identifier.

[0043] If so, update its own candidate identifier to the candidate identifier in the probe message.

[0044] Otherwise, if the candidate identifier in the probe message is greater than the candidate identifier of the adjacent node, the candidate identifier in the probe message is updated to its own candidate identifier before an updated probe message is generated.

[0045] Otherwise, no processing is performed on the probe messages;

[0046] S94: Send the probe message from the adjacent node along the sending direction to the next node of the adjacent node, and take the next node as the adjacent node, and return to execute S93 until the probe message returns to the starting node;

[0047] S95: Determine whether the candidate identifier in the probe 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 starting node candidate identifier to the candidate identifier in the probe 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 addition of switch node number, group number, candidate identifier, and corresponding opcode to the reserved fields of the ERPS protocol for electing the Owner node, enables all switch nodes supporting the improved ERPS protocol to obtain the total number of switch nodes and switch numbers by traversing the Ethernet ring network, and to group the switch nodes using a hash ring to obtain the group number of each switch node. Then, a master switch is elected from each switch node group, and a global master switch node is elected from the master switches in each group as the Owner node. Compared with existing technologies, it is not necessary to manually pre-configure a certain node as the fixed Owner node. Instead, the Owner node is automatically selected from all switch nodes in the network, realizing the automated 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 select 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. Compared with the existing technology, this realizes the autonomous election of a new Owner node to achieve autonomous network recovery, significantly improving the fault tolerance and robustness of industrial control systems using Ethernet ring networks.

[0052] 3. A hash ring algorithm is applied to select a hash function. By adding virtual nodes to each switch node, load balancing is achieved. The hash ring is then grouped and numbered to obtain the group number of each virtual node. The MAC address of the switch node and the number of each virtual node are concatenated and input into the selected hash function to obtain the output result. Based on the output result, the hash value of each virtual node is obtained. Then, based on the hash value of each virtual node, the corresponding group number is obtained, and the number of virtual nodes in each group is obtained. The group number with the most virtual nodes is used as the switch node group number. This not only achieves 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 an appropriate hash function. This basically achieves load balancing of each switch node, and also helps to improve network management efficiency and reduce computational complexity.

[0053] 4. A preset unique identifier is used in each switch node to select the master node within the group and the master node within the network. The node with the smallest preset unique identifier is selected as the master node within the group by comparing them one by one. Then, the node with the smallest preset unique identifier is selected as the master node within the network from the master nodes within each group. This realizes the automatic acquisition of the owner node. Moreover, the election process is fast and has low computational complexity, which greatly shortens the pause time of the industrial control system from the failure of the owner node to the autonomous recovery, and has almost no impact on the industrial control process.

[0054] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description

[0055] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.

[0056] Figure 1 This is a flowchart of a method according to an embodiment of the present invention. Detailed Implementation

[0057] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended 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, such as... Figure 1 As shown.

[0059] An Ethernet ring network is formed by switch nodes supporting the improved ERPS protocol. In this Ethernet ring network, the Owner node is ultimately obtained by performing the following process at each switch node:

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

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

[0062] S3: Based on the group number corresponding to each switch node, obtain the switch node group, then elect the master switch node in the group and save it;

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

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

[0065] Table 1: Existing ERPS Protocol Frame Message Format and Content

[0066]

[0067]

[0068] Bytes 26-52 in Table 1 are used to store R-APS specific information. Among them, the Reserved2 field in R-APSSpecificInformation is a reserved field with a length of 24 octets.

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

[0070] Furthermore, the improved ERPS protocol specifically refers to adding the switch node number, group number, and candidate identifier used for electing the Owner node to the reserved fields of the existing ERPS protocol message, and adding the corresponding opcode.

[0071] In one specific embodiment, the Reserved2 field shown in Table 2 is added to the R-APSSpecificInformation field of the existing ERPS protocol message:

[0072] Table 2: Content and Meaning of New Fields

[0073]

[0074] The CLASS-ID is 4 bytes long. The high 2 bytes (16 bits) are used to identify the group number of the switch node, and the low 2 bytes (16 bits) are used to indicate the role of the switch node. The switch roles specifically include: non-candidate switch node, candidate switch node in the group, master switch node in the group, and global master switch node.

[0075] In one specific embodiment, the new message types added to the improved ERPS protocol are defined by adding the opcodes shown in Table 3 below:

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

[0077]

[0078] By adding the newly added fields in Table 2 to the Reserved2 field of the R-APSSpecificInformation in the existing ERPS protocol message through the above specific embodiments, and adding the corresponding opcodes for the new message types in Table 3, an improved ERPS protocol message is obtained.

[0079] When a switch supporting the improved ERPS protocol and a switch supporting the existing ERPS protocol form an Ethernet ring network, the switch supporting the improved ERPS protocol can be compatible with and recognize existing ERPS protocol messages. However, the switch supporting the existing ERPS protocol does not recognize the new opcodes and fields added in the improved ERPS protocol. Therefore, it cannot participate in the owner node self-election process, nor can it recognize the self-elected owner node.

[0080] In this embodiment, switch nodes supporting the improved ERPS protocol form an Ethernet ring network. Before an owner node is autonomously elected or manually configured in the Ethernet ring network, the owner node is ultimately obtained through the following process performed by each switch node:

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

[0082] Specifically, the Ethernet ring network consists of switch nodes that support the improved ERPS protocol. Once all switches are powered on and enabled, each node performs a self-test.

[0083] Specifically, each switch node, starting from itself, traverses the Ethernet ring network to obtain the total number of switch nodes through the following process:

[0084] S31: Set 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 one of the adjacent switch nodes on one side;

[0086] S33: When the probe message is input to the adjacent switch, it will be updated after a count when it is output from the adjacent switch. Then, the adjacent switch will be used as the current node, and the updated probe message will be used as the probe message. Then, S32 will be executed again until the probe message returns to the starting node. Then, the probe message will stop being sent, and the node count result in the probe message will be used as the total number of nodes of the Ethernet ring network switch.

[0087] After the switch node is powered on, the newly added fields "Switch Node Number" and "Total Number of Switch Nodes" in the improved ERPS protocol fields are both empty.

[0088] Specifically, based on the operating mechanism of the ERPS protocol in the Ethernet ring network, each switching node acts as an initial switching node. The initial switching node sends a probe message from one side port to the adjacent switching node at the other end to count the total number of nodes. The probe message also records the preset unique identifier of the initial switching node.

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

[0090] When the probe message passes through each switch node, it reads the preset unique identifier of the passed switch node and compares it with the preset unique identifier carried by itself. If they do not match, a count is performed. Based on the characteristics of the Ethernet ring network, after passing through all switch nodes, the probe message will return to the initial switch node that sent the corresponding probe message. The other port of the initial switch node will receive and read the probe message. If the preset unique identifier of the initial switch node recorded in the probe message matches the preset unique identifier of the initial switch node, then the total number of nodes recorded in the probe message is read and stored in the initial switch node.

[0091] In one specific embodiment, when the initial switch node sends a probe message to count the total number of nodes, the total number of nodes is initially set to 1. For each adjacent switch node, the node count is incremented by 1. Specifically, a new counting field can be added to the improved ERPS protocol to count the nodes passed through by the probe message.

[0092] In one specific embodiment, TTL (Time To Live) network data packet counting can also be used. The initial switch node sends a TTL probe message containing a preset initial value. The probe message is decremented by 1 for each adjacent switch node it passes through. When the probe message returns to the initial switch node, the TTL value recorded by the initial switch node is subtracted from the TTL value stored in the probe message, and then incremented by 1 to obtain the node count result. The node count result is used as the total number of switch nodes.

[0093] The purpose of step S1 is to ensure that each switch node in the Ethernet ring network that supports the improved ERPS protocol can obtain and save the total number of switch nodes by traversing all nodes in the Ethernet ring network, so as to execute subsequent steps. The total number of switch nodes obtained by each switch node from its own probe packets is the same.

[0094] Preferably, the probe message can also record a preset unique identifier of each node it passes through, which is convenient for subsequent processing.

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

[0096] Specifically, the application of the hash ring groups the switch nodes, meaning that each switch node performs the following process:

[0097] Multiple virtual nodes are generated for each switch node;

[0098] The number of hash ring packets is determined based on the number of switch nodes. For each virtual node, the MAC address of the switch node and the packet number of the virtual node are concatenated and then input into the selected hash function to obtain the output result. The hash value of each virtual node is obtained based on the output result.

[0099] The corresponding group number is determined based on the hash value, hash ring length, and number of groups of each virtual node;

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

[0101] The principle of step S2 is that each switch node constructs a hash ring by selecting a hash function, dividing all switch nodes into multiple groups. Each switch node obtains a corresponding group number. The purpose is to distribute all switch nodes as evenly as possible, thereby avoiding the problem of unbalanced load.

[0102] Specifically, a hash ring value range space is preset, the hash ring is grouped, and several virtual nodes are set for the switch nodes. The virtual nodes are mapped to the hash ring to find the corresponding group of the switch node on the hash ring. This is done by executing the following process:

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

[0104] In principle, the more virtual nodes there are, the better the uniformity of the distribution mapped onto the hash ring. However, too many virtual nodes can lead to redundant computation and unnecessary overhead on the 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 packets based on the number of switch nodes.

[0108] Furthermore, the feature is that the number of hash ring groups is calculated using the following formula, which is specifically expressed as:

[0109]

[0110] G is the number of packets, and N is the total number of switch nodes. It represents rounding up. This represents rounding down to the nearest integer.

[0111] For example, if N = 50, then G = 8; if N = 1000, then G = 316.

[0112] For Ethernet ring networks, different grouping methods are used for different network sizes. Usually, 100 switch nodes is used as the critical point. Ethernet ring networks with more than 100 switch nodes have more groups than those with fewer than 100 switch nodes in order to obtain a relatively balanced correspondence between the number of groups and the number of nodes within each group, thus achieving the optimal computational time complexity.

[0113] Next, the virtual nodes of the switch nodes are grouped based on the obtained number of groups and the range of hash ring values.

[0114] The hash ring value range is divided equally into segments on the hash ring, with the same number of segments as the number of groups. Each segment corresponds to one of the segments.

[0115] For example, assuming the total number of Ethernet ring network switch nodes N is 50, the number of packets G is 8, a single switch node is configured with 1000 virtual nodes, and the hash ring length is 2. 128 The hash ring is then divided into 8 equal intervals, as follows:

[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] Each interval has a length of 2. 128 / 8=2 125 .

[0125] For all switch nodes in the Ethernet ring network, each switch node is configured with the same number of virtual nodes and mapped onto the hash ring. When all virtual nodes of all switch nodes are mapped onto the hash ring, it can be considered that a relatively uniform distribution has been achieved. The purpose of this 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, a switch node goes offline, causing all corresponding virtual nodes to disappear from the hash ring), since the overall distribution of virtual nodes is uniform, it is equivalent to removing a few virtual nodes in each group, which will not affect the overall distribution balance. Therefore, it is not necessary to repeat step S2 to make the switch nodes obtain group numbers again, reducing the processing complexity when there are local changes in the network and improving response efficiency.

[0126] Step 3: For each virtual node, concatenate the MAC address of the switch node and the packet number of the virtual node, input the concatenation 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] Furthermore, the selected hash function is SHA-1.

[0128] Specifically, SHA-1 is selected as the hash function. The output of SHA-1 is a 160-bit value. In this embodiment, it is preferable to extract the first 128 bits of the SHA-1 output as the hash value. For the Ethernet ring network, SHA-1 is used as the selected hash function, and 0 to 2 are used as the hash value. 128 Using -1 as the total length of the hash ring satisfies the requirements of hash value uniqueness and uniform distribution, and does not lead to redundant computational complexity.

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

[0130] Specifically, the output result of the selected hash function corresponding to the virtual node is first calculated using the following formula, which 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 represents concatenating i with the MAC address of the switch node, and SHA-1(MAC||i)[0:127] is the hash value of the switch node.

[0133] The first 128 bits of the output are truncated and used as the hash value of the corresponding virtual node.

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

[0135]

[0136] The hash value of the 50th virtual node is obtained by truncating the first 128 bits of the output result.

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

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

[0139] In the formula,

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

[0141] Specifically, based on the goal of uniformly mapping virtual nodes onto the hash ring, in the first step, the hash ring length has been divided into multiple equal-length intervals according to the total number of groups. Then, after obtaining the hash value of the virtual node, the group number corresponding to the virtual node is obtained by dividing the hash value of the virtual node by the length of a single interval and rounding down.

[0142] For example, the hash value of the 50th virtual node of the switch node is assumed to be 3*2. 125 The calculation process for the 50th virtual node group number of this switch node is as follows:

[0143]

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

[0145] Using the same method, the group number of each virtual node of the switch node can be calculated.

[0146] Step 5: Obtain the number of virtual nodes in each group, and use the group number with the most virtual nodes as the switch node group number.

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

[0148] The group number with the most virtual nodes of the same group number is used as the group number of the switch node.

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

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

[0151] Furthermore, each switch includes its own preset unique identifier; the initial value of the candidate identifier for each switch is set to its own preset unique identifier; taking each switch node as the starting node, the following process is performed on each switch, and after all switches have completed the process, the switch in each group whose preset unique identifier and candidate identifier are the same is designated as the master switch node in the group; the process specifically includes:

[0152] S81: Using the starting node as the current node, generate a probe message including a preset unique identifier, alternative identifiers, and a group number;

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

[0154] S83: After receiving the probe message, the adjacent node determines whether the group number in the probe message is the same as the group number of the adjacent node.

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

[0156] If so, the candidate identifier of the adjacent node is updated to the candidate identifier in the probe message;

[0157] Otherwise, if the candidate identifier in the probe message is greater than the candidate identifier of the adjacent node, then the candidate identifier in the probe message is updated to the candidate identifier of the adjacent node.

[0158] Otherwise, the probe message is sent from the adjacent node along the sending direction to the next node of the adjacent node, and the next node is taken as the adjacent node. Then, S83 is executed again until the probe message returns to the starting node.

[0159] S84: Determine whether the candidate identifier in the probe message is equal to the preset unique identifier of the starting node. If so, designate the starting node as the main switch within the group.

[0160] Otherwise, update the starting node candidate identifier to the candidate identifier in the probe message.

[0161] The principle of electing the Owner node in this embodiment is to compare the preset unique identifiers of each switch node and select the switch node with the smallest preset unique identifier as the Owner node. To achieve this, each switch node obtains a list containing the preset unique identifiers of all switch nodes within the Ethernet ring network after step S1. When the network is very large, the time complexity of traversing the entire network and comparing each node to select the Owner node is O(N). 2 The network overhead and time consumption are significant. By first selecting the master switch node within each group, and then selecting the owner node from the master switch nodes within the group, the time complexity is reduced to [a much smaller value]. Group management helps reduce 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 probe message that includes a preset unique identifier, an alternative identifier, and a packet number.

[0163] When a switch node obtains a group number, it becomes the current node and begins executing step S81, generating an intra-group election probe message. The intra-group election probe message serves several purposes: it transmits the initial node's group number, finds and records nodes in the same group, and then transmits this message back to the initial node via ring network communication to maintain information about nodes in the same group; furthermore, it executes an election process to select the node with the smallest preset unique identifier within the group. After comparing each node in the group through ring network communication, the message is then transmitted back to the initial node for storage and recording.

[0164] For example, Table 4 below shows the format of intragroup election probe messages.

[0165] Table 4: Format of Intra-group Election Probe Messages

[0166] Fields illustrate Type Message type (indicating the activation of the master switch node within the election group) CLASSID Current group number SenderMAC Sender's MAC address CandidateMAC The MAC addresses of candidate nodes in the current group (initially the sender's own MAC address). TTL Survival time, used to count nodes within a group Direction Direction of dissemination

[0167] For example, in the preferred group election probe message in Table 4, the MAC address is used as the preset unique identifier; where SenderMAC is the MAC address of the initial node as the preset unique identifier of the initial node; the CandidateMAC field is the candidate identifier, which stores the MAC address of the candidate node in the group, where the initial value of CandidateMAC is the MAC address of the initial node; TTL is used to count the number of nodes in the same group.

[0168] When a neighboring node receives a probe message for intra-group election, it first determines whether the node that initially sent the probe message is in the same group by comparing its own group number with the group number in the probe message.

[0169] If not, the adjacent node will forward the probe message to the next adjacent node in the same direction without processing the probe message or its own information.

[0170] If the adjacent node and the current node are in the same group, it is determined whether the candidate identifier in the probe message is smaller than the candidate identifier of the adjacent node. Based on the election principle, the smaller candidate identifier is preferred. If the adjacent node's candidate identifier is smaller, the candidate identifier in the probe message is updated to the adjacent node's candidate identifier. The purpose is to find the node with the smallest candidate identifier by traversing all nodes in the group through probe messages and save it to the candidate identifier field of each node in the group. Each switch node in the group sends probe messages to traverse all nodes in the group. After the nodes are identified, the smallest candidate identifier is found and stored in all nodes within the group. The smallest candidate identifier corresponds to the switch node with the smallest preset unique identifier within the group. When the switch node sends a group election probe message that traverses all nodes within the group and returns, the switch node compares the candidate identifier stored in the probe message with its own preset unique identifier. If they are the same, the switch node marks itself as the main switch node within the group. Other non-main switch nodes send probe messages, traverse all nodes within the group, store the main switch node in the group in their own maintained list of switch nodes within the group, and mark themselves as candidate nodes within the group.

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

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

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

[0174] Furthermore, taking the master switch node within each group as the starting node, the following process is executed for each master switch node within the group. After all switch nodes have completed the execution, the master switch node within the group whose preset unique identifier is the same as the candidate identifier is selected as the global master switch node. The process specifically includes:

[0175] S91: Using the starting node as the current node, generate a global master switch node election probe message including a preset unique identifier, candidate identifier, and group number;

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

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

[0178] If so, determine whether the candidate identifier in the probe message is smaller than its own candidate identifier.

[0179] If so, update its own candidate identifier to the candidate identifier in the probe message.

[0180] Otherwise, if the candidate identifier in the probe message is greater than the candidate identifier of the adjacent node, the candidate identifier in the probe message is updated to its own candidate identifier before an updated probe message is generated.

[0181] Otherwise, no processing is performed on the probe messages;

[0182] S94: Send the probe message from the adjacent node along the sending direction to the next node of the adjacent node, and take the next node as the adjacent node, and return to execute S93 until the probe message returns to the starting node;

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

[0184] Otherwise, update the starting node candidate identifier to the candidate identifier in the probe message.

[0185] Specifically, the election process for the global master switch node is executed by each master switch node within its own group, with other switch nodes not participating. The purpose of the global master switch node election is to find the master switch node with the smallest preset unique identifier among all master switch nodes in the group.

[0186] For example, Table 5 below shows the format of the global election probe message.

[0187] Table 5: Global Election Probe Message Format

[0188]

[0189] Once each group's master switch node has completed step S4, the global master switch node is elected. All group master switch nodes are aware of the election result, but other non-group master switch nodes did not participate in the global master switch node election process and are unaware of the election result. Therefore, the global master switch node periodically sends broadcast messages declaring the owner node status to all other switch nodes in the Ethernet ring network, notifying all other switch nodes that the global master switch node is the owner node.

[0190] Thus, the Ethernet ring network composed of switch nodes that support the improved ERPS protocol has completed the entire process of autonomously electing the Owner node.

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

[0192] Specifically, when the Owner node fails, it stops periodically sending broadcast messages to all other switch nodes in the Ethernet ring network. As a result, the other switch nodes in the Ethernet ring network will not receive the broadcast message declaring the Owner node's status sent by the Owner node, and thus the Ethernet ring network communication will be suspended. Then, the other switch nodes in the group where the failed Owner node is located will first select a new master switch node within the group, and then select a new global master switch node from the master switch nodes within each group as the new Owner node and save it.

[0193] In one specific embodiment, after the remaining switch nodes in the Ethernet ring network time out while waiting for the Owner node to send a broadcast message declaring the Owner node's status, they periodically send Owner node status query messages and wait for a reply. When the status query messages in several consecutive periods all reply with timeouts, the remaining switch nodes in the Ethernet ring network update the total number of switch nodes they have stored. The remaining switch nodes in the group where the faulty Owner node is located remove the faulty Owner node from their respective stored switch node lists and execute S3 to elect a new master switch node in the group and mark it. When the group where the faulty Owner node is located elects a new master switch node in the group, the new master switch node in the group immediately executes S4 to become the global master switch node.

[0194] This embodiment discloses a method for autonomously obtaining the Owner node of an Ethernet ring network based on an improved ERPS protocol. The Ethernet ring network is composed of 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. It then applies a hash ring to obtain the corresponding group number for each switch node. Next, it selects the master switch node within the same group of switch nodes. Finally, it selects the global master switch node as the Owner node from all the group master switch nodes. Compared to existing technologies, this embodiment improves the ERPS protocol by adding a field corresponding to the election to the reserved fields of the ERPS protocol and adding a corresponding message type opcode. This enables the Ethernet ring network composed of switch nodes supporting the improved ERPS protocol to not only support communication with existing ERPS protocol switch nodes but also to obtain the ability to autonomously acquire the Owner node of the Ethernet ring network. This solves the problem of poor fault tolerance and robustness of existing ERPS protocol Ethernet ring networks, which cannot autonomously recover after the Owner node fails.

[0195] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0196] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection 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. Specifically, the improved ERPS protocol involves adding a switch node number, packet number, and candidate identifier to the reserved fields of existing ERPS protocol messages for electing the Owner node, and adding corresponding opcodes. In the Ethernet ring network, the Owner node is ultimately obtained by each switch node performing the following process: S1: Traverse the Ethernet ring network to obtain and save the total number of switch nodes; S2: Apply a hash ring to obtain and save the group number corresponding to each switch node. Specifically, applying the hash ring to group the switch nodes means that each switch node performs the following process: Multiple virtual nodes are generated for each switch node; The number of hash ring packets is determined based on the number of switch nodes. For each virtual node, the MAC address of the switch node and the group number of the virtual node are concatenated and then input into the selected hash function to obtain the output result. The hash value of each virtual node is obtained based on the output result. The corresponding group number is determined based on the hash value, hash ring length, and number of groups of each virtual node; The number of virtual nodes in each group is obtained based on the group number of each virtual node, and the group number with the most virtual nodes is used as the switch node group number. S3: Group each switch node based on the corresponding group number, and then elect and save the master switch node in each group. S4: Elect the global master switch node from the master switch nodes in each group as the Owner node and save it.

2. The method for autonomously obtaining an Ethernet ring network owner node based on an improved ERPS protocol according to claim 1, characterized in that, Each switch node starts from itself and traverses the Ethernet ring network to obtain the total number of switch nodes through the following process: S31: Set the starting node as the current node and generate a probe message for node counting; S32: Send the probe message from the current node to one of the adjacent switch nodes on one side; S33: When the probe message is input to the adjacent switch, it will be updated after a count when it is output from the adjacent switch. Then, the adjacent switch will be used as the current node, and the updated probe message will be used as the probe message. Then, S32 will be executed again until the probe message returns to the starting node. Then, the probe message will stop being sent, and the node count result in the probe message will be used as the total number of nodes of the Ethernet ring network switch.

3. The method for autonomously obtaining an Ethernet ring network owner node based on the improved ERPS protocol according to claim 2, characterized in that, The number of hash ring groups is calculated using the following formula, which is specifically expressed as follows: In the formula, G is the number of packets, and N is the total number of switch nodes. It represents rounding up. This represents rounding down to the nearest integer.

4. The method for autonomously obtaining an Ethernet ring network owner node based on the improved ERPS protocol according to claim 3, characterized in that, The selected hash function is SHA-1.

5. The method for autonomously obtaining an Ethernet ring network owner node based on an improved ERPS protocol according to claim 4, characterized in that, The corresponding group number is calculated based on the hash value, hash ring length, and number of groups for each virtual node using the following formulas, which are specifically expressed as follows: In the formula, CLASS-ID is the group number, H virtual It is the hash value of the virtual node, 2 preset-length It is the length of the hash ring.

6. The method for autonomously obtaining an Ethernet ring network owner node 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 for each switch is set to its own preset unique identifier; starting with each switch node, the following process is performed on each switch; after all switches have completed the process, the switch in each group whose preset unique identifier and candidate identifier are the same is designated as the master switch node in the group; the process specifically includes: S81: Using the starting node as the current node, generate a probe message including a preset unique identifier, alternative identifiers, and a group number; S82: Send the probe message from the current node to the adjacent switch node on one side; S83: After receiving the probe message, the adjacent node determines whether the group number in the probe message is the same as the group number of the adjacent node. S831: If so, determine whether the candidate identifier in the probe message is less than the candidate identifier of the adjacent node. If so, the candidate identifier of the adjacent node is updated to the candidate identifier in the probe message; Otherwise, if the candidate identifier in the probe message is greater than the candidate identifier of the adjacent node, then the candidate identifier in the probe message is updated to the candidate identifier of the adjacent node. Otherwise, the probe message is sent from the adjacent node along the sending direction to the next node of the adjacent node, and the next node is taken as the adjacent node. Then, S83 is executed again until the probe message returns to the starting node. S84: Determine whether the candidate identifier in the probe message is equal to the preset unique identifier of the starting node. If so, designate the starting node as the main switch within the group. Otherwise, update the starting node candidate identifier to the candidate identifier in the probe message.

7. The method for autonomously obtaining an Ethernet ring network owner node based on the improved ERPS protocol according to claim 6, characterized in that, Starting with the master switch node within each group, the following process is executed for each master switch node within the group. After all switch nodes have completed the process, the master switch node within the group whose preset unique identifier matches the candidate identifier is designated as the global master switch node. The process specifically includes: S91: Using the starting node as the current node, generate a global master switch node election probe message including a preset unique identifier, candidate identifier, and group number; S92: Send the probe message from the current node to the adjacent switch node on one side; S93: The adjacent node determines whether it is the main switch node in the group. If so, determine whether the candidate identifier in the probe message is smaller than its own candidate identifier. If so, update its own candidate identifier to the candidate identifier in the probe message. Otherwise, if the candidate identifier in the probe message is greater than the candidate identifier of the adjacent node, the candidate identifier in the probe message is updated to its own candidate identifier before an updated probe message is generated. Otherwise, no processing is performed on the probe messages; S94: Send the probe message from the adjacent node along the sending direction to the next node of the adjacent node, and take the next node as the adjacent node, and return to execute S93 until the probe message returns to the starting node; S95: Determine whether the candidate identifier in the probe message is equal to the preset unique identifier of the starting node. If so, mark the starting node as the global master switch. Otherwise, update the starting node candidate identifier to the candidate identifier in the probe message.

8. The method for autonomously obtaining an Ethernet ring network owner node 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 group master switch node, and then elect a new global master switch node from the group master switch nodes as the new Owner node and save it.

Citation Information

Patent Citations

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

    CN113645312A

  • Data configuration method and device for protecting ring network

    WO2017059715A1