# Dynamic-RPL: Enhancing RPL-Based IoT Networks with Effective Support of Dynamic Topology Management
## 5 Design
### Dynamic DODAG Establishment  
Once it establishes its local-DODAG, the first-running sink node in an RPL network also initiates a global-DODAG in a separate RPL instance. It is also possible to have a particular sink node in the network administratively configured to initiate it. As a result, two different RPL instances need to be maintained for the RPL network. One is the multi-DODAG local-instance containing the local-DODAGs individually initiated using their respective sink nodes (local sink nodes). The other one is a global-instance of a single-DODAG interconnecting the local sink nodes in the entire network. In addition, non-sink RPL nodes at the first level of the local-DODAGs can also join the global-DODAG and actas global-nodes. Figure 2 shows an example of an RPL network of three local-DODAGs (LD1-LD3). The dashed arrows demonstrate how the global-DODAG is established among the relevant global-nodes (S1-S3 (local-sinks) and N1-N7 (local-non-sink)).  
The global-sink (global-DODAG-initiating node) broadcasts global-DIO messages that contain a specific Instance ID and DODAG ID in addition to a special flag indicating a global-DODAG advertisement. The messages also advertise a special global-OF (more details in Section 5.2) designed to enable effective management of the global-DODAG. Upon the reception of these messages, a newly joining sink node to the RPL network attaches to the advertised global-DODAG after having its local-DODAG established. All the level-1 non-sink nodes locally attaching to the sink node also join the global-DODAG. To avoid adding much to the protocol complexity, the same functionality of the standard single-DODAG RPL is maintained for the global-instance. That is, each global-node uses the OF advertised in the DIO messages to join a single global-parent and form a standard DODAG topology. Since it is designed towards optimizing the multi-DODAG RPL network efficiency, the advertised global-OF enables each sink node to join the best global-parent available and ensure optimal interconnectivity and dynamicity. More details of the design of the adopted OF are provided in the following subsection. In the case of a new sink node not receiving the global-DIO message, it sends a DIS message soliciting the global-DIO transmission as per the standard RPL specification. The message includes a flag indicating a request to broadcast the global-DIO messages.  
As a result, a tree-like DODAG topology is formed among the different global-nodes. The node that initiated this global-DODAG becomes its sink node (global-sink) whereas the other attaching global-nodes become normal RPL nodes to the global-DODAG. Each local-sink then separately maintains its local-DODAG and the global-DODAG connectivity. It runs the normal RPL sink functionality via one interface while acting as a global-DODAG RPL node at another interface, except for the global-sink, which acts as the sink node for each DODAG individually. For level-1 nodes, non-sink RPL functionality is maintained at both the local-DODAG and global-DODAG. This means that both local-sinks and level-1 non-sink nodes become non-sink RPL nodes running the basic standard RPL operations in the global-DODAG.  
In the example presented in Figure 2, it can be seen that a standard RPL DODAG is established among the different global-nodes. S1 represents the sink of the global-DODAG whereas S2 acts as a non-sink global-node and attaches to S1 as a standard RPL child node. Being a level-1 node, N5 joins the global-DODAG and attaches to S2, which is its local sink node. However, S3 has no direct wireless connectivity with S2. Therefore, it has no choice in joining the global-DODAG but to attach to N5, which then represents an external non-sink global-parent.  
Figure 2: An example of a simple Dynamic-RPL network.