Skip to content

Commit

Permalink
Change ygot to ygnmi
Browse files Browse the repository at this point in the history
  • Loading branch information
wenovus committed Nov 10, 2023
1 parent 5bb9ae5 commit e050d6e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 21 deletions.
17 changes: 8 additions & 9 deletions cmd_gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,22 +214,21 @@ 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=(
)
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
Expand All @@ -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
Expand Down
17 changes: 8 additions & 9 deletions cmd_gen/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,21 @@ 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=(
)
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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions validators/goyang-ygot/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e050d6e

Please sign in to comment.