aboutsummaryrefslogtreecommitdiffstats
path: root/tools/validate-diameter-xml.sh
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2021-06-01 15:21:11 +0200
committerAnders Broman <anders.broman@ericsson.com>2021-06-03 15:49:38 +0200
commite64bad71bebe2178df717924e8dbbe1cedf56304 (patch)
tree067cff549ff13943476306e6e1f66fed643b1184 /tools/validate-diameter-xml.sh
parent5202119239f76af3df20540b35c618d7095c99c6 (diff)
Diameter: Update AVPs from 3GPP TS 29.272 V16.4.0
Amend the xml checking script to exlude one more AVP from the check and make it easy to add more to the list. Courtesy of Christopher Maynard.
Diffstat (limited to 'tools/validate-diameter-xml.sh')
-rwxr-xr-xtools/validate-diameter-xml.sh18
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/validate-diameter-xml.sh b/tools/validate-diameter-xml.sh
index 36b6fb2976..a360633d44 100755
--- a/tools/validate-diameter-xml.sh
+++ b/tools/validate-diameter-xml.sh
@@ -49,10 +49,26 @@ trap 'rm -rf "$tmpdir"' EXIT
# 2) (but) we do want to use xmllint to find problems
# 3) (and) users see the AVP names. Showing them "TGPP" instead of "3GPP"
# is annoying enough to warrant this extra work.
+
+# Declare and populate associative exceptions array
+declare -A exceptions=(
+ ["3GPP"]="TGPP"
+ ["5QI"]="FiveQI"
+)
+
+# Loop through the exceptions, building the sed options
+sedopts=
+for e in ${!exceptions[@]}; do
+ sedopts="${sedopts}s/name=\"$e/name=\"${exceptions[$e]}/;"
+done
+
+# Delete the last character, i.e., the trailing semicolon
+sedopts=${sedopts%?}
+
cp diameter/dictionary.dtd "$tmpdir" || exit 1
for f in diameter/*.xml
do
- sed 's/name="3GPP/name="TGPP/g' "$f" > "$tmpdir/${f##*/}" || exit 1
+ sed "${sedopts}" "$f" > "$tmpdir/${f##*/}" || exit 1
done
xmllint --noout --noent --postvalid "$tmpdir/dictionary.xml" &&