Fix build faliures due to OFPlugin checktyle fixes
[netvirt.git] / natservice / natservice-api / src / main / yang / odl-nat-rpc.yang
1 module odl-nat-rpc {
2     namespace "urn:opendaylight:netvirt:natservice:rpc";
3     prefix odl-nat-rpc;
4
5     import ietf-yang-types { prefix "yang"; }
6     import ietf-inet-types {
7         prefix inet;
8         revision-date "2013-07-15";
9     }
10
11     revision "2017-02-09" {
12         description "NAT RPC module";
13     }
14
15     grouping nat-router-info {
16         leaf router-uuid {
17             description "Router UUID";
18             type yang:uuid;
19         }
20         leaf router-name {
21             description "Router Name";
22             type string;
23         }
24     }
25
26     grouping snat-state {
27         list snat-ip-mapping {
28             leaf internal-ip {
29                 description "Internal IP Address of VM";
30                 type string;
31             }
32             leaf internal-port {
33                 description "Internal Port";
34                 type string;
35             }
36             leaf external-ip {
37                 description "External Fixed IP Address used for SNAT Translation";
38                 type string;
39             }
40             leaf external-port {
41                 description "External Port used for SNAT Translation";
42                 type string;
43             }
44             leaf protocol {
45                 description "Protocol Type";
46                 type string;
47             }
48         }
49     }
50
51     grouping dnat-configuration {
52         list dnat-ip-mapping {
53             leaf internal-ip {
54                 description "Internal IP Address";
55                 type string;
56             }
57             leaf external-ip {
58                 description "Floating IP Address used for DNAT Translation";
59                 type string;
60             }
61         }
62     }
63
64     grouping nat-output {
65         list router-nat {
66             key router-uuid;
67             uses nat-router-info;
68             uses dnat-configuration;
69             uses snat-state;
70         }
71     }
72
73     rpc get_nat_translations_on_router {
74         description "Provides the NAT translations for given router uuid";
75         input {
76             leaf router-uuid {
77                 description "Router UUID";
78                 mandatory true;
79                 type yang:uuid;
80             }
81         }
82         output {
83             uses nat-output;
84         }
85     }
86     /*
87     Sample output of get_nat_translations_on_router RPC
88     {
89     "output": {
90       "router-nat": [
91         {
92           "router-uuid": "feca5b1a-8ca8-43c1-b85d-80542144435d",
93           "snat-ip-mapping": [
94             {
95               "external-port": "49152",
96               "internal-port": "33811",
97               "internal-ip": "20.0.0.5",
98               "external-ip": "172.170.0.3",
99               "protocol": "TCP"
100             }
101           ],
102           "router-name": "router2",
103           "dnat-ip-mapping": [
104             {
105               "external-ip": "172.170.0.100",
106               "internal-ip": "20.0.0.5"
107             }
108           ]
109         }
110       ]
111     }
112   }
113   */
114
115
116     rpc get_nat_translations_on_vpn {
117         description "Provides the NAT translations for given vpn uuid";
118         input {
119             leaf vpn-uuid {
120                 description "External VPN UUID";
121                 mandatory true;
122                 type yang:uuid;
123             }
124         }
125         output {
126             uses nat-output;
127         }
128     }
129     /*
130     Sample output for get_nat_translations_on_vpn RPC
131     {
132     "output": {
133       "router-nat": [
134         {
135           "router-uuid": "2e4563c4-c051-44f9-a84a-0d6814f2b83e",
136           "router-name": "router1",
137           "snat-ip-mapping": [
138             {
139               "external-port": "49152",
140               "internal-port": "39268",
141               "internal-ip": "10.0.0.5",
142               "external-ip": "172.160.0.3",
143               "protocol": "TCP"
144             }
145           ]
146         },
147         {
148           "router-uuid": "feca5b1a-8ca8-43c1-b85d-80542144435d",
149           "snat-ip-mapping": [
150             {
151               "external-port": "49152",
152               "internal-port": "33811",
153               "internal-ip": "20.0.0.5",
154               "external-ip": "172.170.0.3",
155               "protocol": "TCP"
156             }
157           ],
158           "router-name": "router2",
159           "dnat-ip-mapping": [
160             {
161               "external-ip": "172.170.0.100",
162               "internal-ip": "20.0.0.5"
163             }
164           ]
165         }
166       ]
167     }
168     */
169
170
171     rpc get_nat_translations_for_network_and_ipaddress {
172         description "Provides the NAT translations for given IP Address";
173         input {
174             leaf network-uuid {
175                 description "Network UUID of the Internal IP address provided";
176                 mandatory true;
177                 type yang:uuid;
178             }
179             leaf ip-address {
180                 description "Internal IP address of VM";
181                 mandatory true;
182                 type inet:ip-address;
183             }
184         }
185         output {
186             leaf nat-translation {
187                 description "Represents whether its an SNAT or DNAT translation";
188                 type string;
189             }
190             leaf external-ip {
191                 description "External IP address used for NAT translation";
192                 type string;
193             }
194             leaf internal-ip {
195                 description "Internal IP address";
196                 type string;
197             }
198             leaf external-port {
199                 description "External Port";
200                 type string;
201             }
202             leaf internal-port {
203                 description "Internal Port";
204                 type string;
205             }
206             leaf protocol {
207                 description "Protocol Type";
208                 type string;
209             }
210         }
211     }
212     /*
213     DNAT output
214     {
215     "output": {
216       "nat-translation": "DNAT",
217       "external-ip-address": "172.160.0.100"
218     }
219     }
220
221     SNAT output
222     {
223     "output": {
224       "nat-translation": "SNAT",
225       "external-port": "49152",
226       "internal-port": "6543",
227       "internal-ip": "10.0.0.5",
228       "external-ip": "172.160.0.3",
229       "protocol": "TCP"
230     }
231     }
232     */
233 }