I expect the problem is that you're doing packet.IP_TYPE, but packet is a 
string, and not the part of the packet library with the IP_TYPE "constant".  As 
mentioned in the manual, POX convention is to import the packet library as:
import pox.lib.packet as pkt

.. after which you can do pkt.IP_TYPE and it should work.

Of course, if packet is a string, the next line -- packet.next.srcip -- won't 
work either.  You need packet to be some sort of a packet subclass.  You 
haven't shown the relevant code, so I don't know what you should be doing 
instead.

Also, offhand, it looks like you may be mixing usage of "msg" and "msgd".

As a sidenote: just giving the exception is generally of limited use.  As the 
POX FAQ states in the section about getting help, it's much more useful to post 
the entire traceback.

-- Murphy

On Feb 23, 2015, at 12:00 PM, AMER <amer7...@hotmail.com> wrote:

> Thank you
> I have solved this problem but I am facing another :)
> 
> with this flow match i am receiving the down error
> 
>     match = of.ofp_match()
>     msg.match.eth_type = packet.IP_TYPE
>     msg.match.nw_src = packet.next.srcip
>     msgd.idle_timeout = idle_timeout
>     msgd.hard_timeout = hard_timeout
>     msgd.priority = priority
>     msgd.actions.append(of.ofp_action_nw_addr.set_dst(packet.next.dstip))
>     msgd.actions.append(of.ofp_action_output(port = lport))
>     msgd.buffer_id = buf
>     core.openflow.sendToDPID(dstsw, msgd)
> 
> AttributeError: 'str' object has no attribute 'IP_TYPE'
> 
> Thank you
> 
> Eng Amer Alghadhban
> COE
> SANS-GCFW
> CEH, SCNP, CCNA
> 
> 
> From: amer7...@hotmail.com
> To: murphy.mccau...@gmail.com; pox-dev@lists.noxrepo.org
> Date: Mon, 23 Feb 2015 17:53:57 +0000
> Subject: Re: [pox-dev] Install a flow in for loop
> 
> Hello,
> I have removed the index  [i], but still nothing installed !!?
> 
> Best regards,
> 
> Eng Amer Alghadhban
> COE
> SANS-GCFW
> CEH, SCNP, CCNA
> 
> 
> From: amer7...@hotmail.com
> To: murphy.mccau...@gmail.com; pox-dev@lists.noxrepo.org
> Date: Mon, 23 Feb 2015 17:08:50 +0000
> Subject: [pox-dev] Install a flow in for loop
> 
> hello,
> 
> i want to install a flow table like the following:
> But it is not installing  
>      for i in range(0,3):
>         msg[i] = of.ofp_flow_mod()
>         msg[i].idle_timeout = 100
>         msg[i].hard_timeout = 120
>         msg[i].match.eth_type = packet.IP_TYPE
>         msg[i].match.eth_src = packet.src
>         msg[i].match.eth_dst = packet.dst
>         msg[i].match.ip_dst = dst[i]  # proactive port based ip
>         msg[i].actions.append(of.ofp_action_output(port = i+1))
>         msgs = str(msg).strip('[]')
>         self.connection.send(msgs)
> 
> Best regards,
> 
> Eng Amer Alghadhban
> COE
> SANS-GCFW
> CEH, SCNP, CCNA

Reply via email to