BUG-7028: Migrate BGP Benchmark App to BP wiring 91/48791/2
authorClaudio D. Gasparini <cgaspari@cisco.com>
Tue, 8 Nov 2016 08:12:09 +0000 (09:12 +0100)
committerClaudio D. Gasparini <cgaspari@cisco.com>
Thu, 1 Dec 2016 18:26:14 +0000 (19:26 +0100)
Migrate BGP Benchmark App to BP wiring

Change-Id: I5632a5ec3afde41862004e172e451fc358c53eab
Signed-off-by: Claudio D. Gasparini <cgaspari@cisco.com>
artifacts/pom.xml
bgp/benchmark-app/pom.xml
bgp/benchmark-app/src/main/java/org/opendaylight/controller/config/yang/odl_bgp_benchmark_cfg/AppPeerBenchmarkModule.java [deleted file]
bgp/benchmark-app/src/main/java/org/opendaylight/controller/config/yang/odl_bgp_benchmark_cfg/AppPeerBenchmarkModuleFactory.java [deleted file]
bgp/benchmark-app/src/main/resources/initial/bgp-app-peer-benchmark.xml [deleted file]
bgp/benchmark-app/src/main/resources/org/opendaylight/blueprint/bgp-app-peer-benchmark.xml [new file with mode: 0644]
bgp/benchmark-app/src/main/yang/odl-bgp-app-peer-benchmark-config.yang [new file with mode: 0644]
bgp/benchmark-app/src/main/yang/odl-bgp-benchmark-cfg.yang [deleted file]
bgp/benchmark-app/src/test/java/org/opendaylight/controller/config/yang/odl_bgp_benchmark_cfg/AppPeerBenchmarkModuleTest.java [deleted file]
features/bgp/pom.xml
features/bgp/src/main/features/features.xml

index afb0b74dd343ed2271ca6cd66ba05841465d4184..e3ec70e70da669911b5251d147facc66c9fc0cdb 100644 (file)
                 <artifactId>bgp-benchmark-app</artifactId>
                 <version>${project.version}</version>
             </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>bgp-benchmark-app</artifactId>
-                <version>${project.version}</version>
-                <type>xml</type>
-                <classifier>app-peer-benchmark-config</classifier>
-            </dependency>
 
             <dependency>
                 <groupId>${project.groupId}</groupId>
index 4239373acaf1c786740d121eda0e0fd7ee83fdd9..a1537afd2a1e45a05b704c69ac617855ffa38089 100644 (file)
         </dependency>
     </dependencies>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>build-helper-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>attach-artifacts</id>
-                        <goals>
-                            <goal>attach-artifact</goal>
-                        </goals>
-                        <phase>package</phase>
-                        <configuration>
-                            <artifacts>
-                                <artifact>
-                                    <file>${project.build.directory}/classes/initial/bgp-app-peer-benchmark.xml</file>
-                                    <type>xml</type>
-                                    <classifier>app-peer-benchmark-config</classifier>
-                                </artifact>
-                            </artifacts>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
     <scm>
         <connection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</connection>
         <developerConnection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</developerConnection>
