Refactored parsing of YANG uses statement.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-impl / src / test / resources / model / testfile2.yang
index 15685f75a1b1c55ac50f608a66f055df7f522fbd..b25f65e4a45705d1ff6326987303cc2bf562c3b8 100644 (file)
@@ -3,19 +3,15 @@ module types2 {
     namespace "urn:simple.types.data.demo";
     prefix "t2";
     
-    import types1 {
-         prefix "if";
-         revision-date 2013-02-27;
-     }
-
     organization "opendaylight";
-    contact "WILL-BE-DEFINED-LATER";
+    contact "http://www.opendaylight.org/";
+    
     description "This is types-data test description";
 
     revision "2013-02-27" {
         reference " WILL BE DEFINED LATER";
     }
-    
+
     typedef my-base-int32-type {
         type int32 {
             range "2..20";
@@ -24,22 +20,22 @@ module types2 {
 
     typedef my-type1 {
         type my-base-int32-type {
-            range "11..max";
+            range "3..9|11..max";
         }
         units "mile";
         default "11";
     }
-    
+
     typedef my-custom-string {
         type string {
             pattern "[a-k]*";
             length "5..11";
         }
     }
-    
+
     typedef my-string-type {
         type my-custom-string {
-            length "5..10";
+            length "6..10";
         }
     }
     
@@ -60,25 +56,25 @@ module types2 {
             range "10..20";
         }
     }
-    
+
     typedef my-int-type2 {
         type my-int-type {
             range "12..18";
         }
     }
-    
+
     typedef my-int-type-ext {
         type my-int-type2 {
             range "14..16";
         }
     }
-    
+
     typedef my-decimal-type {
         type decimal64 {
             fraction-digits 6;
         }
     }
-    
+
     typedef my-decimal-type-ext {
         type decimal64 {
             fraction-digits 5;
@@ -86,32 +82,25 @@ module types2 {
     }
 
     typedef my-union {
-       type union {
-               type int16 {
-                       range "1..100";
-               }
-               type int32;
-       }
+        type union {
+            type int16 {
+                range "1..100";
+            }
+            type int32;
+        }
     }
 
     typedef my-union-ext {
-       type my-union;
+        type my-union;
     }
 
     typedef nested-union1 {
-       type nested-union2;
+        type nested-union2;
     }
 
     typedef nested-union2 {
-       type union {
-               type my-union-ext;
-               type string;
-       }
-    }
-
-    augment "/if:interfaces/if:ifEntry" {
-        when "if:ifType='ds0'";
-        leaf ds0ChannelNumber {
+        type union {
+            type my-union-ext;
             type string;
         }
     }
@@ -121,15 +110,21 @@ module types2 {
             path "/interface/name";
         }
     }
-     
+
     leaf name {
         type string;
     }
-     
+
+    leaf count {
+        type int8 {
+            range "1..10";
+        }
+    }
+
     leaf nested-type-leaf {
         type my-type1;
     }
-    
+
     extension c-define {
         description
         "Takes as argument a name string.
@@ -139,11 +134,124 @@ module types2 {
             yin-element "true";
         }
     }
-    
+
     container system {
         leaf user {
             type string;
         }
     }
 
+    grouping target {
+        anyxml data {
+            config true;
+            description "Copy of the source datastore subset.";
+            mandatory false;
+            must "test-condition-text";
+            reference "test-no-reference";
+            status "obsolete";
+            when "test-when-text";
+        }
+        choice how {
+            description "test choice description";
+            default interval;
+            case interval {
+                leaf interval {
+                    type uint16;
+                    default 30;
+                    units minutes;
+                }
+            }
+            case daily {
+                leaf daily {
+                    type empty;
+                }
+                leaf time-of-day {
+                    type string;
+                    units 24-hour-clock;
+                    default 1am;
+                }
+            }
+        }
+        leaf address {
+            type string;
+            description "Target IP address";
+        }
+        container port {
+            description "Target port container";
+        }
+        list addresses {
+            key "id";
+            leaf id {
+                type int8;
+            }
+        }
+        grouping target-inner {
+            description "target-inner default description";
+            leaf inner-grouping-id {
+                type int8;
+            }
+        }
+        typedef group-type {
+            type my-decimal-type;
+        }
+
+        opendaylight;
+    }
+
+    container peer {
+        container destination {
+            uses target {
+                refine address {
+                    default "1.2.3.4";
+                    description "IP address of target node";
+                    reference "address reference added by refine";
+                    config false;
+                    mandatory true;
+                    must "ifType != 'ethernet' or " +
+                            "(ifType = 'ethernet' and ifMTU = 1500)" {
+                        error-message "An ethernet MTU must be 1500";
+                    }
+                }
+                refine port {
+                    description "description of port defined by refine";
+                    reference "port reference added by refine";
+                    config false;
+                    presence "presence is required";
+                }
+                refine addresses {
+                    description "description of addresses defined by refine";
+                    reference "addresses reference added by refine";
+                    config false;
+                    min-elements 2;
+                    max-elements 12;
+                }
+                refine target-inner {
+                    description "new target-inner grouping description";
+                }
+                refine group-type {
+                    description "new group-type description";
+                    reference "new group-type reference";
+                }
+            }
+        }
+    }
+
+    container interfaces {
+         list ifEntry {
+             key "ifIndex";
+
+             leaf ifIndex {
+                 type uint32;
+                 units minutes;
+             }
+
+             leaf ifMtu {
+                 type int32;
+             }
+
+             min-elements 1;
+             max-elements 11;
+         }
+    }
+
 }