# Cloud Based Smart City Services for Industrial Internet of Things in Software-Defined Networking
## 5 System Analysis and Performance Evaluation  
Authors are going to create a switch application using POX Controller as switches are intelligent devices therefore, they maintain a dictionary of MAC addresses and ports. Firstly, the logic of our application will be explained  
Our switch topology consists of 4 hosts, 1 switch and 1 POX controller as shown in Figure 5. When our switch application is executed the \"switch application-efficient\" on top of the POX controller, 2 tables will be maintained. One table will be maintained at the controller and another table (flow table) will be maintained at the switch. The table maintained at the controller will be \"MAC to port table\". The table maintained at the switch will contain flow entries. Initially, both tables will be empty.  
Initially, the \"MAC to port\" at the controller will be empty. Now host h1 wants to ping to host h4. What will happen in the MAC to port table?  
First, h1 will send ARP requests. Since the flow table at switch \"s1\" does not contain any flow entry therefore, the packet is transferred to the controller. The controller looks at SRC MAC address and the port on which packet came to the switch and makes 1 entry in the \"MAC to port\" table maintained at the controller. Since in our case, the packet's SRC MAC address was \"00:00:00:00:00:01\" and came to the switch through port 1. Therefore, the controller made the entry in the controller table as shown in Table 2. The controller will look for the DST MAC address in the \"MAC to port\" table. If entry is found, the packet will be sent out from the corresponding port, otherwise, it will be flooded. As can be seen, the DST MAC address \"00:00:00:00:00:04\" is not in the table, so the packet is getting flooded and no entry is made at the switch flow table. Now, h4 will send an ARP reply. Since the flow table at switch \"s1\" does not contain any flow entry, therefore, the packet is transferred to the controller. The controller looks at SRC MAC address and the port on  
Figure 5: POX Controller Using Switch Application.  
which packet came to the switch and makes 1 entry in the \"MAC to port\" table maintained at the controller.  
Therefore, the packet's SRC MAC address was \"00:00:00:00:00:04\" and came to the switch through port 4. So the controller made the entry in the \"MAC to port\" table as shown in Table 3. Now the controller will look at the DST MAC address which is \"00:00:00:00:00:01\" in our case. The controller will look for the DST MAC address in the \"MAC to port\" table. If entry is found, the packet will be sent out from the corresponding port, otherwise, it will be flooded. The entry added tells the switch if further packets with DST MAC address \"00:00:00:00:01\" enters the switch, do not send these packets to the controller. Handle these packets at the switch itself and sent the packet out from port 1. The next packet will be ICMP request from host h1 (00:00:00:00:01) to host h4 (00:00:00:00:04). The switch has got no entry regarding how to handle traffic going to DST MAC \"00:00:00:00:04\", so the packet will be sent to the controller. The controller will consult its table. Since now the controller has information about DST MAC so it will instruct the switch to send the packet out from port 4. After some time the \"MAC to port\" table at controller and flow table at the switch.