# Dynamic-RPL: Enhancing RPL-Based IoT Networks with Effective Support of Dynamic Topology Management
## 5 Design
### Example Dynamic-RPL Scenarios  
Figure 6 shows an example scenario of a multi-DODAG RPL network that consists of eight local-DODAGs (LD1-LD8). S1 is the first-running local sink node in the network and initially establishes its local-DODAG (LD1) in the local-instance. Then, it initiates the global-DODAG in the global-instance by broadcasting global-DIO messages with the global-flag set to one. S1 also collects and includes the load and stability measures of LD1 into the LSIO option of the message. Being a level-1 non-sink node, N1 and N2 attach to S1 upon the reception and processing of the global-DIO message. They join the global-DODAG and then act as potential-sinks for the dynamic multi-DODAG algorithm. After that, S2 runs and then initiates LD2 before processing any global advertisement. Once that is completed, S2 receives and acts upon the global-DIO messages of S1. It then decides to join the global-DODAG by instantly attaching to S1 as its global-parent since no other options are available. It then keeps broadcasting the DIO messages of the global-DODAGs. Then, the same procedure is repeated for S3 and S4 after receiving the global-DIO messages from S1 and S2, respectively, which become their respective global-parents. N3-N8 also join the global-DODAG via their respective local-sinks and operate as potential-sinks for the dynamic multi-DODAG algorithm. The situation is a bit different in the case of S5 as it receives the global-DIO messages of both S2 and S3. Since they are local-sinks performing locally well, S5 applies the advertised LSOF to select the best global-parent among them. The parent selection process ends up with S2 being preferred and selected. This decision is made since S2 has better load and stability measures as indicated with the collected LSOF information. That is, it would be better for S5 to merge into S2 than S3 in the case of being decided later using the dynamic multi-DODAG algorithm. S5 attaches to S2 and then carries on forwarding the global-DIO messages. N9-N10 also join the global-DODAG via S5 and operate as potential-sinks for the dynamic multi-DODAG algorithm. In the case of S6, the only nearby global-node to which it can globally attach is a potential-sink locally joining a different local-DODAG. This is N8, which maintains both local and global attachments via S4. S6 joins the global-DODAG and attaches to N8. It then continues receiving and sending global-DIO messages. This enables N11-N12 to join the global-DODAG and establish global attachments with S6. For S7, no global-parent is initially available once it completes the establishment of its local-DODAG. This situation continues until its local-child (N13) has succeeded in joining the global-DODAG via S2. N13 then becomes a potential-sink globally attached to an external local-sink. After that, S7 globally attaches to N13 as its global-parent while separately maintaining local attachment. The algorithm ensures that this is risk-free while keeping them maintained over the two separate RPL instances. Note that N13 also receives but discards the global advertisements of S4 as a higher LSOF ranking is indicated. N14-N15 then receive the global-DIO messages of S7 and decide to attach to it and join the global-DODAG. In addition, N16 receives the global-DIO messages from N15 and N8 but then decides to attach to N15 after running the parent selection algorithm. It concludes that N15 performs better than N8 based on their advertised load and stability information. Then, S8 runs the parent selection algorithm, which concludes that S6 has a lower ranking and better LSOF measures than N16. Therefore, S8 attaches to S6 as its global-parent and starts forwarding the global-DODAG advertisements. Finally, N17 receives the global-DIDO messages of S8 and then decides to attach to it and join the global-DODAG. Then, a complete convergence of the initial global-DODAG topology is realized.