• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DebugCounter类的典型用法和代码示例

java 1次浏览

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

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

示例1: setUp

点赞 2

import net.floodlightcontroller.debugcounter.DebugCounter; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    blockMessage = null;
    // Build our test packet
    testPacket = new Ethernet()
    .setSourceMACAddress(srcMac)
    .setDestinationMACAddress("00:11:22:33:44:55")
    .setEtherType(Ethernet.TYPE_ARP)
    .setPayload(
            new ARP()
            .setHardwareType(ARP.HW_TYPE_ETHERNET)
            .setProtocolType(ARP.PROTO_TYPE_IP)
            .setHardwareAddressLength((byte) 6)
            .setProtocolAddressLength((byte) 4)
            .setOpCode(ARP.OP_REPLY)
            .setSenderHardwareAddress(Ethernet.toMACAddress("00:44:33:22:11:00"))
            .setSenderProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.1"))
            .setTargetHardwareAddress(Ethernet.toMACAddress("00:11:22:33:44:55"))
            .setTargetProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.2")));
    testPacketSerialized = testPacket.serialize();

    pi = ((OFPacketIn) BasicFactory.getInstance().getMessage(OFType.PACKET_IN))
            .setBufferId(-1)
            .setInPort((short) 1)
            .setPacketData(testPacketSerialized)
            .setReason(OFPacketInReason.NO_MATCH)
            .setTotalLength((short) testPacketSerialized.length);
    floodlightProvider = createMock(IFloodlightProviderService.class);
    sw = new OFSwitchTest(floodlightProvider);
    IDebugCounterService debugCounter = new DebugCounter();
    sw.setDebugCounterService(debugCounter);
    switches = new ConcurrentHashMap<Long, IOFSwitch>();
    switches.put(sw.getId(), sw);
    expect(floodlightProvider.getSwitch(sw.getId())).andReturn(sw).anyTimes();
    expect(floodlightProvider.getOFMessageFactory())
            .andReturn(BasicFactory.getInstance()).anyTimes();
}
 

开发者ID:JianqingJiang,
项目名称:QoS-floodlight,
代码行数:38,
代码来源:OFSwitchBaseTest.java

示例2: setUp

点赞 2

import net.floodlightcontroller.debugcounter.DebugCounter; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    FloodlightModuleContext fmc = new FloodlightModuleContext();

    FloodlightProvider floodlightProvider = new FloodlightProvider();

    controller = (Controller) floodlightProvider.getServiceImpls().get(
            IFloodlightProviderService.class);
    fmc.addService(IFloodlightProviderService.class, controller);

    RestApiServer restApi = new RestApiServer();
    fmc.addService(IRestApiService.class, restApi);

    DebugCounter counterService = new DebugCounter();
    fmc.addService(IDebugCounterService.class, counterService);

    threadPool = new MockThreadPoolService();
    fmc.addService(IThreadPoolService.class, threadPool);

    IControllerRegistryService registry =
            createMock(IControllerRegistryService.class);
    fmc.addService(IControllerRegistryService.class, registry);
    LinkDiscoveryManager linkDiscovery = new LinkDiscoveryManager();
    fmc.addService(ILinkDiscoveryService.class, linkDiscovery);

    restApi.init(fmc);
    floodlightProvider.init(fmc);
    threadPool.init(fmc);
    linkDiscovery.init(fmc);
    restApi.startUp(fmc);
    floodlightProvider.startUp(fmc);
    threadPool.startUp(fmc);
}
 

开发者ID:opennetworkinglab,
项目名称:spring-open,
代码行数:36,
代码来源:ControllerTest.java

示例3: setUp

点赞 2

import net.floodlightcontroller.debugcounter.DebugCounter; //导入依赖的package包/类
@Before
public void setUp() throws Exception {

    floodlightProvider = createMock(IFloodlightProviderService.class);
    sw = new OFSwitchTest(floodlightProvider);
    IDebugCounterService debugCounter = new DebugCounter();
    sw.setDebugCounterService(debugCounter);
    switches = new ConcurrentHashMap<Long, IOFSwitch>();
    switches.put(sw.getId(), sw);
    expect(floodlightProvider.getSwitch(sw.getId())).andReturn(sw).anyTimes();

}
 

开发者ID:opennetworkinglab,
项目名称:spring-open,
代码行数:13,
代码来源:OFSwitchImplBaseTest.java

示例4: setUp

点赞 2

