Convert rpcbenchmark to blueprint 19/58419/3
authorTom Pantelis <tompantelis@gmail.com>
Wed, 7 Jun 2017 14:54:33 +0000 (10:54 -0400)
committerTom Pantelis <tompantelis@gmail.com>
Thu, 8 Jun 2017 15:50:44 +0000 (11:50 -0400)
Change-Id: I1af664396721a899d51d12fe132853d642d98a7e
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
12 files changed:
benchmark/rpcbenchmark/pom.xml
benchmark/rpcbenchmark/src/main/config/default-config.xml [deleted file]
benchmark/rpcbenchmark/src/main/config/maven-metadata-local.xml [deleted file]
benchmark/rpcbenchmark/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/rpcbenchmark/impl/rev141210/RpcbenchmarkModule.java [deleted file]
benchmark/rpcbenchmark/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/rpcbenchmark/impl/rev141210/RpcbenchmarkModuleFactory.java [deleted file]
benchmark/rpcbenchmark/src/main/java/rpcbenchmark/impl/RpcbenchmarkProvider.java
benchmark/rpcbenchmark/src/main/resources/org/opendaylight/blueprint/rpcbenchmark.xml [new file with mode: 0644]
benchmark/rpcbenchmark/src/main/yang/rpcbenchmark-impl.yang [deleted file]
features/benchmark/features-mdsal-benchmark/pom.xml
features/benchmark/features-mdsal-benchmark/src/main/features/features.xml
features/benchmark/odl-mdsal-benchmark/pom.xml
features/benchmark/odl-mdsal-benchmark/src/main/feature/feature.xml [deleted file]

index 6b016bd..e4d398b 100644 (file)
@@ -9,10 +9,10 @@ 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.7.0-SNAPSHOT</version>
-    <relativePath>../../opendaylight/config/config-parent/pom.xml</relativePath>
+    <groupId>org.opendaylight.mdsal</groupId>
+    <artifactId>binding-parent</artifactId>
+    <version>0.11.0-SNAPSHOT</version>
+    <relativePath/>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
@@ -20,12 +20,29 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   <artifactId>rpcbenchmark</artifactId>
   <version>1.4.0-SNAPSHOT</version>
   <packaging>bundle</packaging>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>mdsal-artifacts</artifactId>
+        <version>1.6.0-SNAPSHOT</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
   <dependencies>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>benchmark-api</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-binding-api</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal-core-api</artifactId>
diff --git a/benchmark/rpcbenchmark/src/main/config/default-config.xml b/benchmark/rpcbenchmark/src/main/config/default-config.xml
deleted file mode 100644 (file)
index 3ce1e64..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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:rpcbenchmark:impl?module=rpcbenchmark-impl&amp;revision=2014-12-10</capability>
-      <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;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:rpcbenchmark:impl">prefix:rpcbenchmark</type>
-          <name>rpcbenchmark-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>
-        </module>
-      </modules>
-    </data>
-  </configuration>
-</snapshot>
diff --git a/benchmark/rpcbenchmark/src/main/config/maven-metadata-local.xml b/benchmark/rpcbenchmark/src/main/config/maven-metadata-local.xml
deleted file mode 100644 (file)
index 22a3e02..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<metadata modelVersion="1.1.0">
-  <groupId>org.opendaylight.controller</groupId>
-  <artifactId>rpcbenchmark</artifactId>
-  <version>1.1.0-SNAPSHOT</version>
-  <versioning>
-    <snapshot>
-      <localCopy>true</localCopy>
-    </snapshot>
-    <lastUpdated>20151122054906</lastUpdated>
-    <snapshotVersions>
-      <snapshotVersion>
-        <classifier>config</classifier>
-        <extension>xml</extension>
-        <value>1.1.0-SNAPSHOT</value>
-        <updated>20151122054906</updated>
-      </snapshotVersion>
-    </snapshotVersions>
-  </versioning>
-</metadata>
diff --git a/benchmark/rpcbenchmark/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/rpcbenchmark/impl/rev141210/RpcbenchmarkModule.java b/benchmark/rpcbenchmark/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/rpcbenchmark/impl/rev141210/RpcbenchmarkModule.java
deleted file mode 100644 (file)
index 6475d0c..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.rpcbenchmark.impl.rev141210;
-
-import rpcbenchmark.impl.RpcbenchmarkProvider;
-
-public class RpcbenchmarkModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rpcbenchmark.impl.rev141210.AbstractRpcbenchmarkModule {
-    public RpcbenchmarkModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public RpcbenchmarkModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rpcbenchmark.impl.rev141210.RpcbenchmarkModule oldModule, final 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() {
-        RpcbenchmarkProvider provider = new RpcbenchmarkProvider();
-        getBrokerDependency().registerProvider(provider);
-        return provider;
-    }
-
-}
diff --git a/benchmark/rpcbenchmark/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/rpcbenchmark/impl/rev141210/RpcbenchmarkModuleFactory.java b/benchmark/rpcbenchmark/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/rpcbenchmark/impl/rev141210/RpcbenchmarkModuleFactory.java
deleted file mode 100644 (file)
index d8b6973..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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: rpcbenchmark yang module local name: rpcbenchmark
-* 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.rpcbenchmark.impl.rev141210;
-public class RpcbenchmarkModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rpcbenchmark.impl.rev141210.AbstractRpcbenchmarkModuleFactory {
-
-}
index 503bd17..7f8be49 100644 (file)
@@ -15,11 +15,7 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
-
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.NodeContext;
 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RpcbenchPayloadService;
