Change in osmo-sgsn[master]: regen_doc.sh: support gbproxy, run without docker

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Dec 3 19:13:25 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/16407 )

Change subject: regen_doc.sh: support gbproxy, run without docker
......................................................................

regen_doc.sh: support gbproxy, run without docker

Do not only update the VTY reference and counters of osmo-sgsn, but also
the VTY reference of gbproxy.

This was not possible with the old code path of calling "regen_doc.sh"
inside docker-playground.git, as it expects the program to be updated to
have the same name as the docker image. Using the docker-playground
script also has the disadvantage, that one must push the development
branch to git.osmocom.org before updating the VTY reference/counters,
because that script would build a new docker container with a freshly
cloned repository, check out the same commit that we have already
locally, build that and then finally regenerate the docs.

So instead of adding another parameter for the docker image to the
script in docker-playground.git and calling it twice, simplify the
process by rewriting the regen_doc.sh script in osmo-sgsn.git. Make it
start the locally installed osmo-sgsn and osmo-gbproxy binaries and
call osmo_interact_vty.py on them.

Related: OS#4292
Change-Id: I8b5bd5347ea34266ad650383372630f2a84d5cce
---
M doc/manuals/regen_doc.sh
1 file changed, 71 insertions(+), 11 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/doc/manuals/regen_doc.sh b/doc/manuals/regen_doc.sh
index d758436..847b764 100755
--- a/doc/manuals/regen_doc.sh
+++ b/doc/manuals/regen_doc.sh
@@ -1,17 +1,77 @@
-#!/bin/sh -x
+#!/bin/sh -e
 
-if [ -z "$DOCKER_PLAYGROUND" ]; then
-	echo "You need to set DOCKER_PLAYGROUND"
+require_osmo_interact_vty() {
+	if command -v osmo_interact_vty.py >/dev/null 2>&1; then
+		return
+	fi
+	echo "ERROR: osmo_interact_vty.py not found. Are osmo-python-tests in PATH?"
 	exit 1
-fi
+}
 
-SCRIPT=$(realpath "$0")
-MANUAL_DIR=$(dirname "$SCRIPT")
+# $1: "update_vty_reference" or "update_counters"
+# $2: output file
+# $3: port
+# $4-$n: command
+interact_vty() {
+	action="$1"
+	output="$2"
+	port="$3"
+	log="/tmp/$4.log"
+	shift 3
 
-COMMIT=${COMMIT:-$(git log -1 --format=format:%H)}
+	echo "Starting in background: $@"
+	"$@" > "$log" 2>&1 &
+	pid="$!"
 
-cd "$DOCKER_PLAYGROUND/scripts" || exit 1
+	sleep 0.5
+	if ! kill -0 "$pid" 2>/dev/null; then
+		echo "ERROR: start failed!"
+		cat "$log"
+		exit 1
+	fi
 
-OSMO_SGSN_BRANCH=$COMMIT ./regen_doc.sh osmo-sgsn 4245 \
-	"$MANUAL_DIR/chapters/counters_generated.adoc" \
-	"$MANUAL_DIR/vty/sgsn_vty_reference.xml"
+	case "$action" in
+		"update_vty_reference")
+			echo "Updating VTY reference: $output"
+			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)"
+cd "$DIR"
+
+require_osmo_interact_vty
+
+interact_vty \
+	"update_vty_reference" \
+	"vty/sgsn_vty_reference.xml" \
+	4245 \
+	osmo-sgsn -c "../examples/osmo-sgsn/osmo-sgsn.cfg"
+
+interact_vty \
+	"update_vty_reference" \
+	"vty-osmogbproxy/gbproxy_vty_reference.xml" \
+	4246 \
+	osmo-gbproxy -c "../examples/osmo-gbproxy/osmo-gbproxy.cfg"
+
+interact_vty \
+	"update_counters" \
+	"chapters/counters_generated.adoc" \
+	4245 \
+	osmo-sgsn -c "../examples/osmo-sgsn/osmo-sgsn.cfg"
+
+
+echo "Done with all"

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/16407
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I8b5bd5347ea34266ad650383372630f2a84d5cce
Gerrit-Change-Number: 16407
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-CC: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191203/950a6061/attachment.htm>


More information about the gerrit-log mailing list