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


Java IOFSwitch.getId方法代码示例

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


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

示例1: SwitchRepresentation

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
public SwitchRepresentation(@Nonnull IOFSwitch sw, @Nonnull OFSwitchHandshakeHandler handshakeHandler) {
    Preconditions.checkNotNull(sw, "switch must not be null");
    Preconditions.checkNotNull(handshakeHandler, "handshakeHandler must not be null");

    // IOFSwitch
    this.buffers = sw.getBuffers();
    this.capabilities = sw.getCapabilities();
    this.tables = sw.getNumTables();
    this.inetAddress = sw.getInetAddress();
    this.sortedPorts = sw.getSortedPorts();
    this.isConnected = sw.isConnected();
    this.connectedSince = sw.getConnectedSince();
    this.dpid = sw.getId();
    this.attributes = sw.getAttributes();
    this.isActive = sw.isActive();

    // OFSwitchHandshakeHandler
    this.connections = handshakeHandler.getConnections();
    this.handshakeState = handshakeHandler.getState();
    this.quarantineReason = handshakeHandler.getQuarantineReason();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:22,代码来源:SwitchRepresentation.java

示例2: switchAddedToStore

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
/**
 * Called when we receive a store notification about a new or updated
 * switch.
 * @param sw
 */
private synchronized void switchAddedToStore(IOFSwitch sw) {
	if (floodlightProvider.getRole() != HARole.STANDBY) {
		return; // only read from store if slave
	}
	DatapathId dpid = sw.getId();

	IOFSwitch oldSw = syncedSwitches.put(dpid, sw);
	if (oldSw == null)  {
		addUpdateToQueue(new SwitchUpdate(dpid, SwitchUpdateType.ADDED));
	} else {
		// The switch already exists in storage, see if anything
		// has changed
		sendNotificationsIfSwitchDiffers(oldSw, sw);
	}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:21,代码来源:OFSwitchManager.java

示例3: SwitchRepresentation

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
public SwitchRepresentation(@Nonnull IOFSwitch sw, @Nonnull OFSwitchHandshakeHandler handshakeHandler) {
    Preconditions.checkNotNull(sw, "switch must not be null");
    Preconditions.checkNotNull(handshakeHandler, "handshakeHandler must not be null");

    // IOFSwitch
    this.buffers = sw.getBuffers();
    this.capabilities = sw.getCapabilities();
    this.tables = sw.getTables();
    this.inetAddress = sw.getInetAddress();
    this.sortedPorts = sw.getSortedPorts();
    this.isConnected = sw.isConnected();
    this.connectedSince = sw.getConnectedSince();
    this.dpid = sw.getId();
    this.attributes = sw.getAttributes();
    this.isActive = sw.isActive();

    // OFSwitchHandshakeHandler
    this.connections = handshakeHandler.getConnections();
    this.handshakeState = handshakeHandler.getState();
    this.quarantineReason = handshakeHandler.getQuarantineReason();
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:22,代码来源:SwitchRepresentation.java

示例4: switchActivated

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
@Override
public void switchActivated(DatapathId switchId) {
	IOFSwitch sw = switchService.getSwitch(switchId);
	if (sw == null)       //fix dereference violation in case race conditions
		return;
	if (sw.getEnabledPortNumbers() != null) {
		for (OFPort p : sw.getEnabledPortNumbers()) {
			processNewPort(sw.getId(), p);
		}
	}
	LDUpdate update = new LDUpdate(sw.getId(), SwitchType.BASIC_SWITCH, UpdateOperation.SWITCH_UPDATED);
	updates.add(update);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:14,代码来源:LinkDiscoveryManager.java

示例5: topologyChanged

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
@Override
public void topologyChanged(List<LDUpdate> appliedUpdates) {
    for (LDUpdate ldu : appliedUpdates) {
        if (ldu.getOperation()
               .equals(ILinkDiscovery.UpdateOperation.PORT_DOWN)) {

            // Get the switch ID for the OFMatchWithSwDpid object
            IOFSwitch affectedSwitch = switchService.getSwitch(ldu.getSrc());

            // Create an OFMatchReconcile object
            OFMatchReconcile ofmr = new OFMatchReconcile();

            // Generate an OFMatch objects for the OFMatchWithSwDpid object
            Match match = affectedSwitch.getOFFactory().buildMatch().build(); // nothing specific set, so all wildcarded

            // Generate the OFMatchWithSwDpid
            OFMatchWithSwDpid ofmatchsw = new OFMatchWithSwDpid(match, affectedSwitch.getId());

            // Set the action to update the path to remove flows routing
            // towards the downed port
            ofmr.rcAction = OFMatchReconcile.ReconcileAction.UPDATE_PATH;

            // Set the match, with the switch dpid
            ofmr.ofmWithSwDpid = ofmatchsw;

            // Assign the downed port to the OFMatchReconcile's outPort data
            // member (I added this to
            // the OFMatchReconcile class)
            ofmr.outPort = ldu.getSrcPort();

            // Tell the reconcile manager to reconcile matching flows
            frm.reconcileFlow(ofmr, EventPriority.HIGH);
        }
    }
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:36,代码来源:PortDownReconciliation.java

示例6: packetFromHost

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
/**
 * checks if the packet arrived at a host-facing port
 * @param sw
 * @param pi
 * @param cntx
 * @return
 */
private boolean packetFromHost(IOFSwitch sw, OFPacketIn pi, FloodlightContext cntx) {
	for (Link link : linkDiscoveryService.getSwitchLinks().get(sw.getId())) {
		if ((link.getSrc() == sw.getId()) && (link.getSrcPort() == pi.getMatch().get(MatchField.IN_PORT))) { // link where the packet arrived
			if (switchService.getActiveSwitch(link.getDst()) != null) // endpoint of link is another switch -> not a host
				return false;
		}
       }
	return true;
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:17,代码来源:ObfuscationController.java

示例7: floodArpRequest

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
private void floodArpRequest(IOFSwitch sw, IPv4Address requestedAddress) {
	IPacket arpRequest = new Ethernet()
	.setSourceMACAddress("00:00:00:00:00:01")
	.setDestinationMACAddress("ff:ff:ff:ff:ff:ff")
	.setEtherType(EthType.ARP)
	.setVlanID((short) 0)
	.setPriorityCode((byte) 0)
	.setPayload(
			new ARP()
			.setHardwareType(ARP.HW_TYPE_ETHERNET)
			.setProtocolType(ARP.PROTO_TYPE_IP)
			.setHardwareAddressLength((byte) 6)
			.setProtocolAddressLength((byte) 4)
			.setOpCode(ARP.OP_REQUEST)
			.setSenderHardwareAddress(HexString.fromHexString("00:00:00:00:00:01"))
			.setSenderProtocolAddress(IPv4.toIPv4AddressBytes("10.0.0.111"))
			.setTargetHardwareAddress(HexString.fromHexString("00:00:00:00:00:00"))
			.setTargetProtocolAddress(requestedAddress.getBytes()));
       
       Set<OFPort> portsConnectedToSwitches = new HashSet<OFPort>();
       
       for (Link link : linkDiscoveryService.getSwitchLinks().get(sw.getId())) {
       	if (link.getSrc() == sw.getId())
       		portsConnectedToSwitches.add(link.getSrcPort());
       }
       
       for (OFPortDesc port : sw.getPorts()) {
       	if (!portsConnectedToSwitches.contains(port.getPortNo())) {
       		pushPacket(arpRequest, sw, OFBufferId.NO_BUFFER, OFPort.ANY, port.getPortNo());
       	}
       }
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:33,代码来源:ObfuscationController.java

示例8: switchActivated

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
@Override
public void switchActivated(DatapathId switchId) {
	IOFSwitch sw = switchService.getSwitch(switchId);
	if (sw.getEnabledPortNumbers() != null) {
		for (OFPort p : sw.getEnabledPortNumbers()) {
			processNewPort(sw.getId(), p);
		}
	}
	LDUpdate update = new LDUpdate(sw.getId(), SwitchType.BASIC_SWITCH, UpdateOperation.SWITCH_UPDATED);
	updates.add(update);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:12,代码来源:LinkDiscoveryManager.java


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