本文整理汇总了Java中net.floodlightcontroller.core.IOFSwitchBackend.getId方法的典型用法代码示例。如果您正苦于以下问题:Java IOFSwitchBackend.getId方法的具体用法?Java IOFSwitchBackend.getId怎么用?Java IOFSwitchBackend.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.floodlightcontroller.core.IOFSwitchBackend
的用法示例。
在下文中一共展示了IOFSwitchBackend.getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notifyPortChanged
import net.floodlightcontroller.core.IOFSwitchBackend; //导入方法依赖的package包/类
@Override
public synchronized void notifyPortChanged(IOFSwitchBackend sw,
OFPortDesc port,
PortChangeType changeType) {
Preconditions.checkNotNull(sw, "switch must not be null");
Preconditions.checkNotNull(port, "port must not be null");
Preconditions.checkNotNull(changeType, "changeType must not be null");
if (role != OFControllerRole.ROLE_MASTER) {
counters.invalidPortsChanged.increment();
return;
}
if (!this.switches.containsKey(sw.getId())) {
counters.invalidPortsChanged.increment();
return;
}
if(sw.getStatus().isVisible()) {
// no need to count here. SwitchUpdate.dispatch will count
// the portchanged
SwitchUpdate update = new SwitchUpdate(sw.getId(),
SwitchUpdateType.PORTCHANGED,
port, changeType);
addUpdateToQueue(update);
}
}
示例2: switchAdded
import net.floodlightcontroller.core.IOFSwitchBackend; //导入方法依赖的package包/类
@Override
public synchronized void switchAdded(IOFSwitchBackend sw) {
DatapathId dpid = sw.getId();
IOFSwitchBackend oldSw = this.switches.put(dpid, sw);
// Update event history
evSwitch.newEventWithFlush(new SwitchEvent(dpid, "connected"));
if (oldSw == sw) {
// Note == for object equality, not .equals for value
counters.errorActivatedSwitchNotPresent.increment();
log.error("Switch {} added twice?", sw);
return;
} else if (oldSw != null) {
// This happens either when we have switches with duplicate
// DPIDs or when a switch reconnects before we saw the
// disconnect
counters.switchWithSameDpidActivated.increment();
log.warn("New switch added {} for already-added switch {}", sw, oldSw);
// We need to disconnect and remove the old switch
// TODO: we notify switch listeners that the switch has been
// removed and then we notify them that the new one has been
// added. One could argue that a switchChanged notification
// might be more appropriate in this case....
oldSw.cancelAllPendingRequests();
addUpdateToQueue(new SwitchUpdate(dpid, SwitchUpdateType.REMOVED));
oldSw.disconnect();
}
/*
* Set some other config options for this switch.
*/
if (sw.getOFFactory().getVersion().compareTo(OFVersion.OF_13) >= 0) {
if (forwardToControllerFlowsUpToTableByDpid.containsKey(sw.getId())) {
sw.setMaxTableForTableMissFlow(forwardToControllerFlowsUpToTableByDpid.get(sw.getId()));
} else {
sw.setMaxTableForTableMissFlow(forwardToControllerFlowsUpToTable);
}
}
}
示例3: switchDisconnected
import net.floodlightcontroller.core.IOFSwitchBackend; //导入方法依赖的package包/类
@Override
public synchronized void switchDisconnected(IOFSwitchBackend sw) {
DatapathId dpid = sw.getId();
IOFSwitchBackend presentSw = this.switches.get(dpid);
if (presentSw != sw) {
// Note == for object equality, not .equals for value
counters.errorActivatedSwitchNotPresent.increment();
log.warn("Switch {} disconnect but not present in sync manager", sw);
return;
}
counters.switchDisconnected.increment();
this.switches.remove(dpid);
}
示例4: switchAdded
import net.floodlightcontroller.core.IOFSwitchBackend; //导入方法依赖的package包/类
@Override
public synchronized void switchAdded(IOFSwitchBackend sw) {
DatapathId dpid = sw.getId();
IOFSwitchBackend oldSw = this.switches.put(dpid, sw);
// Update event history
evSwitch.newEventWithFlush(new SwitchEvent(dpid, "connected"));
if (oldSw == sw) {
// Note == for object equality, not .equals for value
counters.errorActivatedSwitchNotPresent.increment();
log.error("Switch {} added twice?", sw);
return;
} else if (oldSw != null) {
// This happens either when we have switches with duplicate
// DPIDs or when a switch reconnects before we saw the
// disconnect
counters.switchWithSameDpidActivated.increment();
log.warn("New switch added {} for already-added switch {}", sw, oldSw);
// We need to disconnect and remove the old switch
// TODO: we notify switch listeners that the switch has been
// removed and then we notify them that the new one has been
// added. One could argue that a switchChanged notification
// might be more appropriate in this case....
oldSw.cancelAllPendingRequests();
addUpdateToQueue(new SwitchUpdate(dpid, SwitchUpdateType.REMOVED));
oldSw.disconnect();
}
}
示例5: switchStatusChanged
import net.floodlightcontroller.core.IOFSwitchBackend; //导入方法依赖的package包/类
@Override
public synchronized void switchStatusChanged(IOFSwitchBackend sw, SwitchStatus oldStatus, SwitchStatus newStatus) {
DatapathId dpid = sw.getId();
IOFSwitchBackend presentSw = this.switches.get(dpid);
if (presentSw != sw) {
// Note == for object equality, not .equals for value
counters.errorActivatedSwitchNotPresent
.increment();
log.debug("Switch {} status change but not present in sync manager", sw);
return;
}
evSwitch.newEventWithFlush(new SwitchEvent(dpid,
String.format("%s -> %s",
oldStatus,
newStatus)));
if(newStatus == SwitchStatus.MASTER && role != OFControllerRole.ROLE_MASTER) {
counters.invalidSwitchActivatedWhileSlave.increment();
log.error("Switch {} activated but controller not MASTER", sw);
sw.disconnect();
return; // only react to switch connections when master
}
if(!oldStatus.isVisible() && newStatus.isVisible()) {
// the switch has just become visible. Send 'add' notification to our
// listeners
addUpdateToQueue(new SwitchUpdate(dpid, SwitchUpdateType.ADDED));
} else if((oldStatus.isVisible() && !newStatus.isVisible())) {
addUpdateToQueue(new SwitchUpdate(dpid, SwitchUpdateType.REMOVED));
}
// note: no else if - both may be true
if(oldStatus != SwitchStatus.MASTER && newStatus == SwitchStatus.MASTER ) {
counters.switchActivated.increment();
addUpdateToQueue(new SwitchUpdate(dpid,
SwitchUpdateType.ACTIVATED));
} else if(oldStatus == SwitchStatus.MASTER && newStatus != SwitchStatus.MASTER ) {
counters.switchDeactivated.increment();
addUpdateToQueue(new SwitchUpdate(dpid, SwitchUpdateType.DEACTIVATED));
}
}
示例6: switchStatusChanged
import net.floodlightcontroller.core.IOFSwitchBackend; //导入方法依赖的package包/类
@LogMessageDocs({
@LogMessageDoc(level="ERROR",
message="Switch {switch} activated but was already active",
explanation="A switch that was already activated was " +
"activated again. This should not happen.",
recommendation=LogMessageDoc.REPORT_CONTROLLER_BUG
),
@LogMessageDoc(level="WARN",
message="New switch added {switch} for already-added switch {switch}",
explanation="A switch with the same DPID as another switch " +
"connected to the controller. This can be caused by " +
"multiple switches configured with the same DPID, or " +
"by a switch reconnected very quickly after " +
"disconnecting.",
recommendation="If this happens repeatedly, it is likely there " +
"are switches with duplicate DPIDs on the network. " +
"Reconfigure the appropriate switches. If it happens " +
"very rarely, then it is likely this is a transient " +
"network problem that can be ignored."
)
})
@Override
public synchronized void switchStatusChanged(IOFSwitchBackend sw, SwitchStatus oldStatus, SwitchStatus newStatus) {
DatapathId dpid = sw.getId();
IOFSwitchBackend presentSw = this.switches.get(dpid);
if (presentSw != sw) {
// Note == for object equality, not .equals for value
counters.errorActivatedSwitchNotPresent
.increment();
log.debug("Switch {} status change but not present in sync manager", sw);
return;
}
evSwitch.newEventWithFlush(new SwitchEvent(dpid,
String.format("%s -> %s",
oldStatus,
newStatus)));
if(newStatus == SwitchStatus.MASTER && role != OFControllerRole.ROLE_MASTER) {
counters.invalidSwitchActivatedWhileSlave.increment();
log.error("Switch {} activated but controller not MASTER", sw);
sw.disconnect();
return; // only react to switch connections when master
}
if(!oldStatus.isVisible() && newStatus.isVisible()) {
// the switch has just become visible. Send 'add' notification to our
// listeners
addUpdateToQueue(new SwitchUpdate(dpid, SwitchUpdateType.ADDED));
} else if((oldStatus.isVisible() && !newStatus.isVisible())) {
addUpdateToQueue(new SwitchUpdate(dpid, SwitchUpdateType.REMOVED));
}
// note: no else if - both may be true
if(oldStatus != SwitchStatus.MASTER && newStatus == SwitchStatus.MASTER ) {
counters.switchActivated.increment();
addUpdateToQueue(new SwitchUpdate(dpid,
SwitchUpdateType.ACTIVATED));
} else if(oldStatus == SwitchStatus.MASTER && newStatus != SwitchStatus.MASTER ) {
counters.switchDeactivated.increment();
addUpdateToQueue(new SwitchUpdate(dpid, SwitchUpdateType.DEACTIVATED));
}
}