@@ -641,20 +641,40 @@ func (s *sharedEntryAttributes) Validate(ctx context.Context, errchan chan<- err
641641 }(c )
642642 }
643643
644- // TODO: Validate Mandatory is skipped for now, until we have running
645- // configuration information in the tree, to perform proper validation
646-
647- // // validate the mandatory statement on this entry
644+ // validate the mandatory statement on this entry
648645 if s .remainsToExist () {
649646 s .validateMandatory (errchan )
650647 s .validateLeafRefs (ctx , errchan )
651648 s .validateLeafListMinMaxAttributes (errchan )
652649 s .validatePattern (errchan )
653650 s .validateMustStatements (ctx , errchan )
654651 s .validateLength (errchan )
652+ s .validateRange (errchan )
655653 }
656654}
657655
656+ func (s * sharedEntryAttributes ) validateRange (errchan chan <- error ) {
657+
658+ lv := s .leafVariants .GetHighestPrecedence (false )
659+ if lv == nil {
660+ return
661+ }
662+
663+ tv , err := lv .Value ()
664+ if err != nil {
665+ errchan <- fmt .Errorf ("failed reading value from %s LeafVariant %v: %w" , s .Path (), lv , err )
666+ return
667+ }
668+
669+ if schema := s .schema .GetField (); schema != nil {
670+ for _ , rng := range schema .GetType ().Range {
671+ _ = tv
672+ _ = rng
673+ }
674+ }
675+
676+ }
677+
658678// validateLeafListMinMaxAttributes validates the Min-, and Max-Elements attribute of the Entry if it is a Leaflists.
659679func (s * sharedEntryAttributes ) validateLeafListMinMaxAttributes (errchan chan <- error ) {
660680 if schema := s .schema .GetLeaflist (); schema != nil {
@@ -679,14 +699,6 @@ func (s *sharedEntryAttributes) validateLeafListMinMaxAttributes(errchan chan<-
679699 }
680700}
681701
682- // func (s *sharedEntryAttributes) validateUnique(errchan chan<- error) {
683- // if schema := s.schema.GetLeaflist(); schema != nil {
684- // if schema. {
685- // return
686- // }
687- // }
688- // }
689-
690702func (s * sharedEntryAttributes ) validateLength (errchan chan <- error ) {
691703 if schema := s .schema .GetField (); schema != nil {
692704
0 commit comments