/Lucas and Murphy,

   First of all thank you very much for the reply./

   Citando Murphy McCauley <murphy.mccau...@gmail.com>:

 
On May 15, 2013, at 8:13 AM, y...@gteccom.uff.br wrote:

I´m using mininet and POX and I have two questions:
II) How do I add a flow_mod without being involved in an event? I want to install proactively rules in the switches, but I only have achieved this when listening events. I didn't find any such thing on Internet. When I make simple applications like the one below, it works, but I need to install rules proactively.


 
As Lucas Brasilino said, you could do this from a timer, but... what's wrong with it being involved with an event?  Don't you just need to pick the right event?
     
A common scenario is to install rules when a switch connects.  In some sense, these are still "reactive".  It's just that they're not reacting to PacketIn events -- they're reacting to ConnectionUp events.  See misc.dnsspy for an example.  It makes sense to install rules in response to this event, right?  You're not going to install rules BEFORE the switch connects...
 
/My scenario is a little different, is known in advance and I would like to reconfigure the entire network each time a new switch connects.Thus, each event ConnectionUp, I would connect to the new switch, but wouldn't have access to the other switches that need to be reconfigured, right? Or not?/
II)How do I add a rule which sends a flow to two or more ports? Using dpctl just put the ports and it works well (e.g. in_port=2,actions=output:1,output:3), and in a application, how would I do that? I tried as above, which works weel when I have two ports, but when I need to install rules that sends flows to one and more ports together :
...
       self._install(event.connection.dpid,2,(1,3))    
self._install(event.connection.dpid,1,2))
       ...
        
it doesn't work:

  File "/home/mininet/pox/pox/lib/revent/revent.py", line 234, in raiseEventNoErrors
    return self.raiseEvent(event, *args, **kw)
  File "/home/mininet/pox/pox/lib/revent/revent.py", line 281, in raiseEvent
    rv = event._invoke(handler, *args, **kw)
  File "/home/mininet/pox/pox/lib/revent/revent.py", line 159, in _invoke
    return handler(self, *args, **kw)
  File "/home/mininet/pox/ext/swbasico2.py", line 36, in _handle_ConnectionUp
    self._install(event.connection.dpid,3,1)
  File "/home/mininet/pox/ext/swbasico2.py", line 46, in _install
    for i in range(len(out_port)):
TypeError: object of type 'int' has no len()
 

Please, could you help me with that?





In the second example, you're passing out_port = 2.  When line 46 does len(out_port), this is len(2), which doesn't make any sense.  You could fix this function so that it does the right thing depending on whether it's passed an integer or a sequence, but you can also just pass it a sequence.  Lucas almost had it right, except that (2) is not a tuple -- it's just a subexpression.  Try this:
self._install(event.connection.dpid,1,(2,)))
or
self._install(event.connection.dpid,1,[2]))

/Thank you very much, I had used self._install(event.connection.dpid,1,(2,)) and worked well./


 
-- Murphy



   --
   Esta mensagem foi verificada pelo sistema de antivírus e
   acredita-se estar livre de perigo.


--
Esta mensagem foi verificada pelo sistema de antivírus e
acredita-se estar livre de perigo.

Reply via email to