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


Java OspfInterface.listOfNeighbors方法代码示例

本文整理汇总了Java中org.onosproject.ospf.controller.OspfInterface.listOfNeighbors方法的典型用法代码示例。如果您正苦于以下问题:Java OspfInterface.listOfNeighbors方法的具体用法?Java OspfInterface.listOfNeighbors怎么用?Java OspfInterface.listOfNeighbors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.onosproject.ospf.controller.OspfInterface的用法示例。


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

示例1: addToOtherNeighborLsaTxList

import org.onosproject.ospf.controller.OspfInterface; //导入方法依赖的package包/类
/**
 * Adds the received LSA in other neighbors tx list.
 *
 * @param recLsa LSA Header instance
 */
public void addToOtherNeighborLsaTxList(LsaHeader recLsa) {
    //Add the received LSA in other neighbors retransmission list.
    log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList");
    List<OspfInterface> ospfInterfaces = ospfInterfaceList();
    for (OspfInterface ospfInterfaceFromArea : ospfInterfaces) {
        Map neighbors = ospfInterfaceFromArea.listOfNeighbors();
        for (Object neighborIP : neighbors.keySet()) {
            OspfNbrImpl nbr = (OspfNbrImpl) neighbors.get(neighborIP);
            if (nbr.getState().getValue() < OspfNeighborState.EXCHANGE.getValue()) {
                continue;
            }
            String key = database.getLsaKey(recLsa);
            if (nbr.getState() == OspfNeighborState.EXCHANGE || nbr.getState() == OspfNeighborState.LOADING) {
                if (nbr.getLsReqList().containsKey(key)) {
                    LsaWrapper lsWrapper = lsaLookup(recLsa);
                    if (lsWrapper != null) {
                        LsaHeader ownLsa = (LsaHeader) lsWrapper.ospfLsa();
                        String status = isNewerOrSameLsa(recLsa, ownLsa);
                        if (status.equals("old")) {
                            continue;
                        } else if (status.equals("same")) {
                            log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: " +
                                              "Removing lsa from reTxtList {}", key);
                            nbr.getLsReqList().remove(key);
                            continue;
                        } else {
                            log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: " +
                                              "Removing lsa from reTxtList {}", key);
                            nbr.getLsReqList().remove(key);
                        }
                    }
                }
            }
            if (recLsa.advertisingRouter().equals((String) neighborIP)) {
                continue;
            }
            if ((recLsa.lsType() == OspfParameters.LINK_LOCAL_OPAQUE_LSA ||
                    recLsa.lsType() == OspfParameters.AREA_LOCAL_OPAQUE_LSA)) {
                if (nbr.isOpaqueCapable()) {
                    log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: Adding lsa to reTxtList {}",
                              recLsa);
                    nbr.getReTxList().put(key, recLsa);
                }
            } else {
                log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: Adding lsa to reTxtList {}",
                          recLsa);
                nbr.getReTxList().put(key, recLsa);
            }
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:57,代码来源:OspfAreaImpl.java

示例2: updateInterfaceMap

import org.onosproject.ospf.controller.OspfInterface; //导入方法依赖的package包/类
/**
 * Updates the interface map with interface details.
 *
 * @param ospfProcesses updated process instances
 * @throws Exception might throws exception
 */
