<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-binding-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.openflowplugin.model</groupId>
<artifactId>model-flow-service</artifactId>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-api</artifactId>
+ </dependency>
</dependencies>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>${maven.bundle.version}</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Activator>org.opendaylight.openflowplugin.droptestkaraf.DropTestActivator</Bundle-Activator>
- <Embed-Dependency>commons-lang</Embed-Dependency>
- <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
- <Import-Package>
- org.apache.felix.service.command,
- org.apache.felix.gogo.commands,
- org.apache.karaf.shell.console,
- *
- </Import-Package>
- </instructions>
- </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>
+ org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ </codeGeneratorClass>
+ <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
+ <additionalConfiguration>
+ <namespaceToPackage1>
+ urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang
+ </namespaceToPackage1>
+ </additionalConfiguration>
+ </generator>
+ <generator>
+ <codeGeneratorClass>
+ org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl
+ </codeGeneratorClass>
+ <outputBaseDir>${project.build.directory}/generated-sources/sal</outputBaseDir>
+ </generator>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.yangtools.yang.unified.doc.generator.maven.DocumentationGeneratorImpl</codeGeneratorClass>
+ <outputBaseDir>${project.build.directory}/site/models</outputBaseDir>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>true</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>yang-jmx-generator-plugin</artifactId>
+ <version>${config.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>maven-sal-api-gen-plugin</artifactId>
+ <version>${yangtools.version}</version>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <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/69-drop-test.xml</file>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
</plugins>
</build>
package org.opendaylight.openflowplugin.droptestkaraf;
-import org.opendaylight.openflowplugin.testcommon.DropTestDsProvider;
-
import java.io.PrintStream;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.openflowplugin.testcommon.DropTestDsProvider;
import org.opendaylight.openflowplugin.testcommon.DropTestRpcProvider;
@Command(scope = "drop-test", name = "clearDropStats", description = "Clear drop statistics.")
@Override
protected Object doExecute() throws Exception {
PrintStream out = session.getConsole();
- final DropTestRpcProvider rpcProvider = DropTestActivator.getDropRpcProvider();
- final DropTestDsProvider provider = DropTestActivator.getDropDsProvider();
+ final DropTestRpcProvider rpcProvider = DropTestProviderImpl.getDropRpcProvider();
+ final DropTestDsProvider provider = DropTestProviderImpl.getDropDsProvider();
out.println("Clearing drop statistics... ");
rpcProvider.clearStats();
@Override
protected Object doExecute() throws Exception {
PrintStream out = session.getConsole();
- final DropTestDsProvider provider = DropTestActivator.getDropDsProvider();
+ final DropTestDsProvider provider = DropTestProviderImpl.getDropDsProvider();
if ("on".equalsIgnoreCase(targetStateArg)) {
if (! provider.isActive()) {
@Override
protected Object doExecute() throws Exception {
PrintStream out = session.getConsole();
- final DropTestRpcProvider provider = DropTestActivator.getDropRpcProvider();
+ final DropTestRpcProvider provider = DropTestProviderImpl.getDropRpcProvider();
if ("on".equalsIgnoreCase(targetStateArg)) {
if (! provider.isActive()) {
+++ /dev/null
-/**
- * Copyright (c) 2013 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.openflowplugin.droptestkaraf;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
-import org.opendaylight.openflowplugin.testcommon.DropTestDsProvider;
-import org.opendaylight.openflowplugin.testcommon.DropTestRpcProvider;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("all")
-public class DropTestActivator extends AbstractBindingAwareProvider {
- private static Logger LOG = LoggerFactory.getLogger(DropTestActivator.class);
-
- private static DropTestDsProvider dropDsProvider = new DropTestDsProvider();
-
- private static DropTestRpcProvider dropRpcProvider = new DropTestRpcProvider();
-
- public void onSessionInitiated(final ProviderContext session) {
- LOG.debug("Activator DropAllPack INIT");
-
- dropDsProvider.setDataService(session.<DataBroker>getSALService(DataBroker.class));
- dropDsProvider.setNotificationService(session.<NotificationProviderService>getSALService(NotificationProviderService.class));
-
- dropRpcProvider.setNotificationService(session.<NotificationProviderService>getSALService(NotificationProviderService.class));
- dropRpcProvider.setFlowService(session.<SalFlowService>getRpcService(SalFlowService.class));
-
- LOG.debug("Activator DropAllPack END");
- }
-
- public void startImpl(final BundleContext ctx) {
- super.startImpl(ctx);
- LOG.debug("------------------------------------- DROP ALL PACK TEST INITIATED ------------------------ ");
- }
-
- protected void stopImpl(final BundleContext context) {
- LOG.debug("-------------------------------------- DROP ALL PACK TEST STOPPED --------------------------- ");
- dropDsProvider.close();
- dropRpcProvider.close();
- super.stopImpl(context);
- }
-
- /**
- * @return the dropDsProvider
- */
- public static DropTestDsProvider getDropDsProvider() {
- return dropDsProvider;
- }
-
- /**
- * @return the dropRpcProvider
- */
- public static DropTestRpcProvider getDropRpcProvider() {
- return dropRpcProvider;
- }
-}
--- /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.openflowplugin.droptestkaraf;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.openflowplugin.testcommon.DropTestDsProvider;
+import org.opendaylight.openflowplugin.testcommon.DropTestRpcProvider;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Created by Martin Bobak <mbobak@cisco.com> on 26.4.2015.
+ */
+public class DropTestProviderImpl implements AutoCloseable {
+
+ private static Logger LOG = LoggerFactory.getLogger(DropTestProviderImpl.class);
+
+ private static DropTestDsProvider dropDsProvider = new DropTestDsProvider();
+
+ private static DropTestRpcProvider dropRpcProvider = new DropTestRpcProvider();
+
+ public DropTestProviderImpl(final DataBroker dataBroker,
+ final NotificationProviderService notificationProviderService,
+ final SalFlowService salFlowService) {
+ Preconditions.checkNotNull(dataBroker, "Data broker can't be empty");
+ Preconditions.checkNotNull(notificationProviderService, "NotificationProviderService can't be empty");
+ Preconditions.checkNotNull(salFlowService, "SalFlowService can't be empty");
+
+ LOG.debug("Activator DropAllPack INIT");
+
+ dropDsProvider.setDataService(dataBroker);
+ dropDsProvider.setNotificationService(notificationProviderService);
+
+ dropRpcProvider.setNotificationService(notificationProviderService);
+ dropRpcProvider.setFlowService(salFlowService);
+
+ LOG.debug("Activator DropAllPack END");
+ }
+
+ public static DropTestDsProvider getDropDsProvider() {
+ return dropDsProvider;
+ }
+
+ public static DropTestRpcProvider getDropRpcProvider() {
+ return dropRpcProvider;
+ }
+
+ @Override
+ public void close() throws Exception {
+ dropDsProvider.close();
+ dropRpcProvider.close();
+ }
+}
@Override
protected Object doExecute() throws Exception {
PrintStream out = session.getConsole();
- final DropTestRpcProvider rpcProvider = DropTestActivator.getDropRpcProvider();
- final DropTestDsProvider provider = DropTestActivator.getDropDsProvider();
+ final DropTestRpcProvider rpcProvider = DropTestProviderImpl.getDropRpcProvider();
+ final DropTestDsProvider provider = DropTestProviderImpl.getDropDsProvider();
out.format("RPC Test Statistics: %s%n", rpcProvider.getStats().toString());
out.format("FRM Test Statistics: %s%n", provider.getStats().toString());
--- /dev/null
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.config.openflow.test.droptest.rev150327;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.openflowplugin.droptestkaraf.DropTestProviderImpl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DropTestProviderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.config.openflow.test.droptest.rev150327.AbstractDropTestProviderModule {
+ private static final Logger LOG = LoggerFactory.getLogger(DropTestProviderModule.class);
+ public DropTestProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public DropTestProviderModule(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.config.openflow.test.droptest.rev150327.DropTestProviderModule 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() {
+ LOG.debug("Starting drop-test provider module.");
+ DataBroker dataBroker = getDataBrokerDependency();
+ NotificationProviderService notificationProviderService = getNotificationServiceDependency();
+ SalFlowService salFlowService = getRpcRegistryDependency().getRpcService(SalFlowService.class);
+ DropTestProviderImpl dropTestProvider = new DropTestProviderImpl(dataBroker, notificationProviderService, salFlowService);
+ LOG.info("Drop-test provider module initialized.");
+ return dropTestProvider;
+ }
+
+}
--- /dev/null
+/*
+* Generated file
+*
+* Generated from: yang module name: drop-test-provider yang module local name: drop-test-provider
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Sun Apr 26 11:04:30 CEST 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.config.openflow.test.droptest.rev150327;
+public class DropTestProviderModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.config.openflow.test.droptest.rev150327.AbstractDropTestProviderModuleFactory {
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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
+ -->
+
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+
+<snapshot>
+ <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:config:openflow:test:droptest">prefix:drop-test-provider</type>
+ <name>drop-test-provider</name>
+ <data-broker>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
+ <name>binding-data-broker</name>
+ </data-broker>
+ <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>
+ <notification-service>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-notification-service</type>
+ <name>binding-notification-broker</name>
+ </notification-service>
+ </module>
+ </modules>
+ </data>
+ </configuration>
+</snapshot>
\ No newline at end of file
--- /dev/null
+module drop-test-provider {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:config:openflow:test:droptest";
+ prefix "drop-test-provider";
+
+ import config {prefix config; revision-date 2013-04-05;}
+ import rpc-context { prefix rpcx; revision-date 2013-06-17; }
+ import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
+
+ description
+ "drop-test-provider";
+
+ revision "2015-03-27" {
+ description
+ "Drop test implementation.";
+ }
+
+ identity drop-test-provider {
+ base config:module-type;
+ config:java-name-prefix DropTestProvider;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case drop-test-provider {
+ when "/config:modules/config:module/config:type = 'drop-test-provider'";
+
+ container data-broker {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity md-sal-binding:binding-async-data-broker;
+ }
+ }
+ }
+ container rpc-registry {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity md-sal-binding:binding-rpc-registry;
+ }
+ }
+ }
+ container notification-service {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity md-sal-binding:binding-notification-service;
+ }
+ }
+ }
+ }
+ }
+}
<feature version="${project.version}">odl-openflowplugin-flow-services</feature>
<bundle>mvn:org.opendaylight.openflowplugin/test-common/${project.version}</bundle>
<bundle>mvn:org.opendaylight.openflowplugin/drop-test-karaf/${project.version}</bundle>
+ <configfile finalname="etc/opendaylight/karaf/69-drop-test.xml">mvn:org.opendaylight.openflowplugin/drop-test-karaf/${project.version}/xml/config</configfile>
</feature>
<!-- APPLICATIONS -->
<feature version="${project.version}">odl-openflowplugin-flow-services</feature>
<bundle>mvn:org.opendaylight.openflowplugin/test-common/${project.version}</bundle>
<bundle>mvn:org.opendaylight.openflowplugin/drop-test-karaf/${project.version}</bundle>
+ <configfile finalname="etc/opendaylight/karaf/69-drop-test.xml">mvn:org.opendaylight.openflowplugin/drop-test-karaf/${project.version}/xml/config</configfile>
</feature>
<!-- APPLICATIONS -->