@@ -412,45 +412,54 @@ index 0000000..286a29c
412
412
+ }
413
413
+
414
414
diff --git a/pkg/yang/entry.go b/pkg/yang/entry.go
415
- index ef658d6..cd3b046 100644
415
+ index dfd4525..cdf6eb1 100644
416
416
--- a/pkg/yang/entry.go
417
417
+++ 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 {
419
427
420
428
// Fields associated with directory nodes
421
429
Dir map[string]*Entry `json:",omitempty"`
422
430
+ DirOKeys []string // Ordered Keys list in Dir
423
431
Key string `json:",omitempty"` // Optional key name for lists (i.e., maps)
424
432
425
433
// Fields associated with leaf nodes
426
- @@ -115,6 +116,10 @@ type Entry struct {
434
+ @@ -115,6 +117,11 @@ type Entry struct {
427
435
// the augmenting entity per RFC6020 Section 7.15.2. The namespace
428
436
// of the Entry should be accessed using the Namespace function.
429
437
namespace *Value
430
438
+
431
439
+ ChildSchemaCache map[reflect.StructTag]*Entry `json:"-"`
432
- +
440
+ + ChildSchemaMutex sync.RWMutex `json:"-"`
441
+ +
433
442
+ IsSchemaValidated bool `json:"-"`
434
443
}
435
444
436
445
// 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 {
438
447
return &Entry{
439
448
Kind: DirectoryEntry,
440
449
Dir: make(map[string]*Entry),
441
450
+ DirOKeys: make([]string, 0),
442
451
Node: n,
443
452
Name: n.NName(),
444
453
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 {
446
455
return e
447
456
}
448
457
e.Dir[key] = value
449
458
+ e.DirOKeys = append(e.DirOKeys, key)
450
459
return e
451
460
}
452
461
453
- @@ -1007 ,7 +1014 ,7 @@ func (e *Entry) ApplyDeviate() []error {
462
+ @@ -999 ,7 +1008 ,7 @@ func (e *Entry) ApplyDeviate() []error {
454
463
}
455
464
456
465
if devSpec.Default != "" {
@@ -459,15 +468,15 @@ index ef658d6..cd3b046 100644
459
468
}
460
469
461
470
if devSpec.Mandatory != TSUnset {
462
- @@ -1090 ,6 +1097 ,7 @@ func (e *Entry) FixChoice() {
471
+ @@ -1082 ,6 +1091 ,7 @@ func (e *Entry) FixChoice() {
463
472
}
464
473
ce.Parent = ne
465
474
e.Dir[k] = ne
466
475
+ e.DirOKeys = append(e.DirOKeys, k)
467
476
}
468
477
}
469
478
}
470
- @@ -1260 ,6 +1268 ,14 @@ func (e *Entry) shallowDup() *Entry {
479
+ @@ -1252 ,6 +1262 ,14 @@ func (e *Entry) shallowDup() *Entry {
471
480
// copied we will have to explicitly uncopy them.
472
481
ne := *e
473
482
@@ -482,7 +491,7 @@ index ef658d6..cd3b046 100644
482
491
// Now only copy direct children, clear their Dir, and fix up
483
492
// Parent pointers.
484
493
if e.Dir != nil {
485
- @@ -1283 ,6 +1299 ,14 @@ func (e *Entry) dup() *Entry {
494
+ @@ -1275 ,6 +1293 ,14 @@ func (e *Entry) dup() *Entry {
486
495
// to do that.
487
496
ne := *e
488
497
@@ -497,15 +506,15 @@ index ef658d6..cd3b046 100644
497
506
// Now recurse down to all of our children, fixing up Parent
498
507
// pointers as we go.
499
508
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) {
502
510
v.Parent = e
511
+ v.Exts = append(v.Exts, oe.Exts...)
503
512
e.Dir[k] = v
504
513
+ e.DirOKeys = append(e.DirOKeys, k)
505
514
}
506
515
}
507
516
}
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 {
509
518
}
510
519
return nless(fi[x], fj[x])
511
520
}
@@ -516,6 +525,33 @@ index ef658d6..cd3b046 100644
516
525
case -1:
517
526
return true
518
527
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
519
555
diff --git a/yang.go b/yang.go
520
556
index 2480a4e..515d1b3 100644
521
557
--- a/yang.go
0 commit comments