本文整理汇总了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);
}
}
示例2: getType
import org.onosproject.bgpio.protocol.BgpType; //导入依赖的package包/类
@Override
public BgpType getType() {
return BgpType.NOTIFICATION;
}
示例3: getType
import org.onosproject.bgpio.protocol.BgpType; //导入依赖的package包/类
@Override
public BgpType getType() {
return BgpType.UPDATE;
}
示例4: getType
import org.onosproject.bgpio.protocol.BgpType; //导入依赖的package包/类
@Override
public BgpType getType() {
return MSG_TYPE;
}
示例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);
}
}