<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On May 15, 2013, at 8:13 AM, <a href="mailto:yona@gteccom.uff.br">yona@gteccom.uff.br</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">


<title></title>

<div style="font-family: Arial; ">
<div style="font-size: 14px; ">I´m using mininet and POX and I have two questions:</div>
<div style="font-size: 14px; ">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.</div></div></blockquote><div><br></div><div>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?</div><div><br></div><div>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...</div><div><br></div><br><blockquote type="cite"><div style="font-family: Arial; "><div style="font-size: 14px; margin-left: 40px; ">
</div>
<div style="font-size: 14px; ">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 :</div>
<div style="font-size: 14px; margin-left: 40px; "><span style="font-size: 11px;">...<br>
self._install(event.connection.dpid,2,(1,3))    </span><br>
<span style="font-size: 11px;">self._install(event.connection.dpid,1,2)</span>)<br>
...<br>
 </div>
<div style="font-size: 14px; ">it doesn't work:</div>
<div style="font-size: 14px; ">
<div><br>
<div><span style="font-size:11px;">  File "/home/mininet/pox/pox/lib/revent/revent.py", line 234, in raiseEventNoErrors</span></div>
<div><span style="font-size:11px;">    return self.raiseEvent(event, *args, **kw)</span></div>
<div><span style="font-size:11px;">  File "/home/mininet/pox/pox/lib/revent/revent.py", line 281, in raiseEvent</span></div>
<div><span style="font-size:11px;">    rv = event._invoke(handler, *args, **kw)</span></div>
<div><span style="font-size:11px;">  File "/home/mininet/pox/pox/lib/revent/revent.py", line 159, in _invoke</span></div>
<div><span style="font-size:11px;">    return handler(self, *args, **kw)</span></div>
<div><span style="font-size:11px;">  File "/home/mininet/pox/ext/swbasico2.py", line 36, in _handle_ConnectionUp</span></div>
<div><span style="font-size:11px;">    self._install(event.connection.dpid,3,1)</span></div>
<div><span style="font-size:11px;">  File "/home/mininet/pox/ext/swbasico2.py", line 46, in _install</span></div>
<div><span style="font-size:11px;">    for i in range(len(out_port)):</span></div>
<div><span style="font-size:11px;">TypeError: object of type 'int' has no len()</span></div>
<div> </div>
</div>
<div>Please, could you help me with that?</div></div></div></blockquote><br></div><div>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:</div><div>self._install(event.connection.dpid,1,(2,)))</div><div>or</div><div><div>self._install(event.connection.dpid,1,[2]))</div><div><br></div><div><br></div><div>-- Murphy</div></div></body></html>