本文整理汇总了Java中net.floodlightcontroller.core.IOFSwitch.SwitchStatus类的典型用法代码示例。如果您正苦于以下问题:Java SwitchStatus类的具体用法?Java SwitchStatus怎么用?Java SwitchStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SwitchStatus类属于net.floodlightcontroller.core.IOFSwitch包,在下文中一共展示了SwitchStatus类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: enterState
import net.floodlightcontroller.core.IOFSwitch.SwitchStatus; //导入依赖的package包/类
@Override
void enterState() {
if (OFSwitchManager.clearTablesOnEachTransitionToMaster) {
log.info("Clearing flow tables of {} on upcoming transition to MASTER.", sw.getId().toString());
clearAllTables();
} else if (OFSwitchManager.clearTablesOnInitialConnectAsMaster && initialRole == null) { /* don't do it if we were slave first */
initialRole = OFControllerRole.ROLE_MASTER;
log.info("Clearing flow tables of {} on upcoming initial role as MASTER.", sw.getId().toString());
clearAllTables();
}
sendBarrier(); /* Need to make sure the tables are clear before adding default flows */
addDefaultFlows();
/*
* We also need a barrier between adding flows and notifying modules of the
* transition to master. Some modules might modify the flow tables and expect
* the clear/default flow operations above to have completed.
*/
sendBarrier();
setSwitchStatus(SwitchStatus.MASTER);
}
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:24,代码来源:OFSwitchHandshakeHandler.java
示例2: connectionClosed
import net.floodlightcontroller.core.IOFSwitch.SwitchStatus; //导入依赖的package包/类
/** IOFConnectionListener */
@Override
public void connectionClosed(IOFConnectionBackend connection) {
// Disconnect handler's remaining connections
cleanup();
// Only remove the switch handler when the main connection is
// closed
if (connection == this.mainConnection) {
switchManager.handshakeDisconnected(connection.getDatapathId());
if(sw != null) {
log.debug("[{}] - main connection {} closed - disconnecting switch",
connection);
setSwitchStatus(SwitchStatus.DISCONNECTED);
switchManager.switchDisconnected(sw);
}
}
}
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:20,代码来源:OFSwitchHandshakeHandler.java
示例3: setSwitchStatus
import net.floodlightcontroller.core.IOFSwitch.SwitchStatus; //导入依赖的package包/类
public void setSwitchStatus(SwitchStatus status) {
if(sw != null) {
SwitchStatus oldStatus = sw.getStatus();
if(oldStatus != status) {
log.debug("[{}] SwitchStatus change to {} requested, switch is in status " + oldStatus,
mainConnection.getDatapathId(), status);
sw.setStatus(status);
switchManager.switchStatusChanged(sw, oldStatus, status);
} else {
log.warn("[{}] SwitchStatus change to {} requested, switch is already in status",
mainConnection.getDatapathId(), status);
}
} else {
log.warn("[{}] SwitchStatus change to {} requested, but switch is not allocated yet",
mainConnection.getDatapathId(), status);
}
}
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:18,代码来源:OFSwitchHandshakeHandler.java
示例4: testNewSwitchActivatedWhileSlave
import net.floodlightcontroller.core.IOFSwitch.SwitchStatus; //导入依赖的package包/类
/**
* Test switchActivated for a new switch while in slave: disconnect the switch
*/
@Test
public void testNewSwitchActivatedWhileSlave() throws Exception {
doSetUp(HARole.STANDBY);
IOFSwitchBackend sw = createMock(IOFSwitchBackend.class);
IOFSwitchListener listener = createMock(IOFSwitchListener.class);
switchManager.addOFSwitchListener(listener);
expect(sw.getId()).andReturn(DATAPATH_ID_0).anyTimes();
expect(sw.getStatus()).andReturn(SwitchStatus.MASTER).anyTimes();
sw.disconnect();
expectLastCall().once();
expect(sw.getOFFactory()).andReturn(factory).once();
replay(sw, listener); // nothing recorded
switchManager.switchAdded(sw);
switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.MASTER);
verify(sw);
controller.processUpdateQueueForTesting();
verify(listener);
}
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:24,代码来源:OFSwitchManagerTest.java
示例5: doActivateSwitchInt
import net.floodlightcontroller.core.IOFSwitch.SwitchStatus; //导入依赖的package包/类
/**
* Create and activate a switch, either completely new or reconnected
* The mocked switch instance will be returned. It will be reset.
*/
private IOFSwitchBackend doActivateSwitchInt(DatapathId datapathId,
SwitchDescription description,
OFFeaturesReply featuresReply,
boolean clearFlows)
throws Exception {
IOFSwitchBackend sw = createMock(IOFSwitchBackend.class);
if (featuresReply == null) {
featuresReply = createOFFeaturesReply(datapathId);
}
if (description == null) {
description = createSwitchDescription();
}
setupSwitchForAddSwitch(sw, datapathId, description, featuresReply);
replay(sw);
switchManager.switchAdded(sw);
switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.MASTER);
verify(sw);
assertEquals(sw, switchManager.getSwitch(datapathId));
// drain updates and ignore
controller.processUpdateQueueForTesting();
reset(sw);
return sw;
}
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:30,代码来源:OFSwitchManagerTest.java
示例6: testSwitchDisconnectedOther
import net.floodlightcontroller.core.IOFSwitch.SwitchStatus; //导入依赖的package包/类
/**
* Try to remove a switch that's different from what's in the active
* switch map. Should be ignored
*/
@Test
public void testSwitchDisconnectedOther() throws Exception {
IOFSwitch origSw = doActivateNewSwitch(DATAPATH_ID_1, null, null);
// create a new mock switch
IOFSwitchBackend sw = createMock(IOFSwitchBackend.class);
expect(sw.getId()).andReturn(DATAPATH_ID_1).anyTimes();
IOFSwitchListener listener = createMock(IOFSwitchListener.class);
switchManager.addOFSwitchListener(listener);
replay(sw, listener);
switchManager.switchDisconnected(sw);
controller.processUpdateQueueForTesting();
verify(sw, listener);
expect(origSw.getStatus()).andReturn(SwitchStatus.MASTER).anyTimes();
replay(origSw);
assertSame(origSw, switchManager.getSwitch(DATAPATH_ID_1));
}
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:22,代码来源:OFSwitchManagerTest.java
示例7: testRemoveActiveSwitch
import net.floodlightcontroller.core.IOFSwitch.SwitchStatus; //导入依赖的package包/类
/**
* Tests that you can't remove a switch from the map returned by
* getSwitches() (because getSwitches should return an unmodifiable
* map)
*/
@Test
public void testRemoveActiveSwitch() {
IOFSwitchBackend sw = createNiceMock(IOFSwitchBackend.class);
setupSwitchForAddSwitch(sw, DATAPATH_ID_1, null, null);
replay(sw);
switchManager.switchAdded(sw);
switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.MASTER);
assertEquals(sw, switchManager.getSwitch(DATAPATH_ID_1));
try {
switchManager.getAllSwitchMap().remove(DATAPATH_ID_1);
fail("Expected: UnsupportedOperationException");
} catch(UnsupportedOperationException e) {
// expected
}
// we don't care for updates. drain queue.
controller.processUpdateQueueForTesting();
}
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:23,代码来源:OFSwitchManagerTest.java
示例8: testGetActiveSwitch
import net.floodlightcontroller.core.IOFSwitch.SwitchStatus; //导入依赖的package包/类
/**
* Tests that the switch manager should only return a switch to a getActiveSwitch
* call when the switch is visible/active.
*/
@Test
public void testGetActiveSwitch() {
MockOFConnection connection = new MockOFConnection(DATAPATH_ID_1, OFAuxId.MAIN);
IOFSwitchBackend sw = new MockOFSwitchImpl(connection);
sw.setStatus(SwitchStatus.HANDSHAKE);
assertNull(switchManager.getActiveSwitch(DATAPATH_ID_1));
switchManager.switchAdded(sw);
assertNull(switchManager.getActiveSwitch(DATAPATH_ID_1));
sw.setStatus(SwitchStatus.MASTER);
assertEquals(sw, switchManager.getActiveSwitch(DATAPATH_ID_1));
sw.setStatus(SwitchStatus.QUARANTINED);
assertNull(switchManager.getActiveSwitch(DATAPATH_ID_1));
sw.setStatus(SwitchStatus.SLAVE);
assertEquals(sw, switchManager.getActiveSwitch(DATAPATH_ID_1));
sw.setStatus(SwitchStatus.DISCONNECTED);
assertNull(switchManager.getActiveSwitch(DATAPATH_ID_1));
// we don't care for updates. drain queue.
controller.processUpdateQueueForTesting();
}
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:25,代码来源:OFSwitchManagerTest.java
示例9: testConnectionClosedAfterHandshakeComplete
import net.floodlightcontroller.core.IOFSwitch.SwitchStatus; //导入依赖的package包/类
/**
* Tests the connection closed functionality after the switch handshake is complete.
* Essentially when the switch handshake is aware of an IOFSwitch.
* @throws Exception
*/
@Test
public void testConnectionClosedAfterHandshakeComplete() throws Exception {
testInitialMoveToMasterWithRole();
// Test connection closed prior to being finished
reset(switchManager);
switchManager.handshakeDisconnected(dpid);
expectLastCall().once();
switchManager.switchDisconnected(sw);
expectLastCall().once();
replay(switchManager);
reset(sw);
expect(sw.getStatus()).andReturn(SwitchStatus.DISCONNECTED).anyTimes();
replay(sw);
switchHandler.connectionClosed(connection);
verify(switchManager);
verify(sw);
}
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:27,代码来源:OFSwitchHandlerTestBase.java
示例10: testNewSwitchActivatedWhileSlave
import net.floodlightcontroller.core.IOFSwitch.SwitchStatus; //导入依赖的package包/类
/**
* Test switchActivated for a new switch while in slave: disconnect the switch
*/
@Test
public void testNewSwitchActivatedWhileSlave() throws Exception {
doSetUp(HARole.STANDBY);
IOFSwitchBackend sw = createMock(IOFSwitchBackend.class);
IOFSwitchListener listener = createMock(IOFSwitchListener.class);
switchManager.addOFSwitchListener(listener);
expect(sw.getId()).andReturn(DATAPATH_ID_0).anyTimes();
expect(sw.getStatus()).andReturn(SwitchStatus.MASTER).anyTimes();
sw.disconnect();
expectLastCall().once();
replay(sw, listener); // nothing recorded
switchManager.switchAdded(sw);
switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.MASTER);
verify(sw);
controller.processUpdateQueueForTesting();
verify(listener);
}
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:23,代码来源:OFSwitchManagerTest.java
示例11: testConnectionClosedAfterHandshakeComplete
import net.floodlightcontroller.core.IOFSwitch.SwitchStatus; //导入依赖的package包/类
/**
* Tests the connection closed functionality after the switch handshake is complete.
* Essentially when the switch handshake is aware of an IOFSwitch.
* @throws Exception
*/
@Test
public void testConnectionClosedAfterHandshakeComplete() throws Exception {
testInitialMoveToMasterWithRole();
// Test connection closed prior to being finished
reset(switchManager);
switchManager.handshakeDisconnected(dpid);
expectLastCall().once();
switchManager.switchDisconnected(sw);
expectLastCall().once();
replay(switchManager);
reset(sw);
expect(sw.getStatus()).andReturn(SwitchStatus.DISCONNECTED).anyTimes();
replay(sw);
switchHandler.connectionClosed(connection);
verify(switchManager);
verify(sw);
}
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:27,代码来源:OFSwitchHandlerTestBase.java
注:本文中的net.floodlightcontroller.core.IOFSwitch.SwitchStatus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论