From: Ed Warnicke Date: Thu, 13 Feb 2014 11:44:11 +0000 (+0000) Subject: Merge "Refactor Additional header for netconf hello message." X-Git-Tag: autorelease-tag-v20140601202136_82eb3f9~460 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=aeabf761ca043e41eeca6333bc9deb94b1de9ed0;hp=15863b438cff589c647169776f876c330e2cd651 Merge "Refactor Additional header for netconf hello message." --- diff --git a/opendaylight/distribution/opendaylight/pom.xml b/opendaylight/distribution/opendaylight/pom.xml index 5aba5ca5cb..fca4936c7f 100644 --- a/opendaylight/distribution/opendaylight/pom.xml +++ b/opendaylight/distribution/opendaylight/pom.xml @@ -51,6 +51,16 @@ org.opendaylight.controller sal-broker-impl ${mdsal.version} + + + org.opendaylight.controller + sal-remote + ${mdsal.version} + + + org.opendaylight.controller + sal-restconf-broker + ${mdsal.version} org.opendaylight.controller @@ -175,6 +185,16 @@ concepts ${yangtools.version} + + org.opendaylight.yangtools + restconf-client-api + ${yangtools.version} + + + org.opendaylight.yangtools + restconf-client-impl + ${yangtools.version} + diff --git a/opendaylight/md-sal/pom.xml b/opendaylight/md-sal/pom.xml index 8b4e478429..f900c0b18c 100644 --- a/opendaylight/md-sal/pom.xml +++ b/opendaylight/md-sal/pom.xml @@ -137,6 +137,11 @@ sal-connector-api ${project.version} + + org.opendaylight.controller + sal-binding-api + ${project.version} + org.opendaylight.controller sal @@ -148,6 +153,16 @@ + + org.opendaylight.controller + sal-remote + ${project.version} + + + org.opendaylight.controller + sal-binding-util + ${project.version} + diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcConsumerRegistry.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcConsumerRegistry.java index 33b384a94c..69a2108065 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcConsumerRegistry.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcConsumerRegistry.java @@ -19,8 +19,6 @@ public interface RpcConsumerRegistry extends BindingAwareService { * Returns a session specific instance (implementation) of requested * YANG module implentation / service provided by consumer. * - * @param service - * Broker service * @return Session specific implementation of service */ T getRpcService(Class module); diff --git a/opendaylight/md-sal/sal-binding-broker/pom.xml b/opendaylight/md-sal/sal-binding-broker/pom.xml index e5a74e42a1..fd2c8a2fa4 100644 --- a/opendaylight/md-sal/sal-binding-broker/pom.xml +++ b/opendaylight/md-sal/sal-binding-broker/pom.xml @@ -101,7 +101,7 @@ org.opendaylight.controller.sal.binding.impl.*, org.opendaylight.controller.sal.binding.codegen, org.opendaylight.controller.sal.binding.codegen.*, - org.opendaylight.controller.sal.binding.dom.*, + org.opendaylight.controller.sal.binding.osgi.*, diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java index 0762739c63..14006a3fce 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java @@ -7,10 +7,11 @@ */ package org.opendaylight.controller.config.yang.md.sal.binding.impl; +import com.google.common.base.Optional; +import com.google.common.base.Preconditions; import java.util.Hashtable; import java.util.Map.Entry; import java.util.Set; - import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder; import org.opendaylight.yangtools.concepts.Delegator; import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl; @@ -27,9 +28,6 @@ import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; -import com.google.common.base.Optional; -import com.google.common.base.Preconditions; - /** * */ @@ -63,7 +61,7 @@ public final class RuntimeMappingModule extends @Override public java.lang.AutoCloseable createInstance() { - + RuntimeGeneratedMappingServiceProxy potential = tryToReuseGlobalInstance(); if(potential != null) { return potential; @@ -100,7 +98,7 @@ public final class RuntimeMappingModule extends BindingIndependentMappingService, // Delegator, // AutoCloseable { - + private BindingIndependentMappingService delegate; private ServiceReference reference; private BundleContext bundleContext; @@ -113,56 +111,48 @@ public final class RuntimeMappingModule extends this.delegate = Preconditions.checkNotNull(delegate); } - @Override public CodecRegistry getCodecRegistry() { return delegate.getCodecRegistry(); } - @Override public CompositeNode toDataDom(DataObject data) { return delegate.toDataDom(data); } - @Override public Entry toDataDom( Entry, DataObject> entry) { return delegate.toDataDom(entry); } - @Override public InstanceIdentifier toDataDom( org.opendaylight.yangtools.yang.binding.InstanceIdentifier path) { return delegate.toDataDom(path); } - @Override public DataObject dataObjectFromDataDom( org.opendaylight.yangtools.yang.binding.InstanceIdentifier path, CompositeNode result) throws DeserializationException { return delegate.dataObjectFromDataDom(path, result); } - @Override public org.opendaylight.yangtools.yang.binding.InstanceIdentifier fromDataDom(InstanceIdentifier entry) throws DeserializationException { return delegate.fromDataDom(entry); } - @Override public Set getRpcQNamesFor(Class service) { return delegate.getRpcQNamesFor(service); } - @Override - public DataContainer dataObjectFromDataDom(Class inputClass, CompositeNode domInput) { - return delegate.dataObjectFromDataDom(inputClass, domInput); - } - @Override public Optional> getRpcServiceClassFor(String namespace, String revision) { - return delegate.getRpcServiceClassFor(namespace, revision); + return delegate.getRpcServiceClassFor(namespace,revision); } + public DataContainer dataObjectFromDataDom(Class inputClass, CompositeNode domInput) { + return delegate.dataObjectFromDataDom(inputClass, domInput); + } + @Override public void close() throws Exception { if(delegate != null) { diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java index 5292487d03..3ad1dabffe 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java @@ -7,8 +7,7 @@ */ package org.opendaylight.controller.sal.binding.impl; -import static com.google.common.base.Preconditions.checkState; - +import com.google.common.collect.ImmutableClassToInstanceMap; import org.opendaylight.controller.md.sal.binding.util.AbstractBindingSalProviderInstance; import org.opendaylight.controller.md.sal.binding.util.BindingContextUtils; import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener; @@ -33,8 +32,7 @@ import org.opendaylight.yangtools.yang.binding.RpcService; import org.osgi.framework.BundleContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import com.google.common.collect.ImmutableClassToInstanceMap; +import static com.google.common.base.Preconditions.checkState; public class RootBindingAwareBroker implements // Mutable, // diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeEventImpl.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeEventImpl.java index 7f5e466c00..691c303688 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeEventImpl.java +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeEventImpl.java @@ -20,8 +20,6 @@ public class DataChangeEventImpl

, D> implements DataChangeEven private final DataChange dataChange; private final D originalConfigurationSubtree; - - private final D originalOperationalSubtree; private final D updatedOperationalSubtree; private final D updatedConfigurationSubtree; diff --git a/opendaylight/md-sal/sal-dom-broker/pom.xml b/opendaylight/md-sal/sal-dom-broker/pom.xml index 8b193e03aa..8553d9eea5 100644 --- a/opendaylight/md-sal/sal-dom-broker/pom.xml +++ b/opendaylight/md-sal/sal-dom-broker/pom.xml @@ -64,6 +64,7 @@ + org.opendaylight.yangtools yang-maven-plugin diff --git a/opendaylight/md-sal/sal-remote/pom.xml b/opendaylight/md-sal/sal-remote/pom.xml index b6d0632068..d4f5d43e5e 100644 --- a/opendaylight/md-sal/sal-remote/pom.xml +++ b/opendaylight/md-sal/sal-remote/pom.xml @@ -6,13 +6,20 @@ 1.1-SNAPSHOT sal-remote - jar + bundle scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL HEAD + + + org.opendaylight.controller + sal-binding-api + 1.1-SNAPSHOT + + @@ -80,12 +87,4 @@ - - - - org.opendaylight.controller - sal-binding-api - 1.1-SNAPSHOT - - diff --git a/opendaylight/md-sal/sal-remote/src/main/java/org/opendaylight/controller/sal/restconf/service/impl/SalRemoteServiceImpl.java b/opendaylight/md-sal/sal-remote/src/main/java/org/opendaylight/controller/sal/restconf/service/impl/SalRemoteServiceImpl.java deleted file mode 100644 index 1da603266b..0000000000 --- a/opendaylight/md-sal/sal-remote/src/main/java/org/opendaylight/controller/sal/restconf/service/impl/SalRemoteServiceImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.restconf.service.impl; - -import java.util.concurrent.Future; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.BeginTransactionOutput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateDataChangeEventSubscriptionInput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateDataChangeEventSubscriptionOutput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateNotificationStreamInput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateNotificationStreamOutput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.SalRemoteService; -import org.opendaylight.yangtools.yang.common.RpcResult; - -public class SalRemoteServiceImpl implements SalRemoteService { - @Override - public Future> beginTransaction() { - return null; - } - - @Override - public Future> createDataChangeEventSubscription(CreateDataChangeEventSubscriptionInput input) { - return null; - } - - @Override - public Future> createNotificationStream(CreateNotificationStreamInput input) { - return null; - } -} diff --git a/opendaylight/md-sal/sal-restconf-broker/pom.xml b/opendaylight/md-sal/sal-restconf-broker/pom.xml index 8294c101e9..bef2943b4c 100644 --- a/opendaylight/md-sal/sal-restconf-broker/pom.xml +++ b/opendaylight/md-sal/sal-restconf-broker/pom.xml @@ -6,47 +6,133 @@ 1.1-SNAPSHOT sal-restconf-broker - jar + bundle scm:git:ssh://git.opendaylight.org:29418/controller.git scm:git:ssh://git.opendaylight.org:29418/controller.git https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL HEAD - - - - org.apache.felix - maven-bundle-plugin - true - - - - org.opendaylight.controller sal-binding-api - 1.1-SNAPSHOT + + + org.opendaylight.controller + sal-binding-util org.opendaylight.controller sal-remote - 1.1-SNAPSHOT + + + org.opendaylight.controller + sal-broker-impl + + + org.opendaylight.controller + sal-binding-config org.opendaylight.controller sal-core-api - 1.1-SNAPSHOT org.opendaylight.yangtools restconf-client-api ${yangtools.version} + + org.opendaylight.yangtools + restconf-client-impl + ${yangtools.version} + org.slf4j slf4j-api + + + + org.apache.felix + maven-bundle-plugin + true + + + ${project.groupId}.${project.artifactId} + org.opendaylight.controller.sal.restconf.broker.osgi.Activator + + * + + + + + + org.opendaylight.yangtools + yang-maven-plugin + ${yangtools.version} + + + + generate-sources + + + + + + org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator + + ${project.build.directory}/generated-sources/config + + + urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang + + + + + org.opendaylight.yangtools.yang.unified.doc.generator.maven.DocumentationGeneratorImpl + target/site/models + + + true + + + + + + org.opendaylight.controller + yang-jmx-generator-plugin + 0.2.4-SNAPSHOT + + + org.opendaylight.yangtools + maven-sal-api-gen-plugin + ${yangtools.version} + jar + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.8 + + + add-source + generate-sources + + add-source + + + + ${project.build.directory}/generated-sources/ + + + + + + + diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/DataBrokerImplModule.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/DataBrokerImplModule.java new file mode 100644 index 0000000000..7b7f089910 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/DataBrokerImplModule.java @@ -0,0 +1,38 @@ +/** +* Generated file + +* Generated from: yang module name: opendaylight-sal-restconf-broker-impl yang module local name: restconf-data-broker +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Mon Feb 10 15:32:31 CET 2014 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.md.sal.restconf.broker; + +/** +* +*/ +public final class DataBrokerImplModule extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractDataBrokerImplModule + { + + public DataBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public DataBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, + DataBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) { + + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + protected void customValidation(){ + // Add custom validation for module attributes here. + } + + @Override + public java.lang.AutoCloseable createInstance() { + //TODO:implement + throw new java.lang.UnsupportedOperationException("Unimplemented stub method"); + } +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/DataBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/DataBrokerImplModuleFactory.java new file mode 100644 index 0000000000..1722f6d5fb --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/DataBrokerImplModuleFactory.java @@ -0,0 +1,19 @@ +/** +* Generated file + +* Generated from: yang module name: opendaylight-sal-restconf-broker-impl yang module local name: restconf-data-broker +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Mon Feb 10 15:32:31 CET 2014 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.md.sal.restconf.broker; + +/** +* +*/ +public class DataBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractDataBrokerImplModuleFactory +{ + + +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/NotificationBrokerImplModule.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/NotificationBrokerImplModule.java new file mode 100644 index 0000000000..ac4245207d --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/NotificationBrokerImplModule.java @@ -0,0 +1,38 @@ +/** +* Generated file + +* Generated from: yang module name: opendaylight-sal-restconf-broker-impl yang module local name: restconf-notification-broker +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Mon Feb 10 15:32:31 CET 2014 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.md.sal.restconf.broker; + +/** +* +*/ +public final class NotificationBrokerImplModule extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractNotificationBrokerImplModule + { + + public NotificationBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public NotificationBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, + NotificationBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) { + + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + protected void customValidation(){ + // Add custom validation for module attributes here. + } + + @Override + public java.lang.AutoCloseable createInstance() { + //TODO:implement + throw new java.lang.UnsupportedOperationException("Unimplemented stub method"); + } +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/NotificationBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/NotificationBrokerImplModuleFactory.java new file mode 100644 index 0000000000..bb05e06802 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/NotificationBrokerImplModuleFactory.java @@ -0,0 +1,19 @@ +/** +* Generated file + +* Generated from: yang module name: opendaylight-sal-restconf-broker-impl yang module local name: restconf-notification-broker +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Mon Feb 10 15:32:31 CET 2014 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.md.sal.restconf.broker; + +/** +* +*/ +public class NotificationBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractNotificationBrokerImplModuleFactory +{ + + +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RpcBrokerImplModule.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RpcBrokerImplModule.java new file mode 100644 index 0000000000..3460ed07fe --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RpcBrokerImplModule.java @@ -0,0 +1,38 @@ +/** +* Generated file + +* Generated from: yang module name: opendaylight-sal-restconf-broker-impl yang module local name: restconf-rpc-broker +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Mon Feb 10 15:32:31 CET 2014 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.md.sal.restconf.broker; + +/** +* +*/ +public final class RpcBrokerImplModule extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractRpcBrokerImplModule + { + + public RpcBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public RpcBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, + RpcBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) { + + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + protected void customValidation(){ + // Add custom validation for module attributes here. + } + + @Override + public java.lang.AutoCloseable createInstance() { + //TODO:implement + throw new java.lang.UnsupportedOperationException("Unimplemented stub method"); + } +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RpcBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RpcBrokerImplModuleFactory.java new file mode 100644 index 0000000000..5d11f8da03 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RpcBrokerImplModuleFactory.java @@ -0,0 +1,19 @@ +/** +* Generated file + +* Generated from: yang module name: opendaylight-sal-restconf-broker-impl yang module local name: restconf-rpc-broker +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Mon Feb 10 15:32:31 CET 2014 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.md.sal.restconf.broker; + +/** +* +*/ +public class RpcBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractRpcBrokerImplModuleFactory +{ + + +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RuntimeMappingModule.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RuntimeMappingModule.java new file mode 100644 index 0000000000..1b4a8f5eae --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RuntimeMappingModule.java @@ -0,0 +1,38 @@ +/** +* Generated file + +* Generated from: yang module name: opendaylight-sal-restconf-broker-impl yang module local name: restconf-runtime-generated-mapping +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Mon Feb 10 15:32:31 CET 2014 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.md.sal.restconf.broker; + +/** +* +*/ +public final class RuntimeMappingModule extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractRuntimeMappingModule + { + + public RuntimeMappingModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public RuntimeMappingModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, + RuntimeMappingModule oldModule, java.lang.AutoCloseable oldInstance) { + + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + protected void customValidation(){ + // Add custom validation for module attributes here. + } + + @Override + public java.lang.AutoCloseable createInstance() { + //TODO:implement + throw new java.lang.UnsupportedOperationException("Unimplemented stub method"); + } +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RuntimeMappingModuleFactory.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RuntimeMappingModuleFactory.java new file mode 100644 index 0000000000..007b886cee --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RuntimeMappingModuleFactory.java @@ -0,0 +1,19 @@ +/** +* Generated file + +* Generated from: yang module name: opendaylight-sal-restconf-broker-impl yang module local name: restconf-runtime-generated-mapping +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Mon Feb 10 15:32:31 CET 2014 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.md.sal.restconf.broker; + +/** +* +*/ +public class RuntimeMappingModuleFactory extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractRuntimeMappingModuleFactory +{ + + +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/SalRemoteServiceBrokerModule.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/SalRemoteServiceBrokerModule.java new file mode 100644 index 0000000000..7022603455 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/SalRemoteServiceBrokerModule.java @@ -0,0 +1,38 @@ +/** +* Generated file + +* Generated from: yang module name: opendaylight-sal-restconf-broker-impl yang module local name: restconf-broker-impl +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Mon Feb 10 15:32:31 CET 2014 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.md.sal.restconf.broker; + +/** +* +*/ +public final class SalRemoteServiceBrokerModule extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractSalRemoteServiceBrokerModule + { + + public SalRemoteServiceBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public SalRemoteServiceBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, + SalRemoteServiceBrokerModule oldModule, java.lang.AutoCloseable oldInstance) { + + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + protected void customValidation(){ + // Add custom validation for module attributes here. + } + + @Override + public java.lang.AutoCloseable createInstance() { + //TODO:implement + throw new java.lang.UnsupportedOperationException("Unimplemented stub method"); + } +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/SalRemoteServiceBrokerModuleFactory.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/SalRemoteServiceBrokerModuleFactory.java new file mode 100644 index 0000000000..ed10cc074d --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/SalRemoteServiceBrokerModuleFactory.java @@ -0,0 +1,19 @@ +/** +* Generated file + +* Generated from: yang module name: opendaylight-sal-restconf-broker-impl yang module local name: restconf-broker-impl +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Mon Feb 10 15:32:31 CET 2014 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.controller.config.yang.md.sal.restconf.broker; + +/** +* +*/ +public class SalRemoteServiceBrokerModuleFactory extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractSalRemoteServiceBrokerModuleFactory +{ + + +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationServiceImpl.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationServiceImpl.java deleted file mode 100644 index 76c98e3dda..0000000000 --- a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.impl; - -import org.opendaylight.controller.sal.binding.api.NotificationListener; -import org.opendaylight.controller.sal.binding.api.NotificationService; -import org.opendaylight.yangtools.concepts.Registration; -import org.opendaylight.yangtools.yang.binding.Notification; - -public class NotificationServiceImpl implements NotificationService { - @Override - public void addNotificationListener(Class notificationType, NotificationListener listener) { - - } - - @Override - public void addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) { - - } - - @Override - public void removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) { - - } - - @Override - public void removeNotificationListener(Class notificationType, NotificationListener listener) { - - } - - @Override - public Registration> registerNotificationListener(Class notificationType, NotificationListener listener) { - //TODO implementation using sal-remote - return null; - } - - @Override - public Registration registerNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) { - //TODO implementation using sal-remote - return null; - } -} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataBrokerServiceImpl.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/binding/impl/DataBrokerServiceImpl.java similarity index 98% rename from opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataBrokerServiceImpl.java rename to opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/binding/impl/DataBrokerServiceImpl.java index ad28305b22..6fe56c87ed 100644 --- a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataBrokerServiceImpl.java +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/binding/impl/DataBrokerServiceImpl.java @@ -5,7 +5,7 @@ * 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.impl; +package org.opendaylight.controller.sal.restconf.binding.impl; import java.net.URL; import java.util.concurrent.Future; diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/SalRemoteServiceBroker.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/SalRemoteServiceBroker.java index 988bfd8ca5..74b23201e7 100644 --- a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/SalRemoteServiceBroker.java +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/SalRemoteServiceBroker.java @@ -8,25 +8,60 @@ package org.opendaylight.controller.sal.restconf.broker; -import org.opendaylight.controller.sal.core.api.Broker; -import org.opendaylight.controller.sal.core.api.Consumer; -import org.opendaylight.controller.sal.core.api.Provider; +import com.google.common.collect.ImmutableClassToInstanceMap; +import org.opendaylight.controller.md.sal.binding.util.BindingContextUtils; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; +import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer; +import org.opendaylight.controller.sal.binding.api.BindingAwareProvider; +import org.opendaylight.controller.sal.binding.api.BindingAwareService; +import org.opendaylight.controller.sal.binding.api.NotificationService; +import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry; +import org.opendaylight.controller.sal.binding.api.data.DataBrokerService; +import org.opendaylight.controller.sal.restconf.broker.impl.RemoteServicesFactory; +import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext; import org.osgi.framework.BundleContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import static com.google.common.base.Preconditions.checkState; -public class SalRemoteServiceBroker implements Broker,AutoCloseable { +public class SalRemoteServiceBroker implements BindingAwareBroker,AutoCloseable { - @Override - public void close() throws Exception { + private static final Logger logger = LoggerFactory.getLogger(SalRemoteServiceBroker.class.toString()); + private ImmutableClassToInstanceMap supportedConsumerServices; + + private final String identifier; + + private RpcConsumerRegistry rpcBroker; + private NotificationService notificationBroker; + private DataBrokerService dataBroker; + private final RemoteServicesFactory servicesFactory; + + public SalRemoteServiceBroker(String instanceName,RestconfClientContext clientContext){ + this.identifier = instanceName; + this.servicesFactory = new RemoteServicesFactory(clientContext); } - @Override - public ConsumerSession registerConsumer(Consumer cons, BundleContext context) { - return null; + public void start() { + logger.info("Starting Binding Aware Broker: {}", identifier); + + supportedConsumerServices = ImmutableClassToInstanceMap. builder() + .put(NotificationService.class, servicesFactory.getNotificationService()) // + .put(DataBrokerService.class,servicesFactory.getDataBrokerService() ) // + .put(RpcConsumerRegistry.class,servicesFactory.getRpcConsumerRegistry() ).build(); } + public ProviderContext registerProvider(BindingAwareProvider provider, BundleContext ctx) { + throw new UnsupportedOperationException(); + } + @Override + public void close() throws Exception { + //TODO decide if serviceFactory should close clientContext or it has to be closed by consumer + } @Override - public ProviderSession registerProvider(Provider prov, BundleContext context) { - return null; + public ConsumerContext registerConsumer(BindingAwareConsumer consumer, BundleContext ctx) { + checkState(supportedConsumerServices != null, "Broker is not initialized."); + return BindingContextUtils.createConsumerContextAndInitialize(consumer, supportedConsumerServices); } + } diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/event/RemoteDataChangeEvent.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/event/RemoteDataChangeEvent.java new file mode 100644 index 0000000000..5fad76ff08 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/event/RemoteDataChangeEvent.java @@ -0,0 +1,137 @@ +/* + * 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.restconf.broker.event; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.DataChangedNotification; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; + +public class RemoteDataChangeEvent implements DataChangeEvent,DataObject> { + + + private final DataChangedNotification dataChangedNotification; + + + public RemoteDataChangeEvent(DataChangedNotification dataChangedNotification){ + + this.dataChangedNotification = dataChangedNotification; + } + + @Override + public DataObject getOriginalConfigurationSubtree() { + throw new UnsupportedOperationException(); + } + + @Override + public DataObject getOriginalOperationalSubtree() { + throw new UnsupportedOperationException(); + } + + @Override + public DataObject getUpdatedConfigurationSubtree() { + throw new UnsupportedOperationException(); + } + + @Override + public DataObject getUpdatedOperationalSubtree() { + throw new UnsupportedOperationException(); + } + + @Override + public Map, DataObject> getCreatedOperationalData() { + return new HashMap, DataObject>(){{ + for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){ + if (d.getOperation().getIntValue() == 0 && d.getStore().getIntValue() == 1){ + put(d.getPath(),d); + } + } + }}; + } + + @Override + public Map, DataObject> getCreatedConfigurationData() { + return new HashMap, DataObject>(){{ + for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){ + if (d.getOperation().getIntValue() == 0 && d.getStore().getIntValue() == 0){ + put(d.getPath(),d); + } + } + }}; + } + + @Override + public Map, DataObject> getUpdatedOperationalData() { + return new HashMap, DataObject>(){{ + for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){ + if (d.getOperation().getIntValue() == 1 && d.getStore().getIntValue() == 1){ + put(d.getPath(),d); + } + } + }}; + } + + @Override + public Map, DataObject> getUpdatedConfigurationData() { + return new HashMap, DataObject>(){{ + for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){ + if (d.getOperation().getIntValue() == 1 && d.getStore().getIntValue() == 0){ + put(d.getPath(),d); + } + } + }}; + } + + @Override + public Set> getRemovedConfigurationData() { + return new HashSet>(){{ + for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){ + if (d.getOperation().getIntValue() == 2 && d.getStore().getIntValue() == 0){ + add(d.getPath()); + } + } + }}; + } + + @Override + public Set> getRemovedOperationalData() { + return new HashSet>(){{ + for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){ + if (d.getOperation().getIntValue() == 2 && d.getStore().getIntValue() == 1){ + add(d.getPath()); + } + } + }}; + } + + @Override + public Map, DataObject> getOriginalConfigurationData() { + return new HashMap, DataObject>(){{ + for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){ + if (d.getOperation().getIntValue() == 1 && d.getStore().getIntValue() == 0){ + put(d.getPath(),d); + } + } + }}; + } + + @Override + public Map, DataObject> getOriginalOperationalData() { + return new HashMap, DataObject>(){{ + for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){ + if (d.getOperation().getIntValue() == 1 && d.getStore().getIntValue() == 1){ + put(d.getPath(),d); + } + } + }}; + } +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/DataBrokerServiceImpl.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/DataBrokerServiceImpl.java new file mode 100644 index 0000000000..e6659c2265 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/DataBrokerServiceImpl.java @@ -0,0 +1,168 @@ +/* + * 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.restconf.broker.impl; + +import com.google.common.base.Optional; +import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import org.opendaylight.controller.sal.binding.api.data.DataBrokerService; +import org.opendaylight.controller.sal.binding.api.data.DataChangeListener; +import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction; +import org.opendaylight.controller.sal.common.DataStoreIdentifier; +import org.opendaylight.controller.sal.restconf.broker.listeners.RemoteDataChangeNotificationListener; +import org.opendaylight.controller.sal.restconf.broker.tools.RemoteStreamTools; +import org.opendaylight.controller.sal.restconf.broker.transactions.RemoteDataModificationTransaction; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.BeginTransactionOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateDataChangeEventSubscriptionInputBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateDataChangeEventSubscriptionOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.SalRemoteService; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext; +import org.opendaylight.yangtools.restconf.client.api.event.EventStreamInfo; +import org.opendaylight.yangtools.restconf.client.api.event.ListenableEventStreamContext; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.DataRoot; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DataBrokerServiceImpl implements DataBrokerService { + + private static final Logger logger = LoggerFactory.getLogger(DataBrokerServiceImpl.class.toString()); + private RestconfClientContext restconfClientContext; + private SalRemoteService salRemoteService; + + public DataBrokerServiceImpl(RestconfClientContext restconfClientContext) { + this.restconfClientContext = restconfClientContext; + this.salRemoteService = this.restconfClientContext.getRpcServiceContext(SalRemoteService.class).getRpcService(); + } + @Override + public T getData(DataStoreIdentifier store, Class rootType) { + throw new UnsupportedOperationException("Deprecated"); + } + + @Override + public T getData(DataStoreIdentifier store, T filter) { + throw new UnsupportedOperationException("Deprecated"); + } + + @Override + public T getCandidateData(DataStoreIdentifier store, Class rootType) { + throw new UnsupportedOperationException("Deprecated"); + } + + @Override + public T getCandidateData(DataStoreIdentifier store, T filter) { + throw new UnsupportedOperationException("Deprecated"); + } + + @Override + public RpcResult editCandidateData(DataStoreIdentifier store, DataRoot changeSet) { + throw new UnsupportedOperationException("Deprecated"); + } + + @Override + public Future> commit(DataStoreIdentifier store) { + throw new UnsupportedOperationException("Deprecated"); + } + + @Override + public DataObject getData(InstanceIdentifier data) { + throw new UnsupportedOperationException("Deprecated"); + } + + @Override + public DataObject getConfigurationData(InstanceIdentifier data) { + throw new UnsupportedOperationException("Deprecated"); + } + + @Override + public DataModificationTransaction beginTransaction() { + Future> rpcResultFuture = this.salRemoteService.beginTransaction(); + //TODO finish yang model for proper remoteDataModificationTransaction setup + RemoteDataModificationTransaction remoteDataModificationTransaction = new RemoteDataModificationTransaction(); + return remoteDataModificationTransaction; + } + + @Override + public void registerChangeListener(InstanceIdentifier path, DataChangeListener changeListener) { + throw new UnsupportedOperationException("Deprecated"); + } + + @Override + public void unregisterChangeListener(InstanceIdentifier path, DataChangeListener changeListener) { + throw new UnsupportedOperationException("Deprecated"); + } + + @Override + public DataObject readConfigurationData(InstanceIdentifier path) { + try { + Optional optDataObject = (Optional) this.restconfClientContext.getConfigurationDatastore().readData(path).get(); + if (optDataObject.isPresent()){ + return optDataObject.get(); + } + } catch (InterruptedException e) { + logger.trace("Reading configuration data interrupted {}",e); + } catch (ExecutionException e) { + logger.trace("Reading configuration execution exception {}",e); + } + throw new IllegalStateException("No data to return."); + } + + @Override + public DataObject readOperationalData(InstanceIdentifier path) { + try { + Optional optDataObject = (Optional) this.restconfClientContext.getOperationalDatastore().readData(path).get(); + if (optDataObject.isPresent()){ + return optDataObject.get(); + } + } catch (InterruptedException e) { + logger.trace("Reading configuration data interrupted {}",e); + } catch (ExecutionException e) { + logger.trace("Reading configuration execution exception {}",e); + } + throw new IllegalStateException("No data to return."); + } + @Override + public ListenerRegistration registerDataChangeListener(InstanceIdentifier path, DataChangeListener listener) { + CreateDataChangeEventSubscriptionInputBuilder inputBuilder = new CreateDataChangeEventSubscriptionInputBuilder(); + Future> rpcResultFuture = salRemoteService.createDataChangeEventSubscription(inputBuilder.setPath(path).build()); + String streamName = ""; + try { + if (rpcResultFuture.get().isSuccessful()){ + streamName = rpcResultFuture.get().getResult().getStreamName(); + } + } catch (InterruptedException e) { + logger.trace("Interupted while getting rpc result due to {}",e); + } catch (ExecutionException e) { + logger.trace("Execution exception while getting rpc result due to {}",e); + } + final Map desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext,streamName); + ListenableEventStreamContext restConfListenableEventStreamContext = restconfClientContext.getEventStreamContext(desiredEventStream.get(streamName)); + RemoteDataChangeNotificationListener remoteDataChangeNotificationListener = new RemoteDataChangeNotificationListener(listener); + restConfListenableEventStreamContext.registerNotificationListener(remoteDataChangeNotificationListener); + return new SalRemoteDataListenerRegistration(listener); + } + + private class SalRemoteDataListenerRegistration implements ListenerRegistration { + private DataChangeListener dataChangeListener; + public SalRemoteDataListenerRegistration(DataChangeListener dataChangeListener){ + this.dataChangeListener = dataChangeListener; + } + @Override + public DataChangeListener getInstance() { + return this.dataChangeListener; + } + @Override + public void close() throws Exception { + //noop + } + } +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java new file mode 100644 index 0000000000..a0162395f5 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java @@ -0,0 +1,118 @@ +/* + * 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.restconf.broker.impl; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import com.google.common.collect.Multimaps; +import com.google.common.collect.SetMultimap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import org.opendaylight.controller.sal.binding.api.NotificationListener; +import org.opendaylight.controller.sal.binding.api.NotificationService; +import org.opendaylight.controller.sal.restconf.broker.listeners.RemoteNotificationListener; +import org.opendaylight.controller.sal.restconf.broker.tools.RemoteStreamTools; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.QName; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.SalRemoteService; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.concepts.Registration; +import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext; +import org.opendaylight.yangtools.restconf.client.api.event.EventStreamInfo; +import org.opendaylight.yangtools.yang.binding.Notification; + +public class NotificationServiceImpl implements NotificationService { + private SalRemoteService salRemoteService; + private RestconfClientContext restconfClientContext; + + private final Multimap,NotificationListener> listeners; + private ExecutorService _executor; + + public NotificationServiceImpl(RestconfClientContext restconfClienetContext){ + this.restconfClientContext = restconfClienetContext; + this.salRemoteService = this.restconfClientContext.getRpcServiceContext(SalRemoteService.class).getRpcService(); + + HashMultimap,NotificationListener> _create = HashMultimap., NotificationListener>create(); + SetMultimap,NotificationListener> _synchronizedSetMultimap = Multimaps., NotificationListener>synchronizedSetMultimap(_create); + this.listeners = _synchronizedSetMultimap; + + } + public ExecutorService getExecutor() { + return this._executor; + } + + public void setExecutor(final ExecutorService executor) { + this._executor = executor; + } + + @Override + public void addNotificationListener(Class notificationType, NotificationListener listener) { + this.listeners.put(notificationType, listener); + } + + @Override + public void addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) { + UnsupportedOperationException _unsupportedOperationException = new UnsupportedOperationException("Deprecated method. Use registerNotificationListener instead."); + throw _unsupportedOperationException; + } + + @Override + public void removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) { + UnsupportedOperationException _unsupportedOperationException = new UnsupportedOperationException( + "Deprecated method. Use RegisterNotificationListener returned value to close registration."); + throw _unsupportedOperationException; + } + + @Override + public void removeNotificationListener(Class notificationType, NotificationListener listener) { + this.listeners.remove(notificationType, listener); + } + + @Override + public Registration> registerNotificationListener(Class notificationType, NotificationListener listener) { + //TODO implementation using sal-remote + List notifications = new ArrayList(); + notifications.add(new QName(notificationType.toString())); + String notificationStreamName = RemoteStreamTools.createNotificationStream(salRemoteService, notifications); + final Map desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext, notificationStreamName); + RemoteNotificationListener remoteNotificationListener = new RemoteNotificationListener(listener); + ListenerRegistration listenerRegistration = restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))).registerNotificationListener(remoteNotificationListener); + SalNotificationRegistration salNotificationRegistration = new SalNotificationRegistration(listenerRegistration); + return salNotificationRegistration; + } + + @Override + public Registration registerNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) { + //TODO implementation using sal-remote + String notificationStreamName = RemoteStreamTools.createNotificationStream(salRemoteService, null); + final Map desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext, notificationStreamName); + ListenerRegistration listenerRegistration = restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))).registerNotificationListener(listener); + return listenerRegistration; + } + + private class SalNotificationRegistration implements Registration>{ + private Registration registration; + + public SalNotificationRegistration(ListenerRegistration listenerRegistration){ + this.registration = listenerRegistration; + } + + @Override + public NotificationListener getInstance() { + return this.getInstance(); + } + + @Override + public void close() throws Exception { + this.registration.close(); + } + } + + +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/RemoteServicesFactory.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/RemoteServicesFactory.java new file mode 100644 index 0000000000..65ecd8b70b --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/RemoteServicesFactory.java @@ -0,0 +1,35 @@ +/* + * 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.restconf.broker.impl; + +import org.opendaylight.controller.sal.binding.api.NotificationService; +import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry; +import org.opendaylight.controller.sal.binding.api.data.DataBrokerService; +import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext; + +public class RemoteServicesFactory { + + private final RestconfClientContext restconfClientContext; + + public RemoteServicesFactory(RestconfClientContext restconfClientContext){ + this.restconfClientContext = restconfClientContext; + } + + public DataBrokerService getDataBrokerService(){ + return new DataBrokerServiceImpl(this.restconfClientContext); + } + + public NotificationService getNotificationService(){ + return new NotificationServiceImpl(this.restconfClientContext); + } + + public RpcConsumerRegistry getRpcConsumerRegistry(){ + return new RpcConsumerRegistryImpl(this.restconfClientContext); + } + +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcConsumerRegistryImpl.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/RpcConsumerRegistryImpl.java similarity index 58% rename from opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcConsumerRegistryImpl.java rename to opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/RpcConsumerRegistryImpl.java index e6a67ee8eb..82342ace26 100644 --- a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcConsumerRegistryImpl.java +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/RpcConsumerRegistryImpl.java @@ -5,15 +5,21 @@ * 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.impl; +package org.opendaylight.controller.sal.restconf.broker.impl; import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext; import org.opendaylight.yangtools.yang.binding.RpcService; public class RpcConsumerRegistryImpl implements RpcConsumerRegistry { + + private RestconfClientContext restconfClientContext; + + public RpcConsumerRegistryImpl(RestconfClientContext restconfClientContext){ + this.restconfClientContext = restconfClientContext; + } @Override public T getRpcService(Class module) { - //TODO implementation using restconf-client - return null; + return restconfClientContext.getRpcServiceContext(module).getRpcService(); } } diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteDataChangeNotificationListener.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteDataChangeNotificationListener.java new file mode 100644 index 0000000000..df72ac8ce2 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteDataChangeNotificationListener.java @@ -0,0 +1,27 @@ +/* + * 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.restconf.broker.listeners; + +import org.opendaylight.controller.sal.binding.api.data.DataChangeListener; +import org.opendaylight.controller.sal.restconf.broker.event.RemoteDataChangeEvent; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.DataChangedNotification; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.SalRemoteListener; + +public class RemoteDataChangeNotificationListener implements SalRemoteListener { + + + private final DataChangeListener dataChangeListener; + + public RemoteDataChangeNotificationListener(DataChangeListener dataChangeListener){ + this.dataChangeListener = dataChangeListener; + } + @Override + public void onDataChangedNotification(DataChangedNotification notification) { + this.dataChangeListener.onDataChanged(new RemoteDataChangeEvent(notification)); + } +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteNotificationListener.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteNotificationListener.java new file mode 100644 index 0000000000..895a5030e9 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteNotificationListener.java @@ -0,0 +1,23 @@ +/* + * 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.restconf.broker.listeners; + +import org.opendaylight.controller.sal.binding.api.NotificationListener; + +public class RemoteNotificationListener implements org.opendaylight.yangtools.yang.binding.NotificationListener { + + org.opendaylight.controller.sal.binding.api.NotificationListener listener; + + public RemoteNotificationListener(NotificationListener listener){ + this.listener = listener; + } + public NotificationListener getListener(){ + return this.listener; + } + +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/SalNotificationListener.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/SalNotificationListener.java new file mode 100644 index 0000000000..16ca0aee93 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/SalNotificationListener.java @@ -0,0 +1,24 @@ +/* + * 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.restconf.broker.listeners; + +import org.opendaylight.controller.sal.binding.api.NotificationListener; +import org.opendaylight.yangtools.yang.binding.Notification; + + +public class SalNotificationListener implements NotificationListener { + private NotificationListener notificationListener; + + public SalNotificationListener( NotificationListener notificationListener){ + this.notificationListener = notificationListener; + } + @Override + public void onNotification(Notification notification) { + this.notificationListener.onNotification(notification); + } +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/osgi/Activator.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/osgi/Activator.java new file mode 100644 index 0000000000..13535ee8d5 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/osgi/Activator.java @@ -0,0 +1,41 @@ +/* + * 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.restconf.broker.osgi; + +import java.util.Hashtable; +import javassist.ClassPool; +import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl; +import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +public class Activator implements BundleActivator { + + private ServiceRegistration mappingReg; + + @Override + public void start(BundleContext context) throws Exception { + RuntimeGeneratedMappingServiceImpl service = new RuntimeGeneratedMappingServiceImpl(); + service.setPool(new ClassPool()); + service.init(); + startRuntimeMappingService(service, context); + } + + private void startRuntimeMappingService(RuntimeGeneratedMappingServiceImpl service, BundleContext context) { + Hashtable properties = new Hashtable(); + mappingReg = context.registerService(BindingIndependentMappingService.class, service, properties); + } + + @Override + public void stop(BundleContext context) throws Exception { + if(mappingReg != null) { + mappingReg.unregister(); + } + } +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/tools/RemoteStreamTools.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/tools/RemoteStreamTools.java new file mode 100644 index 0000000000..726f7f0649 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/tools/RemoteStreamTools.java @@ -0,0 +1,71 @@ +/* + * 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.restconf.broker.tools; + +import com.google.common.util.concurrent.ListenableFuture; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateNotificationStreamInputBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateNotificationStreamOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.QName; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.SalRemoteService; +import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext; +import org.opendaylight.yangtools.restconf.client.api.event.EventStreamInfo; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class RemoteStreamTools { + private static final Logger logger = LoggerFactory.getLogger(RemoteStreamTools.class.toString()); + + public static String createNotificationStream(SalRemoteService salRemoteService,List notifications){ + CreateNotificationStreamInputBuilder notificationStreamInputBuilder = new CreateNotificationStreamInputBuilder(); + + if (null == notifications){ + notificationStreamInputBuilder.setNotifications(notifications); + } + + Future> notificationStream = salRemoteService.createNotificationStream(notificationStreamInputBuilder.build()); + + String nofiticationStreamIdentifier = ""; + try { + if (notificationStream.get().isSuccessful()){ + nofiticationStreamIdentifier = notificationStream.get().getResult().getNotificationStreamIdentifier(); + } + } catch (InterruptedException e) { + logger.trace("Interrupted while resolving notification stream identifier due to {}",e); + } catch (ExecutionException e) { + logger.trace("Execution exception while resolving notification stream identifier due to {}",e); + } + return nofiticationStreamIdentifier; + } + + public static Map createEventStream(RestconfClientContext restconfClientContext, String desiredStreamName){ + ListenableFuture> availableEventStreams = restconfClientContext.getAvailableEventStreams(); + final Map desiredEventStream = new HashMap(); + + try { + Iterator it = availableEventStreams.get().iterator(); + while (it.hasNext()){ + if (it.next().getIdentifier().equals(desiredStreamName)){ + desiredEventStream.put(desiredStreamName,it.next()); + } + } + } catch (InterruptedException e) { + logger.trace("Resolving of event stream interrupted due to {}",e); + } catch (ExecutionException e) { + logger.trace("Resolving of event stream failed due to {}",e); + } + return desiredEventStream; + } +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/transactions/RemoteDataModificationTransaction.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/transactions/RemoteDataModificationTransaction.java new file mode 100644 index 0000000000..7f9cc8f6c4 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/transactions/RemoteDataModificationTransaction.java @@ -0,0 +1,122 @@ +/* + * 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.restconf.broker.transactions; + +import java.util.Map; +import java.util.Set; +import java.util.concurrent.Future; +import org.opendaylight.controller.md.sal.common.api.TransactionStatus; +import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.common.RpcResult; + +public class RemoteDataModificationTransaction implements DataModificationTransaction { + //TODO implement this + + @Override + public Object getIdentifier() { + return null; + } + + @Override + public TransactionStatus getStatus() { + return null; + } + + @Override + public void putRuntimeData(InstanceIdentifier path, DataObject data) { + + } + + @Override + public void putOperationalData(InstanceIdentifier path, DataObject data) { + + } + + @Override + public void putConfigurationData(InstanceIdentifier path, DataObject data) { + + } + + @Override + public void removeRuntimeData(InstanceIdentifier path) { + + } + + @Override + public void removeOperationalData(InstanceIdentifier path) { + + } + + @Override + public void removeConfigurationData(InstanceIdentifier path) { + + } + + @Override + public Future> commit() { + return null; + } + + @Override + public ListenerRegistration registerListener(DataTransactionListener listener) { + return null; + } + + @Override + public Map, DataObject> getCreatedOperationalData() { + return null; + } + + @Override + public Map, DataObject> getCreatedConfigurationData() { + return null; + } + + @Override + public Map, DataObject> getUpdatedOperationalData() { + return null; + } + + @Override + public Map, DataObject> getUpdatedConfigurationData() { + return null; + } + + @Override + public Set> getRemovedConfigurationData() { + return null; + } + + @Override + public Set> getRemovedOperationalData() { + return null; + } + + @Override + public Map, DataObject> getOriginalConfigurationData() { + return null; + } + + @Override + public Map, DataObject> getOriginalOperationalData() { + return null; + } + + @Override + public DataObject readOperationalData(InstanceIdentifier path) { + return null; + } + + @Override + public DataObject readConfigurationData(InstanceIdentifier path) { + return null; + } +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/yang/opendaylight-restconf-broker-impl.yang b/opendaylight/md-sal/sal-restconf-broker/src/main/yang/opendaylight-restconf-broker-impl.yang new file mode 100644 index 0000000000..634a2ba205 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/yang/opendaylight-restconf-broker-impl.yang @@ -0,0 +1,142 @@ +// vi: set smarttab et sw=4 tabstop=4: +module opendaylight-sal-restconf-broker-impl { + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:restconf:broker"; + prefix "restconf-impl"; + + import config { prefix config; revision-date 2013-04-05; } + import opendaylight-md-sal-binding {prefix sal;} + import opendaylight-md-sal-dom {prefix dom;} + import opendaylight-md-sal-common {prefix common;} + + description + "Service definition for Restconf MD-SAL."; + + revision "2014-02-10" { + description + "Initial revision"; + } + + identity binding-dom-mapping-service { + base config:service-type; + config:java-class "org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService"; + } + + + identity restconf-broker-impl { + base config:module-type; + config:provided-service sal:binding-data-consumer-broker; + config:provided-service sal:binding-notification-subscription-service; + /*TODO provide RpcConsumerRegistry*/ + config:java-name-prefix SalRemoteServiceBroker; + } + + identity restconf-data-broker { + base config:module-type; + config:provided-service sal:binding-data-broker; + config:java-name-prefix DataBrokerImpl; + } + + identity restconf-rpc-broker { + base config:module-type; + config:provided-service sal:binding-rpc-registry; + config:java-name-prefix RpcBrokerImpl; + } + + identity restconf-notification-broker { + base config:module-type; + config:provided-service sal:binding-notification-service; + config:java-name-prefix NotificationBrokerImpl; + } + + identity restconf-runtime-generated-mapping { + base config:module-type; + config:provided-service binding-dom-mapping-service; + config:java-name-prefix RuntimeMapping; + } + + augment "/config:modules/config:module/config:configuration" { + case restconf-broker-impl { + when "/config:modules/config:module/config:type = 'restconf-broker-impl'"; + + /* + container rpc-registry { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity sal:binding-rpc-registry; + } + } + }*/ + + container data-broker { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity sal:binding-data-broker; + } + } + } + + container notification-service { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity sal:binding-notification-service; + } + } + } + } + } + + augment "/config:modules/config:module/config:configuration" { + case restconf-data-broker { + when "/config:modules/config:module/config:type = 'restconf-data-broker'"; + container dom-broker { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity dom:dom-broker-osgi-registry; + } + } + } + + container mapping-service { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity binding-dom-mapping-service; + } + } + } + } + } + + + augment "/config:modules/config:module/config:state" { + case restconf-runtime-generated-mapping { + when "/config:modules/config:module/config:type = 'restconf-runtime-generated-mapping'"; + } + } + + augment "/config:modules/config:module/config:state" { + case restconf-data-broker { + when "/config:modules/config:module/config:type = 'restconf-data-broker'"; + container data { + uses common:data-state; + } + } + } + augment "/config:modules/config:module/config:state" { + case restconf-rpc-broker { + when "/config:modules/config:module/config:type = 'restconf-rpc-broker'"; + uses common:rpc-state; + } + } + augment "/config:modules/config:module/config:state" { + case restconf-notification-broker { + when "/config:modules/config:module/config:type = 'restconf-notification-broker'"; + uses common:notification-state; + } + } +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/DataBrokerImplTest.java b/opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/DataBrokerImplTest.java new file mode 100644 index 0000000000..eafc47d620 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/DataBrokerImplTest.java @@ -0,0 +1,15 @@ +/* + * 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.impl.test; + +public class DataBrokerImplTest { + + public static void main(String[] args){ + + } +} diff --git a/opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/NotificationServiceImplTest.java b/opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/NotificationServiceImplTest.java new file mode 100644 index 0000000000..a91b06ee76 --- /dev/null +++ b/opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/NotificationServiceImplTest.java @@ -0,0 +1,15 @@ +/* + * 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.impl.test; + +public class NotificationServiceImplTest { + + public static void main(String[] args){ + + } +}