Bump upstreams
[openflowplugin.git] / test-common / src / main / java / org / opendaylight / openflowplugin / testcommon / AbstractDropTest.java
index 0ac67560262f23c54c6caf97b34e5c93b524e63d..d7703b5e6c505b037ed97bb8e056ef16d1cc06a8 100644 (file)
@@ -7,8 +7,6 @@
  */
 package org.opendaylight.openflowplugin.testcommon;
 
-import static org.opendaylight.openflowjava.util.ByteBufUtils.macAddressToString;
-
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import java.util.Arrays;
 import java.util.Collections;
@@ -18,7 +16,8 @@ import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+import org.opendaylight.mdsal.binding.api.NotificationService.Listener;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.IetfYangUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder;
@@ -37,7 +36,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeCon
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.Uint16;
@@ -46,7 +44,7 @@ import org.opendaylight.yangtools.yang.common.Uint8;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-abstract class AbstractDropTest implements PacketProcessingListener, AutoCloseable {
+abstract class AbstractDropTest implements Listener<PacketReceived>, AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(AbstractDropTest.class);
 
     protected static final Uint16 PRIORITY = Uint16.valueOf(4);
@@ -55,14 +53,11 @@ abstract class AbstractDropTest implements PacketProcessingListener, AutoCloseab
     protected static final Uint16 IDLE_TIMEOUT = Uint16.valueOf(240);
     protected static final Uint8 TABLE_ID = Uint8.ZERO;
 
-    static final long STARTUP_LOOP_TICK = 500L;
-    static final int STARTUP_LOOP_MAX_RETRIES = 8;
     private static final int PROCESSING_POOL_SIZE = 10000;
 
     private static final int POOL_THREAD_AMOUNT = 8;
     private final ExecutorService executorService;
 
-
     private static final AtomicIntegerFieldUpdater<AbstractDropTest> SENT_UPDATER = AtomicIntegerFieldUpdater
             .newUpdater(AbstractDropTest.class, "sent");
     private volatile int sent;
@@ -92,8 +87,7 @@ abstract class AbstractDropTest implements PacketProcessingListener, AutoCloseab
     protected volatile int runablesRejected;
 
     public final DropTestStats getStats() {
-        return new DropTestStats(this.sent, this.rcvd, this.excs, this.ftrFailed, this.ftrSuccess,
-                this.runablesExecuted, this.runablesRejected);
+        return new DropTestStats(sent, rcvd, excs, ftrFailed, ftrSuccess, runablesExecuted, runablesRejected);
     }
 
     AbstractDropTest() {
@@ -114,13 +108,13 @@ abstract class AbstractDropTest implements PacketProcessingListener, AutoCloseab
     }
 
     public final void clearStats() {
-        this.sent = 0;
-        this.rcvd = 0;
-        this.excs = 0;
-        this.ftrSuccess = 0;
-        this.ftrFailed = 0;
-        this.runablesExecuted = 0;
-        this.runablesRejected = 0;
+        sent = 0;
+        rcvd = 0;
+        excs = 0;
+        ftrSuccess = 0;
+        ftrFailed = 0;
+        runablesExecuted = 0;
+        runablesRejected = 0;
     }
 
     private void incrementRunableExecuted() {
@@ -132,7 +126,7 @@ abstract class AbstractDropTest implements PacketProcessingListener, AutoCloseab
     }
 
     @Override
-    public final void onPacketReceived(final PacketReceived notification) {
+    public final void onNotification(final PacketReceived notification) {
         LOG.debug("onPacketReceived - Entering - {}", notification);
 
         RCVD_UPDATER.incrementAndGet(this);
@@ -178,7 +172,7 @@ abstract class AbstractDropTest implements PacketProcessingListener, AutoCloseab
             //TODO: use HEX, use binary form
             //Hex.decodeHex("000000000001".toCharArray());
 
-            ethSourceBuilder.setAddress(new MacAddress(macAddressToString(srcMac)));
+            ethSourceBuilder.setAddress(IetfYangUtil.macAddressFor(srcMac));
             ethernetMatch.setEthernetSource(ethSourceBuilder.build());
             match.setEthernetMatch(ethernetMatch.build());