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


Java OspfProcess类代码示例

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


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

示例1: initializeInterfaceMap

import org.onosproject.ospf.controller.OspfProcess; //导入依赖的package包/类
/**
 * Initializes the interface map with interface details.
 *
 * @throws Exception might throws exception
 */
public void initializeInterfaceMap() throws Exception {
    for (OspfProcess process : processes) {
        for (OspfArea area : process.areas()) {
            for (OspfInterface ospfInterface : area.ospfInterfaceList()) {
                OspfInterface anInterface = ospfInterfaceMap.get(ospfInterface.interfaceIndex());
                if (anInterface == null) {
                    ospfInterface.setOspfArea(area);
                    ((OspfInterfaceImpl) ospfInterface).setController(controller);
                    ((OspfInterfaceImpl) ospfInterface).setState(OspfInterfaceState.DOWN);
                    ospfInterface.setDr(Ip4Address.valueOf("0.0.0.0"));
                    ospfInterface.setBdr(Ip4Address.valueOf("0.0.0.0"));
                    ospfInterfaceMap.put(ospfInterface.interfaceIndex(), ospfInterface);
                }
                ((OspfInterfaceImpl) ospfInterface).setChannel(channel);
                ospfInterface.interfaceUp();
                ospfInterface.startDelayedAckTimer();
            }
            //Initialize the LSDB and aging process
            area.initializeDb();
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:OspfInterfaceChannelHandler.java

示例2: initializeInterfaceMap

import org.onosproject.ospf.controller.OspfProcess; //导入依赖的package包/类
/**
 * Initializes the interface map with interface details.
 */
public void initializeInterfaceMap()  {
    for (OspfProcess process : processes) {
        for (OspfArea area : process.areas()) {
            for (OspfInterface ospfInterface : area.ospfInterfaceList()) {
                OspfInterface anInterface = ospfInterfaceMap.get(ospfInterface.interfaceIndex());
                if (anInterface == null) {
                    ospfInterface.setOspfArea(area);
                    ((OspfInterfaceImpl) ospfInterface).setController(controller);
                    ((OspfInterfaceImpl) ospfInterface).setState(OspfInterfaceState.DOWN);
                    ospfInterface.setDr(Ip4Address.valueOf("0.0.0.0"));
                    ospfInterface.setBdr(Ip4Address.valueOf("0.0.0.0"));
                    ospfInterfaceMap.put(ospfInterface.interfaceIndex(), ospfInterface);
                }
                ((OspfInterfaceImpl) ospfInterface).setChannel(channel);
                ospfInterface.interfaceUp();
                ospfInterface.startDelayedAckTimer();
            }
            //Initialize the LSDB and aging process
            area.initializeDb();
        }
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:26,代码来源:OspfInterfaceChannelHandler.java

示例3: processes

import org.onosproject.ospf.controller.OspfProcess; //导入依赖的package包/类
/**
 * Returns list of OSPF process from the json nodes.
 *
 * @param jsonNodes represents one or more OSPF process configuration
 * @return list of OSPF processes.
 */
public static List<OspfProcess> processes(JsonNode jsonNodes) {
    List<OspfProcess> ospfProcesses = new ArrayList<>();
    if (jsonNodes == null) {
        return ospfProcesses;
    }
    //From each Process nodes, get area and related interface details.
    jsonNodes.forEach(jsonNode -> {
        List<OspfArea> areas = new ArrayList<>();
        //Get configured areas for the process.
        for (JsonNode areaNode : jsonNode.path(AREAS)) {
            List<OspfInterface> interfaceList = new ArrayList<>();
            for (JsonNode interfaceNode : areaNode.path(INTERFACE)) {
                OspfInterface ospfInterface = interfaceDetails(interfaceNode);
                if (ospfInterface != null) {
                    interfaceList.add(ospfInterface);
                }
            }
            //Get the area details
            OspfArea area = areaDetails(areaNode);
            if (area != null) {
                area.setOspfInterfaceList(interfaceList);
                areas.add(area);
            }
        }
        OspfProcess process = new OspfProcessImpl();
        process.setProcessId(jsonNode.path(PROCESSID).asText());
        process.setAreas(areas);
        ospfProcesses.add(process);
    });

    return ospfProcesses;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:39,代码来源:OspfConfigUtil.java

示例4: updateConfig

import org.onosproject.ospf.controller.OspfProcess; //导入依赖的package包/类
/**
 * Updates the processes configuration.
 *
 * @param ospfProcesses list of OSPF process instances
 * @throws Exception might throws parse exception
 */
public void updateConfig(List<OspfProcess> ospfProcesses) throws Exception {
    log.debug("Controller::UpdateConfig called");
    configPacket = new byte[OspfUtil.CONFIG_LENGTH];
    byte numberOfInterface = 0; // number of interfaces to configure
    configPacket[0] = (byte) 0xFF; // its a conf packet - identifier
    for (OspfProcess ospfProcess : ospfProcesses) {
        log.debug("OspfProcessDetails : " + ospfProcess);
        for (OspfArea ospfArea : ospfProcess.areas()) {
            for (OspfInterface ospfInterface : ospfArea.ospfInterfaceList()) {
                log.debug("OspfInterfaceDetails : " + ospfInterface);
                numberOfInterface++;
                configPacket[2 * numberOfInterface] = (byte) ospfInterface.interfaceIndex();
                configPacket[(2 * numberOfInterface) + 1] = (byte) 4;
            }
        }
    }
    configPacket[1] = numberOfInterface;
    //First time configuration
    if (processes == null) {
        if (ospfProcesses.size() > 0) {
            processes = ospfProcesses;
            connectPeer();
        }
    } else {
        ospfChannelHandler.updateInterfaceMap(ospfProcesses);
        //Send the config packet
        ospfChannelHandler.sentConfigPacket(configPacket);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:36,代码来源:Controller.java

示例5: updateConfig

import org.onosproject.ospf.controller.OspfProcess; //导入依赖的package包/类
@Override
public void updateConfig(JsonNode processesNode) {
    try {
        List<OspfProcess> ospfProcesses = OspfConfigUtil.processes(processesNode);
        //if there is interface details then update configuration
        if (ospfProcesses.size() > 0 &&
                ospfProcesses.get(0).areas() != null && ospfProcesses.get(0).areas().size() > 0 &&
                ospfProcesses.get(0).areas().get(0) != null &&
                ospfProcesses.get(0).areas().get(0).ospfInterfaceList().size() > 0) {
            ctrl.updateConfig(ospfProcesses);
        }
    } catch (Exception e) {
        log.debug("Error::updateConfig::{}", e.getMessage());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:OspfControllerImpl.java

示例6: buildLsaLists

import org.onosproject.ospf.controller.OspfProcess; //导入依赖的package包/类
/**
 * Builds all LSA lists with LSA details.
 */
private void buildLsaLists() {
    this.ospfController = get(OspfController.class);
    List<OspfProcess> listOfProcess = ospfController.getAllConfiguredProcesses();
    Iterator<OspfProcess> itrProcess = listOfProcess.iterator();
    while (itrProcess.hasNext()) {
        OspfProcess ospfProcess = itrProcess.next();
        if (process.equalsIgnoreCase(ospfProcess.processId())) {
            List<OspfArea> listAreas = ospfProcess.areas();
            Iterator<OspfArea> itrArea = listAreas.iterator();
            while (itrArea.hasNext()) {
                OspfArea area = itrArea.next();
                List<LsaHeader> lsas = area.database()
                        .getAllLsaHeaders(false, area.isOpaqueEnabled());
                List<LsaHeader> tmpLsaList = new ArrayList<>(lsas);
                log.debug("OSPFController::size of database::" + (lsas != null ? lsas.size() : null));
                Iterator<LsaHeader> itrLsaHeader = tmpLsaList.iterator();
                areaList.add(area);
                if (itrLsaHeader != null) {
                    while (itrLsaHeader.hasNext()) {
                        LsaHeader header = itrLsaHeader.next();
                        populateLsaLists(header, area);
                    }
                }
            }
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:31,代码来源:ApplicationOspfCommand.java

示例7: buildNeighborInformation

import org.onosproject.ospf.controller.OspfProcess; //导入依赖的package包/类
/**
 * Builds OSPF neighbor information.
 */
private void buildNeighborInformation() {
    try {
        this.ospfController = get(OspfController.class);
        List<OspfProcess> listOfProcess = ospfController.getAllConfiguredProcesses();
        boolean flag = false;
        printNeighborsFormat();
        Iterator<OspfProcess> itrProcess = listOfProcess.iterator();
        while (itrProcess.hasNext()) {
            OspfProcess process = itrProcess.next();
            List<OspfArea> listAreas = process.areas();
            Iterator<OspfArea> itrArea = listAreas.iterator();
            while (itrArea.hasNext()) {
                OspfArea area = itrArea.next();
                List<OspfInterface> itrefaceList = area.ospfInterfaceList();
                for (OspfInterface interfc : itrefaceList) {
                    List<OspfNbr> nghbrList = new ArrayList<>(interfc.listOfNeighbors().values());
                    for (OspfNbr neigbor : nghbrList) {
                        print("%-20s%-20s%-20s%-20s%-20s\n", neigbor.neighborId(), neigbor.routerPriority(),
                              neigbor.getState() + "/" + checkDrBdrOther(neigbor.neighborIpAddr().toString(),
                                                                         neigbor.neighborDr().toString(),
                                                                         neigbor.neighborBdr().toString()),
                              neigbor.neighborIpAddr().toString(), interfc.ipAddress());
                    }
                }
            }
        }
    } catch (Exception ex) {
        print("Error occured while Ospf controller getting called" + ex.getMessage());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:34,代码来源:ApplicationOspfCommand.java

示例8: updateConfig

import org.onosproject.ospf.controller.OspfProcess; //导入依赖的package包/类
/**
 * Updates the processes configuration.
 *
 * @param ospfProcesses list of OSPF process instances
 */
public void updateConfig(List<OspfProcess> ospfProcesses) {
    log.debug("Controller::UpdateConfig called");
    configPacket = new byte[OspfUtil.CONFIG_LENGTH];
    byte numberOfInterface = 0; // number of interfaces to configure
    configPacket[0] = (byte) 0xFF; // its a conf packet - identifier
    for (OspfProcess ospfProcess : ospfProcesses) {
        log.debug("OspfProcessDetails : " + ospfProcess);
        for (OspfArea ospfArea : ospfProcess.areas()) {
            for (OspfInterface ospfInterface : ospfArea.ospfInterfaceList()) {
                log.debug("OspfInterfaceDetails : " + ospfInterface);
                numberOfInterface++;
                configPacket[2 * numberOfInterface] = (byte) ospfInterface.interfaceIndex();
                configPacket[(2 * numberOfInterface) + 1] = (byte) 4;
            }
        }
    }
    configPacket[1] = numberOfInterface;
    //First time configuration
    if (processes == null) {
        if (ospfProcesses.size() > 0) {
            processes = ospfProcesses;
            connectPeer();
        }
    } else {
        ospfChannelHandler.updateInterfaceMap(ospfProcesses);
        //Send the config packet
        ospfChannelHandler.sentConfigPacket(configPacket);
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:35,代码来源:Controller.java

示例9: updateConfig

import org.onosproject.ospf.controller.OspfProcess; //导入依赖的package包/类
@Override
public void updateConfig(JsonNode processesNode) {
    try {
        List<OspfProcess> ospfProcesses = OspfConfigUtil.processes(processesNode);
        //if there is interface details then update configuration
        if (!ospfProcesses.isEmpty() &&
                ospfProcesses.get(0).areas() != null && !ospfProcesses.get(0).areas().isEmpty() &&
                ospfProcesses.get(0).areas().get(0) != null &&
                !ospfProcesses.get(0).areas().get(0).ospfInterfaceList().isEmpty()) {
            ctrl.updateConfig(ospfProcesses);
        }
    } catch (Exception e) {
        log.debug("Error::updateConfig::{}", e.getMessage());
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:16,代码来源:OspfControllerImpl.java

示例10: updateInterfaceMap

import org.onosproject.ospf.controller.OspfProcess; //导入依赖的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

示例11: getAllConfiguredProcesses

import org.onosproject.ospf.controller.OspfProcess; //导入依赖的package包/类
@Override
public List<OspfProcess> getAllConfiguredProcesses() {
    List<OspfProcess> processes = ctrl.getAllConfiguredProcesses();
    return processes;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:6,代码来源:OspfControllerImpl.java

示例12: deleteConfig

import org.onosproject.ospf.controller.OspfProcess; //导入依赖的package包/类
@Override
public void deleteConfig(List<OspfProcess> processes, String attribute) {
}
 
开发者ID:shlee89,项目名称:athena,代码行数:4,代码来源:OspfControllerImpl.java

示例13: getAllConfiguredProcesses

import org.onosproject.ospf.controller.OspfProcess; //导入依赖的package包/类
@Override
public List<OspfProcess> getAllConfiguredProcesses() {
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:OspfTopologyProviderTest.java

示例14: updateInterfaceMap

import org.onosproject.ospf.controller.OspfProcess; //导入依赖的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

示例15: getProcesses

import org.onosproject.ospf.controller.OspfProcess; //导入依赖的package包/类
/**
 * Gets the configured processes.
 *
 * @return list of configured processes.
 */
public List<OspfProcess> getProcesses() {
    return processes;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:Configuration.java


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