A method for relaying data in a relay network element
By calculating link weights in real time and optimizing relay paths in a quantum-safe network, the problems of low data relay efficiency and waste of quantum key resources caused by excessively long relay paths are solved, achieving efficient data relay and network operation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MATRICTIME DIGITAL TECH CO LTD
- Filing Date
- 2023-10-30
- Publication Date
- 2026-06-30
Smart Images

Figure CN117478585B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of communications, and specifically relates to a method for relaying data in a relay network element. Background Technology
[0002] Quantum-safe network relay elements provide relay routing and data relay functions for network elements in the quantum-safe network that require cross-regional communication. Currently, with the increasing number of users and the continuous expansion of the network scale in quantum-safe networks, more relay elements are needed to support data relay services. The increase in relay elements necessitates the continuous selection of the next relay element during the relay process, resulting in longer relay paths. The selection of relay elements may present the following problems: excessively long relay paths lead to low data relay efficiency, resulting in reduced network operating efficiency and a poor user communication experience; excessively long relay paths also increase the consumption of quantum keys required during data relay, causing unnecessary waste of quantum key resources. Therefore, there is an urgent need to provide a method for relaying data through relay elements to ensure that relay elements that do not meet the relay conditions are not selected during the data relay process. Summary of the Invention
[0003] To address the aforementioned problems, this invention discloses a method for relaying data in a relay network element.
[0004] According to an embodiment of the present invention, the technical solution of the present invention is as follows:
[0005] A method for relaying data in a relay network element, comprising the following steps:
[0006] Step 1: In the quantum network, each relay element establishes a link with the relay element connected to it based on the link establishment information provided by the network management system, and calculates the weight value of the link in real time. At the same time, it reports the link, link status, and link weight value to the network management system, which then synchronizes them to each relay element in the quantum network. Each relay element establishes a link weight value table and calculates the link path table based on the link weight value table.
[0007] Step 2: Any relay element in the quantum network acts as the target relay element to receive relay data sent by other relay elements in the quantum network. It decrypts and verifies the relay data using the paired decryption key and then puts it into the relay queue. Then, it parses the decrypted and verified relay data in the relay queue to obtain the identifier of the destination relay element corresponding to the relay data.
[0008] Step 3: The target relay element traverses the link path table based on the destination relay element identifier to find the shortest path route to the destination relay element;
[0009] Step 4: The target relay element verifies and encrypts the received relay data corresponding to the identifier of the destination relay element, and then sends it to the destination relay element according to the shortest path obtained in Step 3.
[0010] As an improvement of the present invention, in step 1, the process of calculating the weight value of the link specifically includes:
[0011] Step 1-1: Perform relay network initialization weight calculation on the link to obtain the initial link weight value W0;
[0012] Step 1-2: Calculate the link weights for delay and packet loss, and obtain the link weight values W1 for delay and packet loss.
[0013] Steps 1-3: Calculate the link weight of the relay queue to obtain the link weight value W2 of the relay queue;
[0014] Steps 1-4: Calculate the link weight based on the key reserve to obtain the link weight value W3 based on the key reserve;
[0015] Steps 1-5: Calculate the link weight for key download to obtain the link weight value W4 for key download;
[0016] Steps 1-6: Sum all the link weight values calculated in steps 1-1 to 1-5 to obtain the final link weight value W = W0 + W1 + W2 + W3 + W4.
[0017] As an improvement of the present invention, in step 1-1, the specific process of calculating the initial weight of the relay network is as follows:
[0018] Initialize the relay network, then the relay element m obtains the link establishment information from the network management, and establishes a link Lmn with the relay element n connected to it, and sets the weight value of link Lmn to W0=Wmn=Wnm=1.
[0019] If the link Lmn between relay element m and the relay element n connected to it is disconnected, then the weight value of link Lmn is W0=Wmn=Wnm=∞.
[0020] The relay element m synchronizes the link weight value W0 to the network management system, which then synchronizes the link status and link weight value W0 of link Lmn to all other relay elements.
[0021] As an improvement of the present invention, the specific process of calculating the delay and packet loss link weight in steps 1-2 is as follows:
[0022] Relay element m sends a heartbeat packet to relay element n connected to it via link Lmn. After receiving the heartbeat packet, relay element n replies with a heartbeat packet via link Lnm. The sending and replying of heartbeat packets are performed in a loop. The latency and packet loss rate of link Lmn are continuously calculated, and the latency and packet loss rate are monitored in real time to see if they reach the threshold T[i] and the packet loss rate reach the threshold T[j].
[0023] If the latency does not reach the threshold T[i], then the weight value W1 of link Lmn is Wmn; if the latency reaches the threshold T[i] and the packet loss rate does not reach the threshold T[j], then the weight value W1 of link Lmn is Wmn ± ΔW[i]; if the latency reaches the threshold T[i] and the packet loss rate reaches the threshold T[j], then the weight value W1 of link Lmn is Wmn ± ΔW[i] ± ΔW[j].
[0024] The relay element m synchronizes the link weight value W1 to the network management system, which then synchronizes the link weight value W1 of link Lmn to all other relay elements.
[0025] As an improvement of the present invention, when the delay reaches the threshold T[i], if the threshold T[i] = 200 ms, ΔW[i] = 0.5; if the threshold T[i] = 500 ms, ΔW[i] = 1; if the threshold T[i] = 1000 ms, ΔW[i] = ∞; when the packet loss rate reaches the threshold T[j], if the threshold T[j] = 20%, ΔW[j] = 0.5; if the threshold T[j] = 50%, ΔW[j] = 1; if the threshold T[j] = 90%, ΔW[j] = ∞.
[0026] As an improvement of the present invention, the specific process of calculating the relay queue link weight in steps 1-3 is as follows:
[0027] The initial number of data queued in the relay queue Q of relay element m is 0. Relay element m puts relay data from all relay elements connected to it into relay queue Q. If the number of data queued in relay queue Q reaches the threshold T[k], then the link weight value W2 of the relay queue of link Lmn is Wmn ± ΔW[k]. If the number of data queued in relay queue Q does not reach the threshold T[k], then the link weight value W2 of the relay queue of link Lmn is Wmn. The relay queue Q is stored in the memory area of relay element m. Relay element m synchronizes the link weight value W2 to the network management system, and the network management system synchronizes the link weight value W2 of link Lmn to all other relay elements.
[0028] As an improvement of the present invention, when the number of relay data queued in the relay queue Q of the relay network element m reaches the threshold T[k], if the threshold T[k]=1000, ΔW[k]=0.5; if the threshold T[k]=5000, ΔW[k]=1; if the threshold T[k]=10000, ΔW[k]=∞.
[0029] As an improvement of the present invention, the specific process of calculating the key surplus link weight in steps 1-4 is as follows:
[0030] When a link is established between a relay element m and a relay element n connected to it, the relay element m periodically monitors the key balance between itself and the relay element n connected to it. When the key balance reaches the threshold T[q], the link weight value of the key balance of link Lmn is W3 = Wmn ± ΔW[q]. When the key balance does not reach the threshold T[q], the link weight value of the key balance of link Lmn is W3 = Wmn. The relay element m synchronizes the link weight value W3 to the network management system in real time, and the network management system synchronizes the link weight value W3 of link Lmn to all other relay elements. Among them, when the key balance reaches the threshold T[q], if the threshold T[q] = 50%, ΔW[q] = 0.5; if the threshold T[q] = 20%, ΔW[q] = 1; if the threshold T[q] = 10%, ΔW[q] = ∞.
[0031] As an improvement of the present invention, the specific process of calculating the key download link weight in steps 1-5 is as follows:
[0032] Step 1-5-1: Relay network element m periodically monitors the key balance between itself and the relay network element n connected to it. If the key balance is greater than or equal to the threshold T[q], W4=Wmn; if the key balance is less than the threshold T[q], relay network element m and the relay network element n connected to it are triggered to synchronously download the key from the key center and proceed to the next step.
[0033] Step 1-5-2: Determine whether the download keys are paired and equal in number between relay network element m and its connected relay network element n.
[0034] If the pairings are identical in number, the key download is successful, and the link weight value W4 = Wmn for the key download of link Lmn.
[0035] Otherwise, if the key download fails, the link weight value W4=Wmn=Wnm=∞ for the key download of link Lmn will be repeatedly triggered. At the same time, the relay element m and the relay element n connected to it will be repeatedly triggered to download the key from the key center and the judgment process in step 1-5-2 until the key download is successful.
[0036] The relay element m synchronizes the link weight value W4 to the network management system in real time, and the network management system then synchronizes the link weight value W4 of link Lmn to all other relay elements.
[0037] As an improvement of the present invention, in step 1, the specific process of establishing the link weight value table is as follows: each relay network element constructs a two-dimensional array based on the links synchronized by the network management and the weight values of the links, and establishes the link weight value table based on the two-dimensional array.
[0038] As an improvement of the present invention, in step 1, the specific process of calculating the link path table based on the link weight value table is as follows: each relay network element uses the link weight value table as the first parameter and uses the relay network element's own identifier as the second parameter, and inputs it into the Dijkstra algorithm to calculate the link path table of the relay network element.
[0039] The beneficial effects of this invention are as follows:
[0040] 1. Provide a method for selecting the optimal relay route, simplifying data relay links, improving data relay efficiency, and thus effectively improving network operating efficiency;
[0041] 2. The optimization of the relay route reduces the consumption of quantum keys and computing power. The sending relay network element no longer needs to consider factors such as the remaining key quantity of the receiving network element, key download, latency and packet loss of public network routing, and whether the relay queue is overloaded, which may cause relay data anomalies, thereby reducing the waste of quantum key resources. Attached Figure Description
[0042] Figure 1 This is a flowchart of the method for relaying data in a relay network element according to the present invention;
[0043] Figure 2 Flowchart for initializing weight calculation for relay network;
[0044] Figure 3 Flowchart for calculating link weights based on latency and packet loss;
[0045] Figure 4 Here is a flowchart for calculating the link weight of a relay queue;
[0046] Figure 5 Here is a flowchart for calculating the key margin link weight;
[0047] Figure 6 Flowchart for calculating the weight of the key download link;
[0048] Figure 7 Flowchart for calculating the shortest path route for relay network elements. Detailed Implementation
[0049] The present invention will be further illustrated below with reference to the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are for illustrative purposes only and are not intended to limit the scope of the invention.
[0050] The relay network element involved in this embodiment of the invention is a network unit used for relaying data in a quantum secure network. The relay data includes relay quantum keys, relay signaling, etc. Specifically, it also includes the target relay network element receiving relay data sent by other relay network elements, performing checksum and encryption / decryption on the relay data, and finally transmitting it to the destination relay network element via the public network. Each relay network element in the quantum secure network is connected to any other relay network element through a network link, and all relay network elements together form a quantum secure network relay network. In the quantum secure network, the network manager is responsible for managing all relay network elements. When a relay network element starts up, it receives link establishment information issued by the network manager, and the relay network element uses the link establishment information issued by the network manager to establish links (TCP or UDP) with other relay network elements.
[0051] In embodiments of the present invention, the target relay element obtains the shortest path to the destination relay element primarily by requesting link and link weight information of all relay elements in the current network from the network management system. The process of calculating link weights specifically includes relay network initialization weight calculation, delay and packet loss link weight calculation, relay queue link weight calculation, key surplus link weight calculation, and key download link weight calculation, and the calculated weight values are reported to the network management system for unified management.
[0052] First, the relay network initialization weight calculation is performed to obtain the initial link weight values. Then, the four weight calculation processes—delay and packet loss link weight calculation, relay queue link weight calculation, key surplus link weight calculation, and key download link weight calculation—are iteratively checked, and the link weights are adjusted according to preset thresholds. If the weight exceeds the preset threshold, it is increased or set to infinity; if it is below the preset threshold, it is decreased or set to 0. All calculated link weights are gradually accumulated to obtain the final link weight value, where the final link weight value W = initial link weight value W0 + delay and packet loss link weight value W1 + relay queue link weight value W2 + key surplus link weight value W3 + key download link weight value W4.
[0053] Relay network elements report known links, their corresponding statuses, and weight values to the network management system. The network management system then synchronizes the received links, their corresponding statuses, and weight values to all other relay network elements, ensuring that all relay network elements have access to the latest link status across the entire network. The target relay network element constructs a two-dimensional array using all network links and their corresponding weight values W as its first parameter. Then, it inputs its own network element identifier as the second parameter into Dijkstra's algorithm to calculate the link path table from the target relay network element to any other relay network element. Finally, combining this with the known identifier of the destination relay network element, it queries the shortest path route from the target relay network element identifier to the destination relay network element identifier. Using this shortest path route, the target relay network element verifies and encrypts the received relay data corresponding to the destination relay network element identifier before sending it to the destination relay network element according to the shortest path route.
[0054] like Figure 1 As shown, the relay network element relay data method of the present invention includes the following steps:
[0055] Step 1: In the quantum network, each relay element requests the network management system to establish a link with the relay elements connected to it and obtains the link establishment information. Then, it establishes a link with the relay elements connected to it and calculates the weight value of the link in real time. At the same time, it reports the link, the link status, and the link weight value to the network management system, which synchronizes them to each relay element in the quantum network. Each relay element establishes its own link weight value table and calculates its own link path table based on the link weight value table.
[0056] In step 1, the process of calculating the weight value of the link is specifically as follows:
[0057] Step 1-1: As Figure 2 The flowchart shown illustrates the relay network initialization weight calculation process, which calculates the initial link weight W0 by performing relay network initialization weight calculation on the link.
[0058] In step 1-1, the specific process of calculating the initial weights for the relay network is as follows:
[0059] Initialize the relay network, then the relay element m obtains the link establishment information from the network management, and establishes a link Lmn with the relay element n connected to it, and sets the weight value of link Lmn to W0=Wmn=Wnm=1.
[0060] If the link Lmn between relay element m and the relay element n connected to it is disconnected, then the weight value of link Lmn is W0=Wmn=Wnm=∞.
[0061] The relay element m synchronizes the link weight value W0 to the network management system, which then synchronizes the link status and link weight value W0 of link Lmn to all other relay elements.
[0062] The relay element m mentioned above is the target relay element.
[0063] Before the relay network is initialized, all links are not yet established. At this time, the bidirectional link weights between relay element m and relay element n are W0 = Wmn = Wnm = ∞. For example... Figure 2 As shown, when relay element m starts up, it obtains link establishment information from the network management system and establishes links with other relay elements. Assuming a link Lmn is established with relay element n, the weight value W0 = Wmn = Wnm = 1 is initialized for link Lmn. Relay element m reports this weight value W0 to the network management system, which then synchronizes the link status and weight value W0 of link Lmn to all other relay elements. When a disconnection is detected in link Lmn, the weight value W0 of the bidirectional link Lmn becomes W0 = Wmn = Wnm = ∞. Relay element m reports this weight value W0 to the network management system, which then synchronizes the link status and weight value W0 of link Lmn to all other relay elements.
[0064] Steps 1-2: As Figure 3 The flowchart shown illustrates the calculation of link weights for delay and packet loss. The link weights for delay and packet loss are calculated to obtain the link weight values W1 for delay and packet loss.
[0065] In steps 1-2, the specific process for calculating the delay and packet loss link weights is as follows:
[0066] like Figure 3 As shown, relay element m sends a heartbeat packet to the relay element n connected to it via link Lmn. After receiving the heartbeat packet, the relay element n connected to it replies with a heartbeat packet via link Lnm. The sending and replying of heartbeat packets are executed cyclically. This process will continue to be executed during the keep-alive period of links Lmn and Lnm. At the same time, the latency and packet loss rate of link Lmn are continuously calculated, and it is monitored in real time whether the latency reaches the threshold T[i] and whether the packet loss rate reaches the threshold T[j].
[0067] If the latency does not reach the threshold T[i], then the weight value W1 of link Lmn is Wmn; if the latency reaches the threshold T[i] and the packet loss rate does not reach the threshold T[j], then the weight value W1 of link Lmn is Wmn ± ΔW[i]; if the latency reaches the threshold T[i] and the packet loss rate reaches the threshold T[j], then the weight value W1 of link Lmn is Wmn ± ΔW[i] ± ΔW[j]; the relay element m synchronizes the link weight value W1 to the network management system, and the network management system synchronizes the link weight value W1 of link Lmn to all other relay elements.
[0068] It should be noted that the thresholds T[i] and T[j], and the weight change values ΔW[i] and ΔW[j] can be configured according to the performance and service capabilities of the relay network element, and no numerical restrictions are imposed in this invention. For example only, when the latency reaches the threshold T[i], if the threshold T[i] = 200 ms, ΔW[i] = 0.5; if the threshold T[i] = 500 ms, ΔW[i] = 1; if the threshold T[i] = 1000 ms, ΔW[i] = ∞; when the packet loss rate reaches the threshold T[j], if the threshold T[j] = 20%, ΔW[j] = 0.5; if the threshold T[j] = 50%, ΔW[j] = 1; if the threshold T[j] = 90%, ΔW[j] = ∞.
[0069] In one embodiment of the present invention, as shown in Table 1 below, the link weight is calculated based on the network latency. Each link is configured with a threshold array T[i] and a weight array ΔW[i]. When the network latency rises to T[2] = 500 ms, ΔW[2] = 1, and the link weight value W1 after the network latency rises needs to be increased by 1 based on the current value. When the network latency falls to T[2] = 500 ms, the link weight W1 after the network latency falls is decreased by 1 based on the current value.
[0070] Table 1
[0071] i 1 2 3 T[i] (ms) 200 500 1000 ΔW[i] 0.5 1 ∞
[0072] Steps 1-3: As Figure 4 The flowchart shown illustrates the relay queue link weight calculation process, which calculates the relay queue link weight to obtain the relay queue link weight value W2.
[0073] In steps 1-3, the specific process of calculating the relay queue link weight is as follows:
[0074] like Figure 4As shown, relay element m establishes a link Lxm with relay element x and a link Lym with relay element y. Relay element m receives relay data from relay elements x and y, and needs to perform verification and decryption operations on such data. These operations consume a certain amount of time, so the relay data is placed in the relay queue Q for sequential processing. The relay queue Q is stored in the memory area of relay element m. In an embodiment of the present invention, when a relay network element is started, the number of relay data queued in the relay queue Q of relay network element m is initially 0. Relay network element m puts relay data from all relay network elements connected to it into the relay queue Q according to the time of receipt. If the number of relay data queued in the relay queue Q reaches the threshold T[k], then the link weight value W2 of the relay queue of link Lmn is Wmn ± ΔW[k]. If the number of relay data queued in the relay queue Q does not reach the threshold T[k], then the link weight value W2 of the relay queue of link Lmn is Wmn. Relay network element m synchronizes the link weight value W2 to the network management system, and the network management system synchronizes the link weight value W2 of link Lmn to all other relay network elements.
[0075] It should be noted that the threshold T[k] and the weight change value ΔW[k] can be configured according to the performance and service capabilities of the relay network element, and no numerical restrictions are imposed in this invention. For example only, when the number of relay data queued in the relay queue Q of relay network element m reaches the threshold T[k], if the threshold T[k] = 1000, ΔW[k] = 0.5; if the threshold T[k] = 5000, ΔW[k] = 1; if the threshold T[k] = 10000, ΔW[k] = ∞.
[0076] Steps 1-4: As Figure 5 The flowchart shown illustrates the key margin link weight calculation process, which calculates the key margin link weight to obtain the key margin link weight value W3.
[0077] In steps 1-4, the specific process of calculating the key surplus link weight is as follows:
[0078] like Figure 5As shown, each relay element periodically monitors the key balance between itself and other relay elements. Assuming a link exists between relay element m and its connected relay element n, when a link is established between relay element m and its connected relay element n, relay element m periodically monitors the key balance between itself and its connected relay element n. When the key balance reaches a threshold T[q], the link weight value of the key balance of link Lmn is W3 = Wmn ± ΔW[q]. When the key balance does not reach the threshold T[q], the link weight value of the key balance of link Lmn is W3 = Wmn. Relay element m synchronizes the link weight value W3 to the network management system in real time, and the network management system synchronizes the link weight value W3 of link Lmn to all other relay elements. In this embodiment, the time interval for periodic cyclic monitoring is determined according to actual services and is not numerically limited in this invention. For example, the time interval for periodic cyclic monitoring is 1 second. It should be noted that the threshold T[q] and the weight change value ΔW[q] can be configured according to the performance and service capabilities of the relay network element, and no numerical restrictions are imposed in this invention. For example only, when the key balance reaches the threshold T[q], if the threshold T[q] = 50%, ΔW[q] = 0.5; if the threshold T[q] = 20%, ΔW[q] = 1; if the threshold T[q] = 10%, ΔW[q] = ∞.
[0079] Steps 1-5: As Figure 6 The flowchart shown illustrates the key download link weight calculation process. The link weight is calculated to obtain the key download link weight value W4.
[0080] In steps 1-5, the specific process of calculating the key download link weight is as follows:
[0081] Step 1-5-1: Relay element m periodically monitors the remaining key balance between itself and other relay elements. If the remaining key balance between itself and the relay element n it is connected to is greater than or equal to the threshold T[q], then W4=Wmn; if the remaining key balance is less than the threshold T[q], relay element m and the relay element n it is connected to are triggered to synchronously download the key from the key center and proceed to the next step.
[0082] Step 1-5-2: Determine whether the download keys are paired and equal in number between relay network element m and its connected relay network element n.
[0083] If the pairings are identical in number, the key download is successful, and the link weight value W4 = Wmn for the key download of link Lmn.
[0084] Otherwise, if the key download fails, the link weight value W4=Wmn=Wnm=∞ for the key download of link Lmn. The relay element m will synchronize the link weight value W4 to the network management system in real time, and the network management system will then synchronize the link weight value W4 of link Lmn to all other relay elements.
[0085] If the key download fails, you need to continue trying to download it. That is, repeat the process of relay element m and the relay element n connected to it synchronously downloading the key from the key center and the judgment process in step 1-5-2 until the key download is successful.
[0086] Steps 1-6: Sum all the link weight values calculated in steps 1-1 to 1-5 to obtain the final link weight value W = W0 + W1 + W2 + W3 + W4.
[0087] In an embodiment of the present invention, each relay network element constructs a two-dimensional array based on the links synchronized from the network management system and the link weight values W, and establishes a link weight value table based on the two-dimensional array. As shown in Table 2 below, if there is a link between relay network element i and relay network element j, then matrix[i][j] = the link weight of ij; if there is a link between relay network element j and relay network element i, then matrix[j][i] = the link weight of ji; if there is no link, then matrix[i][j] = matrix[j][i] = ∞ infinity; if the link is ii, that is, the link between the relay network element and the local relay network element, then matrix[i][i] = 0.
[0088] Table 2. Link Weight Value Table
[0089]
[0090] In an embodiment of the present invention, the specific process by which each relay network element calculates the link path table based on the link weight value table is as follows: Each relay network element uses the link weight value table (e.g., Table 2 above) as the first parameter and its own identifier as the second parameter, inputting them into the Dijkstra algorithm for calculation, thereby obtaining the link path table between the relay network element and all other relay network elements (see Table 3 below). It should be noted that, due to the special nature of the algorithm, if the calculation process is local to local, the weight value is 0, meaning the data does not require relaying and is directly sent to the destination relay network element.
[0091] For example, assuming the identifier of the target relay element is 1, the target relay element r1 uses Table 2 above as the first parameter and the identifier r1 as the second parameter, inputs them into Dijkstra's algorithm, and calculates the link path table of the target relay element r1:
[0092] Table 3. Link Path Table
[0093]
[0094] The link path is a complete path, and the link weight value is the sum of the weight values between any two adjacent relay network elements in the complete path.
[0095] Step 2: Any relay element in the quantum network acts as the target relay element to receive relay data sent by other relay elements in the quantum network. It decrypts and verifies the relay data using the paired decryption key and then puts it into the relay queue. Then, it parses the decrypted and verified relay data in the relay queue to obtain the identifier of the destination relay element corresponding to the relay data.
[0096] In embodiments of the present invention, the relay queue is a first-in-first-out queue, a producer / consumer model. Producer relay elements add received relay data to the relay queue, and consumer relay elements retrieve relay data from this queue. For example, the relay queue can be configured as follows: the producer relay element creates an independent queue for the consumer relay element based on the link establishment information, and subsequent data from that consumer relay element is automatically stored in its corresponding queue; that is, data from the same relay element is stored in the same queue. Alternatively, the producer relay element does not create a queue based on the link establishment information, meaning all relay data is stored in the same queue. Specific implementations can be configured accordingly. In embodiments of the present invention, the header of the relay data packet is unencrypted. Each relay data packet header contains the identifier of the final destination relay element to which the data packet needs to reach. The destination relay element identifier can be obtained by extracting the values of each byte in the header.
[0097] Step 3: As Figure 7 The flowchart shown illustrates the shortest path routing calculation process for relay network elements. The target relay network element queries the link path table to find the shortest path route to the destination relay network element based on the destination relay network element identifier.
[0098] In an embodiment of the present invention, the target relay element calls the link path table (e.g., Table 3) obtained in step 1 after obtaining the destination relay element identifier in step 2. For example, assume the identifier of the destination relay element is 5. The target relay element traverses the link path table (e.g., Table 3) to find that the minimum link weight from the target relay element r1 to the destination relay element r5 is 5, and the corresponding path is the shortest path route: r1-->r2-->r4-->r5. If the sum of the shortest path weights is ∞, it indicates that the link is not working and relaying cannot be completed.
[0099] Step 4: The target relay element verifies and encrypts the received relay data corresponding to the identifier of the destination relay element, and then sends it to the destination relay element according to the shortest path obtained in Step 3.
[0100] In the embodiments of the present invention, since the network management system synchronizes the link weight values of each relay element with other relay elements in real time, if the subsequent link weight value changes when a data packet is sent to a certain relay element, such as the weight value being ∞ (indicating that the link is not working and relay cannot be completed), or the weight value increasing (indicating that the subsequent link is not the shortest path route), then the weight value of the subsequent link needs to be recalculated when it is sent to the next relay element. After obtaining the link weight value table and link path table of the subsequent links, the shortest path route of the destination relay element is found by traversing the link path table according to the identifier of the destination relay element, and the data packet is transmitted from this relay element to the destination relay element to complete the data relay.
[0101] It should be noted that the above content merely illustrates the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. For those skilled in the art, various improvements and modifications can be made without departing from the principle of the present invention, and all such improvements and modifications fall within the scope of protection of the claims of the present invention.
Claims
1. A method for relaying data in a relay network element, characterized in that, Includes the following steps: Step 1: In the quantum network, each relay element establishes a link with the relay element connected to it based on the link establishment information provided by the network management system, and calculates the weight value of the link in real time. At the same time, it reports the link, link status, and link weight value to the network management system, which then synchronizes them to each relay element in the quantum network. Each relay element establishes a link weight value table and calculates the link path table based on the link weight value table. Step 2: Next, any relay element in the quantum network acts as the target relay element to receive relay data sent by other relay elements in the quantum network. It decrypts and verifies the relay data using the paired decryption key and then puts it into the relay queue. Then, it parses the decrypted and verified relay data in the relay queue to obtain the identifier of the destination relay element corresponding to the relay data. Step 3: The target relay element traverses the link path table based on the destination relay element identifier to find the shortest path route to the destination relay element; Step 4: The target relay element verifies and encrypts the received relay data corresponding to the destination relay element identifier, and then sends it to the destination relay element according to the shortest path obtained in Step 3. In step 1, the process of calculating the weight value of the link specifically involves: Step 1-1: Perform relay network initialization weight calculation on the link to obtain the initial link weight value W0; Step 1-2: Calculate the link weights for delay and packet loss, and obtain the link weight values W1 for delay and packet loss. Steps 1-3: Calculate the link weight of the relay queue to obtain the link weight value W2 of the relay queue; Steps 1-4: Calculate the link weight based on the key reserve to obtain the link weight value W3 based on the key reserve; Steps 1-5: Calculate the link weight for key download to obtain the link weight value W4 for key download; Steps 1-6: Sum all the link weight values calculated in steps 1-1 to 1-5 to obtain the final link weight value W = W0 + W1 + W2 + W3 + W4; In step 1-1, the specific process of calculating the initial weights for the relay network is as follows: Initialize the relay network, then the relay element m obtains the link establishment information from the network management, and establishes a link Lmn with the relay element n connected to it, and sets the weight value of link Lmn to W0=Wmn=Wnm=1. If the link Lmn between relay element m and the relay element n connected to it is disconnected, then the weight value of link Lmn is W0=Wmn=Wnm=∞. The relay element m synchronizes the link weight value W0 to the network management system, which then synchronizes the link status and link weight value W0 of link Lmn to all other relay elements. In steps 1-2, the specific process for calculating the delay and packet loss link weights is as follows: Relay element m sends a heartbeat packet to relay element n connected to it via link Lmn. After receiving the heartbeat packet, relay element n replies with a heartbeat packet via link Lnm. The sending and replying of heartbeat packets are performed in a loop. The latency and packet loss rate of link Lmn are continuously calculated, and the latency and packet loss rate are monitored in real time to see if they reach the threshold T[i] and the packet loss rate reach the threshold T[j]. If the latency does not reach the threshold T[i], then the weight value W1 of link Lmn is Wmn; if the latency reaches the threshold T[i] and the packet loss rate does not reach the threshold T[j], then the weight value W1 of link Lmn is Wmn±ΔW[i]. If the latency reaches the threshold T[i] and the packet loss rate reaches the threshold T[j], then the weight value W1 of link Lmn is Wmn±ΔW[i]±ΔW[j]. The relay element m synchronizes the link weight value W1 to the network management system, which then synchronizes the link weight value W1 of link Lmn to all other relay elements. In steps 1-3, the specific process of calculating the relay queue link weight is as follows: The initial number of data queued in the relay queue Q of relay element m is 0. Relay element m puts relay data from all relay elements connected to it into relay queue Q. If the number of relay data queued in relay queue Q reaches the threshold T[k], then the link weight value W2 of the relay queue of link Lmn is Wmn ± ΔW[k]; if the number of relay data queued in relay queue Q does not reach the threshold T[k], then the link weight value W2 of the relay queue of link Lmn is Wmn. The relay queue Q is stored in the memory area of the relay network element m; the relay network element m synchronizes the link weight value W2 to the network management system, and the network management system synchronizes the link weight value W2 of link Lmn to all other relay network elements; In steps 1-4, the specific process of calculating the key surplus link weight is as follows: When a link is established between a relay element m and a relay element n connected to it, the relay element m periodically monitors the key balance between itself and the relay element n connected to it. When the key balance reaches the threshold T[q], the link weight value of the key balance of link Lmn is W3 = Wmn ± ΔW[q]. When the key balance does not reach the threshold T[q], the link weight value of the key balance of link Lmn is W3 = Wmn. The relay element m synchronizes the link weight value W3 to the network management system in real time, and the network management system synchronizes the link weight value W3 of link Lmn to all other relay elements. Among them, when the key balance reaches the threshold T[q], if the threshold T[q] = 50%, ΔW[q] = 0.5; if the threshold T[q] = 20%, ΔW[q] = 1; if the threshold T[q] = 10%, ΔW[q] = ∞. In steps 1-5, the specific process of calculating the key download link weight is as follows: Step 1-5-1: Relay network element m periodically monitors the key balance between itself and the relay network element n connected to it. If the key balance is greater than or equal to the threshold T[q], W4=Wmn; if the key balance is less than the threshold T[q], relay network element m and the relay network element n connected to it are triggered to synchronously download the key from the key center and proceed to the next step. Step 1-5-2: Determine whether the download keys are paired and equal in number between relay element m and its connected relay element n. If the pairings are identical in quantity, the key download is successful, and the link weight value W4 = Wmn for the key download of link Lmn. Otherwise, if the key download fails, the link weight value W4=Wmn=Wnm=∞ for the key download of link Lmn will be repeatedly triggered. At the same time, the relay element m and the relay element n connected to it will be repeatedly triggered to download the key from the key center and the judgment process in step 1-5-2 until the key download is successful. The relay element m synchronizes the link weight value W4 to the network management system in real time, and the network management system then synchronizes the link weight value W4 of link Lmn to all other relay elements.
2. The method for relaying data in a relay network element according to claim 1, characterized in that, When the delay reaches the threshold T[i], if the threshold T[i] = 200 ms, ΔW[i] = 0.5; if the threshold T[i] = 500 ms, ΔW[i] = 1; if the threshold T[i] = 1000 ms, ΔW[i] = ∞; when the packet loss rate reaches the threshold T[j], if the threshold T[j] = 20%, ΔW[j] = 0.5; if the threshold T[j] = 50%, ΔW[j] = 1; if the threshold T[j] = 90%, ΔW[j] = ∞.
3. The method for relaying data in a relay network element according to claim 1, characterized in that, When the number of relay data queued in the relay queue Q of relay element m reaches the threshold T[k], if the threshold T[k] = 1000, ΔW[k] = 0.5; if the threshold T[k] = 5000, ΔW[k] = 1; if the threshold T[k] = 10000, ΔW[k] = ∞.
4. The method for relaying data in a relay network element according to claim 1, characterized in that, In step 1, the specific process of establishing the link weight value table is as follows: each relay network element constructs a two-dimensional array based on the links synchronized by the network management and the weight values of the links, and establishes the link weight value table based on the two-dimensional array.
5. The method for relaying data in a relay network element according to claim 4, characterized in that, In step 1, the specific process of calculating the link path table based on the link weight value table is as follows: each relay network element uses the link weight value table as the first parameter and its own identifier as the second parameter, and inputs it into the Dijkstra algorithm to calculate the link path table of the relay network element.