diff --git a/bgp/benchmark-app/src/main/java/org/opendaylight/controller/config/yang/odl_bgp_benchmark_cfg/AppPeerBenchmarkModule.java b/bgp/benchmark-app/src/main/java/org/opendaylight/controller/config/yang/odl_bgp_benchmark_cfg/AppPeerBenchmarkModule.java
deleted file mode 100644 (file)
index 00892fd..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2016 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.controller.config.yang.odl_bgp_benchmark_cfg;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.protocol.bgp.benchmark.app.AppPeerBenchmark;
-
-public class AppPeerBenchmarkModule extends AbstractAppPeerBenchmarkModule {
-    public AppPeerBenchmarkModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public AppPeerBenchmarkModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver, final AppPeerBenchmarkModule oldModule, final java.lang.AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void customValidation() {
-        JmxAttributeValidationException.checkNotNull(getAppRibId(), "value is not set.", appRibIdJmxAttribute);
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        return new AppPeerBenchmark(getBindingDataBrokerDependency(), getRpcRegistryDependency(), getAppRibId());
-    }
-
-}
diff --git a/bgp/benchmark-app/src/main/java/org/opendaylight/controller/config/yang/odl_bgp_benchmark_cfg/AppPeerBenchmarkModuleFactory.java b/bgp/benchmark-app/src/main/java/org/opendaylight/controller/config/yang/odl_bgp_benchmark_cfg/AppPeerBenchmarkModuleFactory.java
deleted file mode 100644 (file)
index e4d5d40..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 2016 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.controller.config.yang.odl_bgp_benchmark_cfg;
-
-public class AppPeerBenchmarkModuleFactory extends org.opendaylight.controller.config.yang.odl_bgp_benchmark_cfg.AbstractAppPeerBenchmarkModuleFactory {
-
-}
diff --git a/bgp/benchmark-app/src/main/resources/initial/bgp-app-peer-benchmark.xml b/bgp/benchmark-app/src/main/resources/initial/bgp-app-peer-benchmark.xml
deleted file mode 100644 (file)
index 3eb8bc5..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
-Copyright (c) 2016 Cisco System 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:controller:odl-bgp-benchmark-cfg?module=odl-bgp-benchmark-cfg&amp;revision=2016-03-09</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:controller:odl-bgp-benchmark-cfg">prefix:app-peer-benchmark</type>
-          <name>bgp-app-peer-benchmark</name>
-          <rpc-registry>
-            <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
-            <name>binding-rpc-broker</name>
-          </rpc-registry>
-          <binding-data-broker>
-            <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
-            <name>pingpong-binding-data-broker</name>
-          </binding-data-broker>
-        </module>
-      </modules>
-    </data>
-  </configuration>
-</snapshot>
\ No newline at end of file
diff --git a/bgp/benchmark-app/src/main/resources/org/opendaylight/blueprint/bgp-app-peer-benchmark.xml b/bgp/benchmark-app/src/main/resources/org/opendaylight/blueprint/bgp-app-peer-benchmark.xml
new file mode 100644 (file)
index 0000000..43551b5
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright (c) 2016 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
+  -->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
+    <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" odl:type="pingpong"/>
+    <reference id="rpcRegistry" interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"/>
+
+    <odl:clustered-app-config id="bgpBenchmarkConfig"
+        binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.config.rev161129.Config"/>
+
+    <bean id="bgpBenchmark" class="org.opendaylight.protocol.bgp.benchmark.app.AppPeerBenchmark"
+          destroy-method="close">
+        <argument ref="dataBroker"/>
+        <argument ref="rpcRegistry"/>
+        <argument>
+            <bean factory-ref="bgpBenchmarkConfig" factory-method="getAppPeerId"/>
+        </argument>
+    </bean>
+</blueprint>
\ No newline at end of file
diff --git a/bgp/benchmark-app/src/main/yang/odl-bgp-app-peer-benchmark-config.yang b/bgp/benchmark-app/src/main/yang/odl-bgp-app-peer-benchmark-config.yang
new file mode 100644 (file)
index 0000000..493d489
--- /dev/null
@@ -0,0 +1,28 @@
+module odl-bgp-app-peer-benchmark-config {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark-config";
+    prefix bgp-benchmark-app-config;
+
+    description
+        "This module contains the base YANG definitions for
+         BGP Peer Acceptor Configuration.
+         Copyright (c)2016 Cisco Systems, Inc. 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";
+
+    revision "2016-11-29" {
+        description
+            "Initial revision.";
+    }
+
+    container config {
+        leaf app-peer-id {
+            type string;
+            default "192.0.2.6";
+            mandatory true;
+        }
+    }
+}
\ No newline at end of file
diff --git a/bgp/benchmark-app/src/main/yang/odl-bgp-benchmark-cfg.yang b/bgp/benchmark-app/src/main/yang/odl-bgp-benchmark-cfg.yang
deleted file mode 100644 (file)
index ae945d8..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-// Contents of "odl-bgp-benchmark-cfg"
-module odl-bgp-benchmark-cfg {
-    namespace "urn:opendaylight:params:xml:ns:yang:controller:odl-bgp-benchmark-cfg";
-    prefix "bgp-bm-cfg";
-
-    import config { prefix config; revision-date 2013-04-05; }
-    import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
-
-    organization "Cisco Systems, Inc.";
-    contact "Milos Fabian <milfabia@cisco.com>";
-
-    description
-        "This module contains Configuration Yang Data Model for BGP Benchmark application.
-
-        Copyright (c)2016 Cisco Systems, Inc. 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";
-
-    revision 2016-03-09 {
-        description "Initial revision";
-    }
-
-    identity app-peer-benchmark {
-        base config:module-type;
-        config:java-name-prefix AppPeerBenchmark;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case app-peer-benchmark {
-            when "/config:modules/config:module/config:type = 'app-peer-benchmark'";
-
-            container rpc-registry {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity mdsal:binding-rpc-registry;
-                    }
-                }
-            }
-
-            container binding-data-broker {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity mdsal:binding-async-data-broker;
-                    }
-                }
-            }
-
-            leaf app-rib-id {
-                type string;
-                default "example-app-rib";
-            }
-
-        }
-    }
-
-}
\ No newline at end of file
diff --git a/bgp/benchmark-app/src/test/java/org/opendaylight/controller/config/yang/odl_bgp_benchmark_cfg/AppPeerBenchmarkModuleTest.java b/bgp/benchmark-app/src/test/java/org/opendaylight/controller/config/yang/odl_bgp_benchmark_cfg/AppPeerBenchmarkModuleTest.java
deleted file mode 100644 (file)
index 988d707..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2016 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.controller.config.yang.odl_bgp_benchmark_cfg;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Matchers;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.JmxAttribute;
-import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTest;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.protocol.bgp.benchmark.app.AppPeerBenchmark;
-import org.osgi.framework.BundleContext;
-
-public class AppPeerBenchmarkModuleTest extends AbstractDataBrokerTest {
-
-    private static final String INSTANCE_NAME = "instance";
-
-    @Mock
-    private DependencyResolver dependencyResolver;
-    @Mock
-    private BundleContext bundleContextON;
-    @Mock
-    private ObjectName bindingDataBrokerON;
-    @Mock
-    private ObjectName rpcRegistryON;
-    @Mock
-    private RpcProviderRegistry rpcRegistry;
-
-    @Before
-    public void setUp() throws MalformedObjectNameException {
-        MockitoAnnotations.initMocks(this);
-        Mockito.doReturn(this.rpcRegistry).when(this.dependencyResolver).resolveInstance(Matchers.eq(RpcProviderRegistry.class), Mockito.any(ObjectName.class), Mockito.any(JmxAttribute.class));
-        Mockito.doReturn(getDataBroker()).when(this.dependencyResolver).resolveInstance(Matchers.eq(DataBroker.class), Mockito.any(ObjectName.class), Mockito.any(JmxAttribute.class));
-    }
-
-    @Test
-    public void testCreateInstance() {
-        final AppPeerBenchmarkModule module = (AppPeerBenchmarkModule) new AppPeerBenchmarkModuleFactory().createModule(INSTANCE_NAME,
-                this.dependencyResolver, this.bundleContextON);
-        module.setAppRibId("appRib");
-        module.setBindingDataBroker(this.bindingDataBrokerON);
-        module.setRpcRegistry(this.rpcRegistryON);
-        module.resolveDependencies();
-        module.customValidation();
-        final AutoCloseable instance = module.createInstance();
-        Assert.assertTrue(instance instanceof AppPeerBenchmark);
-    }
-
-    @Test(expected=JmxAttributeValidationException.class)
-    public void testCustomValidation() {
-        final AppPeerBenchmarkModule module = (AppPeerBenchmarkModule) new AppPeerBenchmarkModuleFactory().createModule(INSTANCE_NAME,
-                this.dependencyResolver, this.bundleContextON);
-        module.setAppRibId(null);
-        module.customValidation();
-    }
-
-}
index 35bd6faf5bd75e038ada678af827e5d372301f3f..22026eebf7a9b93927578393b10910e4ff6fca1e 100644 (file)
           <type>xml</type>
           <classifier>network-topology-initial-config</classifier>
       </dependency>
-      <dependency>
-          <groupId>${project.groupId}</groupId>
-          <artifactId>bgp-benchmark-app</artifactId>
-          <type>xml</type>
-          <classifier>app-peer-benchmark-config</classifier>
-      </dependency>
       <dependency>
           <groupId>${project.groupId}</groupId>
           <artifactId>data-change-counter-controller-config</artifactId>
index 27865c22f1b6f414bfc7dc9e28c90dfdc9da7b67..c28bc9bbc7917684bd1ecf1f45575964ae06e9ce 100644 (file)
         <feature version='${project.version}'>odl-bgpcep-bgp-inet</feature>
         <feature version='${mdsal.version}'>odl-mdsal-broker</feature>
         <bundle>mvn:org.opendaylight.bgpcep/bgp-benchmark-app/{{VERSION}}</bundle>
-        <configfile finalname="etc/opendaylight/karaf/bgp-app-peer-benchmark.xml">mvn:org.opendaylight.bgpcep/bgp-benchmark-app/{{VERSION}}/xml/app-peer-benchmark-config</configfile>
     </feature>
+
     <feature name='odl-bgpcep-bgp-cli' version='${project.version}'>
         <feature version='${project.version}'>odl-bgpcep-bgp-rib-impl</feature>
         <bundle>mvn:org.opendaylight.bgpcep/bgp-cli/{{VERSION}}</bundle>