# SDN Architecture for 6 LoWPAN Wireless Sensor Networks
## 3 SD6 WSN Architecture  
SD6 WSN is a typical SDN architecture, with a control layer composed of a set of controllers and a forwarding layer composed of a set of switching devices (in SD6 WSN, we name switching devices as nodes). SD6 WSN controllers include topology discovery and flow control functions, and the communication between controllers and nodes occurs through the southbound API. Networking applications connect to the controller to implement networking algorithms. Nodes are typical WSN devices extended with the following communication functions: border routing, data plane forwarding and control plane routing. The communication functions and sensing applications are coordinated by the SD6 WSN agent, which interacts with the controller coordinator through the control plane protocol (SD6 WSNP). Figure 1 depicts the SD6 WSN architecture. The IETF has established the working group WPAN to standardize a solution for IoT, which includes IEEE 802.15.4 at the MAC layer, 6 LoWPAN and RPL at the network layer, UDP at the transport layer and CoAP at the application layer. SD6 WSNP uses CoAP messages as the basis of communication, allowing the controller to perform the following operations: to manage entries in flow tables; to obtain local information from nodes including neighborhood, wireless link quality, geo-location and power transmission level; to modify node behavior, by setting power transmission level and transmission channel. Through SD6 WSNP messages, the controller sends instructions to the agent (which has an internal CoAP server), which interprets the messages and performs actions, such as installing rules in the flow table. The agent also interacts with lower-level processes in the operating system (such as the TCP/IP stack) to drive packet forwarding according to the flow table. Some nodes can include the border router function, which is performed in 6 LoWPAN-RPL by a special node called 6 LBR (6 LoWPAN Border Router). This node is responsible for topology management and for the conversion of the IPv6 to 6 LoWPAN. Figure 2 presents the SD6 WSN communication architecture. The security issue is essential for applications running in SDN. For example, in OpenFlow, the switch and controller communicate through a transport layer security (TLS) connection, which is initiated by the switch on startup to the controller. In SD6 WSN, communication at layer 4 uses the UDP protocol; thus, the datagram transport layer security (DTLS) is more appropriate to securitize communication. DTLS is a communication protocol that provides security for datagram-based applications, designed to prevent eavesdropping, tampering or message forgery. The SD6 WSN architecture extends the 6 LoWPAN wireless sensor network, which can alone provide message delivery. The last uses 6 LoWPAN at layer 3 and UDP at layer 4, and the routing protocol is RPL. SD6 WSN uses this delivery stack as the end-to-end transport protocol for supporting  
Figure 1: Software-defined 6 LoWPAN wireless sensor network (SD6 WSN) architecture. Figure 2: Communication between SD6 WSN components. control plane communication, that is to transport the messages of SD6 WSNP. This is the way that flow-based SDN architectures transport control plane packets. For example, OpenFlow control messages can be encapsulated in TCP packets transiting a TCP-IP network, routed by some of the standard protocols (e.g., OSPF). In flow-based SDN, the controller is in charge of routing decisions. It sends the necessary information to switches so that they can forward packets in the data plane accordingly. In other words, the controller drives packet forwarding by storing rules in flow tables present in switches. Packets that do not match any installed flow table entry are forwarded to the controller, which computes a path for the new flow and install an entry instructing how to forward the packets of the new flow in every switch along the computed path. If the controller decides to not route a packet, it installs a new entry instructing to drop it in the origin node.