On Tue, May 28, 2013 at 11:45:55AM +0200, Philipp Aeschlimann wrote:
> Hey there
> 
> See the code below. I have a proposal/first-draft for OFPMeterMod
> messages but I have a problem with the understanding of the
> OF-switch-spec 1.3.0 and also with the calculation of the "len"
> attribute in RYU for OFPMeterBandHeader:
> 
> - Can you send multiple meter-bands in one OFPMeterMod message?

OF spec says yes.
A.3.4.4
The bands eld is a list of rate bands. It can contain any number of
bands, and each band type can be repeated when it make sense.

> - From where or how is the "len" attribute in OFPMeterBandDrop calculated?

Something like this.
class OFPMeterBandDrop(OFPMeterBandHeader):
    def __init__(rate, busrt_size):
        super(OFPMeterBandDrop, self).__init__(
                                ofproto_v1_3.OFPMBT_DROP
                                ofproto_v1_3.OFP_METER_BAND_DROP_SIZE,
                                rate, burst_size)

And OFPMeterBandHader should have serialize method, not parser method.


> Snippet from ofproto_v1_3_parser.py
> 
> class OFPMeterBandDrop(object):
>     def __init__(self, type_, len_, rate, burst_size):
>         super(OFPMeterBandDrop, self).__init__()
>         self.type = type_
>         self.len = len_
>         self.rate = rate
>         self.burst_size = burst_size
> 
>     def serialize(self, buf, offset):
>         meter_offset = offset
>         self.len = ofproto_v1_3.OFP_METER_BAND_DROP_SIZE
>         msg_pack_into(ofproto_v1_3.OFP_METER_BAND_DROP_PACK_STR, buf,
> meter_offset,
>                       self.type, self.len, self.rate, self.burst_size)

There is no point to use meter_offset. just use offset.

thanks,

> @_set_msg_type(ofproto_v1_3.OFPT_METER_MOD)
> class OFPMeterMod(MsgBase):
>     def __init__(self, datapath, command, flags, meter_id, bands):
>         super(OFPMeterMod, self).__init__(datapath)
>         self.command = command
>         self.flags = flags
>         self.meter_id = meter_id
>         self.bands = bands
> 
>     def _serialize_body(self):
>         msg_pack_into(ofproto_v1_3.OFP_METER_MOD_PACK_STR, self.buf,
>                       ofproto_v1_3.OFP_HEADER_SIZE,
>                       self.command, self.flags, self.meter_id)
> 
>         offset = ofproto_v1_3.OFP_METER_MOD_SIZE
>         for b in self.bands:
>             b.serialize(self.buf, offset)
>             offset += b.len
> 
> Snippet from the testing-app (example goes on the github-ryu-wiki)
> 
>     def send_meter_mod(self, datapath):
>         ofp = datapath.ofproto
>         ofp_parser = datapath.ofproto_parser
> 
>         bands = [ofp_parser.OFPMeterBandDrop(type_=ofp.OFPMBT_DROP,
> len_=0, rate=10, burst_size=12)]
>         req = ofp_parser.OFPMeterMod(datapath=datapath,
>                                    command=ofp.OFPMC_ADD,
>                                    flags=ofp.OFPMF_KBPS,
>                                    meter_id=1,
>                                    bands=bands)
>         datapath.send_msg(req)
> 
> The code works with the ofsoftswitch13 from
> https://github.com/CPqD/ofsoftswitch13. This is the only softswitch I
> know that works with meter-bands. At the moment, there is only the
> drop-meter-band supported in the softswitch, but if this works, the
> DSCP meter-band will also do because it's almost the same struct.
> 
> As always, thanks in advance, g *pae
> 
> --
> ZHAW - Zurich University of Applied Sciences
> Institute of Applied Information Technology InIT
> InIT Cloud Computing Laboratory ICCLab
> 
> Philipp Aeschlimann
> Researcher
> Obere Kirchgasse 2
> CH-8401 Winterthur
> 
> Tel. +41 58 934 6964 (intern 6964)
> mailto:[email protected]
> www.zhaw.ch
> www.cloudcomp.ch
> 
> GPG IDKey: 647E122E
> Fingerprint: 47B7 8D8A 98D1 E91D 4B7C E261 D88C BE9E 647E 122E
> 
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service 
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

-- 
yamahata

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to