Just a couple quick observations to help you get started here:

If this flow is static, you shouldn't need to wait for a packet_in to install 
it.  You should be able to install it proactively when the switch connects 
(aka when the datapath joins).

The OFPAT_SET_NW_SRC and OFPAT_SET_NW_DST actions *change the addresses in the 
packet*.  But you're already setting the flow to only match these same 
addresses.  So there's no point changing them.

Your switch seems to think something is "ILLEGAL" and is sending an "ERROR" 
before it even gets the flow_mod from install_datapath_flow().  You might want 
to know what this is.  Additionally, it might help to actually look at the 
flow_mod that gets sent to see if it's sensible.  For both of these, the 
easiest thing to do is probably install the OpenFlow WireShark plugin and 
watch the traffic on the wire.

Hope something in there helps. :)

-- Murphy

On Thursday, June 16, 2011 08:34:22 AM Giorgio Mazza wrote:
> Hi,
> I'm new in NOX and python and, to start, I am trying to write a simple
> component that inserts a static entry in the switch flow-table.
> To handle the packet-in event, I wrote this code, in order to send out
> of port 25 all the packets arriving from port 26 (these are the two port
> connected with my hosts).
> 
>          def packet_in_callback(self,dp_id, inport, ofp_reason,
> total_frame_len, buffer_id, captured_data):
>                  if inport == 26:
>                          outport = 25
>                          dp_id = 1
>                          attrs = { core.IN_PORT : 26,
>                                        core.DL_TYPE :
> ethernet.ethernet.IP_TYPE,
>                                        core.NW_PROTO :
> ipv4.ipv4.UDP_PROTOCOL,
>                                        core.NW_SRC : '192.168.1.3',
>                                        core.NW_DST : '192.168.1.2' }
>                          idle_timeout = openflow.OFP_FLOW_PERMANENT
>                          hard_timeout = openflow.OFP_FLOW_PERMANENT
>                          actions = [[openflow.OFPAT_SET_NW_SRC,
> attrs[core.NW_SRC]],[openflow.OFPAT_SET_NW_DST, attrs[core.NW_DST]],
>                                            [openflow.OFPAT_OUTPUT, [0,
> outport]]]
>                          self.install_datapath_flow(dp_id,
>                                                                     attrs,
> 
> idle_timeout,
> 
> hard_timeout,
>                                                                    
> actions)
> 
>                          return CONTINUE
>                  return CONTINUE
> 
> 
> To test my configuration I generate some UDP traffic from host
> 192.168.1.3 (connected to switch's port 26) to host 192.168.1.2
> (connected to port 25), but I didn't receive anything.
> All my packets, instead of going to the second host, were sent to the
> controller, as if it was no entry in the table.
> So, I checked the OF table and I saw that there was an entry with
> <in_port> = 26 and no <out_port> field.
> Looking at the controller-session, from the switch side, I saw these
> messages:
> 
> 
> 02:47:12.833936 OFS( 1) SENT    192.168.0.31.6633 : HELLO
> 02:47:12.844890 OFS( 1) RECV    192.168.0.31.6633 : HELLO
> 02:47:12.856572 OFS( 1) RECV    192.168.0.31.6633 : FEATURES_REQUEST
> 02:47:12.860060 OFS( 1) SENT    192.168.0.31.6633 : FEATURES_REPLY
> 02:47:12.863689 OFS( 1) RECV    192.168.0.31.6633 : SET_CONFIG
> 02:47:12.868494 OFS( 1) RECV    192.168.0.31.6633 : ILLEGAL
> 02:47:12.868531 OFS( 1) SENT    192.168.0.31.6633 : ERROR
> 02:47:12.871919 OFS( 1) RECV    192.168.0.31.6633 : FLOW_MOD
> 02:47:13.611462 OFS( 1) SENT    192.168.0.31.6633 : PACKET_IN
> 02:47:13.613926 OFS( 1) RECV    192.168.0.31.6633 : FLOW_MOD
> 
> 
> Could someone please explain to me where I am wrong in the code, so that
> I get these illegal and error messages and I am not able to make the
> switch has the desired behaviour?
> Sorry for bothering with dummy questions.
> Thanks a lot.
> Regards,
> Giorgio
_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev

Reply via email to