|
The switch begins in an idle location in Figure 5; after a packet arrives at the switch, the packet matches the rule to the flow table's flow entry to determine the forwarding rule for the packet. The match location checks the flow table and finds a matching field. If the flow table has matching rules(match_flow_table(switch_id) == true), the packet goes to the action location. If the flow table does not have matching rules(match_flow_table(switch_id) ==false), it drops the packet. Switch modeling used the switch_init(), check_recv_packet(),update_recv_packet_flag(), match_flow_table(), action_instruction(), drop_packet(), and forward_packet() functions. The function switch_init() initializes a switch and adds a flow table. The function check_recv_packet() checks whether a packet is received. update_recv_packet_flag() updates the packet reception status. match_flow_table() checks whether the received packet has a matching entry in the flow table. If the packet is not in the flow table, it is dropped, and if it is in the flow table, it is executed as the specified action. The function action_instruction() checks whether the action matched in the flow table is OUT_PORT or DROP. The function forward_packet() forwards the packet and randomly processes the path.
|