# An Efficient Routing Protocol for Quantum Key Distribution Networks
## 2 The Proposed QOLSR Protocol
### The Proposed QOLSR Protocol
#### 2.3.3 An Example of QOLSR Protocol  
This section provides a basic example to explain QOLSR protocol's link-state awareness mechanism and path optimization. In this section, an SECOQC network is chosen as the network topology, as illustrated in Figure 4. The length of the optical fiber link is indicated by the numbers on each edge (in km). It is assumed that each edge generates the quantum secure key through the VWDDS protocol. The optical parameters of the QKD devices are the same as in [31]. The GLLP formula can be used to calculate the key generation rate on each link, as shown in Figure 4. The key pool parameter MIN is set to 2 Mbit, WARN to 10 Mbit, and MAX to 50 Mbit. It is assumed that node 2 and node 4 communicate by path 2-4 at the beginning. Link 2-4 has a key generation rate of 5.6 Mbps and a key consumption rate of 6 Mbps. Figure 5 shows the entire workflow of link-state awareness and path optimization of QOLSR. First, since the key consumption rate of link 2-4 is higher than the key generation rate, the keys in key pool 2-4 will be consumed indefinitely. When the number of keys in key pool 2-4 decreases to the warning threshold of 10 Mb, the link-state awareness mechanism of QOLSR will be triggered. At the same time, HELLO packets will not be sent between nodes 2 and 4. However, the data packets will be sent as usual. When node 2 does not receive HELLO packets from node 4 during the HELLO interval, link 2-4 is considered disconnected. As a result, it will begin routing discovery in order to find a new communication path. Packet loss during path switching is reduced and quantum secure key consumption is improved because data packets are still transferred properly while searching for a new path.  
There are four possible communication paths between nodes 2 and 4, as shown in Figure 4: 2-3-4, 2-3-5-4, 2-5-4, and 2-5-3-4. Thus, the optimal path will be selected based on key recovery capability. First, we calculate the key recovery capability of path 2-3-4. Path 2-3-4 consists of two links: 2-3 and 3-4. Therefore, the key recovery capabilities of links 2-3 and 3-4 are calculated first, and then the key recovery capability of path 2-3-4 is calculated as the minimum value between them. The key generation rate on link 2-3 is 4 Mbps, the key consumption rate is 1 Mbps, and the remaining key  
Figure 4: An example of QOLSR: KGR, quantum secure key generation rate; KSR, quantum secure key consumption rate. The numbers 1–6 represent the nodes in QKD networks.  
Figure 5: Workflow of QOLSR in this example.  
40 Mb, as shown in Figure 4. Therefore, its key recovery capability is \(\frac{4\text{ Mbps}-1\text{ Mbps}}{50\text{ Mb}-40\text{ Mb}}=0.3\). Similarly, the key recovery capability of link 3-4 is \(\frac{8.5\text{ Mbps}-10\text{ Mbps}}{50\text{ Mb}-30\text{ Mb}}=-0.075\). Therefore, the key recovery capability of path 2-3-4 is \(-0.075\). Similarly, the key recovery capabilities of paths 2-3-5-4, 2-5-4, and 2-5-3-4 can be calculated as shown in Figure 5. As a result, it can be seen that path 2-5-4 has the best key recovery capability; hence it is chosen as the new communication path. Since the key recovery capability of path 2-5-4 is higher, it can continue to function properly for a longer period of time. Subsequently, the frequency of path switching is lowered, and quantum secure key utilization improves.