Add yang-ext:mount extension
[mdsal.git] / model / yang-ext / src / main / yang / yang-ext.yang
1 module yang-ext {
2     yang-version 1;
3     namespace "urn:opendaylight:yang:extension:yang-ext";
4     prefix "ext";
5
6     contact "Anton Tkacik <ttkacik@cisco.com>";
7
8     description
9             "Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
10
11             This program and the accompanying materials are made available under the
12             terms of the Eclipse Public License v1.0 which accompanies this distribution,
13             and is available at http://www.eclipse.org/legal/epl-v10.html";
14
15     revision "2013-07-09" {
16         description "";
17     }
18
19     // Augmentation name
20
21     extension "augment-identifier" {
22         description
23            "YANG language extension which assigns an identifier to
24             augmentation. Augment identifier is used to identify
25             specific augment statement by name.
26
27             The identifier syntax is defined formally defined by the rule
28             'identifier' in Section 12 of RFC 6020.
29
30             All augment identifiers defined in a namespace MUST be unique.
31             The namespace of augment identifiers is shared by module and
32             its submodules.";
33
34             /*
35                 Discussion:
36                 This extension allows for ease of development / debug
37                 of YANG modules and it is suitable for code generation,
38                 where each augment statement is nicely identified by
39                 unique name instead of combination of augment target
40                 and when condition.
41             */
42         argument "identifier";
43     }
44
45     // Mount point marker
46
47     extension mount {
48         description
49            "YANG language extension which marks a place where a semantic mount
50             point can be present. This extension can only be used in a container or
51             a list statement, for example:
52
53               module foo {
54                 container foo {
55                   leaf bar {
56                     type string;
57                   }
58
59                   ext:mount;
60                 }
61               }
62
63             In this example, container foo can contain a local leaf bar and some
64             mounted data. From addressing perspective, the extension use acts as
65             a container with yang-ext's namespace, i.e. it looks as though as this
66             (yang-ext) module contained the following construct:
67
68               import foo { prefix foo; }
69
70               augment /foo:foo {
71                 container mount;
72               }
73
74             From data lifecycle perspective, this container should never be
75             automatically included in the datastore content for 'container foo', unless
76             specifically explicitly requested.";
77     }
78
79     // Context-aware RPCs
80
81     grouping rpc-context-ref {
82         description
83            "A reference to RPC context.";
84         leaf context-instance {
85             type instance-identifier;
86             description "Pointer to the context. ";
87             mandatory true;
88         }
89     }
90
91     extension "rpc-context-instance" {
92         description
93            "YANG language extension which defines enclosing (parent)
94             schema node as referencable context for RPCs.
95
96             The argument is identity which is used to identify RPC context
97             type.";
98
99         argument "context-type";
100     }
101
102     extension "context-reference" {
103         argument "context-type";
104     }
105
106     extension "context-instance" {
107         argument "context-type";
108     }
109
110     extension "instance-target" {
111         argument "path";
112     }
113 }