Updated BgpManager for Be
[vpnservice.git] / bgpmanager / bgpmanager-impl / src / main / java / org / opendaylight / bgpmanager / thrift / idl / qbgp.thrift
1 /*
2  * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. 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 // the label argument in pushRoute can use these
10 const i32 LBL_NO_LABEL = 0
11 const i32 LBL_EXPLICIT_NULL = 3
12
13 // FIB entry type
14 const i32 BGP_RT_ADD = 0
15 const i32 BGP_RT_DEL = 1
16
17 // FIB table iteration op
18 const i32 GET_RTS_INIT = 0
19 const i32 GET_RTS_NEXT = 1
20
21 /*
22  * Error codes. 
23  * 0 is success.
24  * ERR_FAILED because something not permitted 
25  *    was attempted, such as deleting a route
26  *    that doesn't exist.
27  * ERR_ACTIVE when session is sought to be created
28  *    when it is already running.
29  * ERR_INACTIVE when an RPC is called but there is
30  *    no session.
31  * ERR_NOT_ITER when GET_RTS_NEXT is called without 
32  *    initializing with GET_RTS_INIT 
33  * ERR_PARAM when there is an issue with params
34  */
35  
36 const i32 BGP_ERR_FAILED = 1 
37 const i32 BGP_ERR_ACTIVE = 10
38 const i32 BGP_ERR_INACTIVE = 11
39 const i32 BGP_ERR_NOT_ITER = 15
40 const i32 BGP_ERR_PARAM = 100
41
42 // these are the supported afi-safi combinations 
43 enum af_afi {
44     AFI_IP = 1
45 }
46
47 enum af_safi {
48     SAFI_IPV4_LABELED_UNICAST = 4,
49     SAFI_MPLS_VPN = 5
50 }
51
52 /*
53  * FIB update.
54  * type is either RT_ADD(0) or RT_DEL(1)
55  */
56
57 struct Update {
58     1: i32 type,
59     2: i32 reserved,
60     3: i32 prefixlen,
61     4: i32 label,
62     5: string rd,
63     6: string prefix,
64     7: string nexthop
65 }
66
67 /*
68  * A sequence of FIB updates, valid only if errcode
69    is zero. Returned as a result of iteration using
70    getRoutes() (ie, a database read). more=0 signals
71    end of iteration.
72  */
73
74 struct Routes {
75     1: i32 errcode,
76     2: optional list<Update> updates,
77     4: optional i32 more
78 }
79
80 service BgpConfigurator {
81     /*
82      * startBgp() starts a BGP instance on the BGP VM. Graceful Restart
83      * also must be configured (stalepathTime > 0). If local BGP is 
84      * restarting, announceFlush tells neighbor to flush all routes 
85      * previously advertised by us. This is the F bit of RFC 4724. 
86      */
87     i32 startBgp(1:i32 asNumber, 2:string routerId, 3: i32 port, 
88                        4:i32 holdTime, 5:i32 keepAliveTime, 
89                        6:i32 stalepathTime, 7:bool announceFlush),
90     i32 stopBgp(1:i32 asNumber),
91     i32 createPeer(1:string ipAddress, 2:i32 asNumber),
92     i32 deletePeer(1:string ipAddress)
93     i32 addVrf(1:string rd, 2:list<string> irts, 3:list<string> erts),
94     i32 delVrf(1:string rd),
95     /*
96      * pushRoute:
97      * IPv6 is not supported.
98      * 'nexthop' cannot be null for VPNv4 and LU.
99      * 'rd' is null for LU (and unicast). 
100      * 'label' cannot be NO_LABEL for VPNv4 and LU. 
101      *  ipv4 unicast is not fully supported.  
102      */
103     i32 pushRoute(1:string prefix, 2:string nexthop, 3:string rd, 4:i32 label),
104     /*
105      * withdrawRoute:
106      * Second argument is either 'rd' (VPNv4) or 
107      * label (LU) as a string (eg: "2500")
108      */
109     i32 withdrawRoute(1:string prefix, 2:string rd),
110     i32 setEbgpMultihop(1:string peerIp, 2:i32 nHops),
111     i32 unsetEbgpMultihop(1:string peerIp),
112     i32 setUpdateSource(1:string peerIp, 2:string srcIp),
113     i32 unsetUpdateSource(1:string peerIp),
114     i32 enableAddressFamily(1:string peerIp, 2:af_afi afi, 3:af_safi safi),
115     i32 disableAddressFamily(1:string peerIp, 2:af_afi afi, 3:af_safi safi),
116     i32 setLogConfig(1:string logFileName, 2:string logLevel),
117     i32 enableGracefulRestart(1:i32 stalepathTime),
118     i32 disableGracefulRestart(),
119     /*
120      * getRoutes():
121      * optype is one of: GET_RTS_INIT: initialize iteration,
122      * GET_RTS_NEXT: get next bunch of routes. winSize is
123      * the size of the buffer that caller has allocated to 
124      * receive the array. QBGP sends no more than the number 
125      * of routes that would fit in this buffer, but not 
126      * necessarily the maximum number that would fit. 
127      * Calling INIT when NEXT is expected causes reinit.
128      */
129     Routes getRoutes(1:i32 optype, 2:i32 winSize)
130 }
131
132 service BgpUpdater {
133     oneway void onUpdatePushRoute(1:string rd, 2:string prefix, 
134                                   3:i32 prefixlen, 4:string nexthop, 
135                                   5:i32 label),
136     oneway void onUpdateWithdrawRoute(1:string rd, 2:string prefix, 
137                                       3:i32 prefixlen), 
138     oneway void onStartConfigResyncNotification(),
139     /* communicate to ODL a BGP Notification received from peer */
140     oneway void onNotificationSendEvent(1:string prefix, 
141                                         2:byte errCode, 3:byte errSubcode)
142 }
143