Skip to content

Commit

Permalink
2024-11-11: TR-383 Amendment 8 Common YANG Modules for Access Networks
Browse files Browse the repository at this point in the history
  • Loading branch information
BBF Tools committed Nov 12, 2024
1 parent eaac2c3 commit c66a929
Show file tree
Hide file tree
Showing 37 changed files with 2,850 additions and 662 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## Broadband Forum YANG Modules

### 2024-11-11: [TR-383 Amendment 8](https://www.broadband-forum.org/technical/download/TR-383_Amendment-8.pdf) Common YANG Modules for Access Networks
*Tag: [TR-383-v1.8.0](https://github.com/BroadbandForum/yang/tree/TR-383-v1.8.0)*

* Enhancements to existing models.
* New models for Ethernet OAM, IP interfaces and IPFIX.

### 2024-04-23: [TR-385 Issue 3](https://www.broadband-forum.org/technical/download/TR-385_Issue-3.pdf) YANG Modules for PON Management
*Tag: [TR-385-v3.0.0](https://github.com/BroadbandForum/yang/tree/TR-385-v3.0.0)*

Expand Down
133 changes: 99 additions & 34 deletions check.sh
Original file line number Diff line number Diff line change
@@ -1,79 +1,144 @@
#!/bin/sh
#!/bin/bash
#
# BBF check script (loosely) based on the IETF one.
#
# Invoke without arguments in a YangModels/yang checkout
# Invoke without arguments from the top level of a YangModels/yang checkout.
#
# Or specifying the pyang version and enabling debug output
#
# PYTHONPATH=$MYROOT/pyang/default standard/bbf/check.sh '' '' $MYROOT/pyang/default/bin/pyang true
# Invoke with the -h option to see command-line options.

# remember the current directory
cwd=`pwd`

# experimental YANG
exp_dir="$cwd/experimental"

# default arguments
# process arguments
bbf_dir="$cwd/standard/bbf"
before_dir="$cwd/experimental"
ietf_dir="$cwd/standard/ietf"
after_dir=""
ieee_dir="$cwd/standard/ieee"
pyang=pyang
pyang="pyang"
debug=""
dryrun=""
while getopts "b:e:i:E:I:p:dnh" option; do
case "$option" in
b) bbf_dir="$OPTARG";;
e) before_dir="$OPTARG";;
i) ietf_dir="$OPTARG";;
E) after_dir="$OPTARG";;
I) ieee_dir="$OPTARG";;
p) pyang="$OPTARG";;
d) debug="true";;
n) dryrun="true";;
h|*) cat <<END
Usage: $0
-b BBF-DIR # BBF YANG directory (default "$bbf_dir")
-e BEFORE-DIR # IETF experimental YANG directory (default "$before_dir")
-i IETF-DIR # IETF published YANG directory (default "$ietf_dir")
-E AFTER-DIR # IETF experimental YANG directory (default "$after_dir")
-I IEEE-DIR # IEEE YANG directory (default "$ieee_dir")
-p PYANG # pyang command (default "$pyang")
-d # whether to generate debug output (default NO)
-n # whether to perform a try run (default NO)
-h # output this help
Run pyang to check YANG files in BBF-DIR. The pyang path is set to BBF-DIR,
BEFORE-DIR, IETF-DIR, AFTER-DIR, IEEE-DIR, so IETF experimental YANG can be
searched before or after IETF published YANG (or both before and after).
END
exit 0
;;
esac
done

# step over options
shift $(($OPTIND - 1))

# $1 overrides bbf_dir
# process remaining command line arguments (backwards compatibility)
if [ -n "$1" ]; then
bbf_dir="$1"
echo "warning: should use -b to override BBF-DIR"
bbf_dir="$1"
fi

# $2 overrides ietf_dir
if [ -n "$2" ]; then
ietf_dir="$2"
echo "warning: should use -i to override IETF-DIR"
ietf_dir="$2"
fi

# $3 overrides pyang (may also need to set PYTHONPATH)
if [ -n "$3" ]; then
pyang="$3"
echo "warning: should use -p to override PYANG"
pyang="$3"
fi
if [ -n "$4" ]; then
echo "warning: should use -d to set DEBUG"
debug="$4"
fi

# $4 if non-empty enables debug output
debug="$4"

# ieee_dir can't currently be overridden
# BBF-DIR and IETF-DIR must exist
if [ ! -d "$bbf_dir" ]; then
echo "$bbf_dir doesn't exist"
exit 1
fi
if [ ! -d "$ietf_dir" ]; then
echo "$ietf_dir doesn't exist"
exit 1
fi

# get the BBF-DIR absolute path, and collect YANG to be processed
cd $bbf_dir
to_check=`find standard draft -mindepth 1 -maxdepth 1 -type d`
bbf_dir=`pwd`
paths="standard"
[ -d draft ] && paths+=" draft"
to_check=`find $paths -mindepth 1 -maxdepth 1 -type d`

# get the IETF-DIR absolute path
cd $cwd
cd $ietf_dir
ietf_dir=`pwd`

# return to the starting directory
cd $cwd

pyang_flags="--max-line-length=70 --lint --lint-modulename-prefix=bbf --lint-namespace-prefix=urn:bbf:yang: --lint-ensure-hyphenated-name --verbose --path=$bbf_dir --path=$exp_dir --path=$ietf_dir --path=$ieee_dir"
# form the pyang flags
pyang_flags="--max-line-length=70 --lint --lint-modulename-prefix=bbf --lint-namespace-prefix=urn:bbf:yang: --lint-ensure-hyphenated-name"

checkDir () {
for dir in $bbf_dir $before_dir $ietf_dir $after_dir $ieee_dir; do
if [ ! -r $dir ]; then
2>&1 echo "warning: $dir doesn't exist"
else
pyang_flags+=" --path=$dir"
fi
done

if [ -n "$debug" ]; then
pyang_flags+=" --verbose"
fi

# helper function for checking YANG files in a directory
check_dir () {
local dir="$bbf_dir/$1"
printf "\n"
echo Checking YANG files in $dir
exit_status=""
for f in `find $dir -name '*.yang'`; do
if [ -n "$debug" ]; then
echo Checking $f
fi
errors=`$pyang $pyang_flags $f 2>&1 | grep "error:"`
if [ -n "$errors" ]; then
echo Errors in $f
printf "\n $errors \n"
exit_status="failed!"
echo "Checking $f"
fi
if [ -n "$dryrun" ]; then
echo "$pyang $pyang_flags"
else
errors=`$pyang $pyang_flags $f 2>&1 | grep "error:"`
if [ -n "$errors" ]; then
echo "Errors in $f"
printf "\n $errors \n"
exit_status="failed!"
fi
fi
done
if [ -n "$exit_status" ]; then
exit 1
fi
}

echo Checking modules with pyang command:
echo "Checking modules with pyang command:"
printf "\nPYTHONPATH=$PYTHONPATH $pyang $pyang_flags MODULE\n"

for d in $to_check; do
checkDir $d
check_dir "$d"
done
Binary file added docs/YANG-develop-102.pdf
Binary file not shown.
Binary file removed docs/YANG-develop-97.pdf
Binary file not shown.
Binary file modified docs/index.docx
Binary file not shown.
4 changes: 3 additions & 1 deletion docs/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
div.csl-bib-body { }
div.csl-entry {
clear: both;
margin-bottom: 0em;
}
.hanging-indent div.csl-entry {
margin-left:2em;
Expand Down Expand Up @@ -485,7 +486,8 @@ <h1 class="title auto-hoverlink" id="title">OD-360 – Broadband Forum
</div>
<h1 class="auto-hoverlink" data-info="header"
id="sec:references">References</h1>
<div id="refs" class="references csl-bib-body" role="list">
<div id="refs" class="references csl-bib-body" data-entry-spacing="0"
role="list">
<div id="ref-RFC2119" class="csl-entry" role="listitem">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">RFC
2119, <em><a href="https://www.rfc-editor.org/rfc/rfc2119.html">Key
Expand Down
4 changes: 3 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
div.csl-bib-body { }
div.csl-entry {
clear: both;
margin-bottom: 0em;
}
.hanging-indent div.csl-entry {
margin-left:2em;
Expand Down Expand Up @@ -759,7 +760,8 @@ <h1 class="cover-page unnumbered">Cover Page</h1>
<section id="sec:references" class="auto-hoverlink new-section hidden"
data-info="header">
<h1 class="auto-hoverlink" data-info="header">References</h1>
<div id="refs" class="references csl-bib-body" role="list">
<div id="refs" class="references csl-bib-body" data-entry-spacing="0"
role="list">
<div id="ref-RFC2119" class="csl-entry" role="listitem">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">RFC
2119, <em><a href="https://www.rfc-editor.org/rfc/rfc2119.html">Key
Expand Down
2 changes: 1 addition & 1 deletion docs/index.json

Large diffs are not rendered by default.

Binary file modified docs/index.pdf
Binary file not shown.
Loading

0 comments on commit c66a929

Please sign in to comment.