My overall aim is to divert the traffic

I want two rules to get installed.
1. if src address is equal to 10.0.0.2 and destination address is
equal to 10.0.0.3,
Then change the destination address to 30.0.0.2 and send it out of port 3.

2. If destination address is equal to 30.0.0.2 then send it out of port 1.

> I have only one action in 2nd rule.

* So i want to install these two rules in the switches.

I am matching fields on IP, So acc to that question I should put MAC
address too?? But isn't missing field means match everything? And if for a
machine/node IP is static, isn't it going to be the same machine/node every
time then why the need of MAC in my case??

Please suggest me how can i put both the rules in the switches?

Thanks and Best Regards.

On Thu, Dec 18, 2014 at 1:21 PM, Murphy McCauley <murphy.mccau...@gmail.com>
wrote:
>
> Please see the second, third, and final entries in the POX FAQ.
>
> I also think the second entry you're trying to install has problems (too
> many actions).
>
> -- Murphy
>
> On Dec 17, 2014, at 9:54 AM, chaitanya tanwar <chaitanya.tan...@gmail.com>
> wrote:
>
> 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.
>
>
>

Reply via email to