Merge "Elevate the _send_packet method"
This commit is contained in:
commit
3018c4db7d
|
@ -98,17 +98,16 @@ class DFlowApp(df_db_notifier.DBNotifyInterface):
|
||||||
|
|
||||||
datapath.send_msg(message)
|
datapath.send_msg(message)
|
||||||
|
|
||||||
def _send_packet(self, datapath, port, pkt):
|
def send_packet(self, port, pkt):
|
||||||
|
datapath = self.get_datapath()
|
||||||
ofproto = datapath.ofproto
|
ofproto = datapath.ofproto
|
||||||
parser = datapath.ofproto_parser
|
parser = datapath.ofproto_parser
|
||||||
pkt.serialize()
|
|
||||||
data = pkt.data
|
|
||||||
actions = [parser.OFPActionOutput(port=port)]
|
actions = [parser.OFPActionOutput(port=port)]
|
||||||
out = parser.OFPPacketOut(datapath=datapath,
|
out = parser.OFPPacketOut(datapath=datapath,
|
||||||
buffer_id=ofproto.OFP_NO_BUFFER,
|
buffer_id=ofproto.OFP_NO_BUFFER,
|
||||||
in_port=ofproto.OFPP_CONTROLLER,
|
in_port=ofproto.OFPP_CONTROLLER,
|
||||||
actions=actions,
|
actions=actions,
|
||||||
data=data)
|
data=pkt)
|
||||||
datapath.send_msg(out)
|
datapath.send_msg(out)
|
||||||
|
|
||||||
def send_arp_request(self, src_mac, src_ip, dst_ip, port):
|
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_mac=src_mac,
|
||||||
src_ip=src_ip,
|
src_ip=src_ip,
|
||||||
dst_ip=dst_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)
|
||||||
|
|
|
@ -137,7 +137,7 @@ class DHCPApp(df_base_app.DFlowApp):
|
||||||
LOG.error(_LE("DHCP message type %d not handled"),
|
LOG.error(_LE("DHCP message type %d not handled"),
|
||||||
dhcp_message_type)
|
dhcp_message_type)
|
||||||
if send_packet:
|
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):
|
def _create_dhcp_packet(self, packet, dhcp_packet, pkt_type, lport):
|
||||||
pkt_ipv4 = packet.get_protocol(ipv4.ipv4)
|
pkt_ipv4 = packet.get_protocol(ipv4.ipv4)
|
||||||
|
|
|
@ -147,9 +147,7 @@ class L3App(df_base_app.DFlowApp):
|
||||||
echo.data = bytearray(echo.data)
|
echo.data = bytearray(echo.data)
|
||||||
icmp_pkt.add_protocol(icmp.icmp(icmp.ICMP_ECHO_REPLY, data=echo))
|
icmp_pkt.add_protocol(icmp.icmp(icmp.ICMP_ECHO_REPLY, data=echo))
|
||||||
|
|
||||||
self._send_packet(self.get_datapath(),
|
self.send_packet(msg.match.get('in_port'), icmp_pkt)
|
||||||
msg.match.get('in_port'),
|
|
||||||
icmp_pkt)
|
|
||||||
icmp_responder.ICMPResponder(
|
icmp_responder.ICMPResponder(
|
||||||
self, dst_ip, dst_mac,
|
self, dst_ip, dst_mac,
|
||||||
table_id=const.L3_LOOKUP_TABLE).add(
|
table_id=const.L3_LOOKUP_TABLE).add(
|
||||||
|
|
Loading…
Reference in New Issue