- for (int i = 0; i < containersRX.size(); i++) {
- String container = containersRX.get(i);
- IPluginOutDataPacketService s = this.pluginOutDataPacketServices
- .get(container);
- if (s != null) {
- // TODO add filtering on a per-flowSpec base
- s.receiveDataPacket(dataPacket);
- if (logger.isTraceEnabled()) {
- logger.trace(
- "Dispatched to apps a frame of size: {}" +
- " on container: {}: {}", new Object[] {
- ofPacket.getPacketData().length,
- container,
- HexEncode.bytesToHexString(dataPacket
- .getPacketData()) });
+ Ethernet frame = new Ethernet();
+ byte data[] = dataPacket.getPacketData();
+ frame.deserialize(data, 0, data.length * NetUtils.NumBitsInAByte);
+ Match packetMatch = frame.getMatch();
+ for (String container : containersRX) {
+ boolean notify = true;
+ List<ContainerFlow> containerFlows = this.container2FlowSpecs.get(container);
+ if (containerFlows != null) {
+ notify = false;
+ for (ContainerFlow cFlow : containerFlows) {
+ if (cFlow.allowsMatch(packetMatch)) {
+ notify = true;
+ break;
+ }
+ }
+ if (notify) {
+ IPluginOutDataPacketService s = this.pluginOutDataPacketServices.get(container);
+ if (s != null) {
+ s.receiveDataPacket(dataPacket);
+ if (logger.isTraceEnabled()) {
+ logger.trace(
+ "Dispatched to apps a frame of size: {}" + " on container: {}: {}",
+ new Object[] { ofPacket.getPacketData().length, container,
+ HexEncode.bytesToHexString(dataPacket.getPacketData()) });
+ }
+ }
+ dispatched_to_container = true;