Shashikanth VH
Committed by Gerrit Code Review

[ONOS-2592] Bgp interface to initiate peer connection.

Change-Id: I54c4324eebb5d9ad3993de018cbaeda4b68453ea
......@@ -163,4 +163,18 @@ public interface BGPPeerCfg {
* AS number
*/
void setPeerRouterId(String peerId, int asNumber);
/**
* Set the peer connect instance.
*
* @param connectpeer connect peer instance
*/
void setConnectPeer(BgpConnectPeer connectpeer);
/**
* Get the peer connect instance.
*
* @return peer connect instance
*/
BgpConnectPeer connectPeer();
}
......
......@@ -12,17 +12,17 @@
*/
package org.onosproject.bgp.controller;
import java.util.concurrent.ExecutorService;
/**
* Abstraction of an BGP connect peer, initiate remote connection to BGP peer on configuration.
*/
public interface BGPConnectPeer {
public interface BgpConnectPeer {
/**
* Initiate bgp peer connection.
*/
void connectPeer();
/**
* Returns the executor initialized to connect peer.
*
* @return connectExecutor the connection executor
* End bgp peer connection.
*/
ExecutorService connectExecutor();
void disconnectPeer();
}
......
......@@ -16,6 +16,7 @@
package org.onosproject.bgp.controller.impl;
import org.onlab.packet.Ip4Address;
import org.onosproject.bgp.controller.BgpConnectPeer;
import org.onosproject.bgp.controller.BGPPeerCfg;
/**
......@@ -28,6 +29,7 @@ public class BGPPeerConfig implements BGPPeerCfg {
private Ip4Address peerId = null;
private State state;
private boolean selfInitiated;
private BgpConnectPeer connectPeer;
/**
* Constructor to initialize the values.
......@@ -106,4 +108,14 @@ public class BGPPeerConfig implements BGPPeerCfg {
public void setSelfInnitConnection(boolean selfInit) {
this.selfInitiated = selfInit;
}
@Override
public BgpConnectPeer connectPeer() {
return this.connectPeer;
}
@Override
public void setConnectPeer(BgpConnectPeer connectPeer) {
this.connectPeer = connectPeer;
}
}
......