...
Grouping and uses
Overview
Grouping the nodes together, for reusing them at many places, can be done in YANG. Grouping the nodes is done by grouping statement and using those grouped nodes at different places is done by uses statement.
Java mapping
During YANG to java conversion, wherever the nodes under grouping are completely copied, wherever uses is present. Later the java file generation takes place according to the new yang nodes added. Grouping and uses itself will not have any impact in java file generationis present a class as similar as to that of a container is created.Wherever uses is present object of this class is used as an attribute.
Example
| Code Block | ||
|---|---|---|
| ||
File : Test.yang module Test { module Test { namespace "http://test.example.com/"; prefix "test"; organization "ACME Inc."; grouping endpoint { . leaf address .{ . type int32; grouping Percentage} { leaf port mark{ type Stringint8; } } container classroomconnection { container leafsource student{ typeuses Stringendpoint; } container destination { uses Percentage;endpoint; } } . . . } |
Choice and case
Overview
The choice statement defines a set of alternatives, only one of which may exist at any one time. The argument is an identifier, followed by a block of sub-statements that holds detailed choice information.
...