<version>1.1.0-SNAPSHOT</version>
<packaging>bundle</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>yang-ext</artifactId>
+ </dependency>
+ </dependencies>
+
</project>
--- /dev/null
+module ntfbench-payload {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:ntfbench-payload";
+ prefix "ntfbenchmark";
+
+ revision "2015-07-09" {
+ description "Initial revision of ntfbenchmark model";
+ }
+
+ grouping payload {
+ list payload {
+ description
+ "The payload for the notification";
+ key id;
+ leaf id {
+ type int32;
+ }
+ }
+ }
+
+ notification ntfbench {
+ uses payload;
+ }
+}
--- /dev/null
+module ntfbenchmark {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:ntfbenchmark";
+ prefix "ntfbenchmark";
+
+ revision "2015-01-05" {
+ description "Initial revision of ntfbenchmark model";
+ }
+
+ rpc test-status {
+ description
+ "Get test status";
+ output {
+ leaf execStatus {
+ type enumeration {
+ enum "idle" {
+ value 1;
+ }
+ enum "executing" {
+ value 2;
+ }
+ }
+ }
+ leaf ntf-cnt {
+ type uint32;
+ default 0;
+ description
+ "The number of times the notification benchmark test was invoked";
+ }
+ }
+ }
+
+ rpc start-test {
+ description
+ "Start a new RPC Benchmark test";
+
+ input {
+ leaf producer-type {
+ mandatory true;
+ type enumeration {
+ enum "BLOCKING" {
+ value 1;
+ description
+ "The producer waits for a free slot in RPC Broker's ring buffer";
+ }
+ enum "DROPPING" {
+ value 2;
+ description
+ "The producer drops a notification if there is no free slot in RPC Broker's ring buffer";
+ }
+ }
+ description
+ "RPC type and client type to use in the test";
+ }
+ leaf producers {
+ type uint32;
+ default 1;
+ description
+ "Number of notification producers (test client threads) to start";
+ }
+ leaf listeners {
+ type uint32;
+ default 1;
+ description
+ "Number of notification listener instances";
+ }
+
+ leaf payload-size {
+ type uint32;
+ default 1;
+ description
+ "Notification payload size: number of elements in the list of integers that is the notification payload";
+ }
+ leaf iterations {
+ type uint32;
+ default 1;
+ description
+ "Number of notifications to generate in each client thread";
+ }
+
+ }
+
+ output {
+ leaf listener-ok {
+ type uint32;
+ default 0;
+ description
+ "Number of successfully creceived notifications by all listeners";
+ }
+ leaf producer-ok {
+ type uint32;
+ default 0;
+ description
+ "Number of successfully generated notifications in all producer clients";
+ }
+ leaf producer-error {
+ type uint32;
+ default 0;
+ description
+ "Number of errors encoutered during notification generation at all producers";
+ }
+ leaf producer-elapsed-time {
+ type uint32;
+ default 0;
+ description
+ "The time it took for all producers to finish (i.e. to send their notifications), in milliseconds";
+ }
+ leaf listener-elapsed-time {
+ type uint32;
+ default 0;
+ description
+ "The time it took for all listeners to finish (i.e. to receive their notifications), in milliseconds";
+ }
+ leaf producer-rate {
+ type uint32;
+ default 0;
+ description
+ "RPC rate (Number of RPCs/sec)";
+ }
+ leaf listener-rate {
+ type uint32;
+ default 0;
+ description
+ "RPC rate (Number of RPCs/sec)";
+ }
+ }
+ }
+}
--- /dev/null
+module rpcbench-payload {
+ yang-version 1;
+ namespace "rpcbench-payload";
+ prefix "rpcb";
+
+ import yang-ext { prefix ext; revision-date "2013-07-09"; }
+
+ revision "2015-07-02" {
+ description "Initial revision of rpcbenchmark model";
+ }
+
+ identity node-context {
+ description "Identity used to mark node context for Routed RPCs (determines the type of routing)";
+ }
+
+ grouping payload {
+ list payload {
+ description
+ "The input and output payload for the RPC Benchmark's Global RPC Server (a list of integers)";
+ key id;
+ leaf id {
+ type int32;
+ }
+ }
+ }
+
+ rpc global-rpc-bench {
+ description
+ "Interface to the RPC Benchmark's Global RPC Server. In each RPC call, the input is copied on the output";
+ input {
+ uses payload;
+ }
+ output {
+ uses payload;
+ }
+ }
+
+ rpc routed-rpc-bench {
+ description
+ "Interface to RPC Benchmark's Routed RPC Servers. In each RPC call, the input is copied on the output";
+ input {
+ leaf node {
+ ext:context-reference "node-context";
+ type "instance-identifier";
+ }
+ uses payload;
+ }
+ output {
+ uses payload;
+ }
+ }
+
+ container rpcbench-rpc-routes {
+ list rpc-route {
+ description
+ "Routed RPC server context instances (i.e. instances to which RPC calls are routed)";
+ key id;
+ ext:context-instance "node-context";
+ leaf id {
+ type string;
+ }
+ }
+ }
+}
--- /dev/null
+module rpcbenchmark {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:rpcbenchmark";
+ prefix "rpcbenchmark";
+
+ revision "2015-07-02" {
+ description "Initial revision of rpcbenchmark model";
+ }
+
+ rpc test-status {
+ description
+ "Get test status";
+ output {
+ leaf execStatus {
+ type enumeration {
+ enum "idle" {
+ value 1;
+ }
+ enum "executing" {
+ value 2;
+ }
+ }
+ }
+ leaf global-server-cnt {
+ type uint32;
+ default 0;
+ description
+ "The number of times the Global RPC server was invoked";
+
+ }
+ }
+ }
+
+ rpc start-test {
+ description
+ "Start a new RPC Benchmark test run";
+
+ input {
+ leaf operation {
+ mandatory true;
+ type enumeration {
+ enum "GLOBAL-RTC" {
+ value 1;
+ description
+ "Use Global RPC service and run-to-completion client";
+ }
+ enum "ROUTED-RTC" {
+ value 2;
+ description
+ "Use routed RPC service and run-to-completion client. RPC server instances are
+ dynamically created when the test starts and deleted when the test finishes";
+ }
+ }
+ description
+ "RPC type and client type to use in the test";
+ }
+ leaf num-clients {
+ type uint32;
+ default 1;
+ description
+ "Number of clients (test client threads) to start";
+ }
+ leaf num-servers {
+ type uint32;
+ default 1;
+ description
+ "Number of RPC server instances. Only valid for routed RPCs.";
+ }
+
+ leaf payload-size {
+ type uint32;
+ default 1;
+ description
+ "Input/Output payload size: number of elements in the list of integers that is the input and output RPC payload";
+ }
+ leaf iterations {
+ type uint32;
+ default 1;
+ description
+ "Number of calls to the specified RPC server that is to be made by each client";
+ }
+
+ }
+
+ output {
+ leaf global-rtc-client-ok {
+ type uint32;
+ default 0;
+ description
+ "Number of successful calls to the Global RPC Server for all test threads";
+ }
+ leaf global-rtc-client-error {
+ type uint32;
+ default 0;
+ description
+ "Number of failed calls to the Global RPC server from all test threads";
+ }
+ leaf exec-time {
+ type uint32;
+ default 0;
+ description
+ "Test execution time, in milliseconds";
+ }
+ leaf rate {
+ type uint32;
+ default 0;
+ description
+ "RPC rate (Number of RPCs/sec)";
+ }
+ }
+ }
+}
</dependency>
</dependencies>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.jacoco</groupId>
+ <artifactId>
+ jacoco-maven-plugin
+ </artifactId>
+ <versionRange>
+ [0.7.2.201409121644,)
+ </versionRange>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: --><!--
+Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>ntfbenchmark</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>benchmark-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-data-impl</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright (c) 2015 Cisco Systems Inc. and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<snapshot>
+ <required-capabilities>
+ <capability>urn:opendaylight:params:xml:ns:yang:ntfbenchmark:impl?module=ntfbenchmark-impl&revision=2014-12-10</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28</capability>
+ </required-capabilities>
+ <configuration>
+
+ <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <module>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:ntfbenchmark:impl">prefix:ntfbenchmark</type>
+ <name>ntfbenchmark-default</name>
+ <broker>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
+ <name>binding-osgi-broker</name>
+ </broker>
+ <publish-service>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">binding:binding-new-notification-publish-service</type>
+ <name>binding-notification-publish-adapter</name>
+ </publish-service>
+ <listen-service>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">binding:binding-new-notification-service</type>
+ <name>binding-notification-adapter</name>
+ </listen-service>
+ </module>
+ </modules>
+ </data>
+ </configuration>
+</snapshot>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata modelVersion="1.1.0">
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>ntfbenchmark</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <localCopy>true</localCopy>
+ </snapshot>
+ <lastUpdated>20151113053911</lastUpdated>
+ <snapshotVersions>
+ <snapshotVersion>
+ <classifier>config</classifier>
+ <extension>xml</extension>
+ <value>1.1.0-SNAPSHOT</value>
+ <updated>20151113053911</updated>
+ </snapshotVersion>
+ </snapshotVersions>
+ </versioning>
+</metadata>
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package ntfbenchmark.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.Ntfbench;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.NtfbenchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.payload.Payload;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.payload.PayloadBuilder;
+
+public abstract class AbstractNtfbenchProducer implements Runnable {
+ protected final NotificationPublishService publishService;
+ protected final int iterations;
+ protected final Ntfbench ntf;
+
+ /**
+ * @return the ntfOk
+ */
+ public int getNtfOk() {
+ return ntfOk;
+ }
+
+ /**
+ * @return the ntfError
+ */
+ public int getNtfError() {
+ return ntfError;
+ }
+
+ protected int ntfOk = 0;
+ protected int ntfError = 0;
+
+ public AbstractNtfbenchProducer(final NotificationPublishService publishService, final int iterations,
+ final int payloadSize) {
+ this.publishService = publishService;
+ this.iterations = iterations;
+
+ final List<Payload> listVals = new ArrayList<>();
+ for (int i = 0; i < payloadSize; i++) {
+ listVals.add(new PayloadBuilder().setId(i).build());
+ }
+
+ ntf = new NtfbenchBuilder().setPayload(listVals).build();
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package ntfbenchmark.impl;
+
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+
+public class NtfbenchBlockingProducer extends AbstractNtfbenchProducer {
+
+ public NtfbenchBlockingProducer(final NotificationPublishService publishService, final int iterations,
+ final int payloadSize) {
+ super(publishService, iterations, payloadSize);
+ }
+
+ @Override
+ public void run() {
+ int ntfOk = 0;
+ int ntfError = 0;
+
+ for (int i = 0; i < this.iterations; i++) {
+ try {
+ this.publishService.putNotification(this.ntf);
+ ntfOk++;
+ } catch (final Exception e) {
+ ntfError++;
+ }
+ }
+
+ this.ntfOk = ntfOk;
+ this.ntfError = ntfError;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package ntfbenchmark.impl;
+
+import com.google.common.base.Throwables;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.SettableFuture;
+import java.util.concurrent.ExecutionException;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+
+public class NtfbenchNonblockingProducer extends AbstractNtfbenchProducer {
+
+ private final SettableFuture<?> lastDeliveryFuture = SettableFuture.create();
+
+
+ public NtfbenchNonblockingProducer(final NotificationPublishService publishService, final int iterations,
+ final int payloadSize) {
+ super(publishService, iterations, payloadSize);
+ }
+
+
+ @Override
+ public void run() {
+ int ntfOk = 0;
+ int ntfError = 0;
+ ListenableFuture<? extends Object> lastOkFuture = null;
+ for (int i = 0; i < this.iterations; i++) {
+ try {
+ final ListenableFuture<? extends Object> result = this.publishService.offerNotification(this.ntf);
+ if (NotificationPublishService.REJECTED == result) {
+ ntfError++;
+ } else {
+ ntfOk++;
+ lastOkFuture = result;
+ }
+ } catch (final Exception e) {
+ ntfError++;
+ }
+ }
+
+ this.ntfOk = ntfOk;
+ this.ntfError = ntfError;
+ // We wait for last notification to be delivered to listeners.
+ if (lastOkFuture != null) {
+ try {
+ lastOkFuture.get();
+ } catch (InterruptedException | ExecutionException e) {
+ throw Throwables.propagate(e);
+ }
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package ntfbenchmark.impl;
+
+import java.util.concurrent.Future;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.Ntfbench;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.NtfbenchPayloadListener;
+
+import com.google.common.util.concurrent.Futures;
+
+public class NtfbenchTestListener implements NtfbenchPayloadListener {
+
+ private final int expectedSize;
+ private int received = 0;
+
+ public NtfbenchTestListener(final int expectedSize) {
+ this.expectedSize = expectedSize;
+ }
+
+ @Override
+ public void onNtfbench(final Ntfbench notification) {
+ if (expectedSize == notification.getPayload().size()) {
+ received++;
+ }
+ };
+
+ public int getReceived() {
+ return received;
+ }
+
+ public Future<?> getAllDone() {
+ return Futures.immediateFuture(null);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package ntfbenchmark.impl;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.Ntfbench;
+
+import com.google.common.util.concurrent.SettableFuture;
+
+public class NtfbenchWTCListener extends NtfbenchTestListener {
+ private final int expectedCount;
+ private final SettableFuture<?> allDone = SettableFuture.create();
+
+ public NtfbenchWTCListener(int expectedSize, int expectedCount) {
+ super(expectedSize);
+ this.expectedCount = expectedCount;
+ }
+
+ @Override
+ public void onNtfbench(Ntfbench notification) {
+ // TODO Auto-generated method stub
+ super.onNtfbench(notification);
+ if (expectedCount == getReceived()) {
+ allDone.set(null);
+ }
+ }
+
+ public SettableFuture<?> getAllDone() {
+ return allDone;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package ntfbenchmark.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.md.sal.binding.api.NotificationService;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.NtfbenchmarkService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.StartTestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.StartTestInput.ProducerType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.StartTestOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.StartTestOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.TestStatusOutput;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NtfbenchmarkProvider implements BindingAwareProvider, AutoCloseable, NtfbenchmarkService {
+
+ private static final Logger LOG = LoggerFactory.getLogger(NtfbenchmarkProvider.class);
+ private NotificationService listenService;
+ private NotificationPublishService publishService;
+ private static final int testTimeout = 5;
+
+ public NtfbenchmarkProvider(NotificationService listenServiceDependency,
+ NotificationPublishService publishServiceDependency) {
+ LOG.info("NtfbenchmarkProvider Constructor");
+ listenService = listenServiceDependency;
+ publishService = publishServiceDependency;
+ }
+
+ @Override
+ public void onSessionInitiated(final ProviderContext session) {
+ LOG.info("NtfbenchmarkProvider Session Initiated");
+ session.addRpcImplementation(NtfbenchmarkService.class, this);
+ }
+
+ @Override
+ public void close() throws Exception {
+ LOG.info("NtfbenchmarkProvider Closed");
+ }
+
+ @Override
+ public Future<RpcResult<StartTestOutput>> startTest(final StartTestInput input) {
+ final int producerCount = input.getProducers().intValue();
+ final int listenerCount = input.getListeners().intValue();
+ final int iterations = input.getIterations().intValue();
+ final int payloadSize = input.getIterations().intValue();
+
+ final List<AbstractNtfbenchProducer> producers = new ArrayList<>(producerCount);
+ final List<ListenerRegistration<NtfbenchTestListener>> listeners = new ArrayList<>(listenerCount);
+ for (int i = 0; i < producerCount; i++) {
+ producers.add(new NtfbenchBlockingProducer(publishService, iterations, payloadSize));
+ }
+ int expectedCntPerListener = producerCount * iterations;
+
+ for (int i = 0; i < listenerCount; i++) {
+ final NtfbenchTestListener listener;
+ if (input.getProducerType() == ProducerType.BLOCKING) {
+ listener = new NtfbenchWTCListener(payloadSize, expectedCntPerListener);
+ } else {
+ listener = new NtfbenchTestListener(payloadSize);
+ }
+ listeners.add(listenService.registerNotificationListener(listener));
+ }
+
+ try {
+ final ExecutorService executor = Executors.newFixedThreadPool(input.getProducers().intValue());
+
+ LOG.info("Test Started");
+ final long startTime = System.nanoTime();
+
+ for (int i = 0; i < input.getProducers().intValue(); i++) {
+ executor.submit(producers.get(i));
+ }
+ executor.shutdown();
+ try {
+ executor.awaitTermination(testTimeout, TimeUnit.MINUTES);
+ for (ListenerRegistration<NtfbenchTestListener> listenerRegistration : listeners) {
+ listenerRegistration.getInstance().getAllDone().get();
+ }
+ } catch (final InterruptedException | ExecutionException e) {
+ LOG.error("Out of time: test did not finish within the {} min deadline ", testTimeout);
+ }
+
+ final long producerEndTime = System.nanoTime();
+ final long producerElapsedTime = producerEndTime - startTime;
+
+ long allListeners = 0;
+ long allProducersOk = 0;
+ long allProducersError = 0;
+
+ for (final ListenerRegistration<NtfbenchTestListener> listenerRegistration : listeners) {
+ allListeners += listenerRegistration.getInstance().getReceived();
+ }
+
+ final long listenerEndTime = System.nanoTime();
+ final long listenerElapsedTime = producerEndTime - startTime;
+
+ LOG.info("Test Done");
+
+ for (final AbstractNtfbenchProducer abstractNtfbenchProducer : producers) {
+ allProducersOk += abstractNtfbenchProducer.getNtfOk();
+ allProducersError += abstractNtfbenchProducer.getNtfError();
+ }
+
+ final StartTestOutput output =
+ new StartTestOutputBuilder()
+ .setProducerElapsedTime(producerElapsedTime / 1000000)
+ .setListenerElapsedTime(listenerElapsedTime / 1000000)
+ .setListenerOk(allListeners)
+ .setProducerOk(allProducersOk)
+ .setProducerError(allProducersError)
+ .setProducerRate(((allProducersOk + allProducersError) * 1000000000) / producerElapsedTime)
+ .setListenerRate((allListeners * 1000000000) / listenerElapsedTime)
+ .build();
+ return RpcResultBuilder.success(output).buildFuture();
+ } finally {
+ for (final ListenerRegistration<NtfbenchTestListener> listenerRegistration : listeners) {
+ listenerRegistration.close();
+ }
+ }
+ }
+
+ @Override
+ public Future<RpcResult<TestStatusOutput>> testStatus() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.impl.rev141210;
+
+import ntfbenchmark.impl.NtfbenchmarkProvider;
+
+public class NtfbenchmarkModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.impl.rev141210.AbstractNtfbenchmarkModule {
+ public NtfbenchmarkModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public NtfbenchmarkModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.impl.rev141210.NtfbenchmarkModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ NtfbenchmarkProvider provider = new NtfbenchmarkProvider(getListenServiceDependency(), getPublishServiceDependency());
+ getBrokerDependency().registerProvider(provider);
+ return provider;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+/*
+* Generated file
+*
+* Generated from: yang module name: ntfbenchmark yang module local name: ntfbenchmark
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri Jan 02 13:49:24 CST 2015
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.impl.rev141210;
+public class NtfbenchmarkModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.impl.rev141210.AbstractNtfbenchmarkModuleFactory {
+
+}
--- /dev/null
+module ntfbenchmark-impl {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:ntfbenchmark:impl";
+ prefix "ntfbenchmark-impl";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
+ import opendaylight-sal-binding-broker-impl {prefix binding-impl; revision-date 2013-10-28;}
+
+ description
+ "Service definition for ntfbenchmark project";
+
+ revision "2014-12-10" {
+ description
+ "Initial revision";
+ }
+
+ identity ntfbenchmark {
+ base config:module-type;
+ config:java-name-prefix Ntfbenchmark;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case ntfbenchmark {
+ when "/config:modules/config:module/config:type = 'ntfbenchmark'";
+ container broker {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity md-sal-binding:binding-broker-osgi-registry;
+ }
+ }
+ }
+ container publish-service {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity binding-impl:binding-new-notification-publish-service;
+ }
+ }
+ }
+ container listen-service {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity binding-impl:binding-new-notification-service;
+ }
+ }
+ }
+
+ }
+ }
+}
<modules>
<module>api</module>
<module>dsbenchmark</module>
+ <module>ntfbenchmark</module>
<module>artifacts</module>
</modules>
</project>
<type>xml</type>
<classifier>config</classifier>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>ntfbenchmark</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>ntfbenchmark</artifactId>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>benchmark-api</artifactId>
<bundle>mvn:org.opendaylight.controller/dsbenchmark/{{VERSION}}</bundle>
<configfile finalname="dsbenchmark-impl-default-config.xml">mvn:org.opendaylight.controller/dsbenchmark/{{VERSION}}/xml/config</configfile>
</feature>
+ <feature name='odl-ntfbenchmark' version='${project.version}' description='OpenDaylight :: ntfbenchmark :: '>
+ <feature version='${controller.mdsal.version}'>odl-mdsal-broker</feature>
+ <feature version='${project.version}'>odl-benchmark-api</feature>
+ <bundle>mvn:org.opendaylight.controller/ntfbenchmark/{{VERSION}}</bundle>
+ <configfile finalname="ntfbenchmark-impl-default-config.xml">mvn:org.opendaylight.controller/ntfbenchmark/{{VERSION}}/xml/config</configfile>
+ </feature>
</features>