ODLUX Update
[ccsdk/features.git] / sdnr / wt / odlux / apps / configurationApp / src / yang / yangParser.ts
index 85eeb41..14e3468 100644 (file)
@@ -491,7 +491,12 @@ export class YangParser {
   }
 
   public postProcess() {
-
+    // process all type refs
+    this._typeRefToResolve.forEach(cb => {
+      try { cb(); } catch (error) {
+        console.warn(error.message);
+      }
+    });
     /**
      * This is to fix the issue for sequential execution of modules based on their child and parent relationship
      * We are sorting the module object based on their augment status
@@ -580,7 +585,7 @@ export class YangParser {
         const identity = module.identities[idKey];
         if (identity.base != null) {
           const base = this.resolveIdentity(identity.base, module);
-          base.children?.push(identity);
+          base?.children?.push(identity);
         } else {
           baseIdentities.push(identity);
         }
@@ -596,12 +601,6 @@ export class YangParser {
       }
     });
 
-    this._typeRefToResolve.forEach(cb => {
-      try { cb(); } catch (error) {
-        console.warn(error.message);
-      }
-    });
-
     this._modulesToResolve.forEach(cb => {
       try { cb(); } catch (error) {
         console.warn(error.message);
@@ -622,8 +621,11 @@ export class YangParser {
       }
     });
 
+    const knownViews: ViewSpecification[] = [];
     // resolve readOnly
     const resolveReadOnly = (view: ViewSpecification, parentConfig: boolean) => {
+      if (knownViews.includes(view)) return;
+      knownViews.push(view);
 
       // update view config
       view.config = view.config && parentConfig;
@@ -1622,4 +1624,4 @@ export class YangParser {
       : module.identities[identityName];
 
   }
-}
\ No newline at end of file
+}