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


Java MockFloodlightProvider.dispatchRoleChanged方法代码示例

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


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

示例1: 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

示例2: 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

    OFFlowMod flowMod = staticFlowEntryPusher.entriesFromStorage.get(getDpidFromTestRule(TestRule1)).get(getNameFromTestRule(TestRule1));
    verifyFlowMod(flowMod, FlowMod1);
    flowMod = staticFlowEntryPusher.entriesFromStorage.get(getDpidFromTestRule(TestRule2)).get(getNameFromTestRule(TestRule2));
    verifyFlowMod(flowMod, FlowMod2);
    flowMod = staticFlowEntryPusher.entriesFromStorage.get(getDpidFromTestRule(TestRule3)).get(getNameFromTestRule(TestRule3));
    verifyFlowMod(flowMod, FlowMod3);

    // Send a notification that we've changed to slave
    mfp.dispatchRoleChanged(null, Role.SLAVE);
    // Make sure we've removed all our entries
    assertTrue(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
    flowMod = staticFlowEntryPusher.entriesFromStorage.get(getDpidFromTestRule(TestRule1)).get(getNameFromTestRule(TestRule1));
    verifyFlowMod(flowMod, FlowMod1);
    flowMod = staticFlowEntryPusher.entriesFromStorage.get(getDpidFromTestRule(TestRule2)).get(getNameFromTestRule(TestRule2));
    verifyFlowMod(flowMod, FlowMod2);
    flowMod = staticFlowEntryPusher.entriesFromStorage.get(getDpidFromTestRule(TestRule3)).get(getNameFromTestRule(TestRule3));
    verifyFlowMod(flowMod, FlowMod3);

}
 
开发者ID:andi-bigswitch,项目名称:floodlight-oss,代码行数:41,代码来源:StaticFlowTests.java


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