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


Java IOFSwitchBackend.getId方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:27,代码来源:OFSwitchManager.java

示例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);
		}
	}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:40,代码来源:OFSwitchManager.java

示例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);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:16,代码来源:OFSwitchManager.java

示例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();
	}

}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:30,代码来源:OFSwitchManager.java

示例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));
	}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:43,代码来源:OFSwitchManager.java

示例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));
	}
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:64,代码来源:OFSwitchManager.java


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