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


Java OspfAreaImpl类代码示例

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


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

示例1: processMaxAgeLsa

import org.onosproject.ospf.controller.area.OspfAreaImpl; //导入依赖的package包/类
/**
 * Process max age LSA.
 *
 * @param wrapper LSA wrapper instance
 */
private void processMaxAgeLsa(LsaWrapper wrapper) {
    //set the destination
    OspfInterface ospfInterface = wrapper.ospfInterface();
    if (ospfInterface != null) {
        LsaHeader header = (LsaHeader) wrapper.ospfLsa().lsaHeader();
        header.setAge(OspfParameters.MAXAGE);
        ((LsaWrapperImpl) wrapper).lsaHeader().setAge(OspfParameters.MAXAGE);
        if (((OspfInterfaceImpl) ospfInterface).state() == OspfInterfaceState.DR ||
                ((OspfInterfaceImpl) ospfInterface).state() == OspfInterfaceState.POINT2POINT) {
            //remove from db
            ((OspfAreaImpl) ospfArea).addToOtherNeighborLsaTxList(((LsaWrapperImpl) wrapper).lsaHeader());
            ((OspfAreaImpl) ospfArea).deleteLsa(((LsaWrapperImpl) wrapper).lsaHeader());
        } else {
            ((OspfAreaImpl) ospfArea).deleteLsa(((LsaWrapperImpl) wrapper).lsaHeader());
        }
        log.debug("LSAQueueConsumer: processMaxAgeLsa - Flooded SelfOriginated-Max Age LSA {}",
                  ((LsaWrapperImpl) wrapper).lsaHeader());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:LsaQueueConsumer.java

示例2: addLsaToHeaderList

import org.onosproject.ospf.controller.area.OspfAreaImpl; //导入依赖的package包/类
/**
 * Adds the LSAs to summary list.
 *
 * @param summList         summary list
 * @param excludeMaxAgeLsa exclude max age LSA
 * @param lsaMap           map of LSA
 */
private void addLsaToHeaderList(List summList, boolean excludeMaxAgeLsa, Map lsaMap) {
    Iterator slotVals = lsaMap.values().iterator();
    while (slotVals.hasNext()) {
        LsaWrapper wrapper = (LsaWrapper) slotVals.next();
        if (excludeMaxAgeLsa) {
            //if current age of lsa is max age or lsa present in Max Age bin
            if (wrapper.currentAge() != OspfParameters.MAXAGE &&
                    lsdbAge.getMaxAgeBin().ospfLsa(((OspfAreaImpl)
                            ospfArea).getLsaKey(((LsaWrapperImpl) wrapper).lsaHeader())) == null) {
                addToList(wrapper, summList);
            }
        } else {
            addToList(wrapper, summList);
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:OspfLsdbImpl.java

示例3: testRun1

import org.onosproject.ospf.controller.area.OspfAreaImpl; //导入依赖的package包/类
/**
 * Tests run() method.
 */
@Test
public void testRun1() throws Exception {
    blockingQueue = new ArrayBlockingQueue(5);
    channel = EasyMock.createMock(Channel.class);
    ospfArea = new OspfAreaImpl();
    lsaWrapper = new LsaWrapperImpl();
    routerLsa = new RouterLsa();
    routerLsa.setLsType(1);
    lsaWrapper.addLsa(OspfLsaType.ROUTER, routerLsa);
    ospfInterface = new OspfInterfaceImpl();
    ospfInterface.setState(OspfInterfaceState.DR);
    lsaWrapper.setOspfInterface(ospfInterface);
    lsaWrapper.setIsSelfOriginated(true);
    lsaHeader = new LsaHeader();
    lsaHeader.setLsType(1);
    lsaWrapper.setLsaHeader(lsaHeader);
    lsaWrapper.setLsaProcessing("refreshLsa");
    lsaWrapper.setLsdbAge(new LsdbAgeImpl(ospfArea));
    blockingQueue.add(lsaWrapper);
    lsaQueueConsumer = new LsaQueueConsumer(blockingQueue, channel, ospfArea);
    lsaQueueConsumer.run();
    assertThat(lsaQueueConsumer, is(notNullValue()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:LsaQueueConsumerTest.java

示例4: testRun3

import org.onosproject.ospf.controller.area.OspfAreaImpl; //导入依赖的package包/类
@Test
public void testRun3() throws Exception {
    blockingQueue = new ArrayBlockingQueue(5);
    channel = EasyMock.createMock(Channel.class);
    ospfArea = new OspfAreaImpl();
    lsaWrapper = new LsaWrapperImpl();
    routerLsa = new RouterLsa();
    routerLsa.setLsType(2);
    lsaWrapper.addLsa(OspfLsaType.NETWORK, routerLsa);
    ospfInterface = new OspfInterfaceImpl();
    ospfInterface.setState(OspfInterfaceState.BDR);
    lsaWrapper.setOspfInterface(ospfInterface);
    lsaWrapper.setIsSelfOriginated(true);
    lsaHeader = new LsaHeader();
    lsaHeader.setLsType(2);
    lsaWrapper.setLsaHeader(lsaHeader);
    lsaWrapper.setLsaProcessing("refreshLsa");
    lsaWrapper.setLsdbAge(new LsdbAgeImpl(ospfArea));
    blockingQueue.add(lsaWrapper);
    lsaQueueConsumer = new LsaQueueConsumer(blockingQueue, channel, ospfArea);
    lsaQueueConsumer.run();
    assertThat(lsaQueueConsumer, is(notNullValue()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:LsaQueueConsumerTest.java

示例5: testRun5

import org.onosproject.ospf.controller.area.OspfAreaImpl; //导入依赖的package包/类
/**
 * Tests run() method.
 */
@Test
public void testRun5() throws Exception {
    blockingQueue = new ArrayBlockingQueue(5);
    channel = EasyMock.createMock(Channel.class);
    ospfArea = new OspfAreaImpl();
    lsaWrapper = new LsaWrapperImpl();
    routerLsa = new RouterLsa();
    routerLsa.setLsType(2);
    lsaWrapper.addLsa(OspfLsaType.NETWORK, routerLsa);
    ospfInterface = new OspfInterfaceImpl();
    ospfInterface.setState(OspfInterfaceState.DR);
    lsaWrapper.setOspfInterface(ospfInterface);
    lsaWrapper.setIsSelfOriginated(true);
    lsaHeader = new LsaHeader();
    lsaHeader.setLsType(2);
    lsaWrapper.setLsaHeader(lsaHeader);
    lsaWrapper.setLsaProcessing("maxAgeLsa");
    lsaWrapper.setLsdbAge(new LsdbAgeImpl(ospfArea));
    blockingQueue.add(lsaWrapper);
    lsaQueueConsumer = new LsaQueueConsumer(blockingQueue, channel, ospfArea);
    lsaQueueConsumer.run();
    assertThat(lsaQueueConsumer, is(notNullValue()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:LsaQueueConsumerTest.java

示例6: testMaxageLsa

import org.onosproject.ospf.controller.area.OspfAreaImpl; //导入依赖的package包/类
/**
 * Tests maxAgeLsa() method.
 */
@Test
public void testMaxageLsa() throws Exception {
    lsaWrapper = EasyMock.createMock(LsaWrapperImpl.class);
    ospfArea = new OspfAreaImpl();
    lsdbAge = new LsdbAgeImpl(ospfArea);
    lsaWrapper.setLsdbAge(lsdbAge);
    lsdbAge.addLsaToMaxAgeBin("lsa1", lsaWrapper);
    lsaBin = new LsaBinImpl(1);
    lsaBin.addOspfLsa("1", lsaWrapper);
    lsaWrapper = EasyMock.createMock(LsaWrapperImpl.class);
    lsdbAge.addLsaToMaxAgeBin("lsa2", lsaWrapper);
    lsaBin.addOspfLsa("2", lsaWrapper);
    lsdbAge.startDbAging();
    lsdbAge = new LsdbAgeImpl(new OspfAreaImpl());
    lsdbAge.ageLsaAndFlood();
    lsdbAge.maxAgeLsa();
    assertThat(lsdbAge, is(notNullValue()));

}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:LsdbAgeImplTest.java

示例7: createOspfInterface

import org.onosproject.ospf.controller.area.OspfAreaImpl; //导入依赖的package包/类
/**
 * Utility for test method.
 */
private OspfInterfaceImpl createOspfInterface() throws UnknownHostException {
    ospfInterface = new OspfInterfaceImpl();
    OspfAreaImpl ospfArea = new OspfAreaImpl();
    OspfInterfaceChannelHandler ospfInterfaceChannelHandler = EasyMock.createMock(
            OspfInterfaceChannelHandler.class);
    ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.226.165.164"),
                              Ip4Address.valueOf("1.1.1.1"), 2,
                              topologyForDeviceAndLink);
    ospfNbr.setState(OspfNeighborState.EXSTART);
    ospfNbr.setNeighborId(Ip4Address.valueOf("10.226.165.100"));
    this.ospfInterface = new OspfInterfaceImpl();
    this.ospfInterface.setIpAddress(Ip4Address.valueOf("10.226.165.164"));
    this.ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
    this.ospfInterface.setBdr(Ip4Address.valueOf("111.111.111.111"));
    this.ospfInterface.setDr(Ip4Address.valueOf("111.111.111.111"));
    this.ospfInterface.setHelloIntervalTime(20);
    this.ospfInterface.setInterfaceType(2);
    this.ospfInterface.setReTransmitInterval(2000);
    this.ospfInterface.setMtu(6500);
    this.ospfInterface.setRouterDeadIntervalTime(1000);
    this.ospfInterface.setRouterPriority(1);
    this.ospfInterface.setInterfaceType(1);
    this.ospfInterface.addNeighbouringRouter(ospfNbr);
    return this.ospfInterface;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:OspfNbrImplTest.java

示例8: testUpdateConfig1

import org.onosproject.ospf.controller.area.OspfAreaImpl; //导入依赖的package包/类
/**
 * Tests updateConfig() method.
 */
@Test
public void testUpdateConfig1() throws Exception {
    ospfProcess = new OspfProcessImpl();
    ospfArea = new OspfAreaImpl();
    ospfInterface = new OspfInterfaceImpl();
    ospfInterfaces = new ArrayList();
    ospfInterface.setIpAddress(Ip4Address.valueOf("10.10.10.5"));
    ospfInterfaces.add(ospfInterface);
    ospfArea.setAreaId(Ip4Address.valueOf("2.2.2.2"));
    ospfArea.setOspfInterfaceList(ospfInterfaces);
    ospfProcess.setProcessId("10.10.10.10");
    ospfAreas = new ArrayList();
    ospfAreas.add(ospfArea);
    ospfProcess.setAreas(ospfAreas);
    ospfProcesses = new ArrayList();
    ospfProcesses.add(ospfProcess);
    controller.updateConfig(ospfProcesses);
    assertThat(controller, is(notNullValue()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:ControllerTest.java

示例9: createOspfArea

import org.onosproject.ospf.controller.area.OspfAreaImpl; //导入依赖的package包/类
/**
 * Utility for test method.
 */
private OspfAreaImpl createOspfArea() throws Exception {
    OspfAreaAddressRangeImpl ospfAreaAddressRange;
    ospfAreaAddressRange = createOspfAreaAddressRange();
    addressRanges.add(ospfAreaAddressRange);
    OspfAreaImpl ospfArea = new OspfAreaImpl();
    ospfArea.setAreaId(ip4Address5);
    ospfArea.setExternalRoutingCapability(true);
    OspfInterfaceImpl ospfInterface = createOspfInterface();
    ospfInterfaces.add(ospfInterface);
    ospfArea.setOspfInterfaceList(ospfInterfaces);
    RouterLsa routerLsa = new RouterLsa();
    routerLsa.setLsType(1);
    routerLsa.setLinkStateId(string1);
    routerLsa.setAdvertisingRouter(ip4Address2);
    ospfArea.addLsa(routerLsa, false, ospfInterface);
    ospfArea.setRouterId(ip4Address4);

    return ospfArea;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:OspfInterfaceChannelHandlerTest.java

示例10: removeLsaFromBin

import org.onosproject.ospf.controller.area.OspfAreaImpl; //导入依赖的package包/类
/**
 * Removes LSA from Bin.
 *
 * @param lsaWrapper wrapper instance
 */
public void removeLsaFromBin(LsaWrapper lsaWrapper) {
    if (ageBins.containsKey(lsaWrapper.binNumber())) {
        LsaBin lsaBin = ageBins.get(lsaWrapper.binNumber());
        lsaBin.removeOspfLsa(((OspfAreaImpl) ospfArea).getLsaKey(((LsaWrapperImpl)
                lsaWrapper).lsaHeader()), lsaWrapper);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:LsdbAgeImpl.java

示例11: processRefreshLsa

import org.onosproject.ospf.controller.area.OspfAreaImpl; //导入依赖的package包/类
/**
 * Process refresh LSA.
 *
 * @param wrapper LSA wrapper instance
 */
private void processRefreshLsa(LsaWrapper wrapper) throws Exception {
    if (wrapper.isSelfOriginated()) { //self originated
        //set the destination
        OspfInterface ospfInterface = wrapper.ospfInterface();
        if (ospfInterface != null) {
            LsaHeader header = ((LsaWrapperImpl) wrapper).lsaHeader();
            header.setAge(wrapper.currentAge());
            if (((OspfInterfaceImpl) ospfInterface).state() == OspfInterfaceState.DR) {
                if (header.lsType() == OspfLsaType.ROUTER.value()) {
                    RouterLsa routerLsa = ((OspfAreaImpl) ospfArea).buildRouterLsa(ospfInterface);
                    ((OspfAreaImpl) ospfArea).addLsa(routerLsa, true, ospfInterface);
                    ((OspfAreaImpl) ospfArea).addToOtherNeighborLsaTxList(routerLsa);
                } else if (header.lsType() == OspfLsaType.NETWORK.value()) {
                    if (ospfInterface.listOfNeighbors().size() > 0) {
                        NetworkLsa networkLsa = ((OspfAreaImpl) ospfArea).buildNetworkLsa(
                                ospfInterface.ipAddress(), ospfInterface.ipNetworkMask());
                        ospfArea.addLsa(networkLsa, true, ospfInterface);
                        ((OspfAreaImpl) ospfArea).addToOtherNeighborLsaTxList(networkLsa);
                    }
                }
            }

            if (((OspfInterfaceImpl) ospfInterface).state() == OspfInterfaceState.BDR ||
                    ((OspfInterfaceImpl) ospfInterface).state() == OspfInterfaceState.POINT2POINT ||
                    ((OspfInterfaceImpl) ospfInterface).state() == OspfInterfaceState.DROTHER) {
                ospfArea.refreshArea(ospfInterface);
            }
            log.debug("LSAQueueConsumer: processRefreshLsa - Flooded SelfOriginated LSA {}",
                      ((LsaWrapperImpl) wrapper).lsaHeader());
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:38,代码来源:LsaQueueConsumer.java

示例12: areaDetails

import org.onosproject.ospf.controller.area.OspfAreaImpl; //导入依赖的package包/类
/**
 * Returns OSPF area instance from configuration.
 *
 * @param areaNode area configuration
 * @return OSPF area instance
 */
private static OspfArea areaDetails(JsonNode areaNode) {
    OspfArea area = new OspfAreaImpl();
    String areaId = areaNode.path(AREAID).asText();
    if (isValidIpAddress(areaId)) {
        area.setAreaId(Ip4Address.valueOf(areaId));
    } else {
        log.debug("Wrong areaId: {}", areaId);
        return null;
    }
    String routerId = areaNode.path(ROUTERID).asText();
    if (isValidIpAddress(routerId)) {
        area.setRouterId(Ip4Address.valueOf(routerId));
    } else {
        log.debug("Wrong routerId: {}", routerId);
        return null;
    }
    String routingCapability = areaNode.path(EXTERNALROUTINGCAPABILITY).asText();
    if (isBoolean(routingCapability)) {
        area.setExternalRoutingCapability(Boolean.valueOf(routingCapability));
    } else {
        log.debug("Wrong routingCapability: {}", routingCapability);
        return null;
    }
    String isOpaqueEnabled = areaNode.path(ISOPAQUE).asText();
    if (isBoolean(isOpaqueEnabled)) {
        area.setIsOpaqueEnabled(Boolean.valueOf(isOpaqueEnabled));
    } else {
        log.debug("Wrong isOpaqueEnabled: {}", isOpaqueEnabled);
        return null;
    }
    area.setOptions(OspfUtil.HELLO_PACKET_OPTIONS);

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

示例13: processLsUpdate

import org.onosproject.ospf.controller.area.OspfAreaImpl; //导入依赖的package包/类
/**
 * LS Update Packet has been received while state was EXCHANGE or LOADING.
 * Examine the received LSAs, check whether they were requested or not and process
 * them accordingly. Therefore use method "processReceivedLsa" for further treatment.
 *
 * @param lsUpdPkt LS Update Packet received while Neighbor state was EXCHANGE or
 *                 LOADING
 * @param ch       netty channel instance
 * @throws Exception might throws exception
 */
public void processLsUpdate(LsUpdate lsUpdPkt, Channel ch) throws Exception {
    stopRxMtLsrTimer();
    log.debug("OSPFNbr::processLsUpdate...!!!");

    List lsaList = lsUpdPkt.getLsaList();
    if (!lsaList.isEmpty()) {
        Iterator itr = lsaList.iterator();

        while (itr.hasNext()) {
            LsaHeader lsaHeader = (LsaHeader) itr.next();
            String key = ((OspfAreaImpl) ospfArea).getLsaKey(lsaHeader);

            if (lsReqList.containsKey(key)) {
                boolean removeIt;
                removeIt = processReceivedLsa(lsaHeader, false, ch,
                                              lsUpdPkt.sourceIp());
                if (removeIt) {
                    lsReqList.remove(key);
                }
            } else {
                // LSA was received via Flooding
                processReceivedLsa(lsaHeader, true, ch,
                                   lsUpdPkt.sourceIp());
            }
        }

        if (lsReqList.isEmpty() && (state == OspfNeighborState.LOADING)) {
            // loading complete
            loadingDone();
        } else {
            stopRxMtLsrTimer();
            LsRequest lsRequest = buildLsRequest();
            lsRequest.setDestinationIp(lsUpdPkt.sourceIp());
            setLastSentLsrPacket(lsRequest);

            startRxMtLsrTimer(ch);
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:50,代码来源:OspfNbrImpl.java

示例14: testRun

import org.onosproject.ospf.controller.area.OspfAreaImpl; //导入依赖的package包/类
/**
 * Tests run() method.
 */
@Test
public void testRun() throws Exception {
    blockingQueue = new ArrayBlockingQueue(5);
    ospfArea = new OspfAreaImpl();
    lsdbAge = new LsdbAgeImpl(ospfArea);
    channel = EasyMock.createMock(Channel.class);
    lsaWrapper = new LsaWrapperImpl();
    lsaWrapper.setLsaProcessing("verifyChecksum");
    blockingQueue.add(lsaWrapper);
    lsaQueueConsumer = new LsaQueueConsumer(blockingQueue, channel, ospfArea);
    lsaQueueConsumer.run();
    assertThat(lsaQueueConsumer, is(notNullValue()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:LsaQueueConsumerTest.java

示例15: setUp

import org.onosproject.ospf.controller.area.OspfAreaImpl; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    OspfAreaImpl ospfArea = new OspfAreaImpl();
    ospfLsdb = new OspfLsdbImpl(ospfArea);
    routerLsa = new RouterLsa();
    networkLsa = new NetworkLsa();
    summaryLsa = new SummaryLsa(new LsaHeader());
    asbrSummaryLsa = new AsbrSummaryLsa(new LsaHeader());
    opaqueLsa9 = new OpaqueLsa9(new OpaqueLsaHeader());
    opaqueLsa10 = new OpaqueLsa10(new OpaqueLsaHeader());
    opaqueLsa11 = new OpaqueLsa11(new OpaqueLsaHeader());
    externalLsa = new ExternalLsa(new LsaHeader());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:OspfLsdbImplTest.java


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