Thomas Vachuska | 6655bee | 2017-08-24 16:12:59 -0700 | [diff] [blame^] | 1 | module openconfig-vlan { |
| 2 | |
| 3 | yang-version "1"; |
| 4 | |
| 5 | // namespace |
| 6 | namespace "http://openconfig.net/yang/vlan"; |
| 7 | |
| 8 | prefix "oc-vlan"; |
| 9 | |
| 10 | // import some basic types |
| 11 | import openconfig-vlan-types { prefix oc-vlan-types; } |
| 12 | import openconfig-interfaces { prefix oc-if; } |
| 13 | import openconfig-if-ethernet { prefix oc-eth; } |
| 14 | import openconfig-if-aggregate { prefix oc-lag; } |
| 15 | import iana-if-type { prefix ift; } |
| 16 | import openconfig-extensions { prefix oc-ext; } |
| 17 | |
| 18 | // meta |
| 19 | organization "OpenConfig working group"; |
| 20 | |
| 21 | contact |
| 22 | "OpenConfig working group |
| 23 | netopenconfig@googlegroups.com"; |
| 24 | |
| 25 | description |
| 26 | "This module defines configuration and state variables for VLANs, |
| 27 | in addition to VLAN parameters associated with interfaces"; |
| 28 | |
| 29 | oc-ext:openconfig-version "2.0.0"; |
| 30 | |
| 31 | revision "2017-07-14" { |
| 32 | description |
| 33 | "Move top-level vlan data to network-instance; Update |
| 34 | identities to comply to style guide; fixed pattern |
| 35 | quoting; corrected trunk vlan types; added TPID config to |
| 36 | base interface."; |
| 37 | reference "2.0.0"; |
| 38 | } |
| 39 | |
| 40 | revision "2016-05-26" { |
| 41 | description |
| 42 | "OpenConfig public release"; |
| 43 | reference "1.0.2"; |
| 44 | } |
| 45 | |
| 46 | // grouping statements |
| 47 | |
| 48 | grouping vlan-config { |
| 49 | description "VLAN configuration container."; |
| 50 | |
| 51 | leaf vlan-id { |
| 52 | type oc-vlan-types:vlan-id; |
| 53 | description "Interface VLAN id."; |
| 54 | } |
| 55 | |
| 56 | leaf name { |
| 57 | type string; |
| 58 | description "Interface VLAN name."; |
| 59 | } |
| 60 | |
| 61 | leaf status { |
| 62 | type enumeration { |
| 63 | enum ACTIVE { |
| 64 | description "VLAN is active"; |
| 65 | } |
| 66 | enum SUSPENDED { |
| 67 | description "VLAN is inactive / suspended"; |
| 68 | } |
| 69 | } |
| 70 | default ACTIVE; |
| 71 | description "Admin state of the VLAN"; |
| 72 | } |
| 73 | |
| 74 | } |
| 75 | |
| 76 | grouping vlan-state { |
| 77 | description "State variables for VLANs"; |
| 78 | |
| 79 | // placeholder |
| 80 | |
| 81 | } |
| 82 | |
| 83 | grouping vlan-tpid-config { |
| 84 | description |
| 85 | "TPID configuration for dot1q-enabled interfaces"; |
| 86 | |
| 87 | leaf tpid { |
| 88 | type identityref { |
| 89 | base oc-vlan-types:TPID_TYPES; |
| 90 | } |
| 91 | default oc-vlan-types:TPID_0X8100; |
| 92 | description |
| 93 | "Optionally set the tag protocol identifier field (TPID) that |
| 94 | is accepted on the VLAN"; |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | grouping vlan-tpid-state { |
| 99 | description |
| 100 | "TPID opstate for dot1q-enabled interfaces"; |
| 101 | |
| 102 | // placeholder |
| 103 | |
| 104 | } |
| 105 | |
| 106 | grouping vlan-members-state { |
| 107 | description |
| 108 | "List of interfaces / subinterfaces belonging to the VLAN."; |
| 109 | |
| 110 | container members { |
| 111 | description |
| 112 | "Enclosing container for list of member interfaces"; |
| 113 | |
| 114 | list member { |
| 115 | config false; |
| 116 | description |
| 117 | "List of references to interfaces / subinterfaces |
| 118 | associated with the VLAN."; |
| 119 | |
| 120 | uses oc-if:base-interface-ref-state; |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | grouping vlan-switched-config { |
| 126 | description |
| 127 | "VLAN related configuration that is part of the physical |
| 128 | Ethernet interface."; |
| 129 | |
| 130 | leaf interface-mode { |
| 131 | type oc-vlan-types:vlan-mode-type; |
| 132 | description |
| 133 | "Set the interface to access or trunk mode for |
| 134 | VLANs"; |
| 135 | } |
| 136 | |
| 137 | leaf native-vlan { |
| 138 | when "interface-mode = 'TRUNK'" { |
| 139 | description |
| 140 | "Native VLAN is valid for trunk mode interfaces"; |
| 141 | } |
| 142 | type oc-vlan-types:vlan-id; |
| 143 | description |
| 144 | "Set the native VLAN id for untagged frames arriving on |
| 145 | a trunk interface. Tagged frames sent on an interface |
| 146 | configured with a native VLAN should have their tags |
| 147 | stripped prior to transmission. This configuration is only |
| 148 | valid on a trunk interface."; |
| 149 | } |
| 150 | |
| 151 | leaf access-vlan { |
| 152 | when "interface-mode = 'ACCESS'" { |
| 153 | description |
| 154 | "Access VLAN assigned to the interfaces"; |
| 155 | } |
| 156 | type oc-vlan-types:vlan-id; |
| 157 | description |
| 158 | "Assign the access vlan to the access port."; |
| 159 | } |
| 160 | |
| 161 | leaf-list trunk-vlans { |
| 162 | when "interface-mode = 'TRUNK'" { |
| 163 | description |
| 164 | "Allowed VLANs may be specified for trunk mode |
| 165 | interfaces."; |
| 166 | } |
| 167 | type union { |
| 168 | type oc-vlan-types:vlan-id; |
| 169 | type oc-vlan-types:vlan-range; |
| 170 | } |
| 171 | description |
| 172 | "Specify VLANs, or ranges thereof, that the interface may |
| 173 | carry when in trunk mode. If not specified, all VLANs are |
| 174 | allowed on the interface. Ranges are specified in the form |
| 175 | x..y, where x<y - ranges are assumed to be inclusive (such |
| 176 | that the VLAN range is x <= range <= y."; |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | grouping vlan-switched-state { |
| 181 | description |
| 182 | "VLAN related operational state that is part of Ethernet |
| 183 | interface state data"; |
| 184 | |
| 185 | //TODO: placeholder for operational state related to VLANs |
| 186 | //on the physical interface |
| 187 | } |
| 188 | |
| 189 | grouping vlan-switched-top { |
| 190 | description |
| 191 | "Top-level grouping for VLAN data associated with an |
| 192 | Ethernet interface"; |
| 193 | |
| 194 | container switched-vlan { |
| 195 | description |
| 196 | "Enclosing container for VLAN interface-specific |
| 197 | data on Ethernet interfaces. These are for standard |
| 198 | L2, switched-style VLANs."; |
| 199 | |
| 200 | container config { |
| 201 | description "Configuration parameters for VLANs"; |
| 202 | |
| 203 | uses vlan-switched-config; |
| 204 | } |
| 205 | |
| 206 | container state { |
| 207 | |
| 208 | config false; |
| 209 | description "State variables for VLANs"; |
| 210 | |
| 211 | uses vlan-switched-config; |
| 212 | uses vlan-switched-state; |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | grouping vlan-logical-config { |
| 218 | description |
| 219 | "VLAN related configuration that is part of subinterface |
| 220 | (logical interface) configuration. These are generally |
| 221 | L3 VLANs with an id that is local."; |
| 222 | |
| 223 | |
| 224 | leaf vlan-id { |
| 225 | type union { |
| 226 | type oc-vlan-types:vlan-id; |
| 227 | type oc-vlan-types:qinq-id; |
| 228 | } |
| 229 | description |
| 230 | "VLAN id for the subinterface -- specified inline for the |
| 231 | case of a local VLAN. The id is scoped to the |
| 232 | subinterface, and could be repeated on different |
| 233 | subinterfaces."; |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | grouping vlan-logical-state { |
| 238 | description |
| 239 | "VLAN related operational state that is part of logical |
| 240 | interface state data"; |
| 241 | |
| 242 | //TODO: placeholder to add VLAN-specific state variables on |
| 243 | //the subinterface |
| 244 | } |
| 245 | |
| 246 | grouping vlan-top { |
| 247 | description "Top-level grouping for VLAN configuration"; |
| 248 | |
| 249 | container vlans { |
| 250 | description "Container for VLAN configuration and state |
| 251 | variables"; |
| 252 | |
| 253 | list vlan { |
| 254 | key "vlan-id"; |
| 255 | |
| 256 | description "Configured VLANs keyed by id"; |
| 257 | |
| 258 | leaf vlan-id { |
| 259 | type leafref { |
| 260 | path "../config/vlan-id"; |
| 261 | } |
| 262 | description "references the configured vlan-id"; |
| 263 | } |
| 264 | |
| 265 | container config { |
| 266 | description "Configuration parameters for VLANs"; |
| 267 | |
| 268 | uses vlan-config; |
| 269 | } |
| 270 | |
| 271 | container state { |
| 272 | |
| 273 | config false; |
| 274 | description "State variables for VLANs"; |
| 275 | |
| 276 | uses vlan-config; |
| 277 | uses vlan-state; |
| 278 | } |
| 279 | uses vlan-members-state; |
| 280 | } |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | grouping vlan-logical-top { |
| 285 | description |
| 286 | "Top-level grouping for VLAN data associated with a |
| 287 | logical interface or subinterface"; |
| 288 | |
| 289 | container vlan { |
| 290 | description |
| 291 | "Enclosing container for VLAN interface-specific |
| 292 | data on subinterfaces"; |
| 293 | |
| 294 | container config { |
| 295 | description "Configuration parameters for VLANs"; |
| 296 | |
| 297 | uses vlan-logical-config; |
| 298 | } |
| 299 | |
| 300 | container state { |
| 301 | |
| 302 | config false; |
| 303 | description "State variables for VLANs"; |
| 304 | |
| 305 | uses vlan-logical-config; |
| 306 | uses vlan-logical-state; |
| 307 | } |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | grouping vlan-routed-config { |
| 312 | description |
| 313 | "Configuration data for routed vlans (SVI, IRB, etc.)"; |
| 314 | |
| 315 | leaf vlan { |
| 316 | type union { |
| 317 | // TODO: in YANG 1.1, unions support leafref types which |
| 318 | // should be used here to reference a configured VLAN by |
| 319 | // id or name |
| 320 | type uint16; |
| 321 | type string; |
| 322 | } |
| 323 | description |
| 324 | "References the VLAN for which this IP interface |
| 325 | provides routing services -- similar to a switch virtual |
| 326 | interface (SVI), or integrated routing and bridging interface |
| 327 | (IRB) in some implementations."; |
| 328 | } |
| 329 | |
| 330 | } |
| 331 | |
| 332 | grouping vlan-routed-state { |
| 333 | description |
| 334 | "Operational state data for routed vlan interfaces."; |
| 335 | } |
| 336 | |
| 337 | grouping vlan-routed-top { |
| 338 | description |
| 339 | "Top-level grouping for routed vlan logical interfaces"; |
| 340 | |
| 341 | container routed-vlan { |
| 342 | description |
| 343 | "Top-level container for routed vlan interfaces. These |
| 344 | logical interfaces are also known as SVI (switched virtual |
| 345 | interface), IRB (integrated routing and bridging), RVI |
| 346 | (routed VLAN interface)"; |
| 347 | |
| 348 | container config { |
| 349 | description |
| 350 | "Configuration data for routed vlan interfaces"; |
| 351 | |
| 352 | uses vlan-routed-config; |
| 353 | } |
| 354 | |
| 355 | container state { |
| 356 | |
| 357 | config false; |
| 358 | |
| 359 | description |
| 360 | "Operational state data "; |
| 361 | |
| 362 | uses vlan-routed-config; |
| 363 | uses vlan-routed-state; |
| 364 | } |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | // data definition statements |
| 369 | |
| 370 | // augment statements |
| 371 | |
| 372 | augment "/oc-if:interfaces/oc-if:interface/oc-if:subinterfaces/" + |
| 373 | "oc-if:subinterface" { |
| 374 | description |
| 375 | "Adds VLAN settings to individual subinterfaces"; |
| 376 | |
| 377 | uses vlan-logical-top; |
| 378 | } |
| 379 | |
| 380 | augment "/oc-if:interfaces/oc-if:interface/oc-if:config" { |
| 381 | description |
| 382 | "Adds TPID / ethertype setting for the base interface"; |
| 383 | |
| 384 | uses vlan-tpid-config; |
| 385 | } |
| 386 | |
| 387 | augment "/oc-if:interfaces/oc-if:interface/oc-if:state" { |
| 388 | description |
| 389 | "Adds TPID / ethertype opstate for the base interface"; |
| 390 | |
| 391 | uses vlan-tpid-config; |
| 392 | uses vlan-tpid-state; |
| 393 | } |
| 394 | |
| 395 | augment "/oc-if:interfaces/oc-if:interface/oc-eth:ethernet" { |
| 396 | description |
| 397 | "Adds VLAN settings to individual Ethernet interfaces"; |
| 398 | |
| 399 | uses vlan-switched-top { |
| 400 | when "oc-if:type = 'ift:ethernetCsmacd'" { |
| 401 | description |
| 402 | "Active when the interface is Ethernet"; |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | augment "/oc-if:interfaces/oc-if:interface/oc-lag:aggregation" { |
| 408 | description "Adds VLAN settings to a LAG interface"; |
| 409 | |
| 410 | uses vlan-switched-top { |
| 411 | when "oc-if:type = 'ift:ieee8023adLag'" { |
| 412 | description |
| 413 | "Active when the interface is a LAG"; |
| 414 | } |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | augment "/oc-if:interfaces/oc-if:interface" { |
| 419 | description |
| 420 | "Adds configuration and state for routed VLAN interfaces"; |
| 421 | |
| 422 | uses vlan-routed-top { |
| 423 | when "current()/oc-if:config/oc-if:type = 'ift:l3ipvlan'" { |
| 424 | description |
| 425 | "Active when the interface is a logical interface providing |
| 426 | L3 routing for VLANs"; |
| 427 | } |
| 428 | } |
| 429 | } |
| 430 | |
| 431 | |
| 432 | // rpc statements |
| 433 | |
| 434 | // notification statements |
| 435 | |
| 436 | } |