[pox-dev] add rules proactively - send flow to two or more ports
yona at gteccom.uff.br
yona at gteccom.uff.br
Wed May 15 08:13:38 PDT 2013
Hello everyone,
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.
(Using: sudo mn --topo single,3 --mac --switch ovsk --controller remote)
....
class Simples (object):
def __init__ (self):
core.openflow.addListeners(self)
def _handle_ConnectionUp (self, event):
self._install(event.connection.dpid,1,(2,3))
self._install(event.connection.dpid,2,(1,3))
self._install(event.connection.dpid,3,(1,2))
def _install(self,switch,in_port,out_port):
msg = of.ofp_flow_mod()
match = of.ofp_match()
match.in_port = in_port
msg.match = match
msg.idle_timeout = 0
msg.hard_timeout = 0
for i in range(len(out_port)):
msg.actions.append(of.ofp_action_output(port = out_port[i]))
core.openflow.sendToDPID(switch,msg)
def launch ():
core.registerNew(Simples)
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?
Many thanks in advance,
Yona Lopes
--
Esta mensagem foi verificada pelo sistema de antivírus e
acredita-se estar livre de perigo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noxrepo.org/pipermail/pox-dev-noxrepo.org/attachments/20130515/e53c3119/attachment.htm>
More information about the pox-dev
mailing list