Bug 1411-4: MDSAL Binding2 Generator Impl
[mdsal.git] / binding2 / mdsal-binding2-generator-impl / src / main / twirl / org / opendaylight / mdsal / binding2 / yangTemplateWriteRPC.scala.txt
1 @*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  *@
8
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 *                                                         *
15 * Note: we should introduce our own format instead of txt *
16 ***********************************************************@
17
18 @import org.opendaylight.yangtools.yang.model.api.RpcDefinition
19 @import org.opendaylight.yangtools.yang.model.api.Status
20
21 @(rpc: RpcDefinition)
22 rpc @{rpc.getQName().getLocalName()} {
23     @if(rpc.getDescription() != null && !rpc.getDescription().isEmpty()) {
24         "@{rpc.getDescription()}";
25     }
26     @if(rpc.getGroupings() != null && !rpc.getGroupings().isEmpty()) {
27         @yangTemplateWriteGroupingDefs(rpc.getGroupings())
28     }
29     @if(rpc.getInput() != null) {
30         input {
31             @if(rpc.getInput().getChildNodes != null && !rpc.getInput().getChildNodes().isEmpty()) {
32                 @yangTemplateWriteDataSchemaNodes(rpc.getInput().getChildNodes)
33             }
34         }
35     }
36     @if(rpc.getOutput() != null) {
37         output {
38             @if(rpc.getOutput().getChildNodes != null && !rpc.getOutput().getChildNodes().isEmpty()) {
39                 @yangTemplateWriteDataSchemaNodes(rpc.getOutput().getChildNodes)
40             }
41         }
42     }
43     @if(rpc.getReference() != null && !rpc.getReference().isEmpty()) {
44         reference "@{rpc.getReference()}";
45     }
46     @if(rpc.getStatus() != Status.CURRENT) {
47         status @{rpc.getStatus()};
48     }
49 }