There are two problems with your code.

First, in POX, Ethernet addresses should be instances of EthAddr (and IP 
addresses should be instances of IPAddr).  That is, don't use the raw string 
"00:00:00:00:00:00" -- use EthAddr("00:00:00:00:00:00").

Second, if you look up ofp_action_dl_addr in the spec, you'll see that it also 
has a "type" field which tells whether it's supposed to be rewriting the source 
or destination address.  You haven't specified this.  The recommended way of 
creating a rewrite action is not to create an ofp_action_dl_addr directly, but 
to use one of the two factory functions -- ofp_action_dl_addr.set_dst() and 
ofp_action_dl_addr.set_src().

There's an example of this in the POX wiki in the section "Set Ethernet source 
or destination address".

-- Murphy

On Jul 10, 2013, at 10:07 AM, adria sole wrote:

> Hi all, 
> 
> I want to add two actions to a packet when a new flow appears, the default 
> one is output (to an indicated port but I want for example adding a second 
> one like: 
> 
> 
> msg.actions.append(of.ofp_action_dl_addr(dl_addr = "00:00:00:00:00:00"))
> 
> 
> But I am getting an error like: 
> 
> ERROR:core:Exception while handling Connection!PacketIn...
> Traceback (most recent call last):
>   File "/home/adria/Descargas/pox/pox/lib/revent/revent.py", line 234, in 
> raiseEventNoErrors
>     return self.raiseEvent(event, *args, **kw)
>   File "/home/adria/Descargas/pox/pox/lib/revent/revent.py", line 281, in 
> raiseEvent
>     rv = event._invoke(handler, *args, **kw)
>   File "/home/adria/Descargas/pox/pox/lib/revent/revent.py", line 159, in 
> _invoke
>     return handler(self, *args, **kw)
>   File "/home/adria/Descargas/pox/ext/my_component.py", line 207, in 
> _handle_PacketIn
>     self.connection.send(msg)
>   File "/home/adria/Descargas/pox/pox/openflow/of_01.py", line 690, in send
>     data = data.pack()
>   File "/home/adria/Descargas/pox/pox/openflow/libopenflow_01.py", line 2275, 
> in pack
>     packed += i.pack()
>   File "/home/adria/Descargas/pox/pox/openflow/libopenflow_01.py", line 1746, 
> in pack
>     packed += struct.pack("!HH", self.type, len(self))
> error: cannot convert argument to integer
> 
> What I am doing wrong? I have seen that there is a self.dl_addr in class 
> ofp_action_dl_addr (ofp_action_base): in libopenflow_01.py
> 
> But I don't understand how is the code executing, how to they pass the 
> parameters? 
> 
> Ty in advance

Reply via email to