@@ -412,45 +412,54 @@ index 0000000..286a29c
412412+ }
413413+
414414diff --git a/pkg/yang/entry.go b/pkg/yang/entry.go
415- index ef658d6..cd3b046 100644
415+ index dfd4525..cdf6eb1 100644
416416--- a/pkg/yang/entry.go
417417+++ b/pkg/yang/entry.go
418- @@ -80,6 +80,7 @@ type Entry struct {
418+ @@ -29,6 +29,7 @@ import (
419+ "sort"
420+ "strconv"
421+ "strings"
422+ + "sync"
423+
424+ "github.com/openconfig/goyang/pkg/indent"
425+ )
426+ @@ -80,6 +81,7 @@ type Entry struct {
419427
420428 // Fields associated with directory nodes
421429 Dir map[string]*Entry `json:",omitempty"`
422430+ DirOKeys []string // Ordered Keys list in Dir
423431 Key string `json:",omitempty"` // Optional key name for lists (i.e., maps)
424432
425433 // Fields associated with leaf nodes
426- @@ -115,6 +116,10 @@ type Entry struct {
434+ @@ -115,6 +117,11 @@ type Entry struct {
427435 // the augmenting entity per RFC6020 Section 7.15.2. The namespace
428436 // of the Entry should be accessed using the Namespace function.
429437 namespace *Value
430438+
431439+ ChildSchemaCache map[reflect.StructTag]*Entry `json:"-"`
432- +
440+ + ChildSchemaMutex sync.RWMutex `json:"-"`
441+ +
433442+ IsSchemaValidated bool `json:"-"`
434443 }
435444
436445 // An RPCEntry contains information related to an RPC Node.
437- @@ -264,6 +269 ,7 @@ func newDirectory(n Node) *Entry {
446+ @@ -264,6 +271 ,7 @@ func newDirectory(n Node) *Entry {
438447 return &Entry{
439448 Kind: DirectoryEntry,
440449 Dir: make(map[string]*Entry),
441450+ DirOKeys: make([]string, 0),
442451 Node: n,
443452 Name: n.NName(),
444453 Extra: map[string][]interface{}{},
445- @@ -366 ,6 +372 ,7 @@ func (e *Entry) add(key string, value *Entry) *Entry {
454+ @@ -360 ,6 +368 ,7 @@ func (e *Entry) add(key string, value *Entry) *Entry {
446455 return e
447456 }
448457 e.Dir[key] = value
449458+ e.DirOKeys = append(e.DirOKeys, key)
450459 return e
451460 }
452461
453- @@ -1007 ,7 +1014 ,7 @@ func (e *Entry) ApplyDeviate() []error {
462+ @@ -999 ,7 +1008 ,7 @@ func (e *Entry) ApplyDeviate() []error {
454463 }
455464
456465 if devSpec.Default != "" {
@@ -459,15 +468,15 @@ index ef658d6..cd3b046 100644
459468 }
460469
461470 if devSpec.Mandatory != TSUnset {
462- @@ -1090 ,6 +1097 ,7 @@ func (e *Entry) FixChoice() {
471+ @@ -1082 ,6 +1091 ,7 @@ func (e *Entry) FixChoice() {
463472 }
464473 ce.Parent = ne
465474 e.Dir[k] = ne
466475+ e.DirOKeys = append(e.DirOKeys, k)
467476 }
468477 }
469478 }
470- @@ -1260 ,6 +1268 ,14 @@ func (e *Entry) shallowDup() *Entry {
479+ @@ -1252 ,6 +1262 ,14 @@ func (e *Entry) shallowDup() *Entry {
471480 // copied we will have to explicitly uncopy them.
472481 ne := *e
473482
@@ -482,7 +491,7 @@ index ef658d6..cd3b046 100644
482491 // Now only copy direct children, clear their Dir, and fix up
483492 // Parent pointers.
484493 if e.Dir != nil {
485- @@ -1283 ,6 +1299 ,14 @@ func (e *Entry) dup() *Entry {
494+ @@ -1275 ,6 +1293 ,14 @@ func (e *Entry) dup() *Entry {
486495 // to do that.
487496 ne := *e
488497
@@ -497,15 +506,15 @@ index ef658d6..cd3b046 100644
497506 // Now recurse down to all of our children, fixing up Parent
498507 // pointers as we go.
499508 if e.Dir != nil {
500- @@ -1317,6 +1341,7 @@ func (e *Entry) merge(prefix *Value, namespace *Value, oe *Entry) {
501- } else {
509+ @@ -1310,6 +1336,7 @@ func (e *Entry) merge(prefix *Value, namespace *Value, oe *Entry) {
502510 v.Parent = e
511+ v.Exts = append(v.Exts, oe.Exts...)
503512 e.Dir[k] = v
504513+ e.DirOKeys = append(e.DirOKeys, k)
505514 }
506515 }
507516 }
508- @@ -1378 ,8 +1403 ,8 @@ func (s sortedErrors) Less(i, j int) bool {
517+ @@ -1371 ,8 +1398 ,8 @@ func (s sortedErrors) Less(i, j int) bool {
509518 }
510519 return nless(fi[x], fj[x])
511520 }
@@ -516,6 +525,33 @@ index ef658d6..cd3b046 100644
516525 case -1:
517526 return true
518527 case 1:
528+ diff --git a/pkg/yang/types.go b/pkg/yang/types.go
529+ index 307610a..ffb59a6 100644
530+ --- a/pkg/yang/types.go
531+ +++ b/pkg/yang/types.go
532+ @@ -12,6 +12,9 @@
533+ // See the License for the specific language governing permissions and
534+ // limitations under the License.
535+
536+ + // This file is changed by Broadcom.
537+ + // Modifications - Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or its subsidiaries.
538+ +
539+ package yang
540+
541+ // This file implements the functions relating to types and typedefs.
542+ @@ -69,6 +72,12 @@ func (d *typeDictionary) findExternal(n Node, prefix, name string) (*Typedef, er
543+ }
544+ if td := d.find(root, name); td != nil {
545+ return td, nil
546+ + } else {
547+ + for _, in := range root.Include {
548+ + if td := typeDict.find(in.Module, name); td != nil {
549+ + return td, nil
550+ + }
551+ + }
552+ }
553+ if prefix != "" {
554+ name = prefix + ":" + name
519555diff --git a/yang.go b/yang.go
520556index 2480a4e..515d1b3 100644
521557--- a/yang.go
0 commit comments