abae3418c9d94de4fed4a1feeb09437cc60dad55
[netvirt.git] / model-bgp / src / main / yang / ebgp.yang
1 module ebgp {
2
3   yang-version "1";
4
5   // namespace
6   namespace "urn:ericsson:params:xml:ns:yang:ebgp";
7
8   prefix "ericsson-bgp";
9
10   // import some basic inet types
11   import ietf-inet-types { prefix inet; revision-date "2013-07-15"; }
12
13   // meta
14   organization
15     "Ericsson Bangalore";
16
17   contact
18     "Ericsson Bangalore";
19
20   description
21     "BGP configuration model for Ericsson's implementation of
22     Opendaylight L3VPN";
23
24   revision "2015-09-01" {
25   }
26
27
28   typedef tcp-md5-signature-password-type {
29     type string {
30       length 1..80;
31     } // subtype string
32     description
33       "The shared secret used by TCP MD5 Signature Option.  The length is
34        limited to 80 chars because A) it is identified by the RFC as current
35        practice and B) it is the maximum length accepted by Quagga
36        implementation.";
37     reference "RFC 2385";
38   } // typedef tcp-md5-signature-password-type
39
40
41   grouping tcp-security-option-grouping {
42     description "TCP security options.";
43     choice tcp-security-option {
44       description "The tcp security option in use, if any.";
45
46       case tcp-md5-signature-option {
47         description "The connection uses TCP MD5 Signature Option.";
48         reference "RFC 2385";
49         leaf tcp-md5-signature-password {
50           type tcp-md5-signature-password-type;
51           description "The shared secret used to sign the packets.";
52         } // leaf tcp-md5-signature-password
53       } // case tcp-md5-signature-option
54
55     } // choice tcp-security-option
56   } // grouping tcp-security-option-grouping
57
58
59  container bgp {
60   config "true";
61   container config-server {
62     leaf host {
63       type inet:ipv4-address;
64       mandatory "true";
65     }
66     leaf port {
67       type uint32;
68       mandatory "true";
69     }
70   }
71
72   container as-id {
73     leaf local-as {
74       type uint32;
75       mandatory "true";
76     }
77     leaf router-id {
78       type inet:ip-address;
79     }
80     leaf stalepath-time {
81       type uint32;
82       default 360;
83     }
84     leaf announce-fbit {
85       type boolean;
86     }
87     leaf keepalive {
88         type         uint32;
89         description  "BGP keepalive timer value";
90         default      60;
91     }
92     leaf holdtime {
93         type         uint32;
94         description  "BGP hold time value";
95         default      180;
96     }
97   }
98
99   container graceful-restart {
100     leaf stalepath-time {
101       type uint32;
102       mandatory "true";
103     }
104   }
105
106   container logging {
107     leaf file {
108       type string;
109     }
110     leaf level {
111       type string;
112     }
113   }
114
115   list neighbors {
116     key "address";
117     leaf address {
118       type inet:ipv4-address;
119       mandatory "true";
120     }
121     leaf remote-as {
122       type uint32;
123       mandatory "true";
124     }
125     uses tcp-security-option-grouping;
126     container ebgp-multihop {
127       leaf nhops {
128         type uint32;
129       }
130       leaf peer-ip {
131         type leafref {
132           path "/ericsson-bgp:bgp/neighbors/address";
133         }
134       }
135     }
136     container update-source {
137       leaf source-ip {
138         type inet:ipv4-address;
139       }
140       leaf peer-ip {
141         type leafref {
142           path "/ericsson-bgp:bgp/neighbors/address";
143         }
144       }
145     }
146     list address-families {
147       key "afi safi";
148       leaf afi {
149         type uint32;
150         mandatory "true";
151       }
152       leaf safi {
153         type uint32;
154         mandatory "true";
155       }
156       leaf peer-ip {
157         type leafref {
158           path "/ericsson-bgp:bgp/neighbors/address";
159         }
160       }
161     } //addr-families
162   } // neighbhors
163
164   list networks {
165     key "rd prefix-len";
166     leaf rd {
167       type string;
168     }
169     leaf prefix-len {
170       type string;
171     }
172     leaf afi {
173       type uint32;
174     }
175     leaf macaddress {
176       description "Mac address of the advertised host.";
177       type string;
178     }
179     leaf bgp_control_plane_type{
180       description "Specifies the route type";
181       type bgp_control_plane_type;
182       mandatory "true";
183     }
184     leaf nexthop {
185       type inet:ipv4-address;
186     }
187     leaf label {
188       type uint32;
189     }
190     leaf ethtag {
191       description "Ethernet Tag Id to Identify a broadcast domain in an EVPN Instance";
192       type uint32;
193     }
194     leaf esi {
195       description "Ethernet Segment Identifier.";
196       type string;
197     }
198     leaf encap-type {
199       description "Encapsulation types supported as per RFC 5512.";
200       type encap_type;
201     }
202     leaf routermac {
203       description "Gateway Mac Address for the advertised host.";
204       type string;
205     }
206     leaf l3vni {
207       description "VxLAN Identifier.";
208       type uint32;
209     }
210
211     leaf l2vni {
212       type uint32;
213       description "l2vni for EVPN RT2 route advertisement";
214     }
215
216   } // networks
217
218   list vrfs {
219     key "rd";
220     leaf rd {
221       type string;
222     }
223     list address-families-vrf {
224       key "afi safi";
225       leaf afi {
226         type uint32;
227         mandatory "true";
228       }
229       leaf safi {
230         type uint32;
231         mandatory "true";
232       }
233     }
234     leaf-list import-rts {
235       type string;
236     }
237     leaf-list export-rts {
238       type string;
239     }
240   }
241
242   typedef layer_type
243     {
244       description
245         "This value represents the layer to which
246         a VRF entry belongs to in IP protocol.";
247       type enumeration
248       {
249         enum LAYER_2
250         {
251           value "1";
252           description "VRF represents a MAC-VRF.";
253         }
254         enum LAYER_3
255         {
256           value "2";
257           description "VRF represents an IP-VRF.";
258         }
259       }
260     }
261
262   typedef address_family
263     {
264       description
265         "This value represents the address family
266         a VRF entry supports";
267       type enumeration
268       {
269         enum IPV_4
270         {
271           value "1";
272           description "VRF represents IPv4 VRF.";
273         }
274         enum IPV_6
275         {
276           value "2";
277           description "VRF represents an IPv6-VRF.";
278         }
279         enum L2VPN
280         {
281           value "3";
282           description "VRF represents a MAC-VRF.";
283         }
284       }
285     }
286
287   typedef encap_type
288   {
289     description
290       "Encapsulation types supported as per
291       RFC 5512 - The BGP Encapsulation Subsequent
292       Address Family Identifier (SAFI) and the
293       BGP Tunnel Encapsulation Attribute";
294     type enumeration
295     {
296       enum L2TPV3_OVER_IP
297       {
298         value "1";
299         description "L2TPV3_OVER_IP";
300       }
301       enum GRE
302       {
303         value "2";
304         description "GRE";
305       }
306       enum IP_IN_IP
307       {
308         value "7";
309         description "IP_IN_IP";
310       }
311       enum VXLAN
312       {
313         value "8";
314         description "VXLAN";
315       }
316       enum MPLS
317       {
318         value "10";
319         description "MPLS";
320         }
321     }
322   }
323
324   typedef bgp_control_plane_type
325   {
326     description
327       "protocol type - used to know which route type is referred to";
328     type enumeration
329     {
330       enum PROTOCOL_LU
331       {
332         value "1";
333         description "PROTOCOL_LU";
334       }
335       enum PROTOCOL_L3VPN
336       {
337         value "2";
338         description "PROTOCOL_L3VPN";
339       }
340       enum PROTOCOL_EVPN
341       {
342         value "3";
343         description "PROTOCOL_EVPN";
344       }
345       enum PROTOCOL_ANY
346       {
347         value "4";
348         description "PROTOCOL_ANY";
349       }
350     }
351   }
352
353   leaf vpn-type
354   {
355     description
356       "The type of the VPN Instance.
357       L3 indicates it is an L3VPN.
358       L2 indicates it is EVPN";
359     type enumeration
360     {
361       enum l3
362       {
363         value "0";
364         description "L3VPN";
365       }
366       enum l2
367       {
368         value "1";
369         description "EVPN";
370       }
371     }
372     default "l3";
373   }
374
375   list multipath {
376
377      key "afi safi";
378
379      leaf afi {
380        type uint32;
381        mandatory "true";
382      }
383
384      leaf safi {
385        type uint32;
386        mandatory "true";
387      }
388
389      leaf multipath-enabled {
390        type boolean;
391        mandatory "true";
392      }
393   } //multipath
394
395   list vrfMaxpath {
396        key "rd";
397
398        leaf rd {
399          type string;
400        }
401
402        leaf maxpaths {
403          type uint16;
404        }
405   } //vrfMaxpaths
406
407   container bfd {
408       leaf bfd-enabled {
409           description  "is BFD enabled";
410           type         boolean;
411           default      false;
412       }
413   }
414
415   list tep-dcgw {
416       key          "dc-gw-ip";
417       description  "mapping: DC-Gwy ip <> TEP ip";
418       leaf dc-gw-ip {
419            type string;
420       }
421       leaf-list tep-ip {
422           type string;
423       }
424   }
425  } // bgp
426 }