| module example-schema { |
| yang-version 1.1; |
| prefix aha; |
| namespace "http://example.com"; |
| |
| import other-module { |
| prefix other; |
| } |
| |
| container inventory { |
| container stuff { |
| presence true; |
| } |
| } |
| |
| leaf leafUInt8 { |
| type uint8; |
| } |
| |
| leaf leafUInt16 { |
| type uint16; |
| } |
| |
| leaf leafUInt32 { |
| type uint32; |
| } |
| |
| leaf leafUInt64 { |
| type uint64; |
| } |
| |
| leaf leafInt8 { |
| type int8; |
| } |
| |
| leaf leafInt16 { |
| type int16; |
| } |
| |
| leaf leafInt32 { |
| type int32; |
| } |
| |
| leaf leafInt64 { |
| type int64; |
| } |
| |
| leaf leafString { |
| type string; |
| } |
| |
| leaf leafEnum { |
| type enumeration { |
| enum lol; |
| enum data; |
| enum coze; |
| } |
| } |
| |
| leaf leafDecimal { |
| units "nm"; |
| type decimal64 { |
| fraction-digits 9; |
| } |
| } |
| |
| container pContainer { |
| presence true; |
| } |
| |
| list person { |
| key 'name'; |
| leaf name { |
| type string; |
| } |
| } |
| |
| leaf bossPerson { |
| type leafref { |
| path '../aha:person/name'; |
| } |
| } |
| |
| leaf unionIntString { |
| type union { |
| type int32; |
| type string; |
| } |
| } |
| |
| typedef myType { |
| type int32; |
| description "My type."; |
| } |
| |
| leaf typedefedLeaf { |
| type myType; |
| description "This is a typedefed leaf."; |
| } |
| |
| grouping upAndDown { |
| leaf up { |
| type boolean; |
| } |
| leaf down { |
| type boolean; |
| } |
| } |
| |
| uses upAndDown; |
| |
| container lol { |
| uses upAndDown; |
| } |
| |
| grouping targets_def { |
| list targets { |
| key 'city'; |
| leaf city { |
| type string; |
| } |
| } |
| } |
| |
| rpc fire { |
| input { |
| leaf whom { |
| type leafref { |
| path '/aha:person/name'; |
| } |
| } |
| } |
| } |
| |
| rpc launch-nukes { |
| input { |
| container payload { |
| leaf kilotons { |
| type uint64; |
| mandatory true; |
| units "kilotons"; |
| } |
| } |
| leaf description { |
| type string; |
| } |
| container cities { |
| presence true; |
| uses targets_def; |
| } |
| } |
| output { |
| leaf blast-radius { |
| type uint32; |
| units "m"; |
| } |
| leaf actual-yield { |
| type uint64; |
| units "kilotons"; |
| } |
| container damaged-places { |
| presence true; |
| uses targets_def; |
| } |
| } |
| } |
| |
| rpc noop {} |
| |
| rpc setIp { |
| input { |
| leaf ip { |
| mandatory true; |
| type string; |
| } |
| } |
| } |
| |
| list selectedNumbers { |
| key 'value'; |
| leaf value { |
| type int8; |
| } |
| } |
| |
| list animalWithColor { |
| key 'name color'; |
| leaf name { |
| type string; |
| } |
| leaf color { |
| type string; |
| } |
| } |
| |
| list ports { |
| key 'name'; |
| leaf name { |
| type enumeration { |
| enum A; |
| enum B; |
| enum C; |
| enum D; |
| enum E; |
| } |
| } |
| |
| action shutdown { |
| input { |
| leaf force { |
| mandatory true; |
| type boolean; |
| } |
| } |
| output { |
| leaf success { |
| mandatory true; |
| type boolean; |
| } |
| } |
| } |
| } |
| |
| list org { |
| key 'department'; |
| leaf department { |
| type string; |
| } |
| |
| list people { |
| key 'name'; |
| leaf name { |
| type string; |
| } |
| |
| list computers { |
| key 'type'; |
| leaf type { |
| type enumeration { |
| enum PC; |
| enum laptop; |
| enum server; |
| } |
| } |
| } |
| } |
| } |
| |
| augment "/other:parking-lot" { |
| list cars { |
| key 'id'; |
| leaf id { |
| type int32; |
| } |
| } |
| } |
| |
| leaf temperature { |
| type int32; |
| config false; |
| } |
| |
| identity Animal { |
| } |
| |
| identity Mammal { |
| base "Animal"; |
| } |
| |
| identity Dog { |
| base "Mammal"; |
| } |
| |
| identity Whale { |
| base "Mammal"; |
| } |
| |
| identity Velociraptor { |
| base "Animal"; |
| } |
| |
| leaf beast { |
| type identityref { |
| base "Animal"; |
| } |
| } |
| |
| leaf blob { |
| type binary; |
| } |
| |
| leaf dummy { |
| type empty; |
| } |
| |
| leaf-list addresses { |
| type string; |
| } |
| |
| leaf-list protocols { |
| type string; |
| ordered-by user; |
| } |
| |
| list players { |
| key "name"; |
| ordered-by user; |
| leaf name { |
| type string; |
| } |
| } |
| |
| list point { |
| key "x y"; |
| leaf x { |
| type int32; |
| } |
| leaf y { |
| type int32; |
| } |
| } |
| |
| leaf flags { |
| type bits { |
| bit carry; |
| bit zero; |
| bit sign; |
| bit parity; |
| } |
| } |
| |
| container users { |
| config false; |
| list userList { |
| leaf name { |
| type string; |
| } |
| leaf otherfield { |
| type string; |
| } |
| } |
| } |
| |
| } |