本文整理汇总了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();
}
示例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);
}
}
示例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();
}
示例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);
}
示例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);
}
}
}
示例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;
}
示例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());
}
}
}
示例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);
}