In this example static routes are configured in sensors using SDN commands executed in a SDN controller. The WSN network model in this example consists of the following configuration:
- A subnet with 5 wireless sensor, 1 ad-hoc link, 1 wireless sink node, and a unicast sensor application running on one of the wireless sensors.
- One wireless Sensor is configured as the SDN controller.
- A unicast application from Wireless_Sensor_1 to Wireless_Sensor_5.
- Simulation time of 500 seconds.
- Packet trace is enabled.
To simulate the example for WSN using SDN:
Open NetSim and Select Examples > Software Defined Networks > WSN StaticRoute then click on the tile in the middle panel to load the example as shown in below screenshot
The following network diagram illustrates the network setup considered in this example:
The following settings are done in the application layer properties of the devices for configuring SDN:
Device Name Open_Flow SDN_Controller SDN_Controller_DeviceName Wireless_Sensor_1 Enable FALSE SDN_Controller Wireless_Sensor_2 Enable FALSE SDN_Controller SDN_Controller Enable TRUE NA Wireless_Sensor_4 Enable FALSE SDN_Controller Wireless_Sensor_5 Enable FALSE SDN_Controller WSN_Sink_6 Enable FALSE SDN_Controller
Click on the Application icon present in the top ribbon/toolbar.
a. Sensor Application from Wireless_Sensor_1 to Wireless_Sensor_5 with default Generation Rate (Packet Size: 50Bytes, Inter Arrival Time: 1000000µs).
b. Set Transport Protocol to UDP.
- In NetSim GUI Plots and Packet Trace are enabled.
- Simulate the example. To do so:
a. Click on the Run button. The Run Simulation pop-up window appears.
b. Simulation time is set to 500 seconds.
c. In the Run time Interaction tab, the Interactive Simulation option is set to True.
d. Click Accept.
e. Click OK.
Simulation (NetSimCore.exe) starts to run. NetSimCore.exe displays the following message: waiting for first client to connect.
- To use the SDN CLI Console:
a. Right-click SDN_Controller and click NetSim Console. Now, the client (NetSimCLI.exe) starts and attempts to establish a connection with NetSimCore.exe.
- Interpret the results.
a. Click View Animation and see the Packet Animation. The packets reach Wireless_Sensor_5 from Wireless_Sensor_1 > SDN_Controller > Wireless_Sensor_5.
- Configure static routes such that the packets will go through Wireless_Sensor_1 to Wireless_Sensor_5 via SDN_Controller.
To configure the static routes on SDN_Controller for Wireless_Sensor_1
a. Run simulation again.
b. Right-click SDN_Controller and click NetSim Console.
Now, the client (NetSimCLI.exe) starts and tries to establish a connection with NetSimCore.exe. NetSim CLI console opens.
c. Type the following commands on the NetSim CLI console, in the <DeviceName with Device_ID> route add <destination IP address> MASK <subnet mask> <gateway IP address> <metric> if <interface #> format.
Wireless_Sensor_1 route ADD 184.108.40.206 MASK 255.255.0.0 220.127.116.11 METRIC 1 IF 1
SDN_Controller route ADD 18.104.22.168 MASK 255.255.0.0 22.214.171.124 METRIC 1 IF 1
- Interpret the results.
a. Click View Animation and see the Packet Animation. The packets reach Wireless_Sensor_5 from Wireless_Sensor_4 > SDN_Controller to Wireless_Sensor_5.
b. In the simulation results window select the Open Packet trace option in the left area. Once the packet trace opens apply filter in the CONTROL_PACKET_TYPE/APP_NAME column to show only OPENFLOW_COMMAND and OPENFLOW_RESPONSE messages.
You will see that OpenFlow packets flow from Wireless_Sensor_4 to SDN_Controller as part of the static route configuration done via console.