Thejaswi N K | 6a4cd00 | 2015-09-21 17:19:55 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Thejaswi N K | 6a4cd00 | 2015-09-21 17:19:55 +0530 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.bgp.controller; |
| 17 | |
| 18 | /** |
| 19 | * BGP Peer configuration information. |
| 20 | */ |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 21 | public interface BgpPeerCfg { |
Thejaswi N K | 6a4cd00 | 2015-09-21 17:19:55 +0530 | [diff] [blame] | 22 | |
| 23 | enum State { |
| 24 | |
| 25 | /** |
| 26 | * Signifies that peer connection is idle. |
| 27 | */ |
| 28 | IDLE, |
| 29 | |
| 30 | /** |
| 31 | * Signifies that connection is initiated. |
| 32 | */ |
| 33 | CONNECT, |
| 34 | |
| 35 | /** |
| 36 | * Signifies that state is active and connection can be established. |
| 37 | */ |
| 38 | ACTIVE, |
| 39 | |
| 40 | /** |
| 41 | * Signifies that open is sent and anticipating reply. |
| 42 | */ |
| 43 | OPENSENT, |
| 44 | |
| 45 | /** |
| 46 | * Signifies that peer sent the open message as reply. |
| 47 | */ |
| 48 | OPENCONFIRM, |
| 49 | |
| 50 | /** |
| 51 | * Signifies that all the negotiation is successful and ready to exchange other messages. |
| 52 | */ |
| 53 | ESTABLISHED, |
| 54 | |
| 55 | /** |
| 56 | * Signifies that invalid state. |
| 57 | */ |
| 58 | INVALID |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Returns the connection State information of the peer. |
| 63 | * |
| 64 | * @return |
| 65 | * enum state is returned |
| 66 | */ |
| 67 | State getState(); |
| 68 | |
| 69 | /** |
| 70 | * Set the connection state information of the peer. |
| 71 | * |
| 72 | * @param state |
| 73 | * enum state |
| 74 | */ |
| 75 | void setState(State state); |
| 76 | |
| 77 | /** |
| 78 | * Returns the connection is initiated from us or not. |
| 79 | * |
| 80 | * @return |
| 81 | * true if the connection is initiated by this peer, false if it has been received. |
| 82 | */ |
| 83 | boolean getSelfInnitConnection(); |
| 84 | |
| 85 | /** |
| 86 | * Set the connection is initiated from us or not. |
| 87 | * |
| 88 | * @param selfInit |
| 89 | * true if the connection is initiated by this peer, false if it has been received. |
| 90 | */ |
| 91 | void setSelfInnitConnection(boolean selfInit); |
| 92 | |
| 93 | /** |
| 94 | * Returns the AS number to which this peer belongs. |
| 95 | * |
| 96 | * @return |
| 97 | * AS number |
| 98 | */ |
| 99 | int getAsNumber(); |
| 100 | |
| 101 | /** |
| 102 | * Set the AS number to which this peer belongs. |
| 103 | * |
| 104 | * @param asNumber |
| 105 | * AS number |
| 106 | */ |
| 107 | void setAsNumber(int asNumber); |
| 108 | |
| 109 | /** |
| 110 | * Get the keep alive timer value configured. |
| 111 | * |
| 112 | * @return |
| 113 | * keep alive timer value in seconds |
| 114 | */ |
| 115 | short getHoldtime(); |
| 116 | |
| 117 | /** |
| 118 | * Set the keep alive timer value. |
| 119 | * |
| 120 | * @param holdTime |
| 121 | * keep alive timer value in seconds |
| 122 | */ |
| 123 | void setHoldtime(short holdTime); |
| 124 | |
| 125 | /** |
| 126 | * Return the connection type eBGP or iBGP. |
| 127 | * |
| 128 | * @return |
| 129 | * true if iBGP, false if it is eBGP |
| 130 | */ |
| 131 | boolean getIsIBgp(); |
| 132 | |
| 133 | /** |
| 134 | * Set the connection type eBGP or iBGP. |
| 135 | * |
| 136 | * @param isIBgp |
| 137 | * true if iBGP, false if it is eBGP |
| 138 | */ |
| 139 | void setIsIBgp(boolean isIBgp); |
| 140 | |
| 141 | /** |
| 142 | * Return the peer router IP address. |
| 143 | * |
| 144 | * @return |
| 145 | * IP address in string format |
| 146 | */ |
| 147 | String getPeerRouterId(); |
| 148 | |
| 149 | /** |
| 150 | * Set the peer router IP address. |
| 151 | * |
| 152 | * @param peerId |
| 153 | * IP address in string format |
| 154 | */ |
| 155 | void setPeerRouterId(String peerId); |
| 156 | |
| 157 | /** |
| 158 | * Set the peer router IP address and AS number. |
| 159 | * |
| 160 | * @param peerId |
| 161 | * IP address in string format |
| 162 | * @param asNumber |
| 163 | * AS number |
| 164 | */ |
| 165 | void setPeerRouterId(String peerId, int asNumber); |
Shashikanth VH | 4b76e51 | 2015-11-18 15:42:37 +0530 | [diff] [blame] | 166 | |
| 167 | /** |
| 168 | * Set the peer connect instance. |
| 169 | * |
| 170 | * @param connectpeer connect peer instance |
| 171 | */ |
| 172 | void setConnectPeer(BgpConnectPeer connectpeer); |
| 173 | |
| 174 | /** |
| 175 | * Get the peer connect instance. |
| 176 | * |
| 177 | * @return peer connect instance |
| 178 | */ |
| 179 | BgpConnectPeer connectPeer(); |
Thejaswi N K | 6a4cd00 | 2015-09-21 17:19:55 +0530 | [diff] [blame] | 180 | } |