#!/bin/bash # Copyright ETSI 2020 echo "------ Switching to $1 folder --------" cd $1 echo "------ Content of the folder ------" ls echo "------ Validating all YANG, JSON and XML files ------" # If there are no YANG, JSON or XML files, then simply exit ls | grep -q 'yang\|json\|xml\|xsd' found_data_models=$? if [ ! $found_data_models ] ; then echo "-- No YANG, JSON, XML or XSD files." exit 0 fi echo "------ pyYANG Version ------" docker run --rm -v $(pwd)/yang-models:/yang hellt/pyang:2.1 pyang --version echo "------ Linting all YANG files ------" # Display all errors and warnings to the user. Errors are allowed. docker run --rm -v $(pwd)/yang-models:/yang hellt/pyang:2.1 "/bin/sh" -c 'pyang --lint -p external-yams _3gpp-*.yang' ret=$? echo "------ Linting result ------" echo $ret # exit $ret exit 0