diff --git a/dragonflow/controller/df_base_app.py b/dragonflow/controller/df_base_app.py index 8d4b4612a..3de442a91 100644 --- a/dragonflow/controller/df_base_app.py +++ b/dragonflow/controller/df_base_app.py @@ -98,17 +98,16 @@ class DFlowApp(df_db_notifier.DBNotifyInterface): datapath.send_msg(message) - def _send_packet(self, datapath, port, pkt): + def send_packet(self, port, pkt): + datapath = self.get_datapath() ofproto = datapath.ofproto parser = datapath.ofproto_parser - pkt.serialize() - data = pkt.data actions = [parser.OFPActionOutput(port=port)] out = parser.OFPPacketOut(datapath=datapath, buffer_id=ofproto.OFP_NO_BUFFER, in_port=ofproto.OFPP_CONTROLLER, actions=actions, - data=data) + data=pkt) datapath.send_msg(out) def send_arp_request(self, src_mac, src_ip, dst_ip, port): @@ -121,6 +120,5 @@ class DFlowApp(df_db_notifier.DBNotifyInterface): src_mac=src_mac, src_ip=src_ip, dst_ip=dst_ip)) - arp_request_pkt.serialize() - self._send_packet(self.get_datapath(), port, arp_request_pkt) + self.send_packet(port, arp_request_pkt) diff --git a/dragonflow/controller/dhcp_app.py b/dragonflow/controller/dhcp_app.py index 3618b52b1..20db7b248 100644 --- a/dragonflow/controller/dhcp_app.py +++ b/dragonflow/controller/dhcp_app.py @@ -137,7 +137,7 @@ class DHCPApp(df_base_app.DFlowApp): LOG.error(_LE("DHCP message type %d not handled"), dhcp_message_type) if send_packet: - self._send_packet(self.get_datapath(), ofport, send_packet) + self.send_packet(ofport, send_packet) def _create_dhcp_packet(self, packet, dhcp_packet, pkt_type, lport): pkt_ipv4 = packet.get_protocol(ipv4.ipv4) diff --git a/dragonflow/controller/l3_app.py b/dragonflow/controller/l3_app.py index 256ac7941..f8f335f50 100644 --- a/dragonflow/controller/l3_app.py +++ b/dragonflow/controller/l3_app.py @@ -147,9 +147,7 @@ class L3App(df_base_app.DFlowApp): echo.data = bytearray(echo.data) icmp_pkt.add_protocol(icmp.icmp(icmp.ICMP_ECHO_REPLY, data=echo)) - self._send_packet(self.get_datapath(), - msg.match.get('in_port'), - icmp_pkt) + self.send_packet(msg.match.get('in_port'), icmp_pkt) icmp_responder.ICMPResponder( self, dst_ip, dst_mac, table_id=const.L3_LOOKUP_TABLE).add(