From e050d6eaba64a8e7cee55e26246141351679b25d Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 9 Nov 2023 18:30:24 -0800 Subject: [PATCH] Change ygot to ygnmi --- cmd_gen/main.go | 17 ++++++++--------- cmd_gen/main_test.go | 17 ++++++++--------- validators/goyang-ygot/test.sh | 6 +++--- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/cmd_gen/main.go b/cmd_gen/main.go index ad6ca3c..cb633f5 100644 --- a/cmd_gen/main.go +++ b/cmd_gen/main.go @@ -214,14 +214,13 @@ function run-dir() { headerTemplate: mustTemplate("goyang-ygot-header", `#!/bin/bash workdir={{ .ResultsDir }} mkdir -p "$workdir" -cmd="generator" +cmd="ygnmi generator" options=( - -path={{ .ModelRoot }},{{ .RepoRoot }}/third_party/ietf - -package_name=exampleoc -generate_fakeroot -fakeroot_name=device -compress_paths=true - -shorten_enum_leaf_names -trim_enum_openconfig_prefix -typedef_enum_with_defmod -enum_suffix_for_simple_union_enums - -exclude_modules=ietf-interfaces -generate_rename -generate_append -generate_getters - -generate_leaf_getters -generate_delete -annotations -generate_simple_unions - -list_builder_key_threshold=3 + --trim_module_prefix=openconfig + --exclude_modules=ietf-interfaces + --split_package_paths="/network-instances/network-instance/protocols/protocol/isis=netinstisis,/network-instances/network-instance/protocols/protocol/bgp=netinstbgp" + --paths={{ .ModelRoot }},{{ .RepoRoot }}/third_party/ietf + --annotations ) script_options=( ) @@ -229,7 +228,7 @@ function run-dir() { declare prefix="$workdir"/"$1"=="$2"== outdir=$GOPATH/src/"$1"."$2"/ mkdir "$outdir" - local options=( -output_file="$outdir"/oc.go "${options[@]}" ) + local options=( --output_dir="${outdir}"/oc --base_package_path="$1"."$2"/oc "${options[@]}" ) shift 2 echo $cmd "${options[@]}" "$@" > ${prefix}cmd status=0 @@ -238,7 +237,7 @@ function run-dir() { if [[ $status -eq "0" ]]; then go mod init &>> ${prefix}pass || status=1 go mod tidy &>> ${prefix}pass || status=1 - go build &>> ${prefix}pass || status=1 + go build ./... &>> ${prefix}pass || status=1 fi if [[ $status -eq "1" ]]; then mv ${prefix}pass ${prefix}fail diff --git a/cmd_gen/main_test.go b/cmd_gen/main_test.go index 1c34c85..48d7f12 100644 --- a/cmd_gen/main_test.go +++ b/cmd_gen/main_test.go @@ -184,14 +184,13 @@ wait wantCmd: `#!/bin/bash workdir=/workspace/results/goyang-ygot mkdir -p "$workdir" -cmd="generator" +cmd="ygnmi generator" options=( - -path=testdata,/workspace/third_party/ietf - -package_name=exampleoc -generate_fakeroot -fakeroot_name=device -compress_paths=true - -shorten_enum_leaf_names -trim_enum_openconfig_prefix -typedef_enum_with_defmod -enum_suffix_for_simple_union_enums - -exclude_modules=ietf-interfaces -generate_rename -generate_append -generate_getters - -generate_leaf_getters -generate_delete -annotations -generate_simple_unions - -list_builder_key_threshold=3 + --trim_module_prefix=openconfig + --exclude_modules=ietf-interfaces + --split_package_paths="/network-instances/network-instance/protocols/protocol/isis=netinstisis,/network-instances/network-instance/protocols/protocol/bgp=netinstbgp" + --paths=testdata,/workspace/third_party/ietf + --annotations ) script_options=( ) @@ -199,7 +198,7 @@ function run-dir() { declare prefix="$workdir"/"$1"=="$2"== outdir=$GOPATH/src/"$1"."$2"/ mkdir "$outdir" - local options=( -output_file="$outdir"/oc.go "${options[@]}" ) + local options=( --output_dir="${outdir}"/oc --base_package_path="$1"."$2"/oc "${options[@]}" ) shift 2 echo $cmd "${options[@]}" "$@" > ${prefix}cmd status=0 @@ -208,7 +207,7 @@ function run-dir() { if [[ $status -eq "0" ]]; then go mod init &>> ${prefix}pass || status=1 go mod tidy &>> ${prefix}pass || status=1 - go build &>> ${prefix}pass || status=1 + go build ./... &>> ${prefix}pass || status=1 fi if [[ $status -eq "1" ]]; then mv ${prefix}pass ${prefix}fail diff --git a/validators/goyang-ygot/test.sh b/validators/goyang-ygot/test.sh index 075c76a..7f40d1e 100755 --- a/validators/goyang-ygot/test.sh +++ b/validators/goyang-ygot/test.sh @@ -24,11 +24,11 @@ if ! stat $RESULTSDIR; then fi # module download logs go to stderr, so only fail if command failed. -if ! go install github.com/openconfig/ygot/generator@latest &> "${OUTFILE}"; then - echo "failed: go install github.com/openconfig/ygot/generator@latest" > "${FAILFILE}" +if ! go install github.com/openconfig/ygnmi/app/ygnmi@latest &> "${OUTFILE}"; then + echo "failed: go install github.com/openconfig/ygnmi/app/ygnmi@latest" > "${FAILFILE}" fi -go list -m github.com/openconfig/ygot@latest > $RESULTSDIR/latest-version.txt +go list -m github.com/openconfig/ygnmi@latest > $RESULTSDIR/latest-version.txt if bash $RESULTSDIR/script.sh >> $OUTFILE 2>> $FAILFILE; then # Delete fail file if it's empty and the script passed. find $FAILFILE -size 0 -delete