Hi,

How about skipping the ofp event processing for the specific dpid
at the top of each event handler?

e.g.) If dpid is registered, do switch_features_handler, otherwise skip.
$ git diff
diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py
index 3e7c598..c8a9291 100644
--- a/ryu/app/simple_switch_13.py
+++ b/ryu/app/simple_switch_13.py
@@ -30,8 +30,12 @@ class SimpleSwitch13(app_manager.RyuApp):
          super(SimpleSwitch13, self).__init__(*args, **kwargs)
          self.mac_to_port = {}
  
+        self.registered_dpids = [1, 2, 3]  # specify the range of dpid
+
      @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
      def switch_features_handler(self, ev):
+        if ev.msg.datapath.id not in self.registered_dpids:
+            return
          datapath = ev.msg.datapath
          ofproto = datapath.ofproto
          parser = datapath.ofproto_parser


On 2016年09月06日 18:47, Francesco Murador wrote:
> Hi i have a question...i need to start stplib when i check a thing how can i 
> start it? Not at the begin of my program with _CONTEXTS...i have to check if 
> some values in a switch are out of range if they aren't i need to start the 
> spanning tree because all i want is to block a dpid but if i don't block a 
> dpid i have a topology with loops so normal simple_switch will not work so i 
> had to run the stplib
> ------------------------------------------------------------------------------
> _______________________________________________
> Ryu-devel mailing list
> Ryu-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>

------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to