ne, similarly this app raises or gets an event. To raise event, apt base.app_manager function is called. A particular function controller.handler.set_ey_clsi is used if the app wants to register to listen about particular events. This particular function is referred as decorator. A decorator deals with decorated function only. Primary parameter shows the most awaited event, starting the function call in return. The latter one also indicates the state but somewhat it is like a log to the switch. Consider a simple scenario where the controller and switch are under heated discussion or doing some interaction and the Downloaded 4/15/2022 9:44:49AM Nova Southeastern University IP Address: 137.52.76.29 The Heart and Brain of SDN app wishes to ignore certain packet messages. So it calls the MAIN_DISPATCHER function as the latter parameter that specifies to be called after the interaction between the app and the switch is completed. What the example below is focusing on is app wants to know about message events, at each instance the controller receives a message, and a handler method is fired up. The below app is capable enough to forward a message to any port number regardless of the protocol instate. Consider the below code: set_env_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER) def packet_in_handler(self, ev) : msg = ev.msg dp = msg.datapath ofp = dp.ofproto ofp_parser = dp.ofproto_parser actions = (ofp_parser.OFPActionOutput (ofp.OFPP_FLOOD) ] out = ofp_parser.OFPPacketOut datapath=dp, buffer_id=msg.buffer_id, in_port=msg.in_port, actions=actions) dp. send_msg (out) Engage yourself on to packet_in_handler method. . The set_env_cls application programming interface has the job to call in packet_in_handler which internally is called when a message/packet is received. The two parameters msg.datapath refers to the switch while the ev.msg refers to the packet_in data structure. Therefore the dp.ofproto presents the OpenFlow protocol negotiated between controller and switches. The incoming packet is parsed with ofproto_p