Hi all,
I am using the following code to insert flowtable entires in switch. I want
to fill two table entries but the following code is only putting the last
one, may be overwriting the previously written.
How to resolve this?
from pox.core import core
> import pox.openflow.libopenflow_01 as of
> from pox.lib.revent import *
> from pox.lib.util import dpidToStr
> from pox.lib.addresses import EthAddr
> from collections import namedtuple
> from pox.lib.addresses import IPAddr
> import os
> log = core.getLogger()
> class Diversion(EventMixin):
> def __init__ (self) :
> self.listenTo(core.openflow)
> log.debug("Enabling Diversion Module")
> def _handle_ConnectionUp (self, event):
> msg = of.ofp_flow_mod()
> msg1 = of.ofp_flow_mod()
> msg.match = of.ofp_match(nw_src = '10.0.0.2',nw_dst = '10.0.0.3')
>
> msg.actions.append(of.ofp_action_nw_addr.set_dst(IPAddr('30.0.0.2')))
> msg.actions.append(of.ofp_action_output(port = 3))
> msg.priority = 100
> event.connection.send(msg)
> msg.match = of.ofp_match(nw_dst = '30.0.0.2')
> msg.actions.append(of.ofp_action_output(port = 1))
> msg.priority = 100
> event.connection.send(msg)
> log.debug(" rules installed on %s", dpidToStr(event.dpid))
> def launch():
> core.registerNew(Diversion)
Thanks in advance.
Best Regards.