Search in sources :

Example 1 with BgpPeerCfg

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;
}
Also used : Entry(java.util.Map.Entry) BgpPeerCfg(org.onosproject.bgp.controller.BgpPeerCfg)

Example 2 with BgpPeerCfg

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;
    }
}
Also used : BgpPeerCfg(org.onosproject.bgp.controller.BgpPeerCfg)

Example 3 with BgpPeerCfg

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;
    }
}
Also used : BgpPeer(org.onosproject.bgp.controller.BgpPeer) BgpPeerCfg(org.onosproject.bgp.controller.BgpPeerCfg)

Example 4 with BgpPeerCfg

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;
    }
}
Also used : BgpPeerCfg(org.onosproject.bgp.controller.BgpPeerCfg)

Example 5 with BgpPeerCfg

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;
}
Also used : BgpPeerCfg(org.onosproject.bgp.controller.BgpPeerCfg)

Aggregations

BgpPeerCfg (org.onosproject.bgp.controller.BgpPeerCfg)6 Entry (java.util.Map.Entry)1 BgpPeer (org.onosproject.bgp.controller.BgpPeer)1 BgpValueType (org.onosproject.bgpio.types.BgpValueType)1