#!/bin/bash # Parse yang openconfig tests # Note that the openconfig test suites are patched to counter CLixon issues as follows: # - release/models/mpls/openconfig-mpls-te.yang # issue: https://github.com/clicon/clixon/issues/60 # - release/models/wifi/types/openconfig-wifi-types.yang # issue: https://github.com/clicon/clixon/issues/59 # #PROG="valgrind --leak-check=full --show-leak-kinds=all ../util/clixon_util_yang" PROG=../util/clixon_util_yang OPENCONFIG=public OCDIR=$OPENCONFIG/release/models # Clone openconfig dir if not there if [ ! -d public ]; then git clone https://github.com/openconfig/public else (cd public; git pull) fi # include err() and new() functions and creates $dir . ./lib.sh # Yang specifics: multi-keys and empty type APPNAME=example # include err() and new() functions and creates $dir . ./lib.sh cfg=$dir/conf_yang.xml fyang=$dir/test.yang cat < $cfg $cfg $OCDIR $OCDIR/acl $OCDIR/aft $OCDIR/bfd $OCDIR/bgp $OCDIR/catalog $OCDIR/interfaces $OCDIR/isis $OCDIR/lacp $OCDIR/lldp $OCDIR/local-routing $OCDIR/mpls $OCDIR/multicast $OCDIR/network-instance $OCDIR/openflow $OCDIR/optical-transport $OCDIR/ospf $OCDIR/platform $OCDIR/policy $OCDIR/policy-forwarding $OCDIR/probes $OCDIR/qos $OCDIR/relay-agent $OCDIR/rib $OCDIR/segment-routing $OCDIR/stp $OCDIR/system $OCDIR/telemetry $OCDIR/types $OCDIR/vlan $OCDIR/wifi $OCDIR/wifi/access-points $OCDIR/wifi/ap-manager $OCDIR/wifi/mac $OCDIR/wifi/phy $OCDIR/wifi/types /usr/local/share/$APPNAME/yang /usr/local/share/clixon $APPNAME /usr/local/lib/$APPNAME/clispec /usr/local/lib/$APPNAME/cli $APPNAME /usr/local/var/$APPNAME/$APPNAME.sock /usr/local/var/$APPNAME/$APPNAME.pidfile 1 /usr/local/var/$APPNAME /usr/local/lib/xmldb/text.so true EOF files=$(find $OPENCONFIG -name "*.yang") # Just cound nr of modules (exclude submodule) let m=0; # Nr of modules for f in $files; do if [ -n "$(head -1 $f|grep '^module')" ]; then let m++; fi done echo "Number of modules:$m" for f in $files; do if [ -n "$(head -1 $f|grep '^module')" ]; then new "cli $f" expectfn "$clixon_cli -1f $cfg -y $f show version" 0 "3." fi done rm -rf $dir