Reputation: 43
I am trying to send a ping message to a host via a Ryu controller but I am not getting the response on mininet . Here is the code I have written
This is method under SimpleSwitch13:
def send_packet_to_host(self, eth_dst, out_port):
# Get the datapath
datapath = self.datapaths.get(1)
if datapath is None:
print(f"No datapath found with id = 1")
return
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
# Create an Ethernet frame
pkt = packet.Packet()
pkt.add_protocol(ethernet.ethernet(ethertype=ether.ETH_TYPE_IP,
dst=eth_dst))
# Create an output action to send the packet
actions = [parser.OFPActionOutput(out_port)]
# Create a flow mod message to install a flow entry in the switch
out = parser.OFPPacketOut(datapath=datapath,
buffer_id=ofproto.OFP_NO_BUFFER,
in_port=ofproto.OFPP_CONTROLLER,
actions=actions,
data=pkt)
# Send the packet out of the specified port
datapath.send_msg(out)
Trying to send data packet .
should ping the host and display on mininet or ryu controller.
Upvotes: 0
Views: 23