@@ -40,30 +36,27 @@ import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class RpcbenchmarkProvider implements BindingAwareProvider, AutoCloseable, RpcbenchmarkService {
+public class RpcbenchmarkProvider implements AutoCloseable, RpcbenchmarkService {
 
     private static final Logger LOG = LoggerFactory.getLogger(RpcbenchmarkProvider.class);
-    private static final GlobalBindingRTCServer gServer = new GlobalBindingRTCServer();
     private static final int testTimeout = 5;
+
+    private final GlobalBindingRTCServer globalServer;
     private final AtomicReference<ExecStatus> execStatus = new AtomicReference<>(ExecStatus.Idle);
-    private RpcConsumerRegistry consumerRegistry;
-    private RpcProviderRegistry providerRegistry;
+    private final RpcProviderRegistry providerRegistry;
 
-    @Override
-    public void onSessionInitiated(final ProviderContext session) {
-        LOG.debug("RpcbenchmarkProvider Session Initiated");
-        consumerRegistry = session.getSALService(RpcConsumerRegistry.class);
-        providerRegistry = session.getSALService(RpcProviderRegistry.class);
-
-        // Register the benchmark Global RPC
-        session.addRpcImplementation(RpcbenchPayloadService.class, gServer);
-        // Register RPC Benchmark's control REST API
-        session.addRpcImplementation(RpcbenchmarkService.class, this);
+    public RpcbenchmarkProvider(final RpcProviderRegistry providerRegistry, final GlobalBindingRTCServer globalServer) {
+        this.providerRegistry = providerRegistry;
+        this.globalServer = globalServer;
+    }
+
+    public void init() {
+        LOG.info("RpcbenchmarkProvider initiated");
     }
 
     @Override
-    public void close() throws Exception {
-        LOG.debug("RpcbenchmarkProvider Closed");
+    public void close() {
+        LOG.info("RpcbenchmarkProvider closed");
     }
 
     @Override
@@ -90,11 +83,11 @@ public class RpcbenchmarkProvider implements BindingAwareProvider, AutoCloseable
                 rpcRegs.add(routedReg);
             }
 
-            client = new RoutedBindingRTClient(consumerRegistry, input.getPayloadSize().intValue(), routeIid);
+            client = new RoutedBindingRTClient(providerRegistry, input.getPayloadSize().intValue(), routeIid);
             break;
 
         case GLOBALRTC:
-            client = new GlobalBindingRTCClient(consumerRegistry, input.getPayloadSize().intValue());
+            client = new GlobalBindingRTCClient(providerRegistry, input.getPayloadSize().intValue());
             break;
 
         default:
@@ -118,7 +111,7 @@ public class RpcbenchmarkProvider implements BindingAwareProvider, AutoCloseable
             try {
                 executor.awaitTermination(testTimeout, TimeUnit.MINUTES);
             } catch (final InterruptedException e) {
-                LOG.error("Out of time: test did not finish within the {} min deadline ", testTimeout); 
+                LOG.error("Out of time: test did not finish within the {} min deadline ", testTimeout);
             }
 
             long endTime = System.nanoTime();
@@ -131,7 +124,7 @@ public class RpcbenchmarkProvider implements BindingAwareProvider, AutoCloseable
                                             .setGlobalRtcClientError(client.getRpcError())
                                             .setGlobalRtcClientOk(client.getRpcOk())
                                             .setExecTime(TimeUnit.NANOSECONDS.toMillis(elapsedTime))
-                                            .setRate(((client.getRpcOk() + client.getRpcError()) * 1000000000) / elapsedTime)
+                                            .setRate((client.getRpcOk() + client.getRpcError()) * 1000000000 / elapsedTime)
                                             .build();
             return RpcResultBuilder.success(output).buildFuture();
         } finally {
@@ -145,7 +138,7 @@ public class RpcbenchmarkProvider implements BindingAwareProvider, AutoCloseable
     public Future<RpcResult<TestStatusOutput>> testStatus() {
         LOG.info("testStatus");
         TestStatusOutput output = new TestStatusOutputBuilder()
-                                        .setGlobalServerCnt((long)gServer.getNumRpcs())
+                                        .setGlobalServerCnt((long)globalServer.getNumRpcs())
                                         .setExecStatus(execStatus.get())
                                         .build();
         return RpcResultBuilder.success(output).buildFuture();
diff --git a/benchmark/rpcbenchmark/src/main/resources/org/opendaylight/blueprint/rpcbenchmark.xml b/benchmark/rpcbenchmark/src/main/resources/org/opendaylight/blueprint/rpcbenchmark.xml
new file mode 100644 (file)
index 0000000..96611d3
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2017 Inocybe Technologies 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
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+           odl:use-default-for-reference-types="true">
+
+  <bean id="globalServer" class="rpcbenchmark.impl.GlobalBindingRTCServer"/>
+
+  <reference id="rpcRegistry" interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"/>
+
+  <bean id="provider" class="rpcbenchmark.impl.RpcbenchmarkProvider"
+          init-method="init" destroy-method="close">
+    <argument ref="rpcRegistry"/>
+    <argument ref="globalServer"/>
+  </bean>
+
+  <odl:rpc-implementation ref="globalServer"/>
+  <odl:rpc-implementation ref="provider"/>
+</blueprint>
diff --git a/benchmark/rpcbenchmark/src/main/yang/rpcbenchmark-impl.yang b/benchmark/rpcbenchmark/src/main/yang/rpcbenchmark-impl.yang
deleted file mode 100644 (file)
index b28de51..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-module rpcbenchmark-impl {
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:rpcbenchmark:impl";
-    prefix "rpcbenchmark-impl";
-
-    import config { prefix config; revision-date 2013-04-05; }
-    import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
-
-    description
-        "Service definition for rpcbenchmark project";
-
-    revision "2014-12-10" {
-        description
-            "Initial revision";
-    }
-
-    identity rpcbenchmark {
-        base config:module-type;
-        config:java-name-prefix Rpcbenchmark;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case rpcbenchmark {
-            when "/config:modules/config:module/config:type = 'rpcbenchmark'";
-            container broker {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity md-sal-binding:binding-broker-osgi-registry;
-                    }
-                }
-            }
-        }
-    }
-}
index 72e9812..6001a90 100644 (file)
@@ -73,13 +73,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
       <artifactId>rpcbenchmark</artifactId>
       <version>${project.version}</version>
     </dependency>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>rpcbenchmark</artifactId>
-      <version>${project.version}</version>
-      <type>xml</type>
-      <classifier>config</classifier>
-    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>benchmark-api</artifactId>
index b1a1a18..7e2b451 100644 (file)
@@ -32,6 +32,5 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
     <feature version='${project.version}'>odl-dsbenchmark</feature>
     <feature version='${project.version}'>odl-ntfbenchmark</feature>
     <bundle>mvn:org.opendaylight.controller/rpcbenchmark/{{VERSION}}</bundle>
-    <configfile finalname="rpcbenchmark-impl-default-config.xml">mvn:org.opendaylight.controller/rpcbenchmark/{{VERSION}}/xml/config</configfile>
   </feature>
 </features>
index ec73270..dc5be79 100644 (file)
             <artifactId>rpcbenchmark</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <!-- finalname="rpcbenchmark-impl-default-config.xml" -->
-            <groupId>${project.groupId}</groupId>
-            <artifactId>rpcbenchmark</artifactId>
-            <version>${project.version}</version>
-            <type>xml</type>
-            <classifier>config</classifier>
-        </dependency>
     </dependencies>
 </project>
diff --git a/features/benchmark/odl-mdsal-benchmark/src/main/feature/feature.xml b/features/benchmark/odl-mdsal-benchmark/src/main/feature/feature.xml
deleted file mode 100644 (file)
index f5f1e0a..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2016, 2017 Red Hat, Inc. and others.
-
- 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
- -->
-<features name="odl-dsbenchmark-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0">
-    <feature name="odl-mdsal-benchmark" version="${project.version}">
-        <configfile finalname="rpcbenchmark-impl-default-config.xml">
-            mvn:org.opendaylight.controller/rpcbenchmark/${project.version}/xml/config
-        </configfile>
-    </feature>
-</features>

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.