+++ /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.controller</groupId>
- <artifactId>sal-parent</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
- </parent>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main</url>
- <tag>HEAD</tag>
- </scm>
-
- <artifactId>clustered-datastore-implementation</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- </instructions>
- <manifestLocation>${project.basedir}/META-INF</manifestLocation>
- </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.yang.unified.doc.generator.maven.DocumentationGeneratorImpl</codeGeneratorClass>
- <outputBaseDir>target/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>0.2.3-SNAPSHOT</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>
- </plugins>
- </build>
- <dependencies>
-
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-core-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>clustering.services</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-binding</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-data-api</artifactId>
- </dependency>
-
- </dependencies>
-</project>
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
-* Generated file
-
-* Generated from: yang module name: odl-sal-dom-clustered-store-cfg yang module local name: dom-clustered-store-impl
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Wed Nov 27 17:09:17 CET 2013
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.controller.config.yang.md.sal.dom.cluster.store;
-
-import org.opendaylight.controller.datastore.internal.ClusteredDataStoreManager;
-import org.osgi.framework.BundleContext;
-
-/**
-*
-*/
-public final class ClusteredDataStoreImplModule extends org.opendaylight.controller.config.yang.md.sal.dom.cluster.store.AbstractClusteredDataStoreImplModule
-{
-
- private BundleContext bundleContext;
-
- public ClusteredDataStoreImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public ClusteredDataStoreImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, ClusteredDataStoreImplModule oldModule, java.lang.AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public void validate(){
- super.validate();
- // Add custom validation for module attributes here.
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- ClusteredDataStoreManager manager = new ClusteredDataStoreManager();
- manager.setContext(bundleContext);
- manager.start();
- return manager;
- }
-
- public void setBundleContext(BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
-* Generated file
-
-* Generated from: yang module name: odl-sal-dom-clustered-store-cfg yang module local name: dom-clustered-store-impl
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Wed Nov 27 17:09:17 CET 2013
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.controller.config.yang.md.sal.dom.cluster.store;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
-import org.opendaylight.controller.config.spi.Module;
-import org.osgi.framework.BundleContext;
-
-/**
-*
-*/
-public class ClusteredDataStoreImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.dom.cluster.store.AbstractClusteredDataStoreImplModuleFactory
-{
-
- @Override
- public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
- ClusteredDataStoreImplModule module =
- (ClusteredDataStoreImplModule) super.createModule(instanceName, dependencyResolver, bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-
- @Override
- public Module createModule(String instanceName, DependencyResolver dependencyResolver,
- DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
- ClusteredDataStoreImplModule module =
- (ClusteredDataStoreImplModule) super.createModule(instanceName, dependencyResolver, old, bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-
-}
+++ /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.controller.datastore;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
-import org.opendaylight.controller.md.sal.common.api.data.DataReader;
-import org.opendaylight.controller.sal.core.api.data.DataStore;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-
-public interface ClusteredDataStore extends DataStore {
-
-
-}
+++ /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.controller.datastore.internal;
-
-import com.google.common.base.Preconditions;
-
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.datastore.ClusteredDataStore;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.controller.sal.common.util.Rpcs;
-import org.opendaylight.yangtools.yang.common.RpcError;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * The ClusteredDataStoreImpl stores global data to be shared across a controller cluster. It uses Clustering Services.
- */
-public class ClusteredDataStoreImpl implements ClusteredDataStore {
-
-
- public static final String OPERATIONAL_DATA_CACHE = "clustered_data_store.operational_data_cache";
- public static final String CONFIGURATION_DATA_CACHE = "clustered_data_store.configuration_data_cache";
-
- private final ConcurrentMap<InstanceIdentifier, CompositeNode> operationalDataCache;
- private final ConcurrentMap<InstanceIdentifier, CompositeNode> configurationDataCache;
-
- private Logger logger = LoggerFactory.getLogger(ClusteredDataStoreImpl.class);
-
- public ClusteredDataStoreImpl(IClusterGlobalServices clusterGlobalServices) throws CacheConfigException {
- logger.trace("Constructing clustered data store");
- Preconditions.checkNotNull(clusterGlobalServices, "clusterGlobalServices cannot be null");
-
- operationalDataCache = getOrCreateCache(clusterGlobalServices, OPERATIONAL_DATA_CACHE);
-
- Preconditions.checkNotNull(operationalDataCache, "operationalDataCache cannot be null");
-
- configurationDataCache = getOrCreateCache(clusterGlobalServices, CONFIGURATION_DATA_CACHE);
-
- Preconditions.checkNotNull(configurationDataCache, "configurationDataCache cannot be null");
- }
-
- @Override
- public DataCommitTransaction<InstanceIdentifier, CompositeNode> requestCommit(DataModification<InstanceIdentifier, CompositeNode> modification) {
- return new ClusteredDataStoreTransaction(modification);
- }
-
- @Override
- public CompositeNode readOperationalData(InstanceIdentifier path) {
- Preconditions.checkNotNull(path, "path cannot be null");
- return operationalDataCache.get(path);
- }
-
- @Override
- public boolean containsConfigurationPath(InstanceIdentifier path) {
- return configurationDataCache.containsKey(path);
- }
-
- @Override
- public boolean containsOperationalPath(InstanceIdentifier path) {
- return operationalDataCache.containsKey(path);
- }
-
- @Override
- public Iterable<InstanceIdentifier> getStoredConfigurationPaths() {
- return configurationDataCache.keySet();
- }
-
- @Override
- public Iterable<InstanceIdentifier> getStoredOperationalPaths() {
- return operationalDataCache.keySet();
- }
-
-
-
- @Override
- public CompositeNode readConfigurationData(InstanceIdentifier path) {
- Preconditions.checkNotNull(path, "path cannot be null");
- return configurationDataCache.get(path);
- }
-
- private RpcResult<Void> finish(final ClusteredDataStoreTransaction transaction) {
- final DataModification<InstanceIdentifier,CompositeNode> modification = transaction.getModification();
-
- this.configurationDataCache.putAll(modification.getUpdatedConfigurationData());
- this.operationalDataCache.putAll(modification.getUpdatedOperationalData());
-
- for (final InstanceIdentifier removal : modification.getRemovedConfigurationData()) {
- this.configurationDataCache.remove(removal);
- }
-
- for (final InstanceIdentifier removal : modification.getRemovedOperationalData()) {
- this.operationalDataCache.remove(removal );
- }
-
- Set<RpcError> _emptySet = Collections.<RpcError>emptySet();
- return Rpcs.<Void>getRpcResult(true, null, _emptySet);
- }
-
- private RpcResult<Void> rollback(final ClusteredDataStoreTransaction transaction) {
- Set<RpcError> _emptySet = Collections.<RpcError>emptySet();
- return Rpcs.<Void>getRpcResult(true, null, _emptySet);
- }
-
-
- private ConcurrentMap getOrCreateCache(IClusterGlobalServices clusterGlobalServices, String name) throws CacheConfigException {
- ConcurrentMap cache = clusterGlobalServices.getCache(name);
-
- if(cache == null) {
- try {
- cache = clusterGlobalServices.createCache(name, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
- } catch (CacheExistException e) {
- cache = clusterGlobalServices.getCache(name);
- }
- }
- return cache;
- }
-
- private class ClusteredDataStoreTransaction implements DataCommitTransaction<InstanceIdentifier, CompositeNode> {
- private final DataModification<InstanceIdentifier,CompositeNode> modification;
-
- public ClusteredDataStoreTransaction(DataModification<InstanceIdentifier,CompositeNode> modification){
- Preconditions.checkNotNull(modification, "modification cannot be null");
-
- this.modification = modification;
- }
-
- @Override
- public DataModification<InstanceIdentifier, CompositeNode> getModification() {
- return this.modification;
- }
-
- @Override
- public RpcResult<Void> finish() throws IllegalStateException {
- return ClusteredDataStoreImpl.this.finish(this);
- }
-
- @Override
- public RpcResult<Void> rollback() throws IllegalStateException {
- return ClusteredDataStoreImpl.this.rollback(this);
- }
- }
-}
+++ /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.controller.datastore.internal;
-
-import java.util.Hashtable;
-
-import com.google.common.base.Preconditions;
-
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
-import org.opendaylight.controller.datastore.ClusteredDataStore;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-
-public class ClusteredDataStoreManager implements //
- ClusteredDataStore, //
- ServiceTrackerCustomizer<IClusterGlobalServices, IClusterGlobalServices>, //
- AutoCloseable {
-
- private ClusteredDataStore clusteredDataStore = null;
- private IClusterGlobalServices clusterGlobalServices = null;
- private BundleContext context;
-
- private ServiceReference<IClusterGlobalServices> firstClusterGlobalReference;
- private ServiceTracker<IClusterGlobalServices, IClusterGlobalServices> clusterTracker;
-
- @Override
- public DataCommitTransaction<InstanceIdentifier, CompositeNode> requestCommit(
- DataModification<InstanceIdentifier, CompositeNode> modification) {
- Preconditions.checkState(clusteredDataStore != null, "clusteredDataStore cannot be null");
- return clusteredDataStore.requestCommit(modification);
- }
-
- @Override
- public CompositeNode readOperationalData(InstanceIdentifier path) {
- Preconditions.checkState(clusteredDataStore != null, "clusteredDataStore cannot be null");
- return clusteredDataStore.readOperationalData(path);
- }
-
- @Override
- public CompositeNode readConfigurationData(InstanceIdentifier path) {
- Preconditions.checkState(clusteredDataStore != null, "clusteredDataStore cannot be null");
- return clusteredDataStore.readConfigurationData(path);
- }
-
- public Iterable<InstanceIdentifier> getStoredConfigurationPaths() {
- Preconditions.checkState(clusteredDataStore != null, "clusteredDataStore cannot be null");
- return clusteredDataStore.getStoredConfigurationPaths();
- }
-
- public Iterable<InstanceIdentifier> getStoredOperationalPaths() {
- Preconditions.checkState(clusteredDataStore != null, "clusteredDataStore cannot be null");
- return clusteredDataStore.getStoredOperationalPaths();
- }
-
- public boolean containsConfigurationPath(InstanceIdentifier path) {
- Preconditions.checkState(clusteredDataStore != null, "clusteredDataStore cannot be null");
- return clusteredDataStore.containsConfigurationPath(path);
- }
-
- public boolean containsOperationalPath(InstanceIdentifier path) {
- Preconditions.checkState(clusteredDataStore != null, "clusteredDataStore cannot be null");
- return clusteredDataStore.containsOperationalPath(path);
- }
-
- public void setClusterGlobalServices(IClusterGlobalServices clusterGlobalServices) {
- this.clusterGlobalServices = clusterGlobalServices;
- try {
- // Adding creation of the clustered data store in its own method
- // to make the method unit testable
- clusteredDataStore = createClusteredDataStore();
- } catch (CacheConfigException e) {
- throw new IllegalStateException("could not construct clusteredDataStore");
- }
- }
-
- @Override
- public IClusterGlobalServices addingService(ServiceReference<IClusterGlobalServices> reference) {
- if (clusterGlobalServices == null) {
- setClusterGlobalServices(context.getService(reference));
- return clusterGlobalServices;
- }
- return null;
- }
-
- @Override
- public void modifiedService(ServiceReference<IClusterGlobalServices> reference, IClusterGlobalServices service) {
-
- }
-
- @Override
- public void removedService(ServiceReference<IClusterGlobalServices> reference, IClusterGlobalServices service) {
- if (clusterGlobalServices == service) {
- clusterGlobalServices = null;
- clusteredDataStore = null;
- }
- }
-
- public BundleContext getContext() {
- return context;
- }
-
- public void setContext(BundleContext context) {
- this.context = context;
- }
-
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- *
- */
- public void start() {
- if (context != null) {
- clusterTracker = new ServiceTracker<>(context, IClusterGlobalServices.class, this);
- clusterTracker.open();
-
- context.registerService(ClusteredDataStore.class, this, new Hashtable<String,Object>());
- }
- }
-
- protected ClusteredDataStore createClusteredDataStore() throws CacheConfigException {
- return new ClusteredDataStoreImpl(clusterGlobalServices);
- }
-
- @Override
- public void close() throws Exception {
- clusterTracker.close();
- }
-}
+++ /dev/null
-module odl-sal-dom-clustered-store-cfg {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:cluster:store";
- prefix "binding-impl";
-
- import config { prefix config; revision-date 2013-04-05; }
- import opendaylight-md-sal-dom {prefix sal;}
-
- description
- "Service definition for MD-SAL Clustered Store.";
-
- revision "2013-10-28" {
- description
- "Initial revision";
- }
-
- identity dom-clustered-store-impl {
- base config:module-type;
- config:provided-service sal:dom-data-store;
- config:java-name-prefix ClusteredDataStoreImpl;
- }
-
- augment "/config:modules/config:module/config:state" {
- case dom-clustered-store-impl {
- when "/config:modules/config:module/config:type = 'dom-clustered-store-impl'";
- }
- }
-
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.datastore.internal;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-
-import java.util.EnumSet;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-public class ClusteredDataStoreImplTest {
- @Before
- public void setUp(){
-
- }
-
- @Test
- public void constructor_WhenPassedANullClusteringServices_ShouldThrowANullPointerException() throws CacheExistException, CacheConfigException {
- try {
- new ClusteredDataStoreImpl(null);
- } catch(NullPointerException npe){
- assertEquals("clusterGlobalServices cannot be null", npe.getMessage());
- }
- }
-
- @Test
- public void constructor_WhenClusteringServicesReturnsANullOperationalDataCache_ShouldThrowANullPointerException() throws CacheExistException, CacheConfigException {
- try {
- new ClusteredDataStoreImpl(mock(IClusterGlobalServices.class));
- } catch(NullPointerException npe){
- assertEquals("operationalDataCache cannot be null", npe.getMessage());
- }
- }
-
- @Test
- public void constructor_WhenClusteringServicesReturnsANullOConfigurationDataCache_ShouldThrowANullPointerException() throws CacheExistException, CacheConfigException {
- IClusterGlobalServices mockClusterGlobalServices = mock(IClusterGlobalServices.class);
-
- // Confused about the following line?
- // See this http://stackoverflow.com/questions/10952629/a-strange-generics-edge-case-with-mockito-when-and-generic-type-inference
- Mockito.<ConcurrentMap<?,?>>when(mockClusterGlobalServices.createCache(ClusteredDataStoreImpl.OPERATIONAL_DATA_CACHE, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL))).thenReturn(new ConcurrentHashMap<Object, Object>());
-
-
- try {
- new ClusteredDataStoreImpl(mockClusterGlobalServices);
- } catch(NullPointerException npe){
- assertEquals("configurationDataCache cannot be null", npe.getMessage());
- }
- }
-
- @Test
- public void constructor_WhenOperationalDataCacheIsAlreadyPresent_ShouldNotAttemptToCreateCache() throws CacheExistException, CacheConfigException {
- IClusterGlobalServices mockClusterGlobalServices = mock(IClusterGlobalServices.class);
-
- Mockito.<ConcurrentMap<?,?>>when(mockClusterGlobalServices.getCache(ClusteredDataStoreImpl.OPERATIONAL_DATA_CACHE)).thenReturn(new ConcurrentHashMap<Object, Object>());
- Mockito.<ConcurrentMap<?,?>>when(mockClusterGlobalServices.getCache(ClusteredDataStoreImpl.CONFIGURATION_DATA_CACHE)).thenReturn(new ConcurrentHashMap<Object, Object>());
-
- new ClusteredDataStoreImpl(mockClusterGlobalServices);
-
- verify(mockClusterGlobalServices, never()).createCache(ClusteredDataStoreImpl.OPERATIONAL_DATA_CACHE, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
- }
-
- @Test
- public void constructor_WhenConfigurationDataCacheIsAlreadyPresent_ShouldNotAttemptToCreateCache() throws CacheExistException, CacheConfigException {
- IClusterGlobalServices mockClusterGlobalServices = mock(IClusterGlobalServices.class);
-
- Mockito.<ConcurrentMap<?,?>>when(mockClusterGlobalServices.getCache(ClusteredDataStoreImpl.OPERATIONAL_DATA_CACHE)).thenReturn(new ConcurrentHashMap<Object, Object>());
- Mockito.<ConcurrentMap<?,?>>when(mockClusterGlobalServices.getCache(ClusteredDataStoreImpl.CONFIGURATION_DATA_CACHE)).thenReturn(new ConcurrentHashMap<Object, Object>());
-
- new ClusteredDataStoreImpl(mockClusterGlobalServices);
-
- verify(mockClusterGlobalServices, never()).createCache(ClusteredDataStoreImpl.CONFIGURATION_DATA_CACHE, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
- }
-
-
- @Test
- public void constructor_WhenPassedAValidClusteringServices_ShouldNotThrowAnyExceptions() throws CacheExistException, CacheConfigException {
- IClusterGlobalServices mockClusterGlobalServices = createClusterGlobalServices();
-
- new ClusteredDataStoreImpl(mockClusterGlobalServices);
- }
-
-
- @Test
- public void readOperationalData_WhenPassedANullPath_ShouldThrowANullPointerException() throws CacheExistException, CacheConfigException {
- IClusterGlobalServices mockClusterGlobalServices = createClusterGlobalServices();
-
- ClusteredDataStoreImpl store = new ClusteredDataStoreImpl(mockClusterGlobalServices);
-
- try {
- store.readOperationalData(null);
- } catch(NullPointerException npe){
- assertEquals("path cannot be null", npe.getMessage());
- }
- }
-
- @Test
- public void readOperationalData_WhenPassedAKeyThatDoesNotExistInTheCache_ShouldReturnNull() throws CacheExistException, CacheConfigException {
- InstanceIdentifier path = InstanceIdentifier.builder().toInstance();
-
- IClusterGlobalServices mockClusterGlobalServices = createClusterGlobalServices();
-
- ClusteredDataStoreImpl store = new ClusteredDataStoreImpl(mockClusterGlobalServices);
-
- assertNull(store.readOperationalData(path));
- }
-
- @Test
- public void readOperationalData_WhenPassedAKeyThatDoesExistInTheCache_ShouldReturnTheValueObject() throws CacheExistException, CacheConfigException {
- InstanceIdentifier path = InstanceIdentifier.builder().toInstance();
-
- IClusterGlobalServices mockClusterGlobalServices = createClusterGlobalServices();
-
- ConcurrentMap<InstanceIdentifier, CompositeNode> mockOperationalDataCache = mock(ConcurrentMap.class);
-
- CompositeNode valueObject = mock(CompositeNode.class);
-
- when(mockOperationalDataCache.get(path)).thenReturn(valueObject);
-
- Mockito.<ConcurrentMap<?,?>>when(mockClusterGlobalServices.createCache(ClusteredDataStoreImpl.OPERATIONAL_DATA_CACHE, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL))).thenReturn(mockOperationalDataCache);
- Mockito.<ConcurrentMap<?,?>>when(mockClusterGlobalServices.createCache(ClusteredDataStoreImpl.CONFIGURATION_DATA_CACHE, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL))).thenReturn(new ConcurrentHashMap<Object, Object>());
-
-
- ClusteredDataStoreImpl store = new ClusteredDataStoreImpl(mockClusterGlobalServices);
-
- assertEquals(valueObject, store.readOperationalData(path));
- }
-
-
-
- @Test
- public void readConfigurationData_WhenPassedANullPath_ShouldThrowANullPointerException() throws CacheExistException, CacheConfigException {
-
- IClusterGlobalServices mockClusterGlobalServices = createClusterGlobalServices();
-
- ClusteredDataStoreImpl store = new ClusteredDataStoreImpl(mockClusterGlobalServices);
-
- try {
- store.readConfigurationData(null);
- } catch(NullPointerException npe){
- assertEquals("path cannot be null", npe.getMessage());
- }
- }
-
-
- @Test
- public void readConfigurationData_WhenPassedAKeyThatDoesNotExistInTheCache_ShouldReturnNull() throws CacheExistException, CacheConfigException {
- InstanceIdentifier path = InstanceIdentifier.builder().toInstance();
-
- IClusterGlobalServices mockClusterGlobalServices = createClusterGlobalServices();
-
- ClusteredDataStoreImpl store = new ClusteredDataStoreImpl(mockClusterGlobalServices);
-
- assertNull(store.readConfigurationData(path));
- }
-
- @Test
- public void readConfigurationData_WhenPassedAKeyThatDoesExistInTheCache_ShouldReturnTheValueObject() throws CacheExistException, CacheConfigException {
- InstanceIdentifier path = InstanceIdentifier.builder().toInstance();
-
- IClusterGlobalServices mockClusterGlobalServices = createClusterGlobalServices();
-
- ConcurrentMap<InstanceIdentifier, CompositeNode> mockConfigurationDataCache = mock(ConcurrentMap.class);
-
- CompositeNode valueObject = mock(CompositeNode.class);
-
- when(mockConfigurationDataCache.get(path)).thenReturn(valueObject);
-
- Mockito.<ConcurrentMap<?,?>>when(mockClusterGlobalServices.createCache(ClusteredDataStoreImpl.OPERATIONAL_DATA_CACHE, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL))).thenReturn(mock(ConcurrentMap.class));
- Mockito.<ConcurrentMap<?,?>>when(mockClusterGlobalServices.createCache(ClusteredDataStoreImpl.CONFIGURATION_DATA_CACHE, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL))).thenReturn(mockConfigurationDataCache);
-
-
- ClusteredDataStoreImpl store = new ClusteredDataStoreImpl(mockClusterGlobalServices);
-
- assertEquals(valueObject, store.readConfigurationData(path));
- }
-
-
- @Test
- public void requestCommit_ShouldReturnADataTransaction() throws CacheExistException, CacheConfigException {
- IClusterGlobalServices mockClusterGlobalServices = createClusterGlobalServices();
-
- ClusteredDataStoreImpl store = new ClusteredDataStoreImpl(mockClusterGlobalServices);
-
- assertNotNull(store.requestCommit(mock(DataModification.class)));
-
-
- }
-
- @Test
- public void finishingADataTransaction_ShouldUpdateTheUnderlyingCache() throws CacheExistException, CacheConfigException {
- IClusterGlobalServices mockClusterGlobalServices = mock(IClusterGlobalServices.class);
-
- ConcurrentMap mockConfigurationDataCache = mock(ConcurrentMap.class);
- ConcurrentMap mockOperationalDataCache = mock(ConcurrentMap.class);
-
- Mockito.<ConcurrentMap<?,?>>when(mockClusterGlobalServices.createCache(ClusteredDataStoreImpl.OPERATIONAL_DATA_CACHE, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL))).thenReturn(mockOperationalDataCache);
- Mockito.<ConcurrentMap<?,?>>when(mockClusterGlobalServices.createCache(ClusteredDataStoreImpl.CONFIGURATION_DATA_CACHE, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL))).thenReturn(mockConfigurationDataCache);
-
- ClusteredDataStoreImpl store = new ClusteredDataStoreImpl(mockClusterGlobalServices);
-
- DataModification mockModification = mock(DataModification.class);
-
- Map configurationData = mock(Map.class);
- Map operationalData = mock(Map.class);
-
- when(mockModification.getUpdatedConfigurationData()).thenReturn(configurationData);
- when(mockModification.getUpdatedOperationalData()).thenReturn(operationalData);
-
- DataCommitHandler.DataCommitTransaction<InstanceIdentifier, CompositeNode> transaction = store.requestCommit(mockModification);
-
- transaction.finish();
-
- verify(mockConfigurationDataCache).putAll(mockModification.getUpdatedConfigurationData());
- verify(mockOperationalDataCache).putAll(mockModification.getUpdatedOperationalData());
- }
-
-
- @Test
- public void rollingBackADataTransaction_ShouldDoNothing() throws CacheExistException, CacheConfigException {
- IClusterGlobalServices mockClusterGlobalServices = mock(IClusterGlobalServices.class);
-
- ConcurrentMap mockConfigurationDataCache = mock(ConcurrentMap.class);
- ConcurrentMap mockOperationalDataCache = mock(ConcurrentMap.class);
-
- Mockito.<ConcurrentMap<?,?>>when(mockClusterGlobalServices.createCache(ClusteredDataStoreImpl.OPERATIONAL_DATA_CACHE, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL))).thenReturn(mockOperationalDataCache);
- Mockito.<ConcurrentMap<?,?>>when(mockClusterGlobalServices.createCache(ClusteredDataStoreImpl.CONFIGURATION_DATA_CACHE, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL))).thenReturn(mockConfigurationDataCache);
-
- ClusteredDataStoreImpl store = new ClusteredDataStoreImpl(mockClusterGlobalServices);
-
- DataModification mockModification = mock(DataModification.class);
-
- Map configurationData = mock(Map.class);
- Map operationalData = mock(Map.class);
-
- when(mockModification.getUpdatedConfigurationData()).thenReturn(configurationData);
- when(mockModification.getUpdatedOperationalData()).thenReturn(operationalData);
-
- DataCommitHandler.DataCommitTransaction<InstanceIdentifier, CompositeNode> transaction = store.requestCommit(mockModification);
-
- transaction.rollback();
-
- verify(mockConfigurationDataCache, never()).putAll(mockModification.getUpdatedConfigurationData());
- verify(mockOperationalDataCache, never()).putAll(mockModification.getUpdatedOperationalData());
-
- }
-
-
- private IClusterGlobalServices createClusterGlobalServices() throws CacheExistException, CacheConfigException {
- IClusterGlobalServices mockClusterGlobalServices = mock(IClusterGlobalServices.class);
-
- Mockito.<ConcurrentMap<?,?>>when(mockClusterGlobalServices.createCache(ClusteredDataStoreImpl.OPERATIONAL_DATA_CACHE, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL))).thenReturn(mock(ConcurrentMap.class));
- Mockito.<ConcurrentMap<?,?>>when(mockClusterGlobalServices.createCache(ClusteredDataStoreImpl.CONFIGURATION_DATA_CACHE, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL))).thenReturn(mock(ConcurrentMap.class));
-
- return mockClusterGlobalServices;
- }
-}
+++ /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.controller.datastore.internal;
-
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.felix.dm.Component;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-
-import static junit.framework.Assert.assertNotNull;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-public class ClusteredDataStoreManagerTest {
-
- private static ClusteredDataStoreManager clusteredDSMgr = null;
- private IClusterGlobalServices icClusterGlbServices = mock(IClusterGlobalServices.class);
-
- @BeforeClass
- public static void construct() {
- clusteredDSMgr = new ClusteredDataStoreManager();
- assertNotNull(clusteredDSMgr);
- }
-
- @Test
- public void construct_OnSetClusterGlobalServices_AssertNoException() {
- doReturn(new ConcurrentHashMap<InstanceIdentifier, CompositeNode>()).when(icClusterGlbServices).getCache(ClusteredDataStoreImpl.CONFIGURATION_DATA_CACHE);
- doReturn(new ConcurrentHashMap<InstanceIdentifier, CompositeNode>()).when(icClusterGlbServices).getCache(ClusteredDataStoreImpl.OPERATIONAL_DATA_CACHE);
- clusteredDSMgr.setClusterGlobalServices(icClusterGlbServices);
- }
-
- @Test
- public void construct_init_AssertNoException() throws CacheExistException, CacheConfigException {
- ClusteredDataStoreImpl clusteredDSImpl = mock(ClusteredDataStoreImpl.class);
-
- ClusteredDataStoreManager clusteredDSManager = spy(new ClusteredDataStoreManager());
- doReturn(clusteredDSImpl).when(clusteredDSManager).createClusteredDataStore();
- clusteredDSManager.start();
- }
-
-
- @Test
- public void construct_readOperationalData_AssertNoException() throws CacheExistException, CacheConfigException {
- ClusteredDataStoreImpl clusteredDSImpl = mock(ClusteredDataStoreImpl.class);
-
- ClusteredDataStoreManager clusteredDSManager = spy(new ClusteredDataStoreManager());
- doReturn(clusteredDSImpl).when(clusteredDSManager).createClusteredDataStore();
- Component c = mock(Component.class);
-
- clusteredDSManager.start();
- clusteredDSManager.setClusterGlobalServices(icClusterGlbServices);
- CompositeNode o = mock(CompositeNode.class);
-
- when(clusteredDSImpl.readOperationalData(any(InstanceIdentifier.class))).thenReturn(o);
- assertEquals(o, clusteredDSManager.readOperationalData(any(InstanceIdentifier.class)));
- }
-
- @Test
- public void construct_readConfigurationData_AssertNoException() throws CacheExistException, CacheConfigException {
- ClusteredDataStoreImpl clusteredDSImpl = mock(ClusteredDataStoreImpl.class);
-
- ClusteredDataStoreManager clusteredDSManager = spy(new ClusteredDataStoreManager());
- doReturn(clusteredDSImpl).when(clusteredDSManager).createClusteredDataStore();
- Component c = mock(Component.class);
-
- clusteredDSManager.start();
- clusteredDSManager.setClusterGlobalServices(icClusterGlbServices);
-
- CompositeNode o = mock(CompositeNode.class);
-
- when(clusteredDSImpl.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(o);
- assertEquals(o, clusteredDSManager.readConfigurationData(any(InstanceIdentifier.class)));
- }
-
- @Test
- public void construct_requestCommit_AssertNoException() throws CacheExistException, CacheConfigException {
- ClusteredDataStoreImpl clusteredDSImpl = mock(ClusteredDataStoreImpl.class);
-
- ClusteredDataStoreManager clusteredDSManager = spy(new ClusteredDataStoreManager());
- doReturn(clusteredDSImpl).when(clusteredDSManager).createClusteredDataStore();
- IClusterGlobalServices globalServices = mock(IClusterGlobalServices.class);
- clusteredDSManager.setClusterGlobalServices(globalServices);
- clusteredDSManager.start();
- DataCommitTransaction dataCommitTransaction = mock(DataCommitTransaction.class);
-
- when(clusteredDSImpl.requestCommit(any(DataModification.class))).thenReturn(dataCommitTransaction);
- assertEquals(dataCommitTransaction, clusteredDSManager.requestCommit(any(DataModification.class)));
- }
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>commons.integrationtest</artifactId>
- <version>0.5.1-SNAPSHOT</version>
- <relativePath>../../../commons/integrationtest</relativePath>
- </parent>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main</url>
- </scm>
-
- <artifactId>clustered-datastore.integrationtest</artifactId>
- <version>0.4.0-SNAPSHOT</version>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- <version>1.4.01</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-it</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-api</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-util</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-impl</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-broker-impl</artifactId>
- <version>1.0-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <artifactId>xml-apis</artifactId>
- <groupId>xml-apis</groupId>
- </exclusion>
- <exclusion>
- <artifactId>reflections</artifactId>
- <groupId>org.reflections</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>clustering.services</artifactId>
- <version>0.5.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-binding</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools.thirdparty</groupId>
- <artifactId>antlr4-runtime-osgi-nohead</artifactId>
- <version>4.0</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>protocol_plugins.stub</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal.implementation</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>containermanager</artifactId>
- <version>0.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>containermanager.it.implementation</artifactId>
- <version>0.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>clustering.stub</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>clustered-datastore-implementation</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools.thirdparty</groupId>
- <artifactId>xtend-lib-osgi</artifactId>
- <version>2.4.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-broker-impl</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-container-native</artifactId>
- <version>${exam.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-junit4</artifactId>
- <version>${exam.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-netconf-connector</artifactId>
- <version>${netconf.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <artifactId>xml-apis</artifactId>
- <groupId>xml-apis</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>logback-config</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-persister-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-persister-file-xml-adapter</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>netconf-impl</artifactId>
- <version>${netconf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>netconf-client</artifactId>
- <version>${netconf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>concepts</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-data-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.9.5</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-manager</artifactId>
- <version>0.2.3-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller.model</groupId>
- <artifactId>model-flow-management</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools.thirdparty</groupId>
- <artifactId>antlr4-runtime-osgi-nohead</artifactId>
- <version>4.0</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools.thirdparty</groupId>
- <artifactId>xtend-lib-osgi</artifactId>
- <version>2.4.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-broker-impl</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-container-native</artifactId>
- <version>${exam.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-junit4</artifactId>
- <version>${exam.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-netconf-connector</artifactId>
- <version>${netconf.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-parser-impl</artifactId>
- <version>${yangtools.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-model-util</artifactId>
- <version>${yangtools.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>logback-config</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-persister-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>netconf-impl</artifactId>
- <version>${netconf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>netconf-client</artifactId>
- <version>${netconf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-link-mvn</artifactId>
- <version>${exam.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.eclipse.osgi</artifactId>
- <version>3.8.1.v20120830-144521</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>log4j-over-slf4j</artifactId>
- <version>1.7.2</version>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- <version>1.0.9</version>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>1.0.9</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller.model</groupId>
- <artifactId>model-flow-service</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-manager</artifactId>
- <version>0.2.3-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller.model</groupId>
- <artifactId>model-flow-management</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools.thirdparty</groupId>
- <artifactId>antlr4-runtime-osgi-nohead</artifactId>
- <version>4.0</version>
- </dependency>
- </dependencies>
- <properties>
- <!-- Sonar jacoco plugin to get integration test coverage info -->
- <sonar.jacoco.reportPath>../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
- <sonar.jacoco.itReportPath>../implementaiton/target/jacoco-it.exec</sonar.jacoco.itReportPath>
- </properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <configuration>
- <destFile>../implementation/target/jacoco-it.exec</destFile>
- <includes><include>org.opendaylight.controller.*</include></includes>
- </configuration>
- <executions>
- <execution>
- <id>pre-test</id>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </execution>
- <execution>
- <id>post-test</id>
- <configuration>
- <skip>true</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
+++ /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.controller.datastore;
-
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.ops4j.pax.exam.CoreOptions.junitBundles;
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.systemPackages;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.controller.test.sal.binding.it.TestHelper;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.util.Filter;
-import org.ops4j.pax.exam.util.PathUtils;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@RunWith(PaxExam.class)
-//@ExamReactorStrategy(PerClass.class)
-public class ClusteredDataStoreIT {
- private Logger log = LoggerFactory.getLogger(ClusteredDataStoreIT.class);
- // get the OSGI bundle context
- @Inject
- private BundleContext bc;
- @Inject
- @Filter(timeout=60*1000)
- private ClusteredDataStore clusteredDS;
-
- // Configure the OSGi container
- @Configuration
- public Option[] config() {
- return options(
- //
- systemProperty("logback.configurationFile").value(
- "file:" + PathUtils.getBaseDir() + "/src/test/resources/logback.xml"),
- // To start OSGi console for inspection remotely
- systemProperty("osgi.console").value("2401"),
- // Set the systemPackages (used by clustering)
- systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"),
- systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
- // List framework bundles
- mavenBundle("equinoxSDK381", "org.eclipse.equinox.console").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.eclipse.equinox.util").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.eclipse.osgi.services").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell").versionAsInProject(),
- // List logger bundles
- mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(),
- mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(),
- mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(),
- mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(),
- // needed by statisticsmanager
- mavenBundle("org.opendaylight.controller", "containermanager").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "containermanager.it.implementation").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "clustering.services").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "clustering.stub").versionAsInProject(),
-
- // List all the bundles on which the test case depends
- mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(),
- TestHelper.baseModelBundles(),
- TestHelper.configMinumumBundles(),
- TestHelper.bindingIndependentSalBundles(),
- TestHelper.bindingAwareSalBundles(),
- TestHelper.mdSalCoreBundles(),
- mavenBundle("org.opendaylight.controller", "config-api").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "sal.implementation").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "protocol_plugins.stub").versionAsInProject(),
-
- mavenBundle("org.osgi", "org.osgi.core").versionAsInProject(),
- // adding new maven bundles
- mavenBundle("org.mockito", "mockito-all").versionAsInProject(),
-
- // needed by hosttracker
- mavenBundle("org.opendaylight.controller", "clustered-datastore-implementation").versionAsInProject(),
- mavenBundle("org.jboss.spec.javax.transaction", "jboss-transaction-api_1.1_spec").versionAsInProject(),
- mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(),
- mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager").versionAsInProject(),
- junitBundles());
- }
-
- private String stateToString(int state) {
- switch (state) {
- case Bundle.ACTIVE:
- return "ACTIVE";
- case Bundle.INSTALLED:
- return "INSTALLED";
- case Bundle.RESOLVED:
- return "RESOLVED";
- case Bundle.UNINSTALLED:
- return "UNINSTALLED";
- default:
- return "Not CONVERTED";
- }
- }
-
- @Test
- public void testBundleContextClusteredDS_NotNull() throws Exception {
- ServiceReference serviceReference = bc.getServiceReference(ClusteredDataStore.class);
- ClusteredDataStore store = ClusteredDataStore.class.cast(bc.getService(serviceReference));
- assertNotNull(store);
- }
-
- @Test
- public void testInjected_ClusteredDS_NotNull() {
- assertNotNull(clusteredDS);
- }
-
- @Test
- public void requestCommit_readConfigurationData_ShouldVerifyDataAndNoException() {
- DataModification dataModification = mock(DataModification.class);
- HashMap map = new HashMap();
- List list = new ArrayList();
- list.add("key");
- InstanceIdentifier key = new InstanceIdentifier(list);
- map.put(key, mock(CompositeNode.class));
- when(dataModification.getUpdatedConfigurationData()).thenReturn(map);
- DataCommitTransaction dataCommitTrans = clusteredDS.requestCommit(dataModification);
- dataCommitTrans.finish();
- Object value = clusteredDS.readConfigurationData(key);
- Assert.assertNotNull(value);
- }
-
- @Test(expected = NullPointerException.class)
- public void requestCommit_ShouldThrowException() {
- DataModification dataModification = null;
- DataCommitTransaction dataCommitTrans = clusteredDS.requestCommit(dataModification);
- dataCommitTrans.finish();
- }
-
- @Test
- public void requestCommit_readOperationalData_ShouldVerifyDataAndNoException() {
- DataModification dataModification = mock(DataModification.class);
- HashMap map = new HashMap();
- List list = new ArrayList();
- list.add("key");
- InstanceIdentifier key = new InstanceIdentifier(list);
- map.put(key, mock(CompositeNode.class));
- when(dataModification.getUpdatedOperationalData()).thenReturn(map);
- DataCommitTransaction dataCommitTrans = clusteredDS.requestCommit(dataModification);
- dataCommitTrans.finish();
- Object value = clusteredDS.readOperationalData(key);
- Assert.assertNotNull(value);
- }
-
- @Test
- public void requestCommit_readConfigurationData_NonExistingKey_ShouldVerifyNoMappedValueAndNoException() {
- DataModification dataModification = mock(DataModification.class);
- HashMap map = new HashMap();
- List list = new ArrayList();
- list.add("key");
- InstanceIdentifier key = new InstanceIdentifier(list);
- map.put(key, "value");
- when(dataModification.getUpdatedConfigurationData()).thenReturn(map);
- DataCommitTransaction dataCommitTrans = clusteredDS.requestCommit(dataModification);
- dataCommitTrans.finish();
- list = new ArrayList();
- list.add("key1");
- InstanceIdentifier key1 = new InstanceIdentifier(list);
-
- Object value = clusteredDS.readConfigurationData(key1);
- assertNull(value);
- }
-
- @Test
- public void requestCommit_readOperationalData_NonExistingKey_ShouldVerifyNoMappedValueAndNoException() {
- DataModification dataModification = mock(DataModification.class);
- HashMap map = new HashMap();
- List list = new ArrayList();
- list.add("key");
- InstanceIdentifier key = new InstanceIdentifier(list);
- map.put(key, mock(CompositeNode.class));
- when(dataModification.getUpdatedOperationalData()).thenReturn(map);
- DataCommitTransaction dataCommitTrans = clusteredDS.requestCommit(dataModification);
- dataCommitTrans.finish();
- list = new ArrayList();
- list.add("key1");
- InstanceIdentifier key1 = new InstanceIdentifier(list);
-
- Object value = clusteredDS.readOperationalData(key1);
- assertNull(value);
- }
-
- @Test(expected = NullPointerException.class)
- public void requestCommit_readConfigurationData_WithNullPathShouldThrowException() {
- DataModification dataModification = mock(DataModification.class);
- HashMap map = new HashMap();
- List list = new ArrayList();
- list.add("key");
- InstanceIdentifier key = new InstanceIdentifier(list);
- map.put(key, "value");
- when(dataModification.getUpdatedConfigurationData()).thenReturn(map);
- DataCommitTransaction dataCommitTrans = clusteredDS.requestCommit(dataModification);
- dataCommitTrans.finish();
- Object value = clusteredDS.readConfigurationData(null);
- }
-
- @Test(expected = NullPointerException.class)
- public void requestCommit_readOperationalData_WithNullPathShouldThrowException() {
- DataModification dataModification = mock(DataModification.class);
- HashMap map = new HashMap();
- List list = new ArrayList();
- list.add("key");
- InstanceIdentifier key = new InstanceIdentifier(list);
- map.put(key, "value");
- when(dataModification.getOriginalOperationalData()).thenReturn(map);
- DataCommitTransaction dataCommitTrans = clusteredDS.requestCommit(dataModification);
- dataCommitTrans.finish();
- Object value = clusteredDS.readOperationalData(null);
- }
-
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<persisted-snapshots>
- <snapshots>
- <snapshot>
- <required-capabilities>
- <capability>
- urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:cluster:store?module=odl-sal-dom-clustered-store-cfg&revision=2013-10-28
- </capability>
- </required-capabilities>
- <configuration>
-
- <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
- <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:cluster:store">
- prefix:dom-clustered-store-impl
- </type>
- <name>cluster-data-store</name>
- </module>
- </modules>
-
- <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
-
- </services>
- </data>
-
- </configuration>
- </snapshot>
- </snapshots>
-</persisted-snapshots>
+++ /dev/null
-<configuration scan="true">
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
- </pattern>
- </encoder>
- </appender>
-
- <root level="debug">
- <appender-ref ref="STDOUT" />
- </root>
-</configuration>
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yangtools.yang.binding.Identifier;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.IdentifiableItem;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
return new org.opendaylight.controller.sal.core.Node(NodeMapping.MD_SAL_TYPE, aDNodeId);
}
- public static NodeId toNodeId(final InstanceIdentifier<? extends Object> node) {
- Preconditions.<InstanceIdentifier<? extends Object>>checkNotNull(node);
- List<PathArgument> path = node.getPath();
- Preconditions.<List<PathArgument>>checkNotNull(path);
- int size = path.size();
- Preconditions.checkArgument(size >= 2);
- final PathArgument arg = path.get(1);
- final IdentifiableItem item = Arguments.<IdentifiableItem>checkInstanceOf(arg, IdentifiableItem.class);
- Identifier<?> key = item.getKey();
- final NodeKey nodeKey = Arguments.<NodeKey>checkInstanceOf(key, NodeKey.class);
- return nodeKey.getId();
+ public static NodeId toNodeId(final InstanceIdentifier<?> id) {
+ final NodeKey key = id.firstKeyOf(Node.class, NodeKey.class);
+ Preconditions.checkArgument(key != null, "No node identifier found in %s", id);
+ return key.getId();
}
public static String toADNodeId(final NodeId nodeId) {
- Preconditions.<NodeId>checkNotNull(nodeId);
return nodeId.getValue();
}
public static org.opendaylight.controller.sal.core.NodeConnector toADNodeConnector(final NodeConnectorRef source) throws ConstructionException {
- Preconditions.<NodeConnectorRef>checkNotNull(source);
- final InstanceIdentifier<?> path = Preconditions.<InstanceIdentifier<? extends Object>>checkNotNull(source.getValue());
- Preconditions.checkArgument(path.getPath().size() >= 3);
- final PathArgument arg = path.getPath().get(2);
- final IdentifiableItem item = Arguments.<IdentifiableItem>checkInstanceOf(arg,IdentifiableItem.class);
- final NodeConnectorKey connectorKey = Arguments.<NodeConnectorKey>checkInstanceOf(item.getKey(), NodeConnectorKey.class);
- return NodeMapping.toADNodeConnector(connectorKey.getId(), NodeMapping.toNodeId(path));
+ final InstanceIdentifier<?> id = Preconditions.checkNotNull(source.getValue());
+ final NodeConnectorKey key = id.firstKeyOf(NodeConnector.class, NodeConnectorKey.class);
+ return NodeMapping.toADNodeConnector(key.getId(), NodeMapping.toNodeId(id));
}
public static org.opendaylight.controller.sal.core.NodeConnector toADNodeConnector(final NodeConnectorId ncid, final NodeId nid) throws ConstructionException {
public static NodeConnectorRef toNodeConnectorRef(final org.opendaylight.controller.sal.core.NodeConnector nodeConnector) {
final NodeRef node = NodeMapping.toNodeRef(nodeConnector.getNode());
+ @SuppressWarnings("unchecked")
final InstanceIdentifier<Node> nodePath = ((InstanceIdentifier<Node>) node.getValue());
NodeConnectorId nodeConnectorId = null;
<!-- Clustering -->
<module>remoterpc-routingtable/implementation</module>
<module>sal-remoterpc-connector/implementation</module>
- <!--module>clustered-data-store/implementation</module>
- -->
<!-- Documentation -->
<module>sal-rest-docgen</module>
<modules>
<module>sal-binding-it</module>
<module>sal-binding-dom-it</module>
- <!--module>clustered-data-store/integrationtest</module -->
- <!--module>zeromq-routingtable/integrationtest</module -->
- <!--module>sal-remoterpc-connector/integrationtest</module -->
- <!--module>test/sal-rest-connector-it</modulei -->
</modules>
</profile>
</profiles>
+++ /dev/null
-<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.controller</groupId>
- <artifactId>sal-parent</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
- <artifactId>sal-binding-spi</artifactId>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-core-api</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>concepts-lang</artifactId>
- <version>0.5-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
+++ /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.controller.sal.binding.spi;
-
-import org.opendaylight.controller.concepts.lang.Transformer;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-
-public interface DataDomToJavaTransformer<P extends DataObject> extends Transformer<CompositeNode, P> {
-
- /**
- * Returns a QName of valid input composite node.
- *
- * @return
- */
- QName getQName();
-}
+++ /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.controller.sal.binding.spi;
-
-import org.opendaylight.controller.concepts.lang.InputClassBasedTransformer;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-
-public interface JavaToDataDomTransformer<I extends DataObject> extends
- InputClassBasedTransformer<DataObject, I, CompositeNode> {
-}
+++ /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.controller.sal.binding.spi;
-
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-/**
- * Translator between Binding-Independent format and generated Binding Data Objects
- *
- *
- *
- *
- * @param <T> Result Type
- */
-public interface Mapper<T extends DataObject> {
-
- QName getQName();
- Class<T> getDataObjectClass();
- T objectFromDom(CompositeNode object);
-
- /**
- *
- * @param obj
- * @return
- * @throws IllegalArgumentException
- */
- CompositeNode domFromObject(DataObject obj) throws IllegalArgumentException;
-
-}
+++ /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.controller.sal.binding.spi;
-
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.RpcService;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-
-public interface MappingProvider {
-
- <T extends DataObject> Mapper<T> mapperForClass(Class<T> type);
- Mapper<DataObject> mapperForQName(QName name);
-
- /**
- * Returns {@link RpcMapper} associated to class
- *
- * @param type Class for which RpcMapper should provide mapping
- * @return
- */
- <T extends RpcService> RpcMapper<T> rpcMapperForClass(Class<T> type);
-
- /**
- * Returns {@link RpcMapper} associated to the {@link RpcService} proxy.
- *
- * @param proxy
- * @return
- */
- RpcMapper<? extends RpcService> rpcMapperForProxy(RpcService proxy);
-
- /**
- *
- *
- * @param rpc
- * @param inputNode
- * @return
- */
- RpcMapper<? extends RpcService> rpcMapperForData(QName rpc,
- CompositeNode inputNode);
-
- <T extends MappingExtension> MappingExtensionFactory<T> getExtensionFactory(Class<T> cls);
-
- public interface MappingExtension {
-
- }
-
- public interface MappingExtensionFactory<T> {
- T forClass(Class<?> obj);
- }
-
-
-
-}
+++ /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.controller.sal.binding.spi;
-
-import java.util.Set;
-import java.util.concurrent.Future;
-
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.RpcService;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
-public interface RpcMapper<T extends RpcService> {
-
- Set<QName> getRpcQNames();
-
- /**
- * Returns a class object representing subinterface
- * to whom, this mapper is assigned.
- *
- * @return
- */
- Class<T> getServiceClass();
-
- /**
- * Returns a Binding Mapper for Rpc Input Data
- * @return
- */
- Mapper<?> getInputMapper();
- /**
- * Returns a Binding Mapper for Rpc Output Data
- *
- * @return
- */
- Mapper<?> getOutputMapper();
-
- /**
- * Returns a consumer proxy, which is responsible
- * for invoking the rpc functionality of {@link BindingAwareBroker} implementation.
- *
- * @return Proxy of {@link RpcService} assigned to this mapper.
- */
- T getConsumerProxy(RpcProxyInvocationHandler handler);
-
- /**
- * Invokes the method of RpcService representing the supplied rpc.
- *
- * @param rpc QName of Rpc
- * @param impl Implementation of RpcService on which the method should be invoked
- * @param baInput Input Data to RPC method
- * @return Result of RPC invocation.
- */
- RpcResult<? extends DataObject> invokeRpcImplementation(QName rpc,
- RpcService impl, DataObject baInput);
-
- public interface RpcProxyInvocationHandler {
-
- Future<RpcResult<? extends DataObject>> invokeRpc(RpcService proxy, QName rpc, DataObject input);
- }
-}
*/
package org.opendaylight.controller.sal.common.util;
-public class Arguments {
+public final class Arguments {
private Arguments() {
throw new UnsupportedOperationException("Utility class");
}
-
+
/**
* Checks if value is instance of provided class
- *
- *
+ *
+ *
* @param value Value to check
* @param type Type to check
* @return Reference which was checked
@SuppressWarnings("unchecked")
public static <T> T checkInstanceOf(Object value, Class<T> type) {
if(!type.isInstance(value))
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.format("Value %s is not of type %s", value, type));
return (T) value;
}
}
+++ /dev/null
-<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">\r
- <modelVersion>4.0.0</modelVersion>\r
- <parent>\r
- <groupId>org.opendaylight.controller</groupId>\r
- <artifactId>sal-parent</artifactId>\r
- <version>1.0-SNAPSHOT</version>\r
- </parent>\r
- <artifactId>sal-data-api</artifactId>\r
- <scm>\r
- <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>\r
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>\r
- <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>\r
- </scm>\r
-\r
-</project>\r
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.sal.dom.store.impl;
-
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.StoreMetadataNode;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.TreeNodeUtils;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-
-import com.google.common.base.Optional;
-
-class DataAndMetadataSnapshot {
-
- private final StoreMetadataNode metadataTree;
- private final Optional<SchemaContext> schemaContext;
-
- private DataAndMetadataSnapshot(final StoreMetadataNode metadataTree, final Optional<SchemaContext> schemaCtx) {
- this.metadataTree = metadataTree;
- this.schemaContext = schemaCtx;
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static DataAndMetadataSnapshot createEmpty() {
- return createEmpty(new NodeIdentifier(SchemaContext.NAME));
- }
-
-
- public static DataAndMetadataSnapshot createEmpty(final NodeIdentifier rootNode) {
- NormalizedNode<?, ?> data = Builders.containerBuilder().withNodeIdentifier(rootNode).build();
- StoreMetadataNode metadata = StoreMetadataNode.createEmpty(data);
- return new DataAndMetadataSnapshot(metadata,Optional.<SchemaContext>absent());
- }
-
- public static DataAndMetadataSnapshot createEmpty(final SchemaContext ctx) {
- NodeIdentifier rootNodeIdentifier = new NodeIdentifier(ctx.getQName());
- NormalizedNode<?, ?> data = Builders.containerBuilder().withNodeIdentifier(rootNodeIdentifier).build();
- StoreMetadataNode metadata = StoreMetadataNode.createEmpty(data);
- return new DataAndMetadataSnapshot(metadata, Optional.of(ctx));
- }
-
- public Optional<SchemaContext> getSchemaContext() {
- return schemaContext;
- }
-
- public NormalizedNode<?, ?> getDataTree() {
- return metadataTree.getData();
- }
-
- public StoreMetadataNode getMetadataTree() {
- return metadataTree;
- }
-
- public Optional<StoreMetadataNode> read(final InstanceIdentifier path) {
- return TreeNodeUtils.findNode(metadataTree, path);
- }
-
- public static class Builder {
- private StoreMetadataNode metadataTree;
- private SchemaContext schemaContext;
-
- public Builder setMetadataTree(final StoreMetadataNode metadataTree) {
- this.metadataTree = metadataTree;
- return this;
- }
-
- public Builder setSchemaContext(final SchemaContext schemaContext) {
- this.schemaContext = schemaContext;
- return this;
- }
-
- public DataAndMetadataSnapshot build() {
- return new DataAndMetadataSnapshot(metadataTree, Optional.fromNullable(schemaContext));
- }
-
- }
-}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.md.sal.dom.store.impl;
+
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.opendaylight.controller.md.sal.dom.store.impl.tree.StoreMetadataNode;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
+import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeUtils;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+
+/**
+ * Read-only snapshot of the data tree.
+ */
+final class DataTree {
+ public static final class Snapshot {
+ private final SchemaContext schemaContext;
+ private final StoreMetadataNode rootNode;
+
+ @VisibleForTesting
+ Snapshot(final SchemaContext schemaContext, final StoreMetadataNode rootNode) {
+ this.schemaContext = Preconditions.checkNotNull(schemaContext);
+ this.rootNode = Preconditions.checkNotNull(rootNode);
+ }
+
+ public SchemaContext getSchemaContext() {
+ return schemaContext;
+ }
+
+ public Optional<NormalizedNode<?, ?>> readNode(final InstanceIdentifier path) {
+ return NormalizedNodeUtils.findNode(rootNode.getData(), path);
+ }
+
+ // FIXME: this is a leak of information
+ @Deprecated
+ StoreMetadataNode getRootNode() {
+ return rootNode;
+ }
+
+ @Override
+ public String toString() {
+ return rootNode.getSubtreeVersion().toString();
+ }
+ }
+
+ private static final Logger LOG = LoggerFactory.getLogger(DataTree.class);
+ private final ReadWriteLock rwLock = new ReentrantReadWriteLock(true);
+ private StoreMetadataNode rootNode;
+ private SchemaContext currentSchemaContext;
+
+ private DataTree(StoreMetadataNode rootNode, final SchemaContext schemaContext) {
+ this.rootNode = Preconditions.checkNotNull(rootNode);
+ this.currentSchemaContext = schemaContext;
+ }
+
+ public synchronized void setSchemaContext(final SchemaContext newSchemaContext) {
+ Preconditions.checkNotNull(newSchemaContext);
+
+ LOG.info("Attepting to install schema context {}", newSchemaContext);
+
+ /*
+ * FIXME: we should walk the schema contexts, both current and new and see
+ * whether they are compatible here. Reject incompatible changes.
+ */
+
+ // Ready to change the context now, make sure no operations are running
+ rwLock.writeLock().lock();
+ try {
+ this.currentSchemaContext = newSchemaContext;
+ } finally {
+ rwLock.writeLock().unlock();
+ }
+ }
+
+ public static DataTree create(final SchemaContext schemaContext) {
+ final NodeIdentifier root = new NodeIdentifier(SchemaContext.NAME);
+ final NormalizedNode<?, ?> data = Builders.containerBuilder().withNodeIdentifier(root).build();
+
+ return new DataTree(StoreMetadataNode.createEmpty(data), schemaContext);
+ }
+
+ public Snapshot takeSnapshot() {
+ rwLock.readLock().lock();
+
+ try {
+ return new Snapshot(currentSchemaContext, rootNode);
+ } finally {
+ rwLock.readLock().unlock();
+ }
+ }
+
+ public void commitSnapshot(Snapshot currentSnapshot, StoreMetadataNode newDataTree) {
+ // Ready to change the context now, make sure no operations are running
+ rwLock.writeLock().lock();
+ try {
+ Preconditions.checkState(currentSnapshot.rootNode == rootNode,
+ String.format("Store snapshot %s and transaction snapshot %s differ.",
+ rootNode, currentSnapshot.rootNode));
+
+ this.rootNode = newDataTree;
+ } finally {
+ rwLock.writeLock().unlock();
+ }
+ }
+}
import java.util.Collections;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeUtils;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
import org.slf4j.Logger;
private final ListeningExecutorService executor;
private final String name;
private final AtomicLong txCounter = new AtomicLong(0);
- private final ListenerTree listenerTree;
- private final AtomicReference<DataAndMetadataSnapshot> snapshot;
-
- private ModificationApplyOperation operationTree;
-
- private SchemaContext schemaContext;
+ private final ListenerTree listenerTree = ListenerTree.create();
+ private final DataTree dataTree = DataTree.create(null);
+ private ModificationApplyOperation operationTree = new AlwaysFailOperation();
public InMemoryDOMDataStore(final String name, final ListeningExecutorService executor) {
this.name = Preconditions.checkNotNull(name);
this.executor = Preconditions.checkNotNull(executor);
- this.listenerTree = ListenerTree.create();
- this.snapshot = new AtomicReference<DataAndMetadataSnapshot>(DataAndMetadataSnapshot.createEmpty());
- this.operationTree = new AlwaysFailOperation();
}
@Override
@Override
public DOMStoreReadTransaction newReadOnlyTransaction() {
- return new SnapshotBackedReadTransaction(nextIdentifier(), snapshot.get());
+ return new SnapshotBackedReadTransaction(nextIdentifier(), dataTree.takeSnapshot());
}
@Override
public DOMStoreReadWriteTransaction newReadWriteTransaction() {
- return new SnapshotBackedReadWriteTransaction(nextIdentifier(), snapshot.get(), this, operationTree);
+ return new SnapshotBackedReadWriteTransaction(nextIdentifier(), dataTree.takeSnapshot(), this, operationTree);
}
@Override
public DOMStoreWriteTransaction newWriteOnlyTransaction() {
- return new SnapshotBackedWriteTransaction(nextIdentifier(), snapshot.get(), this, operationTree);
+ return new SnapshotBackedWriteTransaction(nextIdentifier(), dataTree.takeSnapshot(), this, operationTree);
}
@Override
public synchronized void onGlobalContextUpdated(final SchemaContext ctx) {
- operationTree = SchemaAwareApplyOperationRoot.from(ctx);
- schemaContext = ctx;
+ /*
+ * Order of operations is important: dataTree may reject the context
+ * and creation of ModificationApplyOperation may fail. So pre-construct
+ * the operation, then update the data tree and then move the operation
+ * into view.
+ */
+ final ModificationApplyOperation newOperationTree = SchemaAwareApplyOperationRoot.from(ctx);
+ dataTree.setSchemaContext(ctx);
+ operationTree = newOperationTree;
}
@Override
reg = listenerTree.registerDataChangeListener(path, listener, scope);
- Optional<StoreMetadataNode> currentState = snapshot.get().read(path);
+ Optional<NormalizedNode<?, ?>> currentState = dataTree.takeSnapshot().readNode(path);
if (currentState.isPresent()) {
- final NormalizedNode<?, ?> data = currentState.get().getData();
+ final NormalizedNode<?, ?> data = currentState.get();
final DOMImmutableDataChangeEvent event = DOMImmutableDataChangeEvent.builder(DataChangeScope.BASE) //
.setAfter(data) //
return name + "-" + txCounter.getAndIncrement();
}
- private void commit(final DataAndMetadataSnapshot currentSnapshot, final StoreMetadataNode newDataTree,
+ private void commit(final DataTree.Snapshot currentSnapshot, final StoreMetadataNode newDataTree,
final ResolveDataChangeEventsTask listenerResolver) {
- LOG.debug("Updating Store snaphot version: {} with version:{}", currentSnapshot.getMetadataTree()
- .getSubtreeVersion(), newDataTree.getSubtreeVersion());
+ LOG.debug("Updating Store snaphot version: {} with version:{}", currentSnapshot, newDataTree.getSubtreeVersion());
if (LOG.isTraceEnabled()) {
LOG.trace("Data Tree is {}", StoreUtils.toStringTree(newDataTree.getData()));
}
- final DataAndMetadataSnapshot newSnapshot = DataAndMetadataSnapshot.builder() //
- .setMetadataTree(newDataTree) //
- .setSchemaContext(schemaContext) //
- .build();
-
/*
* The commit has to occur atomically with regard to listener
* registrations.
*/
synchronized (this) {
- final boolean success = snapshot.compareAndSet(currentSnapshot, newSnapshot);
- checkState(success, "Store snapshot and transaction snapshot differ. This should never happen.");
+ dataTree.commitSnapshot(currentSnapshot, newDataTree);
for (ChangeListenerNotifyTask task : listenerResolver.call()) {
LOG.trace("Scheduling invocation of listeners: {}", task);
}
}
- private static class SnapshotBackedReadTransaction extends AbstractDOMStoreTransaction implements
+ private static final class SnapshotBackedReadTransaction extends AbstractDOMStoreTransaction implements
DOMStoreReadTransaction {
- private DataAndMetadataSnapshot stableSnapshot;
+ private DataTree.Snapshot stableSnapshot;
- public SnapshotBackedReadTransaction(final Object identifier, final DataAndMetadataSnapshot snapshot) {
+ public SnapshotBackedReadTransaction(final Object identifier, final DataTree.Snapshot snapshot) {
super(identifier);
this.stableSnapshot = Preconditions.checkNotNull(snapshot);
- LOG.debug("ReadOnly Tx: {} allocated with snapshot {}", identifier, snapshot.getMetadataTree()
- .getSubtreeVersion());
+ LOG.debug("ReadOnly Tx: {} allocated with snapshot {}", identifier, snapshot);
}
@Override
public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final InstanceIdentifier path) {
checkNotNull(path, "Path must not be null.");
checkState(stableSnapshot != null, "Transaction is closed");
- return Futures.immediateFuture(NormalizedNodeUtils.findNode(stableSnapshot.getDataTree(), path));
+ return Futures.immediateFuture(stableSnapshot.readNode(path));
}
}
private InMemoryDOMDataStore store;
private boolean ready = false;
- public SnapshotBackedWriteTransaction(final Object identifier, final DataAndMetadataSnapshot snapshot,
+ public SnapshotBackedWriteTransaction(final Object identifier, final DataTree.Snapshot snapshot,
final InMemoryDOMDataStore store, final ModificationApplyOperation applyOper) {
super(identifier);
mutableTree = MutableDataTree.from(snapshot, applyOper);
this.store = store;
- LOG.debug("Write Tx: {} allocated with snapshot {}", identifier, snapshot.getMetadataTree()
- .getSubtreeVersion());
+ LOG.debug("Write Tx: {} allocated with snapshot {}", identifier, snapshot);
}
@Override
private static class SnapshotBackedReadWriteTransaction extends SnapshotBackedWriteTransaction implements
DOMStoreReadWriteTransaction {
- protected SnapshotBackedReadWriteTransaction(final Object identifier, final DataAndMetadataSnapshot snapshot,
+ protected SnapshotBackedReadWriteTransaction(final Object identifier, final DataTree.Snapshot snapshot,
final InMemoryDOMDataStore store, final ModificationApplyOperation applyOper) {
super(identifier, snapshot, store, applyOper);
}
private final SnapshotBackedWriteTransaction transaction;
private final NodeModification modification;
- private DataAndMetadataSnapshot storeSnapshot;
+ private DataTree.Snapshot storeSnapshot;
private Optional<StoreMetadataNode> proposedSubtree;
private ResolveDataChangeEventsTask listenerResolver;
@Override
public ListenableFuture<Boolean> canCommit() {
- final DataAndMetadataSnapshot snapshotCapture = snapshot.get();
+ final DataTree.Snapshot snapshotCapture = dataTree.takeSnapshot();
final ModificationApplyOperation snapshotOperation = operationTree;
return executor.submit(new Callable<Boolean>() {
Boolean applicable = false;
try {
snapshotOperation.checkApplicable(PUBLIC_ROOT_PATH, modification,
- Optional.of(snapshotCapture.getMetadataTree()));
+ Optional.of(snapshotCapture.getRootNode()));
applicable = true;
} catch (DataPreconditionFailedException e) {
LOG.warn("Store Tx: {} Data Precondition failed for {}.",transaction.getIdentifier(),e.getPath(),e);
@Override
public ListenableFuture<Void> preCommit() {
- storeSnapshot = snapshot.get();
+ storeSnapshot = dataTree.takeSnapshot();
if (modification.getModificationType() == ModificationType.UNMODIFIED) {
return Futures.immediateFuture(null);
}
@Override
public Void call() throws Exception {
- StoreMetadataNode metadataTree = storeSnapshot.getMetadataTree();
+ StoreMetadataNode metadataTree = storeSnapshot.getRootNode();
proposedSubtree = operationTree.apply(modification, Optional.of(metadataTree),
increase(metadataTree.getSubtreeVersion()));
private static final Logger LOG = LoggerFactory.getLogger(MutableDataTree.class);
private final AtomicBoolean sealed = new AtomicBoolean();
private final ModificationApplyOperation strategyTree;
- private final DataAndMetadataSnapshot snapshot;
private final NodeModification rootModification;
+ private final DataTree.Snapshot snapshot;
- private MutableDataTree(final DataAndMetadataSnapshot snapshot, final ModificationApplyOperation strategyTree) {
- this.snapshot = snapshot;
- this.strategyTree = strategyTree;
- this.rootModification = NodeModification.createUnmodified(snapshot.getMetadataTree());
+ private MutableDataTree(final DataTree.Snapshot snapshot, final ModificationApplyOperation strategyTree) {
+ this.snapshot = Preconditions.checkNotNull(snapshot);
+ this.strategyTree = Preconditions.checkNotNull(strategyTree);
+ this.rootModification = NodeModification.createUnmodified(snapshot.getRootNode());
}
public void write(final InstanceIdentifier path, final NormalizedNode<?, ?> value) {
return potentialSnapshot.get();
}
return resolveModificationStrategy(path).apply(modification, modification.getOriginal(),
- StoreUtils.increase(snapshot.getMetadataTree().getSubtreeVersion()));
+ StoreUtils.increase(snapshot.getRootNode().getSubtreeVersion()));
} catch (Exception e) {
LOG.error("Could not create snapshot for {}:{}", path,modification,e);
throw e;
return OperationWithModification.from(operation, modification);
}
- public static MutableDataTree from(final DataAndMetadataSnapshot snapshot, final ModificationApplyOperation resolver) {
+ public static MutableDataTree from(final DataTree.Snapshot snapshot, final ModificationApplyOperation resolver) {
return new MutableDataTree(snapshot, resolver);
}
@Test
public void basicReadWrites() {
- MutableDataTree modificationTree = MutableDataTree.from(
- DataAndMetadataSnapshot.builder() //
- .setMetadataTree(StoreMetadataNode.createRecursively(createDocumentOne(), UnsignedLong.valueOf(5))) //
- .setSchemaContext(schemaContext) //
- .build(), new SchemaAwareApplyOperationRoot(schemaContext));
+ MutableDataTree modificationTree = MutableDataTree.from(new DataTree.Snapshot(schemaContext,
+ StoreMetadataNode.createRecursively(createDocumentOne(), UnsignedLong.valueOf(5))),
+ new SchemaAwareApplyOperationRoot(schemaContext));
Optional<NormalizedNode<?, ?>> originalBarNode = modificationTree.read(OUTER_LIST_2_PATH);
assertTrue(originalBarNode.isPresent());
assertSame(BAR_NODE, originalBarNode.get());
/**
* Creates empty Snapshot with associated schema context.
*/
- DataAndMetadataSnapshot emptySnapshot = DataAndMetadataSnapshot.createEmpty(schemaContext);
+ DataTree t = DataTree.create(schemaContext);
/**
*
* context.
*
*/
- MutableDataTree modificationTree = MutableDataTree.from(emptySnapshot, new SchemaAwareApplyOperationRoot(
+ MutableDataTree modificationTree = MutableDataTree.from(t.takeSnapshot(), new SchemaAwareApplyOperationRoot(
schemaContext));
return modificationTree;
}
+++ /dev/null
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
- <modelVersion>4.0.0</modelVersion>\r
- <parent>\r
- <groupId>org.opendaylight.controller</groupId>\r
- <artifactId>sal-parent</artifactId>\r
- <version>1.0-SNAPSHOT</version>\r
- </parent>\r
- <artifactId>sal-core-demo</artifactId>\r
- <scm>\r
- <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>\r
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>\r
- <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>\r
- </scm>\r
-\r
- <dependencies>\r
- <dependency>\r
- <groupId>org.opendaylight.controller</groupId>\r
- <artifactId>sal-broker-impl</artifactId>\r
- <version>1.0-SNAPSHOT</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.opendaylight.controller</groupId>\r
- <artifactId>yang-data-util</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.slf4j</groupId>\r
- <artifactId>slf4j-simple</artifactId>\r
- <version>1.7.2</version>\r
- <scope>runtime</scope>\r
- </dependency>\r
- </dependencies>\r
- <build>\r
- <plugins>\r
- <plugin>\r
- <artifactId>maven-assembly-plugin</artifactId>\r
- <version>2.4</version>\r
- <configuration>\r
- <descriptorRefs>\r
- <descriptorRef>jar-with-dependencies</descriptorRef>\r
- </descriptorRefs>\r
- <archive>\r
- <manifest>\r
- <mainClass>org.opendaylight.controller.sal.demo.SALDemo</mainClass>\r
- </manifest>\r
- </archive>\r
- </configuration>\r
- <executions>\r
- <execution>\r
- <id>make-assembly</id>\r
- <phase>package</phase>\r
- <goals>\r
- <goal>single</goal>\r
- </goals>\r
- </execution>\r
- </executions>\r
- </plugin>\r
-\r
- </plugins>\r
-\r
- </build>\r
-</project>\r
+++ /dev/null
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.sal.demo;\r
-\r
-import java.util.Collection;\r
-import java.util.HashSet;\r
-import java.util.Set;\r
-\r
-import org.opendaylight.controller.sal.core.api.Consumer;\r
-import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession;\r
-import org.opendaylight.controller.sal.core.api.notify.NotificationListener;\r
-import org.opendaylight.controller.sal.core.api.notify.NotificationService;\r
-import org.opendaylight.controller.yang.common.QName;\r
-import org.opendaylight.controller.yang.data.api.CompositeNode;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-\r
-public class DemoConsumerImpl implements Consumer {\r
-\r
- private ConsumerSession session;\r
- private NotificationService notificationService;\r
- private final String name;\r
- private static Logger log = LoggerFactory.getLogger("AlertLogger");\r
-\r
- private boolean changeAware;\r
-\r
- public DemoConsumerImpl(String name) {\r
- this.name = name;\r
- }\r
-\r
- private NotificationListener alertLogger = new NotificationListener() {\r
-\r
- @Override\r
- public void onNotification(CompositeNode notification) {\r
- System.out.println(name\r
- + ": Received alert: "\r
- + notification.getFirstSimpleByName(\r
- DemoUtils.contentNodeName).getValue());\r
- log.info("AlertLogger: Received notification: " + notification);\r
- }\r
-\r
- @Override\r
- public Set<QName> getSupportedNotifications() {\r
- Set<QName> supported = new HashSet<QName>();\r
- supported.add(DemoUtils.alertNotification);\r
- return supported;\r
- }\r
- };\r
-\r
- private NotificationListener changeLogger = new NotificationListener() {\r
-\r
- @Override\r
- public void onNotification(CompositeNode notification) {\r
- System.out.println(name\r
- + ": Received change: "\r
- + notification.getFirstSimpleByName(\r
- DemoUtils.contentNodeName).getValue());\r
- log.info("ChangeLogger: Received notification: " + notification);\r
- }\r
-\r
- @Override\r
- public Set<QName> getSupportedNotifications() {\r
- Set<QName> supported = new HashSet<QName>();\r
- supported.add(DemoUtils.alertNotification);\r
- return supported;\r
- }\r
- };\r
-\r
- @Override\r
- public void onSessionInitiated(ConsumerSession session) {\r
- this.session = session;\r
- this.notificationService = session\r
- .getService(NotificationService.class);\r
- notificationService.addNotificationListener(\r
- DemoUtils.alertNotification, alertLogger);\r
- if (isChangeAware()) {\r
- notificationService.addNotificationListener(\r
- DemoUtils.changeNotification, changeLogger);\r
- }\r
- }\r
-\r
- @Override\r
- public Collection<ConsumerFunctionality> getConsumerFunctionality() {\r
- Set<ConsumerFunctionality> func = new HashSet<ConsumerFunctionality>();\r
- func.add(alertLogger);\r
- return func;\r
- }\r
-\r
- public void closeSession() {\r
- session.close();\r
- }\r
-\r
- public boolean isChangeAware() {\r
- return changeAware;\r
- }\r
-\r
- public void setChangeAware(boolean changeAware) {\r
- this.changeAware = changeAware;\r
- }\r
-\r
-}\r
+++ /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.controller.sal.demo;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
-import org.opendaylight.controller.sal.core.api.notify.NotificationProviderService;
-import org.opendaylight.controller.yang.data.api.Node;
-import org.opendaylight.controller.yang.data.util.Nodes;
-
-
-public class DemoProviderImpl implements
- org.opendaylight.controller.sal.core.api.Provider {
-
- private ProviderSession session;
- private NotificationProviderService notifier;
-
- @Override
- public void onSessionInitiated(ProviderSession session) {
- this.session = session;
- notifier = session.getService(NotificationProviderService.class);
- }
-
- @Override
- public Collection<ProviderFunctionality> getProviderFunctionality() {
- return Collections.emptySet();
- }
-
- public void sendAlertNotification(String content) {
- List<Node<?>> nodes = new ArrayList<Node<?>>();
- nodes.add(DemoUtils.contentNode(content));
-
- if (notifier == null) {
- System.out.println("Provider: Error: Session not available");
- System.out
- .println(" Notification Service not available");
- return;
- }
- notifier.sendNotification(Nodes.containerNode(
- DemoUtils.alertNotification, nodes));
- }
-
- public void sendChangeNotification(String content) {
- List<Node<?>> nodes = new ArrayList<Node<?>>();
- nodes.add(DemoUtils.contentNode(content));
-
- if (notifier == null) {
- System.out.println("Provider: Error: Session not available");
- System.out
- .println(" Notification Service not available");
- return;
- }
- notifier.sendNotification(Nodes.containerNode(
- DemoUtils.changeNotification, nodes));
- }
-
- public void closeSession() {
- session.close();
- }
-}
+++ /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.controller.sal.demo;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Date;
-
-import org.opendaylight.controller.yang.common.QName;
-import org.opendaylight.controller.yang.data.api.Node;
-import org.opendaylight.controller.yang.data.util.Nodes;
-
-
-public class DemoUtils {
-
- public static final URI namespace = uri("urn:cisco:prototype:sal:demo");
- public static final Date revision = new Date();
-
- public static final QName alertNotification = qName("alert");
- public static final QName changeNotification = qName("change");
-
- public static final QName contentNodeName = qName("content");
-
- public static URI uri(String str) {
- try {
- return new URI(str);
- } catch (URISyntaxException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- public static QName qName(String str) {
- return new QName(namespace, revision, str);
- }
-
- public static Node<?> contentNode(String content) {
- return Nodes.leafNode(contentNodeName, content);
- }
-}
+++ /dev/null
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.sal.demo;\r
-\r
-import java.io.BufferedReader;\r
-import java.io.IOException;\r
-import java.io.InputStreamReader;\r
-\r
-import org.opendaylight.controller.sal.core.impl.BrokerImpl;\r
-import org.opendaylight.controller.sal.core.impl.NotificationModule;\r
-\r
-\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-public class SALDemo {\r
- protected static final Logger logger = LoggerFactory\r
- .getLogger(SALDemo.class);\r
-\r
- static BrokerImpl broker;\r
- static DemoProviderImpl provider;\r
- static DemoConsumerImpl consumer1;\r
- static DemoConsumerImpl consumer2;\r
-\r
- public static void main(String[] args) {\r
-\r
- initialize();\r
- initializeProvider();\r
- displayHelp();\r
-\r
- BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\r
- String s;\r
- try {\r
- while (true) {\r
-\r
- System.out.print("\nEnter your choice (0 - list): ");\r
- s = in.readLine();\r
- int choice = Integer.parseInt(s.trim());\r
- try {\r
- switch (choice) {\r
- case 0:\r
- displayHelp();\r
- break;\r
- case 1:\r
- registerProvider();\r
- break;\r
- case 2:\r
- registerConsumer1();\r
- break;\r
- case 3:\r
- registerConsumer2();\r
- break;\r
- case 4:\r
- sendAlert(in);\r
- break;\r
- case 5:\r
- sendChange(in);\r
- break;\r
- case 6:\r
- unregisterConsumer1();\r
- break;\r
- case 7:\r
- unregisterConsumer2();\r
- break;\r
- case 8:\r
- unregisterProvider();\r
- break;\r
- case 9:\r
- return;\r
- default:\r
- System.out.println("Please enter valid input.");\r
- break;\r
- }\r
- } catch (Exception e) {\r
- System.out\r
- .println("Operation failed. Reason exception raised: "\r
- + e.getClass().getSimpleName());\r
- System.out.println(" Message: " + e.getMessage());\r
- }\r
-\r
- }\r
- } catch (IOException e) {\r
-\r
- logger.error("",e);\r
- }\r
- }\r
-\r
- private static void registerConsumer1() {\r
- broker.registerConsumer(consumer1);\r
- }\r
-\r
- private static void registerConsumer2() {\r
- broker.registerConsumer(consumer2);\r
- }\r
-\r
- private static void sendAlert(BufferedReader in) throws IOException {\r
- System.out.print("Please enter notification content:");\r
- String content = in.readLine();\r
- provider.sendAlertNotification(content);\r
- }\r
-\r
- private static void sendChange(BufferedReader in) throws IOException {\r
- System.out.print("Please enter notification content:");\r
- String content = in.readLine();\r
- provider.sendChangeNotification(content);\r
- }\r
-\r
- private static void unregisterConsumer1() {\r
- consumer1.closeSession();\r
- }\r
-\r
- private static void unregisterConsumer2() {\r
- consumer2.closeSession();\r
- }\r
-\r
- private static void unregisterProvider() {\r
- provider.closeSession();\r
- }\r
-\r
- private static void displayHelp() {\r
- System.out.println("Usage: ");\r
- System.out.println(" 0) Display Help");\r
- System.out.println(" 1) Register Provider");\r
- System.out.println(" 2) Register Consumer 1 (listening on alert)");\r
- System.out\r
- .println(" 3) Register Consumer 2 (listening on alert,change)");\r
- System.out.println(" 4) Send Alert Notification");\r
- System.out.println(" 5) Send Change Notification");\r
- System.out.println(" 6) Unregister Consumer 1");\r
- System.out.println(" 7) Unregister Consumer 2");\r
- System.out.println(" 8) Unregister Provider");\r
- System.out.println(" 9) Exit");\r
-\r
- }\r
-\r
- private static void initializeProvider() {\r
- provider = new DemoProviderImpl();\r
- }\r
-\r
- private static void initialize() {\r
- System.out.println("Initializing broker");\r
- broker = new BrokerImpl();\r
- NotificationModule notifyModule = new NotificationModule();\r
- broker.addModule(notifyModule);\r
-\r
- consumer1 = new DemoConsumerImpl("Consumer 1");\r
- consumer2 = new DemoConsumerImpl("Consumer 2");\r
- consumer2.setChangeAware(true);\r
- }\r
-\r
- private static void registerProvider() {\r
- broker.registerProvider(provider);\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.sal.demo;
\ No newline at end of file
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
/**
* InventoryService provides functions related to Nodes & NodeConnectors.
import org.opendaylight.controller.sal.utils.HexEncode;
import org.opendaylight.controller.sal.utils.NetUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.address.tracker.rev140402.l2.addresses.L2Address;
+++ /dev/null
-<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>
- <artifactId>sal-test-parent</artifactId>
- <groupId>org.opendaylight.controller.tests</groupId>
- <version>1.0-SNAPSHOT</version>
- </parent>
- <artifactId>sal-rest-connector-it</artifactId>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
- </scm>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>maven-paxexam-plugin</artifactId>
- <version>1.2.4</version>
- <executions>
- <execution>
- <id>generate-config</id>
- <goals>
- <goal>generate-depends-file</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse
- m2e settings only. It has no influence on the Maven build itself. -->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- org.ops4j.pax.exam
- </groupId>
- <artifactId>
- maven-paxexam-plugin
- </artifactId>
- <versionRange>
- [1.2.4,)
- </versionRange>
- <goals>
- <goal>
- generate-depends-file
- </goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore></ignore>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>logging.bridge</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools.thirdparty</groupId>
- <artifactId>xtend-lib-osgi</artifactId>
- <version>2.4.3</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>bundlescanner.implementation</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-broker-impl</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-rest-connector</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-netconf-connector</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-it</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-container-native</artifactId>
- <version>${exam.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-junit4</artifactId>
- <version>${exam.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>${netty.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-link-mvn</artifactId>
- <version>${exam.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.eclipse.osgi</artifactId>
- <version>3.8.1.v20120830-144521</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>log4j-over-slf4j</artifactId>
- <version>1.7.2</version>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- <version>1.0.9</version>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>1.0.9</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-util</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-core-api</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller.model</groupId>
- <artifactId>model-flow-service</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-manager</artifactId>
- <version>0.2.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller.model</groupId>
- <artifactId>model-flow-management</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools.thirdparty</groupId>
- <artifactId>antlr4-runtime-osgi-nohead</artifactId>
- <version>4.0</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-binding</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-data-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>commons.northbound</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-util</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <version>1.7.2</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
-
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>log4j-over-slf4j</artifactId>
- <version>1.7.2</version>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- <version>1.0.9</version>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>1.0.9</version>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.7</version>
- </dependency>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>javax.servlet</artifactId>
- <version>3.0.0.v201112011016</version>
- </dependency>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>javax.servlet.jsp</artifactId>
- <version>2.2.0.v201112011158</version>
- </dependency>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.eclipse.equinox.ds</artifactId>
- <version>1.4.0.v20120522-1841</version>
- </dependency>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.eclipse.equinox.util</artifactId>
- <version>1.0.400.v20120522-2049</version>
- </dependency>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.eclipse.osgi.services</artifactId>
- <version>3.3.100.v20120522-1822</version>
- </dependency>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.eclipse.osgi</artifactId>
- <version>3.8.1.v20120830-144521</version>
- </dependency>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.apache.felix.gogo.command</artifactId>
- <version>0.8.0.v201108120515</version>
- </dependency>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.apache.felix.gogo.runtime</artifactId>
- <version>0.8.0.v201108120515</version>
- </dependency>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.apache.felix.gogo.shell</artifactId>
- <version>0.8.0.v201110170705</version>
- </dependency>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.eclipse.equinox.cm</artifactId>
- <version>1.0.400.v20120522-1841</version>
- </dependency>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.eclipse.equinox.console</artifactId>
- <version>1.0.0.v20120522-1841</version>
- </dependency>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.eclipse.equinox.launcher</artifactId>
- <version>1.3.0.v20120522-1813</version>
- </dependency>
- <!-- Gemini Web -->
- <dependency>
- <groupId>geminiweb</groupId>
- <artifactId>org.eclipse.gemini.web.core</artifactId>
- <version>${geminiweb.version}</version>
- </dependency>
- <dependency>
- <groupId>geminiweb</groupId>
- <artifactId>org.eclipse.gemini.web.extender</artifactId>
- <version>${geminiweb.version}</version>
- </dependency>
- <dependency>
- <groupId>geminiweb</groupId>
- <artifactId>org.eclipse.gemini.web.tomcat</artifactId>
- <version>${geminiweb.version}</version>
- </dependency>
- <dependency>
- <groupId>geminiweb</groupId>
- <artifactId>org.eclipse.virgo.kernel.equinox.extensions</artifactId>
- <version>${virgo.version}</version>
- </dependency>
- <dependency>
- <groupId>geminiweb</groupId>
- <artifactId>org.eclipse.virgo.util.common</artifactId>
- <version>${virgo.version}</version>
- </dependency>
- <dependency>
- <groupId>geminiweb</groupId>
- <artifactId>org.eclipse.virgo.util.io</artifactId>
- <version>${virgo.version}</version>
- </dependency>
- <dependency>
- <groupId>geminiweb</groupId>
- <artifactId>org.eclipse.virgo.util.math</artifactId>
- <version>${virgo.version}</version>
- </dependency>
- <dependency>
- <groupId>geminiweb</groupId>
- <artifactId>org.eclipse.virgo.util.osgi</artifactId>
- <version>${virgo.version}</version>
- </dependency>
- <dependency>
- <groupId>geminiweb</groupId>
- <artifactId>org.eclipse.virgo.util.osgi.manifest</artifactId>
- <version>${virgo.version}</version>
- </dependency>
- <dependency>
- <groupId>geminiweb</groupId>
- <artifactId>org.eclipse.virgo.util.parser.manifest</artifactId>
- <version>${virgo.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.dependencymanager</artifactId>
- <version>3.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.dependencymanager.shell</artifactId>
- <version>3.0.1</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.spec.javax.transaction</groupId>
- <artifactId>jboss-transaction-api_1.1_spec</artifactId>
- <version>1.0.1.Final</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.fileinstall</artifactId>
- <version>3.1.6</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.1</version>
- </dependency>
- <dependency>
- <groupId>virgomirror</groupId>
- <artifactId>org.eclipse.jdt.core.compiler.batch</artifactId>
- <version>3.8.0.I20120518-2145</version>
- </dependency>
- <dependency>
- <groupId>eclipselink</groupId>
- <artifactId>javax.persistence</artifactId>
- <version>2.0.4.v201112161009</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>javax.activation</artifactId>
- <version>1.1.0.v201211130549</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>javax.annotation</artifactId>
- <version>1.1.0.v201209060031</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>javax.ejb</artifactId>
- <version>3.1.1.v201204261316</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>javax.el</artifactId>
- <version>2.2.0.v201108011116</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>javax.mail.glassfish</artifactId>
- <version>1.4.1.v201108011116</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>javax.xml.rpc</artifactId>
- <version>1.1.0.v201005080400</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>org.apache.catalina</artifactId>
- <version>7.0.32.v201211201336</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>org.apache.catalina.ha</artifactId>
- <version>7.0.32.v201211201952</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>org.apache.catalina.tribes</artifactId>
- <version>7.0.32.v201211201952</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>org.apache.coyote</artifactId>
- <version>7.0.32.v201211201952</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>org.apache.el</artifactId>
- <version>7.0.32.v201211081135</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>org.apache.jasper</artifactId>
- <version>7.0.32.v201211201952</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>org.apache.juli.extras</artifactId>
- <version>7.0.32.v201211081135</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>org.apache.tomcat.api</artifactId>
- <version>7.0.32.v201211081135</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>org.apache.tomcat.util</artifactId>
- <version>7.0.32.v201211201952</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>javax.servlet.jsp.jstl</artifactId>
- <version>1.2.0.v201105211821</version>
- </dependency>
- <dependency>
- <groupId>orbit</groupId>
- <artifactId>javax.servlet.jsp.jstl.impl</artifactId>
- <version>1.2.0.v201210211230</version>
- </dependency>
- <!-- Add Pax Exam -->
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-container-native</artifactId>
- <version>${exam.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-junit4</artifactId>
- <version>${exam.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-link-mvn</artifactId>
- <version>${exam.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.url</groupId>
- <artifactId>pax-url-aether</artifactId>
- <version>${url.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-all</artifactId>
- <version>4.1</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.asm</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.aop</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.context</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.context.support</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.core</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.beans</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.expression</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.web</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.aopalliance</groupId>
- <artifactId>com.springsource.org.aopalliance</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.web.servlet</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <!-- Spring security -->
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-config</artifactId>
- <version>${spring-security.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-core</artifactId>
- <version>${spring-security.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-web</artifactId>
- <version>${spring-security.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-taglibs</artifactId>
- <version>${spring-security.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.transaction</artifactId>
- <version>${spring-security.version}</version>
- </dependency>
- <!-- Visual VM hook -->
- <dependency>
- <groupId>org.ow2.chameleon.management</groupId>
- <artifactId>chameleon-mbeans</artifactId>
- <version>1.0.0</version>
- </dependency>
- <!-- Jersey for JAXRS -->
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-core</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <!-- <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-servlet</artifactId>
- <version>${jersey.version}</version> </dependency> -->
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-server</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-client</artifactId>
- <version>${jersey.version}</version>
- </dependency>
-
- <dependency>
- <groupId>eclipselink</groupId>
- <artifactId>javax.resource</artifactId>
- <version>1.5.0.v200906010428</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller.thirdparty</groupId>
- <artifactId>com.sun.jersey.jersey-servlet</artifactId>
- <version>1.17</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller.thirdparty</groupId>
- <artifactId>org.apache.catalina.filters.CorsFilter</artifactId>
- <version>7.0.42</version>
- </dependency>
-
-
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-manager</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>yang-jmx-generator</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>logback-config</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-persister-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-persister-file-xml-adapter</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>netconf-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>netconf-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>netconf-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>netconf-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>netconf-mapping-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-netconf-connector</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-persister-impl</artifactId>
- </dependency>
- </dependencies>
-</project>
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.test.restconf.it;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.*;
-import static org.ops4j.pax.exam.CoreOptions.junitBundles;
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.systemPackages;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-import static org.ops4j.pax.exam.CoreOptions.maven;
-
-import java.net.InetSocketAddress;
-import java.net.URI;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.connect.netconf.InventoryUtils;
-import org.opendaylight.controller.sal.connect.netconf.NetconfInventoryUtils;
-import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
-import org.opendaylight.controller.test.sal.binding.it.TestHelper;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.CoreOptions;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.util.PathUtils;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-
-import static org.opendaylight.controller.test.sal.binding.it.TestHelper.*;
-
-@RunWith(PaxExam.class)
-public class ServiceProviderController {
-
- public static final String ODL = "org.opendaylight.controller";
- public static final String YANG = "org.opendaylight.yangtools";
- public static final String SAMPLE = "org.opendaylight.controller.samples";
-
- private static QName CONFIG_MODULES = new QName(
- URI.create("urn:opendaylight:params:xml:ns:yang:controller:config"), null, "modules");
- private static QName CONFIG_SERVICES = new QName(
- URI.create("urn:opendaylight:params:xml:ns:yang:controller:config"), null, "modules");
- @Inject
- BundleContext context;
-
- @Inject
- MountProvisionService mountService;
-
- @Inject
- DataBrokerService dataBroker;
-
- @Test
- public void properInitialized() throws Exception {
-
- Map<QName, String> arg = Collections.singletonMap(InventoryUtils.INVENTORY_ID, "foo");
-
- InstanceIdentifier path = InstanceIdentifier.builder(InventoryUtils.INVENTORY_PATH)
- .nodeWithKey(InventoryUtils.INVENTORY_NODE, InventoryUtils.INVENTORY_ID, "foo").toInstance();
-
-
- InstanceIdentifier mountPointPath = path;
-
- /** We retrive a mountpoint **/
- MountProvisionInstance mountPoint = mountService.getMountPoint(mountPointPath);
- CompositeNode data = mountPoint.readOperationalData(InstanceIdentifier.builder().node(CONFIG_MODULES)
- .toInstance());
- assertNotNull(data);
- assertEquals(CONFIG_MODULES, data.getNodeType());
-
- CompositeNode data2 = mountPoint.readOperationalData(InstanceIdentifier.builder().toInstance());
- assertNotNull(data2);
-
- InstanceIdentifier fullPath = InstanceIdentifier.builder(mountPointPath).node(CONFIG_MODULES).toInstance();
-
- CompositeNode data3 = dataBroker.readOperationalData(fullPath);
- assertNotNull(data3);
- assertEquals(CONFIG_MODULES, data.getNodeType());
-
- //Thread.sleep(30 * 60 * 1000); // Waiting for services to get wired.
- //assertTrue(true);
- // assertTrue(consumer.createToast(WhiteBread.class, 5));
- }
-
- @Configuration
- public Option[] config() {
- return options(
- mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(), //
- mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(), //
- mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(), //
- mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(), //
-
- mdSalCoreBundles(),
- baseModelBundles(),
- flowCapableModelBundles(),
- configMinumumBundles(),
-
- // mavenBundle(ODL,
- // "sal-binding-broker-impl").versionAsInProject().update(), //
- mavenBundle(ODL, "sal-common").versionAsInProject(), //
- mavenBundle(ODL, "sal-common-api").versionAsInProject(),//
- mavenBundle(ODL, "sal-common-impl").versionAsInProject(), //
- mavenBundle(ODL, "sal-common-util").versionAsInProject(), //
-
- mavenBundle(ODL, "sal-core-api").versionAsInProject().update(), //
- mavenBundle(ODL, "sal-broker-impl").versionAsInProject(), //
- mavenBundle(ODL, "sal-core-spi").versionAsInProject().update(), //
-
- mavenBundle(ODL, "sal-connector-api").versionAsInProject(), //
- // mavenBundle(SAMPLE,
- // "zeromq-test-provider").versionAsInProject(), //
- mavenBundle(ODL, "sal-rest-connector").versionAsInProject(), //
- mavenBundle(ODL, "sal-netconf-connector").versionAsInProject(), //
-
- mavenBundle(YANG, "concepts").versionAsInProject(),
- mavenBundle(YANG, "yang-binding").versionAsInProject(), //
- mavenBundle(YANG, "yang-common").versionAsInProject(), //
- mavenBundle(YANG, "yang-data-api").versionAsInProject(), //
- mavenBundle(YANG, "yang-data-impl").versionAsInProject(), //
- mavenBundle(YANG, "yang-model-api").versionAsInProject(), //
- mavenBundle(YANG, "yang-model-util").versionAsInProject(), //
- mavenBundle(YANG, "yang-parser-api").versionAsInProject(),
- mavenBundle(YANG, "yang-parser-impl").versionAsInProject(),
-
- mavenBundle(YANG + ".thirdparty", "xtend-lib-osgi").versionAsInProject(), //
- mavenBundle(YANG + ".thirdparty", "antlr4-runtime-osgi-nohead").versionAsInProject(), //
- mavenBundle("com.google.guava", "guava").versionAsInProject(), //
-
- // systemProperty("logback.configurationFile").value(
- // "file:" + PathUtils.getBaseDir() +
- // "/src/test/resources/logback.xml"),
- // To start OSGi console for inspection remotely
- systemProperty("osgi.console").value("2401"),
- systemProperty("org.eclipse.gemini.web.tomcat.config.path").value(
- PathUtils.getBaseDir() + "/src/test/resources/tomcat-server.xml"),
-
- // setting default level. Jersey bundles will need to be started
- // earlier.
- systemProperty("osgi.bundles.defaultStartLevel").value("4"),
-
- systemProperty("netconf.tcp.address").value("127.0.0.1"),
- systemProperty("netconf.tcp.port").value("8383"),
-
- systemProperty("netconf.tcp.client.address").value("127.0.0.1"),
- systemProperty("netconf.tcp.client.port").value("8383"),
-
- // Set the systemPackages (used by clustering)
- systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"),
-
- mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.xerces", "2.11.0_1"),
- mavenBundle("org.eclipse.birt.runtime.3_7_1", "org.apache.xml.resolver", "1.2.0"),
-
- mavenBundle("org.slf4j", "jcl-over-slf4j").versionAsInProject(),
- mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(),
- mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(),
- mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(),
- mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(),
- mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(),
- mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "clustering.services").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "containermanager").versionAsInProject(),
- // List all the opendaylight modules
- mavenBundle("org.opendaylight.controller", "configuration").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "switchmanager").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "usermanager").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "logging.bridge").versionAsInProject(),
- // mavenBundle("org.opendaylight.controller",
- // "clustering.test").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "bundlescanner").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "bundlescanner.implementation").versionAsInProject(),
-
- // Northbound bundles
- mavenBundle("org.opendaylight.controller", "commons.northbound").versionAsInProject(),
-
- mavenBundle("com.fasterxml.jackson.core", "jackson-annotations").versionAsInProject(),
- mavenBundle("com.fasterxml.jackson.core", "jackson-core").versionAsInProject(),
- mavenBundle("com.fasterxml.jackson.core", "jackson-databind").versionAsInProject(),
- mavenBundle("com.fasterxml.jackson.jaxrs", "jackson-jaxrs-json-provider").versionAsInProject(),
- mavenBundle("com.fasterxml.jackson.module", "jackson-module-jaxb-annotations").versionAsInProject(),
-
- mavenBundle("org.codehaus.jettison", "jettison").versionAsInProject(),
-
- mavenBundle("commons-io", "commons-io").versionAsInProject(),
-
- // mavenBundle("commons-fileupload",
- // "commons-fileupload").versionAsInProject(),
-
- mavenBundle("io.netty", "netty-handler").versionAsInProject(),
- mavenBundle("io.netty", "netty-codec").versionAsInProject(),
- mavenBundle("io.netty", "netty-buffer").versionAsInProject(),
- mavenBundle("io.netty", "netty-transport").versionAsInProject(),
- mavenBundle("io.netty", "netty-common").versionAsInProject(),
-
- mavenBundle(ODL, "config-api").versionAsInProject(),
- mavenBundle(ODL, "config-manager").versionAsInProject(),
- mavenBundle(ODL, "config-util").versionAsInProject(),
- mavenBundle(ODL, "yang-jmx-generator").versionAsInProject(),
- mavenBundle(ODL, "logback-config").versionAsInProject(),
- mavenBundle(ODL, "config-persister-api").versionAsInProject(),
- // mavenBundle(ODL,"config-persister-file-xml-adapter").versionAsInProject(),
- mavenBundle(ODL, "protocol-framework").versionAsInProject(),
- mavenBundle(ODL, "netconf-api").versionAsInProject(),
- mavenBundle(ODL, "netconf-impl").versionAsInProject(),
- mavenBundle(ODL, "netconf-client").versionAsInProject(),
- mavenBundle(ODL, "netconf-util").versionAsInProject(),
- mavenBundle(ODL + ".thirdparty", "ganymed").versionAsInProject(),
- mavenBundle(ODL, "netconf-mapping-api").versionAsInProject(),
- mavenBundle(ODL, "config-netconf-connector").versionAsInProject(),
- mavenBundle(ODL, "config-persister-impl").versionAsInProject(),
-
- mavenBundle(YANG, "binding-generator-spi").versionAsInProject(), //
- mavenBundle(YANG, "binding-model-api").versionAsInProject(), //
- mavenBundle(YANG, "binding-generator-util").versionAsInProject(),
- mavenBundle(YANG, "yang-parser-impl").versionAsInProject(),
- mavenBundle(YANG, "binding-type-provider").versionAsInProject(),
-
- mavenBundle("equinoxSDK381", "javax.servlet").versionAsInProject(),
- mavenBundle("equinoxSDK381", "javax.servlet.jsp").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds").versionAsInProject(),
- mavenBundle("orbit", "javax.xml.rpc").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.eclipse.equinox.util").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.eclipse.osgi.services").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.eclipse.equinox.cm").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.eclipse.equinox.console").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.eclipse.equinox.launcher").versionAsInProject(),
-
- mavenBundle("geminiweb", "org.eclipse.gemini.web.core").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.gemini.web.extender").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.gemini.web.tomcat").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.virgo.kernel.equinox.extensions").versionAsInProject().noStart(),
- mavenBundle("geminiweb", "org.eclipse.virgo.util.common").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.virgo.util.io").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.virgo.util.math").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.virgo.util.osgi").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.virgo.util.osgi.manifest").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.virgo.util.parser.manifest").versionAsInProject(),
-
- mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager").versionAsInProject(),
- mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager.shell").versionAsInProject(),
-
- mavenBundle("com.google.code.gson", "gson").versionAsInProject(),
- mavenBundle("org.jboss.spec.javax.transaction", "jboss-transaction-api_1.1_spec").versionAsInProject(),
- mavenBundle("org.apache.felix", "org.apache.felix.fileinstall").versionAsInProject(),
- mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(),
- mavenBundle("commons-codec", "commons-codec").versionAsInProject(),
- mavenBundle("virgomirror", "org.eclipse.jdt.core.compiler.batch").versionAsInProject(),
- mavenBundle("eclipselink", "javax.persistence").versionAsInProject(),
- mavenBundle("eclipselink", "javax.resource").versionAsInProject(),
-
- mavenBundle("orbit", "javax.activation").versionAsInProject(),
- mavenBundle("orbit", "javax.annotation").versionAsInProject(),
- mavenBundle("orbit", "javax.ejb").versionAsInProject(),
- mavenBundle("orbit", "javax.el").versionAsInProject(),
- mavenBundle("orbit", "javax.mail.glassfish").versionAsInProject(),
- mavenBundle("orbit", "javax.xml.rpc").versionAsInProject(),
- mavenBundle("orbit", "org.apache.catalina").versionAsInProject(),
- // these are bundle fragments that can't be started on its own
- mavenBundle("orbit", "org.apache.catalina.ha").versionAsInProject().noStart(),
- mavenBundle("orbit", "org.apache.catalina.tribes").versionAsInProject().noStart(),
- mavenBundle("orbit", "org.apache.coyote").versionAsInProject().noStart(),
- mavenBundle("orbit", "org.apache.jasper").versionAsInProject().noStart(),
-
- mavenBundle("orbit", "org.apache.el").versionAsInProject(),
- mavenBundle("orbit", "org.apache.juli.extras").versionAsInProject(),
- mavenBundle("orbit", "org.apache.tomcat.api").versionAsInProject(),
- mavenBundle("orbit", "org.apache.tomcat.util").versionAsInProject().noStart(),
- mavenBundle("orbit", "javax.servlet.jsp.jstl").versionAsInProject(),
- mavenBundle("orbit", "javax.servlet.jsp.jstl.impl").versionAsInProject(),
-
- mavenBundle("org.ops4j.pax.exam", "pax-exam-container-native").versionAsInProject(),
- mavenBundle("org.ops4j.pax.exam", "pax-exam-junit4").versionAsInProject(),
- mavenBundle("org.ops4j.pax.exam", "pax-exam-link-mvn").versionAsInProject(),
- mavenBundle("org.ops4j.pax.url", "pax-url-aether").versionAsInProject(),
-
- mavenBundle("org.ow2.asm", "asm-all").versionAsInProject(),
-
- mavenBundle("org.springframework", "org.springframework.asm").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.aop").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.context").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.context.support").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.core").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.beans").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.expression").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.web").versionAsInProject(),
-
- mavenBundle("org.aopalliance", "com.springsource.org.aopalliance").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.web.servlet").versionAsInProject(),
- mavenBundle("org.springframework.security", "spring-security-config").versionAsInProject(),
- mavenBundle("org.springframework.security", "spring-security-core").versionAsInProject(),
- mavenBundle("org.springframework.security", "spring-security-web").versionAsInProject(),
- mavenBundle("org.springframework.security", "spring-security-taglibs").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.transaction").versionAsInProject(),
-
- mavenBundle("org.ow2.chameleon.management", "chameleon-mbeans").versionAsInProject(),
- mavenBundle("org.opendaylight.controller.thirdparty", "com.sun.jersey.jersey-servlet")
- .versionAsInProject().startLevel(2),
- mavenBundle("org.opendaylight.controller.thirdparty", "org.apache.catalina.filters.CorsFilter")
- .versionAsInProject().noStart(),
-
- // Jersey needs to be started before the northbound application
- // bundles, using a lower start level
- mavenBundle("com.sun.jersey", "jersey-client").versionAsInProject(),
- mavenBundle("com.sun.jersey", "jersey-server").versionAsInProject().startLevel(2),
- mavenBundle("com.sun.jersey", "jersey-core").versionAsInProject().startLevel(2),
- junitBundles());
- }
-
-}
+++ /dev/null
-#pax.exam.system = default
-pax.exam.logging = none
-pax.exam.service.timeout = 5000
-
+++ /dev/null
-<configuration scan="true">
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
- </pattern>
- </encoder>
- </appender>
-
- <root level="error">
- <appender-ref ref="STDOUT" />
- </root>
-</configuration>
+++ /dev/null
-<?xml version='1.0' encoding='utf-8'?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- You under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<Server>
- <!--APR library loader. Documentation at /docs/apr.html -->
- <Listener className="org.apache.catalina.core.AprLifecycleListener"
- SSLEngine="on" />
- <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
- <Listener className="org.apache.catalina.core.JasperListener" />
- <!-- Prevent memory leaks due to use of particular java/javax APIs -->
- <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
- <Listener
- className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
- <Listener
- className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
-
- <Service name="Catalina">
- <Connector port="8080" protocol="HTTP/1.1"
- connectionTimeout="20000" redirectPort="8443" />
-
- <!-- Please remove the comments around the following Connector tag
- to enable HTTPS Authentication support. Remember to add a valid keystore
- in the configuration folder. More info : http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration -->
-
- <!-- <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
- maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS"
- keystoreFile="configuration/keystore" keystorePass="changeit"/> -->
-
- <Engine name="Catalina" defaultHost="localhost">
- <Host name="localhost" appBase="" unpackWARs="false"
- autoDeploy="false" deployOnStartup="false" createDirs="false">
- <!-- Realm
- className="org.opendaylight.controller.security.ControllerCustomRealm" /> -->
- <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-
- <Valve className="org.apache.catalina.valves.AccessLogValve"
- directory="logs" prefix="web_access_log_" suffix=".txt"
- resolveHosts="false" rotatable="true"
- fileDateFormat="yyyy-MM"
- pattern="%{yyyy-MM-dd HH:mm:ss.SSS z}t - [%a] - %r" />
-
- </Host>
- </Engine>
- </Service>
-</Server>