--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications 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.api.openflow;
+
+import java.util.List;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.md.sal.binding.api.NotificationService;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfig;
+
+/**
+ * Factory for creating OpenFlowPluginProvider instances.
+ *
+ * @author Thomas Pantelis
+ */
+public interface OpenFlowPluginProviderFactory {
+ OpenFlowPluginProvider newInstance(OpenflowProviderConfig providerConfig, DataBroker dataBroker,
+ RpcProviderRegistry rpcRegistry, NotificationService notificationService,
+ NotificationPublishService notificationPublishService,
+ EntityOwnershipService entityOwnershipService,
+ List<SwitchConnectionProvider> switchConnectionProviders);
+}
--- /dev/null
+module openflow-provider-config {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:openflow:provider:config";
+ prefix "openflow-provider-config";
+
+ description
+ "Configuration for an Openflow provider.";
+
+ revision "2016-05-10" {
+ description
+ "Initial revision";
+ }
+
+ typedef non-zero-uint32-type {
+ type uint32 {
+ range "1..max";
+ }
+ }
+
+ typedef non-zero-uint16-type {
+ type uint16 {
+ range "1..max";
+ }
+ }
+
+ container openflow-provider-config {
+ leaf rpc-requests-quota {
+ type uint32;
+ default 20000;
+ }
+
+ leaf switch-features-mandatory {
+ type boolean;
+ default false;
+ }
+
+ leaf global-notification-quota {
+ type uint32;
+ default 64000;
+ }
+
+ leaf is-statistics-polling-off {
+ type boolean;
+ default "false";
+ }
+
+ leaf is-statistics-rpc-enabled {
+ description "Deprecated - exposing backward compatible statistics rpcs providing result in form of async notification";
+ type boolean;
+ default "false";
+ }
+
+ leaf barrier-interval-timeout-limit {
+ type non-zero-uint32-type;
+ default 500;
+ }
+
+ leaf barrier-count-limit {
+ type non-zero-uint16-type;
+ default 25600;
+ }
+
+ leaf echo-reply-timeout {
+ type non-zero-uint32-type;
+ default 2000;
+ }
+ }
+}
\ No newline at end of file
identity openflow-provider{
base config:service-type;
config:java-class "org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider";
+ config:disable-osgi-service-registration;
+ status deprecated;
}
}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opendaylight.openflowplugin</groupId>
+ <artifactId>openflowplugin-parent</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+
+ <artifactId>openflowplugin-blueprint-config</artifactId>
+ <description>Blueprint configuration for the openflowplugin</description>
+ <packaging>bundle</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <DynamicImport-Package>*</DynamicImport-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+
+ <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"/>
+ <reference id="notificationService" interface="org.opendaylight.controller.md.sal.binding.api.NotificationService"/>
+ <reference id="notificationPublishService" interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"/>
+ <reference id="entityOwnershipService" interface="org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService"/>
+
+ <reference id="switchConnProviderFactory"
+ interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderFactory"/>
+
+ <!-- Create OF switch connection provider on port 6633 -->
+ <odl:clustered-app-config id="defaultSwitchConnConfig"
+ binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow._switch.connection.config.rev160506.SwitchConnectionConfig"
+ list-key-value="openflow-switch-connection-provider-default-impl">
+ <odl:default-config><![CDATA[
+ <switch-connection-config xmlns="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:config">
+ <instance-name>openflow-switch-connection-provider-default-impl</instance-name>
+ <port>6633</port>
+ <transport-protocol>TCP</transport-protocol>
+ </switch-connection-config>
+ ]]></odl:default-config>
+ </odl:clustered-app-config>
+
+ <bean id="defaultSwitchConnProvider" factory-ref="switchConnProviderFactory" factory-method="newInstance">
+ <argument ref="defaultSwitchConnConfig"/>
+ </bean>
+
+ <service ref="defaultSwitchConnProvider" interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider"
+ odl:type="openflow-switch-connection-provider-default-impl"/>
+
+ <!-- Create OF switch connection provider on port 6653 -->
+ <odl:clustered-app-config id="legacySwitchConnConfig"
+ binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow._switch.connection.config.rev160506.SwitchConnectionConfig"
+ list-key-value="openflow-switch-connection-provider-legacy-impl">
+ <odl:default-config><![CDATA[
+ <switch-connection-config xmlns="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:config">
+ <instance-name>openflow-switch-connection-provider-legacy-impl</instance-name>
+ <port>6653</port>
+ <transport-protocol>TCP</transport-protocol>
+ </switch-connection-config>
+ ]]></odl:default-config>
+ </odl:clustered-app-config>
+
+ <bean id="legacySwitchConnProvider" factory-ref="switchConnProviderFactory" factory-method="newInstance">
+ <argument ref="legacySwitchConnConfig"/>
+ </bean>
+
+ <service ref="legacySwitchConnProvider" interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider"
+ odl:type="openflow-switch-connection-provider-legacy-impl"/>
+
+ <!-- Create OpenflowPluginProvider instance -->
+
+ <odl:clustered-app-config id="openflowProviderConfig"
+ binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfig"/>
+
+ <reference id="openflowPluginProviderFactory"
+ interface="org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProviderFactory"/>
+
+ <bean id="openflowPluginProvider" factory-ref="openflowPluginProviderFactory" factory-method="newInstance">
+ <argument ref="openflowProviderConfig"/>
+ <argument ref="dataBroker"/>
+ <argument ref="rpcRegistry"/>
+ <argument ref="notificationService"/>
+ <argument ref="notificationPublishService"/>
+ <argument ref="entityOwnershipService"/>
+ <argument>
+ <list>
+ <ref component-id="defaultSwitchConnProvider"/>
+ <ref component-id="legacySwitchConnProvider"/>
+ </list>
+ </argument>
+ </bean>
+
+ <service ref="openflowPluginProvider" odl:type="openflow-plugin-provider-impl">
+ <interfaces>
+ <value>org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider</value>
+ <value>org.opendaylight.openflowplugin.extension.api.OpenFlowPluginExtensionRegistratorProvider</value>
+ </interfaces>
+ </service>
+
+</blueprint>
\ No newline at end of file
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
+
+NOTE: This file is deprecated as wiring is now done via blueprint. This file is kept for
+ backwards compatibility. Runtime modifications are not honored.
-->
<snapshot>
<required-capabilities>
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications 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.impl;
+
+import java.util.List;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.md.sal.binding.api.NotificationService;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
+import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
+import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProviderFactory;
+import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation of OpenFlowPluginProviderFactory.
+ *
+ * @author Thomas Pantelis
+ */
+public class OpenFlowPluginProviderFactoryImpl implements OpenFlowPluginProviderFactory {
+ private static final Logger LOG = LoggerFactory.getLogger(OpenFlowPluginProviderFactoryImpl.class);
+
+ @Override
+ public OpenFlowPluginProvider newInstance(OpenflowProviderConfig providerConfig, DataBroker dataBroker,
+ RpcProviderRegistry rpcRegistry, NotificationService notificationService,
+ NotificationPublishService notificationPublishService,
+ EntityOwnershipService entityOwnershipService,
+ List<SwitchConnectionProvider> switchConnectionProviders) {
+
+ LOG.info("Initializing new OFP southbound.");
+
+ OpenflowPortsUtil.init();
+ OpenFlowPluginProvider openflowPluginProvider = new OpenFlowPluginProviderImpl(providerConfig.getRpcRequestsQuota(),
+ providerConfig.getGlobalNotificationQuota());
+
+ openflowPluginProvider.setSwitchConnectionProviders(switchConnectionProviders);
+ openflowPluginProvider.setDataBroker(dataBroker);
+ openflowPluginProvider.setRpcProviderRegistry(rpcRegistry);
+ openflowPluginProvider.setNotificationProviderService(notificationService);
+ openflowPluginProvider.setNotificationPublishService(notificationPublishService);
+ openflowPluginProvider.setEntityOwnershipService(entityOwnershipService);
+ openflowPluginProvider.setSwitchFeaturesMandatory(providerConfig.isSwitchFeaturesMandatory());
+ openflowPluginProvider.setIsStatisticsPollingOff(providerConfig.isIsStatisticsPollingOff());
+ openflowPluginProvider.setIsStatisticsRpcEnabled(providerConfig.isIsStatisticsRpcEnabled());
+ openflowPluginProvider.setBarrierCountLimit(providerConfig.getBarrierCountLimit().getValue());
+ openflowPluginProvider.setBarrierInterval(providerConfig.getBarrierIntervalTimeoutLimit().getValue());
+ openflowPluginProvider.setEchoReplyTimeout(providerConfig.getEchoReplyTimeout().getValue());
+
+ openflowPluginProvider.initialize();
+
+ LOG.info("Configured values, StatisticsPollingOff:{}, SwitchFeaturesMandatory:{}, BarrierCountLimit:{}, BarrierTimeoutLimit:{}, EchoReplyTimeout:{}",
+ providerConfig.isIsStatisticsPollingOff(), providerConfig.isSwitchFeaturesMandatory(),
+ providerConfig.getBarrierCountLimit().getValue(),
+ providerConfig.getBarrierIntervalTimeoutLimit().getValue(), providerConfig.getEchoReplyTimeout().getValue());
+
+ return openflowPluginProvider;
+ }
+}
package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.config.openflow.plugin.impl.rev150327;
+import com.google.common.reflect.AbstractInvocationHandler;
+import com.google.common.reflect.Reflection;
+import java.lang.reflect.Method;
+import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
-import org.opendaylight.openflowplugin.impl.OpenFlowPluginProviderImpl;
-import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.opendaylight.openflowplugin.extension.api.OpenFlowPluginExtensionRegistratorProvider;
+import org.osgi.framework.BundleContext;
-public class OpenFlowProviderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.config.openflow.plugin.impl.rev150327.AbstractOpenFlowProviderModule {
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class OpenFlowProviderModule extends AbstractOpenFlowProviderModule {
- private static final Logger LOG = LoggerFactory.getLogger(OpenFlowProviderModule.class);
+ private BundleContext bundleContext;
public OpenFlowProviderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
@Override
- public void customValidation() {
- // add custom validation form module attributes here.
+ public AutoCloseable createInstance() {
+ // The service is provided via blueprint so wait for and return it here for backwards compatibility.
+ String typeFilter = String.format("(type=%s)", getIdentifier().getInstanceName());
+ final WaitingServiceTracker<OpenFlowPluginProvider> tracker = WaitingServiceTracker.create(
+ OpenFlowPluginProvider.class, bundleContext, typeFilter);
+ final OpenFlowPluginProvider openflowPluginProvider = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
+
+ // We don't want to call close on the actual service as its life cycle is controlled by blueprint but
+ // we do want to close the tracker so create a proxy to override close appropriately.
+ return Reflection.newProxy(OpenFlowPluginProviderProxyInterface.class, new AbstractInvocationHandler() {
+ @Override
+ protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
+ if (method.getName().equals("close")) {
+ tracker.close();
+ return null;
+ } else {
+ return method.invoke(openflowPluginProvider, args);
+ }
+ }
+ });
+ }
+
+ public void setBundleContext(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
}
@Override
- public java.lang.AutoCloseable createInstance() {
- LOG.info("Initializing new OFP southbound.");
- OpenflowPortsUtil.init();
- final OpenFlowPluginProvider openflowPluginProvider = new OpenFlowPluginProviderImpl(getRpcRequestsQuota(), getGlobalNotificationQuota());
-
- openflowPluginProvider.setSwitchConnectionProviders(getOpenflowSwitchConnectionProviderDependency());
- openflowPluginProvider.setDataBroker(getDataBrokerDependency());
- openflowPluginProvider.setRpcProviderRegistry(getRpcRegistryDependency());
- openflowPluginProvider.setNotificationProviderService(getNotificationAdapterDependency());
- openflowPluginProvider.setNotificationPublishService(getNotificationPublishAdapterDependency());
- openflowPluginProvider.setSwitchFeaturesMandatory(getSwitchFeaturesMandatory());
- openflowPluginProvider.setIsStatisticsPollingOff(getIsStatisticsPollingOff());
- openflowPluginProvider.setEntityOwnershipService(getEntityOwnershipServiceDependency());
- openflowPluginProvider.setIsStatisticsRpcEnabled(getIsStatisticsRpcEnabled());
- openflowPluginProvider.setBarrierCountLimit(getBarrierCountLimit().getValue());
- openflowPluginProvider.setBarrierInterval(getBarrierIntervalTimeoutLimit().getValue());
- openflowPluginProvider.setEchoReplyTimeout(getEchoReplyTimeout().getValue());
-
- openflowPluginProvider.initialize();
-
- LOG.info("Configured values, StatisticsPollingOff:{}, SwitchFeaturesMandatory:{}, BarrierCountLimit:{}, BarrierTimeoutLimit:{}, EchoReplyTimeout:{}",
- getIsStatisticsPollingOff(), getSwitchFeaturesMandatory(), getBarrierCountLimit().getValue(),
- getBarrierIntervalTimeoutLimit().getValue(), getEchoReplyTimeout().getValue());
-
-
- return openflowPluginProvider;
+ public boolean canReuseInstance(AbstractOpenFlowProviderModule oldModule) {
+ return true;
}
+ private static interface OpenFlowPluginProviderProxyInterface extends OpenFlowPluginProvider,
+ OpenFlowPluginExtensionRegistratorProvider {
+ }
}
* 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.plugin.impl.rev150327;
-public class OpenFlowProviderModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.config.openflow.plugin.impl.rev150327.AbstractOpenFlowProviderModuleFactory {
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class OpenFlowProviderModuleFactory extends AbstractOpenFlowProviderModuleFactory {
+ @Override
+ public OpenFlowProviderModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+ OpenFlowProviderModule oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
+ OpenFlowProviderModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
+ oldInstance, bundleContext);
+ module.setBundleContext(bundleContext);
+ return module;
+ }
+
+ @Override
+ public OpenFlowProviderModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+ BundleContext bundleContext) {
+ OpenFlowProviderModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
+ module.setBundleContext(bundleContext);
+ return module;
+ }
}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
+
+ <bean id="ofPluginProviderFactory" class="org.opendaylight.openflowplugin.impl.OpenFlowPluginProviderFactoryImpl"/>
+
+ <service ref="ofPluginProviderFactory" interface="org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProviderFactory"
+ odl:type="default"/>
+</blueprint>
\ No newline at end of file
<module>distribution/karaf</module>
<module>openflowplugin-controller-config</module>
<module>openflowplugin-blueprint-config-he</module>
+ <module>openflowplugin-blueprint-config</module>
<!--
<module>openflowplugin-it</module>
-->