diff options
Diffstat (limited to 'infra/it/benchmark/src/main')
4 files changed, 52 insertions, 49 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 |