# A Novel SDWSN-Based Testbed for IoT Smart Applications
## 3 System Model  
IoT-based WSN system architecture can be looked at based on the sensor node layer, the gateway layer, and the cloud layer. Each tier/layer of the system can offer solutions to the overall challenges of a given application while also making the system more robust and scalable. For instance, cloud interaction with the physical WSN can be utilized to explore future operational improvements with various software scenarios using virtualization, historical data, and learning methods. Considering a vehicular network (VN)-related application as an example, Figure 1 shows the cloud-based architecture for a vehicular network, where the physical network of vehicles updates the cloud with data for real-time monitoring and reorchestration purposes. The acquired data from the physical VN is stored in the cloud database offered by the data storage unit, where access to historical real vehicle data is available. These data can be monitored and analyzed based on the knowledge repository to identify any changes in the data pattern and thus the possibility of dynamic change within the network. Therefore, the virtual platform and software resources are employed to respond to an event that necessitates network reorchestration. The virtual model implemented using the Contiki Cooja simulator tool offers the corresponding orchestration and reorchestration via the softwarization of the nodes involved in the network. The figure also reflects the possibility of a node departure and the cloud's response to that event via the flow of control data to the physical network. From the WSN's point of view, the nodes in our approach can generally be configured with one or more functions. This functional configuration is basically a software component/module. This module is used to configure a specific physical sensor node by enabling the associated hardware libraries. The activities of these functions are presented in Figure 2.  
From the communication dialogue that is based on the role/function of the node's point of view, the exchanged data between the nodes can result in the formulation of a star or tree structure depending on the use case. In one of our previous works [7], we presented the communication messages for a self-healing vehicular network. In this paper, we present a general communication dialogue to serve the virtual model as well as the physical  
Figure 1: The interaction between the physical network and the cloud. Figure 2: The main activities for WSN functions. network implementation. The roles and communication messages of the participating functional nodes are displayed in a sequence diagram, as illustrated in Figure 3. These are provided in detail as the following:  
* To avoid the broadcasting storm in the network, the nodes with routers (coordinator and/or gateway functions) within the LOS (line of sight) can be communicated with to formulate the star or layer(s) of tree structure in some use cases. These nodes are a beacon for message (1), \(\mathbf{M_{Hello\_msg}}\), which is a data message that contains the node ID, node type/function, RSSI, etc. Based on these parameters and the number of received \"Hello_msg\" prompts, the network levels/hops can be allocated. * Upon allocation of roles to the nodes, the gateway node disseminates message (2), \(\mathbf{M_{G\_R}}\), to the router/coordinator node(s) within the LOS. This is an announcement message that indicates the allocation of the gateway node based on the number of received messages. * The other routers within the LOS disseminate message (3), \(\mathbf{M_{R\_G}}\) (acknowledgment), to the gateway node. * Then, the gateway node disseminates a network formation to the other nodes that are connected it. The network structure could be a star or tree depending on the type of function of the nodes within the transmission range.