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


Java BgpType类代码示例

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


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

示例1: processBgpMessage

import org.onosproject.bgpio.protocol.BgpType; //导入依赖的package包/类
@Override
void processBgpMessage(BgpChannelHandler h, BgpMessage m) throws IOException, BgpParseException {
    log.debug("message received in OPENSENT state");
    // check for OPEN message
    if (m.getType() != BgpType.OPEN) {
        // When the message type is not keep alive message increment the wrong packet statistics
        h.processUnknownMsg(BgpErrorType.FINITE_STATE_MACHINE_ERROR,
                            BgpErrorType.RECEIVE_UNEXPECTED_MESSAGE_IN_OPENSENT_STATE,
                            m.getType().getType());
        log.debug("Message is not OPEN message");
    } else {
        log.debug("Sending keep alive message in OPENSENT state");
        h.bgpPacketStats.addInPacket();

        BgpOpenMsg pOpenmsg = (BgpOpenMsg) m;
        h.peerIdentifier = pOpenmsg.getBgpId();

        // validate capabilities and open msg
        if (h.openMsgValidation(h, pOpenmsg)) {
            if (h.connectionCollisionDetection(BgpPeerCfg.State.OPENCONFIRM,
                                               h.peerIdentifier, h.peerAddr)) {
                h.channel.close();
                return;
            }
            log.debug("Sending handshake OPEN message");
            h.remoteBgpCapability = pOpenmsg.getCapabilityTlv();

            /*
             * RFC 4271, section 4.2: Upon receipt of an OPEN message, a BGP speaker MUST calculate the
             * value of the Hold Timer by using the smaller of its configured Hold Time and the Hold Time
             * received in the OPEN message
             */
            h.peerHoldTime = pOpenmsg.getHoldTime();
            if (h.peerHoldTime < h.bgpconfig.getHoldTime()) {
                h.channel.getPipeline().replace("holdTime",
                                                "holdTime",
                                                new ReadTimeoutHandler(BgpPipelineFactory.TIMER,
                                                                       h.peerHoldTime));
            }

            log.info("Hold Time : " + h.peerHoldTime);

            // update AS number
            h.peerAsNum = pOpenmsg.getAsNumber();
        }

        // Send keepalive message to peer.
        h.sendKeepAliveMessage();
        h.bgpPacketStats.addOutPacket();
        h.setState(OPENCONFIRM);
        h.bgpconfig.setPeerConnState(h.peerAddr, BgpPeerCfg.State.OPENCONFIRM);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:54,代码来源:BgpChannelHandler.java

示例2: getType

import org.onosproject.bgpio.protocol.BgpType; //导入依赖的package包/类
@Override
public BgpType getType() {
    return BgpType.NOTIFICATION;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:BgpNotificationMsgVer4.java

示例3: getType

import org.onosproject.bgpio.protocol.BgpType; //导入依赖的package包/类
@Override
public BgpType getType() {
    return BgpType.UPDATE;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:BgpUpdateMsgVer4.java

示例4: getType

import org.onosproject.bgpio.protocol.BgpType; //导入依赖的package包/类
@Override
public BgpType getType() {
    return MSG_TYPE;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:BgpOpenMsgVer4.java

示例5: processBgpMessage

import org.onosproject.bgpio.protocol.BgpType; //导入依赖的package包/类
@Override
void processBgpMessage(BgpChannelHandler h, BgpMessage m) throws IOException, BgpParseException {
    log.debug("message received in OPENSENT state");
    // check for OPEN message
    if (m.getType() != BgpType.OPEN) {
        // When the message type is not keep alive message increment the wrong packet statistics
        h.processUnknownMsg(BgpErrorType.FINITE_STATE_MACHINE_ERROR,
                            BgpErrorType.RECEIVE_UNEXPECTED_MESSAGE_IN_OPENSENT_STATE,
                            m.getType().getType());
        log.debug("Message is not OPEN message");
    } else {
        log.debug("Sending keep alive message in OPENSENT state");
        h.bgpPacketStats.addInPacket();

        BgpOpenMsg pOpenmsg = (BgpOpenMsg) m;
        h.peerIdentifier = pOpenmsg.getBgpId();

        // validate capabilities and open msg
        if (h.openMsgValidation(h, pOpenmsg)) {
            if (h.connectionCollisionDetection(BgpPeerCfg.State.OPENCONFIRM,
                                               h.peerIdentifier, h.peerAddr)) {
                h.channel.close();
                return;
            }
            log.debug("Sending handshake OPEN message");
            h.remoteBgpCapability = pOpenmsg.getCapabilityTlv();

            /*
             * RFC 4271, section 4.2: Upon receipt of an OPEN message, a BGP speaker MUST calculate the
             * value of the Hold Timer by using the smaller of its configured Hold Time and the Hold Time
             * received in the OPEN message
             */
            h.peerHoldTime = pOpenmsg.getHoldTime();
            h.minHoldTime = (short) Math.min(h.bgpconfig.getHoldTime(), pOpenmsg.getHoldTime());
            h.restartHoldTimeoutTimer();
            log.info("Hold Time : " + h.minHoldTime);

            // update AS number
            h.peerAsNum = pOpenmsg.getAsNumber();
        }

        // Send keepalive message to peer.
        h.sendKeepAliveMessage();
        h.bgpPacketStats.addOutPacket();
        h.setState(OPENCONFIRM);
        h.bgpconfig.setPeerConnState(h.peerAddr, BgpPeerCfg.State.OPENCONFIRM);
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:49,代码来源:BgpChannelHandler.java


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