Skip to content

Commit

Permalink
Merge ypathgen's generator into ygen's generator (#408)
Browse files Browse the repository at this point in the history
Enhanced generator to handle generation of both `GoStructs` and `PathStructs`
  • Loading branch information
wenovus authored Jun 29, 2020
1 parent 813ec65 commit 39ec835
Show file tree
Hide file tree
Showing 13 changed files with 92,231 additions and 92,262 deletions.
7 changes: 4 additions & 3 deletions exampleoc/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# OpenConfig ygot Example Go Structs

This directory contains an example generated set of structs from a subset of the
OpenConfig models. They are used within demo applications in the
[ygot/demo](https://github.com/openconfig/ygot/tree/master/demo) directory.
This directory contains an example generated set of structs and path structs
from a subset of the OpenConfig models. They are used within demo applications
in the [ygot/demo](https://github.com/openconfig/ygot/tree/master/demo)
directory.

This package **WILL** change without warning, and **SHOULD NOT** be imported
into your application. Rather, you should generate bindings directly using the
Expand Down
68,697 changes: 34,360 additions & 34,337 deletions exampleoc/oc.go

Large diffs are not rendered by default.

115,059 changes: 57,543 additions & 57,516 deletions exampleocpath/ocpath.go → exampleoc/ocpath.go

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions exampleoc/ocpath_augment.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package exampleoc

func (r *DevicePath) WithName(name string) *DevicePath {
r.PutCustomData("name", name)
return r
}
3 changes: 3 additions & 0 deletions exampleoc/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ git clone https://github.com/openconfig/public.git
mkdir deps
cp ../demo/getting_started/yang/{ietf,iana}* deps
go run ../generator/generator.go -path=public,deps -output_file=oc.go \
-generate_path_structs -path_structs_output_file=ocpath.go\
-package_name=exampleoc -generate_fakeroot -fakeroot_name=device -compress_paths=true \
-shorten_enum_leaf_names \
-exclude_modules=ietf-interfaces \
Expand All @@ -22,6 +23,7 @@ go run ../generator/generator.go -path=public,deps -output_file=oc.go \
-generate_getters \
-generate_leaf_getters \
-annotations \
-list_builder_key_threshold=3 \
public/release/models/network-instance/openconfig-network-instance.yang \
public/release/models/optical-transport/openconfig-optical-amplifier.yang \
public/release/models/optical-transport/openconfig-terminal-device.yang \
Expand All @@ -41,4 +43,5 @@ go run ../generator/generator.go -path=public,deps -output_file=oc.go \
public/release/models/lldp/openconfig-lldp.yang
runsed -i 's/This package was generated by.*/NOTE WELL: This is an example code file that is distributed with ygot.\nIt should not be used within your application, as it WILL change,\nwithout warning. Rather, you should generate structs directly from\nOpenConfig models using the ygot package.\n\nThis package was generated by github.com\/openconfig\/ygot/g' oc.go
gofmt -w -s oc.go
gofmt -w -s ocpath.go
rm -rf deps public
8 changes: 0 additions & 8 deletions exampleocpath/README.md

This file was deleted.

6 changes: 0 additions & 6 deletions exampleocpath/ocpath_augment.go

This file was deleted.

41 changes: 0 additions & 41 deletions exampleocpath/update.sh

This file was deleted.

Loading

0 comments on commit 39ec835

Please sign in to comment.