Hi,
You want to do the port mirroring only the packets sent by packet_out messages,
right?
I think there are some way to do this.
For example, please refer to the following snippet.
I added a output action in to packet_out message (not into flow_mod messages).
$ git diff
diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py
index 3e7c598..55ff4e7 100644
--- a/ryu/app/simple_switch_13.py
+++ b/ryu/app/simple_switch_13.py
@@ -114,6 +114,10 @@ class SimpleSwitch13(app_manager.RyuApp):
if msg.buffer_id == ofproto.OFP_NO_BUFFER:
data = msg.data
+ # add output action for port mirroring
+ mirror_port = 3
+ actions.append(parser.OFPActionOutput(port=mirror_port))
+
out = parser.OFPPacketOut(datapath=datapath, buffer_id=msg.buffer_id,
in_port=in_port, actions=actions, data=data)
datapath.send_msg(out)
If you want to identify the packets from the controller at the switches,
this might be more complex, I think.
Maybe you need to install the specific flows for
in_port=ofproto.OFPP_CONTROLLER packets
or to use group actions for mirroring.
Thanks,
Iwase
On 2016年05月25日 20:44, Maurizio Marrocco wrote:
> Hi, I try with in_port=ofproto.OFPP_CONTROLLER in PktOut msg but don't work.
> In other words, how can Mirror all control traffic (pkt_out messages), from
> controller to port output 3?
> How can match this?
> I post the source with attachment to this email.
>
>
> ________________________________________
> Da: Iwase Yusuke <[email protected]>
> Inviato: mercoledì 25 maggio 2016 03.37
> A: [email protected]
> Cc: [email protected]
> Oggetto: Re: [Ryu-devel] How I can identify a packet from the Ryu-controller
> to OpenFlow v1.3 switch?
>
> Hi,
>
> On 2016年05月25日 02:39, Maurizio Marrocco wrote:
>> Hi to everyone,
>>
>> I need an help for my thesis,
>>
>> I want to identify a control packet from Python RYU-controller. In other
>> words: How I can to do the following instruction?
>>
>> |If(I receive a OFPT_PACKET_OUT msg fromryu-controller)dosomething
>> (forexample all control traffic from controller must mirroring to an output
>> port)|
>>
>> and How can I match this rule?
>>
>> I saw in OpenFlow v1.3 specification that there is a ofproto.OFPP_CONTROLLER
>> reserved port: How can I use it as an ingress port?
>>
>> >From OFv1.3 spec.: "OFPP_CONTROLLER: Represents the control channel with
>> the OpenFlow controller. Can be used as an ingress port or as an output port.
>>
>> When used as an output port, encapsulate the packet in a packet-in message
>> and send it using the OpenFlow protocol.
>>
>> When used as an ingress port, identify a packet originating from the
>> controller."
>
> How about setting "in_port=ofp.OFPP_CONTROLLER" in OFPPacketOut message?
>
> http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#ryu.ofproto.ofproto_v1_3_parser.OFPPacketOut
>
> Thanks,
> Iwase
>
>>
>> Thanks for the help.
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Mobile security can be enabling, not merely restricting. Employees who
>> bring their own devices (BYOD) to work are irked by the imposition of MDM
>> restrictions. Mobile Device Manager Plus allows you to control only the
>> apps on BYO-devices by containerizing them, leaving personal data untouched!
>> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
>>
>>
>>
>> _______________________________________________
>> Ryu-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>
>
>
>
> ------------------------------------------------------------------------------
> Mobile security can be enabling, not merely restricting. Employees who
> bring their own devices (BYOD) to work are irked by the imposition of MDM
> restrictions. Mobile Device Manager Plus allows you to control only the
> apps on BYO-devices by containerizing them, leaving personal data untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
>
>
>
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel