...
This is the kind of object (module) that gets created:
Generated Java Object Structures per Yang concept
...
The Class DataSchemaNode can represent a Yang Leaf, List or Container
Main data types
The package org.opendaylight.yangtools.yang.model.util.type contains classes for all the possible data types including:
- BaseBinaryType
- BaseBitsType
- BaseBooleanType
- BaseDecimalType
- BaseEnumerationType
- BaseInt8Type
- BaseInt16Type
- BaseInt32Type
- BaseInt64Type
- BaseStringType
- BaseUint8Type
- BaseUint16Type
- BaseUint32Type
- BaseUint64Type
There are also some special data types such as:
- BaseIdentityrefType
- BaseInstanceIdentifierType
- BaseLeafrefType
- BaseUnionType
Description | Yang | Java Object View | Notes |
---|---|---|---|
Datatypes and basic constraints | |||
Basic String |
|
Mandatory Basic String |
| ||
Limited String | leaf pnf-name { type string { length "0..256"; } | Specialized class to hold length limitation | |
typedef (String) with pattern |
| ||
Limited unint64 | leaf cid { type string { length "0..52"; } | ||
boolean with default value |
| ||
Unique | |||
Unique | list server { key "name"; unique "ip port"; leaf name { type string; } leaf ip { type dotted-quad; } leaf port { type uint32; } } | ||
Choice | |||
Choice | choice transfer-method { leaf transfer-interval { type uint64 { range "15..2880"; } units minutes; } leaf transfer-on-commit { type empty; } } | ||
Must | |||
Must | leaf ifType { type enumeration { enum ethernet; enum atm; } } leaf ifMTU { type uint32; } must "ifType != 'ethernet' or " + "(ifType = 'ethernet' and ifMTU = 1500)" { error-message 466px"An ethernet MTU must be 1500"; } | ||
When | |||
When | leaf a {
type boolean;
}
leaf b {
type string;
when "../a = 'true'";
} | ||
Extension | |||
Extension declaration | extension store-state-ext { argument duration; description "An extension to enable state-storage for any attribute. Use duration to specify how long: nnn h|d|y"; } | ||
Extension usage | leaf attribute-with-temporal-storage { type string; cm-notify-api:store-state-ext "3 d"; // store state 3 days } | extension is stored as 'UnknownNode' and refers back to the extension declaration | |
Augmentation | |||
augment "server" { when "port = '8787'"; leaf enable-debug { type boolean; } } |