-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support leaf-list defaults using latest version of goyang. (#618)
* Support leaf-list defaults using latest version of goyang. Note: I haven't released goyang yet since I want to release both repos at the same time. This is to avoid a downstream issue: openconfig/models-ci#59 - Update ygot to use the updated `Entry.Default []string` and its corresponding helpers for storing defaults for leaf-lists. - Change some helper function such as `yangDefaultValueToGo` to return `string` instead of `*string`. There is no good reason for returning a pointer and makes the code less convenient. - Factor out `generateGoDefaultValue` from `writeGoStruct`, and have it handle multiple default values. - In protogen's logic to generate default enums, check whether an enum is not a leaf-list before setting a particular one as the default enum value. Note: I'm not sure whether this is the correct handling -- though it appears to me that having a default value doesn't make sense for leaf-lists as repeated fields. Testing: - Added integration tests for Go and proto generation. * Update ygot to use hermetic module parsing change from goyang. (#619) * Update to use goyang@v1.0.0
- Loading branch information
Showing
23 changed files
with
123,687 additions
and
118,468 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
module openconfig-leaflist-default { | ||
yang-version "1.1"; | ||
prefix "ocs"; | ||
namespace "urn:ocs"; | ||
description | ||
"A simple OpenConfig test module with leaflists."; | ||
|
||
typedef string-with-default { | ||
type string; | ||
} | ||
|
||
grouping parent-config { | ||
leaf-list one { type string; } | ||
leaf-list three { | ||
type enumeration { | ||
enum ONE; | ||
enum TWO; | ||
} | ||
default ONE; | ||
default TWO; | ||
} | ||
leaf-list four { | ||
type binary; | ||
default "abc0"; | ||
} | ||
} | ||
|
||
container parent { | ||
description | ||
"I am a parent container | ||
that has 4 children."; | ||
container child { | ||
container config { | ||
uses parent-config; | ||
} | ||
container state { | ||
config false; | ||
uses parent-config; | ||
leaf-list two { | ||
type string-with-default; | ||
default "foo"; | ||
default "foo"; | ||
default "bar"; | ||
default "bar"; | ||
default "baz"; | ||
default "baz"; | ||
} | ||
} | ||
} | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.