-.idea/\r
-target/\r
-*.class\r
-*.iml\r
-**/target\r
-**/bin\r
-dist\r
-**/logs\r
-products\r
-repository\r
-workspace\r
-*~\r
-target\r
-.classpath\r
-.project\r
-.settings\r
-MANIFEST.MF\r
-xtend-gen\r
+.idea/
+target/
+*.class
+*.iml
+**/target
+**/bin
+dist
+**/logs
+products
+repository
+workspace
+*~
+target
+.classpath
+.project
+.settings
+MANIFEST.MF
+xtend-gen
yang-gen-sal
yang-gen-config
-.externalToolBuilders\r
-maven-eclipse.xml\r
+.externalToolBuilders
+maven-eclipse.xml
.metadata/
.checkstyle
+maven-metadata-local.xml
+*.pyc
+/.pydevproject
+*.log
+.tox/
package org.opendaylight.openflowplugin.applications.frsync.util;
+import com.google.common.base.Splitter;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
private static final NodeId NODE_ID = new NodeId("unit-node-id");
private InstanceIdentifier<Node> NODE_IDENT = InstanceIdentifier.create(Nodes.class)
.child(Node.class, new NodeKey(NODE_ID));
+ private static final Splitter COMMA_SPLITTER = Splitter.on(",");
@Rule
public ExpectedException thrown = ExpectedException.none();
private ItemSyncBox<String> createSyncBox(final String pushes, final String updates) {
ItemSyncBox<String> syncBox1 = new ItemSyncBox<>();
- syncBox1.getItemsToPush().addAll(Arrays.asList(pushes.split(",")));
- for (String orig : updates.split(",")) {
+ syncBox1.getItemsToPush().addAll(COMMA_SPLITTER.splitToList(pushes));
+ for (String orig : COMMA_SPLITTER.splitToList(updates)) {
syncBox1.getItemsToUpdate().add(new ItemSyncBox.ItemUpdateTuple<>(orig, orig + "_updated"));
}
return syncBox1;
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>
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class InventoryActivator implements BindingAwareProvider, AutoCloseable {
+public class InventoryActivator implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(InventoryActivator.class);
- private FlowCapableInventoryProvider provider;
- final private EntityOwnershipService eos;
-
- public InventoryActivator(EntityOwnershipService eos) {
- this.eos = eos;
- }
+ private final FlowCapableInventoryProvider provider;
- @Override
- public void onSessionInitiated(final ProviderContext session) {
- DataBroker dataBroker = session.getSALService(DataBroker.class);
- NotificationProviderService salNotifiService =
- session.getSALService(NotificationProviderService.class);
+ public InventoryActivator(DataBroker dataBroker, NotificationProviderService notificationService,
+ EntityOwnershipService eos) {
+ provider = new FlowCapableInventoryProvider(dataBroker, notificationService, eos);
+ }
- provider = new FlowCapableInventoryProvider(dataBroker, salNotifiService, eos);
+ public void start() {
provider.start();
}
@Override
- public void close() throws Exception {
- if (provider != null) {
- try {
- provider.close();
- } catch (InterruptedException e) {
- LOG.warn("Interrupted while waiting for shutdown", e);
- }
- provider = null;
+ public void close() {
+ try {
+ provider.close();
+ } catch (InterruptedException e) {
+ LOG.warn("Interrupted while waiting for shutdown", e);
}
}
}
package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.inventory.manager.impl.rev150530;
-import org.opendaylight.openflowplugin.applications.inventory.manager.InventoryActivator;
+import org.opendaylight.controller.sal.common.util.NoopAutoCloseable;
-public class InventoryManagerImplModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.inventory.manager.impl.rev150530.AbstractInventoryManagerImplModule {
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class InventoryManagerImplModule extends AbstractInventoryManagerImplModule {
public InventoryManagerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
}
@Override
- public void customValidation() {
- // add custom validation form module attributes here.
+ public AutoCloseable createInstance() {
+ // InventoryActivator instance is created via blueprint so this in a no-op.
+ return NoopAutoCloseable.INSTANCE;
}
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- InventoryActivator provider = new InventoryActivator(getEntityOwnershipServiceDependency());
- getBrokerDependency().registerProvider(provider);
- return provider;
- }
-
}
* 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.inventory.manager.impl.rev150530;
-public class InventoryManagerImplModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.inventory.manager.impl.rev150530.AbstractInventoryManagerImplModuleFactory {
+
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class InventoryManagerImplModuleFactory extends AbstractInventoryManagerImplModuleFactory {
}
identity inventory-manager-impl {
base config:module-type;
config:java-name-prefix InventoryManagerImpl;
+ status deprecated;
}
augment "/config:modules/config:module/config:configuration" {
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>
<configuration>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-binding-config</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-common-util</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.openflowplugin.model</groupId>
<artifactId>model-flow-base</artifactId>
package org.opendaylight.openflowplugin.applications.config.yang.statistics_manager;
-import org.opendaylight.openflowplugin.applications.statistics.manager.StatisticsManager;
-import org.opendaylight.openflowplugin.applications.statistics.manager.impl.StatisticsManagerConfig;
-import org.opendaylight.openflowplugin.applications.statistics.manager.impl.StatisticsManagerImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class StatisticsManagerModule extends org.opendaylight.openflowplugin.applications.config.yang.statistics_manager.AbstractStatisticsManagerModule {
-
- private static final Logger LOG = LoggerFactory.getLogger(StatisticsManagerModule.class);
-
- private static final int MAX_NODES_FOR_COLLECTOR_DEFAULT = 16;
- private static final int MIN_REQUEST_NET_MONITOR_INTERVAL_DEFAULT = 3000;
+import org.opendaylight.controller.sal.common.util.NoopAutoCloseable;
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class StatisticsManagerModule extends AbstractStatisticsManagerModule {
public StatisticsManagerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
}
@Override
- public void customValidation() {
- // add custom validation form module attributes here.
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- LOG.info("StatisticsManager module initialization.");
- final StatisticsManagerConfig config = createConfig();
- final StatisticsManager statisticsManagerProvider = new StatisticsManagerImpl(getDataBrokerDependency(), config);
- statisticsManagerProvider.setOwnershipService(getOwnershipServiceDependency());
- statisticsManagerProvider.start(getNotificationServiceDependency(), getRpcRegistryDependency());
-
- final StatisticsManager statisticsManagerProviderExposed = statisticsManagerProvider;
- LOG.info("StatisticsManager started successfully.");
- return new AutoCloseable() {
- @Override
- public void close() throws Exception {
- try {
- statisticsManagerProviderExposed.close();
- }
- catch (final Exception e) {
- LOG.error("Unexpected error by stopping StatisticsManager module", e);
- }
- LOG.info("StatisticsManager module stopped.");
- }
- };
- }
-
- private StatisticsManagerConfig createConfig() {
- final StatisticsManagerConfig.StatisticsManagerConfigBuilder builder = StatisticsManagerConfig.builder();
- if (getStatisticsManagerSettings() != null && getStatisticsManagerSettings().getMaxNodesForCollector() != null) {
- builder.setMaxNodesForCollector(getStatisticsManagerSettings().getMaxNodesForCollector());
- } else {
- LOG.warn("Load the xml ConfigSubsystem input value fail! MaxNodesForCollector value is set to {} ",
- MAX_NODES_FOR_COLLECTOR_DEFAULT);
- builder.setMaxNodesForCollector(MAX_NODES_FOR_COLLECTOR_DEFAULT);
- }
- if (getStatisticsManagerSettings() != null &&
- getStatisticsManagerSettings().getMinRequestNetMonitorInterval() != null) {
- builder.setMinRequestNetMonitorInterval(getStatisticsManagerSettings().getMinRequestNetMonitorInterval());
- } else {
- LOG.warn("Load the xml CofnigSubsystem input value fail! MinRequestNetMonitorInterval value is set to {} ",
- MIN_REQUEST_NET_MONITOR_INTERVAL_DEFAULT);
- builder.setMinRequestNetMonitorInterval(MIN_REQUEST_NET_MONITOR_INTERVAL_DEFAULT);
- }
- return builder.build();
+ public AutoCloseable createInstance() {
+ // StatisticsManager instance is created via blueprint so this in a no-op.
+ return NoopAutoCloseable.INSTANCE;
}
}
* Do not modify this file unless it is present under src/main directory
*/
package org.opendaylight.openflowplugin.applications.config.yang.statistics_manager;
-public class StatisticsManagerModuleFactory extends org.opendaylight.openflowplugin.applications.config.yang.statistics_manager.AbstractStatisticsManagerModuleFactory {
+
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class StatisticsManagerModuleFactory extends AbstractStatisticsManagerModuleFactory {
}
--- /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.applications.statistics.manager;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.statistics.manager.config.rev160509.StatisticsManagerAppConfig;
+
+/**
+ * Factory for creating StatisticsManager instances.
+ *
+ * @author Thomas Pantelis
+ */
+public interface StatisticsManagerFactory {
+ StatisticsManager newInstance(StatisticsManagerAppConfig statsManagerAppConfig, DataBroker dataBroker,
+ NotificationProviderService notifService, RpcConsumerRegistry rpcRegistry,
+ EntityOwnershipService entityOwnershipService);
+
+}
NodeIdentifierWithPredicates niWPredicates = (NodeIdentifierWithPredicates)yId.getLastPathArgument();
Map<QName, Object> keyValMap = niWPredicates.getKeyValues();
String nodeIdStr = (String)(keyValMap.get(ENTITY_NAME));
- BigInteger dpId = new BigInteger(nodeIdStr.split(":")[1]);
NodeId nodeId = new NodeId(nodeIdStr);
setNodeOwnership(nodeId, ownershipChange.isOwner());
}
--- /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.applications.statistics.manager.impl;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.openflowplugin.applications.statistics.manager.StatisticsManager;
+import org.opendaylight.openflowplugin.applications.statistics.manager.StatisticsManagerFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.statistics.manager.config.rev160509.StatisticsManagerAppConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation of StatisticsManagerFactory.
+ *
+ * @author Thomas Pantelis
+ */
+public class StatisticsManagerFactoryImpl implements StatisticsManagerFactory {
+ private static final Logger LOG = LoggerFactory.getLogger(StatisticsManagerFactoryImpl.class);
+
+ @Override
+ public StatisticsManager newInstance(StatisticsManagerAppConfig statsManagerAppConfig, DataBroker dataBroker,
+ NotificationProviderService notifService, RpcConsumerRegistry rpcRegistry,
+ EntityOwnershipService entityOwnershipService) {
+ LOG.info("StatisticsManager module initialization.");
+
+ StatisticsManagerConfig.StatisticsManagerConfigBuilder configBuilder = StatisticsManagerConfig.builder();
+ configBuilder.setMaxNodesForCollector(statsManagerAppConfig.getMaxNodesForCollector());
+ configBuilder.setMinRequestNetMonitorInterval(statsManagerAppConfig.getMinRequestNetMonitorInterval());
+
+ StatisticsManager statisticsManager = new StatisticsManagerImpl(dataBroker, configBuilder.build());
+ statisticsManager.setOwnershipService(entityOwnershipService);
+ statisticsManager.start(notifService, rpcRegistry);
+
+ LOG.info("StatisticsManager started successfully.");
+
+ return statisticsManager;
+ }
+}
--- /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="statsManagerFactory" class="org.opendaylight.openflowplugin.applications.statistics.manager.impl.StatisticsManagerFactoryImpl"/>
+
+ <service ref="statsManagerFactory" interface="org.opendaylight.openflowplugin.applications.statistics.manager.StatisticsManagerFactory"
+ odl:type="default"/>
+</blueprint>
\ No newline at end of file
--- /dev/null
+module statistics-manager-app-config {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:openflowplugin:app:statistics-manager:config";
+ prefix "statistics-manager-app-config";
+
+ description
+ "Configuration for Statistics Manager application.";
+
+ revision "2016-05-09" {
+ description
+ "Initial revision";
+ }
+
+ container statistics-manager-app-config {
+ leaf min-request-net-monitor-interval {
+ type int32;
+ default 3000;
+ }
+
+ leaf max-nodes-for-collector {
+ type int32;
+ default 16;
+ }
+ }
+}
\ No newline at end of file
identity statistics-manager {
base config:module-type;
config:java-name-prefix StatisticsManager;
+ status deprecated;
}
augment "/config:modules/config:module/config:configuration" {
*/
package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor;
+import com.google.common.base.Splitter;
+import com.google.common.collect.Lists;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import java.util.List;
+import java.util.ListIterator;
+
/**
* @author msunal
*
public final class IpConverter {
public static long Ipv4AddressToLong(Ipv4Address ipv4Address) {
- String ipAddress = ipv4Address.getValue();
- long result = 0;
- String[] atoms = ipAddress.split("\\.");
- for (int i = 3; i >= 0; i--) {
- result |= (Long.parseLong(atoms[3 - i]) << (i * 8));
+ long result = 0 ;
+ Iterable<String> splitted = Splitter.on('.')
+ .trimResults()
+ .omitEmptyStrings()
+ .split(ipv4Address.getValue());
+
+ List<String> splittedAddress = Lists.newArrayList(splitted.iterator());
+ int maxIndex = splittedAddress.size() - 1;
+ ListIterator<String> listIter = splittedAddress.listIterator();
+ while(listIter.hasNext()) {
+ String current = listIter.next();
+ int i = splittedAddress.indexOf(current);
+ result |= (Long.parseLong(current) << ((maxIndex-i) * 8));
}
return result & 0xFFFFFFFF;
}
--- /dev/null
+package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+
+public class IpConverterTest {
+
+ @Test
+ public void testIpv4AddressToLong() {
+ Ipv4Address ipAddress = new Ipv4Address("192.168.1.2");
+ long address = 0xc0a80102L;
+ assertEquals(address, IpConverter.Ipv4AddressToLong(ipAddress));
+ }
+
+ @Test
+ public void testIpv4AddressToLong2() {
+ Ipv4Address ipAddress = new Ipv4Address("10.168.1.2");
+ long address = 0x0aa80102L;
+ assertEquals(address, IpConverter.Ipv4AddressToLong(ipAddress));
+ }
+
+}
-package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
+package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor;
import static org.junit.Assert.assertEquals;
<classifier>config</classifier>
<type>xml</type>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.openflowplugin</groupId>
+ <artifactId>openflowplugin-blueprint-config</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.opendaylight.dlux</groupId>
<bundle>mvn:org.opendaylight.openflowplugin/openflowplugin/{{VERSION}}</bundle>
<bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-impl/{{VERSION}}</bundle>
<bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-extension-api/{{VERSION}}</bundle>
- <bundle>mvn:org.opendaylight.controller/liblldp/{{VERSION}}</bundle>
+ <bundle>mvn:org.opendaylight.controller/liblldp/{{VERSION}}</bundle>
+ <bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-blueprint-config/{{VERSION}}</bundle>
<configfile finalname="etc/opendaylight/karaf/42-openflowplugin-Li.xml">mvn:org.opendaylight.openflowplugin/openflowplugin-controller-config/{{VERSION}}/xml/config-Li</configfile>
</feature>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowplugin-impl</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.openflowplugin</groupId>
+ <artifactId>openflowplugin-blueprint-config-he</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.opendaylight.openflowplugin.applications</groupId>
<artifactId>table-miss-enforcer</artifactId>
<bundle>mvn:org.opendaylight.openflowplugin/openflowplugin/{{VERSION}}</bundle>
<bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-api/{{VERSION}}</bundle>
<bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-extension-api/{{VERSION}}</bundle>
- <bundle>mvn:org.opendaylight.controller/liblldp/{{VERSION}}</bundle>
+ <bundle>mvn:org.opendaylight.controller/liblldp/{{VERSION}}</bundle>
<bundle>mvn:org.opendaylight.openflowplugin.applications/inventory-manager/{{VERSION}}</bundle>
<bundle>mvn:org.opendaylight.openflowplugin.applications/statistics-manager/{{VERSION}}</bundle>
+ <bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-blueprint-config-he/{{VERSION}}</bundle>
<configfile finalname="${config.configfile.directory}/${config.statistics.manager.configfile}">mvn:org.opendaylight.openflowplugin.applications/statistics-manager-config/{{VERSION}}/xml/config</configfile>
<configfile finalname="${config.configfile.directory}/${config.inventory.manager.configfile}">mvn:org.opendaylight.openflowplugin.applications/inventory-manager/{{VERSION}}/xml/config</configfile>
<configfile finalname="etc/opendaylight/karaf/42-openflowplugin-He.xml">mvn:org.opendaylight.openflowplugin/openflowplugin-controller-config/{{VERSION}}/xml/config-He</configfile>
--- /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-he</artifactId>
+ <description>Blueprint configuration for the Helium 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.sal.binding.api.NotificationProviderService"/>
+ <reference id="entityOwnershipService" interface="org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService"/>
+
+ <!-- Create the StatisticsManager -->
+ <reference id="statsManagerFactory"
+ interface="org.opendaylight.openflowplugin.applications.statistics.manager.StatisticsManagerFactory"/>
+
+ <odl:clustered-app-config id="statsManagerAppConfig"
+ binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.statistics.manager.config.rev160509.StatisticsManagerAppConfig"/>
+
+ <bean id="statsManager" factory-ref="statsManagerFactory" factory-method="newInstance">
+ <argument ref="statsManagerAppConfig"/>
+ <argument ref="dataBroker"/>
+ <argument ref="notificationService"/>
+ <argument ref="rpcRegistry"/>
+ <argument ref="entityOwnershipService"/>
+ </bean>
+
+ <!-- Create the Inventory manager/provider -->
+ <bean id="inventoryManager" class="org.opendaylight.openflowplugin.applications.inventory.manager.InventoryActivator"
+ init-method="start" destroy-method="close">
+ <argument ref="dataBroker"/>
+ <argument ref="notificationService"/>
+ <argument ref="entityOwnershipService"/>
+ </bean>
+
+ <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 -->
+
+ <bean id="openflowPluginProvider" class="org.opendaylight.openflowplugin.openflow.md.core.sal.OpenflowPluginProvider"
+ init-method="initialization" destroy-method="close" depends-on="statsManager inventoryManager">
+ <property name="dataBroker" ref="dataBroker"/>
+ <property name="rpcRegistry" ref="rpcRegistry"/>
+ <property name="notificationService" ref="notificationService"/>
+ <property name="entityOwnershipService" ref="entityOwnershipService"/>
+ <property name="role" value="NOCHANGE"/>
+ <property name="skipTableFeatures" value="false" />
+ <property name="switchConnectionProviders">
+ <list>
+ <ref component-id="defaultSwitchConnProvider"/>
+ <ref component-id="legacySwitchConnProvider"/>
+ </list>
+ </property>
+ </bean>
+
+ <service ref="openflowPluginProvider" odl:type="openflow-provider-impl">
+ <interfaces>
+ <value>org.opendaylight.openflowplugin.openflow.md.core.sal.OpenflowPluginProvider</value>
+ <value>org.opendaylight.openflowplugin.extension.api.OpenFlowPluginExtensionRegistratorProvider</value>
+ </interfaces>
+ </service>
+
+</blueprint>
\ 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
import com.google.common.annotations.VisibleForTesting;
import java.util.Collection;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterManager;
import org.opendaylight.openflowplugin.openflow.md.core.MDController;
import org.opendaylight.openflowplugin.openflow.md.core.extension.ExtensionConverterManagerImpl;
+import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
import org.opendaylight.openflowplugin.openflow.md.core.session.OFRoleManager;
import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
-import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
import org.opendaylight.openflowplugin.statistics.MessageSpyCounterImpl;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326.OfpRole;
import org.opendaylight.yangtools.yang.binding.DataContainer;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginProvider.class);
+ private static final boolean SKIP_TABLE_FEATURES = false;
+
private Collection<SwitchConnectionProvider> switchConnectionProviders;
private MDController mdController;
private ExtensionConverterManager extensionConverterManager;
private OfpRole role;
+ private Boolean skipTableFeatures;
private OFRoleManager roleManager;
private OfEntityManager entManager;
private OpenflowPluginConfig openflowPluginConfig;
+
+
/**
* Initialization of services and msgSpy counter
*/
messageCountProvider = new MessageSpyCounterImpl();
extensionConverterManager = new ExtensionConverterManagerImpl();
roleManager = new OFRoleManager(OFSessionUtil.getSessionManager());
+ openflowPluginConfig = readConfig(skipTableFeatures);
entManager = new OfEntityManager(entityOwnershipService,getOpenflowPluginConfig());
entManager.setDataBroker(dataBroker);
entManager.init();
@Override
public void close() {
LOG.debug("close");
- mdController.stop();
- mdController = null;
- registrationManager.close();
- registrationManager = null;
+
+ if(mdController != null) {
+ mdController.stop();
+ mdController = null;
+ }
+
+ if(registrationManager != null) {
+ registrationManager.close();
+ registrationManager = null;
+ }
}
public MessageCountDumper getMessageCountDumper() {
}
}
+ private OpenflowPluginConfig readConfig(Boolean skipTableFeatures){
+
+ final OpenflowPluginConfig.OpenflowPluginConfigBuilder openflowCfgBuilder = OpenflowPluginConfig.builder();
+
+ if(skipTableFeatures !=null){
+ openflowCfgBuilder.setSkipTableFeatures(skipTableFeatures.booleanValue());
+ } else{
+ LOG.warn("Could not load XML configuration file via ConfigSubsystem! Fallback to default config value(s)");
+ openflowCfgBuilder.setSkipTableFeatures(SKIP_TABLE_FEATURES);
+ }
+
+ return openflowCfgBuilder.build();
+ }
+
public void setDataBroker(DataBroker dataBroker) {
this.dataBroker = dataBroker;
}
this.entityOwnershipService = entityOwnershipService;
}
- public void setOpenflowPluginConfig(OpenflowPluginConfig openflowPluginConfig) {
- this.openflowPluginConfig = openflowPluginConfig;
+ public void setSkipTableFeatures(Boolean skipTableFeatures) {
+ this.skipTableFeatures = skipTableFeatures;
}
@VisibleForTesting
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeUpdated;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeUpdatedBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
FlowCapableNodeUpdatedBuilder builder2 = new FlowCapableNodeUpdatedBuilder();
try {
builder2.setIpAddress(getIpAddressOf(sw));
+ builder2.setPortNumber(getPortNumberOf(sw));
} catch (Exception e) {
- LOG.warn("IP address of the node {} cannot be obtained.", sw.getNodeId(), e);
+ LOG.warn("IP address/Port Number of the node {} cannot be obtained.", sw.getNodeId(), e);
}
builder2.setSwitchFeatures(swFeaturesUtil.buildSwitchFeatures(features));
builder.addAugmentation(FlowCapableNodeUpdated.class, builder2.build());
throw new IllegalArgumentException("Unsupported IP address type!");
}
+ private static PortNumber getPortNumberOf(ModelDrivenSwitch sw) {
+ SessionContext sessionContext = sw.getSessionContext();
+
+ Preconditions.checkNotNull(sessionContext.getPrimaryConductor(),
+ "primary conductor must not be NULL -> " + sw.getNodeId());
+ Preconditions.checkNotNull(sessionContext.getPrimaryConductor().getConnectionAdapter(),
+ "connection adapter of primary conductor must not be NULL -> " + sw.getNodeId());
+ InetSocketAddress remoteAddress = sessionContext.getPrimaryConductor().getConnectionAdapter()
+ .getRemoteAddress();
+ if (remoteAddress == null) {
+ LOG.warn("Port Number of the node {} cannot be obtained. No connection with switch.", sw.getNodeId());
+ return null;
+ }
+ return resolvePortNumber(remoteAddress.getPort());
+ }
+
+ private static PortNumber resolvePortNumber(int port) {
+ PortNumber portNo = new PortNumber(port);
+ return portNo;
+ }
+
private static NodeRemoved nodeRemoved(final NodeRef nodeRef) {
NodeRemovedBuilder builder = new NodeRemovedBuilder();
builder.setNodeRef(nodeRef);
import java.math.BigInteger;
import java.util.List;
import java.util.concurrent.ExecutionException;
+
+import com.google.common.base.Splitter;
import org.apache.commons.lang3.StringUtils;
import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
public abstract class InventoryDataServiceUtil {
public static final String OF_URI_PREFIX = "openflow:";
+ private static final Splitter COLON_SPLITTER = Splitter.on(":");
private static final Logger LOG = LoggerFactory.getLogger(InventoryDataServiceUtil.class);
/*
}
public static String portNoStringfromNodeConnectorID(final String ncID) {
- String[] split = ncID.split(":");
+
+ List<String> splitStringList = COLON_SPLITTER.splitToList(ncID);
// It can happen that token length will be just 1 i.e 2 or CONTROLLER
// If the length is just one then this cannot be the new MD-SAL style node connector Id which
// is of the form openflow:1:3.
- return split[split.length - 1];
+ return splitStringList.get(splitStringList.size()-1);
}
public static Long portNumberfromNodeConnectorId(final OpenflowVersion ofVersion, final String ncId) {
*/
package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326;
-import com.google.common.base.MoreObjects;
-import javax.management.ObjectName;
-
-import org.opendaylight.openflowplugin.openflow.md.core.sal.OpenflowPluginConfig;
+import java.util.Collection;
+import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
+import org.opendaylight.openflowplugin.api.openflow.statistics.MessageCountDumper;
+import org.opendaylight.openflowplugin.extension.api.ExtensionConverterRegistrator;
import org.opendaylight.openflowplugin.openflow.md.core.sal.OpenflowPluginProvider;
+import org.osgi.framework.BundleContext;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
-*
-*/
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
public final class ConfigurableOpenFlowProviderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326.AbstractConfigurableOpenFlowProviderModule {
private static final Logger LOG = LoggerFactory.getLogger(ConfigurableOpenFlowProviderModule.class);
- private OpenflowPluginProvider pluginProvider;
-
- private static final boolean SKIP_TABLE_FEATURES = false;
+ private BundleContext bundleContext;
/**
* @param identifier module identifier
}
@Override
- public java.lang.AutoCloseable createInstance() {
- pluginProvider = new OpenflowPluginProvider();
- pluginProvider.setDataBroker(getDataBrokerDependency());
- pluginProvider.setNotificationService(getNotificationServiceDependency());
- pluginProvider.setRpcRegistry(getRpcRegistryDependency());
- pluginProvider.setSwitchConnectionProviders(getOpenflowSwitchConnectionProviderDependency());
- pluginProvider.setEntityOwnershipService(getOwnershipServiceDependency());
- pluginProvider.setRole(getRole());
- pluginProvider.setOpenflowPluginConfig(readConfig());
- pluginProvider.initialization();
- return pluginProvider;
+ 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 actualService = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
+
+ return new OpenflowPluginProvider() {
+ @Override
+ public void close() {
+ // Don't close the actual service as its life cycle is controlled by blueprint.
+ tracker.close();
+ }
+
+ @Override
+ public void initialization() {
+ actualService.initialization();
+ }
+
+ @Override
+ public void setSwitchConnectionProviders(Collection<SwitchConnectionProvider> switchConnectionProvider) {
+ actualService.setSwitchConnectionProviders(switchConnectionProvider);
+ }
+
+ @Override
+ public MessageCountDumper getMessageCountDumper() {
+ return actualService.getMessageCountDumper();
+ }
+
+ @Override
+ public ExtensionConverterRegistrator getExtensionConverterRegistrator() {
+ return actualService.getExtensionConverterRegistrator();
+ }
+
+ @Override
+ public void setRole(OfpRole role) {
+ actualService.setRole(role);
+ }
+
+ @Override
+ public void setSkipTableFeatures(Boolean skipTableFeatures) {
+ actualService.setSkipTableFeatures(skipTableFeatures);
+ }
+
+ @Override
+ public void fireRoleChange(OfpRole newRole) {
+ actualService.fireRoleChange(newRole);
+ }
+
+ @Override
+ public void setDataBroker(DataBroker dataBroker) {
+ actualService.setDataBroker(dataBroker);
+ }
+
+ @Override
+ public void setNotificationService(NotificationProviderService notificationService) {
+ actualService.setNotificationService(notificationService);
+ }
+
+ @Override
+ public void setRpcRegistry(RpcProviderRegistry rpcRegistry) {
+ actualService.setRpcRegistry(rpcRegistry);
+ }
+
+ @Override
+ public void setEntityOwnershipService(EntityOwnershipService entityOwnershipService) {
+ actualService.setEntityOwnershipService(entityOwnershipService);
+ }
+ };
}
- @Override
- public boolean canReuseInstance(
- AbstractConfigurableOpenFlowProviderModule oldModule) {
- // we can reuse if only the role field changed
- boolean noChangeExceptRole = true;
- noChangeExceptRole &= dependencyResolver.canReuseDependency(
- getDataBroker(), dataBrokerJmxAttribute);
- noChangeExceptRole &= dependencyResolver.canReuseDependency(
- getNotificationService(), notificationServiceJmxAttribute);
- noChangeExceptRole &= dependencyResolver.canReuseDependency(
- getRpcRegistry(), rpcRegistryJmxAttribute);
-
- for (ObjectName ofSwitchProvider : getOpenflowSwitchConnectionProvider()) {
- noChangeExceptRole &= dependencyResolver.canReuseDependency(
- ofSwitchProvider, openflowSwitchConnectionProviderJmxAttribute);
- }
- return noChangeExceptRole;
+ public void setBundleContext(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
}
@Override
- public AutoCloseable reuseInstance(AutoCloseable oldInstance) {
- OpenflowPluginProvider recycled = (OpenflowPluginProvider) super.reuseInstance(oldInstance);
- // change role if different
- recycled.fireRoleChange(MoreObjects.firstNonNull(getRole(), getRole()));
-
- return recycled;
+ public boolean canReuseInstance(AbstractConfigurableOpenFlowProviderModule oldModule) {
+ return true;
}
- private OpenflowPluginConfig readConfig(){
-
- final OpenflowPluginConfig.OpenflowPluginConfigBuilder openflowCfgBuilder = OpenflowPluginConfig.builder();
-
- if(getSkipTableFeatures()!=null){
- openflowCfgBuilder.setSkipTableFeatures(getSkipTableFeatures().booleanValue());
- } else{
- LOG.warn("Could not load XML configuration file via ConfigSubsystem! Fallback to default config value(s)");
- openflowCfgBuilder.setSkipTableFeatures(SKIP_TABLE_FEATURES);
- }
-
- return openflowCfgBuilder.build();
- }
}
*/
package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326;
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.osgi.framework.BundleContext;
/**
- * the only purpose of this overwritings is to deliver bundleContext from osgi to module
+ * @deprecated Replaced by blueprint wiring
*/
-public class ConfigurableOpenFlowProviderModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326.AbstractConfigurableOpenFlowProviderModuleFactory
-{
- // nothing to override
+@Deprecated
+public class ConfigurableOpenFlowProviderModuleFactory extends AbstractConfigurableOpenFlowProviderModuleFactory {
+ @Override
+ public ConfigurableOpenFlowProviderModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+ ConfigurableOpenFlowProviderModule oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
+ ConfigurableOpenFlowProviderModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
+ oldInstance, bundleContext);
+ module.setBundleContext(bundleContext);
+ return module;
+ }
+
+ @Override
+ public ConfigurableOpenFlowProviderModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+ BundleContext bundleContext) {
+ ConfigurableOpenFlowProviderModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
+ module.setBundleContext(bundleContext);
+ return module;
+ }
}
identity openflow-provider{
base config:service-type;
config:java-class "org.opendaylight.openflowplugin.openflow.md.core.sal.OpenflowPluginProvider";
+ config:disable-osgi-service-registration;
}
}
\ No newline at end of file
<openflowjava.version>0.8.0-SNAPSHOT</openflowjava.version>
<openflowplugin.version>0.3.0-SNAPSHOT</openflowplugin.version>
<sal.api.version>0.11.0-SNAPSHOT</sal.api.version>
- <jmxGeneratorPath>src/main/yang-gen-config</jmxGeneratorPath>
- <salGeneratorPath>src/main/yang-gen-sal</salGeneratorPath>
+ <jmxGeneratorPath>target/generated-sources/config</jmxGeneratorPath>
+ <salGeneratorPath>target/generated-sources/sal</salGeneratorPath>
<exi.nagasena.version>0000.0002.0053.0</exi.nagasena.version>
<controller.distribution.version>0.4.0-SNAPSHOT</controller.distribution.version>
<ignore/>
</action>
</pluginExecution>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-maven-plugin</artifactId>
- <versionRange>[0.5,)</versionRange>
- <goals>
- <goal>generate-sources</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <execute/>
- </action>
- </pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.groovy.maven</groupId>
<module>extension</module>
<module>distribution/karaf</module>
<module>openflowplugin-controller-config</module>
+ <module>openflowplugin-blueprint-config-he</module>
+ <module>openflowplugin-blueprint-config</module>
<!--
<module>openflowplugin-it</module>
-->
+++ /dev/null
-*.pyc
-/.pydevproject
-*.log
-.tox/