Fix star import and enable checkstyle rule to prevent it.
[controller.git] / opendaylight / md-sal / sal-compability / src / main / java / org / opendaylight / controller / sal / compability / adsal / DataPacketServiceAdapter.java
1 package org.opendaylight.controller.sal.compability.adsal;
2
3 import org.opendaylight.controller.sal.compability.NodeMapping;
4 import org.opendaylight.controller.sal.packet.IPluginInDataPacketService;
5 import org.opendaylight.controller.sal.packet.RawPacket;
6 import org.opendaylight.controller.sal.packet.RawPacket;
7 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
8 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
9 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInputBuilder;
11
12 public class DataPacketServiceAdapter implements IPluginInDataPacketService {
13
14     PacketProcessingService delegate;
15
16     @Override
17     public void transmitDataPacket(RawPacket outPkt) {
18         TransmitPacketInput packet = toTransmitPacketInput(outPkt);
19         delegate.transmitPacket(packet);
20     }
21
22     private TransmitPacketInput toTransmitPacketInput(RawPacket rawPacket) {
23         TransmitPacketInputBuilder builderTPIB = new TransmitPacketInputBuilder();
24
25         NodeConnectorRef egress = NodeMapping.toNodeConnectorRef(rawPacket.getOutgoingNodeConnector());
26         NodeConnectorRef ingress = NodeMapping.toNodeConnectorRef(rawPacket.getIncomingNodeConnector());
27         byte[] payload = rawPacket.getPacketData();
28
29         builderTPIB.setEgress(egress);
30         builderTPIB.setIngress(ingress);
31         builderTPIB.setPayload(payload);
32
33         return builderTPIB.build();
34     }
35
36 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.