blob: 49432aabfd0ef542575dac8018d11ffa6e83921b [file] [log] [blame]
Satish Ke107e662015-09-21 19:00:17 +05301/*
2 * Copyright 2015 Open Networking Laboratory
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
17package org.onosproject.bgp.controller;
18
19import org.onosproject.bgpio.protocol.BGPMessage;
20
21/**
22 * Abstraction of an BGP controller. Serves as a one stop shop for obtaining BGP devices and (un)register listeners
23 * on bgp events
24 */
25public interface BGPController {
26
27 /**
Shashikanth VH6de20d32015-10-09 12:04:13 +053028 * Returns list of bgp peers connected to this BGP controller.
29 *
30 * @return Iterable of BGPPeer elements
31 */
32 Iterable<BGPPeer> getPeers();
33
34 /**
35 * Returns the actual bgp peer for the given ip address.
36 *
37 * @param bgpId the id of the bgp peer to fetch
38 * @return the interface to this bgp peer
39 */
40 BGPPeer getPeer(BGPId bgpId);
41
42 /**
Satish Ke107e662015-09-21 19:00:17 +053043 * Send a message to a particular bgp peer.
44 *
45 * @param bgpId the id of the peer to send message.
46 * @param msg the message to send
47 */
48 void writeMsg(BGPId bgpId, BGPMessage msg);
49
50 /**
51 * Process a message and notify the appropriate listeners.
52 *
53 * @param bgpId id of the peer the message arrived on
54 * @param msg the message to process.
55 */
56 void processBGPPacket(BGPId bgpId, BGPMessage msg);
57
58 /**
Shashikanth VH6de20d32015-10-09 12:04:13 +053059 * Close all connected BGP peers.
60 *
61 */
62 void closeConnectedPeers();
63
64 /**
Satish Ke107e662015-09-21 19:00:17 +053065 * Get the BGPConfig class to the caller.
66 *
67 * @return configuration object
68 */
69 BGPCfg getConfig();
Shashikanth VH6de20d32015-10-09 12:04:13 +053070
71 /**
72 * Get the BGP connected peers to this controller.
73 *
74 * @return the integer number
75 */
76 int getBGPConnNumber();
Satish Ke107e662015-09-21 19:00:17 +053077}