import net.floodlightcontroller.debugcounter.DebugCounter; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    controller = createMock(Controller.class);
    threadPool = createMock(IThreadPoolService.class);
    ctx = createMock(ChannelHandlerContext.class);
    channelStateEvent = createMock(ChannelStateEvent.class);
    channel = createMock(Channel.class);
    messageEvent = createMock(MessageEvent.class);
    exceptionEventCapture = new Capture<ExceptionEvent>(CaptureType.ALL);
    pipeline = createMock(ChannelPipeline.class);
    writeCapture = new Capture<List<OFMessage>>(CaptureType.ALL);
    sw = createMock(IOFSwitch.class);
    seenXids = null;

    // TODO: should mock IDebugCounterService and make sure
    // the expected counters are updated.
    debugCounterService = new DebugCounter();
    Controller.Counters counters =
            new Controller.Counters();
    counters.createCounters(debugCounterService);
    expect(controller.getCounters()).andReturn(counters).anyTimes();
    replay(controller);
    handler = new OFChannelHandler(controller);
    verify(controller);
    reset(controller);

    resetChannel();

    // thread pool is usually not called, so start empty replay
    replay(threadPool);

    // replay controller. Reset it if you need more specific behavior
    replay(controller);

    // replay switch. Reset it if you need more specific behavior
    replay(sw);

    // Mock ctx and channelStateEvent
    expect(ctx.getChannel()).andReturn(channel).anyTimes();
    expect(channelStateEvent.getChannel()).andReturn(channel).anyTimes();
    replay(ctx, channelStateEvent);

    /* Setup an exception event capture on the channel. Right now
     * we only expect exception events to be send up the channel.
     * However, it's easy to extend to other events if we need it
     */
    pipeline.sendUpstream(capture(exceptionEventCapture));
    expectLastCall().anyTimes();
    replay(pipeline);
}
 

开发者ID:JianqingJiang,
项目名称:QoS-floodlight,
代码行数:51,
代码来源:OFChannelHandlerTest.java

示例5: setUp

点赞 2

import net.floodlightcontroller.debugcounter.DebugCounter; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    controller = createMock(Controller.class);
    threadPool = createMock(IThreadPoolService.class);
    ctx = createMock(ChannelHandlerContext.class);
    channelStateEvent = createMock(ChannelStateEvent.class);
    channel = createMock(Channel.class);
    messageEvent = createMock(MessageEvent.class);
    exceptionEventCapture = new Capture<ExceptionEvent>(CaptureType.ALL);
    pipeline = createMock(ChannelPipeline.class);
    writeCapture = new Capture<List<OFMessage>>(CaptureType.ALL);
    swImplBase = createMock(OFSwitchImplBase.class);
    seenXids = null;
    factory13 = OFFactories.getFactory(OFVersion.OF_13);
    factory10 = OFFactories.getFactory(OFVersion.OF_10);
    factory = (ofVersion == OFVersion.OF_13) ? factory13 : factory10;

    // TODO: should mock IDebugCounterService and make sure
    // the expected counters are updated.
    debugCounterService = new DebugCounter();
    Controller.Counters counters =
            new Controller.Counters();
    counters.createCounters(debugCounterService);
    expect(controller.getCounters()).andReturn(counters).anyTimes();
    expect(controller.getOFMessageFactory_10()).andReturn(factory10)
        .anyTimes();
    expect(controller.getOFMessageFactory_13()).andReturn(factory13)
        .anyTimes();
    expect(controller.addConnectedSwitch(2000,handler)).andReturn(true)
        .anyTimes();
    replay(controller);
    handler = new OFChannelHandler(controller);
    verify(controller);
    reset(controller);

    resetChannel();

    // thread pool is usually not called, so start empty replay
    replay(threadPool);

    // replay controller. Reset it if you need more specific behavior
    replay(controller);

    // replay switch. Reset it if you need more specific behavior
    replay(swImplBase);

    // Mock ctx and channelStateEvent
    expect(ctx.getChannel()).andReturn(channel).anyTimes();
    expect(channelStateEvent.getChannel()).andReturn(channel).anyTimes();
    replay(ctx, channelStateEvent);

    /* Setup an exception event capture on the channel. Right now
     * we only expect exception events to be send up the channel.
     * However, it's easy to extend to other events if we need it
     */
    pipeline.sendUpstream(capture(exceptionEventCapture));
    expectLastCall().anyTimes();
    replay(pipeline);
    featuresReply = (OFFeaturesReply)buildOFMessage(OFType.FEATURES_REPLY);
}
 

开发者ID:opennetworkinglab,
项目名称:spring-open,
代码行数:61,
代码来源:OFChannelHandlerTest.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)