• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MockFloodlightProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SetUp

import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入依赖的package包/类
@Before 
public void SetUp() throws Exception {
    fmc = new FloodlightModuleContext();
    linkDiscovery = EasyMock.createMock(ILinkDiscoveryService.class);
    mockFloodlightProvider = new MockFloodlightProvider();
    fmc.addService(IFloodlightProviderService.class, mockFloodlightProvider);
    fmc.addService(IOFSwitchService.class, new MockSwitchManager());
    fmc.addService(ILinkDiscoveryService.class, linkDiscovery);
    fmc.addService(IDebugCounterService.class, new MockDebugCounterService());
    fmc.addService(IDebugEventService.class, new MockDebugEventService());
    MockThreadPoolService tp = new MockThreadPoolService();
    topologyManager = new TopologyManager();
    fmc.addService(IThreadPoolService.class, tp);
    topologyManager.init(fmc);
    tp.init(fmc);
    tp.startUp(fmc);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:18,代码来源:TopologyInstanceTest.java


示例2: SetUp

import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入依赖的package包/类
@Before 
public void SetUp() throws Exception {
    fmc = new FloodlightModuleContext();
    linkDiscovery = EasyMock.createMock(ILinkDiscoveryService.class);
    mockFloodlightProvider = new MockFloodlightProvider();
    fmc.addService(IFloodlightProviderService.class, mockFloodlightProvider);
    fmc.addService(ILinkDiscoveryService.class, linkDiscovery);
    fmc.addService(IDebugCounterService.class, new MockDebugCounterService());
    fmc.addService(IDebugEventService.class, new MockDebugEventService());
    MockThreadPoolService tp = new MockThreadPoolService();
    topologyManager  = new TopologyManager();
    fmc.addService(IThreadPoolService.class, tp);
    topologyManager.init(fmc);
    tp.init(fmc);
    tp.startUp(fmc);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:17,代码来源:TopologyInstanceTest.java


示例3: testFloodBufferId

import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入依赖的package包/类
@Test
public void testFloodBufferId() throws Exception {
    MockFloodlightProvider mockFloodlightProvider = getMockFloodlightProvider();
    this.packetIn = this.packetIn.createBuilder()
    		.setBufferId(OFBufferId.of(10))
    		.setXid(1)
    		.build();

    OFActionOutput ao = OFFactories.getFactory(OFVersion.OF_13).actions().buildOutput().setPort(OFPort.FLOOD).build();
	List<OFAction> al = new ArrayList<OFAction>();
	al.add(ao);
    // build our expected flooded packetOut
    OFPacketOut po = OFFactories.getFactory(OFVersion.OF_13).buildPacketOut()
    	.setActions(al)
        .setXid(1)
        .setBufferId(OFBufferId.of(10))
        .setInPort(OFPort.of(1))
        .build();

    // Mock up our expected behavior
    IOFSwitch mockSwitch = createMock(IOFSwitch.class);
    EasyMock.expect(mockSwitch.getOFFactory()).andReturn(OFFactories.getFactory(OFVersion.OF_13)).anyTimes();
    Capture<OFPacketOut> wc1 = new Capture<OFPacketOut>(CaptureType.ALL);
    expect(mockSwitch.write(capture(wc1))).andReturn(true).anyTimes();

    // Start recording the replay on the mocks
    replay(mockSwitch);
    // Get the listener and trigger the packet in
    IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
            OFType.PACKET_IN).get(0);
    listener.receive(mockSwitch, this.packetIn,
                     parseAndAnnotate(this.packetIn));

    // Verify the replay matched our expectations
    verify(mockSwitch);
    
    assertTrue(wc1.hasCaptured());
    OFMessage m = wc1.getValue();
    assertEquals(po, m);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:41,代码来源:HubTest.java


示例4: testFloodBufferId

import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入依赖的package包/类
@Test
public void testFloodBufferId() throws Exception {
    MockFloodlightProvider mockFloodlightProvider = getMockFloodlightProvider();
    this.packetIn = this.packetIn.createBuilder()
    		.setBufferId(OFBufferId.of(10))
    		.setXid(1)
    		.build();

    OFActionOutput ao = OFFactories.getFactory(OFVersion.OF_13).actions().buildOutput().setPort(OFPort.FLOOD).build();
	List<OFAction> al = new ArrayList<OFAction>();
	al.add(ao);
    // build our expected flooded packetOut
    OFPacketOut po = OFFactories.getFactory(OFVersion.OF_13).buildPacketOut()
    	.setActions(al)
        .setXid(1)
        .setBufferId(OFBufferId.of(10))
        .setInPort(OFPort.of(1))
        .build();

    // Mock up our expected behavior
    IOFSwitch mockSwitch = createMock(IOFSwitch.class);
    EasyMock.expect(mockSwitch.getOFFactory()).andReturn(OFFactories.getFactory(OFVersion.OF_13)).anyTimes();
    Capture<OFPacketOut> wc1 = new Capture<OFPacketOut>(CaptureType.ALL);
    mockSwitch.write(capture(wc1));

    // Start recording the replay on the mocks
    replay(mockSwitch);
    // Get the listener and trigger the packet in
    IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
            OFType.PACKET_IN).get(0);
    listener.receive(mockSwitch, this.packetIn,
                     parseAndAnnotate(this.packetIn));

    // Verify the replay matched our expectations
    verify(mockSwitch);
    
    assertTrue(wc1.hasCaptured());
    OFMessage m = wc1.getValue();
    assertEquals(po, m);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:41,代码来源:HubTest.java


示例5: testHARoleChanged

import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入依赖的package包/类
@Test 
  public void testHARoleChanged() throws IOException {
      StaticFlowEntryPusher staticFlowEntryPusher = new StaticFlowEntryPusher();
      IStorageSourceService storage = createStorageWithFlowEntries();
      MockFloodlightProvider mfp = getMockFloodlightProvider();
      staticFlowEntryPusher.setFloodlightProvider(mfp);
      staticFlowEntryPusher.setStorageSource(storage);
      RestApiServer restApi = new RestApiServer();
      try {
          FloodlightModuleContext fmc = new FloodlightModuleContext();
          restApi.init(fmc);
      } catch (FloodlightModuleException e) {
          e.printStackTrace();
      }

      staticFlowEntryPusher.startUp(null);    // again, to hack unittest
      

      
      // Send a notification that we've changed to slave
    //  mfp.dispatchRoleChanged(null, Role.SLAVE);
 //####     mfp.dispatchMessage(Role.SLAVE, Role.MASTER);
      // Make sure we've removed all our entries
      
      // Send a notification that we've changed to master
//#####      mfp.dispatchRoleChanged(Role.SLAVE, Role.MASTER);  
      // Make sure we've learned the entries
     
  }
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:30,代码来源:flowProgram.java


示例6: testFloodBufferId

import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入依赖的package包/类
@Test
public void testFloodBufferId() throws Exception {
    MockFloodlightProvider mockFloodlightProvider = getMockFloodlightProvider();
    this.packetIn.setBufferId(10);

    // build our expected flooded packetOut
    OFPacketOut po = ((OFPacketOut) mockFloodlightProvider.getOFMessageFactory().getMessage(OFType.PACKET_OUT))
        .setActions(Arrays.asList(new OFAction[] {new OFActionOutput().setPort(OFPort.OFPP_FLOOD.getValue())}))
        .setActionsLength((short) OFActionOutput.MINIMUM_LENGTH)
        .setBufferId(10)
        .setInPort((short) 1);
    po.setLengthU(OFPacketOut.MINIMUM_LENGTH + po.getActionsLengthU());

    // Mock up our expected behavior
    IOFSwitch mockSwitch = createMock(IOFSwitch.class);
    Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
    Capture<FloodlightContext> bc1 = new Capture<FloodlightContext>(CaptureType.ALL);
    
    mockSwitch.write(capture(wc1), capture(bc1));

    // Start recording the replay on the mocks
    replay(mockSwitch);
    // Get the listener and trigger the packet in
    IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
            OFType.PACKET_IN).get(0);
    listener.receive(mockSwitch, this.packetIn,
                     parseAndAnnotate(this.packetIn));

    // Verify the replay matched our expectations
    verify(mockSwitch);
    
    assertTrue(wc1.hasCaptured());
    OFMessage m = wc1.getValue();
    assertEquals(po, m);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:36,代码来源:HubTest.java


示例7: setUp

import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
    super.setUp();
    staticFlowEntryPusher = new StaticFlowEntryPusher();
    storage = createStorageWithFlowEntries();
    dpid = HexString.toLong(TestSwitch1DPID);

    mockSwitch = createNiceMock(IOFSwitch.class);
    writeCapture = new Capture<OFMessage>(CaptureType.ALL);
    contextCapture = new Capture<FloodlightContext>(CaptureType.ALL);
    writeCaptureList = new Capture<List<OFMessage>>(CaptureType.ALL);

    //OFMessageSafeOutStream mockOutStream = createNiceMock(OFMessageSafeOutStream.class);
    mockSwitch.write(capture(writeCapture), capture(contextCapture));
    expectLastCall().anyTimes();
    mockSwitch.write(capture(writeCaptureList), capture(contextCapture));
    expectLastCall().anyTimes();
    mockSwitch.flush();
    expectLastCall().anyTimes();


    FloodlightModuleContext fmc = new FloodlightModuleContext();
    fmc.addService(IStorageSourceService.class, storage);

    MockFloodlightProvider mockFloodlightProvider = getMockFloodlightProvider();
    Map<Long, IOFSwitch> switchMap = new HashMap<Long, IOFSwitch>();
    switchMap.put(dpid, mockSwitch);
    // NO ! expect(mockFloodlightProvider.getSwitches()).andReturn(switchMap).anyTimes();
    mockFloodlightProvider.setSwitches(switchMap);
    fmc.addService(IFloodlightProviderService.class, mockFloodlightProvider);
    RestApiServer restApi = new RestApiServer();
    fmc.addService(IRestApiService.class, restApi);
    restApi.init(fmc);
    staticFlowEntryPusher.init(fmc);
    staticFlowEntryPusher.startUp(fmc);    // again, to hack unittest
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:37,代码来源:StaticFlowTests.java


示例8: SetUp

import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入依赖的package包/类
@Before 
public void SetUp() throws Exception {
    fmc = new FloodlightModuleContext();
    linkDiscovery = EasyMock.createMock(ILinkDiscoveryService.class);
    mockFloodlightProvider = new MockFloodlightProvider();
    fmc.addService(IFloodlightProviderService.class, mockFloodlightProvider);
    fmc.addService(ILinkDiscoveryService.class, linkDiscovery);
    MockThreadPoolService tp = new MockThreadPoolService();
    topologyManager  = new TopologyManager();
    fmc.addService(IThreadPoolService.class, tp);
    topologyManager.init(fmc);
    tp.init(fmc);
    tp.startUp(fmc);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:15,代码来源:TopologyInstanceTest.java


示例9: testFloodBufferId

import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入依赖的package包/类
@Test
public void testFloodBufferId() throws Exception {
    MockFloodlightProvider mockFloodlightProvider = getMockFloodlightProvider();
    this.packetIn.setBufferId(10);

    // build our expected flooded packetOut
    OFPacketOut po = ((OFPacketOut) mockFloodlightProvider.getOFMessageFactory().getMessage(OFType.PACKET_OUT))
        .setActions(Arrays.asList(new OFAction[] {new OFActionOutput().setPort(OFPort.OFPP_FLOOD.getValue())}))
        .setActionsLength((short) OFActionOutput.MINIMUM_LENGTH)
        .setBufferId(10)
        .setInPort((short) 1);
    po.setLengthU(OFPacketOut.MINIMUM_LENGTH + po.getActionsLengthU());

    // Mock up our expected behavior
    IOFSwitch mockSwitch = createMock(IOFSwitch.class);
    Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
    Capture<FloodlightContext> bc1 = new Capture<FloodlightContext>(CaptureType.ALL);
    
    mockSwitch.write(capture(wc1), capture(bc1));

    // Start recording the replay on the mocks
    replay(mockSwitch);
    // Get the listener and trigger the packet in
    IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
            OFType.PACKET_IN).get(0);
    listener.receive(mockSwitch, this.packetIn,
                     parseAndAnnotate(this.packetIn));

    // Verify the replay matched our expectations
    verify(mockSwitch);
    
    assertTrue(wc1.hasCaptured());
    OFMessage m = wc1.getValue();
    assert(m.equals(po));
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:36,代码来源:HubTest.java


示例10: testHARoleChanged

import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入依赖的package包/类
@Test 
public void testHARoleChanged() throws IOException {
    StaticFlowEntryPusher staticFlowEntryPusher = new StaticFlowEntryPusher();
    IStorageSourceService storage = createStorageWithFlowEntries();
    MockFloodlightProvider mfp = getMockFloodlightProvider();
    staticFlowEntryPusher.setFloodlightProvider(mfp);
    staticFlowEntryPusher.setStorageSource(storage);
    RestApiServer restApi = new RestApiServer();
    try {
        FloodlightModuleContext fmc = new FloodlightModuleContext();
        restApi.init(fmc);
    } catch (FloodlightModuleException e) {
        e.printStackTrace();
    }
    staticFlowEntryPusher.restApi = restApi;
    staticFlowEntryPusher.startUp(null);    // again, to hack unittest
    
    assert(staticFlowEntryPusher.entry2dpid.containsValue(TestSwitch1DPID));
    assert(staticFlowEntryPusher.entriesFromStorage.containsValue(FlowMod1));
    assert(staticFlowEntryPusher.entriesFromStorage.containsValue(FlowMod2));
    assert(staticFlowEntryPusher.entriesFromStorage.containsValue(FlowMod3));
    
    // Send a notification that we've changed to slave
    mfp.dispatchRoleChanged(null, Role.SLAVE);
    // Make sure we've removed all our entries
    assert(staticFlowEntryPusher.entry2dpid.isEmpty());
    assert(staticFlowEntryPusher.entriesFromStorage.isEmpty());
    
    // Send a notification that we've changed to master
    mfp.dispatchRoleChanged(Role.SLAVE, Role.MASTER);  
    // Make sure we've learned the entries
    assert(staticFlowEntryPusher.entry2dpid.containsValue(TestSwitch1DPID));
    assert(staticFlowEntryPusher.entriesFromStorage.containsValue(FlowMod1));
    assert(staticFlowEntryPusher.entriesFromStorage.containsValue(FlowMod2));
    assert(staticFlowEntryPusher.entriesFromStorage.containsValue(FlowMod3));
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:37,代码来源:StaticFlowTests.java


示例11: SetUp

import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入依赖的package包/类
@Before 
public void SetUp() throws Exception {
    fmc = new FloodlightModuleContext();
    mockFloodlightProvider = new MockFloodlightProvider();
    fmc.addService(IFloodlightProviderService.class, mockFloodlightProvider);
    MockThreadPoolService tp = new MockThreadPoolService();
    topologyManager  = new TopologyManager();
    fmc.addService(IThreadPoolService.class, tp);
    topologyManager.init(fmc);
    tp.init(fmc);
    tp.startUp(fmc);
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:13,代码来源:TopologyInstanceTest.java


示例12: setUp

import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    sw = new OFSwitchImpl();
    Channel ch = createMock(Channel.class);
    SocketAddress sa = new InetSocketAddress(42);
    expect(ch.getRemoteAddress()).andReturn(sa).anyTimes();
    sw.setChannel(ch);
    MockFloodlightProvider floodlightProvider = new MockFloodlightProvider();
    sw.setFloodlightProvider(floodlightProvider);
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:11,代码来源:OFSwitchImplTest.java


示例13: before

import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入依赖的package包/类
@Before
public void before() {
	DTM.resetInstance();
	dtm = DTM.getInstance();
    dtm.setSwitch(null);
    dtm.setSwitch(sw);
    dtm.setFloodlightProvider(new MockFloodlightProvider());
    dtm.setConfigData(TestSetUpHelper.CONFIG_DATA_2DC);
}
 
开发者ID:smartenit-eu,项目名称:smartenit,代码行数:10,代码来源:DTMFlowDistributorTwoDCsTest.java


示例14: before

import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入依赖的package包/类
@Before
public void before() {
	DTM.resetInstance();
	dtm = DTM.getInstance();
    dtm.setSwitch(null);
    dtm.setSwitch(sw);
    dtm.setFloodlightProvider(new MockFloodlightProvider());
    dtm.setConfigData(TestSetUpHelper.CONFIG_DATA_1DC);
}
 
开发者ID:smartenit-eu,项目名称:smartenit,代码行数:10,代码来源:DTMFlowDistributorTest.java


示例15: testSetMultipleReferenceVectors

import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入依赖的package包/类
/**
 * Test the {@link DTM#setReferenceVector(eu.smartenit.sbox.db.dto.RVector)}
 * method.
 */
@Test
public void testSetMultipleReferenceVectors() {

    dtm.setFloodlightProvider(new MockFloodlightProvider());
    IOFSwitch switchMock = EasyMock.createNiceMock(IOFSwitch.class);
    expect(switchMock.getStringId()).andReturn("mock");
    replay(switchMock);
    dtm.setSwitch(null);
    dtm.setSwitch(switchMock);
    dtm.setConfigData(TestSetUpHelper.CONFIG_DATA_2DC);

    RVector referenceVector1 = new RVector();
    referenceVector1.setVectorValues(null);
    referenceVector1.addVectorValueForTunnelEndPrefix(new NetworkAddressIPv4(tunnelEndPrefix1, 24), 1);
    referenceVector1.addVectorValueForTunnelEndPrefix(new NetworkAddressIPv4(tunnelEndPrefix2, 24), 2);

    dtm.setReferenceVector(referenceVector1);

    RVector referenceVector2 = new RVector();
    referenceVector2.setVectorValues(null);
    referenceVector2.addVectorValueForTunnelEndPrefix(new NetworkAddressIPv4(tunnelEndPrefix3, 24), 3);
    referenceVector2.addVectorValueForTunnelEndPrefix(new NetworkAddressIPv4(tunnelEndPrefix4, 24), 4);

    dtm.setReferenceVector(referenceVector2);

    RVector referenceVector3 = new RVector();
    referenceVector3.setVectorValues(null);
    referenceVector3.addVectorValueForTunnelEndPrefix(new NetworkAddressIPv4(tunnelEndPrefix1, 24), 5);
    referenceVector3.addVectorValueForTunnelEndPrefix(new NetworkAddressIPv4(tunnelEndPrefix2, 24), 6);

    dtm.setReferenceVector(referenceVector3);

    assertEquals(4, dtm.rVectorMap.keySet().size());
    assertEquals(4, dtm.daRouterRVectorMap.keySet().size());

    assertEquals(5, (long) dtm.rVectorMap.get(new NetworkAddressIPv4(tunnelEndPrefix1, 24)));
    assertEquals(6, (long) dtm.daRouterRVectorMap.get((short) 2));
}
 
开发者ID:smartenit-eu,项目名称:smartenit,代码行数:43,代码来源:DTMVectorsProcessingTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ViewDisplay类代码示例发布时间:2022-05-21
下一篇:
Java FillPatternType类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap