use of org.onosproject.bgp.controller.BgpPeerCfg in project onos by opennetworkinglab.
the class BgpConfig method displayPeers.
@Override
public TreeMap<String, BgpPeerCfg> displayPeers() {
if (this.bgpPeerTree.isEmpty()) {
log.debug("There are no BGP peers");
} else {
Set<Entry<String, BgpPeerCfg>> set = this.bgpPeerTree.entrySet();
Iterator<Entry<String, BgpPeerCfg>> list = set.iterator();
BgpPeerCfg lspeer;
while (list.hasNext()) {
Entry<String, BgpPeerCfg> me = list.next();
lspeer = me.getValue();
log.debug("Peer neighbor IP :" + me.getKey());
log.debug(", AS Number : " + lspeer.getAsNumber());
log.debug(", Hold Timer : " + lspeer.getHoldtime());
log.debug(", Is iBGP : " + lspeer.getIsIBgp());
}
}
return null;
}
use of org.onosproject.bgp.controller.BgpPeerCfg in project onos by opennetworkinglab.
the class BgpConfig method removePeer.
@Override
public boolean removePeer(String routerid) {
BgpPeerCfg lspeer = this.bgpPeerTree.get(routerid);
if (lspeer != null) {
disconnectPeer(routerid);
lspeer.setSelfInnitConnection(false);
lspeer = this.bgpPeerTree.remove(routerid);
log.debug("Deleted : " + routerid + " successfully");
return true;
} else {
log.debug("Did not find : " + routerid);
return false;
}
}
use of org.onosproject.bgp.controller.BgpPeerCfg in project onos by opennetworkinglab.
the class BgpConfig method disconnectPeer.
@Override
public boolean disconnectPeer(String routerid) {
BgpPeerCfg lspeer = this.bgpPeerTree.get(routerid);
if (lspeer != null) {
BgpPeer disconnPeer = peerManager.getPeer(BgpId.bgpId(IpAddress.valueOf(routerid)));
if (disconnPeer != null) {
// TODO: send notification peer deconfigured
disconnPeer.disconnectPeer();
} else if (lspeer.connectPeer() != null) {
lspeer.connectPeer().disconnectPeer();
}
lspeer.setState(BgpPeerCfg.State.IDLE);
lspeer.setSelfInnitConnection(false);
log.debug("Disconnected : " + routerid + " successfully");
return true;
} else {
log.debug("Did not find : " + routerid);
return false;
}
}
use of org.onosproject.bgp.controller.BgpPeerCfg in project onos by opennetworkinglab.
the class BgpConfig method setPeerConnState.
@Override
public void setPeerConnState(String routerid, BgpPeerCfg.State state) {
BgpPeerCfg lspeer = this.bgpPeerTree.get(routerid);
if (lspeer != null) {
lspeer.setState(state);
log.debug("Peer : " + routerid + " is not available");
return;
} else {
log.debug("Did not find : " + routerid);
return;
}
}
use of org.onosproject.bgp.controller.BgpPeerCfg in project onos by opennetworkinglab.
the class BgpConfig method connectPeer.
@Override
public boolean connectPeer(String routerid) {
BgpPeerCfg lspeer = this.bgpPeerTree.get(routerid);
if (lspeer != null) {
lspeer.setSelfInnitConnection(true);
if (lspeer.connectPeer() == null) {
connectPeer = new BgpConnectPeerImpl(bgpController, routerid, Controller.BGP_PORT_NUM);
lspeer.setConnectPeer(connectPeer);
connectPeer.connectPeer();
peerList.add((BgpConnectPeerImpl) connectPeer);
}
return true;
}
return false;
}
Aggregations