Thanks once more Iwase.
You're the man.
Have a nice day (well, in Brasil it is day).
Edison.

2016-05-17 2:33 GMT+00:00 Iwase Yusuke <[email protected]>:

> Hi,
>
> On 2016年05月16日 19:01, Edison Albuquerque wrote:
>
>> Thanks again Iwase.
>> By the way, to write a complete app with Ryu I need to put Ryu to listen
>> to all openflow messages that are possible to come in.
>> Is there a simple way to do this or I have to write apps to listen to
>> every message like one app to PacketIn, one to PortStatus, and so on.
>>
>
> AFAIK, Ryu does not provide such event...
> But you can specify multiple event into @set_ev_cls decorator as a list:
>   https://github.com/osrg/ryu/blob/master/ryu/app/ofctl_rest.py#L701-L718
>
> If this is not suitable for your purpose, how about the following snippet?
> However, I think this snippet is not appropriate way, because the
> following modifies the core of Ryu.
>
> $ git diff
> diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py
> index 3e7c598..473770a 100644
> --- a/ryu/app/simple_switch_13.py
> +++ b/ryu/app/simple_switch_13.py
> @@ -63,6 +63,9 @@ class SimpleSwitch13(app_manager.RyuApp):
>                                      match=match, instructions=inst)
>          datapath.send_msg(mod)
>  +    def _all_ofp_message_hanlder(self, ev):
> +        self.logger.info("ev=%s", ev)
> +
>      @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
>      def _packet_in_handler(self, ev):
>          # If you hit this you might want to increase
> diff --git a/ryu/controller/controller.py b/ryu/controller/controller.py
> index 1ae7287..7b11661 100644
> --- a/ryu/controller/controller.py
> +++ b/ryu/controller/controller.py
> @@ -148,6 +148,9 @@ class Datapath(ofproto_protocol.ProtocolDesc):
>          self._ports = None
>          self.flow_format = ofproto_v1_0.NXFF_OPENFLOW10
>          self.ofp_brick =
> ryu.base.app_manager.lookup_service_brick('ofp_event')
> +        # Get your RyuApp instance
> +        self.your_app = ryu.base.app_manager.lookup_service_brick(
> +            'SimpleSwitch13')  # Your RyuApp name
>          self.set_state(HANDSHAKE_DISPATCHER)
>       def _get_ports(self):
> @@ -218,6 +221,9 @@ class Datapath(ofproto_protocol.ProtocolDesc):
>                      ev = ofp_event.ofp_msg_to_ev(msg)
>                      self.ofp_brick.send_event_to_observers(ev, self.state)
>  +                    # Invoke handler in your RyuApp
> +                    self.your_app._all_ofp_message_hanlder(ev)
> +
>                      dispatchers = lambda x:
> x.callers[ev.__class__].dispatchers
>                      handlers = [handler for handler in
>                                  self.ofp_brick.get_handlers(ev) if
>
>
> Thanks,
> Iwase
>
> Best wishes.
>> Edison.
>>
>> 2016-05-16 5:08 GMT+00:00 Iwase Yusuke <[email protected] <mailto:
>> [email protected]>>:
>>
>>
>>     Hi,
>>
>>     On 2016年05月14日 08:19, Edison Albuquerque wrote:
>>
>>         Hi.
>>         When I create a topology, I can do:
>>
>>         h1 = self.addHost( 'Bob' )
>>
>>         But:
>>
>>         s1 = self.addSwitch( 'Nyc' )
>>
>>         doesn't work.
>>
>>         What I am doing wrong?
>>
>>
>>     I think this is the constraint of Mininet (not Ryu).
>>
>>     In order to derive default datapath ID from the user-specified switch
>> name,
>>     you need include a number in your switch name like 'Nyc1'.
>>
>> https://github.com/mininet/mininet/blob/master/mininet/node.py#L881-L883
>>
>>     If you want to more support for this problem,
>>     how about getting contact to Mininet team?
>>     https://mailman.stanford.edu/mailman/listinfo/mininet-discuss
>>
>>     Thanks,
>>     Iwase
>>
>>
>>
>>
>>         --
>>         /_Todos querem um mundo melhor. Poucos colaboram.
>>         _/
>>
>>         Prof. Edison de Queiroz Albuquerque, BSc, Msc, Dr.
>>         Adjunto da Escola Politécnica de Pernambuco, Universidade de
>> Pernambuco (POLI/UPE)
>>         Professor do Curso de Engenharia de Computação
>>         Líder do Grupo de Pesquisa em Protocolos de  Redes de Computadores
>>         Membro do IEEE (ComSoc), do SBrT, do IECOM e da APEET
>>
>>         Universidade de Pernambuco/Escola Politécnica de Pernambuco
>>         Rua Benfica, 455 (Bl. 'C' 2. andar) - Bairro: Madalena
>>         CEP 50720-001 - Recife, Pernambuco - Brasil
>>         Fone: +55 81 3184-7542 <tel:%2B55%2081%203184-7542> - Fax: +55
>> 81 3184-7581 <tel:%2B55%2081%203184-7581>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>>         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] <mailto:
>> [email protected]>
>>         https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>
>>
>>
>>
>> --
>> /_Todos querem um mundo melhor. Poucos colaboram.
>> _/
>>
>> Prof. Edison de Queiroz Albuquerque, BSc, Msc, Dr.
>> Adjunto da Escola Politécnica de Pernambuco, Universidade de Pernambuco
>> (POLI/UPE)
>> Professor do Curso de Engenharia de Computação
>> Líder do Grupo de Pesquisa em Protocolos de  Redes de Computadores
>> Membro do IEEE (ComSoc), do SBrT, do IECOM e da APEET
>>
>> Universidade de Pernambuco/Escola Politécnica de Pernambuco
>> Rua Benfica, 455 (Bl. 'C' 2. andar) - Bairro: Madalena
>> CEP 50720-001 - Recife, Pernambuco - Brasil
>> Fone: +55 81 3184-7542 - Fax: +55 81 3184-7581
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> 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
>>
>>


-- 

*Todos querem um mundo melhor. Poucos colaboram.*

Prof. Edison de Queiroz Albuquerque, BSc, Msc, Dr.
Adjunto da Escola Politécnica de Pernambuco, Universidade de Pernambuco
(POLI/UPE)
Professor do Curso de Engenharia de Computação
Líder do Grupo de Pesquisa em Protocolos de  Redes de Computadores
Membro do IEEE (ComSoc), do SBrT, do IECOM e da APEET

Universidade de Pernambuco/Escola Politécnica de Pernambuco
Rua Benfica, 455 (Bl. 'C' 2. andar) - Bairro: Madalena
CEP 50720-001 - Recife, Pernambuco - Brasil
Fone: +55 81 3184-7542 - Fax: +55 81 3184-7581
------------------------------------------------------------------------------
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

Reply via email to