Vinod Kumar S | cf04442 | 2016-02-09 19:53:45 +0530 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2016 Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.yangutils.datamodel; |
| 18 | |
| 19 | /** |
| 20 | * ENUM to identify the YANG data type. |
| 21 | */ |
| 22 | public enum YangDataTypes { |
| 23 | /** |
| 24 | * Reference:RFC 6020. |
| 25 | * int8 represents integer values between -128 and 127, inclusively. |
| 26 | */ |
| 27 | INT8, |
| 28 | |
| 29 | /** |
| 30 | * Reference:RFC 6020. |
| 31 | * int16 represents integer values between -32768 and 32767, inclusively. |
| 32 | */ |
| 33 | INT16, |
| 34 | |
| 35 | /** |
| 36 | * Reference:RFC 6020. |
| 37 | * int32 represents integer values between -2147483648 and 2147483647, |
| 38 | * inclusively. |
| 39 | */ |
| 40 | INT32, |
| 41 | |
| 42 | /** |
| 43 | * Reference:RFC 6020. |
| 44 | * int64 represents integer values between -9223372036854775808 and |
| 45 | * 9223372036854775807, inclusively. |
| 46 | */ |
| 47 | INT64, |
| 48 | |
| 49 | /** |
| 50 | * Reference:RFC 6020. |
| 51 | * uint8 represents integer values between 0 and 255, inclusively. |
| 52 | */ |
| 53 | UINT8, |
| 54 | |
| 55 | /** |
| 56 | * Reference:RFC 6020. |
| 57 | * uint16 represents integer values between 0 and 65535, inclusively. |
| 58 | */ |
| 59 | UINT16, |
| 60 | |
| 61 | /** |
| 62 | * Reference:RFC 6020. |
| 63 | * uint32 represents integer values between 0 and 4294967295, inclusively. |
| 64 | */ |
| 65 | UINT32, |
| 66 | |
| 67 | /** |
| 68 | * Reference:RFC 6020. |
| 69 | * uint64 represents integer values between 0 and 18446744073709551615, |
| 70 | * inclusively. |
| 71 | */ |
| 72 | UINT64, |
| 73 | |
| 74 | /** |
| 75 | * Reference:RFC 6020. |
| 76 | * The decimal64 type represents a subset of the real numbers, which can be |
| 77 | * represented by decimal numerals. The value space of decimal64 is the set |
| 78 | * of numbers that can be obtained by multiplying a 64-bit signed integer by |
| 79 | * a negative power of ten, i.e., expressible as "i x 10^-n" where i is an |
| 80 | * integer64 and n is an integer between 1 and 18, inclusively. |
| 81 | */ |
| 82 | DECIMAL64, // TODO: need to implement in type. |
| 83 | |
| 84 | /** |
| 85 | * Reference:RFC 6020. |
| 86 | * The string built-in type represents human-readable strings in YANG. Legal |
| 87 | * characters are tab, carriage return, line feed, and the legal characters |
| 88 | * of Unicode and ISO/IEC 10646 |
| 89 | */ |
| 90 | STRING, |
| 91 | |
| 92 | /** |
| 93 | * Reference:RFC 6020. |
| 94 | * The boolean built-in type represents a boolean value. |
| 95 | */ |
| 96 | BOOLEAN, |
| 97 | |
| 98 | /** |
| 99 | * Reference:RFC 6020. |
| 100 | * The enumeration built-in type represents values from a set of assigned |
| 101 | * names. |
| 102 | */ |
| 103 | ENUMERATION, |
| 104 | |
| 105 | /** |
| 106 | * Reference:RFC 6020. |
| 107 | * The bits built-in type represents a bit set. That is, a bits value is a |
| 108 | * set of flags identified by small integer position numbers starting at 0. |
| 109 | * Each bit number has an assigned name. |
| 110 | */ |
| 111 | BITS, |
| 112 | |
| 113 | /** |
| 114 | * Reference:RFC 6020. |
| 115 | * The binary built-in type represents any binary data, i.e., a sequence of |
| 116 | * octets. |
| 117 | */ |
| 118 | BINARY, |
| 119 | |
| 120 | /** |
| 121 | * Reference:RFC 6020. |
| 122 | * The leafref type is used to reference a particular leaf instance in the |
| 123 | * data tree. The "path" sub-statement (Section 9.9.2) selects a set of leaf |
| 124 | * instances, and the leafref value space is the set of values of these leaf |
| 125 | * instances. |
| 126 | * |
| 127 | * If the leaf with the leafref type represents configuration data, the leaf |
| 128 | * it refers to MUST also represent configuration. Such a leaf puts a |
| 129 | * constraint on valid data. All leafref nodes MUST reference existing leaf |
| 130 | * instances or leafs with default values in use for the data to be valid. |
| 131 | * |
| 132 | * There MUST NOT be any circular chains of leafrefs. |
| 133 | * |
| 134 | * If the leaf that the leafref refers to is conditional based on one or |
| 135 | * more features, then the leaf with the leafref type MUST also be |
| 136 | * conditional based on at least the same set of features. |
| 137 | */ |
| 138 | LEAFREF, // TODO: need to implement in type. |
| 139 | |
| 140 | /** |
| 141 | * Reference:RFC 6020. |
| 142 | * The identityref type is used to reference an existing identity. |
| 143 | */ |
| 144 | IDENTITYREF, |
| 145 | |
| 146 | /** |
| 147 | * Reference:RFC 6020. |
| 148 | * The empty built-in type represents a leaf that does not have any value, |
| 149 | * it conveys information by its presence or absence. |
| 150 | * |
| 151 | * An empty type cannot have a default value. |
| 152 | */ |
| 153 | EMPTY, |
| 154 | |
| 155 | /** |
| 156 | * Reference:RFC 6020. |
| 157 | * The union built-in type represents a value that corresponds to one of its |
| 158 | * member types. |
| 159 | * |
| 160 | * When the type is "union", the "type" statement MUST be present. It is |
| 161 | * used to repeatedly specify each member type of the union. It takes as an |
| 162 | * argument a string that is the name of a member type. |
| 163 | * |
| 164 | * A member type can be of any built-in or derived type, except it MUST NOT |
| 165 | * be one of the built-in types "empty" or "leafref". |
| 166 | * |
| 167 | * When a string representing a union data type is validated, the string is |
| 168 | * validated against each member type, in the order they are specified in |
| 169 | * the "type" statement, until a match is found. |
| 170 | * |
| 171 | * Any default value or "units" property defined in the member types is not |
| 172 | * inherited by the union type. |
| 173 | */ |
| 174 | UNION, |
| 175 | |
| 176 | /** |
| 177 | * Reference:RFC 6020. |
| 178 | * The instance-identifier built-in type is used to uniquely identify a |
| 179 | * particular instance node in the data tree. |
| 180 | * |
| 181 | * The syntax for an instance-identifier is a subset of the XPath |
| 182 | * abbreviated syntax, formally defined by the rule "instance-identifier". |
| 183 | * It is used to uniquely identify a node in the data tree. Predicates are |
| 184 | * used only for specifying the values for the key nodes for list entries, a |
| 185 | * value of a leaf-list entry, or a positional index for a list without |
| 186 | * keys. For identifying list entries with keys, each predicate consists of |
| 187 | * one equality test per key, and each key MUST have a corresponding |
| 188 | * predicate. |
| 189 | * |
| 190 | * If the leaf with the instance-identifier type represents configuration |
| 191 | * data, and the "require-instance" property is "true", the node it refers |
| 192 | * to MUST also represent configuration. Such a leaf puts a constraint on |
| 193 | * valid data. All such leaf nodes MUST reference existing nodes or leaf |
| 194 | * nodes with their default value in use for the data to be valid. |
| 195 | */ |
| 196 | INSTANCE_IDENTIFIER, |
| 197 | |
| 198 | /** |
| 199 | * Derived Data type. |
| 200 | */ |
| 201 | DERIVED |
| 202 | } |