summaryrefslogtreecommitdiffstats
path: root/infra/it
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2017-10-04 09:55:39 +0200
committerJan Srnicek <jsrnicek@cisco.com>2017-10-04 07:57:11 +0000
commitd893224d0a3727d66253031ebb892c287df0ed8a (patch)
treeb0c8814a8bc210a59b392d379fe0b34089671001 /infra/it
parentca983b9d748fd38e66f854a5d984d216958b1713 (diff)
HONEYCOMB-401 - Fix compilation issues for benchmark
Change-Id: I93df9e6b65273c82da308a194f4fe6488c6ce5e1 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'infra/it')
-rw-r--r--infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerConfigWriteBenchmark.java44
-rw-r--r--infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerOperReadBenchmark.java44
-rw-r--r--infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/NoopWriter.java12
-rw-r--r--infra/it/benchmark/src/main/resources/yang-mapping/yang-index1
-rw-r--r--infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/write/NoopWriter.java7
5 files changed, 58 insertions, 50 deletions
diff --git a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerConfigWriteBenchmark.java b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerConfigWriteBenchmark.java
index 6d76ad2d3..d37148936 100644
--- a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerConfigWriteBenchmark.java
+++ b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerConfigWriteBenchmark.java
@@ -16,27 +16,19 @@
package io.fd.honeycomb.benchmark.data;
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.Key;
-import com.google.inject.Module;
+import com.google.inject.*;
import com.google.inject.multibindings.Multibinder;
import com.google.inject.name.Names;
import io.fd.honeycomb.benchmark.util.DataProvider;
import io.fd.honeycomb.benchmark.util.DataSubmitter;
import io.fd.honeycomb.benchmark.util.FileManager;
import io.fd.honeycomb.benchmark.util.NoopWriter;
+import io.fd.honeycomb.infra.distro.activation.ActivationConfig;
+import io.fd.honeycomb.infra.distro.activation.ActiveModules;
import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration;
import io.fd.honeycomb.infra.distro.data.ConfigAndOperationalPipelineModule;
import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
-import java.io.IOException;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.ExecutionException;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -46,22 +38,20 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.test.
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.test.rev150105.container.with.list.list.in.container.ContainerInList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.test.rev150105.container.with.list.list.in.container.container.in.list.NestedList;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.openjdk.jmh.annotations.Benchmark;
-import org.openjdk.jmh.annotations.BenchmarkMode;
-import org.openjdk.jmh.annotations.Fork;
-import org.openjdk.jmh.annotations.Level;
-import org.openjdk.jmh.annotations.Measurement;
-import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.annotations.Param;
+import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.annotations.Scope;
-import org.openjdk.jmh.annotations.Setup;
-import org.openjdk.jmh.annotations.State;
-import org.openjdk.jmh.annotations.TearDown;
-import org.openjdk.jmh.annotations.Timeout;
-import org.openjdk.jmh.annotations.Warmup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.ExecutionException;
+import java.util.stream.Collectors;
+
/**
* Measures the performance of CONFIG writes into BA DataBroker, backed by HC infrastructure and then NOOP writers.
*/
@@ -162,6 +152,8 @@ public class DataBrokerConfigWriteBenchmark extends AbstractModule implements Fi
try {
instance = getHoneycombConfiguration(persistence);
bind(HoneycombConfiguration.class).toInstance(instance);
+ bind(ActivationConfig.class).toInstance(getActivationConfig());
+ bind(ActiveModules.class).toInstance(new ActiveModules(Arrays.stream(modules).map(Module::getClass).collect(Collectors.toSet())));
} catch (IOException e) {
throw new RuntimeException("Unable to prepare configuration", e);
}
@@ -196,4 +188,10 @@ public class DataBrokerConfigWriteBenchmark extends AbstractModule implements Fi
instance.peristContextPath = FileManager.INSTANCE.createTempFile("context").toString();
return instance;
}
+
+ private static ActivationConfig getActivationConfig(){
+ final ActivationConfig activationConfig = new ActivationConfig();
+ activationConfig.yangModulesIndexPath = "yang-mapping";
+ return activationConfig;
+ }
}
diff --git a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerOperReadBenchmark.java b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerOperReadBenchmark.java
index 86ded0f66..bdb398b86 100644
--- a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerOperReadBenchmark.java
+++ b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerOperReadBenchmark.java
@@ -16,27 +16,19 @@
package io.fd.honeycomb.benchmark.data;
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.Key;
-import com.google.inject.Module;
+import com.google.inject.*;
import com.google.inject.multibindings.Multibinder;
import com.google.inject.name.Names;
import io.fd.honeycomb.benchmark.util.DataProvider;
import io.fd.honeycomb.benchmark.util.FileManager;
import io.fd.honeycomb.benchmark.util.StaticReader;
+import io.fd.honeycomb.infra.distro.activation.ActivationConfig;
+import io.fd.honeycomb.infra.distro.activation.ActiveModules;
import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration;
import io.fd.honeycomb.infra.distro.data.ConfigAndOperationalPipelineModule;
import io.fd.honeycomb.translate.read.Reader;
import io.fd.honeycomb.translate.read.ReaderFactory;
import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import java.io.IOException;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.ExecutionException;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -45,22 +37,20 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.test.
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.test.rev150105.SimpleContainer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.test.rev150105.container.with.list.ListInContainer;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.openjdk.jmh.annotations.Benchmark;
-import org.openjdk.jmh.annotations.BenchmarkMode;
-import org.openjdk.jmh.annotations.Fork;
-import org.openjdk.jmh.annotations.Level;
-import org.openjdk.jmh.annotations.Measurement;
-import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.annotations.Param;
+import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.annotations.Scope;
-import org.openjdk.jmh.annotations.Setup;
-import org.openjdk.jmh.annotations.State;
-import org.openjdk.jmh.annotations.TearDown;
-import org.openjdk.jmh.annotations.Timeout;
-import org.openjdk.jmh.annotations.Warmup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.ExecutionException;
+import java.util.stream.Collectors;
+
/**
* Measures the performance of CONFIG writes into BA DataBroker, backed by HC infrastructure and then NOOP writers.
*/
@@ -142,6 +132,8 @@ public class DataBrokerOperReadBenchmark extends AbstractModule implements FileM
try {
instance = getHoneycombConfiguration(persistence);
bind(HoneycombConfiguration.class).toInstance(instance);
+ bind(ActivationConfig.class).toInstance(getActivationConfig());
+ bind(ActiveModules.class).toInstance(new ActiveModules(Arrays.stream(modules).map(Module::getClass).collect(Collectors.toSet())));
} catch (IOException e) {
throw new RuntimeException("Unable to prepare configuration", e);
}
@@ -189,4 +181,10 @@ public class DataBrokerOperReadBenchmark extends AbstractModule implements FileM
instance.peristContextPath = FileManager.INSTANCE.createTempFile("context").toString();
return instance;
}
+
+ private static ActivationConfig getActivationConfig(){
+ final ActivationConfig activationConfig = new ActivationConfig();
+ activationConfig.yangModulesIndexPath = "yang-mapping";
+ return activationConfig;
+ }
}
diff --git a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/NoopWriter.java b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/NoopWriter.java
index f61bd1b5d..c42474754 100644
--- a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/NoopWriter.java
+++ b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/NoopWriter.java
@@ -19,11 +19,12 @@ package io.fd.honeycomb.benchmark.util;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.honeycomb.translate.write.Writer;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
* Noop writer suitable for lists as well.
@@ -39,7 +40,7 @@ public final class NoopWriter<T extends DataObject> implements Writer<T> {
}
@Override
- public void update(@Nonnull final InstanceIdentifier<? extends DataObject> id,
+ public void processModification(@Nonnull final InstanceIdentifier<? extends DataObject> id,
@Nullable final DataObject dataBefore,
@Nullable final DataObject dataAfter,
@Nonnull final WriteContext ctx) throws WriteFailedException {
@@ -60,4 +61,9 @@ public final class NoopWriter<T extends DataObject> implements Writer<T> {
", counter=" + counter +
'}';
}
+
+ @Override
+ public boolean supportsDirectUpdate() {
+ return true;
+ }
}
diff --git a/infra/it/benchmark/src/main/resources/yang-mapping/yang-index b/infra/it/benchmark/src/main/resources/yang-mapping/yang-index
new file mode 100644
index 000000000..78acc66c1
--- /dev/null
+++ b/infra/it/benchmark/src/main/resources/yang-mapping/yang-index
@@ -0,0 +1 @@
+GUICE_MODULE:io.fd.honeycomb.infra.distro.schema.SchemaModule|YANG_MODULES:org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.test.rev150105.$YangModelBindingProvider
diff --git a/infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/write/NoopWriter.java b/infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/write/NoopWriter.java
index 000a176df..dafca09a9 100644
--- a/infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/write/NoopWriter.java
+++ b/infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/write/NoopWriter.java
@@ -33,13 +33,18 @@ public final class NoopWriter<T extends DataObject> implements Writer<T> {
}
@Override
- public void update(@Nonnull final InstanceIdentifier<? extends DataObject> id,
+ public void processModification(@Nonnull final InstanceIdentifier<? extends DataObject> id,
@Nullable final DataObject dataBefore,
@Nullable final DataObject dataAfter,
@Nonnull final WriteContext ctx) throws WriteFailedException {
// NOOP
}
+ @Override
+ public boolean supportsDirectUpdate() {
+ return true;
+ }
+
@Nonnull
@Override
public InstanceIdentifier<T> getManagedDataObjectType() {