manuals: Regenerate counters/VTY through docker
Related: SYS#5115, SYS#5005 Change-Id: I39d60a7fd7ec66f3f20bfcef5c32502598f2708f
This commit is contained in:
parent
b643765d0a
commit
f06b4817b9
|
@ -1,74 +1,17 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -x
|
||||||
|
|
||||||
require_osmo_interact_vty() {
|
if [ -z "$DOCKER_PLAYGROUND" ]; then
|
||||||
if command -v osmo_interact_vty.py >/dev/null 2>&1; then
|
echo "You need to set DOCKER_PLAYGROUND"
|
||||||
return
|
|
||||||
fi
|
|
||||||
echo "ERROR: osmo_interact_vty.py not found. Are osmo-python-tests in PATH?"
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
fi
|
||||||
|
|
||||||
# $1: "update_vty_reference" or "update_counters"
|
SCRIPT=$(realpath "$0")
|
||||||
# $2: output file
|
MANUAL_DIR=$(dirname "$SCRIPT")
|
||||||
# $3: port
|
|
||||||
# $4-$n: command
|
|
||||||
interact_vty() {
|
|
||||||
action="$1"
|
|
||||||
output="$2"
|
|
||||||
port="$3"
|
|
||||||
log="/tmp/$4.log"
|
|
||||||
shift 3
|
|
||||||
|
|
||||||
echo "Starting in background: $@"
|
COMMIT=${COMMIT:-$(git log -1 --format=format:%H)}
|
||||||
"$@" > "$log" 2>&1 &
|
|
||||||
pid="$!"
|
|
||||||
|
|
||||||
sleep 0.5
|
cd "$DOCKER_PLAYGROUND/scripts" || exit 1
|
||||||
if ! kill -0 "$pid" 2>/dev/null; then
|
|
||||||
echo "ERROR: start failed!"
|
|
||||||
cat "$log"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$action" in
|
OSMO_BSC_BRANCH=$COMMIT ./regen_doc.sh osmo-gbproxy 4246 \
|
||||||
"update_vty_reference")
|
"$MANUAL_DIR/chapters/counters_generated.adoc" \
|
||||||
echo "Updating VTY reference: $output"
|
"$MANUAL_DIR/vty/gbproxy_vty_reference.xml"
|
||||||
osmo_interact_vty.py -X -p "$port" -H 127.0.0.1 -O "$output"
|
|
||||||
;;
|
|
||||||
"update_counters")
|
|
||||||
echo "Updating asciidoc counters: $output"
|
|
||||||
osmo_interact_vty.py -c "enable;show asciidoc counters" -p "$port" -H 127.0.0.1 -O "$output"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "ERROR: invalid argument: $action"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
kill "$pid"
|
|
||||||
echo "Done (killed $1)"
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
|
|
||||||
DIR="$(cd "$(dirname "$0")"; pwd)"
|
|
||||||
echo $DIR
|
|
||||||
cd "$DIR"
|
|
||||||
|
|
||||||
require_osmo_interact_vty
|
|
||||||
|
|
||||||
interact_vty \
|
|
||||||
"update_vty_reference" \
|
|
||||||
"vty/gbproxy_vty_reference.xml" \
|
|
||||||
4246 \
|
|
||||||
osmo-gbproxy -c "../examples/osmo-gbproxy/osmo-gbproxy.cfg"
|
|
||||||
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
interact_vty \
|
|
||||||
"update_counters" \
|
|
||||||
"chapters/counters_generated.adoc" \
|
|
||||||
4246 \
|
|
||||||
osmo-gbproxy -c "../examples/osmo-gbproxy/osmo-gbproxy.cfg"
|
|
||||||
|
|
||||||
|
|
||||||
echo "Done with all"
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue