当前位置: 首页>>代码示例>>Java>>正文


Java BgpPeer类代码示例

本文整理汇总了Java中org.onosproject.bgp.controller.BgpPeer的典型用法代码示例。如果您正苦于以下问题:Java BgpPeer类的具体用法?Java BgpPeer怎么用?Java BgpPeer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BgpPeer类属于org.onosproject.bgp.controller包,在下文中一共展示了BgpPeer类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: disconnectPeer

import org.onosproject.bgp.controller.BgpPeer; //导入依赖的package包/类
@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;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:BgpConfig.java

示例2: closeConnectedPeers

import org.onosproject.bgp.controller.BgpPeer; //导入依赖的package包/类
@Override
public void closeConnectedPeers() {
    BgpPeer bgpPeer;
    for (BgpId id : this.connectedPeers.keySet()) {
        bgpPeer = getPeer(id);
        bgpPeer.disconnectPeer();
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:BgpControllerImpl.java

示例3: addConnectedPeer

import org.onosproject.bgp.controller.BgpPeer; //导入依赖的package包/类
@Override
public boolean addConnectedPeer(BgpId bgpId, BgpPeer bgpPeer) {

    if (connectedPeers.get(bgpId) != null) {
        this.log.error("Trying to add connectedPeer but found previous " + "value for bgp ip: {}",
                       bgpId.toString());
        return false;
    } else {
        this.log.debug("Added Peer {}", bgpId.toString());
        connectedPeers.put(bgpId, bgpPeer);
        return true;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:BgpControllerImpl.java

示例4: executeBatch

import org.onosproject.bgp.controller.BgpPeer; //导入依赖的package包/类
@Override
public void executeBatch(FlowRuleBatchOperation batch) {
    Collection<FlowEntry> flowEntries = new ArrayList<>();

    for (FlowRuleBatchEntry fbe : batch.getOperations()) {
        Criterion criteria = fbe.target().selector().getCriterion(EXTENSION);

        switch (fbe.operator()) {
        case ADD:
            if (criteria == null) {
                processRule(fbe.target(), PcepFlowType.ADD);
            } else {
                handleMessage(fbe, BgpPeer.FlowSpecOperation.ADD, batch.deviceId());
            }
            flowEntries.add(new DefaultFlowEntry(fbe.target(), FlowEntryState.ADDED, 0, 0, 0));
            break;
        case REMOVE:
            if (criteria == null) {
                processRule(fbe.target(), PcepFlowType.REMOVE);
            } else {
                handleMessage(fbe, BgpPeer.FlowSpecOperation.DELETE, batch.deviceId());
            }

            flowEntries.add(new DefaultFlowEntry(fbe.target(), FlowEntryState.REMOVED, 0, 0, 0));
            break;
        default:
            log.error("Unknown flow operation: {}", fbe);
        }
    }

    CompletedBatchOperation status = new CompletedBatchOperation(true, Collections.emptySet(), batch.deviceId());
    providerService.batchOperationCompleted(batch.id(), status);
    providerService.pushFlowMetrics(batch.deviceId(), flowEntries);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:35,代码来源:BgpcepFlowRuleProvider.java

示例5: getPeer

import org.onosproject.bgp.controller.BgpPeer; //导入依赖的package包/类
BgpPeer getPeer(DeviceId deviceId) {
    Device d = deviceService.getDevice(deviceId);
    Annotations a = d != null ? d.annotations() : null;
    String ipAddress = a.value(FLOW_PEER);
    BgpId bgpId = BgpId.bgpId(IpAddress.valueOf(ipAddress));
    BgpPeer peer = bgpController.getPeer(bgpId);
    return peer;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:BgpcepFlowRuleProvider.java

示例6: getPeers

import org.onosproject.bgp.controller.BgpPeer; //导入依赖的package包/类
@Override
public Iterable<BgpPeer> getPeers() {
    return this.connectedPeers.values();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:BgpControllerImpl.java

示例7: getPeer

import org.onosproject.bgp.controller.BgpPeer; //导入依赖的package包/类
@Override
public BgpPeer getPeer(BgpId bgpId) {
    return this.connectedPeers.get(bgpId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:BgpControllerImpl.java

示例8: processBgpPacket

import org.onosproject.bgp.controller.BgpPeer; //导入依赖的package包/类
@Override
public void processBgpPacket(BgpId bgpId, BgpMessage msg) throws BgpParseException {

    BgpPeer peer = getPeer(bgpId);

    switch (msg.getType()) {
    case OPEN:
        // TODO: Process Open message
        break;
    case KEEP_ALIVE:
        // TODO: Process keepalive message
        break;
    case NOTIFICATION:
        // TODO: Process notificatoin message
        break;
    case UPDATE:
        BgpUpdateMsg updateMsg = (BgpUpdateMsg) msg;
        List<BgpValueType> pathAttr = updateMsg.bgpPathAttributes().pathAttributes();
        if (pathAttr == null) {
           log.debug("llPathAttr is null, cannot process update message");
           break;
        }
        Iterator<BgpValueType> listIterator = pathAttr.iterator();
        boolean isLinkstate = false;

        while (listIterator.hasNext()) {
            BgpValueType attr = listIterator.next();
            if (attr instanceof MpReachNlri) {
                MpReachNlri mpReach = (MpReachNlri) attr;
                if (mpReach.bgpFlowSpecNlri() == null) {
                    isLinkstate = true;
                }
            } else if (attr instanceof MpUnReachNlri) {
                MpUnReachNlri mpUnReach = (MpUnReachNlri) attr;
                if (mpUnReach.bgpFlowSpecNlri() == null) {
                    isLinkstate = true;
                }
            }
        }
        if (isLinkstate) {
            peer.buildAdjRibIn(pathAttr);
        }
        break;
    default:
        // TODO: Process other message
        break;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:49,代码来源:BgpControllerImpl.java

示例9: connectedPeers

import org.onosproject.bgp.controller.BgpPeer; //导入依赖的package包/类
@Override
public ConcurrentHashMap<BgpId, BgpPeer> connectedPeers() {
    return connectedPeers;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:BgpControllerImpl.java

示例10: getPeers

import org.onosproject.bgp.controller.BgpPeer; //导入依赖的package包/类
@Override
public Iterable<BgpPeer> getPeers() {
    // TODO Auto-generated method stub
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:6,代码来源:BgpControllerAdapter.java

示例11: getPeer

import org.onosproject.bgp.controller.BgpPeer; //导入依赖的package包/类
@Override
public BgpPeer getPeer(BgpId bgpId) {
    // TODO Auto-generated method stub
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:6,代码来源:BgpControllerAdapter.java

示例12: connectedPeers

import org.onosproject.bgp.controller.BgpPeer; //导入依赖的package包/类
@Override
public Map<BgpId, BgpPeer> connectedPeers() {
    // TODO Auto-generated method stub
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:6,代码来源:BgpControllerAdapter.java

示例13: processBgpPacket

import org.onosproject.bgp.controller.BgpPeer; //导入依赖的package包/类
@Override
public void processBgpPacket(BgpId bgpId, BgpMessage msg) throws BgpParseException {

    BgpPeer peer = getPeer(bgpId);

    switch (msg.getType()) {
        case OPEN:
            // TODO: Process Open message
            break;
        case KEEP_ALIVE:
            // TODO: Process keepalive message
            break;
        case NOTIFICATION:
            // TODO: Process notificatoin message
            break;
        case UPDATE:
            BgpUpdateMsg updateMsg = (BgpUpdateMsg) msg;
            List<BgpValueType> pathAttr = updateMsg.bgpPathAttributes().pathAttributes();
            if (pathAttr == null) {
                log.debug("llPathAttr is null, cannot process update message");
                break;
            }
            Iterator<BgpValueType> listIterator = pathAttr.iterator();
            boolean isLinkstate = false;
            boolean isEvpn = false;

            while (listIterator.hasNext()) {
                BgpValueType attr = listIterator.next();
                if (attr instanceof MpReachNlri) {
                    MpReachNlri mpReach = (MpReachNlri) attr;
                    if (mpReach.bgpFlowSpecNlri() == null
                            && mpReach.bgpEvpnNlri() == null) {
                        isLinkstate = true;
                    }
                    if (mpReach.bgpEvpnNlri() != null) {
                        isEvpn = true;
                    }
                } else if (attr instanceof MpUnReachNlri) {
                    MpUnReachNlri mpUnReach = (MpUnReachNlri) attr;
                    if (mpUnReach.bgpFlowSpecNlri() == null
                            && mpUnReach.bgpEvpnNlri() == null) {
                        isLinkstate = true;
                    }
                    if (mpUnReach.bgpEvpnNlri() != null) {
                        isEvpn = true;
                    }
                }
            }
            if (isLinkstate) {
                peer.buildAdjRibIn(pathAttr);
            }
            if (isEvpn) {
                for (BgpRouteListener listener : bgpRouteListener) {
                    listener.processRoute(bgpId, updateMsg);
                }
            }
            break;
        default:
            // TODO: Process other message
            break;
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:63,代码来源:BgpControllerImpl.java

示例14: getBgpPeerInstance

import org.onosproject.bgp.controller.BgpPeer; //导入依赖的package包/类
/**
 * Gets bgp peer instance.
 *
 * @param bgpController controller instance.
 * @param sessionInfo bgp session info.
 * @param pktStats packet statistics.
 * @return BGPPeer peer instance.
 */
public BgpPeer getBgpPeerInstance(BgpController bgpController, BgpSessionInfoImpl sessionInfo,
                                  BgpPacketStatsImpl pktStats) {
    BgpPeer bgpPeer = new BgpPeerImpl(bgpController, sessionInfo, pktStats);
    return bgpPeer;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:BgpControllerImpl.java


注:本文中的org.onosproject.bgp.controller.BgpPeer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。