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


Java MockFloodlightProvider类代码示例

本文整理汇总了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;未经允许,请勿转载。