@Override public void emit(OutboundPacket packet) { PacketProgrammable programmable = getPacketProgrammable(packet.sendThrough()); if (programmable != null) { programmable.emit(packet); } }
@Override public void emit(OutboundPacket packet) { DeviceId devId = packet.sendThrough(); String scheme = devId.toString().split(":")[0]; if (!scheme.equals(this.id().scheme())) { throw new IllegalArgumentException( "Don't know how to handle Device with scheme " + scheme); } Dpid dpid = Dpid.dpid(devId.uri()); OpenFlowSwitch sw = controller.getSwitch(dpid); if (sw == null) { log.warn("Device {} isn't available?", devId); return; } //Ethernet eth = new Ethernet(); //eth.deserialize(packet.data().array(), 0, packet.data().array().length); OFPortDesc p = null; for (Instruction inst : packet.treatment().allInstructions()) { if (inst.type().equals(Instruction.Type.OUTPUT)) { p = portDesc(((OutputInstruction) inst).port()); OFPacketOut po = packetOut(sw, packet.data().array(), p.getPortNo()); sw.sendMsg(po); } } }
@Override public void send() { if (!this.block()) { if (outPacket() == null) { sendPacket(null); } else { try { Ethernet eth = Ethernet.deserializer() .deserialize(outPacket().data().array(), 0, outPacket().data().array().length); sendPacket(eth); } catch (DeserializationException e) { log.warn("Unable to deserialize packet"); } } } }
DeviceId deviceId = outPacket().sendThrough(); ByteBuffer rawData = outPacket().data(); if (outPacket().treatment() == null) { treatment = (treatmentBuilder() == null) ? emptyTreatment() : treatmentBuilder().build(); } else { treatment = outPacket().treatment(); deviceService.getPorts(outPacket().sendThrough()) .stream() .map(Port::number)
@Override public void emit(OutboundPacket packet) { if (packet != null) { DeviceId deviceId = packet.sendThrough(); Device device = deviceService.getDevice(deviceId); if (device.is(PacketProgrammable.class)) { PacketProgrammable packetProgrammable = device.as(PacketProgrammable.class); packetProgrammable.emit(packet); } else { log.info("No PacketProgrammable behavior for device {}", deviceId); } } }
private void localEmit(OutboundPacket packet) { Device device = deviceService.getDevice(packet.sendThrough()); if (device == null) { return; } PacketProvider packetProvider = getProvider(device.providerId()); if (packetProvider != null) { packetProvider.emit(packet); } }