On Wed, May 1, 2013 at 4:47 AM, Isaku Yamahata <[email protected]>wrote:
> On Tue, Apr 30, 2013 at 05:31:39PM -0400, Nitin Sharma wrote:
> > I am trying to parse an ARP src and dst ip from arp broadcast, and I
> could
> > achieve it on OFv1.0 using the wiki article (pkt.protocols). However on
> v1.2 ,
> > how would i achieve the same?
>
> Using match field of packet-in isn't portable regarding to OF switch
> implementations because packet header fields may not be included.
> Actually Open vSwitch only includes metadata(in_port, tun_id, registers),
> not packet header fields.
>
> From the spec, Please notice "Optionally":
> Optionally, the OXM TLVs may also include packet header fields that
> were previously extracted from the packet, including any
> modifications of those in the course of the processing.
>
> So the portable way is for controller to parse packets itself, don't rely
> on match fields.
> It would be convenient to use match field to extract header fields, I
> think.
> I guess some vendors were against including header fields. So it resulted
> in "Optionally".
>
Got it. Thanks!
The reason I resorted to match fields is because I got the following error
on OF1.2 with msg.in_port
in_port = msg.in_port
AttributeError: 'OFPPacketIn' object has no attribute 'in_port'
Looking at the OFPPacketIn attributes for OF1.2 implementation, it was
different than OF1.0.
Do you recommend to use parsing using the pkt library for everything
(including headers - for compatibility with any vendor switches
implementation), or except (in_port) which can still follow the match
fields for headers. I am just trying to follow the best practice intended.
> thanks,
>
> > Following this - I could get the in_port using the below -
> >
> > if (msg.version == 3):
> > for f in msg.match.fields:
> > if f.header == ofproto_v1_2.OXM_OF_IN_PORT:
> > in_port = f.value
> > if f.header == ofproto_v1_2.OXM_OF_ETH_SRC:
> > unsrc_mac = f.value
> > if f.header == ofproto_v1_2.OXM_OF_ETH_DST:
> > undst_mac = f.value
> > elif (msg.version == 1):
> > in_port = msg.in_port
> >
> > what should i do for the following to work? any specifics im missing.
> >
> > if ((_eth_type == 2054) & (dst_mac == 'ff:ff:ff:ff:ff:ff')):
> > self.logger.info("parse arp broadcast")
> > if (msg.version == 3):
> > for g in msg.match.fields:
> > if g.header == ofproto_v1_2.OXM_OF_ARP_SPA:
> > dst_ip = g.value
> > print dst_ip
> > if g.header == ofproto_v1_2.OXM_OF_ARP_TPA:
> > src_ip = g.value
> > print src_ip
> > elif (msg.version == 1):
> > pkt = packet.Packet(array.array('B', ev.msg.data))
> > for p in pkt.protocols:
> > if p.protocol_name == 'arp':
> > dst_ip = str(self.numToDottedQuad(p.dst_ip))
> > src_ip = str(self.numToDottedQuad(p.src_ip))
> >
> > Thanks for your help.
> > Nitin
>
> >
> ------------------------------------------------------------------------------
> > Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
> > Get 100% visibility into your production application - at no cost.
> > Code-level diagnostics for performance bottlenecks with <2% overhead
> > Download for free and get started troubleshooting in minutes.
> > http://p.sf.net/sfu/appdyn_d2d_ap1
> > _______________________________________________
> > Ryu-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
>
> --
> yamahata
>
------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel