mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-05 07:03:02 +02:00
The yanger source grown significantly, code is disorganized, the namespace is all over the place, etc. Take a stab at remedying the situation by splitting out the individual YANG models in separate Python modules, starting with ietf-system.
35 lines
932 B
Bash
Executable File
35 lines
932 B
Bash
Executable File
#!/bin/sh
|
|
|
|
SCRIPT_PATH="$(dirname "$(readlink -f "$0")")"
|
|
ROOT_PATH="$SCRIPT_PATH/../../../"
|
|
|
|
YANGER_TOOL="$ROOT_PATH/src/statd/python/yanger/yanger"
|
|
|
|
INTERFACES_OUTPUT_FILE="$(mktemp)"
|
|
ROUTES_OUTPUT_FILE="$(mktemp)"
|
|
SYSTEM_OUTPUT_FILE="$(mktemp)"
|
|
cleanup() {
|
|
rm -f "$INTERFACES_OUTPUT_FILE"
|
|
rm -f "$ROUTES_OUTPUT_FILE"
|
|
rm -f "$SYSTEM_OUTPUT_FILE"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
if [ ! -e "$YANGER_TOOL" ]; then
|
|
echo "Error, yanger tool not found"
|
|
exit 1
|
|
fi
|
|
|
|
if ! "$YANGER_TOOL" "ietf-interfaces" \
|
|
-t "$SCRIPT_PATH/system-output/" >> "$INTERFACES_OUTPUT_FILE"; then
|
|
echo "Error, running yanger for interface $iface" >&2
|
|
exit 1
|
|
fi
|
|
|
|
$YANGER_TOOL "ietf-routing" -t "$SCRIPT_PATH/system-output/" > "$ROUTES_OUTPUT_FILE"
|
|
|
|
$YANGER_TOOL "ietf-system" -t "$SCRIPT_PATH/system-output/" > "$SYSTEM_OUTPUT_FILE"
|
|
|
|
# Merge all module files
|
|
jq -s '.[0] * .[1] * .[2]' $ROUTES_OUTPUT_FILE $INTERFACES_OUTPUT_FILE $SYSTEM_OUTPUT_FILE
|