Skip to content

A few YANG validation errors #16

@wezhou-ciena

Description

@wezhou-ciena

While experimenting with the SDK's YANG modules, we've encountered following YANG validation errors in pyang:

('nrm-oam.yang:67 (at nrm-oam.yang:905)', 'AUGMENT_MANDATORY', u'ifdv-1-bin'
('nrm-oam.yang:67 (at nrm-oam.yang:921)', 'AUGMENT_MANDATORY', u'fdr-1-bin'
('nrm-oam.yang:67 (at nrm-oam.yang:951)', 'AUGMENT_MANDATORY', u'fd-1-bin'
('nrm-oam.yang:151 (at nrm-oam.yang:663)', 'AUGMENT_MANDATORY', u'fd-2-bin'
('nrm-oam.yang:151 (at nrm-oam.yang:684)', 'AUGMENT_MANDATORY', u'ifdv-1-fw-bin'
('nrm-oam.yang:151 (at nrm-oam.yang:700)', 'AUGMENT_MANDATORY', u'ifdv-1-bk-bin'
('nrm-oam.yang:151 (at nrm-oam.yang:716)', 'AUGMENT_MANDATORY', u'fdr-1-fw-bin'
('nrm-oam.yang:151 (at nrm-oam.yang:732)', 'AUGMENT_MANDATORY', u'fdr-1-bk-bin'
('nrm-oam.yang:151 (at nrm-oam.yang:628)', 'AUGMENT_MANDATORY', u'fd-1-fw-bin'
('nrm-oam.yang:151 (at nrm-oam.yang:644)', 'AUGMENT_MANDATORY', u'fd-1-bk-bin'
('nrp-interface.yang:31', 'NODE_NOT_FOUND', (u'tapi-connectivity', u'connectivity-service')
('nrp-interface.yang:39', 'NODE_NOT_FOUND', (u'tapi-connectivity', u'connectivity-service')
('nrp-interface.yang:84', 'NODE_NOT_FOUND', (u'tapi-connectivity', u'service')
('nrp-interface.yang:88', 'NODE_NOT_FOUND', (u'tapi-connectivity', u'service')

Some preliminary investigation suggests three possible issues (some with multiple occurrences) exists in some of the YANG modules:

  1. AUGMENT_MANDATORY errors
  65     augment "/tapi-common:context/tapi-oam:oam-context/tapi-oam:oam-job/tapi-oam:pm-current-data/tapi-oam:pm-history-data/tapi     -eth:eth-on-demand-1-dm-performance-data" {
  66         container carrier-eth-oam-pm-2-fd-resource {
  67             uses carrier-eth-oam-pm-2-fd-resource;
  68             description "none";
  69         }
  70         description "none";
  71     }
…
 902         grouping carrier-eth-oam-pm-2-fd-resource {
 903             list ifdv-1-bin {
 904                 config false;
 905                 min-elements 1;
 906                 uses metric-per-bin;
 907                 description "MEF 35.1: A 32-bit counter per Measurement Bin that counts the number of IFDV measurements that f     all within the configured bin.";
 908             }

The validation error seems to suggest that it is not allowed to augment without condition with a mandatory list (min-element), perhaps a when condition is required?

  1. NODE_NOT_FOUND
 31     augment "/tapi-common:context/tapi-connectivity:connectivity-service" {
 32         uses nrp-connectivity-service-attrs;
 33         description "none";
 34     }

This seems to be just an error in the YANG definition, as the connectivity-service is under the path of context/connectivity-context/connectivity-service, it seem that the nrp-interface module’s augmentation statement just missed the intermediate connectivity-context

  1. NODE_NOT_FOUND
 84     augment "/tapi-connectivity:delete-connectivity-service/tapi-connectivity:output/tapi-connectivity:service" {
 85         uses nrp-connectivity-service-attrs;
 86         description "none";
 87     }

This is a bit different, the augmentation statement is attempting to augment the service object under output in the delete-connectivity-service definition, while in the actual RPC definition of delete-connectivity-service in the newer version of the tapi-connectivity module, there is no output object:

724         rpc delete-connectivity-service {
725             description "none";
726             input {
727                 leaf service-id-or-name {
728                     type string;
729                     description "none";
730                 }
731             }
732         }

To workaround the problem, we implemented following changes (but not necessarily the correct fixes IMO) to confirm our conclusiion, just for reference here:

vagrant@vagrant:~/shared/bpo-tapi-model-app$ git diff
diff --git a/yangmodels/tapi/presto/nrm-oam.yang b/yangmodels/tapi/presto/nrm-oam.yang
index 58c26d6..f9fd45b 100644
--- a/yangmodels/tapi/presto/nrm-oam.yang
+++ b/yangmodels/tapi/presto/nrm-oam.yang
@@ -625,7 +625,7 @@ module nrm-oam {
         grouping carrier-eth-oam-pm-fd-synch-resource {
             list fd-1-fw-bin {
                 config false;
-                min-elements 1;
+                // min-elements 1;
                 uses metric-per-bin;
                 description "MEF 35.1: A 32-bit counter per Measurement Bin that counts the number of One-way FD measurements in the Forward direction that fall within the configured bin.";
             }
@@ -641,7 +641,7 @@ module nrm-oam {
             }
             list fd-1-bk-bin {
                 config false;
-                min-elements 1;
+                // min-elements 1;
                 uses metric-per-bin;
                 description "MEF 35.1: A 32-bit counter per Measurement Bin that counts the number of One-way FD measurements in the Backward direction that fall within the configured bin.";
             }
@@ -660,7 +660,7 @@ module nrm-oam {
         grouping carrier-eth-oam-pm-fd-resource {
             list fd-2-bin {
                 config false;
-                min-elements 1;
+                // min-elements 1;
                 uses metric-per-bin;
                 description "MEF 35.1: A 32-bit counter per Measurement Bin that counts the number of FD measurements that fall within the configured range.";
             }
@@ -681,7 +681,7 @@ module nrm-oam {
             }
             list ifdv-1-fw-bin {
                 config false;
-                min-elements 1;
+                // min-elements 1;
                 uses metric-per-bin;
                 description "MEF 35.1: A 32-bit counter per Measurement Bin that counts the number of IFDV measurements (i.e., each instance of |Di – Dj| in the Forward direction) that fall within a configured bin.";
             }
@@ -697,7 +697,7 @@ module nrm-oam {
             }
             list ifdv-1-bk-bin {
                 config false;
-                min-elements 1;
+                // min-elements 1;
                 uses metric-per-bin;
                 description "MEF 35.1: A 32-bit counter per Measurement Bin that counts the number of IFDV measurements in the Backward direction that fall within a configured bin.";
             }
@@ -713,7 +713,7 @@ module nrm-oam {
             }
             list fdr-1-fw-bin {
                 config false;
-                min-elements 1;
+                // min-elements 1;
                 uses metric-per-bin;
                 description "MEF 35.1: A 32-bit counter per Measurement Bin that counts the number of FDR measurements in the Forward direction that fall within a configured bin.";
             }
@@ -729,7 +729,7 @@ module nrm-oam {
             }
             list fdr-1-bk-bin {
                 config false;
-                min-elements 1;
+                // min-elements 1;
                 uses metric-per-bin;
                 description "MEF 35.1: A 32-bit counter per Measurement Bin that counts the number of FDR measurements in the Backward direction that fall within a configured bin.";
             }
@@ -902,7 +902,7 @@ module nrm-oam {
         grouping carrier-eth-oam-pm-2-fd-resource {
             list ifdv-1-bin {
                 config false;
-                min-elements 1;
+                // min-elements 1;
                 uses metric-per-bin;
                 description "MEF 35.1: A 32-bit counter per Measurement Bin that counts the number of IFDV measurements that fall within the configured bin.";
             }
@@ -918,7 +918,7 @@ module nrm-oam {
             }
             list fdr-1-bin {
                 config false;
-                min-elements 1;
+                // min-elements 1;
                 uses metric-per-bin;
                 description "MEF 35.1: A 32-bit counter per Measurement Bin that counts the number of FDR measurements that fall within a configured bin.";
             }
@@ -948,7 +948,7 @@ module nrm-oam {
         grouping carrier-eth-oam-pm-2-fd-synch-resource {
             list fd-1-bin {
                 config false;
-                min-elements 1;
+                // min-elements 1;
                 uses metric-per-bin;
                 description "MEF 35.1: A 32-bit counter per Measurement Bin that counts the number of One-way FD measurements that fall within the configured bin.";
             }
diff --git a/yangmodels/tapi/presto/nrp-interface.yang b/yangmodels/tapi/presto/nrp-interface.yang
index 6c4e86d..461e32b 100644
--- a/yangmodels/tapi/presto/nrp-interface.yang
+++ b/yangmodels/tapi/presto/nrp-interface.yang
@@ -28,7 +28,7 @@ module nrp-interface {
         uses nrp-connectivity-service-end-point-attrs;
         description "none";
     }
-    augment "/tapi-common:context/tapi-connectivity:connectivity-service" {
+    augment "/tapi-common:context/tapi-connectivity:connectivity-context/tapi-connectivity:connectivity-service" {
         uses nrp-connectivity-service-attrs;
         description "none";
     }
@@ -36,7 +36,7 @@ module nrp-interface {
         uses nrp-connectivity-service-end-point-attrs;
         description "none";
     }
-    augment "/tapi-common:context/tapi-connectivity:connectivity-service/tapi-connectivity:end-point" {
+    augment "/tapi-common:context/tapi-connectivity:connectivity-context/tapi-connectivity:connectivity-service/tapi-connectivity:end-point" {
         uses nrp-connectivity-service-end-point-attrs;
         description "none";
     }
diff --git a/yangmodels/tapi/presto/tapi-connectivity.yang b/yangmodels/tapi/presto/tapi-connectivity.yang
index bffe94e..e2e84dc 100644
--- a/yangmodels/tapi/presto/tapi-connectivity.yang
+++ b/yangmodels/tapi/presto/tapi-connectivity.yang
@@ -729,6 +729,12 @@ module tapi-connectivity {
                     description "none";
                 }
             }
+            output {
+                container service {
+                    uses connectivity-service;
+                    description "none";
+                }
+            }
         }
 
 }

With the above changes, we no longer observed the validation errors mentioned above via pyang.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions