Fixed some major sonar issues in yang-validation-tool
[yangtools.git] / code-generator / binding-java-api-generator / src / test / resources / yang / abstract-topology@2013-02-08.yang
1 /*
2  * Copyright (c) 2013 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 module abstract-topology {
9     yang-version 1;
10     namespace "urn:model:abstract:topology";
11     prefix "tp";
12
13     import ietf-inet-types {
14         prefix "inet";
15         revision-date 2010-09-24;
16     }
17
18     import ietf-interfaces {
19         prefix "if";
20         revision-date 2012-11-15;
21     }
22
23     organization "Cisco";
24     contact "WILL-BE-DEFINED-LATER";
25
26     description
27         "This module contains the definitions of elements that creates network 
28     topology i.e. definition of network nodes and links. This module is not designed to be used solely for network representation. This module SHOULD be used as base module in defining the network topology.";
29
30     revision "2013-02-08" {
31         reference "~~~ WILL BE DEFINED LATER";
32     }
33     
34     revision "2013-01-01" {
35         reference "~~~ WILL BE DEFINED LATER";
36     }
37     
38     typedef node-id-ref {
39         type leafref {
40             path "/tp:topology/tp:network-nodes/tp:network-node/tp:node-id";
41         }
42         description "This type is used for leafs that reference network node instance.";
43     }
44
45     typedef link-id-ref {
46         type leafref {
47             path "/tp:topology/tp:network-links/tp:network-link/tp:link-id";
48         }
49         description "This type is used for leafs that reference network link instance.";
50     }
51
52     typedef interface-id-ref {
53         type leafref {
54             path "/tp:topology/tp:interfaces/tp:interface/tp:interface-id";
55         }
56     }
57
58     container topology {
59         description "This is the model of abstract topology which contains only Network Nodes and Network Links. Each topology MUST be identified by unique topology-id for reason that the store could contain many topologies.";
60
61         leaf topology-id {
62             type inet:uri;
63             description "It is presumed that datastore will contain many topologies. To distinguish between topologies it is vital to have
64             UNIQUE topology identifier.";
65         }
66
67         container network-nodes {
68             list network-node {
69                 key "node-id";
70
71                 leaf node-id {
72                     type inet:uri;
73                     description "The Topology identifier of network-node.";
74                 }
75
76                 container attributes {
77                     description "Aditional attributes that can Network Node contains.";
78                 }
79                 description "The list of network nodes defined for topology.";
80             }
81         }
82
83         container interfaces {
84             list interface {
85                 key "interface-id";
86
87                 leaf interface-id {
88                     type leafref {
89                         path "/if:interfaces/if:interface/if:name";
90                     }
91                 }
92
93                 leaf-list higher-layer-if {
94                     type leafref {
95                         path "/if:interfaces/if:interface/if:higher-layer-if";
96                     }
97                 }
98             }
99         }
100         
101         container network-links {
102             list network-link {
103                 key "link-id";
104
105                 leaf link-id {
106                     type inet:uri;
107                     description "";
108                 }
109
110                 container source-node {
111                     leaf id {
112                         type node-id-ref;
113                         description "Source node identifier.";
114                     }
115                 }
116
117                 container destination-node {
118                     leaf id {
119                         type node-id-ref;
120                         description "Destination node identifier.";
121                     }
122                 }
123
124                 container tunnels {
125                     list tunnel {
126                         key "tunnel-id";
127
128                         leaf tunnel-id {
129                             type leafref {
130                                 path "../../../link-id";
131                             }
132                         }
133                     }
134                 }
135
136                 leaf interface {
137                     type interface-id-ref;
138                 }
139
140                 container attributes {
141                     description "Aditional attributes that can Network Link contains.";
142                 }
143                 description "The Network Link which is defined by Local (Source) and Remote (Destination) Network Nodes. Every link MUST be defined either by identifier and
144                 his local and remote Network Nodes (In real applications it is common that many links are originated from one node and end up in same remote node). To ensure that we would always know to distinguish between links, every link SHOULD have identifier.";
145             }
146         }
147     }
148     
149     identity crypto-base {
150         description "crypto-base description";
151     }
152     
153     identity crypto-alg {
154         base crypto-base;
155         description "crypto-alg description";
156     }
157     
158     grouping target {
159         container nodes {
160             leaf source {
161                 type int8;
162             }
163             leaf target {
164                 type int16;
165             }
166         }
167         leaf id {
168             type string;
169         }
170     }
171     
172     leaf idreftest {
173         type identityref {
174             base crypto-alg;
175         }
176     }
177     
178 }