Inline.

On Sep 19, 2014, at 12:35 PM, Anil Kumar K K <aniluvc...@gmail.com> wrote:

> Hi Folks,
> 
> I am trying to install a rule in OpenFlow switch based on the below conditions
> If the destination IP matches "10.0.0.9"
> If the dstination mac matches "some_mac"
> If the protocol is ICMP
> Then send the packet to "10.0.0.3" with mac "0:0:0:0:0:3"
> But looks like switch is sending all the ICMP packets to "10.0.0.3" instead 
> of sending those who are destined to "10.0.0.9".
> 
> Am I missing something here ?
> 
> 
> COde :
>  #msg = oflow.ofp_packet_out()
> 262         msg = oflow.ofp_flow_mod()
> 263         msg.data = new_frame
> 264         msg.in_port = event.ofp.in_port
> 265 
> 266         if  ip_packet.dstip == VIRTUAL_IP:
> 267             msg.match.nwdst = VIRTUAL_IP
> 268             msg.match.dldst = VIRTUAL_MAC

As per the OpenFlow specification and the POX manual (OpenFlow in POX:Match 
Structure), you mean nw_dst and dl_dst.

> 269             msg.match.nw_proto = 1      #ICMP Messages
> 270             msg.match.dl_type = 0x800   #IPv4 Messages
> 271 
> 272             action1 = oflow.ofp_action_nw_addr.set_dst(REAL_IP)
> 273             action2 = oflow.ofp_action_dl_addr.set_dst(REAL_MAC)
> 274             action3 = oflow.ofp_action_output(port = oflow.OFPP_FLOOD)
> 275             msg.actions.append(action1)
> 276             msg.actions.append(action2)
> 277             msg.actions.append(action3)
> 278             self.connection.send(msg)
> 279             print "Successful in dstip VIRTUAL_IP >>>>>>> REAL_IP"
> 
> 
> 
> Rule installed on the switch :
> mininet> dpctl dump-flows
> *** s1 
> ------------------------------------------------------------------------
> NXST_FLOW reply (xid=0x4):
> mininet> 
> mininet> 
> mininet> h1 ping testing_host
> ^CPING testing_host (10.0.0.9) 56(84) bytes of data.
> 
> --- testing_host ping statistics ---
> 3 packets transmitted, 0 received, 100% packet loss, time 2017ms
> 
> mininet> 
> mininet> 
> mininet> dpctl dump-flows
> *** s1 
> ------------------------------------------------------------------------
> NXST_FLOW reply (xid=0x4):
>  cookie=0x0, duration=45.417s, table=0, n_packets=4, n_bytes=392, 
> idle_age=43, icmp 
> actions=mod_nw_dst:10.0.0.3,mod_dl_dst:00:00:00:00:00:03,FLOOD
> mininet> 
> 
> 
> Thanks
> Anil

Reply via email to