public void updateInterfaceMap(List<OspfProcess> ospfProcesses) throws Exception {
    for (OspfProcess ospfUpdatedProcess : ospfProcesses) {
        for (OspfArea updatedArea : ospfUpdatedProcess.areas()) {
            for (OspfInterface ospfUpdatedInterface : updatedArea.ospfInterfaceList()) {
                OspfInterface ospfInterface = ospfInterfaceMap.get(ospfUpdatedInterface.interfaceIndex());
                if (ospfInterface == null) {
                    ospfUpdatedInterface.setOspfArea(updatedArea);
                    ((OspfInterfaceImpl) ospfUpdatedInterface).setController(controller);
                    ((OspfInterfaceImpl) ospfUpdatedInterface).setState(OspfInterfaceState.DOWN);
                    ospfUpdatedInterface.setDr(Ip4Address.valueOf("0.0.0.0"));
                    ospfUpdatedInterface.setBdr(Ip4Address.valueOf("0.0.0.0"));
                    ospfInterfaceMap.put(ospfUpdatedInterface.interfaceIndex(), ospfUpdatedInterface);
                    ((OspfInterfaceImpl) ospfUpdatedInterface).setChannel(channel);
                    ospfUpdatedInterface.interfaceUp();
                    ospfUpdatedInterface.startDelayedAckTimer();
                } else {
                    ospfInterface.setOspfArea(updatedArea);

                    if (ospfInterface.routerDeadIntervalTime() != ospfUpdatedInterface.routerDeadIntervalTime()) {
                        ospfInterface.setRouterDeadIntervalTime(ospfUpdatedInterface.routerDeadIntervalTime());
                        Map<String, OspfNbr> neighbors = ospfInterface.listOfNeighbors();
                        for (String key : neighbors.keySet()) {
                            OspfNbr ospfNbr = ospfInterface.neighbouringRouter(key);
                            ospfNbr.setRouterDeadInterval(ospfInterface.routerDeadIntervalTime());
                            ospfNbr.stopInactivityTimeCheck();
                            ospfNbr.startInactivityTimeCheck();
                        }
                    }
                    if (ospfInterface.interfaceType() != ospfUpdatedInterface.interfaceType()) {
                        ospfInterface.setInterfaceType(ospfUpdatedInterface.interfaceType());
                        if (ospfInterface.interfaceType() == OspfInterfaceType.POINT_TO_POINT.value()) {
                            ospfInterface.setDr(Ip4Address.valueOf("0.0.0.0"));
                            ospfInterface.setBdr(Ip4Address.valueOf("0.0.0.0"));
                        }
                        ospfInterface.removeNeighbors();
                    }
                    if (ospfInterface.helloIntervalTime() != ospfUpdatedInterface.helloIntervalTime()) {
                        ospfInterface.setHelloIntervalTime(ospfUpdatedInterface.helloIntervalTime());
                        ospfInterface.stopHelloTimer();
                        ospfInterface.startHelloTimer();
                    }
                    ospfInterfaceMap.put(ospfInterface.interfaceIndex(), ospfInterface);
                }
            }
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:54,代码来源:OspfInterfaceChannelHandler.java

示例3: addToOtherNeighborLsaTxList

import org.onosproject.ospf.controller.OspfInterface; //导入方法依赖的package包/类
/**
 * Adds the received LSA in other neighbors tx list.
 *
 * @param recLsa LSA Header instance
 */
public void addToOtherNeighborLsaTxList(LsaHeader recLsa) {
    //Add the received LSA in other neighbors retransmission list.
    log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList");
    List<OspfInterface> ospfInterfaces = ospfInterfaceList();
    for (OspfInterface ospfInterfaceFromArea : ospfInterfaces) {
        Map neighbors = ospfInterfaceFromArea.listOfNeighbors();
        for (Object neighborIP : neighbors.keySet()) {
            OspfNbrImpl nbr = (OspfNbrImpl) neighbors.get(neighborIP);
            if (nbr.getState().getValue() < OspfNeighborState.EXCHANGE.getValue()) {
                continue;
            }
            String key = database.getLsaKey(recLsa);
            if (nbr.getState() == OspfNeighborState.EXCHANGE || nbr.getState() == OspfNeighborState.LOADING) {
                if (nbr.getLsReqList().containsKey(key)) {
                    LsaWrapper lsWrapper = lsaLookup(recLsa);
                    if (lsWrapper != null) {
                        LsaHeader ownLsa = (LsaHeader) lsWrapper.ospfLsa();
                        String status = isNewerOrSameLsa(recLsa, ownLsa);
                        if (status.equals("old")) {
                            continue;
                        } else if (status.equals("same")) {
                            log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: " +
                                              "Removing lsa from reTxtList {}", key);
                            nbr.getLsReqList().remove(key);
                            continue;
                        } else {
                            log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: " +
                                              "Removing lsa from reTxtList {}", key);
                            nbr.getLsReqList().remove(key);
                        }
                    }
                }
            }
            if (recLsa.advertisingRouter().toString().equals((String) neighborIP)) {
                continue;
            }
            if ((recLsa.lsType() == OspfParameters.LINK_LOCAL_OPAQUE_LSA ||
                    recLsa.lsType() == OspfParameters.AREA_LOCAL_OPAQUE_LSA)) {
                if (nbr.isOpaqueCapable()) {
                    log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: Adding lsa to reTxtList {}",
                              recLsa);
                    nbr.getReTxList().put(key, recLsa);
                }
            } else {
                log.debug("OspfAreaImpl: addToOtherNeighborLsaTxList: Adding lsa to reTxtList {}",
                          recLsa);
                nbr.getReTxList().put(key, recLsa);
            }
        }
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:57,代码来源:OspfAreaImpl.java

示例4: updateInterfaceMap

import org.onosproject.ospf.controller.OspfInterface; //导入方法依赖的package包/类
/**
 * Updates the interface map with interface details.
 *
 * @param ospfProcesses updated process instances
 */
public void updateInterfaceMap(List<OspfProcess> ospfProcesses) {
    for (OspfProcess ospfUpdatedProcess : ospfProcesses) {
        for (OspfArea updatedArea : ospfUpdatedProcess.areas()) {
            for (OspfInterface ospfUpdatedInterface : updatedArea.ospfInterfaceList()) {
                OspfInterface ospfInterface = ospfInterfaceMap.get(ospfUpdatedInterface.interfaceIndex());
                if (ospfInterface == null) {
                    ospfUpdatedInterface.setOspfArea(updatedArea);
                    ((OspfInterfaceImpl) ospfUpdatedInterface).setController(controller);
                    ((OspfInterfaceImpl) ospfUpdatedInterface).setState(OspfInterfaceState.DOWN);
                    ospfUpdatedInterface.setDr(Ip4Address.valueOf("0.0.0.0"));
                    ospfUpdatedInterface.setBdr(Ip4Address.valueOf("0.0.0.0"));
                    ospfInterfaceMap.put(ospfUpdatedInterface.interfaceIndex(), ospfUpdatedInterface);
                    ((OspfInterfaceImpl) ospfUpdatedInterface).setChannel(channel);
                    ospfUpdatedInterface.interfaceUp();
                    ospfUpdatedInterface.startDelayedAckTimer();
                } else {
                    ospfInterface.setOspfArea(updatedArea);

                    if (ospfInterface.routerDeadIntervalTime() != ospfUpdatedInterface.routerDeadIntervalTime()) {
                        ospfInterface.setRouterDeadIntervalTime(ospfUpdatedInterface.routerDeadIntervalTime());
                        Map<String, OspfNbr> neighbors = ospfInterface.listOfNeighbors();
                        for (String key : neighbors.keySet()) {
                            OspfNbr ospfNbr = ospfInterface.neighbouringRouter(key);
                            ospfNbr.setRouterDeadInterval(ospfInterface.routerDeadIntervalTime());
                            ospfNbr.stopInactivityTimeCheck();
                            ospfNbr.startInactivityTimeCheck();
                        }
                    }
                    if (ospfInterface.interfaceType() != ospfUpdatedInterface.interfaceType()) {
                        ospfInterface.setInterfaceType(ospfUpdatedInterface.interfaceType());
                        if (ospfInterface.interfaceType() == OspfInterfaceType.POINT_TO_POINT.value()) {
                            ospfInterface.setDr(Ip4Address.valueOf("0.0.0.0"));
                            ospfInterface.setBdr(Ip4Address.valueOf("0.0.0.0"));
                        }
                        ospfInterface.removeNeighbors();
                    }
                    if (ospfInterface.helloIntervalTime() != ospfUpdatedInterface.helloIntervalTime()) {
                        ospfInterface.setHelloIntervalTime(ospfUpdatedInterface.helloIntervalTime());
                        ospfInterface.stopHelloTimer();
                        ospfInterface.startHelloTimer();
                    }
                    ospfInterfaceMap.put(ospfInterface.interfaceIndex(), ospfInterface);
                }
            }
        }
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:53,代码来源:OspfInterfaceChannelHandler.java


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