Subject: Re: [PATCH iproute2-next 0/9] TC more JSON support

From: Stephen Hemminger <[email-masked]>
Date: Fri, 13 Jul 2018 15:22:11 -0700

On Fri, 13 Jul 2018 14:29:42 -0700
Jakub Kicinski <[email-masked]> wrote:

> On Fri, 13 Jul 2018 16:48:28 -0400, David Ahern wrote:
> > On 7/9/18 3:48 PM, Stephen Hemminger wrote:  
> > > From: Stephen Hemminger <[email-masked]>
> > > 
> > > Update core of TC command and library to do more JSON.
> > > Most of this patch set is about getting tc utility functions
> > > to be more friendly to the json_print infrastructure.
> > > 
> > > Stephen Hemminger (9):
> > >   tc: use JSON in error handling
> > >   tc: use const char in util
> > >   tc: convert stats print to json
> > >   tc/cbq: use sprint_rate
> > >   tc/util: remove print_rate
> > >   tc/util: remove unused print_size
> > >   tc/util: remove unused print_time
> > >   tc/util: add print helpers for JSON
> > >   tc/sfq: add json support
> > > 
> > >  tc/q_cbq.c   | 15 ++++-----
> > >  tc/q_sfq.c   | 65 +++++++++++++++++++++---------------
> > >  tc/tc.c      | 19 ++++++-----
> > >  tc/tc_util.c | 94 +++++++++++++++++++++++++++-------------------------
> > >  tc/tc_util.h | 11 +++---
> > >  5 files changed, 109 insertions(+), 95 deletions(-)
> > >     
> > 
> > I'd prefer some tc folks to take a look at the json output and verify
> > everything is good.
> > 
> > Jamal, Jiri, Jakub, Cong, others?
> > 
> > There is a second set with 30 patches as well.  
> 
> AFAIK the 31 patches supersede this set?  I only have tests that use
> JSON for MQ and RED qdiscs, and those work fine with the v2 applied!

This is what I used to test the trivial ones.  Some require more parameters.

#! /bin/sh

for q in cbq cbs choke clsact codel drr dsmark fifo \
	fq fq_codel gred hfsc hhf htb ingress mqprio \
	multiq netem pie prio qfq red rr sfb sfq tbf
do 
    echo -n $q ": "
    sudo tc qdisc add dev dummy0 root $q 2>/dev/null
    if [ $? -ne 0 ]; then
	echo "can not test"
    else
	/sbin/tc qdisc show dev dummy0 >$q.orig
	./tc/tc qdisc show dev dummy0 >$q.new
	if cmp $q.new $q.orig; then
		echo -n "ok"
	else
		echo -n "differ"
	fi
	./tc/tc -j qdisc show dev dummy0 >$q.json
	if python -mjson.tool <$q.json >/dev/null; then
		echo " json ok"
	else
		echo " json format error"
	fi

	sudo tc qdisc del dev dummy0 root
    fi
done