p4-dev@lists.p4.org

list for questions/discussion of p4 programs and tools

View all threads

Per port bandwidth utilization information

BS
Bibek Shrestha
Mon, Dec 21, 2020 10:45 PM

Hi,

I need to know per-port bandwidth utilization for my project. Couldn't find
any information related to this. Is there any standard way to accomplish
this using P4 and BMv2 switch?

Thanks
B.

Hi, I need to know per-port bandwidth utilization for my project. Couldn't find any information related to this. Is there any standard way to accomplish this using P4 and BMv2 switch? Thanks B.
DG
David Gengenbach
Mon, Dec 21, 2020 11:18 PM

This is only partially helpful, I guess. Just wanted to give some hints!

Port statistics are not handled in the P4 specification, if I am not
mistaken, because it is for operation/during runtime (as is
inserting/reading/... tables entries which is handled by P4Runtime, for
example).

Getting per-port statistics is possible with gNMI (which is bundled with
Stratum, for example), see:

docker run -it --entrypoint bash bocon/gnmi-cli:latest -c "cat
/usr/local/bin/gnmi-cli"

Running this will show you a Python client for gNMI - you can convert
the Protobuf using
https://github.com/openconfig/gnmi/blob/master/compile_protos.sh

If you just want a CLI, you can simply use:

docker run --network host -it bocon/gnmi-cli:latest  --grpc-addr
GNMI_ADDRESS:PORT get /

However, the standard bmv2 target does not have gNMI as an interface, if
I am not mistaken. There is a stratum_bmv2 one available, see
https://github.com/stratum/tutorial/tree/master/basic

On 12/21/20 11:45 PM, Bibek Shrestha wrote:

Hi,

I need to know per-port bandwidth utilization for my project. Couldn't
find any information related to this. Is there any standard way to
accomplish this using P4 and BMv2 switch?

Thanks
B.


P4-dev mailing list
P4-dev@lists.p4.org
http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org

This is only partially helpful, I guess. Just wanted to give some hints! Port statistics are not handled in the P4 specification, if I am not mistaken, because it is for operation/during runtime (as is inserting/reading/... tables entries which is handled by P4Runtime, for example). Getting per-port statistics is possible with gNMI (which is bundled with Stratum, for example), see: docker run -it --entrypoint bash bocon/gnmi-cli:latest -c "cat /usr/local/bin/gnmi-cli" Running this will show you a Python client for gNMI - you can convert the Protobuf using https://github.com/openconfig/gnmi/blob/master/compile_protos.sh If you just want a CLI, you can simply use: docker run --network host -it bocon/gnmi-cli:latest  --grpc-addr GNMI_ADDRESS:PORT get / However, the standard bmv2 target does not have gNMI as an interface, if I am not mistaken. There is a stratum_bmv2 one available, see https://github.com/stratum/tutorial/tree/master/basic On 12/21/20 11:45 PM, Bibek Shrestha wrote: > Hi, > > I need to know per-port bandwidth utilization for my project. Couldn't > find any information related to this. Is there any standard way to > accomplish this using P4 and BMv2 switch? > > Thanks > B. > > _______________________________________________ > P4-dev mailing list > P4-dev@lists.p4.org > http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
BS
Bibek Shrestha
Tue, Dec 22, 2020 12:11 AM

Hi David,

Thanks for the information. My use case requires a probe packet to collect
information from the switch data plane itself. That means, there is no
standard way to achieve that in P4 BMV2, right?

Thanks,
B.

On Mon, Dec 21, 2020 at 3:18 PM David Gengenbach davidgengenbach@gmx.de
wrote:

This is only partially helpful, I guess. Just wanted to give some hints!

Port statistics are not handled in the P4 specification, if I am not
mistaken, because it is for operation/during runtime (as is
inserting/reading/... tables entries which is handled by P4Runtime, for
example).

Getting per-port statistics is possible with gNMI (which is bundled with
Stratum, for example), see:

docker run -it --entrypoint bash bocon/gnmi-cli:latest -c "cat
/usr/local/bin/gnmi-cli"

Running this will show you a Python client for gNMI - you can convert the
Protobuf using
https://github.com/openconfig/gnmi/blob/master/compile_protos.sh

If you just want a CLI, you can simply use:

docker run --network host -it bocon/gnmi-cli:latest  --grpc-addr
GNMI_ADDRESS:PORT get /

However, the standard bmv2 target does not have gNMI as an interface, if I
am not mistaken. There is a stratum_bmv2 one available, see
https://github.com/stratum/tutorial/tree/master/basic
On 12/21/20 11:45 PM, Bibek Shrestha wrote:

Hi,

I need to know per-port bandwidth utilization for my project. Couldn't
find any information related to this. Is there any standard way to
accomplish this using P4 and BMv2 switch?

Thanks
B.


P4-dev mailing listP4-dev@lists.p4.orghttp://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org

Hi David, Thanks for the information. My use case requires a probe packet to collect information from the switch data plane itself. That means, there is no standard way to achieve that in P4 BMV2, right? Thanks, B. On Mon, Dec 21, 2020 at 3:18 PM David Gengenbach <davidgengenbach@gmx.de> wrote: > This is only partially helpful, I guess. Just wanted to give some hints! > > Port statistics are not handled in the P4 specification, if I am not > mistaken, because it is for operation/during runtime (as is > inserting/reading/... tables entries which is handled by P4Runtime, for > example). > > Getting per-port statistics is possible with gNMI (which is bundled with > Stratum, for example), see: > > docker run -it --entrypoint bash bocon/gnmi-cli:latest -c "cat > /usr/local/bin/gnmi-cli" > > Running this will show you a Python client for gNMI - you can convert the > Protobuf using > https://github.com/openconfig/gnmi/blob/master/compile_protos.sh > > If you just want a CLI, you can simply use: > > docker run --network host -it bocon/gnmi-cli:latest --grpc-addr > GNMI_ADDRESS:PORT get / > > However, the standard bmv2 target does not have gNMI as an interface, if I > am not mistaken. There is a stratum_bmv2 one available, see > https://github.com/stratum/tutorial/tree/master/basic > On 12/21/20 11:45 PM, Bibek Shrestha wrote: > > Hi, > > I need to know per-port bandwidth utilization for my project. Couldn't > find any information related to this. Is there any standard way to > accomplish this using P4 and BMv2 switch? > > Thanks > B. > > _______________________________________________ > P4-dev mailing listP4-dev@lists.p4.orghttp://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org > >
RJ
Raj Joshi
Tue, Dec 22, 2020 8:35 AM

Hi Bibek,

Yes, there is no built-in way in P4 bmv2. However, since you are having
probe packets, you could do bandwidth calculation based on a pair of probe
packets. Basically, you implement a byte counter using a register in the
egress pipeline. Then you add the byte counter value and corresponding
timestamp in your probe packets when they pass. A pair of probe packets
would give you the difference in bytes transmitted and the corresponding
difference in time. You can then calculate bandwidth utilization as (diff
in bytes) / (diff in time). This technique is used by HPCC
https://liyuliang001.github.io/publications/hpcc.pdf. You can refer to
the paper for more information (see the calculation of "txRate" in section
3.2).

Cheers,
Raj

On Tue, Dec 22, 2020 at 8:12 AM Bibek Shrestha sbibek2050@gmail.com wrote:

Hi David,

Thanks for the information. My use case requires a probe packet to collect
information from the switch data plane itself. That means, there is no
standard way to achieve that in P4 BMV2, right?

Thanks,
B.

On Mon, Dec 21, 2020 at 3:18 PM David Gengenbach davidgengenbach@gmx.de
wrote:

This is only partially helpful, I guess. Just wanted to give some hints!

Port statistics are not handled in the P4 specification, if I am not
mistaken, because it is for operation/during runtime (as is
inserting/reading/... tables entries which is handled by P4Runtime, for
example).

Getting per-port statistics is possible with gNMI (which is bundled with
Stratum, for example), see:

docker run -it --entrypoint bash bocon/gnmi-cli:latest -c "cat
/usr/local/bin/gnmi-cli"

Running this will show you a Python client for gNMI - you can convert the
Protobuf using
https://github.com/openconfig/gnmi/blob/master/compile_protos.sh

If you just want a CLI, you can simply use:

docker run --network host -it bocon/gnmi-cli:latest  --grpc-addr
GNMI_ADDRESS:PORT get /

However, the standard bmv2 target does not have gNMI as an interface, if
I am not mistaken. There is a stratum_bmv2 one available, see
https://github.com/stratum/tutorial/tree/master/basic
On 12/21/20 11:45 PM, Bibek Shrestha wrote:

Hi,

I need to know per-port bandwidth utilization for my project. Couldn't
find any information related to this. Is there any standard way to
accomplish this using P4 and BMv2 switch?

Thanks
B.


P4-dev mailing listP4-dev@lists.p4.orghttp://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org


Hi Bibek, Yes, there is no built-in way in P4 bmv2. However, since you are having probe packets, you could do bandwidth calculation based on a pair of probe packets. Basically, you implement a byte counter using a register in the egress pipeline. Then you add the byte counter value and corresponding timestamp in your probe packets when they pass. A pair of probe packets would give you the difference in bytes transmitted and the corresponding difference in time. You can then calculate bandwidth utilization as (diff in bytes) / (diff in time). This technique is used by HPCC <https://liyuliang001.github.io/publications/hpcc.pdf>. You can refer to the paper for more information (see the calculation of "txRate" in section 3.2). Cheers, Raj On Tue, Dec 22, 2020 at 8:12 AM Bibek Shrestha <sbibek2050@gmail.com> wrote: > Hi David, > > Thanks for the information. My use case requires a probe packet to collect > information from the switch data plane itself. That means, there is no > standard way to achieve that in P4 BMV2, right? > > Thanks, > B. > > On Mon, Dec 21, 2020 at 3:18 PM David Gengenbach <davidgengenbach@gmx.de> > wrote: > >> This is only partially helpful, I guess. Just wanted to give some hints! >> >> Port statistics are not handled in the P4 specification, if I am not >> mistaken, because it is for operation/during runtime (as is >> inserting/reading/... tables entries which is handled by P4Runtime, for >> example). >> >> Getting per-port statistics is possible with gNMI (which is bundled with >> Stratum, for example), see: >> >> docker run -it --entrypoint bash bocon/gnmi-cli:latest -c "cat >> /usr/local/bin/gnmi-cli" >> >> Running this will show you a Python client for gNMI - you can convert the >> Protobuf using >> https://github.com/openconfig/gnmi/blob/master/compile_protos.sh >> >> If you just want a CLI, you can simply use: >> >> docker run --network host -it bocon/gnmi-cli:latest --grpc-addr >> GNMI_ADDRESS:PORT get / >> >> However, the standard bmv2 target does not have gNMI as an interface, if >> I am not mistaken. There is a stratum_bmv2 one available, see >> https://github.com/stratum/tutorial/tree/master/basic >> On 12/21/20 11:45 PM, Bibek Shrestha wrote: >> >> Hi, >> >> I need to know per-port bandwidth utilization for my project. Couldn't >> find any information related to this. Is there any standard way to >> accomplish this using P4 and BMv2 switch? >> >> Thanks >> B. >> >> _______________________________________________ >> P4-dev mailing listP4-dev@lists.p4.orghttp://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org >> >> _______________________________________________ > P4-dev mailing list > P4-dev@lists.p4.org > http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org >
BS
Bibek Shrestha
Thu, Dec 24, 2020 7:25 PM

Hi Raj,

Thank you for pointing out the paper. I will take a look at it and
hopefully, that solves the problem for me.

Thanks
B.

On Tue, Dec 22, 2020 at 12:36 AM Raj Joshi rajjoshi@comp.nus.edu.sg wrote:

Hi Bibek,

Yes, there is no built-in way in P4 bmv2. However, since you are having
probe packets, you could do bandwidth calculation based on a pair of probe
packets. Basically, you implement a byte counter using a register in the
egress pipeline. Then you add the byte counter value and corresponding
timestamp in your probe packets when they pass. A pair of probe packets
would give you the difference in bytes transmitted and the corresponding
difference in time. You can then calculate bandwidth utilization as (diff
in bytes) / (diff in time). This technique is used by HPCC
https://liyuliang001.github.io/publications/hpcc.pdf. You can refer to
the paper for more information (see the calculation of "txRate" in section
3.2).

Cheers,
Raj

On Tue, Dec 22, 2020 at 8:12 AM Bibek Shrestha sbibek2050@gmail.com
wrote:

Hi David,

Thanks for the information. My use case requires a probe packet to
collect information from the switch data plane itself. That means, there is
no standard way to achieve that in P4 BMV2, right?

Thanks,
B.

On Mon, Dec 21, 2020 at 3:18 PM David Gengenbach davidgengenbach@gmx.de
wrote:

This is only partially helpful, I guess. Just wanted to give some hints!

Port statistics are not handled in the P4 specification, if I am not
mistaken, because it is for operation/during runtime (as is
inserting/reading/... tables entries which is handled by P4Runtime, for
example).

Getting per-port statistics is possible with gNMI (which is bundled with
Stratum, for example), see:

docker run -it --entrypoint bash bocon/gnmi-cli:latest -c "cat
/usr/local/bin/gnmi-cli"

Running this will show you a Python client for gNMI - you can convert
the Protobuf using
https://github.com/openconfig/gnmi/blob/master/compile_protos.sh

If you just want a CLI, you can simply use:

docker run --network host -it bocon/gnmi-cli:latest  --grpc-addr
GNMI_ADDRESS:PORT get /

However, the standard bmv2 target does not have gNMI as an interface, if
I am not mistaken. There is a stratum_bmv2 one available, see
https://github.com/stratum/tutorial/tree/master/basic
On 12/21/20 11:45 PM, Bibek Shrestha wrote:

Hi,

I need to know per-port bandwidth utilization for my project. Couldn't
find any information related to this. Is there any standard way to
accomplish this using P4 and BMv2 switch?

Thanks
B.


P4-dev mailing listP4-dev@lists.p4.orghttp://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org


Hi Raj, Thank you for pointing out the paper. I will take a look at it and hopefully, that solves the problem for me. Thanks B. On Tue, Dec 22, 2020 at 12:36 AM Raj Joshi <rajjoshi@comp.nus.edu.sg> wrote: > Hi Bibek, > > Yes, there is no built-in way in P4 bmv2. However, since you are having > probe packets, you could do bandwidth calculation based on a pair of probe > packets. Basically, you implement a byte counter using a register in the > egress pipeline. Then you add the byte counter value and corresponding > timestamp in your probe packets when they pass. A pair of probe packets > would give you the difference in bytes transmitted and the corresponding > difference in time. You can then calculate bandwidth utilization as (diff > in bytes) / (diff in time). This technique is used by HPCC > <https://liyuliang001.github.io/publications/hpcc.pdf>. You can refer to > the paper for more information (see the calculation of "txRate" in section > 3.2). > > Cheers, > Raj > > On Tue, Dec 22, 2020 at 8:12 AM Bibek Shrestha <sbibek2050@gmail.com> > wrote: > >> Hi David, >> >> Thanks for the information. My use case requires a probe packet to >> collect information from the switch data plane itself. That means, there is >> no standard way to achieve that in P4 BMV2, right? >> >> Thanks, >> B. >> >> On Mon, Dec 21, 2020 at 3:18 PM David Gengenbach <davidgengenbach@gmx.de> >> wrote: >> >>> This is only partially helpful, I guess. Just wanted to give some hints! >>> >>> Port statistics are not handled in the P4 specification, if I am not >>> mistaken, because it is for operation/during runtime (as is >>> inserting/reading/... tables entries which is handled by P4Runtime, for >>> example). >>> >>> Getting per-port statistics is possible with gNMI (which is bundled with >>> Stratum, for example), see: >>> >>> docker run -it --entrypoint bash bocon/gnmi-cli:latest -c "cat >>> /usr/local/bin/gnmi-cli" >>> >>> Running this will show you a Python client for gNMI - you can convert >>> the Protobuf using >>> https://github.com/openconfig/gnmi/blob/master/compile_protos.sh >>> >>> If you just want a CLI, you can simply use: >>> >>> docker run --network host -it bocon/gnmi-cli:latest --grpc-addr >>> GNMI_ADDRESS:PORT get / >>> >>> However, the standard bmv2 target does not have gNMI as an interface, if >>> I am not mistaken. There is a stratum_bmv2 one available, see >>> https://github.com/stratum/tutorial/tree/master/basic >>> On 12/21/20 11:45 PM, Bibek Shrestha wrote: >>> >>> Hi, >>> >>> I need to know per-port bandwidth utilization for my project. Couldn't >>> find any information related to this. Is there any standard way to >>> accomplish this using P4 and BMv2 switch? >>> >>> Thanks >>> B. >>> >>> _______________________________________________ >>> P4-dev mailing listP4-dev@lists.p4.orghttp://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org >>> >>> _______________________________________________ >> P4-dev mailing list >> P4-dev@lists.p4.org >> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org >> >