2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 @**********************************************************
10 * Twirl YangTemplate for generating yang snippets. *
11 * Twirl is transformed to Scala and compiled. Then, *
12 * it can be called from Java with particular input *
13 * parameters to render desired output code. *
14 ***********************************************************@
16 @import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode
17 @import org.opendaylight.yangtools.yang.model.api.Status
19 @(identity: IdentitySchemaNode)
20 identity @{identity.getQName().getLocalName()} {
21 @for(baseIdentity <- identity.getBaseIdentities()) {
22 base "(@writeIdentityNs(baseIdentity))@{baseIdentity}";
24 @if(identity.getDescription().isPresent()) {
25 description "@{identity.getDescription().get()}";
27 @if(identity.getReference().isPresent()) {
28 reference "@{identity.getReference().get()}";
30 @if(identity.getStatus() != Status.CURRENT) {
31 status @{identity.getStatus()};
35 @writeIdentityNs(identity: IdentitySchemaNode) = {
36 @if(identity.getQName().getNamespace() != null) {
37 @{identity.getQName().getNamespace()}: