It's something like this echo package
pkt = packet.Packet()
pkt.add_protocol(ethernet.ethernet(ethertype=pkt_ethernet.ethertype,
dst=pkt_ethernet.src,
src=self.hw_addr))
pkt.add_protocol(ipv4.ipv4(dst=pkt_ipv4.src,
src=self.ip_addr,
proto=pkt_ipv4.proto))
pkt.add_protocol(icmp.icmp(type_=icmp.ICMP_ECHO_REPLY,
code=icmp.ICMP_ECHO_REPLY_CODE,
csum=0,
data=pkt_icmp.data))
pkt.serialize()
data = pkt.data
actions = [parser.OFPActionOutput(port=port)] # port of host
out = parser.OFPPacketOut(datapath=datapath,
buffer_id=ofproto.OFP_NO_BUFFER,
in_port=ofproto.OFPP_CONTROLLER,
actions=actions,
data=data)
datapath.send_msg(out)
You need to set your own configuration if you want that this example works,
but this is the idea.
2016-08-04 23:31 GMT-06:00 Iwase Yusuke <[email protected]>:
> Hi,
>
> Please refer to the 'data' attribute of OFPPacketOut.
> You can set a binary type value, which you want send, into this attribute.
> e.g.)
> req = ofp_parser.OFPPacketOut(datapath, buffer_id,in_port, actions,
> data=<BINARY_TYPE_VALUE>)
>
> FYI: For building a binary type packet data, Ryu provides the packet
> libraries.
> 'bin_packet' in the following example is a binary type value to send.
>
> http://osrg.github.io/ryu-book/en/html/packet_lib.html#generation-of-packets-serialization
>
> Thanks,
> Iwase
>
>
> On 2016年08月05日 14:19, Alan Wang wrote:
> > HI,
> >
> > Thanks for your reply!!
> >
> >
> > def send_packet_out(self, datapath, buffer_id, in_port):
> >
> > ofp = datapath.ofproto
> > ofp_parser = datapath.ofproto_parser
> >
> > actions = [ofp_parser.OFPActionOutput(ofp.OFPP_FLOOD, 0)]
> > req = ofp_parser.OFPPacketOut(datapath, buffer_id,in_port, actions)
> > datapath.send_msg(req)
> >
> >
> > In these codes of the example, i can't find data the controller send.
> >
> > I think it can't send data what i want to send.
> >
> > Thanks,
> >
> > Alan
> >
> >
> > 2016-08-05 12:04 GMT+08:00 Iwase Yusuke <[email protected]
> <mailto:[email protected]>>:
> >
> > Hi,
> >
> > You can use Packet-Out messages for such purpose, I guess.
> >
> http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPPacketOut
> <
> http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPPacketOut
> >
> >
> > Thanks,
> > Iwase
> >
> >
> >
> > On 2016年08月05日 12:45, Alan Wang wrote:
> >
> > Hi All,
> >
> > I want to send some data controller collected from Controller to
> Host.
> >
> > What should i do ?
> >
> > Thanks,
> >
> > Alan.
> >
> >
> >
> >
>
> ------------------------------------------------------------------------------
> >
> >
> >
> > _______________________________________________
> > Ryu-devel mailing list
> > [email protected] <mailto:
> [email protected]>
> > https://lists.sourceforge.net/lists/listinfo/ryu-devel <
> https://lists.sourceforge.net/lists/listinfo/ryu-devel>
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> >
> >
> >
> > _______________________________________________
> > Ryu-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/ryu-devel
> >
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
--
"La utopía sirve para caminar" Fernando Birri
------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel