本文整理汇总了Java中net.floodlightcontroller.core.IOFSwitchListener.switchPortChanged方法的典型用法代码示例。如果您正苦于以下问题:Java IOFSwitchListener.switchPortChanged方法的具体用法?Java IOFSwitchListener.switchPortChanged怎么用?Java IOFSwitchListener.switchPortChanged使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.floodlightcontroller.core.IOFSwitchListener
的用法示例。
在下文中一共展示了IOFSwitchListener.switchPortChanged方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispatch
import net.floodlightcontroller.core.IOFSwitchListener; //导入方法依赖的package包/类
public void dispatch() {
if (log.isTraceEnabled()) {
log.trace("Dispatching switch update {} {}",
sw, switchUpdateType);
}
if (switchListeners != null) {
for (IOFSwitchListener listener : switchListeners) {
switch(switchUpdateType) {
case ADDED:
listener.addedSwitch(sw);
break;
case REMOVED:
listener.removedSwitch(sw);
break;
case PORTCHANGED:
listener.switchPortChanged(sw.getId());
break;
}
}
}
}
示例2: dispatch
import net.floodlightcontroller.core.IOFSwitchListener; //导入方法依赖的package包/类
@Override
public void dispatch() {
if (log.isTraceEnabled()) {
log.trace("Dispatching switch update {} {}",
sw, switchUpdateType);
}
if (switchListeners != null) {
for (IOFSwitchListener listener : switchListeners) {
switch(switchUpdateType) {
case ADDED:
listener.addedSwitch(sw);
break;
case REMOVED:
listener.removedSwitch(sw);
break;
case PORTCHANGED:
listener.switchPortChanged(sw.getId());
break;
}
}
}
}
示例3: dispatch
import net.floodlightcontroller.core.IOFSwitchListener; //导入方法依赖的package包/类
@Override
public void dispatch() {
if (log.isTraceEnabled()) {
log.trace("Dispatching switch update {} {}", swId, switchUpdateType);
}
if (switchListeners != null) {
for (IOFSwitchListener listener : switchListeners) {
switch(switchUpdateType) {
case ADDED:
// don't count here. We have more specific
// counters before the update is created
listener.switchAdded(swId);
break;
case REMOVED:
// don't count here. We have more specific
// counters before the update is created
listener.switchRemoved(swId);
break;
case PORTCHANGED:
counters.switchPortChanged
.increment();
listener.switchPortChanged(swId, port, changeType);
break;
case ACTIVATED:
// don't count here. We have more specific
// counters before the update is created
listener.switchActivated(swId);
break;
case DEACTIVATED:
// ignore
break;
case OTHERCHANGE:
counters.switchOtherChange
.increment();
listener.switchChanged(swId);
break;
}
}
}
}
示例4: dispatch
import net.floodlightcontroller.core.IOFSwitchListener; //导入方法依赖的package包/类
@Override
public void dispatch() {
if (log.isTraceEnabled()) {
log.trace("Dispatching switch update {} {}",
HexString.toHexString(swId), switchUpdateType);
}
if (switchListeners != null) {
for (IOFSwitchListener listener : switchListeners) {
switch(switchUpdateType) {
case ADDED:
// don't count here. We have more specific
// counters before the update is created
listener.switchAdded(swId);
break;
case REMOVED:
// don't count here. We have more specific
// counters before the update is created
listener.switchRemoved(swId);
break;
case PORTCHANGED:
counters.switchPortChanged.updateCounterWithFlush();
listener.switchPortChanged(swId, port, changeType);
break;
case ACTIVATED:
// don't count here. We have more specific
// counters before the update is created
listener.switchActivated(swId);
break;
case DEACTIVATED:
// ignore
break;
case OTHERCHANGE:
counters.switchOtherChange.updateCounterWithFlush();
listener.switchChanged(swId);
break;
}
}
}
}
示例5: dispatch
import net.floodlightcontroller.core.IOFSwitchListener; //导入方法依赖的package包/类
@Override
public void dispatch() {
if (log.isTraceEnabled()) {
log.trace("Dispatching switch update {} {}",
HexString.toHexString(swId), switchUpdateType);
}
if (switchListeners != null) {
for (IOFSwitchListener listener : switchListeners) {
switch (switchUpdateType) {
case ACTIVATED_MASTER:
// don't count here. We have more specific
// counters before the update is created
listener.switchActivatedMaster(swId);
break;
case ACTIVATED_EQUAL:
// don't count here. We have more specific
// counters before the update is created
listener.switchActivatedEqual(swId);
break;
case MASTER_TO_EQUAL:
listener.switchMasterToEqual(swId);
break;
case EQUAL_TO_MASTER:
listener.switchEqualToMaster(swId);
break;
case DISCONNECTED:
// don't count here. We have more specific
// counters before the update is created
listener.switchDisconnected(swId);
break;
case PORTCHANGED:
counters.switchPortChanged.updateCounterWithFlush();
listener.switchPortChanged(swId, port, changeType);
break;
}
}
}
}
示例6: testNotifySwitchPortChanged
import net.floodlightcontroller.core.IOFSwitchListener; //导入方法依赖的package包/类
/**
* Test that notifyPortChanged() results in an IOFSwitchListener
* update and that its arguments are passed through to
* the listener call
*/
@Test
public void testNotifySwitchPortChanged() throws Exception {
DatapathId dpid = DatapathId.of(42);
OFPortDesc p1 = factory.buildPortDesc()
.setName("Port1")
.setPortNo(OFPort.of(1))
.build();
OFFeaturesReply fr1 = factory.buildFeaturesReply()
.setXid(0)
.setDatapathId(dpid)
.setPorts(ImmutableList.<OFPortDesc>of(p1))
.build();
OFPortDesc p2 = factory.buildPortDesc()
.setName("Port1")
.setPortNo(OFPort.of(1))
.setAdvertised(ImmutableSet.<OFPortFeatures>of(OFPortFeatures.PF_100MB_FD))
.build();
OFFeaturesReply fr2 = factory.buildFeaturesReply()
.setXid(0)
.setDatapathId(dpid)
.setPorts(ImmutableList.<OFPortDesc>of(p2))
.build();
SwitchDescription desc = createSwitchDescription();
// activate switch
IOFSwitchBackend sw = doActivateNewSwitch(dpid, desc, fr1);
IOFSwitchListener listener = createMock(IOFSwitchListener.class);
switchManager.addOFSwitchListener(listener);
// setup switch with the new, second features reply (and thus ports)
setupSwitchForAddSwitch(sw, dpid, desc, fr2);
listener.switchPortChanged(dpid, p2,
PortChangeType.OTHER_UPDATE);
expectLastCall().once();
replay(listener);
replay(sw);
switchManager.notifyPortChanged(sw, p2,
PortChangeType.OTHER_UPDATE);
controller.processUpdateQueueForTesting();
verify(listener);
verify(sw);
}
示例7: testNotifySwitchPoArtChanged
import net.floodlightcontroller.core.IOFSwitchListener; //导入方法依赖的package包/类
/**
* Test that notifyPortChanged() results in an IOFSwitchListener
* update and that its arguments are passed through to
* the listener call
*/
@Test
public void testNotifySwitchPoArtChanged() throws Exception {
long dpid = 42L;
OFFeaturesReply fr1 = createOFFeaturesReply();
fr1.setDatapathId(dpid);
OFPhysicalPort p1 = createOFPhysicalPort("Port1", 1);
fr1.setPorts(Collections.singletonList(p1));
OFFeaturesReply fr2 = createOFFeaturesReply();
fr1.setDatapathId(dpid);
OFPhysicalPort p2 = createOFPhysicalPort("Port1", 1);
p2.setAdvertisedFeatures(0x2); // just some bogus values
fr2.setPorts(Collections.singletonList(p2));
OFDescriptionStatistics desc = createOFDescriptionStatistics();
// activate switch
IOFSwitch sw = doActivateNewSwitch(dpid, desc, fr1);
// check the store
SwitchSyncRepresentation ssr = storeClient.getValue(dpid);
assertNotNull(ssr);
assertEquals(dpid, ssr.getDpid());
assertEquals(1, ssr.getPorts().size());
assertEquals(p1, ssr.getPorts().get(0).toOFPhysicalPort());
IOFSwitchListener listener = createMock(IOFSwitchListener.class);
controller.addOFSwitchListener(listener);
// setup switch with the new, second features reply (and thus ports)
setupSwitchForAddSwitch(sw, dpid, desc, fr2);
listener.switchPortChanged(dpid, ImmutablePort.fromOFPhysicalPort(p2),
PortChangeType.OTHER_UPDATE);
expectLastCall().once();
replay(listener);
replay(sw);
controller.notifyPortChanged(sw, ImmutablePort.fromOFPhysicalPort(p2),
PortChangeType.OTHER_UPDATE);
controller.processUpdateQueueForTesting();
verify(listener);
verify(sw);
// check the store
ssr = storeClient.getValue(dpid);
assertNotNull(ssr);
assertEquals(dpid, ssr.getDpid());
assertEquals(1, ssr.getPorts().size());
assertEquals(p2, ssr.getPorts().get(0).toOFPhysicalPort());
}