-package org.opendaylight.l2switch.packethandler.decoders;
+package org.opendaylight.l2switch.arppacket;
import org.opendaylight.controller.sal.packet.BitBufferHelper;
import org.opendaylight.controller.sal.packet.BufferException;
import org.opendaylight.controller.sal.utils.HexEncode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.arp.rev140528.ArpPacket;
+import org.opendaylight.l2switch.packethandler.decoders.PacketDecoder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.arp.rev140528.ArpPacketBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.arp.rev140528.KnownHardwareType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.arp.rev140528.KnownOperation;
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.l2switch.packethandler;
+package org.opendaylight.l2switch.arppacket;
import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareConsumer;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.binding.api.NotificationService;
import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
+import org.opendaylight.l2switch.packethandler.decoders.PacketDecoderService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.arp.rev140528.ArpPacketReceived;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.ethernet.rev140528.KnownEtherType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
//import org.opendaylight.yangtools.concepts.Registration;
//import org.opendaylight.yangtools.yang.binding.NotificationListener;
import org.slf4j.LoggerFactory;
/**
- * ArpPacketProvider serves as the Activator for our L2Switch OSGI bundle.
+ * ArpPacketProvider serves as the Activator for our ArpPacket OSGI bundle.
*/
public class ArpPacketProvider extends AbstractBindingAwareConsumer
implements AutoCloseable {
private final static Logger _logger = LoggerFactory.getLogger(ArpPacketProvider.class);
-// private Registration<NotificationListener> rawPacketListenerRegistration;
-
-
/**
- * Setup the packet handler.
- *
+ * Setup the ARP packet handler.
* @param consumerContext The context of the L2Switch.
*/
@Override
public void onSessionInitialized(BindingAwareBroker.ConsumerContext consumerContext) {
- /*DataBrokerService dataService = consumerContext.<DataBrokerService>getSALService(DataBrokerService.class);
- NotificationService notificationService =
- consumerContext.<NotificationService>getSALService(NotificationService.class);
- PacketProcessingService packetProcessingService =
- consumerContext.<PacketProcessingService>getRpcService(PacketProcessingService.class);
- RawPacketHandler rawPacketHandler = new RawPacketHandler();
- this.rawPacketListenerRegistration = notificationService.registerNotificationListener(rawPacketHandler);*/
+ //ToDo: Replace with config subsystem call
+ PacketDecoderService packetDecoderService = consumerContext.getSALService(PacketDecoderService.class);
+ packetDecoderService.registerDecoder(KnownEtherType.Arp, new ArpDecoder(), ArpPacketReceived.class);
}
/**
- * Cleanup the packet handler..
- *
- * @throws Exception occurs when the NotificationListener is closed
+ * Cleanup the ARP packet handler
*/
@Override
- public void close() throws Exception {
- //if(rawPacketListenerRegistration != null)
- // rawPacketListenerRegistration.close();
+ public void close() {
}
}
\ No newline at end of file