Thank you Murphy for the information, I solved my error. Now I am trying to create my own action but I get:
ERROR:openflow.of_01:[00-23-20-12-b2-91 1] OpenFlow Error: [00-23-20-12-b2-91 1] Error: header: [00-23-20-12-b2-91 1] Error: version: 1 [00-23-20-12-b2-91 1] Error: type: 1 (OFPT_ERROR) [00-23-20-12-b2-91 1] Error: length: 108 [00-23-20-12-b2-91 1] Error: xid: 7825 [00-23-20-12-b2-91 1] Error: type: OFPET_BAD_ACTION (2) [00-23-20-12-b2-91 1] Error: code: OFPBAC_BAD_TYPE (0) [00-23-20-12-b2-91 1] Error: datalen: 96 I created in libopenflow_01.py my: @openflow_action('OFPAT_SET_COMPTADOR', 12) class ofp_action_comptador (ofp_action_base): ... Its code is a copy of class ofp_action_dl_addr (ofp_action_base) And I try to run in my app: msg.actions.append(of.ofp_action_comptador.set_dst(EthAddr("01:02:03:04:05:06"))) I think it is because I missed some part of code in another file or in the same libopenflow_01.py, or because I put my own type_val and action_type that are defined somewhere where I cannot find... Do you know where is the mistake? Thank you in advance, AdriĆ 2013/7/11 adria sole <adrias...@gmail.com> > Thank you very much for your answer, I have solved my problem, now I will > try adding my own action and after that trying to create my own openflow > message. > > Yesterday I looked for the solution through the Wiki and I saw the section > "Set > Ethernet source or destination address" but I didn't see > action = ofp_action_dl_addr.set_dst(EthAddr("01:02:03:04:05:06")) :S > > Ty! > > > 2013/7/10 Murphy McCauley <murphy.mccau...@gmail.com> > >> 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 >> >> >