[ONOS-6809] Implementation for packet out in p4Runtime

Change-Id: I873a1fd18529fe9fd41aa33f862298892ece7d1c
diff --git a/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/Bmv2PacketProgrammable.java b/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/Bmv2PacketProgrammable.java
index c4dc2b4..cbf032b 100644
--- a/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/Bmv2PacketProgrammable.java
+++ b/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/Bmv2PacketProgrammable.java
@@ -16,7 +16,6 @@
 
 package org.onosproject.drivers.bmv2;
 
-import org.onlab.util.ImmutableByteSequence;
 import org.onosproject.net.Device;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.device.DeviceService;
@@ -32,7 +31,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.onosproject.net.pi.runtime.PiPacketOperation.Type.PACKET_OUT;
+import java.util.Collection;
 
 /**
  * Packet Programmable behaviour for BMv2 devices.
@@ -72,16 +71,13 @@
         }
 
         try {
-            PiPacketOperation piPacketOperation = PiPacketOperation
-                    .builder()
-                    .withType(PACKET_OUT)
-                    .withData(ImmutableByteSequence.copyFrom(packet.data()))
-                    .withMetadatas(interpreter.mapOutboundPacket(packet, pipeconf))
-                    .build();
-            client.packetOut(piPacketOperation, pipeconf);
+            Collection<PiPacketOperation> operations = interpreter.mapOutboundPacket(packet, pipeconf);
+            operations.forEach(piPacketOperation -> {
+                client.packetOut(piPacketOperation, pipeconf);
+            });
         } catch (PiPipelineInterpreter.PiInterpreterException e) {
             log.error("Interpreter of pipeconf {} was unable to translate outbound packet: {}",
-                      pipeconf.id(), e.getMessage());
+                    pipeconf.id(), e.getMessage());
         }
     }
 }