本文整理汇总了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);
}
}
}
}
示例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);
}
}
}
}
}
示例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);
}
}
}
}
示例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);
}
}
}
}
}