github.com/openconfig/goyang@v1.4.5/testdata/base.yang (about) 1 // Copyright 2015 Google Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Base test yang module. 16 module base { 17 namespace "urn:mod"; 18 prefix "base"; 19 20 include sub; 21 import other { 22 prefix bother; 23 } 24 25 // basic type tests 26 typedef base-type { type int32; } 27 leaf base-leaf1 { type base-type; } 28 leaf base-leaf2 { type base:base-type; } 29 leaf base-leaf3 { type bother:other-type; } 30 leaf base-leaf4 { type sub-type; } 31 32 grouping base-group { 33 description 34 "The base-group is used to test the 'uses' statement below. 35 This description is here to simply include a multi-line string 36 as an example of multi-line strings"; 37 leaf base-group-leaf { 38 config false; 39 type string; 40 } 41 } 42 43 // test uses and leaf ref 44 container base-container-1 { 45 uses base-group; 46 uses bother:other-group; 47 uses base:sub-group; 48 choice base-choice { 49 case choice-a { 50 leaf base-choice-a1 { type string; } 51 leaf base-choice-a2 { 52 type leafref { path ../base-container-1-leaf; } 53 } 54 } 55 case choice-b { 56 leaf base-choice-b1 { type string; } 57 leaf base-choice-b2 { 58 type leafref { path ../../base-container-2/base-container-2a/base-container-2a-leaf; } 59 } 60 } 61 } 62 leaf base-container-1-leaf { type string; } 63 } 64 65 // container referenced by a leafref above 66 container base-container-2 { 67 container base-container-2a { 68 leaf base-container-2a-leaf { type string; } 69 } 70 } 71 72 // test basic augmenting 73 augment /base-container-1/base-choice/choice-a { 74 leaf base-choice-a3 { type string; } 75 } 76 augment /base-container-1/base-choice { 77 case choice-c { 78 leaf base-choice-c1 { type string; } 79 } 80 } 81 82 // simple extension test 83 extension base-ext { 84 argument base-arg; 85 } 86 container ext-container { 87 config false; 88 leaf ext-container-leaf { type string; } 89 base:base-ext "EXTENSION" { 90 leaf base-ext-leaf { type string; } 91 } 92 } 93 }