[pox-dev] On 'str' object has no attribute 'buffer_id'

Keqiang He hekeqiang at gmail.com
Fri Jul 26 09:00:43 PDT 2013


I refined the last message so that it is more clear:

Hello --

I want to *install and modify* flow entries* from the controller*. First, I
proactively install new rules into the flow table in this way:

*#flow generate-- simulated flows*
for i in "a set of ip addresses":
    u = udp()
    u.srcport = 1
    u.dstport = 2
    p = ipv4()
    p.set_payload(u)
    p.srcip =IPAddr(i)#i is increased ip address such as 192.168.0.1,
192.168.0.2, 192.168.0.3, ... 192.168.1.255 ...
    p.dstip = IPAddr("192.168.56.100")
   e =ethernet (...)
   e.set_payload(p)
*#get a match from packet and tries to install a new rule...*
   msg = of.ofp_flow_mod()
   msg.match = of.ofp_match.from_packet(packet)
   msg.idle_timeout = 0
   msg.hard_timeout = 0
   msg.actions.append(of.ofp_action_output(port = 1))
   self.connection.send(msg)
Till now, the results is what I expected-- a set of new rules are installed
in the flow table;

Next, I want to *modify* the installed (newly installed rules).  At the
same time, I want to *send out a packet which matches a particular
rules*so that I know that modified rule takes effect.

The code is like this--
*#repeat the "**flow generate-- simulated flows" procedure
...
#*
*#get a match from packet and tries to modify that rule...
*
   msg = of.ofp_flow_mod()
   msg.command = of.OFPFC_MODIFY (make sure that this command is for
modification)
   msg.match = of.ofp_match.from_packet(packet)
   msg.idle_timeout = 0
   msg.hard_timeout = 0
   msg.data = e.pack()
   msg.actions.append(of.ofp_action_output(port = 2)) # the output port is
modified here...
   self.connection.send(msg)
Now, I get the error:
********error message*****************
File "/home/sdn/pox/pox/openflow/
of_01.py", line 687, in send
    data = data.pack()
  File "/home/sdn/pox/pox/openflow/libopenflow_01.py", line 2191, in pack
    self.buffer_id = self.data.buffer_id
*AttributeError: 'str' object has no attribute 'buffer_id'*
*********error message end**********

I tested that If I change msg = of.ofp_flow_mod() to msg =
of.ofp_packet_out(), it is fine. But I do not just want to send packet out.
What I want to do is, first modify a rule and then send out a packet
matching that rule.


Can anyone help on the error? Thanks:)

-------------end of the message---------------------



On Fri, Jul 26, 2013 at 11:55 AM, Keqiang He <hekeqiang at gmail.com> wrote:

> Hello --
>
> I want to *install and modify* flow entries* from the controller*. First,
> I proactively install new rules into the flow table in this way:
>
> *#flow generate-- simulated flows*
> for i in "a set of ip addresses":
>     u = udp()
>     u.srcport = 1
>     u.dstport = 2
>     p = ipv4()
>     p.set_payload(u)
>     p.srcip =IPAddr(i)#i is increased ip address such as 192.168.0.1,
> 192.168.0.2, 192.168.0.3, ... 192.168.1.255 ...
>     p.dstip = IPAddr("192.168.56.100")
>    e =ethernet (...)
>    e.set_payload(p)
> *#get a match from packet and tries to install a new rule...*
>    msg = of.ofp_flow_mod()
>    msg.match = of.ofp_match.from_packet(packet, event.port)
>    msg.idle_timeout = 10
>    msg.hard_timeout = 30
>    msg.actions.append(of.ofp_action_output(port = port))
>    self.connection.send(msg)
> Till now, the results is what I expected-- a set of new rules are
> installed in the flow table;
>
> Next, I want to *modify* the installed (newly installed rules).  At the
> same time, I want to *send out a packet which matches a particular rules*so that I know that modified rule takes effect.
>
> The code is like this--
> *#repeat the "**flow generate-- simulated flows" procedure
> ...
> #*
> *#get a match from packet and tries to modify that rule...
> *
>    msg = of.ofp_flow_mod()
>    msg.command = of.OFPFC_MODIFY (make sure that this command is for
> modification)
>    msg.match = of.ofp_match.from_packet(packet, event.port)
>    msg.idle_timeout = 10
>    msg.hard_timeout = 30
>    msg.data = e.pack()
>    msg.actions.append(of.ofp_action_output(port = port))
>    self.connection.send(msg)
> Now, I get the error:
> ********error message*****************
> File "/home/sdn/pox/pox/openflow/of_01.py", line 687, in send
>     data = data.pack()
>   File "/home/sdn/pox/pox/openflow/libopenflow_01.py", line 2191, in pack
>     self.buffer_id = self.data.buffer_id
> *********error message end**********
>
> I tested that If I change msg = of.ofp_flow_mod() to msg =
> of.ofp_packet_out(), it is fine. But I do not just want to send packet out.
> What I want to do is, first modify a rule and then send out a packet
> matching that rule.
>
>
> Can anyone help on the error? Thanks:)
> AttributeError: 'str' object has no attribute 'buffer_id'
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noxrepo.org/pipermail/pox-dev-noxrepo.org/attachments/20130726/715596a1/attachment-0002.htm>


More information about the pox-dev mailing list