3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.openflowplugin.openflow.internal;
12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory;
14 import org.opendaylight.controller.sal.connection.IPluginOutConnectionService;
15 import org.opendaylight.controller.sal.core.NodeConnector;
16 import org.opendaylight.controller.sal.packet.IPluginInDataPacketService;
17 import org.opendaylight.controller.sal.packet.RawPacket;
18 import org.opendaylight.openflowplugin.openflow.IDataPacketMux;
20 public class DataPacketServices implements IPluginInDataPacketService {
21 protected static final Logger logger = LoggerFactory
22 .getLogger(DataPacketServices.class);
23 private IDataPacketMux iDataPacketMux = null;
24 private IPluginOutConnectionService connectionOutService;
26 void setIDataPacketMux(IDataPacketMux s) {
27 this.iDataPacketMux = s;
30 void unsetIDataPacketMux(IDataPacketMux s) {
31 if (this.iDataPacketMux == s) {
32 this.iDataPacketMux = null;
36 void setIPluginOutConnectionService(IPluginOutConnectionService s) {
37 connectionOutService = s;
40 void unsetIPluginOutConnectionService(IPluginOutConnectionService s) {
41 if (connectionOutService == s) {
42 connectionOutService = null;
47 public void transmitDataPacket(RawPacket outPkt) {
48 NodeConnector nc = outPkt.getOutgoingNodeConnector();
49 if (connectionOutService != null && connectionOutService.isLocal(nc.getNode())) {
50 this.iDataPacketMux.transmitDataPacket(outPkt);
52 logger.debug("{} is dropped in the controller "+outPkt);