本文整理汇总了Java中org.onosproject.ospf.protocol.util.OspfInterfaceState.value方法的典型用法代码示例。如果您正苦于以下问题:Java OspfInterfaceState.value方法的具体用法?Java OspfInterfaceState.value怎么用?Java OspfInterfaceState.value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.ospf.protocol.util.OspfInterfaceState
的用法示例。
在下文中一共展示了OspfInterfaceState.value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: electRouter
import org.onosproject.ospf.protocol.util.OspfInterfaceState; //导入方法依赖的package包/类
/**
* Performs DR election.
*
* @param ch Netty Channel instance.
* @throws Exception might throws exception
*/
public void electRouter(Channel ch) throws Exception {
Ip4Address currentDr = dr();
Ip4Address currentBdr = bdr();
OspfInterfaceState oldState = state();
OspfInterfaceState newState;
log.debug("OSPFInterfaceChannelHandler::electRouter -> currentDr: {}, currentBdr: {}",
currentDr, currentBdr);
List<OspfEligibleRouter> eligibleRouters = calculateListOfEligibleRouters(new OspfEligibleRouter());
log.debug("OSPFInterfaceChannelHandler::electRouter -> eligibleRouters: {}", eligibleRouters);
OspfEligibleRouter electedBdr = electBdr(eligibleRouters);
OspfEligibleRouter electedDr = electDr(eligibleRouters, electedBdr);
setBdr(electedBdr.getIpAddress());
setDr(electedDr.getIpAddress());
if (electedBdr.getIpAddress().equals(ipAddress()) &&
!electedBdr.getIpAddress().equals(currentBdr)) {
setState(OspfInterfaceState.BDR);
}
if (electedDr.getIpAddress().equals(ipAddress()) &&
!electedDr.getIpAddress().equals(currentDr)) {
setState(OspfInterfaceState.DR);
}
if (state() != oldState &&
!(state() == OspfInterfaceState.DROTHER &&
oldState.value() < OspfInterfaceState.DROTHER.value())) {
log.debug("Recalculating as the State is changed ");
log.debug("OSPFInterfaceChannelHandler::electRouter -> currentDr: {}, currentBdr: {}",
currentDr, currentBdr);
eligibleRouters = calculateListOfEligibleRouters(new OspfEligibleRouter());
log.debug("OSPFInterfaceChannelHandler::electRouter -> eligibleRouters: {}", eligibleRouters);
electedBdr = electBdr(eligibleRouters);
electedDr = electDr(eligibleRouters, electedBdr);
setBdr(electedBdr.getIpAddress());
setDr(electedDr.getIpAddress());
}
if (electedBdr.getIpAddress().equals(ipAddress()) &&
!electedBdr.getIpAddress().equals(currentBdr)) {
setState(OspfInterfaceState.BDR);
ospfArea.refreshArea(this);
}
if (electedDr.getIpAddress().equals(ipAddress()) &&
!electedDr.getIpAddress().equals(currentDr)) {
setState(OspfInterfaceState.DR);
//Refresh Router Lsa & Network Lsa
ospfArea.refreshArea(this);
}
if (currentDr != electedDr.getIpAddress() || currentBdr != electedBdr.getIpAddress()) {
Set<String> negibhorIdList;
negibhorIdList = listOfNeighbors().keySet();
for (String routerid : negibhorIdList) {
OspfNbrImpl nbr = (OspfNbrImpl) neighbouringRouter(routerid);
if (nbr.getState().getValue() >= OspfNeighborState.TWOWAY.getValue()) {
nbr.adjOk(ch);
}
}
}
log.debug("OSPFInterfaceChannelHandler::electRouter -> ElectedDR: {}, ElectedBDR: {}",
electedDr.getIpAddress(), electedBdr.getIpAddress());
}
示例2: electRouter
import org.onosproject.ospf.protocol.util.OspfInterfaceState; //导入方法依赖的package包/类
/**
* Performs DR election.
*
* @param ch Netty Channel instance.
*/
public void electRouter(Channel ch) {
Ip4Address currentDr = dr();
Ip4Address currentBdr = bdr();
OspfInterfaceState oldState = state();
OspfInterfaceState newState;
log.debug("OSPFInterfaceChannelHandler::electRouter -> currentDr: {}, currentBdr: {}",
currentDr, currentBdr);
List<OspfEligibleRouter> eligibleRouters = calculateListOfEligibleRouters(new OspfEligibleRouter());
log.debug("OSPFInterfaceChannelHandler::electRouter -> eligibleRouters: {}", eligibleRouters);
OspfEligibleRouter electedBdr = electBdr(eligibleRouters);
OspfEligibleRouter electedDr = electDr(eligibleRouters, electedBdr);
setBdr(electedBdr.getIpAddress());
setDr(electedDr.getIpAddress());
if (electedBdr.getIpAddress().equals(ipAddress()) &&
!electedBdr.getIpAddress().equals(currentBdr)) {
setState(OspfInterfaceState.BDR);
}
if (electedDr.getIpAddress().equals(ipAddress()) &&
!electedDr.getIpAddress().equals(currentDr)) {
setState(OspfInterfaceState.DR);
}
if (state() != oldState &&
!(state() == OspfInterfaceState.DROTHER &&
oldState.value() < OspfInterfaceState.DROTHER.value())) {
log.debug("Recalculating as the State is changed ");
log.debug("OSPFInterfaceChannelHandler::electRouter -> currentDr: {}, currentBdr: {}",
currentDr, currentBdr);
eligibleRouters = calculateListOfEligibleRouters(new OspfEligibleRouter());
log.debug("OSPFInterfaceChannelHandler::electRouter -> eligibleRouters: {}", eligibleRouters);
electedBdr = electBdr(eligibleRouters);
electedDr = electDr(eligibleRouters, electedBdr);
setBdr(electedBdr.getIpAddress());
setDr(electedDr.getIpAddress());
}
if (electedBdr.getIpAddress().equals(ipAddress()) &&
!electedBdr.getIpAddress().equals(currentBdr)) {
setState(OspfInterfaceState.BDR);
ospfArea.refreshArea(this);
}
if (electedDr.getIpAddress().equals(ipAddress()) &&
!electedDr.getIpAddress().equals(currentDr)) {
setState(OspfInterfaceState.DR);
//Refresh Router Lsa & Network Lsa
ospfArea.refreshArea(this);
}
if (currentDr != electedDr.getIpAddress() || currentBdr != electedBdr.getIpAddress()) {
Set<String> negibhorIdList;
negibhorIdList = listOfNeighbors().keySet();
for (String routerid : negibhorIdList) {
OspfNbrImpl nbr = (OspfNbrImpl) neighbouringRouter(routerid);
if (nbr.getState().getValue() >= OspfNeighborState.TWOWAY.getValue()) {
nbr.adjOk(ch);
}
}
}
log.debug("OSPFInterfaceChannelHandler::electRouter -> ElectedDR: {}, ElectedBDR: {}",
electedDr.getIpAddress(), electedBdr.getIpAddress());
}