[ovs-discuss] Set metadata field

Liran Schour LIRANS at il.ibm.com
Thu Mar 28 09:37:50 UTC 2013


Ben Pfaff <blp at nicira.com> wrote on 25/03/2013 06:49:38 PM:
> On Sun, Mar 24, 2013 at 01:21:59PM +0200, Liran Schour wrote:
> > Ben Pfaff <blp at nicira.com> wrote on 21/03/2013 09:52:24 PM:
> >
> > > On Thu, Mar 21, 2013 at 09:07:08AM +0200, Liran Schour wrote:
> > > >
> > > > I try to pass metadata to the controller through the following
flow:
> > > >    ovs-ofctl add-flow br-int "in_port=5 priority=2
> > actions=set_field:123->
> > > >    metadata,controller(reason=no_match)"
> > > >
> > > > I do see the following flow when I do dump-flows:
> > > >    cookie=0x0, duration=310.921s, table=0, n_packets=0, n_bytes=0,
> > > >    idle_age=310, priority=2,in_port=5 actions=load:0x7b->
> > OXM_OF_METADATA
> > > >    [],controller(reason=no_match)
> > > >
> > > > But when I check in the controller side I see metadata=0.
> > > > I check the metadata value with 2 different methods:
> > > >    1. By snooping the communication between switch to controller
and
> > see
> > > >    metadata=0.
> > > >    2. By using the extract_flow function inside the controller to
> > retrieve
> > > >    the flow
> > > >     corresponding to the packet_in message.
> > > >
> > > > What am I doing wrong here?
> > >
> > > I don't know.
> > >
> > > I set up a test of my own with Open vSwitch from current "master".  I
> > > added a single flow to the switch, with:
> > >     ovs-ofctl add-flow br0 'actions=load:123->OXM_OF_METADATA
> > > [],controller,normal'
> > > Then I set up a simple "controller" to watch for packet-ins:
> > >     ovs-ofctl monitor -P nxm br0 128
> > > When I run packets through the switch, I see the metadata fields set
> > > as I would expect in the packet-ins, e.g.
> > >     NXT_PACKET_IN (xid=0x0): total_len=42 in_port=1 metadata=0x7b
> > > (via action) data_len=42 (unbuffered)
> > >
> >
> > When I try to monitor the messages between switch to controller through
> > ovs-ofctl monitor
> > I do see NXT_PACKET_IN packets with metadata=0x7b but when I try to
monitor
> > the messages through
> > ovs-ofctl snoop I do see OFPT_PACKET_IN packets with metadata=0.
> > How can I know which is the real type of the message that goes on the
wire?
> > ( OFPT_PACKET_IN or NXT_PACKET_IN )
>
> "ovs-ofctl snoop" shows the actual OpenFlow messages sent to the
> controller that is in use, so OFPT_PACKET_IN is the real type going
> "on the wire" in this case.
>
> > When I try to verify it inside the code of ovs-controller it seems that
it
> > gets OFPT_PACKET_IN packet with metadata equals to zero.
> > Is it possible to pass metadata value with OFPT_PACKET_IN packet?
>
> No.  OpenFlow 1.0 defines OFPT_PACKET_IN with a fixed format that does
> not include metadata (because metadata was not invented until OpenFlow
> 1.1).  If you want to get NXT_PACKET_IN instead, then you need to send
> an NXT_SET_PACKET_IN_FORMAT request specifying NXPIF_NXM as the
> desired packet-in format.  Alternatively you could use OpenFlow 1.2,
> which uses OXM (which also includes metadata).

Is it possible to set the protocol version to OpenFlow 1.2 with the
ovs-controller
supplied with Openvswitch?
I tried to set the supported protocols in my bridge to OpenFlow12 but then
I failed to
connect to the ovs-controller:
   # version negotiation failed (we support version 0x01, peer supports
   version 0x03)

If it is not possible it seems that the easiest way to work with the
ovs-controller will be
to send set_packet_in_format with NXM to the switch, is it true?

Thanks,
- Liran





More information about the discuss mailing list