Skip to content

Commit

Permalink
Replace IsConfig()'s implementation with goyang's ReadOnly(). (#604)
Browse files Browse the repository at this point in the history
ReadOnly()'s implementation is a bit more robust, and has the same functionality.
  • Loading branch information
wenovus authored Nov 8, 2021
1 parent 29aeec1 commit 13a6771
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions util/yang.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,18 +303,7 @@ func fixYangRegexp(pattern string) string {
// the state. If the element at the top of the tree does not have config set, then config
// is true. See https://tools.ietf.org/html/rfc6020#section-7.19.1.
func IsConfig(e *yang.Entry) bool {
for ; e.Parent != nil; e = e.Parent {
switch e.Config {
case yang.TSTrue:
return true
case yang.TSFalse:
return false
}
}

// Reached the last element in the tree without explicit configuration
// being set.
return e.Config != yang.TSFalse
return !e.ReadOnly()
}

// isPathChild takes an input slice of strings representing a path and determines
Expand Down

0 comments on commit 13a6771

Please sign in to comment.