Merge "Elevate the _send_packet method"

This commit is contained in:
Jenkins 2017-01-23 03:15:33 +00:00 committed by Gerrit Code Review
commit 3018c4db7d
3 changed files with 6 additions and 10 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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(