<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body style="font-family:Arial;font-size:14px">
<div>Hello everyone,</div>
<div> </div>
<div>I´m using mininet and POX and I have two questions:</div>
<div>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 style="margin-left: 40px;"><span style="font-size:11px;">(Using: sudo mn --topo single,3 --mac --switch ovsk --controller remote)</span></div>
<div style="margin-left: 40px;"><span style="font-size:11px;">....</span><br>
<div><span style="font-size:11px;">class Simples (object):</span></div>
<div><span style="font-size:11px;"> def __init__ (self):</span></div>
<div><span style="font-size:11px;"> core.openflow.addListeners(self)</span></div>
<div><span style="font-size:11px;"> </span></div>
<div><span style="font-size:11px;"> def _handle_ConnectionUp (self, event):</span></div>
<div><span style="font-size:11px;"> self._install(event.connection.dpid,1,(2,3))</span></div>
<div><span style="font-size:11px;"> self._install(event.connection.dpid,2,(1,3))</span></div>
<div><span style="font-size:11px;"> self._install(event.connection.dpid,3,(1,2))</span></div>
<div><span style="font-size:11px;"> </span></div>
<div><span style="font-size:11px;"> def _install(self,switch,in_port,out_port):</span></div>
<div><span style="font-size:11px;"> msg = of.ofp_flow_mod()</span></div>
<div><span style="font-size:11px;"> match = of.ofp_match()</span></div>
<div><span style="font-size:11px;"> match.in_port = in_port</span></div>
<div><span style="font-size:11px;"> msg.match = match</span></div>
<div><span style="font-size:11px;"> msg.idle_timeout = 0</span></div>
<div><span style="font-size:11px;"> msg.hard_timeout = 0</span></div>
<div><span style="font-size:11px;"> for i in range(len(out_port)):</span></div>
<div><span style="font-size:11px;"> msg.actions.append(of.ofp_action_output(port = out_port[i]))</span></div>
<div><span style="font-size:11px;"> core.openflow.sendToDPID(switch,msg)</span></div>
<div><span style="font-size:11px;"> </span></div>
<div><span style="font-size:11px;">def launch ():</span></div>
<div><span style="font-size:11px;"> core.registerNew(Simples)</span></div>
<div> </div>
</div>
<div>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="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>it doesn't work:</div>
<div>
<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>
<div>Many thanks in advance,</div>
<div>Yona Lopes</div>
<div> </div>
<div> </div>
</div>
<p><br></p>
<br />--
<br />Esta mensagem foi verificada pelo sistema de antivírus e
<br /> acredita-se estar livre de perigo.
</body>
</html>