Merge "Config save support for networkconfiguration.neutron"
authorAlessandro Boch <aboch@cisco.com>
Sat, 18 Jan 2014 16:40:36 +0000 (16:40 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Sat, 18 Jan 2014 16:40:36 +0000 (16:40 +0000)
206 files changed:
opendaylight/appauth/pom.xml
opendaylight/arphandler/pom.xml
opendaylight/clustering/services_implementation/pom.xml
opendaylight/clustering/stub/pom.xml
opendaylight/clustering/test/pom.xml
opendaylight/config/config-persister-directory-autodetect-adapter/src/main/java/org/opendaylight/controller/config/persist/storage/directory/autodetect/FileType.java
opendaylight/config/config-persister-directory-xml-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/directory/xml/DirectoryStorageAdapterTest.java
opendaylight/config/config-persister-file-xml-adapter/pom.xml
opendaylight/config/config-persister-file-xml-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/file/xml/FileStorageAdapterTest.java
opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/ContextSetter.java
opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/ContextSetterImpl.java
opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/LogbackModule.java
opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/LogbackModuleFactory.java
opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/LogbackStatusListener.java
opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/GlobalEventExecutorModule.java
opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/GlobalEventExecutorModuleFactory.java
opendaylight/config/netty-event-executor-config/src/test/java/org/opendaylight/controller/config/yang/netty/eventexecutor/GlobalEventExecutorModuleTest.java
opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/NettyThreadgroupModule.java
opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/NettyThreadgroupModuleFactory.java
opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerModule.java
opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerModuleFactory.java
opendaylight/config/netty-timer-config/src/test/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerModuleTest.java
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/AsyncEventBusModule.java
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/AsyncEventBusModuleFactory.java
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/EventBusModule.java
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/EventBusModuleFactory.java
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/NamingThreadFactoryModule.java
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/NamingThreadFactoryModuleFactory.java
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/fixed/FixedThreadPoolModule.java
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/fixed/FixedThreadPoolModuleFactory.java
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/flexible/FlexibleThreadPoolModule.java
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/flexible/FlexibleThreadPoolModuleFactory.java
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/scheduled/ScheduledThreadPoolModule.java
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/scheduled/ScheduledThreadPoolModuleFactory.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/async/AsyncEventBusConfigBeanTest.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/eventbus/SyncEventBusConfigBeanTest.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/eventbus/TestingEventBusModule.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/FixedThreadPoolConfigBeanTest.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/TestingFixedThreadPoolModule.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/flexible/FlexibleThreadPoolConfigBeanTest.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/NamingThreadPoolFactoryConfigBeanTest.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/TestingNamingThreadPoolFactoryModule.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/ScheduledThreadPoolConfigBeanTest.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/TestingScheduledThreadPoolModule.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/Dependency.java
opendaylight/configuration/api/pom.xml
opendaylight/configuration/implementation/pom.xml
opendaylight/configuration/integrationtest/pom.xml
opendaylight/connectionmanager/api/pom.xml
opendaylight/connectionmanager/implementation/pom.xml
opendaylight/containermanager/api/pom.xml
opendaylight/containermanager/implementation/pom.xml
opendaylight/containermanager/it.implementation/pom.xml
opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini
opendaylight/forwarding/staticrouting/pom.xml
opendaylight/forwardingrulesmanager/api/pom.xml
opendaylight/forwardingrulesmanager/implementation/pom.xml
opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManager.java
opendaylight/hosttracker/api/pom.xml
opendaylight/hosttracker/implementation/pom.xml
opendaylight/hosttracker_new/api/pom.xml
opendaylight/hosttracker_new/implementation/pom.xml
opendaylight/md-sal/clustered-data-store/implementation/pom.xml
opendaylight/md-sal/clustered-data-store/integrationtest/pom.xml
opendaylight/md-sal/compatibility/flow-management-compatibility/pom.xml
opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.xtend
opendaylight/md-sal/compatibility/sal-compatibility/pom.xml
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ComponentActivator.xtend
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/DataPacketServiceAdapter.java
opendaylight/md-sal/model/model-flow-base/pom.xml
opendaylight/md-sal/model/model-flow-management/pom.xml
opendaylight/md-sal/model/model-flow-service/pom.xml
opendaylight/md-sal/model/model-flow-statistics/pom.xml
opendaylight/md-sal/remoterpc-routingtable/implementation/pom.xml
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcConsumerRegistry.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcProviderRegistry.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderService.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcContextIdentifier.java [moved from opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/RpcContextIdentifier.java with 97% similarity]
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcRouter.java [moved from opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/RpcRouter.java with 98% similarity]
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcRoutingContext.java [moved from opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/RpcRoutingContext.java with 82% similarity]
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcRoutingTable.java [moved from opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/RpcRoutingTable.java with 96% similarity]
opendaylight/md-sal/sal-binding-broker/pom.xml
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModule.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/NotificationBrokerImplModule.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/statistics/DataBrokerRuntimeMXBeanImpl.java [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/RuntimeCodeGenerator.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRouterCodegenInstance.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRoutingTableImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/SingletonHolder.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataBrokerImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/MountPointManagerImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/OsgiConsumerContext.xtend [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/OsgiProviderContext.xtend [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootDataBrokerImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingDomConnectorDeployer.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentConnector.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentMountPointForwarder.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentRpcConnector.java [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedBindingBrokerImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedBroker.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedDataBrokerImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardingUtils.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/osgi/Constants.xtend [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/osgi/PropertiesUtils.xtend [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/osgi/package-info.java [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/RoutingContext.java [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/yang/opendaylight-binding-broker-impl.yang
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/RuntimeCodeGeneratorTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/ChangeOriginatedInDomBrokerTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerMountPointTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/NoficationTest.java
opendaylight/md-sal/sal-binding-util/pom.xml
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalConsumerInstance.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalProviderInstance.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/BindingContextUtils.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/TypeSafeDataReader.java
opendaylight/md-sal/sal-common-util/pom.xml
opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/Arguments.java
opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/CommitHandlerTransactions.java [moved from opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/CommitHandlersTransactions.java with 89% similarity]
opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/Futures.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcProvisionRegistry.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountInstance.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionService.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/$ModuleInfo.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataBrokerImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/MountPointImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/MountPointManagerImpl.xtend
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/MountProviderServiceProxy.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModule.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.xtend
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceListener.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceTwoPhaseCommitTransaction.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.xtend
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfRemoteSchemaSourceProvider.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/XmlDocumentUtils.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/BrokerFacade.xtend
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.xtend
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/InstanceIdWithSchemaNode.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.xtend
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonWithDataFromSeveralModulesTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlWithDataFromSeveralModulesTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/ControllerContextTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyMountInstanceImpl.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/MediaTypesTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestConfigDataTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestDeleteOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestOperationUtils.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/resources/full-versions/yangs/simple-nodes.yang
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/data-of-several-modules/yang/module1.yang [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/data-of-several-modules/yang/module2.yang [new file with mode: 0644]
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsProvider.java
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/NetconfMappingTest.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/util/NetconfUtil.java
opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfMonitoringITTest.java
opendaylight/netconf/netconf-mapping-api/src/main/java/org/opendaylight/controller/netconf/mapping/api/DefaultNetconfOperation.java
opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/xml/model/package-info.java
opendaylight/netconf/netconf-monitoring/src/test/java/org/opendaylight/controller/netconf/monitoring/xml/JaxBSerializerTest.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/SocketThread.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/client/Invoker.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/ExiParameters.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/ExiUtil.java
opendaylight/networkconfiguration/neutron/implementation/pom.xml
opendaylight/networkconfiguration/neutron/pom.xml
opendaylight/northbound/controllermanager/pom.xml
opendaylight/northbound/controllermanager/src/main/java/org/opendaylight/controller/controllermanager/northbound/ControllerManagerNorthbound.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java
opendaylight/protocol_plugins/stub/pom.xml
opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/InventoryService.java
opendaylight/routing/dijkstra_implementation/pom.xml
opendaylight/sal/connection/api/pom.xml
opendaylight/sal/connection/implementation/pom.xml
opendaylight/sal/networkconfiguration/api/pom.xml
opendaylight/sal/networkconfiguration/implementation/pom.xml
opendaylight/samples/loadbalancer/pom.xml
opendaylight/samples/northbound/loadbalancer/pom.xml
opendaylight/samples/simpleforwarding/pom.xml
opendaylight/security/pom.xml
opendaylight/statisticsmanager/api/pom.xml
opendaylight/statisticsmanager/implementation/pom.xml
opendaylight/statisticsmanager/integrationtest/pom.xml
opendaylight/switchmanager/api/pom.xml
opendaylight/switchmanager/implementation/pom.xml
opendaylight/topologymanager/implementation/pom.xml
opendaylight/topologymanager/integrationtest/pom.xml
opendaylight/usermanager/api/pom.xml
opendaylight/usermanager/implementation/pom.xml
opendaylight/web/devices/pom.xml
opendaylight/web/devices/src/main/resources/js/page.js
opendaylight/web/flows/pom.xml
opendaylight/web/flows/src/main/resources/js/page.js
opendaylight/web/root/pom.xml
opendaylight/web/topology/pom.xml
opendaylight/web/troubleshoot/pom.xml

index cba2bb89bae3452f85a73a0fc8db7a6416ff2650..f3a6a3bf4de5719fbc686a96c65906a7cbf6eb8b 100644 (file)
@@ -50,7 +50,7 @@
         <dependency>
          <groupId>org.opendaylight.controller</groupId>
            <artifactId>sal</artifactId>
-          <version>0.6.0-SNAPSHOT</version>
+          <version>0.7.0-SNAPSHOT</version>
         </dependency>
         <dependency>
          <groupId>org.opendaylight.controller</groupId>
index e3576e6ed86cc9284243be20f57358bbe7ce331b..8d3df87c58b0104194368f320ee2fe2a8e3bdc6a 100644 (file)
@@ -78,7 +78,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index 90df7511e4c8050aadfbe42a40bae6a8eea8f821..536fb7dd2e61b2fdad57d661b5cb7b542868c557 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.jboss.jbossts.jta</groupId>
index 8fe1a99a0df59d2e8573b9f2964fb413480457a6..26980e4ff574e4ea82c0b672d89e651afd9ca7f4 100644 (file)
@@ -53,7 +53,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index 4c00ba0db132feed4a3f6991c66e53d0b038114d..e6f889c478df909e3aa46734792197f507642034 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>equinoxSDK381</groupId>
index 03654ebcb223209c01b26738ccadfe4accec97a9..779a887924ca832ac9a0dcbfca23c536d723aa85 100644 (file)
@@ -23,6 +23,7 @@ enum FileType {
     plaintext, xml;
 
     public static final String XML_STORAGE_FIRST_LINE = "<" + ConfigSnapshot.SNAPSHOT_ROOT_ELEMENT_NAME + ">";
+    private static final String XML_FILE_DEFINITION_LINE = "<?xml";
 
     static FileType getFileType(File file) {
         String firstLine = readFirstLine(file);
@@ -35,7 +36,10 @@ enum FileType {
     }
 
     private static boolean isXmlStorage(String firstLine) {
-        return firstLine.startsWith(XML_STORAGE_FIRST_LINE);
+        boolean isXml = false;
+        isXml |= firstLine.startsWith(XML_STORAGE_FIRST_LINE);
+        isXml |= firstLine.startsWith(XML_FILE_DEFINITION_LINE);
+        return isXml;
     }
 
     private static boolean isPlaintextStorage(String firstLine) {
index 0a36db9e2ed76fead08be6ae57fde038430624ae..825eb946c8ec8be817caf0c73470528531e15650 100644 (file)
@@ -14,15 +14,15 @@ import java.util.List;
 import java.util.SortedSet;
 import org.junit.Test;
 import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
-import org.opendaylight.controller.config.persist.api.Persister;
-import org.opendaylight.controller.config.persist.test.PropertiesProviderTest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 public class DirectoryStorageAdapterTest {
-
-    Persister tested;
+    XmlDirectoryPersister tested;
+    Logger logger = LoggerFactory.getLogger(DirectoryStorageAdapterTest.class.toString());
 
     @Test
     public void testEmptyDirectory() throws Exception {
@@ -59,12 +59,8 @@ public class DirectoryStorageAdapterTest {
     @Test
     public void testOneFile() throws Exception {
         File folder = getFolder("oneFile");
-
-        PropertiesProviderTest pp = new PropertiesProviderTest();
-        pp.addProperty("directoryStorage",folder.getPath());
-        XmlDirectoryStorageAdapter xmlDsa = new XmlDirectoryStorageAdapter();
-        tested = xmlDsa.instantiate(pp);
-
+        tested = new XmlDirectoryPersister(folder);
+        logger.info("Testing : "+tested.toString());
         List<ConfigSnapshotHolder> results = tested.loadLastConfigs();
         assertEquals(1, results.size());
         ConfigSnapshotHolder result = results.get(0);
@@ -82,12 +78,8 @@ public class DirectoryStorageAdapterTest {
     @Test
     public void testTwoFiles() throws Exception {
         File folder = getFolder("twoFiles");
-
-        PropertiesProviderTest pp = new PropertiesProviderTest();
-        pp.addProperty("directoryStorage",folder.getPath());
-        XmlDirectoryStorageAdapter xmlDsa = new XmlDirectoryStorageAdapter();
-        tested = xmlDsa.instantiate(pp);
-
+        tested = new XmlDirectoryPersister((folder));
+        logger.info("Testing : "+tested.toString());
         List<ConfigSnapshotHolder> results = tested.loadLastConfigs();
         assertEquals(2, results.size());
 
index abbec382b7a7e2e95e16387f7775912a8e4df855..d08a93e1148b4c00c2f1e794a62aa5846ceb0669 100644 (file)
             <artifactId>mockito-configuration</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>config-persister-api</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
index d6bbeb31da2f3b3caa9a86acbadcd94452c070e1..0e4cce544f049dc361ccc0770d3161db46d5c482 100644 (file)
@@ -9,18 +9,17 @@
 package org.opendaylight.controller.config.persist.storage.file.xml;
 
 import com.google.common.base.Charsets;
-import junit.framework.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
-
 import java.io.File;
 import java.nio.file.Files;
 import java.util.List;
 import java.util.SortedSet;
 import java.util.TreeSet;
-
+import junit.framework.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
+import org.opendaylight.controller.config.persist.test.PropertiesProviderTest;
 import static junit.framework.Assert.assertFalse;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertEquals;
@@ -43,8 +42,11 @@ public class FileStorageAdapterTest {
     @Test
     public void testFileAdapter() throws Exception {
         XmlFileStorageAdapter storage = new XmlFileStorageAdapter();
-        storage.setFileStorage(file);
-        storage.setNumberOfBackups(Integer.MAX_VALUE);
+        PropertiesProviderTest pp = new PropertiesProviderTest();
+        pp.addProperty("fileStorage",file.getPath());
+        pp.addProperty("numberOfBackups",Integer.toString(Integer.MAX_VALUE));
+        storage.instantiate(pp);
+
         final ConfigSnapshotHolder holder = new ConfigSnapshotHolder() {
             @Override
             public String getConfigSnapshot() {
@@ -89,8 +91,12 @@ public class FileStorageAdapterTest {
     @Test
     public void testFileAdapterOneBackup() throws Exception {
         XmlFileStorageAdapter storage = new XmlFileStorageAdapter();
-        storage.setFileStorage(file);
-        storage.setNumberOfBackups(1);
+
+        PropertiesProviderTest pp = new PropertiesProviderTest();
+        pp.addProperty("fileStorage",file.getPath());
+        pp.addProperty("numberOfBackups",Integer.toString(Integer.MAX_VALUE));
+        storage.instantiate(pp);
+
         final ConfigSnapshotHolder holder = new ConfigSnapshotHolder() {
             @Override
             public String getConfigSnapshot() {
@@ -106,7 +112,7 @@ public class FileStorageAdapterTest {
 
         storage.persistConfig(holder);
 
-        assertEquals(16, com.google.common.io.Files.readLines(file, Charsets.UTF_8).size());
+        assertEquals(27, com.google.common.io.Files.readLines(file, Charsets.UTF_8).size());
 
         List<ConfigSnapshotHolder> lastConf = storage.loadLastConfigs();
         assertEquals(1, lastConf.size());
index 3241fb01af69b118c1a62ea6720c5e924a132990..4c83668ab6894052af3315325224885ba4ab8ee6 100644 (file)
@@ -1,11 +1,9 @@
-/**
- * Generated file
-
- * Generated from: yang module name: config-test  yang module local name: testing
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Fri Sep 27 14:06:33 CEST 2013
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
  *
- * Do not modify this file unless it is present under src/main directory
+ * 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.config.yang.logback.config;
 
index 02fba141b338872fe6a1fefa473d56110f9777d8..9837a04e7f903daf5c16b906d36e46f2f72cc6e7 100644 (file)
@@ -1,11 +1,9 @@
-/**
- * Generated file
-
- * Generated from: yang module name: config-test  yang module local name: testing
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Fri Sep 27 14:06:33 CEST 2013
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
  *
- * Do not modify this file unless it is present under src/main directory
+ * 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.config.yang.logback.config;
 
index d75bf6367a6d393d7ee2773a5d903733ae2b21aa..adc69fe31eb596797564ccfa46de81d5cdf264bc 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
  * Generated file
 
index 5e8612f7b94eae1fda8119ec7b25cafb98eafa0c..5a91796ed602d4f239dae51e9ffd14cbd9038f48 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
  * Generated file
 
index 9e63e574895879612858e3a65049d04a456c8395..e8d161afbbafdac3020c86524c36f482bf362adf 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
  * Generated file
 
index 02cbd247a71db70f8dee044771eb904fa67b3b0b..3c52d8c17af7bfadba1d49e42a4d72b0b11459be 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
  * Generated file
 
index 79a5121fa8bee24de0ab719d51ed6faccab26160..c03ade8b5fc63aded18e2540360723c639f82d11 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
 * Generated file
 
index 6af508829be93eb6b64157562806753596b2ae64..71c4b192e5ae3c0c64dcb0d1f43770ddf8fb9d89 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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.config.yang.netty.eventexecutor;
 
 import javax.management.InstanceAlreadyExistsException;
index 9ceef3116ac5603219c019eb2fd21d340e23dcca..3d5a3bf4adf00e78ce5537a884eeb3ad9142d42c 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
 * Generated file
 
index 1dca38182da9c82b49f98848f263270b6ac172b0..c97bd566b07f98ac8ad9914e1db24308a081dd5a 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
 * Generated file
 
index cc78124680990d61474eaa9523e85c7aae0e23da..e65a4d335eb952a53fb68c2fd1e5ac374b351d49 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
  * Generated file
 
index e291ab54658e49b0e1ee0f40e805fff6156f8e88..c869413a5e1726349d894cb9ab140dbb8439cd31 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
  * Generated file
 
index 8bc4d95d60d4f32db07880b43d4f1f050492edbf..1b5668b6100170b8007407ce4840f4be64dc2836 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.config.yang.netty.timer;
 
 import javax.management.InstanceAlreadyExistsException;
index f108303165d0f6ce2de3dd3d36e58d145f250fac..0bdcbbcca413715de256fd7f965968d1e22b9d96 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
  * Generated file
 
index 14fcf41758f2e74f4503c58b4313056f73688adc..17d50562d38b1a71ec460f5ce2db17d7577b03c0 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
  * Generated file
 
index 92eaee5ef25e98e5e07b821a03f9cc718d1af240..6c365990784766410bc143ee0246bfe8bed8099f 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
  * Generated file
 
index e909998a7211a6b2a5af3549ddb33eaffe4dfe93..955d4f16e454b7c56bf94415fb1ae79ac59639a3 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
  * Generated file
 
index a761727e5c673028376b9a7df60a7e07e03e29ce..53320ae1472a709e4aab56624e9610d50f86d2f2 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
  * Generated file
 
index 5e70afb93e8977c5054b58e328f19257454d333d..ff81bc82ae78b9923390d0f9e382e0ae29064c00 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
  * Generated file
 
index de6e6a5ec8e36def81fd8078dbe20847154b277c..d06e6164b1b86cbd65a24ff814357a6b04f1a1e3 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
 * Generated file
 
index 1d3a37c50dd9ee50df23b18e06f71a91e13021e9..39e5f9a508f078985c9c2ce306884bff210cf5f0 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
 * Generated file
 
index 259d90817ea13eaeb83656d75ed8a67e98353189..94639d43c0248787c736a2d7df7738597a4ef975 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
 * Generated file
 
index 878adcfb2cad1af809032393504a1bd3c9448538..64b2a07fff4f0325ba4510a73f7416e43819b26a 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
 * Generated file
 
index 83c4cccfebb309c07af759213cd32a9aa843ed14..c6330e2e59bee1997268d81527c516525d702aa9 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
 * Generated file
 
index ea345baaeb7ef0bb8ef61114d2ed093d698b1356..69f5b1f9acd4ba9649c131787de324ad617171e5 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
+ */
+
 /**
 * Generated file
 
index b2fc75d70016fca4ce13738e1b8d131f01cec64d..b9731cd46d1abc560009ffeeddbe0a3c306bf1b3 100644 (file)
@@ -1,3 +1,10 @@
+/*\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.config.threadpool.async;\r
 \r
 import static org.junit.Assert.assertThat;\r
index 4cd279f881864f858f2d5acbb909f74261b5d762..bc5e98bcb358ec419685823e0403fefe4f6f2e2d 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.config.threadpool.eventbus;
 
 import static org.junit.Assert.assertEquals;
index ee6bbc51bc49d1e1e761032f6adf3a14b3bbb4b4..01a89a987b9c19ea83a979812901140da11ed404 100644 (file)
@@ -1,3 +1,10 @@
+/*\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.config.threadpool.eventbus;\r
 \r
 import static org.mockito.Mockito.doNothing;\r
index 81455a9b21497c4cf1082cdf19542b5276facb92..8bfd049b4b2ca028400a78ad23e987e99400df14 100644 (file)
@@ -1,3 +1,10 @@
+/*\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.config.threadpool.fixed;\r
 \r
 import org.junit.Before;\r
index 00be5d8118983832c0b72543dbded3ac61f1435d..1fc0821405081a0c3a2d6766f91f6c2dfe4010d8 100644 (file)
@@ -1,3 +1,10 @@
+/*\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.config.threadpool.fixed;\r
 \r
 import static org.mockito.Mockito.doNothing;\r
index 5f1a3ee95723d737ce1ad2a7de2d1355fbf7cc45..43cb7e1bcbf3307259d6fd165105931f783a8c44 100644 (file)
@@ -1,3 +1,10 @@
+/*\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.config.threadpool.flexible;\r
 \r
 import org.junit.Before;\r
index 9e9565a4f965d835b2eec18dc4adca7c3d6ed3d0..7280b0410394b7ec11666cd94d30a7c6eb8559b0 100644 (file)
@@ -1,3 +1,10 @@
+/*\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.config.threadpool.naming;\r
 \r
 import static org.junit.Assert.assertEquals;\r
index 5c717ccd4c0ffca9c516e67daa33c25693934c31..f22da34d76f3e5ff39f603f69e672f51eda568f2 100644 (file)
@@ -1,3 +1,10 @@
+/*\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.config.threadpool.naming;\r
 \r
 import static org.mockito.Matchers.any;\r
index 1567896701f47e46b725fbc0af13d3c45388bc2c..6183cb56c172edb3b5c635e75d81e8bc6cdc0cec 100644 (file)
@@ -1,3 +1,10 @@
+/*\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.config.threadpool.scheduled;\r
 \r
 import org.junit.Before;\r
index d1464baa6e0ffb48d2aa7ebf84ac83b484846527..0fe5b0d1834cd78f2e17804fa1e759805d22ced8 100644 (file)
@@ -1,3 +1,10 @@
+/*\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.config.threadpool.scheduled;\r
 \r
 import com.google.common.util.concurrent.ListenableFutureTask;\r
index 38de6e15285377993f3d24b4a3da7977037ed737..b3e7b90c966d0f3e12e4c097c18c44d7ae1dbc14 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.config.yangjmxgenerator.attribute;
 
 import org.opendaylight.controller.config.yangjmxgenerator.ServiceInterfaceEntry;
index d4ae1523756f0128775327ecc876a9b25bf233dc..282185bd7013a94d3d79b51434da27ad16dec2c2 100644 (file)
@@ -44,7 +44,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
 </project>
index 498b3d4e9335db0e8c7c0778f7672b1a7342ee00..db596bf346b07a4b3c5bfa47f8595bff6d7c5636 100644 (file)
@@ -52,7 +52,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
@@ -62,7 +62,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index e18fe8c1ed375ccc7ea666547914dda9c3969c4e..65d46c3e0a269bd1584efd67c2f77148bb8d6cd6 100644 (file)
@@ -35,7 +35,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>forwardingrulesmanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 4471863c0d5c37ffeccea91c05cf939f3dc15049..ab0a32882e4b1376391033541d44b10ba7b90a5e 100644 (file)
@@ -45,7 +45,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 58b21eccb89c27efeefe37c3e8393222b4333887..a3cbe5160712dcb5bf6b259061b57bc28ac7163b 100644 (file)
@@ -54,7 +54,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
@@ -64,7 +64,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index f7e385c87842e6c68319c8cd2dc99a80a56c45f5..1ca905054b5f2e6b32793e84badbf7838100a461 100644 (file)
@@ -54,7 +54,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
 </project>
index 18ed78c37bcb7cf348ede7e1e0641ee2a34a4c4c..bd12bfc87dda36258d60234ab52104b5e94fecec 100644 (file)
@@ -62,7 +62,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
@@ -87,7 +87,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 3b86a797ca22ae3841823043a118ac7e07e043a3..ee1ef12c11e0b565d60ddbc43053699011f9b0dd 100644 (file)
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
@@ -67,7 +67,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index dccb267f3ab565ed5c3022d088292b90e76cccb5..be6fae759819e4d3226e96309e1e658db202480f 100644 (file)
@@ -46,7 +46,6 @@ netconf.config.persister.2.storageAdapterClass=org.opendaylight.controller.confi
 netconf.config.persister.2.properties.fileStorage=configuration/current/controller.currentconfig.xml
 netconf.config.persister.2.properties.numberOfBackups=1
 
-
 yangstore.blacklist=.*controller.model.*
 
 # Set Default start level for framework
index f160cddaade8ee635db3341d30abc85b97a837b9..a0b7367acde6a2ccaeadb6e13c2195583da9f5f8 100644 (file)
@@ -67,7 +67,7 @@
   <dependency>
    <groupId>org.opendaylight.controller</groupId>
    <artifactId>forwardingrulesmanager</artifactId>
-   <version>0.4.1-SNAPSHOT</version>
+   <version>0.5.0-SNAPSHOT</version>
   </dependency>
   <dependency>
    <groupId>org.opendaylight.controller</groupId>
@@ -86,7 +86,7 @@
   <dependency>
    <groupId>org.opendaylight.controller</groupId>
    <artifactId>sal</artifactId>
-   <version>0.5.1-SNAPSHOT</version>
+   <version>0.7.0-SNAPSHOT</version>
   </dependency>
  </dependencies>
 </project>
index 499b98c28ad1c04dd8512af4501b799e4a3e0124..afd3d0ba7ce74f83a710cbbefdcff345ecad8693 100644 (file)
@@ -78,7 +78,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 6b3f5347adb58e7bb31f28d4dae6de262a15db65..ef69b49ca91ff800ec1ee759f6d5c6f3fad7399d 100644 (file)
@@ -84,7 +84,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 2b3347f312469b00ca6748f5d19884626ce1daf3..41075b9554339d7bd503ba9e1dd952bcfa080ac0 100644 (file)
@@ -2994,7 +2994,11 @@ public class ForwardingRulesManager implements
                 // staticFlowEntry should never be null.
                 // the null check is just an extra defensive check.
                 if(staticFlowEntry != null) {
-                    staticFlows.remove(staticFlowEntry.getKey());
+                    // Modify status and update cluster cache
+                    log.debug("Updating static flow configuration on async error event");
+                    String status = String.format("Cannot be installed on node. reason: %s", errorString);
+                    staticFlowEntry.getValue().setStatus(status);
+                    refreshClusterStaticFlowsStatus(node);
                 }
             }
         }
index ea66c34fa3f69dcb63800a0a5898a02720627103..bf2e360334b1221af3f8cc7eabde31084434e003 100644 (file)
   <dependency>
    <groupId>org.opendaylight.controller</groupId>
    <artifactId>clustering.services</artifactId>
-   <version>0.4.1-SNAPSHOT</version>
+   <version>0.5.0-SNAPSHOT</version>
   </dependency>
   <dependency>
    <groupId>org.opendaylight.controller</groupId>
    <artifactId>sal</artifactId>
-   <version>0.5.1-SNAPSHOT</version>
+   <version>0.7.0-SNAPSHOT</version>
   </dependency>
   <dependency>
    <groupId>junit</groupId>
index 258327cca7254472dcf8d8208b21a920a0f0ecc5..78c4ae4160f26c7e40f026353c6a5dcd614c98a7 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index d8b5a4843550f374be970e9e93fcaaaa39eb99e0..ba3da5f764a9c524cd47a83a577268941d77202b 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index 0405d45b6e1989cc186927a016794108c9ac86d2..c5caa7f317bfa5647ed0e6c30f772f461a440399 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 9cbf35576f49ace3b4f6c26b8e7404f951f45c0a..62775c1eecf46115d6b741e93b36b2bbe835efe7 100644 (file)
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>0.7.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>clustering.services</artifactId>
-            <version>0.4.1-SNAPSHOT</version>
+            <version>0.5.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
index 176ab6cbe0138a5ae9cecdf4877bb5a4ebeaa5d1..129e6ff5fcf449122e578bcd8d0c1218a58a7a91 100644 (file)
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>0.7.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>clustering.services</artifactId>
-            <version>0.4.1-SNAPSHOT</version>
+            <version>0.5.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal.implementation</artifactId>
-            <version>0.4.0-SNAPSHOT</version>
+            <version>0.4.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>containermanager</artifactId>
-            <version>0.5.0-SNAPSHOT</version>
+            <version>0.5.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>containermanager.it.implementation</artifactId>
-            <version>0.5.0-SNAPSHOT</version>
+            <version>0.5.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>clustering.stub</artifactId>
-            <version>0.4.0-SNAPSHOT</version>
+            <version>0.4.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
index 3c8bf979614082dcc257e0e0ff82e8c44190c9ec..fd31e358594a62a9a248a4833dbfcb5c735be9d7 100644 (file)
@@ -77,7 +77,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>forwardingrulesmanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index d9fb18f84de5d6b0c3cc1c25e9c5be475ab40a42..1b510d0e0b0c082bc090631e3973dfc895900859 100644 (file)
@@ -51,7 +51,7 @@
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>switchmanager</artifactId>
-            <version>0.6.1-SNAPSHOT</version>
+            <version>0.7.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
@@ -98,7 +98,7 @@
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>forwardingrulesmanager</artifactId>
-            <version>0.4.1-SNAPSHOT</version>
+            <version>0.5.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
index 5e52e3bb89a08b43810b94b5dbfb22fc36111c4d..74193ea128c0525de4f9c4b7e2d1245e4fb020c2 100644 (file)
@@ -33,7 +33,7 @@
     <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>clustering.services</artifactId>
-        <version>0.4.1-SNAPSHOT</version>
+        <version>0.5.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
   <packaging>bundle</packaging>
index 2156a81787b9906b46cdcd4f83138d33feb67de1..4587cc59edc9dfd587daaa68d7d2b40be023166a 100644 (file)
@@ -28,8 +28,10 @@ import org.opendaylight.controller.sal.utils.GlobalConstants
 import org.opendaylight.controller.sal.utils.INodeConnectorFactory
 import org.opendaylight.controller.sal.utils.INodeFactory
 import org.opendaylight.controller.clustering.services.IClusterGlobalServices
+import org.opendaylight.controller.sal.packet.IPluginInDataPacketService
 
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryService
@@ -38,8 +40,11 @@ import org.osgi.framework.BundleContext
 
 import static org.opendaylight.controller.sal.compatibility.NodeMapping.*
 import org.opendaylight.controller.sal.compatibility.topology.TopologyProvider
+import org.opendaylight.controller.sal.compatibility.adsal.DataPacketServiceAdapter
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext
 
-class ComponentActivator extends ComponentActivatorAbstractBase implements BindingAwareConsumer {
+class ComponentActivator extends ComponentActivatorAbstractBase {
 
     private BundleContext context;
 
@@ -64,6 +69,10 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
     @Property
     TopologyProvider tpProvider = new TopologyProvider()
 
+    @Property
+    DataPacketServiceAdapter dataPacketService = new DataPacketServiceAdapter()
+
+
 
     override protected init() {
         Node.NodeIDType.registerIDType(MD_SAL_TYPE, String);
@@ -76,34 +85,9 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
     }
 
     def setBroker(BindingAwareBroker broker) {
-        broker.registerConsumer(this, context)
+        broker.registerProvider(new SalCompatibilityProvider(this), context)
     }
 
-    override onSessionInitialized(ConsumerContext session) {
-        val subscribe = session.getSALService(NotificationService)
-
-        // Registration of Flow Service
-        flow.delegate = session.getRpcService(SalFlowService)
-        flow.dataBrokerService = session.getSALService(DataBrokerService);
-        subscribe.registerNotificationListener(flow);
-
-        // Data Packet Service
-        subscribe.registerNotificationListener(inventory);
-
-        // Inventory Service
-        inventory.dataService = session.getSALService(DataBrokerService);
-        inventory.flowStatisticsService = session.getRpcService(OpendaylightFlowStatisticsService);
-        inventory.flowTableStatisticsService = session.getRpcService(OpendaylightFlowTableStatisticsService);
-        inventory.nodeConnectorStatisticsService = session.getRpcService(OpendaylightPortStatisticsService);
-        inventory.topologyDiscovery = session.getRpcService(FlowTopologyDiscoveryService);
-               inventory.dataProviderService = session.getSALService(DataProviderService)
-               topology.dataService = session.getSALService(DataProviderService)
-               tpProvider.dataService = session.getSALService(DataProviderService)
-               tpProvider.start();
-
-        subscribe.registerNotificationListener(dataPacket)
-
-    }
 
     override protected getGlobalImplementations() {
         return Arrays.asList(this, flow, inventory, dataPacket, nodeFactory, nodeConnectorFactory,topology,tpProvider)
@@ -113,6 +97,14 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
         configure(imp, c);
     }
 
+    override protected getImplementations() {
+        return Arrays.asList(dataPacketService)
+    }
+
+    override protected configureInstance(Component c, Object imp, String containerName) {
+        instanceConfigure(imp, c, containerName);
+    }
+
     private def dispatch configure(MDSalNodeFactory imp, Component it) {
         setInterface(INodeFactory.name, properties);
     }
@@ -154,6 +146,14 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
 
     }
 
+    private def dispatch instanceConfigure(DataPacketServiceAdapter imp, Component it, String containerName) {
+        setInterface(IPluginInDataPacketService.name, properties)
+    }
+
+    private def dispatch instanceConfigure(ComponentActivator imp, Component it, String containerName) {
+    }
+
+
     private def dispatch configure(InventoryAndReadAdapter imp, Component it) {
         setInterface(Arrays.asList(IPluginInInventoryService.name, IPluginInReadService.name), properties)
         add(
@@ -164,7 +164,7 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
         add(
             createServiceDependency() //
             .setService(IPluginOutInventoryService) //
-            .setCallbacks("setInventoryPublisher", "setInventoryPublisher") //
+            .setCallbacks("setInventoryPublisher", "unsetInventoryPublisher") //
             .setRequired(false))
         add(
             createServiceDependency() //
@@ -199,3 +199,54 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
         return props;
     }
 }
+package class SalCompatibilityProvider implements BindingAwareProvider {
+    
+    private val ComponentActivator activator;
+    
+    new(ComponentActivator cmpAct) {
+        activator = cmpAct;
+    }
+    
+    override getFunctionality() {
+        // Noop
+    }
+    
+    override getImplementations() {
+        // Noop
+    }
+    
+    
+    override onSessionInitialized(ConsumerContext session) {
+        // Noop
+    }
+    
+    
+    override onSessionInitiated(ProviderContext session) {
+        val it = activator
+                val subscribe = session.getSALService(NotificationService)
+
+        // Registration of Flow Service
+        flow.delegate = session.getRpcService(SalFlowService)
+        flow.dataBrokerService = session.getSALService(DataBrokerService);
+        subscribe.registerNotificationListener(flow);
+
+        // Data Packet Service
+        subscribe.registerNotificationListener(inventory);
+        dataPacketService.delegate = session.getRpcService(PacketProcessingService)
+
+        // Inventory Service
+        inventory.dataService = session.getSALService(DataBrokerService);
+        inventory.flowStatisticsService = session.getRpcService(OpendaylightFlowStatisticsService);
+        inventory.flowTableStatisticsService = session.getRpcService(OpendaylightFlowTableStatisticsService);
+        inventory.nodeConnectorStatisticsService = session.getRpcService(OpendaylightPortStatisticsService);
+        inventory.topologyDiscovery = session.getRpcService(FlowTopologyDiscoveryService);
+        inventory.dataProviderService = session.getSALService(DataProviderService)
+        topology.dataService = session.getSALService(DataProviderService)
+        tpProvider.dataService = session.getSALService(DataProviderService)
+
+
+        tpProvider.start();
+
+        subscribe.registerNotificationListener(dataPacket)
+    }
+}
index 47a3d113254eee1ad85a66a63132de283fe4ac73..21af047c3d79a5cb2d6c2508e05f9121b119be71 100644 (file)
@@ -3,6 +3,8 @@ package org.opendaylight.controller.sal.compatibility
 import java.util.ArrayList
 import java.util.Collections
 import java.util.List
+import java.util.Set
+import java.util.concurrent.CopyOnWriteArrayList;
 import org.opendaylight.controller.sal.binding.api.data.DataBrokerService
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService
 import org.opendaylight.controller.sal.core.Edge
@@ -93,15 +95,23 @@ class InventoryAndReadAdapter implements IPluginInReadService,
     @Property
     OpendaylightFlowTableStatisticsService flowTableStatisticsService;
 
-    @Property
-    IPluginOutInventoryService inventoryPublisher;
-
     @Property
     FlowTopologyDiscoveryService topologyDiscovery;
     
     @Property
-    List<IPluginOutReadService> statisticsPublisher = new ArrayList<IPluginOutReadService>();
-       
+    List<IPluginOutReadService> statisticsPublisher = new CopyOnWriteArrayList<IPluginOutReadService>();
+
+    @Property
+    List<IPluginOutInventoryService> inventoryPublisher = new CopyOnWriteArrayList<IPluginOutInventoryService>();
+
+       def setInventoryPublisher(IPluginOutInventoryService listener){
+        inventoryPublisher.add(listener);
+       }
+
+       def unsetInventoryPublisher(IPluginOutInventoryService listener){
+        inventoryPublisher.remove(listener);
+       }
+
     def setReadPublisher(IPluginOutReadService listener) {
        statisticsPublisher.add(listener);
     }
@@ -330,7 +340,7 @@ class InventoryAndReadAdapter implements IPluginInReadService,
     override onNodeRemoved(NodeRemoved notification) {
         val properties = Collections.<org.opendaylight.controller.sal.core.Property>emptySet();
 
-        inventoryPublisher.updateNode(notification.nodeRef.toADNode, UpdateType.REMOVED, properties);
+        publishNodeUpdate(notification.nodeRef.toADNode, UpdateType.REMOVED, properties);
     }
 
     override onNodeConnectorUpdated(NodeConnectorUpdated update) {
@@ -341,7 +351,7 @@ class InventoryAndReadAdapter implements IPluginInReadService,
 
         var nodeConnector = update.nodeConnectorRef.toADNodeConnector
 
-        inventoryPublisher.updateNodeConnector(nodeConnector , updateType , update.toADNodeConnectorProperties);
+        publishNodeConnectorUpdate(nodeConnector , updateType , update.toADNodeConnectorProperties);
     }
 
     override onNodeUpdated(NodeUpdated notification) {
@@ -351,7 +361,7 @@ class InventoryAndReadAdapter implements IPluginInReadService,
         if ( this._dataService.readOperationalData(identifier) == null ){
             updateType = UpdateType.ADDED;
         }
-        inventoryPublisher.updateNode(notification.nodeRef.toADNode, updateType, notification.toADNodeProperties);
+        publishNodeUpdate(notification.nodeRef.toADNode, updateType, notification.toADNodeProperties);
         
                //Notify the listeners of IPluginOutReadService
         
@@ -574,4 +584,17 @@ class InventoryAndReadAdapter implements IPluginInReadService,
        override  getConfiguredNotConnectedNodes() {
         return Collections.emptySet();
        }
+
+
+       private def publishNodeUpdate(Node node, UpdateType updateType, Set<org.opendaylight.controller.sal.core.Property> properties){
+           for( publisher : inventoryPublisher){
+               publisher.updateNode(node, updateType, properties);
+           }
+       }
+
+       private def publishNodeConnectorUpdate(org.opendaylight.controller.sal.core.NodeConnector nodeConnector, UpdateType updateType, Set<org.opendaylight.controller.sal.core.Property> properties){
+           for( publisher : inventoryPublisher){
+               publisher.updateNodeConnector(nodeConnector, updateType, properties);
+           }
+       }
 }
index aa67600124e8ebc229b46c3d391f09011b604ce7..edd3a27255d48dc27f3e67ff808a6ca7c8ce440b 100644 (file)
@@ -3,7 +3,6 @@ package org.opendaylight.controller.sal.compatibility.adsal;
 import org.opendaylight.controller.sal.compatibility.NodeMapping;
 import org.opendaylight.controller.sal.packet.IPluginInDataPacketService;
 import org.opendaylight.controller.sal.packet.RawPacket;
-import org.opendaylight.controller.sal.packet.RawPacket;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
@@ -22,8 +21,12 @@ public class DataPacketServiceAdapter implements IPluginInDataPacketService {
     private TransmitPacketInput toTransmitPacketInput(RawPacket rawPacket) {
         TransmitPacketInputBuilder builderTPIB = new TransmitPacketInputBuilder();
 
-        NodeConnectorRef egress = NodeMapping.toNodeConnectorRef(rawPacket.getOutgoingNodeConnector());
-        NodeConnectorRef ingress = NodeMapping.toNodeConnectorRef(rawPacket.getIncomingNodeConnector());
+        builderTPIB.setNode(NodeMapping.toNodeRef(rawPacket.getOutgoingNodeConnector().getNode()));
+
+        NodeConnectorRef egress = rawPacket.getOutgoingNodeConnector() == null ? null :
+                NodeMapping.toNodeConnectorRef(rawPacket.getOutgoingNodeConnector());
+        NodeConnectorRef ingress = rawPacket.getIncomingNodeConnector() == null ? null :
+                NodeMapping.toNodeConnectorRef(rawPacket.getIncomingNodeConnector());
         byte[] payload = rawPacket.getPacketData();
 
         builderTPIB.setEgress(egress);
@@ -33,4 +36,14 @@ public class DataPacketServiceAdapter implements IPluginInDataPacketService {
         return builderTPIB.build();
     }
 
+    public PacketProcessingService getDelegate() {
+        return delegate;
+    }
+
+    public void setDelegate(PacketProcessingService delegate) {
+        this.delegate = delegate;
+    }
+
+
+
 }
index 1c21effd05ac1c9e93f26b187b32760046b4390e..5e69548d9a8cbcf70bee61561b6235bae60aae0d 100644 (file)
@@ -19,7 +19,7 @@
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>opendaylight-l2-types</artifactId>
-            <version>2013.08.27.0</version>
+            <version>2013.08.27.1</version>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
index 1a0c37055b782bf38d55c381566a46f6723ddbba..db2c62d9af24e8199988113d80439a3d7c6f252c 100644 (file)
@@ -29,7 +29,7 @@
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>opendaylight-l2-types</artifactId>
-            <version>2013.08.27.0</version>
+            <version>2013.08.27.1</version>
         </dependency>
     </dependencies>
     <packaging>bundle</packaging>
index 6b8df6a4c8cd3ca42bdffa48160aad3c3b24dc78..c2e48b3df59d13134c73747b3d5b637fb6eb0ccc 100644 (file)
@@ -29,7 +29,7 @@
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>opendaylight-l2-types</artifactId>
-            <version>2013.08.27.0</version>
+            <version>2013.08.27.1</version>
         </dependency>
     </dependencies>
     <packaging>bundle</packaging>
index 476c817c9084812ad78f5cb6993ed047a631e379..e95fe24f28a9e8e6cf9e32af8a2f823fc001a20f 100644 (file)
@@ -29,7 +29,7 @@
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>opendaylight-l2-types</artifactId>
-            <version>2013.08.27-SNAPSHOT</version>
+            <version>2013.08.27.1-SNAPSHOT</version>
         </dependency>
     </dependencies>
     <packaging>bundle</packaging>
index a788baf4c0642a1ebb26b390ba415a338a45a033..dedd318a0cf4b1e2cce4396d5b1874cc63548a74 100644 (file)
@@ -86,7 +86,7 @@
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>clustering.services</artifactId>
-            <version>0.4.1-SNAPSHOT</version>
+            <version>0.5.0-SNAPSHOT</version>
         </dependency>
 
 
index e20640d4202d0bc3441d713bb3caee9a5e14e9eb..72c6b1d75d99fec54f2914b2cc201e9a527910ed 100644 (file)
@@ -7,7 +7,7 @@ import org.opendaylight.yangtools.yang.binding.RpcService;
  * version of RpcServices
  * 
  */
-public interface RpcConsumerRegistry {
+public interface RpcConsumerRegistry extends BindingAwareService {
     /**
      * Returns a session specific instance (implementation) of requested
      * YANG module implentation / service provided by consumer.
index 972e64faf6caa16db8c994db7c39c5682eed1539..cc764888cca932b89dacfe8210c6671147bc5f9d 100644 (file)
@@ -1,18 +1,22 @@
 package org.opendaylight.controller.sal.binding.api;
 
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
 /**
- * Interface defining provider's access to the Rpc Registry
- * which could be used to register their implementations of service to the MD-SAL.
+ * Interface defining provider's access to the Rpc Registry which could be used
+ * to register their implementations of service to the MD-SAL.
  * 
  * @author ttkacik
- *
+ * 
  */
-public interface RpcProviderRegistry extends RpcConsumerRegistry {
+public interface RpcProviderRegistry extends //
+        RpcConsumerRegistry, //
+        RouteChangePublisher<RpcContextIdentifier, InstanceIdentifier<?>> {
     /**
      * Registers an global RpcService implementation.
      * 
@@ -25,12 +29,16 @@ public interface RpcProviderRegistry extends RpcConsumerRegistry {
 
     /**
      * 
-     * Register an Routed RpcService where routing is determined on annotated (in YANG model)
-     * context-reference and value of annotated leaf.
+     * Register an Routed RpcService where routing is determined on annotated
+     * (in YANG model) context-reference and value of annotated leaf.
      * 
-     * @param type Type of RpcService, use generated interface class, not your implementation clas
-     * @param implementation Implementation of RpcService
-     * @return Registration object for routed Rpc which could be used to close an 
+     * @param type
+     *            Type of RpcService, use generated interface class, not your
+     *            implementation clas
+     * @param implementation
+     *            Implementation of RpcService
+     * @return Registration object for routed Rpc which could be used to close
+     *         an
      * 
      * @throws IllegalStateException
      */
index d91a216baa0f66bf4d5b7c8de94460844a321f06..194c431ec0aad22a2391f20d4949f414b53bc41b 100644 (file)
@@ -1,18 +1,36 @@
 package org.opendaylight.controller.sal.binding.api.mount;
 
+import java.util.EventListener;
+
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
- * Provider MountProviderService, this version allows access to MD-SAL
- * services specific for this mountpoint and registration / provision of
- * interfaces for mount point.
+ * Provider MountProviderService, this version allows access to MD-SAL services
+ * specific for this mountpoint and registration / provision of interfaces for
+ * mount point.
  * 
  * @author ttkacik
  * 
  */
-public interface MountProviderService extends MountInstance {
+public interface MountProviderService extends MountService {
+    
+    @Override
+    public MountProviderInstance getMountPoint(InstanceIdentifier<?> path);
 
     MountProviderInstance createMountPoint(InstanceIdentifier<?> path);
+
+    MountProviderInstance createOrGetMountPoint(InstanceIdentifier<?> path);
+
+    ListenerRegistration<MountProvisionListener> registerProvisionListener(MountProvisionListener listener);
+
+    public interface MountProvisionListener extends EventListener {
+
+        void onMountPointCreated(InstanceIdentifier<?> path);
+
+        void onMountPointRemoved(InstanceIdentifier<?> path);
+
+    }
 }
similarity index 98%
rename from opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/RpcRouter.java
rename to opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcRouter.java
index 621d048dfd771694d5b479588980140e9e873066..31fed62d876ef5b8e25512023393204bf1856d02 100644 (file)
@@ -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.spi;
+package org.opendaylight.controller.sal.binding.api.rpc;
 
 import java.util.Set;
 
@@ -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.spi;
+package org.opendaylight.controller.sal.binding.api.rpc;
 
 import java.util.Map;
 
index 1b0f78384f1a6c166b46fed6f4f89152e276c77c..29357c04328a056c107af1671b35228970060979 100644 (file)
             <artifactId>sal-binding-api</artifactId>
             <version>1.0-SNAPSHOT</version>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-binding-util</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
index c46b0dd6b4c529d00e0fae55f862f6a0229e701b..cd45f2c8b2bf8439f19bccbd4125e3eb3d253309 100644 (file)
@@ -1,48 +1,85 @@
 /**\r
-* Generated file\r
+ * Generated file\r
 \r
-* Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: binding-broker-impl\r
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator\r
-* Generated at: Wed Nov 20 17:33:01 CET 2013\r
-*\r
-* Do not modify this file unless it is present under src/main directory\r
-*/\r
+ * Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: binding-broker-impl\r
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator\r
+ * Generated at: Wed Nov 20 17:33:01 CET 2013\r
+ *\r
+ * Do not modify this file unless it is present under src/main directory\r
+ */\r
 package org.opendaylight.controller.config.yang.md.sal.binding.impl;\r
 \r
-import org.opendaylight.controller.sal.binding.impl.BindingAwareBrokerImpl;\r
+import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;\r
+import org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker;\r
+import org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl;\r
+import org.opendaylight.controller.sal.binding.impl.forward.DomForwardedBindingBrokerImpl;\r
+import org.opendaylight.controller.sal.binding.impl.forward.DomForwardingUtils;\r
 import org.osgi.framework.BundleContext;\r
 \r
-import com.google.common.base.Preconditions;\r
+import com.google.common.util.concurrent.MoreExecutors;\r
 \r
 /**\r
 *\r
 */\r
-public final class BindingBrokerImplModule extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingBrokerImplModule {\r
+public final class BindingBrokerImplModule extends\r
+        org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingBrokerImplModule {\r
 \r
     private BundleContext bundleContext;\r
 \r
-    public BindingBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {\r
+    public BindingBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,\r
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {\r
         super(identifier, dependencyResolver);\r
     }\r
 \r
-    public BindingBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, BindingBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) {\r
+    public BindingBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,\r
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,\r
+            BindingBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) {\r
         super(identifier, dependencyResolver, oldModule, oldInstance);\r
     }\r
 \r
     @Override\r
-    public void validate(){\r
+    public void validate() {\r
         super.validate();\r
     }\r
 \r
     @Override\r
     public java.lang.AutoCloseable createInstance() {\r
-        BindingAwareBrokerImpl broker = new BindingAwareBrokerImpl(getIdentifier().getInstanceName(),getBundleContext());\r
-        broker.setDataBroker(getDataBrokerDependency());\r
-        broker.setNotifyBroker(getNotificationServiceDependency());\r
+\r
+        RootBindingAwareBroker broker;\r
+        if (DomForwardingUtils.isDomForwardedBroker(getDataBrokerDependency())) {\r
+            broker = createForwardedBroker();\r
+        } else {\r
+            broker = createStandaloneBroker();\r
+        }\r
         broker.start();\r
         return broker;\r
     }\r
 \r
+    private RootBindingAwareBroker createStandaloneBroker() {\r
+        RootBindingAwareBroker broker = new RootBindingAwareBroker(getIdentifier().getInstanceName());\r
+\r
+        broker.setDataBroker(getDataBrokerDependency());\r
+        broker.setNotificationBroker(getNotificationServiceDependency());\r
+        broker.setRpcBroker(new RpcProviderRegistryImpl(broker.getIdentifier()));\r
+        return broker;\r
+    }\r
+\r
+    private RootBindingAwareBroker createForwardedBroker() {\r
+        DomForwardedBindingBrokerImpl broker = new DomForwardedBindingBrokerImpl(getIdentifier().getInstanceName());\r
+\r
+        broker.setDataBroker(getDataBrokerDependency());\r
+        broker.setNotificationBroker(getNotificationServiceDependency());\r
+        broker.setRpcBroker(new RpcProviderRegistryImpl(broker.getIdentifier()));\r
+\r
+        broker.getMountManager().setDataCommitExecutor(SingletonHolder.getDefaultCommitExecutor());\r
+        broker.getMountManager().setNotificationExecutor(SingletonHolder.getDefaultNotificationExecutor());\r
+\r
+\r
+        DomForwardingUtils.reuseForwardingFrom(broker, broker.getDataBroker());\r
+        broker.startForwarding();\r
+        return broker;\r
+    }\r
+\r
     public BundleContext getBundleContext() {\r
         return bundleContext;\r
     }\r
index 01dc6b8c0cd6162be049fe44d6806524da820f7a..185b37bab53a2789763979525f9455e73aaee8d3 100644 (file)
@@ -13,12 +13,16 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;\r
 import java.util.concurrent.ScheduledExecutorService;\r
 \r
-import org.opendaylight.controller.config.yang.md.sal.binding.statistics.DataBrokerRuntimeMXBeanImpl;\r
 import org.opendaylight.controller.md.sal.common.impl.routing.AbstractDataReadRouter;\r
+import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;\r
 import org.opendaylight.controller.sal.binding.impl.DataBrokerImpl;\r
+import org.opendaylight.controller.sal.binding.impl.RootDataBrokerImpl;\r
+import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingDomConnectorDeployer;\r
 import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingIndependentConnector;\r
 import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingIndependentMappingService;\r
+import org.opendaylight.controller.sal.binding.impl.forward.DomForwardedDataBrokerImpl;\r
 import org.opendaylight.controller.sal.core.api.Broker;\r
+import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;\r
 import org.opendaylight.controller.sal.core.api.data.DataProviderService;\r
 import org.opendaylight.yangtools.yang.binding.DataObject;\r
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;\r
@@ -52,25 +56,38 @@ public final class DataBrokerImplModule extends
 \r
     @Override\r
     public java.lang.AutoCloseable createInstance() {\r
-        DataBrokerRuntimeMXBeanImpl dataBindingBroker = new DataBrokerRuntimeMXBeanImpl();\r
+        RootDataBrokerImpl dataBindingBroker;\r
         \r
-        // FIXME: obtain via dependency management\r
-        ExecutorService executor = Executors.newCachedThreadPool();\r
-        ExecutorService listeningExecutor = MoreExecutors.listeningDecorator(executor);\r
-        dataBindingBroker.setExecutor(listeningExecutor);\r
-\r
-        Broker domBroker = getDomBrokerDependency();\r
-        BindingIndependentMappingService mappingService = getMappingServiceDependency();\r
         \r
-        if (domBroker != null && mappingService != null) {\r
-            BindingIndependentConnector runtimeMapping = new BindingIndependentConnector();\r
-            runtimeMapping.setMappingService(mappingService);\r
-            runtimeMapping.setBaDataService(dataBindingBroker);\r
-            domBroker.registerProvider(runtimeMapping, getBundleContext());\r
+        ExecutorService listeningExecutor = SingletonHolder.getDefaultCommitExecutor();\r
+        \r
+        if (getDomBrokerDependency() != null && getMappingServiceDependency() != null) {\r
+            \r
+            dataBindingBroker = createDomConnectedBroker(listeningExecutor);\r
+        } else {\r
+            dataBindingBroker = createStandAloneBroker(listeningExecutor);\r
         }\r
-        getRootRuntimeBeanRegistratorWrapper().register(dataBindingBroker);\r
+        dataBindingBroker.registerRuntimeBean(getRootRuntimeBeanRegistratorWrapper());\r
+\r
         return dataBindingBroker;\r
     }\r
+    private RootDataBrokerImpl createStandAloneBroker(ExecutorService listeningExecutor) {\r
+        RootDataBrokerImpl broker = new RootDataBrokerImpl();\r
+        broker.setExecutor(listeningExecutor);\r
+        return broker;\r
+    }\r
+\r
+    private RootDataBrokerImpl createDomConnectedBroker(ExecutorService listeningExecutor) {\r
+        DomForwardedDataBrokerImpl forwardedBroker = new DomForwardedDataBrokerImpl();\r
+        forwardedBroker.setExecutor(listeningExecutor);\r
+        BindingIndependentConnector connector = BindingDomConnectorDeployer.createConnector(getMappingServiceDependency());\r
+        getDomBrokerDependency().registerProvider(forwardedBroker, getBundleContext());\r
+        ProviderSession domContext = forwardedBroker.getDomProviderContext();\r
+        forwardedBroker.setConnector(connector);\r
+        forwardedBroker.setDomProviderContext(domContext);\r
+        forwardedBroker.startForwarding();\r
+        return forwardedBroker;\r
+    }\r
 \r
     public BundleContext getBundleContext() {\r
         return bundleContext;\r
index e4f74deb4b3487e31f080186315bc14dc4f9d9d5..644860595e0de2f7b4974616ac341ccc363dc453 100644 (file)
@@ -13,6 +13,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 
+import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
 import org.opendaylight.controller.sal.binding.impl.NotificationBrokerImpl;
 
 import com.google.common.util.concurrent.ListeningExecutorService;
@@ -43,8 +44,7 @@ public final class NotificationBrokerImplModule extends
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-        ExecutorService executor = Executors.newFixedThreadPool(5);
-        ListeningExecutorService listeningExecutor = MoreExecutors.listeningDecorator(executor);
+        ListeningExecutorService listeningExecutor = SingletonHolder.getDefaultNotificationExecutor();
         NotificationBrokerImpl broker = new NotificationBrokerImpl(listeningExecutor);
         return broker;
     }
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/statistics/DataBrokerRuntimeMXBeanImpl.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/statistics/DataBrokerRuntimeMXBeanImpl.java
deleted file mode 100644 (file)
index 5da084e..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.opendaylight.controller.config.yang.md.sal.binding.statistics;\r
-\r
-import org.opendaylight.controller.config.yang.md.sal.binding.impl.Data;\r
-import org.opendaylight.controller.config.yang.md.sal.binding.impl.DataBrokerImplRuntimeMXBean;\r
-import org.opendaylight.controller.config.yang.md.sal.binding.impl.Transactions;\r
-import org.opendaylight.controller.sal.binding.impl.DataBrokerImpl;\r
-\r
-public class DataBrokerRuntimeMXBeanImpl extends DataBrokerImpl implements DataBrokerImplRuntimeMXBean {\r
-    \r
-    private final Transactions transactions = new Transactions();\r
-    private final Data data = new Data();\r
-    \r
-    public Transactions getTransactions() {\r
-        transactions.setCreated(getCreatedTransactionsCount().get());\r
-        transactions.setSubmitted(getSubmittedTransactionsCount().get());\r
-        transactions.setSuccessful(getFinishedTransactionsCount().get());\r
-        transactions.setFailed(getFailedTransactionsCount().get());\r
-        return transactions;\r
-    }\r
-\r
-    @Override\r
-    public Data getData() {\r
-        transactions.setCreated(getCreatedTransactionsCount().get());\r
-        transactions.setSubmitted(getSubmittedTransactionsCount().get());\r
-        transactions.setSuccessful(getFinishedTransactionsCount().get());\r
-        transactions.setFailed(getFailedTransactionsCount().get());\r
-        data.setTransactions(transactions);\r
-        return data;\r
-    }\r
-}\r
index 7789a06fe8c734f61215805d3e5b18bd558c4916..8aff12b44a5f1b5c58dfd816f457a918b497925d 100644 (file)
@@ -7,8 +7,8 @@
  */
 package org.opendaylight.controller.sal.binding.codegen;
 
+import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
 import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory;
-import org.opendaylight.controller.sal.binding.spi.RpcRouter;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.opendaylight.yangtools.yang.binding.annotations.RoutingContext;
index 8b2db8b13cd09b175fc1269ebec693717b70aab5..d976a0cec9ac7e828b9877001d0847e4cc29dab9 100644 (file)
@@ -3,7 +3,8 @@ package org.opendaylight.controller.sal.binding.codegen.impl;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
-import org.opendaylight.controller.sal.binding.spi.RpcRouter;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable;
 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
@@ -13,7 +14,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.HashMap;
 
-import org.opendaylight.controller.sal.binding.spi.RpcRoutingTable;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.opendaylight.yangtools.yang.binding.RpcImplementation;
 import org.opendaylight.controller.md.sal.common.api.routing.MutableRoutingTable;
@@ -147,7 +147,6 @@ public class RpcRouterCodegenInstance<T extends RpcService> implements //
         @Override
         public void unregisterPath(Class<? extends BaseIdentity> context, InstanceIdentifier<?> path) {
             routingTables.get(context).removeRoute(path, getInstance());
-
         }
 
         @Override
index 808358fb3503c1ea38bca66951137c1353c7b64d..76318ae843ff2e7f0689aea0527250ab288756d5 100644 (file)
@@ -1,6 +1,6 @@
 package org.opendaylight.controller.sal.binding.codegen.impl;
 
-import org.opendaylight.controller.sal.binding.spi.RpcRoutingTable;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable;
 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
index 266293fb6dc7f66fff5727fce78798046ced2561..446a9caf8e7fd48f415926f457c6e68abcf73745 100644 (file)
@@ -1,14 +1,49 @@
 package org.opendaylight.controller.sal.binding.codegen.impl;
 
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+
 import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeGenerator;
 import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory;
 
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+
 import javassist.ClassPool;
 
 public class SingletonHolder {
 
-    public static final ClassPool CLASS_POOL = new ClassPool(); 
-    public static final org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator RPC_GENERATOR_IMPL = new org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator(CLASS_POOL);
+    public static final ClassPool CLASS_POOL = new ClassPool();
+    public static final org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator RPC_GENERATOR_IMPL = new org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator(
+            CLASS_POOL);
     public static final RuntimeCodeGenerator RPC_GENERATOR = RPC_GENERATOR_IMPL;
     public static final NotificationInvokerFactory INVOKER_FACTORY = RPC_GENERATOR_IMPL.getInvokerFactory();
+    private static ListeningExecutorService NOTIFICATION_EXECUTOR = null;
+    private static ListeningExecutorService COMMIT_EXECUTOR = null;
+
+    public static synchronized final ListeningExecutorService getDefaultNotificationExecutor() {
+        if (NOTIFICATION_EXECUTOR == null) {
+            NOTIFICATION_EXECUTOR = createNamedExecutor("md-sal-binding-notification-%d");
+        }
+        return NOTIFICATION_EXECUTOR;
+    }
+
+    public static synchronized final ListeningExecutorService getDefaultCommitExecutor() {
+        if (COMMIT_EXECUTOR == null) {
+            COMMIT_EXECUTOR = createNamedExecutor("md-sal-binding-commit-%d");
+        }
+
+        return COMMIT_EXECUTOR;
+    }
+
+    private static ListeningExecutorService createNamedExecutor(String format) {
+        ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat(format).build();
+        ExecutorService executor = Executors.newCachedThreadPool(factory);
+        return MoreExecutors.listeningDecorator(executor);
+
+    }
+
 }
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend
deleted file mode 100644 (file)
index b4bf3f5..0000000
+++ /dev/null
@@ -1,76 +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.BindingAwareConsumer
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider
-import org.osgi.framework.BundleContext
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
-import org.opendaylight.yangtools.yang.binding.DataObject
-import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener
-import org.opendaylight.controller.sal.binding.spi.RpcContextIdentifier
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService
-import org.slf4j.LoggerFactory
-
-class BindingAwareBrokerImpl extends RpcProviderRegistryImpl implements BindingAwareBroker, AutoCloseable {
-    private static val log = LoggerFactory.getLogger(BindingAwareBrokerImpl)
-
-    private InstanceIdentifier<? extends DataObject> root = InstanceIdentifier.builder().toInstance();
-
-    @Property
-    private var NotificationProviderService notifyBroker
-
-    @Property
-    private var DataProviderService dataBroker
-
-    @Property
-    var BundleContext brokerBundleContext
-
-    public new(String name,BundleContext bundleContext) {
-        super(name);
-        _brokerBundleContext = bundleContext;
-    }
-
-    def start() {
-        log.info("Starting MD-SAL: Binding Aware Broker");
-    }
-
-
-
-    override registerConsumer(BindingAwareConsumer consumer, BundleContext bundleCtx) {
-        val ctx = consumer.createContext(bundleCtx)
-        consumer.onSessionInitialized(ctx)
-        return ctx
-    }
-
-    override registerProvider(BindingAwareProvider provider, BundleContext bundleCtx) {
-        val ctx = provider.createContext(bundleCtx)
-        provider.onSessionInitialized(ctx)
-        provider.onSessionInitiated(ctx as ProviderContext)
-        return ctx
-    }
-
-    private def createContext(BindingAwareConsumer consumer, BundleContext consumerCtx) {
-        new OsgiConsumerContext(consumerCtx, this)
-    }
-
-    private def createContext(BindingAwareProvider provider, BundleContext providerCtx) {
-        new OsgiProviderContext(providerCtx, this)
-    }
-
-    override <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> registerRouteChangeListener(L listener) {
-        super.<L>registerRouteChangeListener(listener)
-    }
-    
-    override close() throws Exception {
-        
-    }
-}
\ No newline at end of file
index 5db522f56c34b6c6816b067d96441034a01dfed1..0069de98026dfa2f710e77fc3b60b3a026e6f37d 100644 (file)
@@ -3,7 +3,7 @@ package org.opendaylight.controller.sal.binding.impl;
 import java.util.Set;
 import java.util.concurrent.Future;\r
 import java.util.concurrent.atomic.AtomicLong;\r
-
+\r
 import org.opendaylight.controller.md.sal.common.impl.service.AbstractDataBroker;\r
 import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;\r
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;\r
@@ -11,12 +11,13 @@ import org.opendaylight.controller.sal.binding.impl.util.BindingAwareDataReaderR
 import org.opendaylight.controller.sal.common.DataStoreIdentifier;\r
 import org.opendaylight.yangtools.yang.binding.DataObject;\r
 import org.opendaylight.yangtools.yang.binding.DataRoot;\r
+import org.opendaylight.yangtools.yang.binding.Identifiable;\r
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;\r
 import org.opendaylight.yangtools.yang.common.RpcResult;\r
 \r
 \r
-public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier<? extends DataObject>, DataObject, DataChangeListener> implements\r
-        DataProviderService, AutoCloseable {\r
+public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier<? extends DataObject>, DataObject, DataChangeListener> //\r
+       implements DataProviderService, AutoCloseable {\r
 \r
     private final AtomicLong nextTransaction = new AtomicLong();\r
     private final AtomicLong createdTransactionsCount = new AtomicLong();\r
@@ -114,7 +115,6 @@ public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier<? exte
                 return true;
             }
         }
-
         return false;
     }\r
 }
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/MountPointManagerImpl.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/MountPointManagerImpl.java
new file mode 100644 (file)
index 0000000..f8059fe
--- /dev/null
@@ -0,0 +1,120 @@
+package org.opendaylight.controller.sal.binding.impl;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.opendaylight.controller.md.sal.binding.util.AbstractBindingSalProviderInstance;
+import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
+import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance;
+import org.opendaylight.controller.sal.binding.api.mount.MountProviderService;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.util.concurrent.ListeningExecutorService;
+
+public class MountPointManagerImpl implements MountProviderService {
+
+    public final Logger LOG = LoggerFactory.getLogger(MountPointManagerImpl.class);
+
+    private final ConcurrentMap<InstanceIdentifier<?>, BindingMountPointImpl> mountPoints;
+    private final ListenerRegistry<MountProvisionListener> listeners = ListenerRegistry.create();
+    
+    private ListeningExecutorService notificationExecutor;
+    private ListeningExecutorService dataCommitExecutor;
+
+    public MountPointManagerImpl() {
+        mountPoints = new ConcurrentHashMap<>();
+    }
+
+    public ListeningExecutorService getNotificationExecutor() {
+        return notificationExecutor;
+    }
+
+    public void setNotificationExecutor(ListeningExecutorService notificationExecutor) {
+        this.notificationExecutor = notificationExecutor;
+    }
+
+    public ListeningExecutorService getDataCommitExecutor() {
+        return dataCommitExecutor;
+    }
+
+    public void setDataCommitExecutor(ListeningExecutorService dataCommitExecutor) {
+        this.dataCommitExecutor = dataCommitExecutor;
+    }
+
+    @Override
+    public synchronized BindingMountPointImpl createMountPoint(InstanceIdentifier<?> path) {
+        BindingMountPointImpl potential = mountPoints.get(path);
+        if (potential != null) {
+            throw new IllegalStateException("Mount point already exists.");
+        }
+        return createOrGetMountPointImpl(path);
+    }
+
+    @Override
+    public BindingMountPointImpl createOrGetMountPoint(InstanceIdentifier<?> path) {
+        BindingMountPointImpl potential = getMountPoint(path);
+        if (potential != null) {
+            return potential;
+        }
+        return createOrGetMountPointImpl(path);
+    }
+
+    @Override
+    public BindingMountPointImpl getMountPoint(InstanceIdentifier<?> path) {
+        return mountPoints.get(path);
+    }
+
+    private synchronized BindingMountPointImpl createOrGetMountPointImpl(InstanceIdentifier<?> path) {
+        BindingMountPointImpl potential = getMountPoint(path);
+        if (potential != null) {
+            return potential;
+        }
+        RpcProviderRegistryImpl rpcRegistry = new RpcProviderRegistryImpl("mount");
+        NotificationBrokerImpl notificationBroker = new NotificationBrokerImpl();
+        notificationBroker.setExecutor(getNotificationExecutor());
+        DataBrokerImpl dataBroker = new DataBrokerImpl();
+        dataBroker.setExecutor(getDataCommitExecutor());
+        BindingMountPointImpl mountInstance = new BindingMountPointImpl(path, rpcRegistry, notificationBroker,
+                dataBroker);
+        mountPoints.putIfAbsent(path, mountInstance);
+        notifyMountPointCreated(path);
+        return mountInstance;
+    }
+
+    private void notifyMountPointCreated(InstanceIdentifier<?> path) {
+        for (ListenerRegistration<MountProvisionListener> listener : listeners) {
+            try {
+                listener.getInstance().onMountPointCreated(path);
+            } catch (Exception e) {
+                LOG.error("Unhandled exception during invoking listener.", e);
+            }
+        }
+    }
+
+    @Override
+    public ListenerRegistration<MountProvisionListener> registerProvisionListener(MountProvisionListener listener) {
+        return listeners.register(listener);
+    }
+
+    public class BindingMountPointImpl extends
+            AbstractBindingSalProviderInstance<DataBrokerImpl, NotificationBrokerImpl, RpcProviderRegistryImpl>
+    implements MountProviderInstance {
+
+        private InstanceIdentifier<?> identifier;
+
+        public BindingMountPointImpl(org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> identifier,
+                RpcProviderRegistryImpl rpcRegistry, NotificationBrokerImpl notificationBroker,
+                DataBrokerImpl dataBroker) {
+            super(rpcRegistry, notificationBroker, dataBroker);
+            this.identifier = identifier;
+        }
+        
+        @Override
+        public InstanceIdentifier<?> getIdentifier() {
+            return this.identifier;
+        }
+    }
+}
index b0939a043f68c72f7f994fa538a005d4942f08ea..b4fd6b67712d6054b2f74737d89f3ea091aa9345 100644 (file)
@@ -175,6 +175,7 @@ class NotifyTask implements Callable<Object> {
 \r
     private static val log = LoggerFactory.getLogger(NotifyTask);\r
 \r
+    @SuppressWarnings("rawtypes")\r
     val NotificationListener listener;\r
     val Notification notification;\r
 \r
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/OsgiConsumerContext.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/OsgiConsumerContext.xtend
deleted file mode 100644 (file)
index 644c50b..0000000
+++ /dev/null
@@ -1,60 +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.BindingAwareBroker.ConsumerContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareService;
-import org.opendaylight.yangtools.yang.binding.RpcService;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.LoggerFactory
-import static org.opendaylight.controller.sal.binding.impl.osgi.Constants.*
-
-class OsgiConsumerContext implements ConsumerContext {
-
-    static val log = LoggerFactory.getLogger(OsgiConsumerContext)
-    protected val BundleContext bundleContext;
-    protected val BindingAwareBrokerImpl broker;
-
-    new(BundleContext ctx, BindingAwareBrokerImpl broker) {
-        this.bundleContext = ctx;
-        this.broker = broker;
-    }
-
-    override def <T extends BindingAwareService> getSALService(Class<T> service) {
-
-        // SAL Services are global
-        var ref = bundleContext.getServiceReference(service);
-        return bundleContext.getService(ref) as T;
-    }
-
-    override def <T extends RpcService> T getRpcService(Class<T> module) {
-        try {
-
-            val services = bundleContext.getServiceReferences(module, getProxyFilter());
-
-            // Proxy service found / using first implementation
-            // FIXME: Add advanced logic to retrieve service with right set of models
-            if (false == services.empty) {
-                val ref = services.iterator().next() as ServiceReference<T>;
-                return bundleContext.getService(ref) as T;
-            } else {
-                return broker.getRpcService(module);
-            }
-        } catch (InvalidSyntaxException e) {
-            log.error("Created filter was invalid:", e.message, e)
-        }
-        return null;
-
-    }
-
-    private def getProxyFilter() {
-        return '''(«SAL_SERVICE_TYPE»=«SAL_SERVICE_TYPE_CONSUMER_PROXY»)'''
-    }
-}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/OsgiProviderContext.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/OsgiProviderContext.xtend
deleted file mode 100644 (file)
index d1ec351..0000000
+++ /dev/null
@@ -1,54 +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 java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.yangtools.yang.binding.RpcService;
-import org.osgi.framework.BundleContext;
-
-import static org.opendaylight.controller.sal.binding.impl.osgi.Constants.*;
-import static extension org.opendaylight.controller.sal.binding.impl.osgi.PropertiesUtils.*;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality
-import static com.google.common.base.Preconditions.*
-
-class OsgiProviderContext extends OsgiConsumerContext implements ProviderContext {
-
-    @Property
-    val Map<Class<? extends RpcService>, RpcRegistration<? extends RpcService>> registeredServices
-
-    new(BundleContext ctx, BindingAwareBrokerImpl broker) {
-        super(ctx, broker);
-        _registeredServices = new HashMap();
-    }
-
-    override <T extends RpcService> addRpcImplementation(Class<T> type, T implementation) {
-        val salReg = broker.addRpcImplementation(type, implementation)
-        registeredServices.put(type, salReg)
-        return salReg;
-    }
-
-    override <T extends RpcService> addRoutedRpcImplementation(Class<T> type, T implementation) throws IllegalStateException {
-        val salReg = broker.addRoutedRpcImplementation(type, implementation)
-        registeredServices.put(type, salReg)
-        return salReg;
-    }
-
-    override registerFunctionality(ProviderFunctionality functionality) {
-        // NOOP for now
-    }
-
-    override unregisterFunctionality(ProviderFunctionality functionality) {
-        // NOOP for now
-    }
-}
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
new file mode 100644 (file)
index 0000000..35c2bee
--- /dev/null
@@ -0,0 +1,174 @@
+package org.opendaylight.controller.sal.binding.impl;
+
+import static com.google.common.base.Preconditions.checkState;
+
+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;
+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.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.NotificationService;
+import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.controller.sal.binding.api.mount.MountProviderService;
+import org.opendaylight.controller.sal.binding.api.mount.MountService;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
+import org.opendaylight.yangtools.concepts.Identifiable;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.Mutable;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+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;
+
+public class RootBindingAwareBroker implements //
+        Mutable, //
+        Identifiable<String>, //
+        BindingAwareBroker, AutoCloseable,
+        RpcProviderRegistry {
+
+    private final static Logger LOG = LoggerFactory.getLogger(RootBindingAwareBroker.class);
+
+    RootSalInstance controllerRoot;
+
+    private final String identifier;
+
+    private RpcProviderRegistry rpcBroker;
+
+    private NotificationProviderService notificationBroker;
+
+    private DataProviderService dataBroker;
+
+    private MountPointManagerImpl mountManager;
+
+    public MountPointManagerImpl getMountManager() {
+        return mountManager;
+    }
+
+    public void setMountManager(MountPointManagerImpl mountManager) {
+        this.mountManager = mountManager;
+    }
+
+    private ImmutableClassToInstanceMap<BindingAwareService> supportedConsumerServices;
+
+    private ImmutableClassToInstanceMap<BindingAwareService> supportedProviderServices;
+
+    public RootBindingAwareBroker(String instanceName) {
+        this.identifier = instanceName;
+        mountManager = new MountPointManagerImpl();
+    }
+
+    public String getIdentifier() {
+        return identifier;
+    }
+
+    public RootSalInstance getRoot() {
+        return controllerRoot;
+    }
+
+    public DataProviderService getDataBroker() {
+        return this.dataBroker;
+    }
+
+    public NotificationProviderService getNotificationBroker() {
+        return this.notificationBroker;
+    }
+
+    public RpcProviderRegistry getRpcProviderRegistry() {
+        return this.rpcBroker;
+    }
+
+    public RpcProviderRegistry getRpcBroker() {
+        return rpcBroker;
+    }
+
+    public void setRpcBroker(RpcProviderRegistry rpcBroker) {
+        this.rpcBroker = rpcBroker;
+    }
+
+    public void setNotificationBroker(NotificationProviderService notificationBroker) {
+        this.notificationBroker = notificationBroker;
+    }
+
+    public void setDataBroker(DataProviderService dataBroker) {
+        this.dataBroker = dataBroker;
+    }
+
+    public void start() {
+        checkState(controllerRoot == null, "Binding Aware Broker was already started.");
+        LOG.info("Starting Binding Aware Broker: {}", identifier);
+
+        controllerRoot = new RootSalInstance(getRpcProviderRegistry(), getNotificationBroker(), getDataBroker());
+        
+
+        supportedConsumerServices = ImmutableClassToInstanceMap.<BindingAwareService> builder()
+                .put(NotificationService.class, getRoot()) //
+                .put(DataBrokerService.class, getRoot()) //
+                .put(RpcConsumerRegistry.class, getRoot()) //
+                .put(MountService.class, mountManager).build();
+
+        supportedProviderServices = ImmutableClassToInstanceMap.<BindingAwareService> builder()
+                .putAll(supportedConsumerServices)
+                .put(NotificationProviderService.class, getRoot()) //
+                .put(DataProviderService.class, getRoot()) //
+                .put(RpcProviderRegistry.class, getRoot()) //
+                .put(MountProviderService.class, mountManager).build();
+    }
+
+    @Override
+    public ConsumerContext registerConsumer(BindingAwareConsumer consumer, BundleContext ctx) {
+        checkState(supportedConsumerServices != null, "Broker is not initialized.");
+        return BindingContextUtils.createConsumerContextAndInitialize(consumer, supportedConsumerServices);
+    }
+
+    @Override
+    public ProviderContext registerProvider(BindingAwareProvider provider, BundleContext ctx) {
+        checkState(supportedProviderServices != null, "Broker is not initialized.");
+        return BindingContextUtils.createProviderContextAndInitialize(provider, supportedProviderServices);
+    }
+
+    @Override
+    public void close() throws Exception {
+        // FIXME: Close all sessions
+    }
+    
+    @Override
+    public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> type, T implementation)
+            throws IllegalStateException {
+        return getRoot().addRoutedRpcImplementation(type, implementation);
+    }
+    
+    @Override
+    public <T extends RpcService> RpcRegistration<T> addRpcImplementation(Class<T> type, T implementation)
+            throws IllegalStateException {
+        return getRoot().addRpcImplementation(type, implementation);
+    }
+    
+    @Override
+    public <T extends RpcService> T getRpcService(Class<T> module) {
+        return getRoot().getRpcService(module);
+    }
+    @Override
+    public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
+            L arg0) {
+        return getRoot().registerRouteChangeListener(arg0);
+    }
+    
+
+    public class RootSalInstance extends
+            AbstractBindingSalProviderInstance<DataProviderService, NotificationProviderService, RpcProviderRegistry> {
+
+        public RootSalInstance(RpcProviderRegistry rpcRegistry, NotificationProviderService notificationBroker,
+                DataProviderService dataBroker) {
+            super(rpcRegistry, notificationBroker, dataBroker);
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootDataBrokerImpl.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootDataBrokerImpl.java
new file mode 100644 (file)
index 0000000..1b6c56d
--- /dev/null
@@ -0,0 +1,43 @@
+package org.opendaylight.controller.sal.binding.impl;\r
+\r
+import org.opendaylight.controller.config.yang.md.sal.binding.impl.Data;\r
+import org.opendaylight.controller.config.yang.md.sal.binding.impl.DataBrokerImplRuntimeMXBean;\r
+import org.opendaylight.controller.config.yang.md.sal.binding.impl.DataBrokerImplRuntimeRegistration;\r
+import org.opendaylight.controller.config.yang.md.sal.binding.impl.DataBrokerImplRuntimeRegistrator;\r
+import org.opendaylight.controller.config.yang.md.sal.binding.impl.Transactions;\r
+import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingIndependentConnector;\r
+\r
+public class RootDataBrokerImpl extends DataBrokerImpl implements DataBrokerImplRuntimeMXBean {\r
+\r
+    private final Transactions transactions = new Transactions();\r
+    private final Data data = new Data();\r
+    private BindingIndependentConnector bindingIndependentConnector;\r
+    private DataBrokerImplRuntimeRegistration runtimeBeanRegistration;\r
+\r
+    public BindingIndependentConnector getBindingIndependentConnector() {\r
+        return bindingIndependentConnector;\r
+    }\r
+\r
+    public Transactions getTransactions() {\r
+        transactions.setCreated(getCreatedTransactionsCount().get());\r
+        transactions.setSubmitted(getSubmittedTransactionsCount().get());\r
+        transactions.setSuccessful(getFinishedTransactionsCount().get());\r
+        transactions.setFailed(getFailedTransactionsCount().get());\r
+        return transactions;\r
+    }\r
+\r
+    @Override\r
+    public Data getData() {\r
+        data.setTransactions(getTransactions());\r
+        return data;\r
+    }\r
+\r
+    public void setBindingIndependentConnector(BindingIndependentConnector runtimeMapping) {\r
+        this.bindingIndependentConnector = runtimeMapping;\r
+    }\r
+\r
+    public void registerRuntimeBean(DataBrokerImplRuntimeRegistrator rootRegistrator) {\r
+        runtimeBeanRegistration = rootRegistrator.register(this);\r
+    }\r
+\r
+}\r
index 6a17007d22779c81dd9a55d592fc80da73323f6f..8773476caee9ee4fd01f7b75b3b128bb331e3edd 100644 (file)
@@ -15,11 +15,11 @@ import org.opendaylight.controller.md.sal.common.impl.routing.RoutingUtils;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
 import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeGenerator;
 import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper;
 import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
-import org.opendaylight.controller.sal.binding.spi.RpcContextIdentifier;
-import org.opendaylight.controller.sal.binding.spi.RpcRouter;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingDomConnectorDeployer.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingDomConnectorDeployer.java
new file mode 100644 (file)
index 0000000..f200b4d
--- /dev/null
@@ -0,0 +1,103 @@
+package org.opendaylight.controller.sal.binding.impl.connect.dom;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker;
+import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
+import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
+
+public class BindingDomConnectorDeployer {
+
+    private static BindingIndependentMappingService mappingService;
+
+    public static BindingIndependentConnector tryToDeployConnector(RootBindingAwareBroker baBroker,
+            ProviderSession domSession) {
+        checkNotNull(baBroker);
+        checkNotNull(domSession);
+        BindingIndependentConnector connector = createConnector(mappingService);
+        return connector;
+    }
+
+    public static BindingIndependentConnector createConnector(BindingIndependentMappingService mappingService) {
+        BindingIndependentConnector connector = new BindingIndependentConnector();
+        connector.setMappingService(mappingService);
+        return connector;
+    }
+
+    public static BindingIndependentConnector createConnector(BindingIndependentConnector source) {
+        BindingIndependentConnector connector = new BindingIndependentConnector();
+        connector.setMappingService(source.getMappingService());
+        return connector;
+    }
+    
+    public static void startDataForwarding(BindingIndependentConnector connector, DataProviderService baService,
+            ProviderSession domContext) {
+        startDataForwarding(connector, baService,
+                domContext.getService(org.opendaylight.controller.sal.core.api.data.DataProviderService.class));
+    }
+
+    public static void startRpcForwarding(BindingIndependentConnector connector,
+            RpcProviderRegistry rpcProviderRegistry, ProviderSession domProviderContext) {
+        startRpcForwarding(connector, rpcProviderRegistry, domProviderContext.getService(RpcProvisionRegistry.class));
+
+    }
+    
+    public static void startNotificationForwarding(BindingIndependentConnector connector, NotificationProviderService provider,ProviderSession domProviderContext) {
+        startNotificationForwarding(connector, provider, domProviderContext.getService(NotificationPublishService.class));
+    }
+
+    public static void startRpcForwarding(BindingIndependentConnector connector, RpcProviderRegistry baService,
+            RpcProvisionRegistry domService) {
+        if (connector.isRpcForwarding()) {
+            return;
+        }
+
+        connector.setDomRpcRegistry(domService);
+        connector.setBindingRpcRegistry(baService);
+        connector.startRpcForwarding();
+    }
+
+    public static void startDataForwarding(BindingIndependentConnector connector, DataProviderService baService,
+            org.opendaylight.controller.sal.core.api.data.DataProviderService domService) {
+        if (connector.isDataForwarding()) {
+            return;
+        }
+
+        connector.setBindingDataService(baService);
+        connector.setDomDataService(domService);
+        connector.startDataForwarding();
+    }
+    
+    public static void startNotificationForwarding(BindingIndependentConnector connector, NotificationProviderService baService, NotificationPublishService domService) {
+        if(connector.isNotificationForwarding()) {
+            return;
+        }
+        
+        // FIXME
+    }
+
+    //
+    // public static BindingIndependentMappingService getGlobalMappingService()
+    // {
+    // return mappingService;
+    // }
+    //
+    // protected static BindingIndependentMappingService
+    // setGlobalMappingService(BindingIndependentMappingService service) {
+    // mappingService= service;
+    // return mappingService;
+    // }
+    //
+    // public static BindingIndependentConnector
+    // tryToDeployConnector(MountProviderInstance baMount,MountProvisionInstance
+    // domMount) {
+    //
+    //
+    // return null;
+    // }
+
+}
index 0a769921d80410742cb22b4ad7ee8cc0e9920f0a..75b0138e7cd75657adba42182d0dc7e0cf9c270c 100644 (file)
@@ -1,12 +1,9 @@
 package org.opendaylight.controller.sal.binding.impl.connect.dom;
 
 import java.lang.ref.WeakReference;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -18,21 +15,23 @@ import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 
-
 import org.opendaylight.controller.md.sal.common.api.RegistrationListener;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
 import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandlerRegistration;
 import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.md.sal.common.api.data.DataReader;
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChange;
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
 import org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl;
-import org.opendaylight.controller.sal.binding.spi.RpcContextIdentifier;
-import org.opendaylight.controller.sal.binding.spi.RpcRouter;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
+import org.opendaylight.controller.sal.common.util.CommitHandlerTransactions;
 import org.opendaylight.controller.sal.common.util.Rpcs;
 import org.opendaylight.controller.sal.core.api.Provider;
 import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
@@ -49,7 +48,6 @@ import org.opendaylight.yangtools.yang.binding.BindingMapping;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.RpcInput;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -65,7 +63,6 @@ import com.google.common.collect.FluentIterable;
 import com.google.common.collect.ImmutableSet;
 
 import static com.google.common.base.Preconditions.*;
-import static org.opendaylight.yangtools.concepts.util.ClassLoaderUtils.*;
 
 public class BindingIndependentConnector implements //
         RuntimeDataProvider, //
@@ -96,7 +93,7 @@ public class BindingIndependentConnector implements //
     private Registration<DataCommitHandler<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode>> biCommitHandlerRegistration;
 
     private RpcProvisionRegistry biRpcRegistry;
-    private RpcProviderRegistryImpl baRpcRegistry;
+    private RpcProviderRegistry baRpcRegistry;
 
     private ListenerRegistration<DomToBindingRpcForwardingManager> domToBindingRpcManager;
     // private ListenerRegistration<BindingToDomRpcForwardingManager>
@@ -111,6 +108,14 @@ public class BindingIndependentConnector implements //
 
     };
 
+    private Registration<DataReader<InstanceIdentifier<? extends DataObject>, DataObject>> baDataReaderRegistration;
+
+    private boolean rpcForwarding = false;
+
+    private boolean dataForwarding = false;
+
+    private boolean notificationForwarding = false;
+
     @Override
     public DataObject readOperationalData(InstanceIdentifier<? extends DataObject> path) {
         try {
@@ -222,7 +227,7 @@ public class BindingIndependentConnector implements //
         return biDataService;
     }
 
-    public void setBiDataService(org.opendaylight.controller.sal.core.api.data.DataProviderService biDataService) {
+    protected void setDomDataService(org.opendaylight.controller.sal.core.api.data.DataProviderService biDataService) {
         this.biDataService = biDataService;
     }
 
@@ -230,7 +235,7 @@ public class BindingIndependentConnector implements //
         return baDataService;
     }
 
-    public void setBaDataService(DataProviderService baDataService) {
+    protected void setBindingDataService(DataProviderService baDataService) {
         this.baDataService = baDataService;
     }
 
@@ -238,23 +243,33 @@ public class BindingIndependentConnector implements //
         return baRpcRegistry;
     }
 
-    public void setRpcRegistry(RpcProviderRegistryImpl rpcRegistry) {
+    protected void setBindingRpcRegistry(RpcProviderRegistry rpcRegistry) {
         this.baRpcRegistry = rpcRegistry;
     }
 
-    public void start() {
-        baDataService.registerDataReader(ROOT, this);
+    public void startDataForwarding() {
+        checkState(!dataForwarding, "Connector is already forwarding data.");
+        baDataReaderRegistration = baDataService.registerDataReader(ROOT, this);
         baCommitHandlerRegistration = baDataService.registerCommitHandler(ROOT, bindingToDomCommitHandler);
         biCommitHandlerRegistration = biDataService.registerCommitHandler(ROOT_BI, domToBindingCommitHandler);
         baDataService.registerCommitHandlerListener(domToBindingCommitHandler);
-
-        if (baRpcRegistry != null && biRpcRegistry != null) {
+        dataForwarding = true;
+    }
+    
+    public void startRpcForwarding() {
+        if (baRpcRegistry != null && biRpcRegistry != null && baRpcRegistry instanceof RouteChangePublisher<?, ?>) {
+            checkState(!rpcForwarding,"Connector is already forwarding RPCs");
             domToBindingRpcManager = baRpcRegistry.registerRouteChangeListener(new DomToBindingRpcForwardingManager());
-
+            rpcForwarding = true;
         }
     }
+    
+    public void startNotificationForwarding() {
+        checkState(!notificationForwarding, "Connector is already forwarding notifications.");
+        notificationForwarding = true;
+    }
 
-    public void setMappingService(BindingIndependentMappingService mappingService) {
+    protected void setMappingService(BindingIndependentMappingService mappingService) {
         this.mappingService = mappingService;
     }
 
@@ -265,8 +280,9 @@ public class BindingIndependentConnector implements //
 
     @Override
     public void onSessionInitiated(ProviderSession session) {
-        setBiDataService(session.getService(org.opendaylight.controller.sal.core.api.data.DataProviderService.class));
-        start();
+        setDomDataService(session.getService(org.opendaylight.controller.sal.core.api.data.DataProviderService.class));
+        setDomRpcRegistry(session.getService(RpcProvisionRegistry.class));
+        
     }
 
     public <T extends RpcService> void onRpcRouterCreated(Class<T> serviceType, RpcRouter<T> router) {
@@ -381,7 +397,7 @@ public class BindingIndependentConnector implements //
              */
             if (bindingOpenedTransactions.containsKey(bindingTransaction.getIdentifier())) {
 
-                return CommitHandlersTransactions.allwaysSuccessfulTransaction(bindingTransaction);
+                return CommitHandlerTransactions.allwaysSuccessfulTransaction(bindingTransaction);
             }
             DataModificationTransaction domTransaction = createBindingToDomTransaction(bindingTransaction);
             BindingToDomTransaction wrapped = new BindingToDomTransaction(domTransaction, bindingTransaction);
@@ -420,7 +436,7 @@ public class BindingIndependentConnector implements //
              * duplicating data.
              */
             if (domOpenedTransactions.containsKey(identifier)) {
-                return CommitHandlersTransactions.allwaysSuccessfulTransaction(domTransaction);
+                return CommitHandlerTransactions.allwaysSuccessfulTransaction(domTransaction);
             }
 
             org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction baTransaction = createDomToBindingTransaction(domTransaction);
@@ -597,6 +613,7 @@ public class BindingIndependentConnector implements //
         @SuppressWarnings("rawtypes")
         private WeakReference<Class> outputClass;
 
+        @SuppressWarnings({ "rawtypes", "unchecked" })
         public DefaultInvocationStrategy(Method targetMethod, Class<?> outputClass,
                 Class<? extends DataContainer> inputClass) {
             super(targetMethod);
@@ -624,10 +641,27 @@ public class BindingIndependentConnector implements //
         }
 
         public RpcResult<CompositeNode> uncheckedInvoke(RpcService rpcService, CompositeNode domInput) throws Exception {
+            @SuppressWarnings("unchecked")
             Future<RpcResult<Void>> result = (Future<RpcResult<Void>>) targetMethod.invoke(rpcService);
             RpcResult<Void> bindingResult = result.get();
             return Rpcs.getRpcResult(bindingResult.isSuccessful(), bindingResult.getErrors());
         }
+    }
+
+    public boolean isRpcForwarding() {
+        return rpcForwarding;
+    }
+
+    public boolean isDataForwarding() {
+        return dataForwarding;
+    }
+
+    public boolean isNotificationForwarding() {
+        // TODO Auto-generated method stub
+        return notificationForwarding;
+    }
 
+    public BindingIndependentMappingService getMappingService() {
+        return mappingService;
     }
 }
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentMountPointForwarder.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentMountPointForwarder.java
new file mode 100644 (file)
index 0000000..630b5fa
--- /dev/null
@@ -0,0 +1,128 @@
+package org.opendaylight.controller.sal.binding.impl.connect.dom;
+
+import java.util.concurrent.ConcurrentMap;
+
+import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance;
+import org.opendaylight.controller.sal.binding.api.mount.MountProviderService;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionService.MountProvisionListener;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class BindingIndependentMountPointForwarder {
+
+    private MountProvisionService domMountService;
+    private MountProviderService baMountService;
+    private BindingIndependentMappingService mappingService;
+    
+    private final DomMountPointForwardingManager domForwardingManager = new DomMountPointForwardingManager();
+    private final BindingMountPointForwardingManager bindingForwardingManager = new BindingMountPointForwardingManager();
+
+    private ConcurrentMap<InstanceIdentifier<?>, BindingIndependentConnector> connectors;
+    private ConcurrentMap<InstanceIdentifier<?>, org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> forwarded;
+    private ListenerRegistration<MountProvisionListener> domListenerRegistration;
+    private ListenerRegistration<org.opendaylight.controller.sal.binding.api.mount.MountProviderService.MountProvisionListener> baListenerRegistration;
+
+    public MountProvisionService getDomMountService() {
+        return domMountService;
+    }
+
+    public void setDomMountService(MountProvisionService domMountService) {
+        this.domMountService = domMountService;
+    }
+
+    public void start() {
+        if(domMountService != null && baMountService != null) {
+            domListenerRegistration = domMountService.registerProvisionListener(domForwardingManager);
+            baListenerRegistration = baMountService.registerProvisionListener(bindingForwardingManager);
+        }
+    }
+
+    private void tryToDeployConnector(InstanceIdentifier<?> baPath,
+            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath) {
+        org.opendaylight.yangtools.yang.data.api.InstanceIdentifier previous = forwarded.putIfAbsent(baPath, biPath);
+        if(previous != null) {
+            return;
+        }
+        MountProviderInstance baMountPoint = baMountService.getMountPoint(baPath);
+        MountProvisionInstance domMountPoint = domMountService.getMountPoint(biPath);
+        BindingIndependentConnector connector = createForwarder(baPath, baMountPoint, domMountPoint);
+        connectors.put(baPath, connector);
+        connector.startDataForwarding();
+        connector.startRpcForwarding();
+        connector.startNotificationForwarding();
+    }
+
+    private BindingIndependentConnector createForwarder(InstanceIdentifier<?> path, MountProviderInstance baMountPoint,
+            MountProvisionInstance domMountPoint) {
+        BindingIndependentConnector connector = new BindingIndependentConnector();
+        
+        connector.setBindingDataService(baMountPoint);
+        connector.setBindingRpcRegistry(baMountPoint);
+        //connector.setBindingNotificationBroker(baMountPoint);
+        
+        connector.setDomDataService(domMountPoint);
+        connector.setDomRpcRegistry(domMountPoint);
+        //connector.setDomNotificationBroker(domMountPoint);
+        return connector;
+    }
+
+    public synchronized void tryToDeployDomForwarder(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath) {
+        InstanceIdentifier<?> baPath;
+        try {
+            baPath = mappingService.fromDataDom(domPath);
+            BindingIndependentConnector potentialConnector = connectors.get(baPath);
+            if(potentialConnector != null) {
+                return;
+            }
+            tryToDeployConnector(baPath,domPath);
+        } catch (DeserializationException e) {
+            
+        }
+    }
+
+    public synchronized void tryToDeployBindingForwarder(InstanceIdentifier<?> baPath) {
+        BindingIndependentConnector potentialConnector =connectors.get(baPath);
+        if(potentialConnector != null) {
+            return;
+        }
+        org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath = mappingService.toDataDom(baPath);
+        tryToDeployConnector(baPath, domPath);
+    }
+
+    public synchronized void undeployBindingForwarder(InstanceIdentifier<?> baPath) {
+        // FIXME: Implement closeMountPoint
+    }
+
+    public synchronized void undeployDomForwarder(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath) {
+        // FIXME: Implement closeMountPoint
+    }
+
+    private class DomMountPointForwardingManager implements MountProvisionListener {
+
+        @Override
+        public void onMountPointCreated(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path) {
+            tryToDeployDomForwarder(path);
+        }
+
+        @Override
+        public void onMountPointRemoved(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path) {
+            undeployDomForwarder(path);
+        }
+    }
+
+    private class BindingMountPointForwardingManager implements
+            org.opendaylight.controller.sal.binding.api.mount.MountProviderService.MountProvisionListener {
+
+        @Override
+        public void onMountPointCreated(InstanceIdentifier<?> path) {
+            tryToDeployBindingForwarder(path);
+        }
+
+        @Override
+        public void onMountPointRemoved(InstanceIdentifier<?> path) {
+            undeployBindingForwarder(path);
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentRpcConnector.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentRpcConnector.java
deleted file mode 100644 (file)
index d22da30..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.opendaylight.controller.sal.binding.impl.connect.dom;
-
-public class BindingIndependentRpcConnector {
-
-}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedBindingBrokerImpl.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedBindingBrokerImpl.java
new file mode 100644 (file)
index 0000000..c715c67
--- /dev/null
@@ -0,0 +1,166 @@
+package org.opendaylight.controller.sal.binding.impl.forward;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance;
+import org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker;
+import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingDomConnectorDeployer;
+import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingIndependentConnector;
+import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingIndependentMappingService;
+import org.opendaylight.controller.sal.binding.impl.connect.dom.DeserializationException;
+import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionService.MountProvisionListener;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class DomForwardedBindingBrokerImpl extends RootBindingAwareBroker implements DomForwardedBroker {
+
+    private ProviderSession domProviderContext;
+    private BindingIndependentConnector connector;
+    
+    private MountProvisionService domMountService;
+
+    private final DomMountPointForwardingManager domForwardingManager = new DomMountPointForwardingManager();
+    private final BindingMountPointForwardingManager bindingForwardingManager = new BindingMountPointForwardingManager();
+
+    private ConcurrentMap<InstanceIdentifier<?>, BindingIndependentConnector> connectors = new ConcurrentHashMap<>();
+    private ConcurrentMap<InstanceIdentifier<?>, org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> forwarded = new ConcurrentHashMap<>();
+    private ListenerRegistration<MountProvisionListener> domListenerRegistration;
+    private ListenerRegistration<org.opendaylight.controller.sal.binding.api.mount.MountProviderService.MountProvisionListener> baListenerRegistration;
+
+
+    public DomForwardedBindingBrokerImpl(String instanceName) {
+        super(instanceName);
+    }
+
+    @Override
+    public BindingIndependentConnector getConnector() {
+        return connector;
+    }
+
+    @Override
+    public ProviderSession getDomProviderContext() {
+        return domProviderContext;
+    }
+
+    @Override
+    public void setConnector(BindingIndependentConnector connector) {
+        this.connector = connector;
+    }
+
+    @Override
+    public void setDomProviderContext(ProviderSession domProviderContext) {
+        this.domProviderContext = domProviderContext;
+    }
+
+    @Override
+    public void startForwarding() {
+        BindingDomConnectorDeployer.startDataForwarding(getConnector(), getDataBroker(), getDomProviderContext());
+        BindingDomConnectorDeployer.startRpcForwarding(getConnector(), getRpcProviderRegistry(),
+                getDomProviderContext());
+        BindingDomConnectorDeployer.startNotificationForwarding(getConnector(), getNotificationBroker(),
+                getDomProviderContext());
+        startMountpointForwarding();
+    }
+
+    private void startMountpointForwarding() {
+        domMountService = getDomProviderContext().getService(MountProvisionService.class);
+        if (domMountService != null && getMountManager() != null) {
+            domListenerRegistration = domMountService.registerProvisionListener(domForwardingManager);
+            baListenerRegistration = getMountManager().registerProvisionListener(bindingForwardingManager);
+        }
+    }
+
+    public MountProvisionService getDomMountService() {
+        return domMountService;
+    }
+
+    public void setDomMountService(MountProvisionService domMountService) {
+        this.domMountService = domMountService;
+    }
+
+    private void tryToDeployConnector(InstanceIdentifier<?> baPath,
+            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath) {
+        org.opendaylight.yangtools.yang.data.api.InstanceIdentifier previous = forwarded.putIfAbsent(baPath, biPath);
+        if (previous != null) {
+            return;
+        }
+        MountProviderInstance baMountPoint = getMountManager().createOrGetMountPoint(baPath);
+        MountProvisionInstance domMountPoint = domMountService.createOrGetMountPoint(biPath);
+        BindingIndependentConnector connector = createForwarder(baPath, baMountPoint, domMountPoint);
+        connectors.put(baPath, connector);
+    }
+
+    private BindingIndependentConnector createForwarder(InstanceIdentifier<?> path, MountProviderInstance baMountPoint,
+            MountProvisionInstance domMountPoint) {
+        BindingIndependentConnector mountConnector = BindingDomConnectorDeployer.createConnector(getConnector());
+
+        BindingDomConnectorDeployer.startDataForwarding(mountConnector, baMountPoint, domMountPoint);
+        BindingDomConnectorDeployer.startRpcForwarding(mountConnector, baMountPoint, domMountPoint);
+        BindingDomConnectorDeployer.startNotificationForwarding(mountConnector, baMountPoint, domMountPoint);
+        // connector.setDomNotificationBroker(domMountPoint);
+        return connector;
+    }
+
+    public synchronized void tryToDeployDomForwarder(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath) {
+        InstanceIdentifier<?> baPath;
+        try {
+            baPath = connector.getMappingService().fromDataDom(domPath);
+            BindingIndependentConnector potentialConnector = connectors.get(baPath);
+            if (potentialConnector != null) {
+                return;
+            }
+            tryToDeployConnector(baPath, domPath);
+        } catch (DeserializationException e) {
+
+        }
+    }
+
+    public synchronized void tryToDeployBindingForwarder(InstanceIdentifier<?> baPath) {
+        BindingIndependentConnector potentialConnector = connectors.get(baPath);
+        if (potentialConnector != null) {
+            return;
+        }
+        org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath = connector.getMappingService().toDataDom(baPath);
+        tryToDeployConnector(baPath, domPath);
+    }
+
+    public synchronized void undeployBindingForwarder(InstanceIdentifier<?> baPath) {
+        // FIXME: Implement closeMountPoint
+    }
+
+    public synchronized void undeployDomForwarder(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath) {
+        // FIXME: Implement closeMountPoint
+    }
+
+    private class DomMountPointForwardingManager implements MountProvisionListener {
+
+        @Override
+        public void onMountPointCreated(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path) {
+            tryToDeployDomForwarder(path);
+        }
+
+        @Override
+        public void onMountPointRemoved(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path) {
+            undeployDomForwarder(path);
+        }
+    }
+
+    private class BindingMountPointForwardingManager implements
+            org.opendaylight.controller.sal.binding.api.mount.MountProviderService.MountProvisionListener {
+
+        @Override
+        public void onMountPointCreated(InstanceIdentifier<?> path) {
+            tryToDeployBindingForwarder(path);
+        }
+
+        @Override
+        public void onMountPointRemoved(InstanceIdentifier<?> path) {
+            undeployBindingForwarder(path);
+        }
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedBroker.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedBroker.java
new file mode 100644 (file)
index 0000000..c7dbcd4
--- /dev/null
@@ -0,0 +1,17 @@
+package org.opendaylight.controller.sal.binding.impl.forward;
+
+import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingIndependentConnector;
+import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+
+interface DomForwardedBroker {
+
+    public BindingIndependentConnector getConnector();
+    
+    public void setConnector(BindingIndependentConnector connector);
+    
+    public void setDomProviderContext(ProviderSession domProviderContext);
+
+    public ProviderSession getDomProviderContext();
+
+    void startForwarding();
+}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedDataBrokerImpl.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedDataBrokerImpl.java
new file mode 100644 (file)
index 0000000..f90a4ac
--- /dev/null
@@ -0,0 +1,49 @@
+package org.opendaylight.controller.sal.binding.impl.forward;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.opendaylight.controller.sal.binding.impl.RootDataBrokerImpl;
+import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingDomConnectorDeployer;
+import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingIndependentConnector;
+import org.opendaylight.controller.sal.core.api.Provider;
+import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+
+public class DomForwardedDataBrokerImpl extends RootDataBrokerImpl implements Provider, DomForwardedBroker {
+
+    private BindingIndependentConnector connector;
+    private ProviderSession domProviderContext;
+
+    public void setConnector(BindingIndependentConnector connector) {
+        this.connector = connector;
+    }
+
+    @Override
+    public void onSessionInitiated(ProviderSession session) {
+        this.setDomProviderContext(session);
+    }
+
+    @Override
+    public Collection<ProviderFunctionality> getProviderFunctionality() {
+        return Collections.emptySet();
+    }
+
+    @Override
+    public BindingIndependentConnector getConnector() {
+        return connector;
+    }
+
+    @Override
+    public ProviderSession getDomProviderContext() {
+        return domProviderContext;
+    }
+
+    public void setDomProviderContext(ProviderSession domProviderContext) {
+        this.domProviderContext = domProviderContext;
+    }
+
+    @Override
+    public void startForwarding() {
+        BindingDomConnectorDeployer.startDataForwarding(getConnector(), this, getDomProviderContext());
+    }
+}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardingUtils.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardingUtils.java
new file mode 100644 (file)
index 0000000..581b217
--- /dev/null
@@ -0,0 +1,25 @@
+package org.opendaylight.controller.sal.binding.impl.forward;
+
+import com.google.common.base.Preconditions;
+
+public class DomForwardingUtils {
+
+    public static boolean isDomForwardedBroker(Object obj) {
+        return obj instanceof DomForwardedBroker;
+    }
+
+    public static void reuseForwardingFrom(Object target,Object source) {
+        Preconditions.checkArgument(isDomForwardedBroker(source));
+        Preconditions.checkArgument(isDomForwardedBroker(target));
+        DomForwardedBroker forwardedSource = (DomForwardedBroker) source;
+        DomForwardedBroker forwardedTarget = (DomForwardedBroker) target;
+        reuseForwardingFrom(forwardedTarget, forwardedSource);
+        
+    }
+
+    private static void reuseForwardingFrom(DomForwardedBroker target, DomForwardedBroker source) {
+        target.setConnector(source.getConnector());
+        target.setDomProviderContext(source.getDomProviderContext());
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/osgi/Constants.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/osgi/Constants.xtend
deleted file mode 100644 (file)
index 9fb2140..0000000
+++ /dev/null
@@ -1,19 +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.osgi
-
-class Constants {
-
-    private new() {
-    }
-
-    public static val SAL_SERVICE_TYPE = "salServiceType"
-    public static val SAL_SERVICE_TYPE_CONSUMER_PROXY = "consumerProxy"
-    public static val SAL_SERVICE_TYPE_PROVIDER = "provider"
-    public static val SAL_SERVICE_TYPE_CONNECTOR = "connector"
-}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/osgi/PropertiesUtils.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/osgi/PropertiesUtils.xtend
deleted file mode 100644 (file)
index d04ca7f..0000000
+++ /dev/null
@@ -1,31 +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.osgi
-
-import java.util.Hashtable
-import static org.opendaylight.controller.sal.binding.impl.osgi.Constants.*
-
-class PropertiesUtils {
-
-    private new() {
-    }
-
-    static def setSalServiceType(Hashtable<String, String> properties, String value) {
-        properties.put(SAL_SERVICE_TYPE, value)
-        return properties
-    }
-
-    static def getSalServiceType(Hashtable<String, String> properties) {
-        return properties.get(SAL_SERVICE_TYPE)
-    }
-
-    static def newProperties() {
-        new Hashtable<String, String>()
-    }
-
-}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/osgi/package-info.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/osgi/package-info.java
deleted file mode 100644 (file)
index d788ccf..0000000
+++ /dev/null
@@ -1,8 +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.osgi;
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/RoutingContext.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/RoutingContext.java
deleted file mode 100644 (file)
index 49e056b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.opendaylight.controller.sal.binding.spi;
-
-public class RoutingContext {
-
-}
index b040aa025e2bd05450f5458922df34f85c46fa30..b0d1629a73f645333fb3aacfc3d33aae4fa562a2 100644 (file)
@@ -85,10 +85,10 @@ module opendaylight-sal-binding-broker-impl {
                         config:required-identity sal:binding-notification-service;
                     }
                 }
-            } 
+            }
         }
     }
-    
+
     augment "/config:modules/config:module/config:configuration" {
         case binding-data-broker {
             when "/config:modules/config:module/config:type = 'binding-data-broker'";
@@ -100,6 +100,7 @@ module opendaylight-sal-binding-broker-impl {
                     }
                 }
             }
+
             container mapping-service {
                 uses config:service-ref {
                     refine type {
index 6f0db4cd8d3635d0cd43bea0e943dd7d5555fdd2..20181a62c8a8b38abc3add11873ed3452350cf89 100644 (file)
@@ -16,11 +16,11 @@ import org.junit.Test;
 import static org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper.*;
 
 import org.opendaylight.controller.sal.binding.api.NotificationListener;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable;
 import org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator;
 import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory;
 import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory.NotificationInvoker;
-import org.opendaylight.controller.sal.binding.spi.RpcRouter;
-import org.opendaylight.controller.sal.binding.spi.RpcRoutingTable;
 import org.opendaylight.controller.sal.binding.test.mock.BarListener;
 import org.opendaylight.controller.sal.binding.test.mock.BarUpdate;
 import org.opendaylight.controller.sal.binding.test.mock.CompositeListener;
index d4d27a14eceb68c3df38c8b826ae23845fb76e69..c03d851f5c9ef740a14a9097feceaf8909833184 100644 (file)
@@ -4,26 +4,44 @@ import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.Future;
 
 import javassist.ClassPool;
 
+import org.eclipse.xtext.xbase.lib.Pure;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.controller.sal.binding.api.mount.MountProviderService;
 import org.opendaylight.controller.sal.binding.dom.serializer.impl.RuntimeGeneratedMappingServiceImpl;
-import org.opendaylight.controller.sal.binding.impl.BindingAwareBrokerImpl;
 import org.opendaylight.controller.sal.binding.impl.DataBrokerImpl;
 import org.opendaylight.controller.sal.binding.impl.NotificationBrokerImpl;
+import org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker;
+import org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl;
+import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingDomConnectorDeployer;
 import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingIndependentConnector;
 import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingIndependentMappingService;
+import org.opendaylight.controller.sal.binding.impl.forward.DomForwardedBindingBrokerImpl;
 import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
+import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
+import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration;
+import org.opendaylight.controller.sal.core.api.BrokerService;
 import org.opendaylight.controller.sal.core.api.RpcImplementation;
 import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
+import org.opendaylight.controller.sal.core.api.RpcRegistrationListener;
 import org.opendaylight.controller.sal.core.api.data.DataStore;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
+import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
 import org.opendaylight.controller.sal.dom.broker.BrokerImpl;
+import org.opendaylight.controller.sal.dom.broker.MountPointManagerImpl;
 import org.opendaylight.controller.sal.dom.broker.impl.DataStoreStatsWrapper;
 import org.opendaylight.controller.sal.dom.broker.impl.HashMapDataStore;
 import org.opendaylight.controller.sal.dom.broker.impl.RpcRouterImpl;
 import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareDataStoreAdapter;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
@@ -33,26 +51,26 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Predicate;
+import com.google.common.collect.ClassToInstanceMap;
+import com.google.common.collect.ImmutableClassToInstanceMap;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
 
 import static com.google.common.base.Preconditions.*;
 
 public class BindingTestContext implements AutoCloseable {
-    
-    
+
     public static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier TREE_ROOT = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
             .builder().toInstance();
 
     private static final Logger LOG = LoggerFactory.getLogger(BindingTestContext.class);
-    
+
     private RuntimeGeneratedMappingServiceImpl mappingServiceImpl;
-    
-    
-    private BindingAwareBrokerImpl baBrokerImpl;
+
+    private DomForwardedBindingBrokerImpl baBrokerImpl;
     private DataBrokerImpl baDataImpl;
     private NotificationBrokerImpl baNotifyImpl;
-    private BindingIndependentConnector baConnectDataServiceImpl;
+    private BindingIndependentConnector baConnectImpl;
 
     private org.opendaylight.controller.sal.dom.broker.DataBrokerImpl biDataImpl;
     private BrokerImpl biBrokerImpl;
@@ -61,15 +79,15 @@ public class BindingTestContext implements AutoCloseable {
     private DataStoreStatsWrapper dataStoreStats;
     private DataStore dataStore;
 
-    
     private boolean dataStoreStatisticsEnabled = false;
-    
+
     private final ListeningExecutorService executor;
     private final ClassPool classPool;
 
     private final boolean startWithSchema;
 
-    
+    private MountPointManagerImpl biMountImpl;
+
     protected BindingTestContext(ListeningExecutorService executor, ClassPool classPool, boolean startWithSchema) {
         this.executor = executor;
         this.classPool = classPool;
@@ -82,74 +100,133 @@ public class BindingTestContext implements AutoCloseable {
         rawDataStore = new HashMapDataStore();
         schemaAwareDataStore = new SchemaAwareDataStoreAdapter();
         schemaAwareDataStore.changeDelegate(rawDataStore);
-        if(dataStoreStatisticsEnabled) {
-        dataStoreStats = new DataStoreStatsWrapper(schemaAwareDataStore);
-        dataStore = dataStoreStats;
+        if (dataStoreStatisticsEnabled) {
+            dataStoreStats = new DataStoreStatsWrapper(schemaAwareDataStore);
+            dataStore = dataStoreStats;
         } else {
             dataStore = schemaAwareDataStore;
         }
-        
+
         biDataImpl.registerConfigurationReader(TREE_ROOT, dataStore);
         biDataImpl.registerOperationalReader(TREE_ROOT, dataStore);
         biDataImpl.registerCommitHandler(TREE_ROOT, dataStore);
     }
-    
+
     public void startDomDataBroker() {
-        checkState(executor != null,"Executor needs to be set");
+        checkState(executor != null, "Executor needs to be set");
         biDataImpl = new org.opendaylight.controller.sal.dom.broker.DataBrokerImpl();
         biDataImpl.setExecutor(executor);
     }
-    
+
     public void startBindingDataBroker() {
-        checkState(executor != null,"Executor needs to be set");
+        checkState(executor != null, "Executor needs to be set");
         baDataImpl = new DataBrokerImpl();
         baDataImpl.setExecutor(executor);
     }
-    
+
     public void startBindingBroker() {
-        checkState(executor != null,"Executor needs to be set");
-        checkState(baDataImpl != null,"Binding Data Broker must be started");
+        checkState(executor != null, "Executor needs to be set");
+        checkState(baDataImpl != null, "Binding Data Broker must be started");
         checkState(baNotifyImpl != null, "Notification Service must be started");
-        baBrokerImpl = new BindingAwareBrokerImpl("test",null);
-        
+        baBrokerImpl = new DomForwardedBindingBrokerImpl("test");
+
+        baBrokerImpl.getMountManager().setDataCommitExecutor(executor);
+        baBrokerImpl.getMountManager().setNotificationExecutor(executor);
+        baBrokerImpl.setRpcBroker(new RpcProviderRegistryImpl("test"));
         baBrokerImpl.setDataBroker(baDataImpl);
-        baBrokerImpl.setNotifyBroker(baNotifyImpl);
-        
+        baBrokerImpl.setNotificationBroker(baNotifyImpl);
         baBrokerImpl.start();
     }
-    
-    public void startBindingToDomDataConnector() {
-        checkState(baDataImpl != null,"Binding Data Broker needs to be started");
-        checkState(biDataImpl != null,"DOM Data Broker needs to be started.");
-        checkState(mappingServiceImpl != null,"DOM Mapping Service needs to be started.");
-        baConnectDataServiceImpl = new BindingIndependentConnector();
-        baConnectDataServiceImpl.setRpcRegistry(baBrokerImpl);
-        baConnectDataServiceImpl.setDomRpcRegistry(getDomRpcRegistry());
-        baConnectDataServiceImpl.setBaDataService(baDataImpl);
-        baConnectDataServiceImpl.setBiDataService(biDataImpl);
-        baConnectDataServiceImpl.setMappingService(mappingServiceImpl);
-        baConnectDataServiceImpl.start();
+
+    public void startForwarding() {
+        checkState(baDataImpl != null, "Binding Data Broker needs to be started");
+        checkState(biDataImpl != null, "DOM Data Broker needs to be started.");
+        checkState(mappingServiceImpl != null, "DOM Mapping Service needs to be started.");
+
+        baConnectImpl = BindingDomConnectorDeployer.createConnector(getBindingToDomMappingService());
+        baConnectImpl.setDomRpcRegistry(getDomRpcRegistry());
+        baBrokerImpl.setConnector(baConnectImpl);
+        baBrokerImpl.setDomProviderContext(createMockContext());
+        baBrokerImpl.startForwarding();
     }
-    
+
+    private ProviderSession createMockContext() {
+        // TODO Auto-generated method stub
+        final ClassToInstanceMap<BrokerService> domBrokerServices = ImmutableClassToInstanceMap
+                .<BrokerService> builder()
+                //
+                .put(org.opendaylight.controller.sal.core.api.data.DataProviderService.class, biDataImpl) //
+                .put(RpcProvisionRegistry.class, biBrokerImpl.getRouter()) //
+                .put(MountProvisionService.class, biMountImpl) //
+                .build();
+
+        return new ProviderSession() {
+
+            @Override
+            public Future<RpcResult<CompositeNode>> rpc(QName rpc, CompositeNode input) {
+                throw new UnsupportedOperationException();
+            }
+
+            @Override
+            public <T extends BrokerService> T getService(Class<T> service) {
+                return domBrokerServices.getInstance(service);
+            }
+
+            @Override
+            public boolean isClosed() {
+                return false;
+            }
+
+            @Override
+            public Set<QName> getSupportedRpcs() {
+                return null;
+            }
+
+            @Override
+            public void close() {
+            }
+
+            @Override
+            public ListenerRegistration<RpcRegistrationListener> addRpcRegistrationListener(
+                    RpcRegistrationListener listener) {
+                return null;
+            }
+
+            @Override
+            public RpcRegistration addRpcImplementation(QName rpcType, RpcImplementation implementation)
+                    throws IllegalArgumentException {
+                return null;
+            }
+
+            @Override
+            public RoutedRpcRegistration addRoutedRpcImplementation(QName rpcType, RpcImplementation implementation) {
+                return null;
+            }
+
+            @Override
+            public RoutedRpcRegistration addMountedRpcImplementation(QName rpcType, RpcImplementation implementation) {
+                return null;
+            }
+        };
+    }
+
     public void startBindingToDomMappingService() {
-        checkState(classPool != null,"ClassPool needs to be present");
+        checkState(classPool != null, "ClassPool needs to be present");
         mappingServiceImpl = new RuntimeGeneratedMappingServiceImpl();
         mappingServiceImpl.setPool(classPool);
         mappingServiceImpl.start(null);
     }
-    
-    
+
     public void updateYangSchema(String[] files) {
         SchemaContext context = getContext(files);
-        if(schemaAwareDataStore != null) {
+        if (schemaAwareDataStore != null) {
             schemaAwareDataStore.onGlobalContextUpdated(context);
         }
-        if(mappingServiceImpl != null) {
+        if (mappingServiceImpl != null) {
             mappingServiceImpl.onGlobalContextUpdated(context);
         }
     }
-    
-    
+
     public static String[] getAllYangFilesOnClasspath() {
         Predicate<String> predicate = new Predicate<String>() {
             @Override
@@ -161,7 +238,7 @@ public class BindingTestContext implements AutoCloseable {
         Set<String> result = reflection.getResources(predicate);
         return (String[]) result.toArray(new String[result.size()]);
     }
-    
+
     private static SchemaContext getContext(String[] yangFiles) {
         ClassLoader loader = BindingTestContext.class.getClassLoader();
         List<InputStream> streams = new ArrayList<>();
@@ -173,7 +250,7 @@ public class BindingTestContext implements AutoCloseable {
         Set<Module> modules = parser.parseYangModelsFromStreams(streams);
         return parser.resolveSchemaContext(modules);
     }
-    
+
     public void start() {
         startBindingDataBroker();
         startBindingNotificationBroker();
@@ -181,13 +258,19 @@ public class BindingTestContext implements AutoCloseable {
         startDomDataBroker();
         startDomDataStore();
         startDomBroker();
+        startDomMountPoint();
         startBindingToDomMappingService();
-        startBindingToDomDataConnector();
-        if(startWithSchema) {
+        startForwarding();
+        if (startWithSchema) {
             loadYangSchemaFromClasspath();
         }
     }
 
+    private void startDomMountPoint() {
+        biMountImpl = new MountPointManagerImpl();
+        biMountImpl.setDataBroker(getDomDataBroker());
+    }
+
     private void startDomBroker() {
         checkState(executor != null);
         biBrokerImpl = new BrokerImpl();
@@ -198,7 +281,7 @@ public class BindingTestContext implements AutoCloseable {
     public void startBindingNotificationBroker() {
         checkState(executor != null);
         baNotifyImpl = new NotificationBrokerImpl(executor);
-        
+
     }
 
     public void loadYangSchemaFromClasspath() {
@@ -223,10 +306,10 @@ public class BindingTestContext implements AutoCloseable {
     }
 
     public void logDataStoreStatistics() {
-        if(dataStoreStats == null) {
+        if (dataStoreStats == null) {
             return;
         }
-        
+
         LOG.info("BIDataStore Statistics: Configuration Read Count: {} TotalTime: {} ms AverageTime (ns): {} ms",
                 dataStoreStats.getConfigurationReadCount(), dataStoreStats.getConfigurationReadTotalTime(),
                 dataStoreStats.getConfigurationReadAverageTime());
@@ -241,22 +324,30 @@ public class BindingTestContext implements AutoCloseable {
     }
 
     public RpcProviderRegistry getBindingRpcRegistry() {
-        return baBrokerImpl;
+        return baBrokerImpl.getRoot();
     }
 
     public RpcProvisionRegistry getDomRpcRegistry() {
-        if(biBrokerImpl == null) {
+        if (biBrokerImpl == null) {
             return null;
         }
         return biBrokerImpl.getRouter();
     }
-    
+
     public RpcImplementation getDomRpcInvoker() {
         return biBrokerImpl.getRouter();
     }
-    
+
     @Override
     public void close() throws Exception {
-        
+
+    }
+
+    public MountProviderService getBindingMountProviderService() {
+        return baBrokerImpl.getMountManager();
+    }
+
+    public MountProvisionService getDomMountProviderService() {
+        return biMountImpl;
     }
 }
index 55bff1a5c7d56da9a5a1eda2cb7bb21c8f37f17b..0258c3e439acde92a132406f82861e23314147df 100644 (file)
@@ -5,7 +5,7 @@ import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
 import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.controller.sal.binding.impl.connect.dom.CommitHandlersTransactions;
+import org.opendaylight.controller.sal.common.util.CommitHandlerTransactions;
 import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
 import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpVersion;
@@ -136,7 +136,7 @@ public class ChangeOriginatedInDomBrokerTest extends AbstractDataServiceTest {
             public org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction<InstanceIdentifier<? extends DataObject>, DataObject> requestCommit(
                     DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification) {
                 modificationCapture = modification;
-                return CommitHandlersTransactions.allwaysSuccessfulTransaction(modification);
+                return CommitHandlerTransactions.allwaysSuccessfulTransaction(modification);
             }
 
         };
diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerMountPointTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerMountPointTest.java
new file mode 100644 (file)
index 0000000..a99d80f
--- /dev/null
@@ -0,0 +1,154 @@
+package org.opendaylight.controller.sal.binding.test.connect.dom;
+
+import static junit.framework.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+
+import java.math.BigInteger;
+import java.util.Collections;
+import java.util.Map;
+
+import javax.management.Notification;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.md.sal.common.api.data.DataReader;
+import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance;
+import org.opendaylight.controller.sal.binding.api.mount.MountProviderService;
+import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactory;
+import org.opendaylight.controller.sal.binding.test.util.BindingTestContext;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+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.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
+import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.util.concurrent.MoreExecutors;
+
+public class CrossBrokerMountPointTest {
+
+    private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
+    private static final QName FLOW_ID_QNAME = QName.create(Flow.QNAME, "id");
+    private static final QName FLOW_NODE_QNAME = QName.create(Flow.QNAME, "node");
+    private static final QName TABLE_ID_QNAME = QName.create(Table.QNAME, "id");
+
+    private static final String NODE_ID = "node:1";
+
+    private static final NodeKey NODE_KEY = new NodeKey(new NodeId(NODE_ID));
+
+    private static final Map<QName, Object> NODE_KEY_BI = Collections.<QName, Object> singletonMap(NODE_ID_QNAME,
+            NODE_ID);
+
+    private static final InstanceIdentifier<Node> NODE_INSTANCE_ID_BA = InstanceIdentifier.builder(Nodes.class) //
+            .child(Node.class, NODE_KEY).toInstance();
+    private static GroupKey GROUP_KEY = new GroupKey(new GroupId(0L));
+
+    private static final InstanceIdentifier<GroupStatistics> GROUP_STATISTICS_ID_BA = InstanceIdentifier
+            .builder(NODE_INSTANCE_ID_BA).augmentation(FlowCapableNode.class) //
+            .child(Group.class, GROUP_KEY) //
+            .augmentation(NodeGroupStatistics.class) //
+            .child(GroupStatistics.class) //
+            .toInstance();
+
+    private static final QName AUGMENTED_GROUP_STATISTICS = QName.create(NodeGroupStatistics.QNAME,
+            GroupStatistics.QNAME.getLocalName());
+
+    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
+    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
+            .node(Nodes.QNAME) //
+            .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
+            .toInstance();
+
+    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier GROUP_STATISTICS_ID_BI = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+            //
+            .builder(NODE_INSTANCE_ID_BI)
+            .nodeWithKey(QName.create(FlowCapableNode.QNAME, "group"), QName.create(FlowCapableNode.QNAME, "group-id"),
+                    0L).node(AUGMENTED_GROUP_STATISTICS).toInstance();
+
+    private static final NodeRef NODE_REF = new NodeRef(NODE_INSTANCE_ID_BA);
+
+    private BindingTestContext testContext;
+    private MountProviderService bindingMountPointService;
+    private MountProvisionService domMountPointService;
+
+    @Before
+    public void setup() {
+        BindingBrokerTestFactory testFactory = new BindingBrokerTestFactory();
+        testFactory.setExecutor(MoreExecutors.sameThreadExecutor());
+        testFactory.setStartWithParsedSchema(true);
+        testContext = testFactory.getTestContext();
+
+        testContext.start();
+        bindingMountPointService = testContext.getBindingMountProviderService();
+        domMountPointService = testContext.getDomMountProviderService();
+
+        // biRpcInvoker = testContext.getDomRpcInvoker();
+        assertNotNull(bindingMountPointService);
+        assertNotNull(domMountPointService);
+
+        // flowService = MessageCapturingFlowService.create(baRpcRegistry);
+    }
+
+    @Test
+    public void testMountPoint() {
+
+        testContext.getBindingDataBroker().readOperationalData(NODE_INSTANCE_ID_BA);
+
+        MountProvisionInstance domMountPoint = domMountPointService.createMountPoint(NODE_INSTANCE_ID_BI);
+        assertNotNull(domMountPoint);
+        MountProviderInstance bindingMountPoint = bindingMountPointService.getMountPoint(NODE_INSTANCE_ID_BA);
+        assertNotNull(bindingMountPoint);
+
+        final BigInteger packetCount = BigInteger.valueOf(500L);
+        
+        
+        DataReader<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> simpleReader = new DataReader<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode>() {
+
+            @Override
+            public CompositeNode readConfigurationData(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier arg0) {
+                return null;
+            }
+
+            
+            @Override
+            public CompositeNode readOperationalData(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier arg0) {
+                if (arg0.equals(GROUP_STATISTICS_ID_BI)) {
+                    ImmutableCompositeNode data = ImmutableCompositeNode
+                            .builder()
+                            .setQName(AUGMENTED_GROUP_STATISTICS)
+                            .addLeaf(QName.create(AUGMENTED_GROUP_STATISTICS, "packet-count"), packetCount) //
+                            .toInstance();
+
+                    return data;
+                }
+                return null;
+            }
+
+        };
+        domMountPoint.registerOperationalReader(NODE_INSTANCE_ID_BI, simpleReader);
+        
+        GroupStatistics data = (GroupStatistics) bindingMountPoint.readOperationalData(GROUP_STATISTICS_ID_BA);
+        assertNotNull(data);
+        assertEquals(packetCount,data.getPacketCount().getValue());
+    }
+}
index 112b57cd33fc2fbb43c08059a5274f9647574084..c943226ccac994284cef91da558f3fce973ea11f 100644 (file)
@@ -87,6 +87,7 @@ public class TestHelper {
                 mavenBundle(CONTROLLER, "sal-binding-api").versionAsInProject(), // //
                 mavenBundle(CONTROLLER, "sal-binding-config").versionAsInProject(), //
                 mavenBundle(CONTROLLER, "sal-binding-broker-impl").versionAsInProject(), // //
+                mavenBundle(CONTROLLER, "sal-binding-util").versionAsInProject(), //
                 mavenBundle("org.javassist", "javassist").versionAsInProject(), // //
                 mavenBundle(CONTROLLER, "sal-common-util").versionAsInProject(), // //
 
index 6fec18033f8feeed2df5dd7f040d2ddf622d63ad..2f86ee4cc2e9e34c4db55b803b565f090c7962b5 100644 (file)
@@ -5,13 +5,16 @@ import static org.junit.Assert.assertNotNull;
 
 import java.math.BigInteger;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
 import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.binding.api.NotificationService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded;
@@ -24,6 +27,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalF
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SwitchFlowRemoved;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.NotificationListener;
+import org.opendaylight.yangtools.yang.binding.RpcService;
 
 public class NoficationTest extends AbstractTest {
 
@@ -95,16 +99,36 @@ public class NoficationTest extends AbstractTest {
          * The registration of the Consumer 2. SalFlowListener is registered
          * registered as notification listener.
          */
-        BindingAwareConsumer consumer2 = new BindingAwareConsumer() {
+        BindingAwareProvider provider = new BindingAwareProvider() {
+            
             @Override
-            public void onSessionInitialized(ConsumerContext session) {
+            public void onSessionInitiated(ProviderContext session) {
                 listener2Reg = session.getSALService(NotificationProviderService.class).registerNotificationListener(
                         listener2);
             }
+            
+            @Override
+            public void onSessionInitialized(ConsumerContext session) {
+                // TODO Auto-generated method stub
+                
+            }
+            
+            @Override
+            public Collection<? extends RpcService> getImplementations() {
+                // TODO Auto-generated method stub
+                return null;
+            }
+            
+            @Override
+            public Collection<? extends ProviderFunctionality> getFunctionality() {
+                // TODO Auto-generated method stub
+                return null;
+            }
+            
         };
 
         // registerConsumer method calls onSessionInitialized method above
-        broker.registerConsumer(consumer2, getBundleContext());
+        broker.registerProvider(provider, getBundleContext());
 
         /**
          * 3 notifications are published
index 26041ea85ec61d1f7bece2d274627fea3bd63e33..67c10f4a048405b64ca6ca58b1f7a22cdc8d9d53 100644 (file)
             <artifactId>sal-binding-api</artifactId>
             <version>1.0-SNAPSHOT</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.dependencymanager</artifactId>
-            <version>3.1.0</version>
-        </dependency>
     </dependencies>
 </project>
diff --git a/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalConsumerInstance.java b/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalConsumerInstance.java
new file mode 100644 (file)
index 0000000..ff6f618
--- /dev/null
@@ -0,0 +1,178 @@
+package org.opendaylight.controller.md.sal.binding.util;
+
+import java.util.concurrent.Future;
+import java.util.zip.Checksum;
+
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.controller.sal.binding.api.NotificationListener;
+import org.opendaylight.controller.sal.binding.api.NotificationService;
+import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+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.binding.api.mount.MountInstance;
+import org.opendaylight.controller.sal.common.DataStoreIdentifier;
+import org.opendaylight.yangtools.concepts.Identifiable;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.Registration;
+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.binding.Notification;
+import org.opendaylight.yangtools.yang.binding.RpcService;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import com.google.common.base.Preconditions;
+
+public abstract class AbstractBindingSalConsumerInstance<D extends DataBrokerService, N extends NotificationService, R extends RpcConsumerRegistry> //
+        implements //
+        RpcConsumerRegistry, //
+        NotificationService, //
+        DataBrokerService {
+
+    private final R rpcRegistry;
+    private final N notificationBroker;
+    private final D dataBroker;
+
+    protected final R getRpcRegistry() {
+        return rpcRegistry;
+    }
+
+    protected final N getNotificationBroker() {
+        return notificationBroker;
+    }
+
+    protected final D getDataBroker() {
+        return dataBroker;
+    }
+    
+    protected final R getRpcRegistryChecked() {
+        Preconditions.checkState(rpcRegistry != null,"Rpc Registry is not available.");
+        return rpcRegistry;
+    }
+
+    protected final N getNotificationBrokerChecked() {
+        Preconditions.checkState(notificationBroker != null,"Notification Broker is not available.");
+        return notificationBroker;
+    }
+
+    protected final D getDataBrokerChecked() {
+        Preconditions.checkState(dataBroker != null, "Data Broker is not available");
+        return dataBroker;
+    }
+    
+
+    protected AbstractBindingSalConsumerInstance(R rpcRegistry, N notificationBroker, D dataBroker) {
+        this.rpcRegistry = rpcRegistry;
+        this.notificationBroker = notificationBroker;
+        this.dataBroker = dataBroker;
+    }
+
+    public <T extends RpcService> T getRpcService(Class<T> module) {
+        return getRpcRegistryChecked().getRpcService(module);
+    }
+
+    @Deprecated
+    public <T extends Notification> void addNotificationListener(Class<T> notificationType,
+            NotificationListener<T> listener) {
+        getNotificationBrokerChecked().addNotificationListener(notificationType, listener);
+    }
+
+    @Deprecated
+    public void addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
+        getNotificationBrokerChecked().addNotificationListener(listener);
+    }
+
+    @Deprecated
+    public void removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
+        getNotificationBrokerChecked().removeNotificationListener(listener);
+    }
+
+    @Deprecated
+    public <T extends Notification> void removeNotificationListener(Class<T> notificationType,
+            NotificationListener<T> listener) {
+        getNotificationBrokerChecked().removeNotificationListener(notificationType, listener);
+    }
+
+    public <T extends Notification> Registration<NotificationListener<T>> registerNotificationListener(
+            Class<T> notificationType, NotificationListener<T> listener) {
+        return getNotificationBrokerChecked().registerNotificationListener(notificationType, listener);
+    }
+
+    public Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> registerNotificationListener(
+            org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
+        return getNotificationBrokerChecked().registerNotificationListener(listener);
+    }
+
+    @Deprecated
+    public <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType) {
+        return getDataBrokerChecked().getData(store, rootType);
+    }
+
+    @Deprecated
+    public <T extends DataRoot> T getData(DataStoreIdentifier store, T filter) {
+        return getDataBrokerChecked().getData(store, filter);
+    }
+
+    @Deprecated
+    public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, Class<T> rootType) {
+        return getDataBrokerChecked().getCandidateData(store, rootType);
+    }
+
+    @Deprecated
+    public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter) {
+        return getDataBrokerChecked().getCandidateData(store, filter);
+    }
+
+    @Deprecated
+    public RpcResult<DataRoot> editCandidateData(DataStoreIdentifier store, DataRoot changeSet) {
+        return getDataBrokerChecked().editCandidateData(store, changeSet);
+    }
+
+    @Deprecated
+    public Future<RpcResult<Void>> commit(DataStoreIdentifier store) {
+        return getDataBrokerChecked().commit(store);
+    }
+
+    @Deprecated
+    public DataObject getData(InstanceIdentifier<? extends DataObject> data) {
+        return getDataBrokerChecked().getData(data);
+    }
+
+    @Deprecated
+    public DataObject getConfigurationData(InstanceIdentifier<?> data) {
+        return getDataBrokerChecked().getConfigurationData(data);
+    }
+
+    public DataModificationTransaction beginTransaction() {
+        return getDataBrokerChecked().beginTransaction();
+    }
+
+    @Deprecated
+    public void registerChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener) {
+        getDataBrokerChecked().registerChangeListener(path, changeListener);
+    }
+
+    @Deprecated
+    public void unregisterChangeListener(InstanceIdentifier<? extends DataObject> path,
+            DataChangeListener changeListener) {
+        getDataBrokerChecked().unregisterChangeListener(path, changeListener);
+    }
+
+    @Deprecated
+    public DataObject readConfigurationData(InstanceIdentifier<? extends DataObject> path) {
+        return getDataBrokerChecked().readConfigurationData(path);
+    }
+
+    public DataObject readOperationalData(InstanceIdentifier<? extends DataObject> path) {
+        return getDataBrokerChecked().readOperationalData(path);
+    }
+
+    @Deprecated
+    public ListenerRegistration<DataChangeListener> registerDataChangeListener(
+            InstanceIdentifier<? extends DataObject> path, DataChangeListener listener) {
+        return getDataBrokerChecked().registerDataChangeListener(path, listener);
+    }
+}
diff --git a/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalProviderInstance.java b/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalProviderInstance.java
new file mode 100644 (file)
index 0000000..278e90e
--- /dev/null
@@ -0,0 +1,95 @@
+package org.opendaylight.controller.md.sal.binding.util;
+
+import java.util.concurrent.ExecutorService;
+
+import org.opendaylight.controller.md.sal.common.api.RegistrationListener;
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandlerRegistration;
+import org.opendaylight.controller.md.sal.common.api.data.DataReader;
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.Notification;
+import org.opendaylight.yangtools.yang.binding.RpcService;
+
+public abstract class AbstractBindingSalProviderInstance<D extends DataProviderService, N extends NotificationProviderService, R extends RpcProviderRegistry> //
+        extends AbstractBindingSalConsumerInstance<D, N, R> //
+        implements //
+        DataProviderService, //
+        RpcProviderRegistry, //
+        NotificationProviderService {
+
+    public AbstractBindingSalProviderInstance(R rpcRegistry, N notificationBroker,
+            D dataBroker) {
+        super(rpcRegistry, notificationBroker, dataBroker);
+    }
+
+    @Override
+    public Registration<DataReader<InstanceIdentifier<? extends DataObject>, DataObject>> registerDataReader(
+            InstanceIdentifier<? extends DataObject> path,
+            DataReader<InstanceIdentifier<? extends DataObject>, DataObject> reader) {
+        return getDataBrokerChecked().registerDataReader(path, reader);
+    }
+
+    @Override
+    public Registration<DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject>> registerCommitHandler(
+            InstanceIdentifier<? extends DataObject> path,
+            DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject> commitHandler) {
+        return getDataBrokerChecked().registerCommitHandler(path, commitHandler);
+    }
+
+    @Override
+    public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier<? extends DataObject>, DataObject>>> registerCommitHandlerListener(
+            RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier<? extends DataObject>, DataObject>> commitHandlerListener) {
+        return getDataBrokerChecked().registerCommitHandlerListener(commitHandlerListener);
+    }
+
+    @Override
+    public <T extends RpcService> RpcRegistration<T> addRpcImplementation(Class<T> type, T implementation)
+            throws IllegalStateException {
+        return getRpcRegistryChecked().addRpcImplementation(type, implementation);
+    }
+
+    @Override
+    public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> type, T implementation)
+            throws IllegalStateException {
+        return getRpcRegistryChecked().addRoutedRpcImplementation(type, implementation);
+    }
+
+    @Override
+    @Deprecated
+    public void notify(Notification notification) {
+        getNotificationBrokerChecked().notify(notification);
+    }
+
+    @Override
+    @Deprecated
+    public void notify(Notification notification, ExecutorService service) {
+        getNotificationBrokerChecked().notify(notification, service);
+    }
+
+    @Override
+    public void publish(Notification notification) {
+        getNotificationBrokerChecked().publish(notification);
+    }
+
+    @Override
+    public void publish(Notification notification, ExecutorService service) {
+        getNotificationBrokerChecked().publish(notification, service);
+    }
+
+    @Override
+    public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
+            L listener) {
+        return getRpcRegistryChecked().registerRouteChangeListener(listener);
+    }
+}
diff --git a/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/BindingContextUtils.java b/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/BindingContextUtils.java
new file mode 100644 (file)
index 0000000..6f2186b
--- /dev/null
@@ -0,0 +1,143 @@
+package org.opendaylight.controller.md.sal.binding.util;
+
+import java.awt.image.SinglePixelPackedSampleModel;
+
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
+import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
+import org.opendaylight.controller.sal.binding.api.BindingAwareService;
+import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.RpcService;
+
+import static com.google.common.base.Preconditions.*;
+
+import com.google.common.collect.ClassToInstanceMap;
+import com.google.common.collect.MutableClassToInstanceMap;
+
+public class BindingContextUtils {
+
+    public static ConsumerContext createConsumerContext(BindingAwareConsumer consumer,
+            ClassToInstanceMap<BindingAwareService> serviceProvider) {
+        checkNotNull(consumer,"Consumer should not be null");
+        checkNotNull(serviceProvider,"Service map should not be null");
+        return new SingleConsumerContextImpl(serviceProvider);
+    }
+    
+    public static ProviderContext createProviderContext(BindingAwareProvider provider,
+            ClassToInstanceMap<BindingAwareService> serviceProvider) {
+        checkNotNull(provider,"Provider should not be null");
+        checkNotNull(serviceProvider,"Service map should not be null");
+        return new SingleProviderContextImpl(serviceProvider);
+    }
+
+    public static ConsumerContext createConsumerContextAndInitialize(BindingAwareConsumer consumer,
+            ClassToInstanceMap<BindingAwareService> serviceProvider) {
+        ConsumerContext context = createConsumerContext(consumer, serviceProvider);
+        consumer.onSessionInitialized(context);
+        return context;
+    }
+    
+    public static ProviderContext createProviderContextAndInitialize(BindingAwareProvider provider,
+            ClassToInstanceMap<BindingAwareService> serviceProvider) {
+        ProviderContext context = createProviderContext(provider, serviceProvider);
+        provider.onSessionInitiated(context);
+        return context;
+    }
+
+    public static <T extends BindingAwareService> T createContextProxyOrReturnService(Class<T> service, T instance) {
+        // FIXME: Create Proxy
+        return instance;
+    }
+    
+    private static class SingleConsumerContextImpl implements ConsumerContext, AutoCloseable {
+        
+        private ClassToInstanceMap<BindingAwareService> alreadyRetrievedServices;
+        private ClassToInstanceMap<BindingAwareService> serviceProvider;
+
+        public SingleConsumerContextImpl(ClassToInstanceMap<BindingAwareService> serviceProvider) {
+            this.alreadyRetrievedServices = MutableClassToInstanceMap.create();
+            this.serviceProvider = serviceProvider;
+        }
+
+        @Override
+        public final <T extends RpcService> T getRpcService(Class<T> module) {
+            return getSALService(RpcConsumerRegistry.class).getRpcService(module);
+        }
+        
+        @Override
+        public final <T extends BindingAwareService> T getSALService(Class<T> service) {
+            checkNotNull(service,"Service class should not be null.");
+            T potential = alreadyRetrievedServices.getInstance(service);
+            if(potential != null) {
+                return potential;
+            }
+            return tryToRetrieveSalService(service);
+        }
+        
+        private synchronized <T extends BindingAwareService> T tryToRetrieveSalService(Class<T> service) {
+            final T potential = alreadyRetrievedServices.getInstance(service);
+            if(potential != null) {
+                return potential;
+            }
+            final T requested = serviceProvider.getInstance(service);
+            if(requested == null) {
+                throw new IllegalArgumentException("Requested service "+service.getName() +" is not available.");
+            }
+            final T retrieved = BindingContextUtils.createContextProxyOrReturnService(service,requested);
+            alreadyRetrievedServices.put(service, retrieved);
+            return retrieved;
+        }
+        
+        @Override
+        public final void close() throws Exception {
+            alreadyRetrievedServices = null;
+            serviceProvider = null;
+        }
+    }
+    
+    private static class SingleProviderContextImpl extends SingleConsumerContextImpl implements ProviderContext {
+
+        public SingleProviderContextImpl(ClassToInstanceMap<BindingAwareService> serviceProvider) {
+            super(serviceProvider);
+        }
+        
+        @Override
+        public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
+                L listener) {
+            return getSALService(RpcProviderRegistry.class).registerRouteChangeListener(listener);
+        }
+        
+        @Override
+        public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> type,
+                T implementation) throws IllegalStateException {
+            return getSALService(RpcProviderRegistry.class).addRoutedRpcImplementation(type, implementation);
+        }
+        
+        @Override
+        public <T extends RpcService> RpcRegistration<T> addRpcImplementation(Class<T> type, T implementation)
+                throws IllegalStateException {
+            return getSALService(RpcProviderRegistry.class).addRpcImplementation(type, implementation);
+        }
+        
+        @Deprecated
+        @Override
+        public void registerFunctionality(ProviderFunctionality functionality) {
+            // NOOP
+        }
+        
+        @Deprecated
+        @Override
+        public void unregisterFunctionality(ProviderFunctionality functionality) {
+            // NOOP
+        }
+    }
+}
index fd81af353ceb0d137bf9fbd527a349b6430fd20c..17de595a8b79752400ee5ba36c442d3412f8f5d6 100644 (file)
@@ -6,32 +6,26 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 public final class TypeSafeDataReader {
 
-    
-    private final DataReader<InstanceIdentifier<? extends DataObject>,DataObject> delegate;
-    
-    
-    
+    private final DataReader<InstanceIdentifier<? extends DataObject>, DataObject> delegate;
+
     public DataReader<InstanceIdentifier<?>, DataObject> getDelegate() {
         return delegate;
     }
 
-
     public TypeSafeDataReader(DataReader<InstanceIdentifier<? extends DataObject>, DataObject> delegate) {
         this.delegate = delegate;
     }
 
-
     @SuppressWarnings("unchecked")
     public <D extends DataObject> D readConfigurationData(InstanceIdentifier<D> path) {
         return (D) delegate.readConfigurationData(path);
     }
-    
-    
+
     @SuppressWarnings("unchecked")
-    public <D extends DataObject> D  readOperationalData(InstanceIdentifier<D> path) {
+    public <D extends DataObject> D readOperationalData(InstanceIdentifier<D> path) {
         return (D) delegate.readOperationalData(path);
     }
-    
+
     public static TypeSafeDataReader forReader(DataReader<InstanceIdentifier<? extends DataObject>, DataObject> delegate) {
         return new TypeSafeDataReader(delegate);
     }
index ff15e72ba6fc3d1106a46bfadd08dfcd2e67bd60..adbe3d2a4997e183d6ce73d2420fe67b50db8dab 100644 (file)
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-common-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    
   </dependencies>
 
   <packaging>bundle</packaging>
index 2d10fba8a5fd77c18b872991669d576f9aae7a7e..902665d1a6fa137d41d7f1bc89cf8116fbb52ee1 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.common.util;
 
 public class Arguments {
@@ -1,15 +1,14 @@
-package org.opendaylight.controller.sal.binding.impl.connect.dom;
+package org.opendaylight.controller.sal.common.util;
 
 import java.util.Collections;
 
 import org.opendaylight.controller.md.sal.common.api.data.DataModification;
 import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction;
-import org.opendaylight.controller.sal.common.util.Rpcs;
 import org.opendaylight.yangtools.concepts.Path;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
-public class CommitHandlersTransactions {
+public class CommitHandlerTransactions {
 
     private static class AllwaysSuccessfulTransaction<P extends Path<P>,D> implements DataCommitTransaction<P, D> {
         
@@ -33,7 +32,6 @@ public class CommitHandlersTransactions {
         }
     }
     
-    
     public static final <P extends Path<P>,D> AllwaysSuccessfulTransaction<P, D> allwaysSuccessfulTransaction(DataModification<P, D> modification)  {
         return new AllwaysSuccessfulTransaction<>(modification);
     }
index d9cf5cc477aa2a81cd33796dd6b5f90b488fb1b9..42b00ba03d113dbcf0eb67958f068d5370491792 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.common.util;
 
 import java.util.concurrent.ExecutionException;
index c326bab7a4677bf5db471f940ad2a35768b11dc0..951d5b142e76561485c5cd7f52e12fb84a462cce 100644 (file)
@@ -4,7 +4,7 @@ import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
 
-public interface RpcProvisionRegistry {
+public interface RpcProvisionRegistry extends BrokerService {
 
     /**
      * Registers an implementation of the rpc.
index 910c7cb62365d01ca43e6d30dec43966f1a8f233..18c854646cca6aa08596a84ddaeba77959129219 100644 (file)
@@ -6,7 +6,6 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-
 package org.opendaylight.controller.sal.core.api.mount;
 
 import java.util.concurrent.Future;
@@ -18,9 +17,11 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
-public interface MountInstance extends NotificationService, DataBrokerService {
+public interface MountInstance extends //
+        NotificationService, //
+        DataBrokerService {
 
     Future<RpcResult<CompositeNode>> rpc(QName type, CompositeNode input);
-    
+
     SchemaContext getSchemaContext();
 }
index fade7d341b2bf7d69ee0ad41ad0d4f4e64042acf..c1f873c3af4694395d8cd8a141c06814ecc11bbf 100644 (file)
@@ -1,5 +1,8 @@
 package org.opendaylight.controller.sal.core.api.mount;
 
+import java.util.EventListener;
+
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 
 public interface MountProvisionService extends MountService {
@@ -10,4 +13,14 @@ public interface MountProvisionService extends MountService {
     MountProvisionInstance createMountPoint(InstanceIdentifier path);
     
     MountProvisionInstance createOrGetMountPoint(InstanceIdentifier path);
+    
+    ListenerRegistration<MountProvisionListener> registerProvisionListener(MountProvisionListener listener);
+    
+    public  interface MountProvisionListener extends EventListener {
+        
+        void onMountPointCreated(InstanceIdentifier path);
+        
+        void onMountPointRemoved(InstanceIdentifier path);
+        
+    }
 }
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/$ModuleInfo.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/$ModuleInfo.java
new file mode 100644 (file)
index 0000000..3cc5a61
--- /dev/null
@@ -0,0 +1,6 @@
+package org.opendaylight.controller.sal.dom.broker;
+
+public class $ModuleInfo {
+
+    
+}
index 56eae97848b71c9556c0eb3108c6d7f92e38b200..8f62be97d801f7a557026a1aacd054bdaf5f6936 100644 (file)
@@ -13,6 +13,8 @@ import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 
+import com.google.common.util.concurrent.MoreExecutors;
+
 public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier, CompositeNode, DataChangeListener> implements
         DataProviderService, AutoCloseable {
 
@@ -21,6 +23,7 @@ public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier, Compo
     
     public DataBrokerImpl() {
         setDataReadRouter(new DataReaderRouter());
+        setExecutor(MoreExecutors.sameThreadExecutor());
     }
     
     public AtomicLong getCreatedTransactionsCount() {
index ab5b145064c828cfa083f74a21beff4e66e9074a..b4fccff3b0fe745ae71088942ed05e92429f5e0e 100644 (file)
@@ -36,7 +36,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 public class MountPointImpl implements MountProvisionInstance {
 
     private final RpcRouter rpcs;
-    private final DataReaderRouter dataReader;
+    private final DataBrokerImpl dataReader;
     private final NotificationRouter notificationRouter;
     private final DataReader<InstanceIdentifier,CompositeNode> readWrapper;
     
@@ -48,7 +48,7 @@ public class MountPointImpl implements MountProvisionInstance {
     public MountPointImpl(InstanceIdentifier path) {
         this.mountPath = path;
         rpcs = new RpcRouterImpl("");
-        dataReader = new DataReaderRouter();
+        dataReader = new DataBrokerImpl();
         notificationRouter = new NotificationRouterImpl();
         readWrapper = new ReadWrapper();
     }
@@ -124,15 +124,13 @@ public class MountPointImpl implements MountProvisionInstance {
 
     @Override
     public DataModificationTransaction beginTransaction() {
-        // TODO Auto-generated method stub
-        return null;
+        return dataReader.beginTransaction();
     }
 
     @Override
     public ListenerRegistration<DataChangeListener> registerDataChangeListener(InstanceIdentifier path,
             DataChangeListener listener) {
-        // TODO Auto-generated method stub
-        return null;
+        return dataReader.registerDataChangeListener(path, listener);
     }
 
     @Override
@@ -143,8 +141,7 @@ public class MountPointImpl implements MountProvisionInstance {
     @Override
     public Registration<DataCommitHandler<InstanceIdentifier, CompositeNode>> registerCommitHandler(
             InstanceIdentifier path, DataCommitHandler<InstanceIdentifier, CompositeNode> commitHandler) {
-        // TODO Auto-generated method stub
-        return null;
+        return dataReader.registerCommitHandler(path, commitHandler);
     }
     
     @Override
@@ -208,7 +205,6 @@ public class MountPointImpl implements MountProvisionInstance {
     @Override
     public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier, CompositeNode>>> registerCommitHandlerListener(
             RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier, CompositeNode>> commitHandlerListener) {
-        // TODO Auto-generated method stub
-        return null;
+        return dataReader.registerCommitHandlerListener(commitHandlerListener);
     }
 }
index 19634d79c2203fafe5aaa0156c41bf45a62f905f..5d441bddbd0f23e263c452695da13afe9ecacc3e 100644 (file)
@@ -7,12 +7,16 @@ import java.util.concurrent.ConcurrentMap
 import java.util.concurrent.ConcurrentHashMap
 import static com.google.common.base.Preconditions.*;
 import org.opendaylight.controller.sal.core.api.data.DataProviderService
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionService.MountProvisionListener
+import org.opendaylight.yangtools.concepts.util.ListenerRegistry
 
 class MountPointManagerImpl implements MountProvisionService {
     
     @Property
     DataProviderService dataBroker;
     
+    val ListenerRegistry<MountProvisionListener> listeners = ListenerRegistry.create()
+    
     ConcurrentMap<InstanceIdentifier,MountPointImpl> mounts = new ConcurrentHashMap();
     
     override createMountPoint(InstanceIdentifier path) {
@@ -20,15 +24,26 @@ class MountPointManagerImpl implements MountProvisionService {
         val mount = new MountPointImpl(path);
         registerMountPoint(mount);
         mounts.put(path,mount);
+        notifyMountCreated(path);
         return mount;
     }
     
+    def notifyMountCreated(InstanceIdentifier identifier) {
+        for(listener : listeners) {
+            listener.instance.onMountPointCreated(identifier);
+        }
+    }
+    
     def registerMountPoint(MountPointImpl impl) {
         dataBroker?.registerConfigurationReader(impl.mountPath,impl.readWrapper);
         dataBroker?.registerOperationalReader(impl.mountPath,impl.readWrapper);
         
     }
     
+    override registerProvisionListener(MountProvisionListener listener) {
+        listeners.register(listener)
+    }
+    
     
     override createOrGetMountPoint(InstanceIdentifier path) {
         val mount = mounts.get(path);
index 0d18cb323a8dace4eda4ab023de87fa433d638ed..0021dd8f0f3a707a282ccd1831dc332e1dfadd73 100644 (file)
@@ -3,6 +3,7 @@ package org.opendaylight.controller.sal.dom.broker.osgi;
 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.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 import org.osgi.framework.ServiceReference;
 
@@ -24,4 +25,9 @@ public class MountProviderServiceProxy extends AbstractBrokerServiceProxy<MountP
     public MountProvisionInstance createOrGetMountPoint(InstanceIdentifier path) {
         return getDelegate().createOrGetMountPoint(path);
     }
+    
+    @Override
+    public ListenerRegistration<MountProvisionListener> registerProvisionListener(MountProvisionListener listener) {
+        return getDelegate().registerProvisionListener(listener);
+    }
 }
index f5d592c00715772a87483d09e0ab96d0c4f99697..2403027e01bcd97c626ad129e09a2d954f2e7a51 100644 (file)
@@ -118,7 +118,8 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co
     private synchronized AbstractCachingSchemaSourceProvider<String, InputStream> getGlobalNetconfSchemaProvider(BundleContext bundleContext) {
         if(GLOBAL_NETCONF_SOURCE_PROVIDER == null) {
             String storageFile = "cache/schema";
-            File directory = bundleContext.getDataFile(storageFile);
+//            File directory = bundleContext.getDataFile(storageFile);
+            File directory = new File("cache/schema");
             SchemaSourceProvider<String> defaultProvider = SchemaSourceProviders.noopProvider();
             GLOBAL_NETCONF_SOURCE_PROVIDER = FilesystemSchemaCachingProvider.createFromStringSourceProvider(defaultProvider, directory);
         }
index bfe352ad41322cf78404426a5582afc22a4e074d..21500e1da6441540344daf741dd6becec70ed5a6 100644 (file)
@@ -1,61 +1,55 @@
 package org.opendaylight.controller.sal.connect.netconf
 
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
-import org.opendaylight.controller.md.sal.common.api.data.DataReader
-import org.opendaylight.yangtools.yang.data.api.CompositeNode
-import org.opendaylight.controller.netconf.client.NetconfClient
-import org.opendaylight.controller.sal.core.api.RpcImplementation
-import static extension org.opendaylight.controller.sal.connect.netconf.NetconfMapping.*
+import com.google.common.base.Optional
+import com.google.common.collect.FluentIterable
+import io.netty.util.concurrent.EventExecutor
+import java.io.InputStream
 import java.net.InetSocketAddress
-import org.opendaylight.yangtools.yang.data.api.Node
-import org.opendaylight.yangtools.yang.data.api.SimpleNode
-import org.opendaylight.yangtools.yang.common.QName
+import java.net.URI
 import java.util.Collections
+import java.util.List
+import java.util.Set
+import java.util.concurrent.ExecutorService
+import java.util.concurrent.Future
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.controller.md.sal.common.api.data.DataReader
+import org.opendaylight.controller.netconf.api.NetconfMessage
+import org.opendaylight.controller.netconf.client.NetconfClient
 import org.opendaylight.controller.netconf.client.NetconfClientDispatcher
-import org.opendaylight.yangtools.concepts.Registration
-import org.opendaylight.controller.sal.core.api.Provider
 import org.opendaylight.controller.sal.core.api.Broker.ProviderSession
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionService
-import static org.opendaylight.controller.sal.connect.netconf.InventoryUtils.*;
+import org.opendaylight.controller.sal.core.api.Provider
+import org.opendaylight.controller.sal.core.api.RpcImplementation
 import org.opendaylight.controller.sal.core.api.data.DataBrokerService
 import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction
-import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl
-import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionService
 import org.opendaylight.protocol.framework.ReconnectStrategy
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
-import org.opendaylight.controller.md.sal.common.api.data.DataModification
-import com.google.common.collect.FluentIterable
-import org.opendaylight.yangtools.yang.model.api.SchemaContext
-import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfState
+import org.opendaylight.yangtools.concepts.Registration
+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.opendaylight.yangtools.yang.data.api.Node
+import org.opendaylight.yangtools.yang.data.api.SimpleNode
+import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl
+import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode
+import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl
+import org.opendaylight.yangtools.yang.model.api.SchemaContext
+import org.opendaylight.yangtools.yang.model.util.repo.AbstractCachingSchemaSourceProvider
+import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProvider
+import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProviders
+import org.opendaylight.yangtools.yang.model.util.repo.SourceIdentifier
 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl
-import java.io.InputStream
-import org.slf4j.LoggerFactory
+import org.opendaylight.yangtools.yang.parser.impl.util.YangSourceContext
 import org.slf4j.Logger
-import org.opendaylight.controller.netconf.client.AbstractNetconfClientNotifySessionListener
-import org.opendaylight.controller.netconf.client.NetconfClientSession
-import org.opendaylight.controller.netconf.api.NetconfMessage
-import io.netty.util.concurrent.EventExecutor
+import org.slf4j.LoggerFactory
 
-import java.util.Map
-import java.util.Set
-import com.google.common.collect.ImmutableMap
+import static com.google.common.base.Preconditions.*
+import static org.opendaylight.controller.sal.connect.netconf.InventoryUtils.*
 
-import org.opendaylight.yangtools.yang.model.util.repo.AbstractCachingSchemaSourceProvider
-import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProvider
-import com.google.common.base.Optional
-import com.google.common.collect.ImmutableList
-import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProviders
-import static com.google.common.base.Preconditions.*;
-import java.util.concurrent.ExecutorService
-import java.util.concurrent.Future
-import org.opendaylight.controller.netconf.client.NetconfClientSessionListener
-import io.netty.util.concurrent.Promise
-import org.opendaylight.controller.netconf.util.xml.XmlElement
-import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants
-import java.util.concurrent.ExecutionException
-import java.util.concurrent.locks.ReentrantLock
+import static extension org.opendaylight.controller.sal.connect.netconf.NetconfMapping.*
+import org.opendaylight.controller.netconf.util.xml.XmlUtil
 
 class NetconfDevice implements Provider, // 
 DataReader<InstanceIdentifier, CompositeNode>, //
@@ -86,7 +80,8 @@ AutoCloseable {
     @Property
     var AbstractCachingSchemaSourceProvider<String, InputStream> schemaSourceProvider;
 
-    private NetconfDeviceSchemaContextProvider schemaContextProvider
+    @Property
+    private NetconfDeviceSchemaContextProvider deviceContextProvider
 
     protected val Logger logger
 
@@ -105,9 +100,12 @@ AutoCloseable {
 
     @Property
     var NetconfClientDispatcher dispatcher
-    
+
     static val InstanceIdentifier ROOT_PATH = InstanceIdentifier.builder().toInstance();
 
+    @Property
+    var SchemaSourceProvider<InputStream> remoteSourceProvider
+
     public new(String name) {
         this.name = name;
         this.logger = LoggerFactory.getLogger(NetconfDevice.name + "#" + name);
@@ -120,11 +118,12 @@ AutoCloseable {
         checkState(schemaSourceProvider != null, "Schema Source Provider must be set.")
         checkState(eventExecutor != null, "Event executor must be set.");
 
-        val listener = new NetconfDeviceListener(this,eventExecutor);
+        val listener = new NetconfDeviceListener(this, eventExecutor);
         val task = startClientTask(dispatcher, listener)
-        if(mountInstance != null) {
+        if (mountInstance != null) {
             confReaderReg = mountInstance.registerConfigurationReader(ROOT_PATH, this);
             operReaderReg = mountInstance.registerOperationalReader(ROOT_PATH, this);
+            commitHandlerReg = mountInstance.registerCommitHandler(ROOT_PATH, this)
         }
         return processingExecutor.submit(task) as Future<Void>;
 
@@ -132,27 +131,30 @@ AutoCloseable {
     }
 
     def Optional<SchemaContext> getSchemaContext() {
-        if (schemaContextProvider == null) {
+        if (deviceContextProvider == null) {
             return Optional.absent();
         }
-        return schemaContextProvider.currentContext;
+        return deviceContextProvider.currentContext;
     }
 
     private def Runnable startClientTask(NetconfClientDispatcher dispatcher, NetconfDeviceListener listener) {
+
         return [ |
             logger.info("Starting Netconf Client on: {}", socketAddress);
             client = NetconfClient.clientFor(name, socketAddress, reconnectStrategy, dispatcher, listener);
             logger.debug("Initial capabilities {}", initialCapabilities);
             var SchemaSourceProvider<String> delegate;
-            if (initialCapabilities.contains(NetconfMapping.IETF_NETCONF_MONITORING_MODULE)) {
-                delegate = new NetconfDeviceSchemaSourceProvider(this);
+            if (NetconfRemoteSchemaSourceProvider.isSupportedFor(initialCapabilities)) {
+                delegate = new NetconfRemoteSchemaSourceProvider(this);
+            }  else if(client.capabilities.contains(NetconfRemoteSchemaSourceProvider.IETF_NETCONF_MONITORING.namespace.toString)) {
+                delegate = new NetconfRemoteSchemaSourceProvider(this);
             } else {
-                logger.info("Device does not support IETF Netconf Monitoring.", socketAddress);
+                logger.info("Netconf server {} does not support IETF Netconf Monitoring", socketAddress);
                 delegate = SchemaSourceProviders.<String>noopProvider();
             }
-            val sourceProvider = schemaSourceProvider.createInstanceFor(delegate);
-            schemaContextProvider = new NetconfDeviceSchemaContextProvider(this, sourceProvider);
-            schemaContextProvider.createContextFromCapabilities(initialCapabilities);
+            remoteSourceProvider = schemaSourceProvider.createInstanceFor(delegate);
+            deviceContextProvider = new NetconfDeviceSchemaContextProvider(this, remoteSourceProvider);
+            deviceContextProvider.createContextFromCapabilities(initialCapabilities);
             if (mountInstance != null && schemaContext.isPresent) {
                 mountInstance.schemaContext = schemaContext.get();
             }
@@ -175,18 +177,31 @@ AutoCloseable {
     override getSupportedRpcs() {
         Collections.emptySet;
     }
-    
+
     def createSubscription(String streamName) {
         val it = ImmutableCompositeNode.builder()
         QName = NETCONF_CREATE_SUBSCRIPTION_QNAME
-        addLeaf("stream",streamName);
-        invokeRpc(QName,toInstance())
+        addLeaf("stream", streamName);
+        invokeRpc(QName, toInstance())
     }
 
     override invokeRpc(QName rpc, CompositeNode input) {
-        val message = rpc.toRpcMessage(input);
-        val result = client.sendMessage(message, messegeRetryCount, messageTimeoutCount);
-        return result.toRpcResult();
+        try {
+            val message = rpc.toRpcMessage(input,schemaContext);
+            val result = sendMessageImpl(message, messegeRetryCount, messageTimeoutCount);
+            return result.toRpcResult(rpc, schemaContext);
+
+        } catch (Exception e) {
+            logger.error("Rpc was not processed correctly.", e)
+            throw e;
+        }
+    }
+
+    def NetconfMessage sendMessageImpl(NetconfMessage message, int retryCount, int timeout) {
+        logger.debug("Send message {}",XmlUtil.toString(message.document))
+        val result = client.sendMessage(message, retryCount, timeout);
+        NetconfMapping.checkValidReply(message, result)
+        return result;
     }
 
     override getProviderFunctionality() {
@@ -221,7 +236,7 @@ AutoCloseable {
         return null === transaction.readOperationalData(path);
     }
 
-    def Node<?> findNode(CompositeNode node, InstanceIdentifier identifier) {
+    static def Node<?> findNode(CompositeNode node, InstanceIdentifier identifier) {
 
         var Node<?> current = node;
         for (arg : identifier.path) {
@@ -229,12 +244,17 @@ AutoCloseable {
                 return null;
             } else if (current instanceof CompositeNode) {
                 val currentComposite = (current as CompositeNode);
-
-                current = currentComposite.getFirstCompositeByName(arg.nodeType.withoutRevision());
-                if (current == null) {
-                    current = currentComposite.getFirstSimpleByName(arg.nodeType.withoutRevision());
+                
+                current = currentComposite.getFirstCompositeByName(arg.nodeType);
+                if(current == null) {
+                    current = currentComposite.getFirstCompositeByName(arg.nodeType.withoutRevision());
+                }
+                if(current == null) {
+                    current = currentComposite.getFirstSimpleByName(arg.nodeType);
                 }
                 if (current == null) {
+                    current = currentComposite.getFirstSimpleByName(arg.nodeType.withoutRevision());
+                } if (current == null) {
                     return null;
                 }
             }
@@ -243,7 +263,9 @@ AutoCloseable {
     }
 
     override requestCommit(DataModification<InstanceIdentifier, CompositeNode> modification) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+        val twoPhaseCommit = new NetconfDeviceTwoPhaseCommitTransaction(this, modification);
+        twoPhaseCommit.prepare()
+        return twoPhaseCommit;
     }
 
     def getInitialCapabilities() {
@@ -257,8 +279,18 @@ AutoCloseable {
                 val parts = split("\\?");
                 val namespace = parts.get(0);
                 val queryParams = FluentIterable.from(parts.get(1).split("&"));
-                val revision = queryParams.findFirst[startsWith("revision=")].replaceAll("revision=", "");
-                val moduleName = queryParams.findFirst[startsWith("module=")].replaceAll("module=", "");
+                var revision = queryParams.findFirst[startsWith("revision=")]?.replaceAll("revision=", "");
+                val moduleName = queryParams.findFirst[startsWith("module=")]?.replaceAll("module=", "");
+                if (revision === null) {
+                    logger.warn("Netconf device was not reporting revision correctly, trying to get amp;revision=");
+                    revision = queryParams.findFirst[startsWith("&amp;revision=")]?.replaceAll("revision=", "");
+                    if (revision != null) {
+                        logger.warn("Netconf device returned revision incorectly escaped for {}", it)
+                    }
+                }
+                if (revision == null) {
+                    return QName.create(URI.create(namespace), null, moduleName);
+                }
                 return QName.create(namespace, revision, moduleName);
             ].toSet();
         }
@@ -273,96 +305,6 @@ AutoCloseable {
 
 }
 
-package class NetconfDeviceListener extends NetconfClientSessionListener {
-
-    val NetconfDevice device
-    val EventExecutor eventExecutor
-
-    new(NetconfDevice device,EventExecutor eventExecutor) {
-        this.device = device
-        this.eventExecutor = eventExecutor
-    }
-
-    var Promise<NetconfMessage> messagePromise;
-    val promiseLock = new ReentrantLock;
-    
-    override onMessage(NetconfClientSession session, NetconfMessage message) {
-        if (isNotification(message)) {
-            onNotification(session, message);
-        } else try {
-            promiseLock.lock
-            if (messagePromise != null) {
-                messagePromise.setSuccess(message);
-                messagePromise = null;
-            }
-        } finally {
-            promiseLock.unlock
-        }
-    }
-
-    /**
-     * Method intended to customize notification processing.
-     * 
-     * @param session
-     *            {@see
-     *            NetconfClientSessionListener#onMessage(NetconfClientSession,
-     *            NetconfMessage)}
-     * @param message
-     *            {@see
-     *            NetconfClientSessionListener#onMessage(NetconfClientSession,
-     *            NetconfMessage)}
-     */
-    def void onNotification(NetconfClientSession session, NetconfMessage message) {
-        device.logger.debug("Received NETCONF notification.",message);
-        val domNotification = message?.toCompositeNode?.notificationBody;
-        if(domNotification != null) {
-            device?.mountInstance?.publish(domNotification);
-        }
-    }
-    
-    private static def CompositeNode getNotificationBody(CompositeNode node) {
-        for(child : node.children) {
-            if(child instanceof CompositeNode) {
-                return child as CompositeNode;
-            }
-        }
-    }
-
-    override getLastMessage(int attempts, int attemptMsDelay) throws InterruptedException {
-        val promise = promiseReply();
-        val messageAvailable = promise.await(attempts + attemptMsDelay);
-        if (messageAvailable) {
-            try {
-                return promise.get();
-            } catch (ExecutionException e) {
-                throw new IllegalStateException(e);
-            }
-        }
-
-        throw new IllegalStateException("Unsuccessful after " + attempts + " attempts.");
-
-    // throw new TimeoutException("Message was not received on time.");
-    }
-
-    def Promise<NetconfMessage> promiseReply() {
-        promiseLock.lock
-        try {
-        if (messagePromise == null) {
-            messagePromise = eventExecutor.newPromise();
-            return messagePromise;
-        }
-        return messagePromise;
-        } finally {
-            promiseLock.unlock
-        }
-    }
-
-    def boolean isNotification(NetconfMessage message) {
-        val xmle = XmlElement.fromDomDocument(message.getDocument());
-        return XmlNetconfConstants.NOTIFICATION_ELEMENT_NAME.equals(xmle.getName());
-    }
-}
-
 package class NetconfDeviceSchemaContextProvider {
 
     @Property
@@ -377,25 +319,33 @@ package class NetconfDeviceSchemaContextProvider {
     new(NetconfDevice device, SchemaSourceProvider<InputStream> sourceProvider) {
         _device = device
         _sourceProvider = sourceProvider
+        _currentContext = Optional.absent();
     }
 
     def createContextFromCapabilities(Iterable<QName> capabilities) {
-
-        val modelsToParse = ImmutableMap.<QName, InputStream>builder();
-        for (cap : capabilities) {
-            val source = sourceProvider.getSchemaSource(cap.localName, Optional.fromNullable(cap.formattedRevision));
-            if (source.present) {
-                modelsToParse.put(cap, source.get());
-            }
+        val sourceContext = YangSourceContext.createFrom(capabilities, sourceProvider)
+        if (!sourceContext.missingSources.empty) {
+            device.logger.warn("Sources for following models are missing {}", sourceContext.missingSources);
+        }
+        device.logger.debug("Trying to create schema context from {}", sourceContext.validSources)
+        val modelsToParse = YangSourceContext.getValidInputStreams(sourceContext);
+        if (!sourceContext.validSources.empty) {
+            val schemaContext = tryToCreateContext(modelsToParse);
+            currentContext = Optional.fromNullable(schemaContext);
+        } else {
+            currentContext = Optional.absent();
         }
-        val context = tryToCreateContext(modelsToParse.build);
-        currentContext = Optional.fromNullable(context);
+        if (currentContext.present) {
+            device.logger.debug("Schema context successfully created.");
+        }
+
     }
 
-    def SchemaContext tryToCreateContext(Map<QName, InputStream> modelsToParse) {
+    def SchemaContext tryToCreateContext(List<InputStream> modelsToParse) {
         val parser = new YangParserImpl();
         try {
-            val models = parser.parseYangModelsFromStreams(ImmutableList.copyOf(modelsToParse.values));
+
+            val models = parser.parseYangModelsFromStreams(modelsToParse);
             val result = parser.resolveSchemaContext(models);
             return result;
         } catch (Exception e) {
@@ -404,33 +354,3 @@ package class NetconfDeviceSchemaContextProvider {
         }
     }
 }
-
-package class NetconfDeviceSchemaSourceProvider implements SchemaSourceProvider<String> {
-
-    val NetconfDevice device;
-
-    new(NetconfDevice device) {
-        this.device = device;
-    }
-
-    override getSchemaSource(String moduleName, Optional<String> revision) {
-        val it = ImmutableCompositeNode.builder() //
-        setQName(QName::create(NetconfState.QNAME, "get-schema")) //
-        addLeaf("format", "yang")
-        addLeaf("identifier", moduleName)
-        if (revision.present) {
-            addLeaf("version", revision.get())
-        }
-
-        device.logger.info("Loading YANG schema source for {}:{}", moduleName, revision)
-        val schemaReply = device.invokeRpc(getQName(), toInstance());
-
-        if (schemaReply.successful) {
-            val schemaBody = schemaReply.result.getFirstSimpleByName(
-                QName::create(NetconfState.QNAME.namespace, null, "data"))?.value;
-            device.logger.info("YANG Schema successfully received for: {}:{}", moduleName, revision);
-            return Optional.of(schemaBody as String);
-        }
-        return Optional.absent();
-    }
-}
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceListener.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceListener.java
new file mode 100644 (file)
index 0000000..8623d90
--- /dev/null
@@ -0,0 +1,155 @@
+package org.opendaylight.controller.sal.connect.netconf;
+
+import com.google.common.base.Objects;
+
+import io.netty.util.concurrent.EventExecutor;
+import io.netty.util.concurrent.Promise;
+
+import java.util.List;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.eclipse.xtext.xbase.lib.Exceptions;
+import org.eclipse.xtext.xbase.lib.Functions.Function0;
+import org.opendaylight.controller.netconf.api.NetconfMessage;
+import org.opendaylight.controller.netconf.client.NetconfClientSession;
+import org.opendaylight.controller.netconf.client.NetconfClientSessionListener;
+import org.opendaylight.controller.netconf.util.xml.XmlElement;
+import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
+import org.opendaylight.controller.sal.connect.netconf.NetconfDevice;
+import org.opendaylight.controller.sal.connect.netconf.NetconfMapping;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.w3c.dom.Document;
+
+@SuppressWarnings("all")
+class NetconfDeviceListener extends NetconfClientSessionListener {
+    private final NetconfDevice device;
+    private final EventExecutor eventExecutor;
+
+    public NetconfDeviceListener(final NetconfDevice device, final EventExecutor eventExecutor) {
+        this.device = device;
+        this.eventExecutor = eventExecutor;
+    }
+
+    private Promise<NetconfMessage> messagePromise;
+    private ConcurrentMap<String, Promise<NetconfMessage>> promisedMessages;
+
+    private final ReentrantLock promiseLock = new ReentrantLock();
+
+    public void onMessage(final NetconfClientSession session, final NetconfMessage message) {
+        if (isNotification(message)) {
+            this.onNotification(session, message);
+        } else {
+            try {
+                this.promiseLock.lock();
+                boolean _notEquals = (!Objects.equal(this.messagePromise, null));
+                if (_notEquals) {
+                    this.device.logger.debug("Setting promised reply {} with message {}", this.messagePromise, message);
+                    this.messagePromise.setSuccess(message);
+                    this.messagePromise = null;
+                }
+            } finally {
+                this.promiseLock.unlock();
+            }
+        }
+    }
+
+    /**
+     * Method intended to customize notification processing.
+     * 
+     * @param session
+     *            {@see
+     *            NetconfClientSessionListener#onMessage(NetconfClientSession,
+     *            NetconfMessage)}
+     * @param message
+     *            {@see
+     *            NetconfClientSessionListener#onMessage(NetconfClientSession,
+     *            NetconfMessage)}
+     */
+    public void onNotification(final NetconfClientSession session, final NetconfMessage message) {
+        this.device.logger.debug("Received NETCONF notification.", message);
+        CompositeNode _notificationBody = null;
+        CompositeNode _compositeNode = null;
+        if (message != null) {
+            _compositeNode = NetconfMapping.toCompositeNode(message,device.getSchemaContext());
+        }
+        if (_compositeNode != null) {
+            _notificationBody = NetconfDeviceListener.getNotificationBody(_compositeNode);
+        }
+        final CompositeNode domNotification = _notificationBody;
+        boolean _notEquals = (!Objects.equal(domNotification, null));
+        if (_notEquals) {
+            MountProvisionInstance _mountInstance = null;
+            if (this.device != null) {
+                _mountInstance = this.device.getMountInstance();
+            }
+            if (_mountInstance != null) {
+                _mountInstance.publish(domNotification);
+            }
+        }
+    }
+
+    private static CompositeNode getNotificationBody(final CompositeNode node) {
+        List<Node<? extends Object>> _children = node.getChildren();
+        for (final Node<? extends Object> child : _children) {
+            if ((child instanceof CompositeNode)) {
+                return ((CompositeNode) child);
+            }
+        }
+        return null;
+    }
+
+    public NetconfMessage getLastMessage(final int attempts, final int attemptMsDelay) throws InterruptedException {
+        final Promise<NetconfMessage> promise = this.promiseReply();
+        this.device.logger.debug("Waiting for reply {}", promise);
+        int _plus = (attempts * attemptMsDelay);
+        final boolean messageAvailable = promise.await(_plus);
+        if (messageAvailable) {
+            try {
+                try {
+                    return promise.get();
+                } catch (Throwable _e) {
+                    throw Exceptions.sneakyThrow(_e);
+                }
+            } catch (final Throwable _t) {
+                if (_t instanceof ExecutionException) {
+                    final ExecutionException e = (ExecutionException) _t;
+                    IllegalStateException _illegalStateException = new IllegalStateException(e);
+                    throw _illegalStateException;
+                } else {
+                    throw Exceptions.sneakyThrow(_t);
+                }
+            }
+        }
+        String _plus_1 = ("Unsuccessful after " + Integer.valueOf(attempts));
+        String _plus_2 = (_plus_1 + " attempts.");
+        IllegalStateException _illegalStateException_1 = new IllegalStateException(_plus_2);
+        throw _illegalStateException_1;
+    }
+
+    public synchronized Promise<NetconfMessage> promiseReply() {
+        this.device.logger.debug("Promising reply.");
+        this.promiseLock.lock();
+        try {
+            boolean _equals = Objects.equal(this.messagePromise, null);
+            if (_equals) {
+                Promise<NetconfMessage> _newPromise = this.eventExecutor.<NetconfMessage> newPromise();
+                this.messagePromise = _newPromise;
+                return this.messagePromise;
+            }
+            return this.messagePromise;
+        } finally {
+            this.promiseLock.unlock();
+        }
+    }
+
+    public boolean isNotification(final NetconfMessage message) {
+        Document _document = message.getDocument();
+        final XmlElement xmle = XmlElement.fromDomDocument(_document);
+        String _name = xmle.getName();
+        return XmlNetconfConstants.NOTIFICATION_ELEMENT_NAME.equals(_name);
+    }
+}
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceTwoPhaseCommitTransaction.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceTwoPhaseCommitTransaction.java
new file mode 100644 (file)
index 0000000..6df34cd
--- /dev/null
@@ -0,0 +1,143 @@
+package org.opendaylight.controller.sal.connect.netconf;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.eclipse.xtext.xbase.lib.IterableExtensions;
+import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction;
+import org.opendaylight.yangtools.yang.common.QName;
+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.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
+import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.*;
+
+public class NetconfDeviceTwoPhaseCommitTransaction implements DataCommitTransaction<InstanceIdentifier, CompositeNode> {
+
+    private NetconfDevice device;
+    private final DataModification<InstanceIdentifier, CompositeNode> modification;
+    private boolean candidateSupported = true;
+
+    public NetconfDeviceTwoPhaseCommitTransaction(NetconfDevice device,
+            DataModification<InstanceIdentifier, CompositeNode> modification) {
+        super();
+        this.device = device;
+        this.modification = modification;
+    }
+
+    public void prepare() {
+        for (InstanceIdentifier toRemove : modification.getRemovedConfigurationData()) {
+            sendRemove(toRemove);
+        }
+        for(Entry<InstanceIdentifier, CompositeNode> toUpdate : modification.getUpdatedConfigurationData().entrySet()) {
+            sendMerge(toUpdate.getKey(),toUpdate.getValue());
+        }
+
+    }
+
+    private void sendMerge(InstanceIdentifier key, CompositeNode value) {
+        sendEditRpc(createEditStructure(key, Optional.<String>absent(), Optional.of(value)));
+    }
+
+    private void sendRemove(InstanceIdentifier toRemove) {
+        sendEditRpc(createEditStructure(toRemove, Optional.of("remove"), Optional.<CompositeNode> absent()));
+    }
+
+    private void sendEditRpc(CompositeNode editStructure) {
+        CompositeNodeBuilder<ImmutableCompositeNode> builder = configurationRpcBuilder();
+        builder.setQName(NETCONF_EDIT_CONFIG_QNAME);
+        builder.add(editStructure);
+        
+        RpcResult<CompositeNode> rpcResult = device.invokeRpc(NETCONF_EDIT_CONFIG_QNAME, builder.toInstance());
+        Preconditions.checkState(rpcResult.isSuccessful(),"Rpc Result was unsuccessful");
+        
+    }
+
+    private CompositeNodeBuilder<ImmutableCompositeNode> configurationRpcBuilder() {
+        CompositeNodeBuilder<ImmutableCompositeNode> ret = ImmutableCompositeNode.builder();
+        
+        Node<?> targetNode;
+        if(candidateSupported) {
+            targetNode = ImmutableCompositeNode.create(NETCONF_CANDIDATE_QNAME, ImmutableList.<Node<?>>of());
+        } else {
+            targetNode = ImmutableCompositeNode.create(NETCONF_RUNNING_QNAME, ImmutableList.<Node<?>>of());
+        }
+        Node<?> targetWrapperNode = ImmutableCompositeNode.create(NETCONF_TARGET_QNAME, ImmutableList.<Node<?>>of(targetNode));
+        ret.add(targetWrapperNode);
+        return ret;
+    }
+
+    private CompositeNode createEditStructure(InstanceIdentifier dataPath, Optional<String> action,
+            Optional<CompositeNode> lastChildOverride) {
+        List<PathArgument> path = dataPath.getPath();
+        List<PathArgument> reversed = Lists.reverse(path);
+        CompositeNode previous = null;
+        boolean isLast = true;
+        for (PathArgument arg : reversed) {
+            CompositeNodeBuilder<ImmutableCompositeNode> builder = ImmutableCompositeNode.builder();
+            builder.setQName(arg.getNodeType());
+            Map<QName, Object> predicates = Collections.emptyMap();
+            if (arg instanceof NodeIdentifierWithPredicates) {
+                predicates = ((NodeIdentifierWithPredicates) arg).getKeyValues();
+            }
+            for (Entry<QName, Object> entry : predicates.entrySet()) {
+                builder.addLeaf(entry.getKey(), entry.getValue());
+            }
+            
+            if (isLast) {
+                if (action.isPresent()) {
+                    builder.setAttribute(NETCONF_ACTION_QNAME, action.get());
+                }
+                if (lastChildOverride.isPresent()) {
+                    List<Node<?>> children = lastChildOverride.get().getChildren();
+                    for(Node<?> child : children) {
+                        if(!predicates.containsKey(child.getKey())) {
+                            builder.add(child);
+                        }
+                    }
+                    
+                }
+            } else {
+                builder.add(previous);
+            }
+            previous = builder.toInstance();
+            isLast = false;
+        }
+        return ImmutableCompositeNode.create(NETCONF_CONFIG_QNAME, ImmutableList.<Node<?>>of(previous));
+    }
+
+    @Override
+    public RpcResult<Void> finish() throws IllegalStateException {
+        CompositeNodeBuilder<ImmutableCompositeNode> commitInput = ImmutableCompositeNode.builder();
+        commitInput.setQName(NETCONF_COMMIT_QNAME);
+        RpcResult<?> rpcResult = device.invokeRpc(NetconfMapping.NETCONF_COMMIT_QNAME, commitInput.toInstance());
+        return (RpcResult<Void>) rpcResult;
+    }
+
+    @Override
+    public DataModification<InstanceIdentifier, CompositeNode> getModification() {
+        return this.modification;
+    }
+
+    @Override
+    public RpcResult<Void> rollback() throws IllegalStateException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}
index 794b58294eeb13d54ad8385e4f75dac3e3f5c695..c151e42fbb803e26565e53eb965a6903ebfa98da 100644 (file)
@@ -22,6 +22,10 @@ import java.util.List
 import com.google.common.collect.ImmutableList
 import org.opendaylight.yangtools.yang.data.api.SimpleNode
 import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode
+import com.google.common.base.Preconditions
+import com.google.common.base.Optional
+import org.opendaylight.yangtools.yang.model.api.SchemaContext
+import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils
 
 class NetconfMapping {
 
@@ -36,8 +40,19 @@ class NetconfMapping {
     public static val NETCONF_FILTER_QNAME = QName.create(NETCONF_QNAME, "filter");
     public static val NETCONF_TYPE_QNAME = QName.create(NETCONF_QNAME, "type");
     public static val NETCONF_GET_CONFIG_QNAME = QName.create(NETCONF_QNAME, "get-config");
+    public static val NETCONF_EDIT_CONFIG_QNAME = QName.create(NETCONF_QNAME, "edit-config");
+    public static val NETCONF_DELETE_CONFIG_QNAME = QName.create(NETCONF_QNAME, "delete-config");
+    public static val NETCONF_ACTION_QNAME = QName.create(NETCONF_QNAME, "action");
+    public static val NETCONF_COMMIT_QNAME = QName.create(NETCONF_QNAME, "commit");
+    
+    public static val NETCONF_CONFIG_QNAME = QName.create(NETCONF_QNAME, "config");
     public static val NETCONF_SOURCE_QNAME = QName.create(NETCONF_QNAME, "source");
+    public static val NETCONF_TARGET_QNAME = QName.create(NETCONF_QNAME, "target");
+    
+    public static val NETCONF_CANDIDATE_QNAME = QName.create(NETCONF_QNAME, "candidate");
     public static val NETCONF_RUNNING_QNAME = QName.create(NETCONF_QNAME, "running");
+    
+    
     public static val NETCONF_RPC_REPLY_QNAME = QName.create(NETCONF_QNAME, "rpc-reply");
     public static val NETCONF_OK_QNAME = QName.create(NETCONF_QNAME, "ok");
     public static val NETCONF_DATA_QNAME = QName.create(NETCONF_QNAME, "data");
@@ -80,11 +95,11 @@ class NetconfMapping {
         }
     }
 
-    static def CompositeNode toCompositeNode(NetconfMessage message) {
-        return message.toRpcResult().result;
+    static def CompositeNode toCompositeNode(NetconfMessage message,Optional<SchemaContext> ctx) {
+        return null//message.toRpcResult().result;
     }
 
-    static def NetconfMessage toRpcMessage(QName rpc, CompositeNode node) {
+    static def NetconfMessage toRpcMessage(QName rpc, CompositeNode node,Optional<SchemaContext> ctx) {
         val rpcPayload = wrap(NETCONF_RPC_QNAME, flattenInput(node));
         val w3cPayload = NodeUtils.buildShadowDomTree(rpcPayload);
         w3cPayload.documentElement.setAttribute("message-id", "m-" + messageId.andIncrement);
@@ -106,12 +121,41 @@ class NetconfMapping {
         
     }
 
-    static def RpcResult<CompositeNode> toRpcResult(NetconfMessage message) {
-        val rawRpc = message.document.toCompositeNode() as CompositeNode;
-
+    static def RpcResult<CompositeNode> toRpcResult(NetconfMessage message,QName rpc,Optional<SchemaContext> context) {
+        var CompositeNode rawRpc;
+        if(context.present) {
+            if(isDataRetrievalReply(rpc)) {
+                
+                val xmlData = message.document.dataSubtree
+                val dataNodes = XmlDocumentUtils.toDomNodes(xmlData,Optional.of(context.get.dataDefinitions))
+                
+                val it = ImmutableCompositeNode.builder()
+                setQName(NETCONF_RPC_REPLY_QNAME)
+                add(ImmutableCompositeNode.create(NETCONF_DATA_QNAME,dataNodes));
+                
+                rawRpc = it.toInstance;
+                //sys(xmlData)
+            } else {
+                val rpcSchema = context.get.operations.findFirst[QName == rpc]
+                rawRpc = message.document.toCompositeNode() as CompositeNode;
+            }
+            
+            
+            
+        } else {
+            rawRpc = message.document.toCompositeNode() as CompositeNode;
+        }
         //rawRpc.
         return Rpcs.getRpcResult(true, rawRpc, Collections.emptySet());
     }
+    
+    def static Element getDataSubtree(Document doc) {
+        doc.getElementsByTagNameNS(NETCONF_URI.toString,"data").item(0) as Element
+    }
+    
+    def static boolean isDataRetrievalReply(QName it) {
+        return NETCONF_URI == namespace && ( localName == NETCONF_GET_CONFIG_QNAME.localName || localName == NETCONF_GET_QNAME.localName) 
+    }
 
     static def wrap(QName name, Node<?> node) {
         if (node != null) {
@@ -141,6 +185,14 @@ class NetconfMapping {
     }
 
     public static def Node<?> toCompositeNode(Document document) {
-        return XmlDocumentUtils.toNode(document) as Node<?>
+        return XmlDocumentUtils.toDomNode(document) as Node<?>
     }
+    
+    public static def checkValidReply(NetconfMessage input, NetconfMessage output) {
+        val inputMsgId = input.document.documentElement.getAttribute("message-id")
+        val outputMsgId = output.document.documentElement.getAttribute("message-id")
+        Preconditions.checkState(inputMsgId == outputMsgId,"Rpc request and reply message IDs must be same.");
+        
+    }
+    
 }
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfRemoteSchemaSourceProvider.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfRemoteSchemaSourceProvider.java
new file mode 100644 (file)
index 0000000..12be689
--- /dev/null
@@ -0,0 +1,69 @@
+package org.opendaylight.controller.sal.connect.netconf;
+
+import java.util.Set;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfState;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
+import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
+import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProvider;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+
+class NetconfRemoteSchemaSourceProvider implements SchemaSourceProvider<String> {
+
+    public static final QName IETF_NETCONF_MONITORING = QName.create(
+            "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring", "2010-10-04", "ietf-netconf-monitoring");
+    public static final QName GET_SCHEMA_QNAME = QName.create(IETF_NETCONF_MONITORING, "get-schema");
+    public static final QName GET_DATA_QNAME = QName.create(IETF_NETCONF_MONITORING, "data");
+
+    NetconfDevice device;
+
+    public NetconfRemoteSchemaSourceProvider(NetconfDevice device) {
+        super();
+        this.device = device;
+    }
+
+    @Override
+    public Optional<String> getSchemaSource(String moduleName, Optional<String> revision) {
+        CompositeNodeBuilder<ImmutableCompositeNode> request = ImmutableCompositeNode.builder(); //
+        request.setQName(GET_SCHEMA_QNAME) //
+                .addLeaf("format", "yang") //
+                .addLeaf("identifier", moduleName); //
+        if (revision.isPresent()) {
+            request.addLeaf("version", revision.get());
+        }
+
+        device.logger.info("Loading YANG schema source for {}:{}", moduleName, revision);
+        RpcResult<CompositeNode> schemaReply = device.invokeRpc(GET_SCHEMA_QNAME, request.toInstance());
+        if (schemaReply.isSuccessful()) {
+            String schemaBody = getSchemaFromRpc(schemaReply.getResult());
+            if (schemaBody != null) {
+                device.logger.info("YANG Schema successfully retrieved from remote for {}:{}", moduleName, revision);
+                return Optional.of(schemaBody);
+            }
+        }
+        device.logger.info("YANG shcema was not successfully retrieved.");
+        return Optional.absent();
+    }
+
+    private String getSchemaFromRpc(CompositeNode result) {
+        if (result == null) {
+            return null;
+        }
+        SimpleNode<?> simpleNode = result.getFirstSimpleByName(GET_DATA_QNAME.withoutRevision());
+        Object potential = simpleNode.getValue();
+        if (potential instanceof String) {
+            return (String) potential;
+        }
+        return null;
+    }
+    
+    public static final boolean isSupportedFor(Set<QName> capabilities) {
+        return capabilities.contains(IETF_NETCONF_MONITORING);
+    }
+}
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/XmlDocumentUtils.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/XmlDocumentUtils.java
deleted file mode 100644 (file)
index e151fca..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.opendaylight.controller.sal.connect.netconf;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.Node;
-import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
-import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-import com.google.common.base.Strings;
-
-public class XmlDocumentUtils {
-
-    public static Node<?> toNode(Document doc) {
-        return toCompositeNode(doc.getDocumentElement());
-    }
-
-    private static Node<?> toCompositeNode(Element element) {
-        String orgNamespace = element.getNamespaceURI();
-        URI biNamespace = null;
-        if (orgNamespace != null) {
-            biNamespace = URI.create(orgNamespace);
-        }
-        QName qname = new QName(biNamespace, element.getLocalName());
-
-        List<Node<?>> values = new ArrayList<>();
-        NodeList nodes = element.getChildNodes();
-        boolean isSimpleObject = true;
-        String value = null;
-        for (int i = 0; i < nodes.getLength(); i++) {
-            org.w3c.dom.Node child = nodes.item(i);
-            if (child instanceof Element) {
-                isSimpleObject = false;
-                values.add(toCompositeNode((Element) child));
-            }
-            if (isSimpleObject && child instanceof org.w3c.dom.Text) {
-                value = element.getTextContent();
-                if (!Strings.isNullOrEmpty(value)) {
-                    isSimpleObject = true;
-                }
-            }
-        }
-
-        if (isSimpleObject) {
-            return new SimpleNodeTOImpl<>(qname, null, value);
-        }
-        return new CompositeNodeTOImpl(qname, null, values);
-    }
-}
index 343601865d80bfeaf3ca5899bdb59c08cee25041..c57505829c5bde05dffbfda95ad8d21c3ac1ba26 100644 (file)
@@ -10,6 +10,7 @@ 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.LoggerFactory
+import org.opendaylight.controller.sal.core.api.mount.MountInstance
 
 class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNode> {
 
@@ -44,12 +45,24 @@ class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNode> {
         LOG.info("Read Configuration via Restconf: {}", path)
         return dataService.readConfigurationData(path);
     }
+    
+    def readConfigurationDataBehindMountPoint(MountInstance mountPoint, InstanceIdentifier path) {
+        checkPreconditions
+        LOG.info("Read Configuration via Restconf: {}", path)
+        return mountPoint.readConfigurationData(path);
+    }
 
     override readOperationalData(InstanceIdentifier path) {
         checkPreconditions
         LOG.info("Read Operational via Restconf: {}", path)
         return dataService.readOperationalData(path);
     }
+    
+    def readOperationalDataBehindMountPoint(MountInstance mountPoint, InstanceIdentifier path) {
+        checkPreconditions
+        LOG.info("Read Operational via Restconf: {}", path)
+        return mountPoint.readOperationalData(path);
+    }
 
     def RpcResult<CompositeNode> invokeRpc(QName type, CompositeNode payload) {
         checkPreconditions
@@ -64,6 +77,14 @@ class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNode> {
         transaction.putConfigurationData(path, payload);
         return transaction.commit
     }
+    
+    def commitConfigurationDataPutBehindMountPoint(MountInstance mountPoint, InstanceIdentifier path, CompositeNode payload) {
+        checkPreconditions
+        val transaction = mountPoint.beginTransaction;
+        LOG.info("Put Configuration via Restconf: {}", path)
+        transaction.putConfigurationData(path, payload);
+        return transaction.commit
+    }
 
     def commitConfigurationDataPost(InstanceIdentifier path, CompositeNode payload) {
         checkPreconditions
@@ -76,6 +97,18 @@ class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNode> {
         LOG.info("Post Configuration via Restconf was not executed because data already exists: {}", path)
         return null;
     }
+    
+    def commitConfigurationDataPostBehindMountPoint(MountInstance mountPoint, InstanceIdentifier path, CompositeNode payload) {
+        checkPreconditions
+        val transaction = mountPoint.beginTransaction;
+        transaction.putConfigurationData(path, payload);
+        if (payload == transaction.createdConfigurationData.get(path)) {
+            LOG.info("Post Configuration via Restconf: {}", path)
+            return transaction.commit
+        }
+        LOG.info("Post Configuration via Restconf was not executed because data already exists: {}", path)
+        return null;
+    }
 
     def commitConfigurationDataDelete(InstanceIdentifier path) {
         checkPreconditions
@@ -83,5 +116,12 @@ class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNode> {
         transaction.removeConfigurationData(path)
         return transaction.commit
     }
+    
+    def commitConfigurationDataDeleteBehindMountPoint(MountInstance mountPoint, InstanceIdentifier path) {
+        checkPreconditions
+        val transaction = mountPoint.beginTransaction;
+        transaction.removeConfigurationData(path)
+        return transaction.commit
+    }
 
 }
index 308975c8c599a595d24f928cd6dbe4f4c76b8b9b..61237f01a16933ef742041c787874ec9ee8fc957 100644 (file)
@@ -10,7 +10,6 @@ import java.util.HashMap
 import java.util.List
 import java.util.Map
 import java.util.concurrent.ConcurrentHashMap
-import javax.ws.rs.core.Response
 import org.opendaylight.controller.sal.core.api.model.SchemaServiceListener
 import org.opendaylight.controller.sal.core.api.mount.MountService
 import org.opendaylight.controller.sal.rest.impl.RestUtil
@@ -37,12 +36,16 @@ import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition
 import org.slf4j.LoggerFactory
 
 import static com.google.common.base.Preconditions.*
-import java.util.ArrayList
+import static javax.ws.rs.core.Response.Status.*
+import org.opendaylight.controller.sal.core.api.mount.MountInstance
 
 class ControllerContext implements SchemaServiceListener {
     val static LOG = LoggerFactory.getLogger(ControllerContext)
     val static ControllerContext INSTANCE = new ControllerContext
     val static NULL_VALUE = "null"
+    val static MOUNT_MODULE = "yang-ext"
+    val static MOUNT_NODE = "mount"
+    val static MOUNT = "yang-ext:mount"
 
     @Property
     var SchemaContext globalSchema;
@@ -66,7 +69,7 @@ class ControllerContext implements SchemaServiceListener {
 
     private def void checkPreconditions() {
         if (globalSchema === null) {
-            throw new ResponseException(Response.Status.SERVICE_UNAVAILABLE, RestconfProvider::NOT_INITALIZED_MSG)
+            throw new ResponseException(SERVICE_UNAVAILABLE, RestconfProvider::NOT_INITALIZED_MSG)
         }
     }
 
@@ -76,7 +79,6 @@ class ControllerContext implements SchemaServiceListener {
 
     public def InstanceIdWithSchemaNode toInstanceIdentifier(String restconfInstance) {
         checkPreconditions
-        val ret = InstanceIdentifier.builder();
         val pathArgs = restconfInstance.split("/");
         if (pathArgs.empty) {
             return null;
@@ -84,21 +86,19 @@ class ControllerContext implements SchemaServiceListener {
         if (pathArgs.head.empty) {
             pathArgs.remove(0)
         }
-        val mountPoints = new ArrayList
-        val schemaNode = ret.collectPathArguments(pathArgs, globalSchema.findModule(pathArgs.head), mountPoints);
-        if (schemaNode === null) {
-            return null
+        val startModule = pathArgs.head.toModuleName();
+        if (startModule === null) {
+            throw new ResponseException(BAD_REQUEST, "First node in URI has to be in format \"moduleName:nodeName\"")
         }
-        return new InstanceIdWithSchemaNode(ret.toInstance, schemaNode, mountPoints.last)
+        val iiWithSchemaNode = collectPathArguments(InstanceIdentifier.builder(), pathArgs,
+            globalSchema.getLatestModule(startModule), null);
+        if (iiWithSchemaNode === null) {
+            throw new ResponseException(BAD_REQUEST, "URI has bad format")
+        }
+        return iiWithSchemaNode
     }
 
-    private def findModule(SchemaContext context,String argument) {
-        checkNotNull(argument);
-        val startModule = argument.toModuleName();
-        return context.getLatestModule(startModule)
-    }
-    
-    private def getLatestModule(SchemaContext schema,String moduleName) {
+    private def getLatestModule(SchemaContext schema, String moduleName) {
         checkArgument(schema !== null);
         checkArgument(moduleName !== null && !moduleName.empty)
         val modules = schema.modules.filter[m|m.name == moduleName]
@@ -121,9 +121,9 @@ class ControllerContext implements SchemaServiceListener {
         return globalSchema.getLatestModule(moduleName)
     }
     
-    def findModuleByName(String moduleName, InstanceIdentifier partialPath) {
-        checkArgument(moduleName !== null && !moduleName.empty && partialPath !== null && !partialPath.path.empty)
-        val mountPointSchema = mountService?.getMountPoint(partialPath)?.schemaContext;
+    def findModuleByName(MountInstance mountPoint, String moduleName) {
+        checkArgument(moduleName !== null && mountPoint !== null)
+        val mountPointSchema = mountPoint.schemaContext;
         return mountPointSchema?.getLatestModule(moduleName);
     }
     
@@ -133,9 +133,9 @@ class ControllerContext implements SchemaServiceListener {
         return moduleSchemas?.filterLatestModule
     }
     
-    def findModuleByNamespace(URI namespace, InstanceIdentifier partialPath) {
-        checkArgument(namespace !== null && !namespace.toString.empty && partialPath !== null && !partialPath.path.empty)
-        val mountPointSchema = mountService?.getMountPoint(partialPath)?.schemaContext;
+    def findModuleByNamespace(MountInstance mountPoint, URI namespace) {
+        checkArgument(namespace !== null && mountPoint !== null)
+        val mountPointSchema = mountPoint.schemaContext;
         val moduleSchemas = mountPointSchema?.findModuleByNamespace(namespace)
         return moduleSchemas?.filterLatestModule
     }
@@ -254,39 +254,92 @@ class ControllerContext implements SchemaServiceListener {
         if(object === null) return "";
         return URLEncoder.encode(object.toString)
     }
-
-    private def DataSchemaNode collectPathArguments(InstanceIdentifierBuilder builder, List<String> strings,
-        DataNodeContainer parentNode, List<InstanceIdentifier> mountPoints) {
+    
+    private def InstanceIdWithSchemaNode collectPathArguments(InstanceIdentifierBuilder builder, List<String> strings,
+        DataNodeContainer parentNode, MountInstance mountPoint) {
         checkNotNull(strings)
         if (parentNode === null) {
             return null;
         }
         if (strings.empty) {
-            return parentNode as DataSchemaNode;
-        }
-        val nodeRef = strings.head;
-
-        val nodeName = nodeRef.toNodeName;
-        var targetNode = parentNode.findInstanceDataChild(nodeName);
-        if (targetNode instanceof ChoiceNode) {
-            return null
+            return new InstanceIdWithSchemaNode(builder.toInstance, parentNode as DataSchemaNode, mountPoint)
         }
         
-        if (targetNode === null) {
-            // Node is possibly in other mount point
-            val partialPath = builder.toInstance;
-            val mountPointSchema = mountService?.getMountPoint(partialPath)?.schemaContext;
-            if(mountPointSchema !== null) {
-                val module = mountPointSchema.findModule(strings.head)
-                if (module !== null) {
-                    mountPoints.add(partialPath)
+        val nodeName = strings.head.toNodeName
+        val moduleName = strings.head.toModuleName
+        var DataSchemaNode targetNode = null
+        if (!moduleName.nullOrEmpty) {
+            // if it is mount point
+            if (moduleName == MOUNT_MODULE && nodeName == MOUNT_NODE) {
+                if (mountPoint !== null) {
+                    throw new ResponseException(BAD_REQUEST, "Restconf supports just one mount point in URI.")
+                }
+                
+                if (mountService === null) {
+                    throw new ResponseException(SERVICE_UNAVAILABLE, "MountService was not found. " 
+                        + "Finding behind mount points does not work."
+                    )
+                }
+                
+                val partialPath = builder.toInstance;
+                val mount = mountService.getMountPoint(partialPath)
+                if (mount === null) {
+                    LOG.debug("Instance identifier to missing mount point: {}", partialPath)
+                    throw new ResponseException(BAD_REQUEST, "Mount point does not exist.")
+                }
+                
+                val mountPointSchema = mount.schemaContext;
+                if (mountPointSchema === null) {
+                    throw new ResponseException(BAD_REQUEST, "Mount point does not contain any schema with modules.")
+                }
+                
+                if (strings.size == 1) { // any data node is not behind mount point
+                    return new InstanceIdWithSchemaNode(InstanceIdentifier.builder().toInstance, mountPointSchema, mount)
+                }
+                
+                val moduleNameBehindMountPoint = strings.get(1).toModuleName()
+                if (moduleNameBehindMountPoint === null) {
+                    throw new ResponseException(BAD_REQUEST,
+                        "First node after mount point in URI has to be in format \"moduleName:nodeName\"")
+                }
+                
+                val moduleBehindMountPoint = mountPointSchema.getLatestModule(moduleNameBehindMountPoint)
+                if (moduleBehindMountPoint === null) {
+                    throw new ResponseException(BAD_REQUEST,
+                        "URI has bad format. \"" + moduleName + "\" module does not exist in mount point.")
+                }
+                
+                return collectPathArguments(InstanceIdentifier.builder(), strings.subList(1, strings.size),
+                    moduleBehindMountPoint, mount);
+            }
+            
+            var Module module = null;
+            if (mountPoint === null) {
+                module = globalSchema.getLatestModule(moduleName)
+                if (module === null) {
+                    throw new ResponseException(BAD_REQUEST,
+                        "URI has bad format. \"" + moduleName + "\" module does not exist.")
                 }
-                return builder.collectPathArguments(strings, module, mountPoints);
+            } else {
+                module = mountPoint.schemaContext?.getLatestModule(moduleName)
+                if (module === null) {
+                    throw new ResponseException(BAD_REQUEST,
+                        "URI has bad format. \"" + moduleName + "\" module does not exist in mount point.")
+                }
+            }
+            targetNode = parentNode.findInstanceDataChild(nodeName, module.namespace)
+            if (targetNode === null) {
+                throw new ResponseException(BAD_REQUEST, "URI has bad format. Possible reasons:\n" + 
+                    "1. \"" + strings.head + "\" was not found in parent data node.\n" + 
+                    "2. \"" + strings.head + "\" is behind mount point. Then it should be in format \"/" + MOUNT + "/" + strings.head + "\".")
+            }
+        } else { // string without module name
+            targetNode = parentNode.findInstanceDataChild(nodeName, null)
+            if (targetNode === null) {
+                throw new ResponseException(BAD_REQUEST, "URI has bad format. \"" + nodeName + "\" was not found in parent data node.\n")
             }
-            return null
         }
         
-
         // Number of consumed elements
         var consumed = 1;
         if (targetNode instanceof ListSchemaNode) {
@@ -295,7 +348,7 @@ class ControllerContext implements SchemaServiceListener {
 
             // every key has to be filled
             if ((strings.length - consumed) < keysSize) {
-                return null;
+                throw new ResponseException(BAD_REQUEST,"Missing key for list \"" + listNode.QName.localName + "\".")
             }
             val uriKeyValues = strings.subList(consumed, consumed + keysSize);
             val keyValues = new HashMap<QName, Object>();
@@ -305,7 +358,9 @@ class ControllerContext implements SchemaServiceListener {
 
                 // key value cannot be NULL
                 if (uriKeyValue.equals(NULL_VALUE)) {
-                    return null
+                    throw new ResponseException(BAD_REQUEST, "URI has bad format. List \"" + listNode.QName.localName 
+                        + "\" cannot contain \"null\" value as a key."
+                    )
                 }
                 keyValues.addKeyValue(listNode.getDataChildByName(key), uriKeyValue);
                 i = i + 1;
@@ -319,23 +374,28 @@ class ControllerContext implements SchemaServiceListener {
         }
         if (targetNode instanceof DataNodeContainer) {
             val remaining = strings.subList(consumed, strings.length);
-            val result = builder.collectPathArguments(remaining, targetNode as DataNodeContainer, mountPoints);
+            val result = builder.collectPathArguments(remaining, targetNode as DataNodeContainer, mountPoint);
             return result
         }
 
-        return targetNode
+        return new InstanceIdWithSchemaNode(builder.toInstance, targetNode, mountPoint)
     }
-    
-    static def DataSchemaNode findInstanceDataChild(DataNodeContainer container, String name) {
-        // FIXME: Add namespace comparison
-        var potentialNode = container.getDataChildByName(name);
-        if(potentialNode.instantiatedDataSchema) {
+
+    def DataSchemaNode findInstanceDataChild(DataNodeContainer container, String name, URI moduleNamespace) {
+        var DataSchemaNode potentialNode = null
+        if (moduleNamespace === null) {
+            potentialNode = container.getDataChildByName(name);
+        } else {
+            potentialNode = container.childNodes.filter[n|n.QName.localName == name && n.QName.namespace == moduleNamespace].head
+        }
+        
+        if (potentialNode.instantiatedDataSchema) {
             return potentialNode;
         }
         val allCases = container.childNodes.filter(ChoiceNode).map[cases].flatten
         for (caze : allCases) {
-            potentialNode = caze.findInstanceDataChild(name);
-            if(potentialNode !== null) {
+            potentialNode = caze.findInstanceDataChild(name, moduleNamespace);
+            if (potentialNode !== null) {
                 return potentialNode;
             }
         }
@@ -372,21 +432,21 @@ class ControllerContext implements SchemaServiceListener {
         checkNotNull(str)
         if (str.contains(":")) {
             val args = str.split(":");
-            checkArgument(args.size === 2);
-            return args.get(0);
-        } else {
-            return null;
+            if (args.size === 2) {
+                return args.get(0);
+            }
         }
+        return null;
     }
 
     private def String toNodeName(String str) {
         if (str.contains(":")) {
             val args = str.split(":");
-            checkArgument(args.size === 2);
-            return args.get(1);
-        } else {
-            return str;
+            if (args.size === 2) {
+                return args.get(1);
+            }
         }
+        return str;
     }
 
     private def QName toQName(String name) {
index ba0e47ff928c5d68739556cc05e0aee732199d28..1c958b901bf7039929a655ec84f088c3bdaf0192 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.controller.sal.restconf.impl;
 
+import org.opendaylight.controller.sal.core.api.mount.MountInstance;
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 
@@ -7,9 +8,9 @@ public class InstanceIdWithSchemaNode {
 
     private final InstanceIdentifier instanceIdentifier;
     private final DataSchemaNode schemaNode;
-    private final InstanceIdentifier mountPoint;
+    private final MountInstance mountPoint;
 
-    public InstanceIdWithSchemaNode(InstanceIdentifier instanceIdentifier, DataSchemaNode schemaNode, InstanceIdentifier mountPoint) {
+    public InstanceIdWithSchemaNode(InstanceIdentifier instanceIdentifier, DataSchemaNode schemaNode, MountInstance mountPoint) {
         this.instanceIdentifier = instanceIdentifier;
         this.schemaNode = schemaNode;
         this.mountPoint = mountPoint;
@@ -23,7 +24,7 @@ public class InstanceIdWithSchemaNode {
         return schemaNode;
     }
 
-    public InstanceIdentifier getMountPoint() {
+    public MountInstance getMountPoint() {
         return mountPoint;
     }
 
index a65c0ff97aa73324083a0826186462d59c7006c6..5ad6f1eea88d1ec33fc1cc67c155c601d7f30880 100644 (file)
@@ -1,13 +1,17 @@
 package org.opendaylight.controller.sal.restconf.impl
 
+import com.google.common.base.Preconditions
+import java.net.URI
 import java.util.ArrayList
 import java.util.HashMap
 import java.util.List
 import java.util.Set
 import javax.ws.rs.core.Response
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus
+import org.opendaylight.controller.sal.core.api.mount.MountInstance
 import org.opendaylight.controller.sal.rest.api.RestconfService
 import org.opendaylight.yangtools.yang.common.QName
+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.opendaylight.yangtools.yang.data.api.InstanceIdentifier.InstanceIdentifierBuilder
@@ -21,11 +25,11 @@ import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode
 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode
 import org.opendaylight.yangtools.yang.model.api.Module
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition
 import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition
 
 import static javax.ws.rs.core.Response.Status.*
-import org.opendaylight.yangtools.yang.model.api.RpcDefinition
 
 class RestconfImpl implements RestconfService {
 
@@ -92,21 +96,36 @@ class RestconfImpl implements RestconfService {
     }
 
     override readData(String identifier) {
-        val instanceIdentifierWithSchemaNode = identifier.resolveInstanceIdentifier
-        val data = broker.readOperationalData(instanceIdentifierWithSchemaNode.getInstanceIdentifier);
-        return new StructuredData(data, instanceIdentifierWithSchemaNode.schemaNode)
+        val iiWithData = identifier.toInstanceIdentifier
+        var CompositeNode data = null;
+        if (iiWithData.mountPoint !== null) {
+            data = broker.readOperationalDataBehindMountPoint(iiWithData.mountPoint, iiWithData.instanceIdentifier)
+        } else {
+            data = broker.readOperationalData(iiWithData.getInstanceIdentifier);
+        }
+        return new StructuredData(data, iiWithData.schemaNode)
     }
 
     override readConfigurationData(String identifier) {
-        val instanceIdentifierWithSchemaNode = identifier.resolveInstanceIdentifier
-        val data = broker.readConfigurationData(instanceIdentifierWithSchemaNode.getInstanceIdentifier);
-        return new StructuredData(data, instanceIdentifierWithSchemaNode.schemaNode)
+        val iiWithData = identifier.toInstanceIdentifier
+        var CompositeNode data = null;
+        if (iiWithData.mountPoint !== null) {
+            data = broker.readConfigurationDataBehindMountPoint(iiWithData.mountPoint, iiWithData.getInstanceIdentifier)
+        } else {
+            data = broker.readConfigurationData(iiWithData.getInstanceIdentifier);
+        }
+        return new StructuredData(data, iiWithData.schemaNode)
     }
 
     override readOperationalData(String identifier) {
-        val instanceIdentifierWithSchemaNode = identifier.resolveInstanceIdentifier
-        val data = broker.readOperationalData(instanceIdentifierWithSchemaNode.getInstanceIdentifier);
-        return new StructuredData(data, instanceIdentifierWithSchemaNode.schemaNode)
+        val iiWithData = identifier.toInstanceIdentifier
+        var CompositeNode data = null;
+        if (iiWithData.mountPoint !== null) {
+            data = broker.readOperationalDataBehindMountPoint(iiWithData.mountPoint, iiWithData.getInstanceIdentifier)
+        } else {
+            data = broker.readOperationalData(iiWithData.getInstanceIdentifier);
+        }
+        return new StructuredData(data, iiWithData.schemaNode)
     }
 
     override updateConfigurationDataLegacy(String identifier, CompositeNode payload) {
@@ -114,9 +133,15 @@ class RestconfImpl implements RestconfService {
     }
 
     override updateConfigurationData(String identifier, CompositeNode payload) {
-        val identifierWithSchemaNode = identifier.resolveInstanceIdentifier
-        val value = normalizeNode(payload, identifierWithSchemaNode.schemaNode, identifierWithSchemaNode.mountPoint)
-        val status = broker.commitConfigurationDataPut(identifierWithSchemaNode.instanceIdentifier, value).get();
+        val iiWithData = identifier.toInstanceIdentifier
+        val value = normalizeNode(payload, iiWithData.schemaNode, iiWithData.mountPoint)
+        var RpcResult<TransactionStatus> status = null
+        if (iiWithData.mountPoint !== null) {
+            status = broker.commitConfigurationDataPutBehindMountPoint(iiWithData.mountPoint,
+                iiWithData.instanceIdentifier, value).get()
+        } else {
+            status = broker.commitConfigurationDataPut(iiWithData.instanceIdentifier, value).get();
+        }
         switch status.result {
             case TransactionStatus.COMMITED: Response.status(OK).build
             default: Response.status(INTERNAL_SERVER_ERROR).build
@@ -128,14 +153,21 @@ class RestconfImpl implements RestconfService {
     }
 
     override createConfigurationData(String identifier, CompositeNode payload) {
-        val uncompleteIdentifierWithSchemaNode = identifier.resolveInstanceIdentifier
-        var schemaNode = (uncompleteIdentifierWithSchemaNode.schemaNode as DataNodeContainer).getSchemaChildNode(payload)
-        if (schemaNode === null) {
-            schemaNode = payload.findModule(uncompleteIdentifierWithSchemaNode.instanceIdentifier)?.getSchemaChildNode(payload)
-        }
-        val value = normalizeNode(payload, schemaNode, uncompleteIdentifierWithSchemaNode.instanceIdentifier)
-        val completeIdentifierWithSchemaNode = uncompleteIdentifierWithSchemaNode.addLastIdentifierFromData(value, schemaNode)
-        val status = broker.commitConfigurationDataPost(completeIdentifierWithSchemaNode.instanceIdentifier, value)?.get();
+        if (payload.namespace === null) {
+            throw new ResponseException(BAD_REQUEST,
+                "Data has bad format. Root element node must have namespace (XML format) or module name(JSON format)");
+        }
+        val uncompleteInstIdWithData = identifier.toInstanceIdentifier
+        val schemaNode = uncompleteInstIdWithData.mountPoint.findModule(payload)?.getSchemaChildNode(payload)
+        val value = normalizeNode(payload, schemaNode, uncompleteInstIdWithData.mountPoint)
+        val completeInstIdWithData = uncompleteInstIdWithData.addLastIdentifierFromData(value, schemaNode)
+        var RpcResult<TransactionStatus> status = null
+        if (completeInstIdWithData.mountPoint !== null) {
+            status = broker.commitConfigurationDataPostBehindMountPoint(completeInstIdWithData.mountPoint,
+                completeInstIdWithData.instanceIdentifier, value)?.get();
+        } else {
+            status = broker.commitConfigurationDataPost(completeInstIdWithData.instanceIdentifier, value)?.get();
+        }
         if (status === null) {
             return Response.status(ACCEPTED).build
         }
@@ -146,10 +178,20 @@ class RestconfImpl implements RestconfService {
     }
     
     override createConfigurationData(CompositeNode payload) {
-        val schemaNode = payload.findModule(null)?.getSchemaChildNode(payload)
+        if (payload.namespace === null) {
+            throw new ResponseException(BAD_REQUEST,
+                "Data has bad format. Root element node must have namespace (XML format) or module name(JSON format)");
+        }
+        val schemaNode = findModule(null, payload)?.getSchemaChildNode(payload)
         val value = normalizeNode(payload, schemaNode, null)
-        val identifierWithSchemaNode = addLastIdentifierFromData(null, value, schemaNode)
-        val status = broker.commitConfigurationDataPost(identifierWithSchemaNode.instanceIdentifier, value)?.get();
+        val iiWithData = addLastIdentifierFromData(null, value, schemaNode)
+        var RpcResult<TransactionStatus> status = null
+        if (iiWithData.mountPoint !== null) {
+            status = broker.commitConfigurationDataPostBehindMountPoint(iiWithData.mountPoint,
+                iiWithData.instanceIdentifier, value)?.get();
+        } else {
+            status = broker.commitConfigurationDataPost(iiWithData.instanceIdentifier, value)?.get();
+        }
         if (status === null) {
             return Response.status(ACCEPTED).build
         }
@@ -160,36 +202,43 @@ class RestconfImpl implements RestconfService {
     }
     
     override deleteConfigurationData(String identifier) {
-        val instanceIdentifierWithSchemaNode = identifier.resolveInstanceIdentifier
-        val status = broker.commitConfigurationDataDelete(instanceIdentifierWithSchemaNode.getInstanceIdentifier).get;
+        val iiWithData = identifier.toInstanceIdentifier
+        var RpcResult<TransactionStatus> status = null
+        if (iiWithData.mountPoint !== null) {
+            status = broker.commitConfigurationDataDeleteBehindMountPoint(iiWithData.mountPoint,
+                iiWithData.getInstanceIdentifier).get;
+        } else {
+            status = broker.commitConfigurationDataDelete(iiWithData.getInstanceIdentifier).get;
+        }
         switch status.result {
             case TransactionStatus.COMMITED: Response.status(OK).build
             default: Response.status(INTERNAL_SERVER_ERROR).build
         }
     }
-
-    private def InstanceIdWithSchemaNode resolveInstanceIdentifier(String identifier) {
-        val identifierWithSchemaNode = identifier.toInstanceIdentifier
-        if (identifierWithSchemaNode === null) {
-            throw new ResponseException(BAD_REQUEST, "URI has bad format");
-        }
-        return identifierWithSchemaNode
+    
+    private def dispatch URI namespace(CompositeNode data) {
+        return data.nodeType.namespace
+    }
+    
+    private def dispatch URI namespace(CompositeNodeWrapper data) {
+        return data.namespace
     }
 
-    private def dispatch Module findModule(CompositeNode data, InstanceIdentifier partialPath) {
-        if (partialPath !== null && !partialPath.path.empty) {
-            return data.nodeType.namespace.findModuleByNamespace(partialPath)
+    private def dispatch Module findModule(MountInstance mountPoint, CompositeNode data) {
+        if (mountPoint !== null) {
+            return mountPoint.findModuleByNamespace(data.nodeType.namespace)
         } else {
-            return data.nodeType.namespace.findModuleByNamespace
+            return findModuleByNamespace(data.nodeType.namespace)
         }
     }
 
-    private def dispatch Module findModule(CompositeNodeWrapper data, InstanceIdentifier partialPath) {
+    private def dispatch Module findModule(MountInstance mountPoint, CompositeNodeWrapper data) {
+        Preconditions.checkNotNull(data.namespace)
         var Module module = null;
-        if (partialPath !== null && !partialPath.path.empty) {
-            module = data.namespace.findModuleByNamespace(partialPath) // namespace from XML
+        if (mountPoint !== null) {
+            module = mountPoint.findModuleByNamespace(data.namespace) // namespace from XML
             if (module === null) {
-                module = data.namespace.toString.findModuleByName(partialPath) // namespace (module name) from JSON
+                module = mountPoint.findModuleByName(data.namespace.toString) // namespace (module name) from JSON
             }
         } else {
             module = data.namespace.findModuleByNamespace // namespace from XML
@@ -208,10 +257,11 @@ class RestconfImpl implements RestconfService {
         return parentSchemaNode?.getDataChildByName(data.localName)
     }
 
-    private def InstanceIdWithSchemaNode addLastIdentifierFromData(InstanceIdWithSchemaNode identifierWithSchemaNode, CompositeNode data, DataSchemaNode schemaOfData) {
+    private def InstanceIdWithSchemaNode addLastIdentifierFromData(InstanceIdWithSchemaNode identifierWithSchemaNode,
+        CompositeNode data, DataSchemaNode schemaOfData) {
         val iiOriginal = identifierWithSchemaNode?.instanceIdentifier
-        var  InstanceIdentifierBuilder iiBuilder = null
-        if (iiOriginal === null) { 
+        var InstanceIdentifierBuilder iiBuilder = null
+        if (iiOriginal === null) {
             iiBuilder = InstanceIdentifier.builder
         } else {
             iiBuilder = InstanceIdentifier.builder(iiOriginal)
@@ -230,15 +280,20 @@ class RestconfImpl implements RestconfService {
         for (key : listNode.keyDefinition) {
             val dataNodeKeyValueObject = dataNode.getSimpleNodesByName(key.localName)?.head?.value
             if (dataNodeKeyValueObject === null) {
-                throw new ResponseException(BAD_REQUEST, "Data contains list \"" + dataNode.nodeType.localName + "\" which does not contain key: \"" + key.localName + "\"")
+                throw new ResponseException(BAD_REQUEST,
+                    "Data contains list \"" + dataNode.nodeType.localName + "\" which does not contain key: \"" +
+                        key.localName + "\"")
             }
             keyValues.put(key, dataNodeKeyValueObject);
         }
         return keyValues
     }
 
-    private def CompositeNode normalizeNode(CompositeNode node, DataSchemaNode schema, InstanceIdentifier mountPoint) {
-        if (schema !== null && !schema.containerOrList) {
+    private def CompositeNode normalizeNode(CompositeNode node, DataSchemaNode schema, MountInstance mountPoint) {
+        if (schema === null) {
+            throw new ResponseException(INTERNAL_SERVER_ERROR, "Data schema node was not found for " + node?.nodeType?.localName)
+        }
+        if (!(schema instanceof DataNodeContainer)) {
             throw new ResponseException(BAD_REQUEST, "Root element has to be container or list yang datatype.");
         }
         if (node instanceof CompositeNodeWrapper) {
@@ -250,12 +305,8 @@ class RestconfImpl implements RestconfService {
         return node
     }
 
-    private def isContainerOrList(DataSchemaNode schemaNode) {
-        return (schemaNode instanceof ContainerSchemaNode) || (schemaNode instanceof ListSchemaNode)
-    }
-
     private def void normalizeNode(NodeWrapper<?> nodeBuilder, DataSchemaNode schema, QName previousAugment,
-        InstanceIdentifier mountPoint) {
+        MountInstance mountPoint) {
         if (schema === null) {
             throw new ResponseException(BAD_REQUEST,
                 "Data has bad format.\n\"" + nodeBuilder.localName + "\" does not exist in yang schema.");
@@ -267,9 +318,11 @@ class RestconfImpl implements RestconfService {
         } else if (previousAugment !== null && schema.QName.namespace !== previousAugment.namespace) {
             validQName = QName.create(currentAugment, schema.QName.localName);
         }
-        var moduleName = controllerContext.findModuleNameByNamespace(validQName.namespace);
-        if (moduleName === null && mountPoint !== null && !mountPoint.path.empty) {
-            moduleName = controllerContext.findModuleByNamespace(validQName.namespace, mountPoint)?.name
+        var String moduleName = null;
+        if (mountPoint === null) {
+            moduleName = controllerContext.findModuleNameByNamespace(validQName.namespace);
+        } else {
+            moduleName = mountPoint.findModuleByNamespace(validQName.namespace)?.name
         }
         if (nodeBuilder.namespace === null || nodeBuilder.namespace == validQName.namespace ||
             nodeBuilder.namespace.toString == moduleName) {
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonWithDataFromSeveralModulesTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonWithDataFromSeveralModulesTest.java
new file mode 100644 (file)
index 0000000..fdc10b7
--- /dev/null
@@ -0,0 +1,108 @@
+package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.ws.rs.WebApplicationException;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider;
+import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider;
+import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper;
+import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper;
+import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
+import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+public class CnSnToJsonWithDataFromSeveralModulesTest extends YangAndXmlAndDataSchemaLoader {
+
+    @BeforeClass
+    public static void initialize() {
+        dataLoad("/xml-to-cnsn/data-of-several-modules/yang",2,"module1","cont_m1");
+    }
+
+    @Test
+    public void dataFromSeveralModulesToJsonTest() throws WebApplicationException, IOException, URISyntaxException {
+        SchemaContext schemaContext = TestUtils.loadSchemaContext(modules);
+        String output = TestUtils.writeCompNodeWithSchemaContextToOutput(prepareCnSn(), modules, schemaContext,
+                StructuredDataToJsonProvider.INSTANCE);
+
+//         String output =
+//         String.format("\"data\"   :   {\n" +
+//                             "\t\"cont_m1\"   :  {\n" +
+//                                 "\t\t\"lf1_m1\"   :  \"lf1 m1 value\"\n" +
+//                             "\t}\n" +
+//                             "\t\"cont_m2\"   :  {\n" +
+//                                 "\t\t\"lf1_m2\"   :  \"lf1 m2 value\"\n" +
+//                             "\t}\n" +
+//                     "}");
+
+        StringBuilder regex = new StringBuilder();
+        regex.append("^");
+
+        regex.append(".*\"data\"");
+        regex.append(".*:");
+        regex.append(".*\\{");
+        
+        regex.append(".*\"contB_m1\"");
+        regex.append(".*:");
+        regex.append(".*\\{");
+        regex.append(".*\\}");
+        
+        regex.append(".*\"cont_m1\"");
+        regex.append(".*:");
+        regex.append(".*\\{");
+        regex.append(".*\\}");
+
+        regex.append(".*\"contB_m2\"");
+        regex.append(".*:");
+        regex.append(".*\\{");
+        regex.append(".*\\}");
+        
+        regex.append(".*\"cont_m2\"");
+        regex.append(".*:");
+        regex.append(".*\\{");
+        regex.append(".*\\}");
+        
+        regex.append(".*\\}");
+
+        regex.append(".*");
+        regex.append("$");
+
+        Pattern ptrn = Pattern.compile(regex.toString(), Pattern.DOTALL);
+        Matcher matcher = ptrn.matcher(output);
+
+        assertTrue(matcher.find());
+
+    }
+
+    private CompositeNode prepareCnSn() throws URISyntaxException {
+        CompositeNodeWrapper data = new CompositeNodeWrapper(new URI("urn:ietf:params:xml:ns:netconf:base:1.0"), "data");
+
+        URI uriModule1 = new URI("module:one");
+        CompositeNodeWrapper cont_m1 = new CompositeNodeWrapper(uriModule1, "cont_m1");
+        SimpleNodeWrapper lf1_m1 = new SimpleNodeWrapper(uriModule1, "lf1_m1", "lf1 m1 value");
+        cont_m1.addValue(lf1_m1);
+        CompositeNodeWrapper contB_m1 = new CompositeNodeWrapper(uriModule1, "contB_m1");
+        
+        data.addValue(contB_m1);
+        data.addValue(cont_m1);
+
+        URI uriModule2 = new URI("module:two");
+        CompositeNodeWrapper cont_m2 = new CompositeNodeWrapper(uriModule2, "cont_m2");
+        SimpleNodeWrapper lf1_m2 = new SimpleNodeWrapper(uriModule2, "lf1_m2", "lf1 m2 value");
+        cont_m2.addValue(lf1_m2);
+        CompositeNodeWrapper contB_m2 = new CompositeNodeWrapper(uriModule2, "contB_m2");
+        data.addValue(contB_m2);
+        data.addValue(cont_m2);
+        return data;
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlWithDataFromSeveralModulesTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlWithDataFromSeveralModulesTest.java
new file mode 100644 (file)
index 0000000..57a1495
--- /dev/null
@@ -0,0 +1,107 @@
+package org.opendaylight.controller.sal.restconf.impl.cnsn.to.xml.test;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.ws.rs.WebApplicationException;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider;
+import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper;
+import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper;
+import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
+import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+public class CnSnToXmlWithDataFromSeveralModulesTest extends YangAndXmlAndDataSchemaLoader {
+
+    @BeforeClass
+    public static void initialize() {
+        dataLoad("/xml-to-cnsn/data-of-several-modules/yang",2,"module1","cont_m1");
+    }
+
+    @Test
+    public void dataFromSeveralModulesToXmlTest() throws WebApplicationException, IOException, URISyntaxException {
+        SchemaContext schemaContext = TestUtils.loadSchemaContext(modules);
+        String output = TestUtils.writeCompNodeWithSchemaContextToOutput(prepareCnSn(), modules, schemaContext,
+                StructuredDataToXmlProvider.INSTANCE);
+
+//         String output =
+//         String.format("<data>" +
+//                      "\n<cont_m1>" +
+//                             "\n\t<lf1_m1>" +
+//                                 "\n\t\tlf1 m1 value" +
+//                                     "\n\t</lf1_m1>" +
+//                         "\n</cont_m1>" +
+//                         "\n<cont_m2>" +
+//                             "\n\t<lf1_m2>" +
+//                                 "\n\t\tlf1 m2 value" +
+//                             "\n\t</lf1_m2>" +
+//                         "\n</cont_m2>" +
+//                     "\n</data>");
+
+        StringBuilder regex = new StringBuilder();
+        regex.append("^");
+
+        regex.append(".*<data.*");
+        regex.append(".*xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"");
+        regex.append(".*>");
+        
+        
+        regex.append(".*<contB_m1.*\\/>");
+        regex.append(".*xmlns=\"module:one\"");
+        regex.append(".*>");
+        regex.append(".*<lf1_m1.*>");
+        regex.append(".*<\\/lf1_m1>");
+        regex.append(".*<\\/cont_m1>");
+
+        regex.append(".*<contB_m2.*/>");
+        regex.append(".*<cont_m2.*");
+        regex.append(".*xmlns=\"module:two\"");
+        regex.append(".*>");
+        regex.append(".*<lf1_m2.*>");
+        regex.append(".*<\\/lf1_m2>");
+        regex.append(".*<\\/cont_m2>");
+
+        regex.append(".*<\\/data.*>");
+
+        regex.append(".*");
+        regex.append("$");
+
+        Pattern ptrn = Pattern.compile(regex.toString(), Pattern.DOTALL);
+        Matcher matcher = ptrn.matcher(output);
+
+        assertTrue(matcher.find());
+
+    }
+
+    private CompositeNode prepareCnSn() throws URISyntaxException {
+        CompositeNodeWrapper data = new CompositeNodeWrapper(new URI("urn:ietf:params:xml:ns:netconf:base:1.0"), "data");
+
+        URI uriModule1 = new URI("module:one");
+        CompositeNodeWrapper cont_m1 = new CompositeNodeWrapper(uriModule1, "cont_m1");
+        SimpleNodeWrapper lf1_m1 = new SimpleNodeWrapper(uriModule1, "lf1_m1", "lf1 m1 value");
+        cont_m1.addValue(lf1_m1);
+        CompositeNodeWrapper contB_m1 = new CompositeNodeWrapper(uriModule1, "contB_m1");
+        
+        data.addValue(contB_m1);
+        data.addValue(cont_m1);
+
+        URI uriModule2 = new URI("module:two");
+        CompositeNodeWrapper cont_m2 = new CompositeNodeWrapper(uriModule2, "cont_m2");
+        SimpleNodeWrapper lf1_m2 = new SimpleNodeWrapper(uriModule2, "lf1_m2", "lf1 m2 value");
+        cont_m2.addValue(lf1_m2);
+        CompositeNodeWrapper contB_m2 = new CompositeNodeWrapper(uriModule2, "contB_m2");
+        data.addValue(contB_m2);
+        data.addValue(cont_m2);
+        return data;
+    }
+
+}
index c68fcb90714567849192db25d9dc676e43f700a9..4c5922d73fa962b3aaea2d547846c8905e66bb8a 100644 (file)
@@ -2,21 +2,19 @@ package org.opendaylight.controller.sal.restconf.impl.test;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 import java.io.FileNotFoundException;
 import java.util.Set;
 
+import org.junit.After;
 import org.junit.BeforeClass;
+import org.junit.Rule;
 import org.junit.Test;
-import org.opendaylight.controller.sal.core.api.mount.MountInstance;
-import org.opendaylight.controller.sal.core.api.mount.MountService;
+import org.junit.rules.ExpectedException;
 import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
 import org.opendaylight.controller.sal.restconf.impl.InstanceIdWithSchemaNode;
+import org.opendaylight.controller.sal.restconf.impl.ResponseException;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -25,6 +23,9 @@ public class ControllerContextTest {
 
     private static final ControllerContext controllerContext = ControllerContext.getInstance();
 
+    @Rule
+    public ExpectedException exception = ExpectedException.none();
+
     @BeforeClass
     public static void init() throws FileNotFoundException {
         Set<Module> allModules = TestUtils.loadModulesFrom("/full-versions/yangs");
@@ -33,6 +34,11 @@ public class ControllerContextTest {
         controllerContext.setSchemas(schemaContext);
     }
 
+    @After
+    public void releaseMountService() {
+        controllerContext.setMountService(null);
+    }
+
     @Test
     public void testToInstanceIdentifierList() throws FileNotFoundException {
         InstanceIdWithSchemaNode instanceIdentifier = controllerContext
@@ -50,48 +56,20 @@ public class ControllerContextTest {
 
         instanceIdentifier = controllerContext.toInstanceIdentifier("simple-nodes:users/user/foo");
         assertEquals(instanceIdentifier.getSchemaNode().getQName().getLocalName(), "user");
-
-        instanceIdentifier = controllerContext.toInstanceIdentifier("simple-nodes:user/null/boo");
-        assertNull(instanceIdentifier);
-
-        instanceIdentifier = controllerContext.toInstanceIdentifier("simple-nodes:user/foo");
-        assertNull(instanceIdentifier);
-
     }
 
     @Test
-    public void testToInstanceIdentifierMountPoint() throws FileNotFoundException {
-        try {
-            String mountPointPath = "simple-nodes:user/foo/boo";
-            String nestedPath = "simple-nodes:user/foo/boo/simple-nodes:users";
-            InstanceIdWithSchemaNode mountInstanceIdentifier = controllerContext.toInstanceIdentifier(mountPointPath);
-            assertEquals("user", mountInstanceIdentifier.getSchemaNode().getQName().getLocalName());
-
-            MountInstance mountInstance = mock(MountInstance.class);
-            MountService mountService = mock(MountService.class);
-
-            controllerContext.setMountService(mountService);
-            // when(mountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(null);
-
-            when(mountService.getMountPoint(eq(mountInstanceIdentifier.getInstanceIdentifier()))).thenReturn(
-                    mountInstance);
-
-            when(mountInstance.getSchemaContext()).thenReturn(controllerContext.getGlobalSchema());
-
-            InstanceIdWithSchemaNode mountedInstanceIdentifier = controllerContext.toInstanceIdentifier(nestedPath);
-            assertEquals("users", mountedInstanceIdentifier.getSchemaNode().getQName().getLocalName());
-
-            mountedInstanceIdentifier = controllerContext.toInstanceIdentifier(mountPointPath + "/" + mountPointPath);
-            assertEquals("user", mountedInstanceIdentifier.getSchemaNode().getQName().getLocalName());
-
-            mountedInstanceIdentifier = controllerContext
-                    .toInstanceIdentifier("simple-nodes:user/foo/var/simple-nodes:users");
-            assertNull(mountedInstanceIdentifier);
-
-        } finally {
-            controllerContext.setMountService(null);
-        }
+    public void testToInstanceIdentifierListWithNullKey() {
+        exception.expect(ResponseException.class);
+        exception.expectMessage("HTTP 400 Bad Request");
+        controllerContext.toInstanceIdentifier("simple-nodes:user/null/boo");
+    }
 
+    @Test
+    public void testToInstanceIdentifierListWithMissingKey() {
+        exception.expect(ResponseException.class);
+        exception.expectMessage("HTTP 400 Bad Request");
+        controllerContext.toInstanceIdentifier("simple-nodes:user/foo");
     }
 
     @Test
@@ -104,18 +82,30 @@ public class ControllerContextTest {
 
     @Test
     public void testToInstanceIdentifierChoice() throws FileNotFoundException {
-        InstanceIdWithSchemaNode instanceIdentifier = controllerContext.toInstanceIdentifier("simple-nodes:food/beer");
+        InstanceIdWithSchemaNode instanceIdentifier = controllerContext
+                .toInstanceIdentifier("simple-nodes:food/nonalcoholic/beer");
         assertEquals(instanceIdentifier.getSchemaNode().getQName().getLocalName(), "beer");
+    }
 
-        instanceIdentifier = controllerContext.toInstanceIdentifier("simple-nodes:food/snack");
-        assertNull(instanceIdentifier);
-
-        instanceIdentifier = controllerContext.toInstanceIdentifier("simple-nodes:food/sports-arena");
-        assertNull(instanceIdentifier);
+    @Test
+    public void testToInstanceIdentifierChoiceException() {
+        exception.expect(ResponseException.class);
+        exception.expectMessage("HTTP 400 Bad Request");
+        controllerContext.toInstanceIdentifier("simple-nodes:food/snack");
+    }
 
-        instanceIdentifier = controllerContext.toInstanceIdentifier("simple-nodes:food/snack/sports-arena");
-        assertNull(instanceIdentifier);
+    @Test
+    public void testToInstanceIdentifierCaseException() {
+        exception.expect(ResponseException.class);
+        exception.expectMessage("HTTP 400 Bad Request");
+        controllerContext.toInstanceIdentifier("simple-nodes:food/sports-arena");
+    }
 
+    @Test
+    public void testToInstanceIdentifierChoiceCaseException() {
+        exception.expect(ResponseException.class);
+        exception.expectMessage("HTTP 400 Bad Request");
+        controllerContext.toInstanceIdentifier("simple-nodes:food/snack/sports-arena");
     }
 
 }
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyMountInstanceImpl.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyMountInstanceImpl.java
deleted file mode 100644 (file)
index 181aa04..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.opendaylight.controller.sal.restconf.impl.test;
-
-import java.util.concurrent.Future;
-
-import org.opendaylight.controller.sal.core.api.data.DataChangeListener;
-import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction;
-import org.opendaylight.controller.sal.core.api.mount.MountInstance;
-import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.concepts.Registration;
-import org.opendaylight.yangtools.yang.common.QName;
-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.opendaylight.yangtools.yang.model.api.SchemaContext;
-
-class DummyMountInstanceImpl implements MountInstance {
-
-    SchemaContext schemaContext;
-
-    public static class Builder {
-        SchemaContext schemaContext;
-
-        public Builder setSchemaContext(SchemaContext schemaContext) {
-            this.schemaContext = schemaContext;
-            return this;
-        }
-
-        public MountInstance build() {
-            DummyMountInstanceImpl instance = new DummyMountInstanceImpl();
-            instance.schemaContext = schemaContext;
-            return instance;
-        }
-    }
-
-    @Override
-    public Registration<NotificationListener> addNotificationListener(QName notification, NotificationListener listener) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public CompositeNode readConfigurationData(InstanceIdentifier path) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public CompositeNode readOperationalData(InstanceIdentifier path) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public DataModificationTransaction beginTransaction() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public ListenerRegistration<DataChangeListener> registerDataChangeListener(InstanceIdentifier path,
-            DataChangeListener listener) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public SchemaContext getSchemaContext() {
-        return schemaContext;
-    }
-
-    @Override
-    public Future<RpcResult<CompositeNode>> rpc(QName type, CompositeNode input) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/MediaTypesTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/MediaTypesTest.java
new file mode 100644 (file)
index 0000000..bbedd2b
--- /dev/null
@@ -0,0 +1,225 @@
+package org.opendaylight.controller.sal.restconf.impl.test;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.JSON;
+import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.XML;
+import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.createUri;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Application;
+import javax.ws.rs.core.MediaType;
+
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.test.JerseyTest;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.opendaylight.controller.sal.rest.api.Draft02;
+import org.opendaylight.controller.sal.rest.api.RestconfService;
+import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider;
+import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider;
+import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider;
+import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+
+public class MediaTypesTest extends JerseyTest {
+    
+    private static RestconfService restconfService;
+    private static String jsonData;
+    private static String xmlData;
+    
+    @BeforeClass
+    public static void init() throws IOException {
+        restconfService = mock(RestconfService.class);
+        String jsonPath = RestconfImplTest.class.getResource("/parts/ietf-interfaces_interfaces.json").getPath();
+        jsonData = TestUtils.loadTextFile(jsonPath);
+        InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/parts/ietf-interfaces_interfaces.xml");
+        xmlData = TestUtils.getDocumentInPrintableForm(TestUtils.loadDocumentFrom(xmlStream));
+    }
+    
+    @Override
+    protected Application configure() {
+        /* enable/disable Jersey logs to console */
+//        enable(TestProperties.LOG_TRAFFIC);
+//        enable(TestProperties.DUMP_ENTITY);
+//        enable(TestProperties.RECORD_LOG_LEVEL);
+//        set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue());
+        ResourceConfig resourceConfig = new ResourceConfig();
+        resourceConfig = resourceConfig.registerInstances(restconfService, StructuredDataToXmlProvider.INSTANCE,
+                StructuredDataToJsonProvider.INSTANCE, XmlToCompositeNodeProvider.INSTANCE,
+                JsonToCompositeNodeProvider.INSTANCE);
+        return resourceConfig;
+    }
+    
+  @Test
+  public void testPostOperationsWithInputDataMediaTypes() throws UnsupportedEncodingException {
+      String uriPrefix = "/operations/";
+      String uriPath = "ietf-interfaces:interfaces";
+      String uri = createUri(uriPrefix, uriPath);
+      when(restconfService.invokeRpc(eq(uriPath), any(CompositeNode.class))).thenReturn(null);
+      post(uri, Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+JSON, jsonData);
+      verify(restconfService, times(1)).invokeRpc(eq(uriPath), any(CompositeNode.class));
+      post(uri, Draft02.MediaTypes.DATA+XML, Draft02.MediaTypes.DATA+XML, xmlData);
+      verify(restconfService, times(2)).invokeRpc(eq(uriPath), any(CompositeNode.class));
+      post(uri, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, jsonData);
+      verify(restconfService, times(3)).invokeRpc(eq(uriPath), any(CompositeNode.class));
+      post(uri, MediaType.APPLICATION_XML, MediaType.APPLICATION_XML, xmlData);
+      verify(restconfService, times(4)).invokeRpc(eq(uriPath), any(CompositeNode.class));
+      post(uri, MediaType.TEXT_XML, MediaType.TEXT_XML, xmlData);
+      verify(restconfService, times(5)).invokeRpc(eq(uriPath), any(CompositeNode.class));
+      post(uri, null, MediaType.TEXT_XML, xmlData);
+      verify(restconfService, times(6)).invokeRpc(eq(uriPath), any(CompositeNode.class));
+      
+      // negative tests
+      post(uri, MediaType.TEXT_PLAIN, MediaType.TEXT_XML, xmlData);
+      verify(restconfService, times(6)).invokeRpc(eq(uriPath), any(CompositeNode.class));
+      post(uri, MediaType.TEXT_XML, MediaType.TEXT_PLAIN, xmlData);
+      verify(restconfService, times(6)).invokeRpc(eq(uriPath), any(CompositeNode.class));
+  }
+  
+    @Test
+    public void testGetConfigMediaTypes() throws UnsupportedEncodingException {
+        String uriPrefix = "/config/";
+        String uriPath = "ietf-interfaces:interfaces";
+        String uri = createUri(uriPrefix, uriPath);
+        when(restconfService.readConfigurationData(uriPath)).thenReturn(null);
+        get(uri, Draft02.MediaTypes.DATA+JSON);
+        verify(restconfService, times(1)).readConfigurationData(uriPath);
+        get(uri, Draft02.MediaTypes.DATA+XML);
+        verify(restconfService, times(2)).readConfigurationData(uriPath);
+        get(uri, MediaType.APPLICATION_JSON);
+        verify(restconfService, times(3)).readConfigurationData(uriPath);
+        get(uri, MediaType.APPLICATION_XML);
+        verify(restconfService, times(4)).readConfigurationData(uriPath);
+        get(uri, MediaType.TEXT_XML);
+        verify(restconfService, times(5)).readConfigurationData(uriPath);
+        
+        // negative tests
+        get(uri, MediaType.TEXT_PLAIN);
+        verify(restconfService, times(5)).readConfigurationData(uriPath);
+    }
+    
+    @Test
+    public void testGetOperationalMediaTypes() throws UnsupportedEncodingException {
+        String uriPrefix = "/operational/";
+        String uriPath = "ietf-interfaces:interfaces";
+        String uri = createUri(uriPrefix, uriPath);
+        when(restconfService.readOperationalData(uriPath)).thenReturn(null);
+        get(uri, Draft02.MediaTypes.DATA+JSON);
+        verify(restconfService, times(1)).readOperationalData(uriPath);
+        get(uri, Draft02.MediaTypes.DATA+XML);
+        verify(restconfService, times(2)).readOperationalData(uriPath);
+        get(uri, MediaType.APPLICATION_JSON);
+        verify(restconfService, times(3)).readOperationalData(uriPath);
+        get(uri, MediaType.APPLICATION_XML);
+        verify(restconfService, times(4)).readOperationalData(uriPath);
+        get(uri, MediaType.TEXT_XML);
+        verify(restconfService, times(5)).readOperationalData(uriPath);
+        
+        // negative tests
+        get(uri, MediaType.TEXT_PLAIN);
+        verify(restconfService, times(5)).readOperationalData(uriPath);
+    }
+    
+    @Test
+    public void testPutConfigMediaTypes() throws UnsupportedEncodingException {
+        String uriPrefix = "/config/";
+        String uriPath = "ietf-interfaces:interfaces";
+        String uri = createUri(uriPrefix, uriPath);
+        when(restconfService.updateConfigurationData(eq(uriPath), any(CompositeNode.class))).thenReturn(null);
+        put(uri, null, Draft02.MediaTypes.DATA+JSON, jsonData);
+        verify(restconfService, times(1)).updateConfigurationData(eq(uriPath), any(CompositeNode.class));
+        put(uri, null, Draft02.MediaTypes.DATA+XML, xmlData);
+        verify(restconfService, times(2)).updateConfigurationData(eq(uriPath), any(CompositeNode.class));
+        put(uri, null, MediaType.APPLICATION_JSON, jsonData);
+        verify(restconfService, times(3)).updateConfigurationData(eq(uriPath), any(CompositeNode.class));
+        put(uri, null, MediaType.APPLICATION_XML, xmlData);
+        verify(restconfService, times(4)).updateConfigurationData(eq(uriPath), any(CompositeNode.class));
+        put(uri, null, MediaType.TEXT_XML, xmlData);
+        verify(restconfService, times(5)).updateConfigurationData(eq(uriPath), any(CompositeNode.class));
+        put(uri, "fooMediaType", MediaType.TEXT_XML, xmlData);
+        verify(restconfService, times(6)).updateConfigurationData(eq(uriPath), any(CompositeNode.class));
+    }
+    
+    @Test
+    public void testPostConfigWithPathMediaTypes() throws UnsupportedEncodingException {
+        String uriPrefix = "/config/";
+        String uriPath = "ietf-interfaces:interfaces";
+        String uri = createUri(uriPrefix, uriPath);
+        when(restconfService.createConfigurationData(eq(uriPath), any(CompositeNode.class))).thenReturn(null);
+        post(uri, null, Draft02.MediaTypes.DATA+JSON, jsonData);
+        verify(restconfService, times(1)).createConfigurationData(eq(uriPath), any(CompositeNode.class));
+        post(uri, null, Draft02.MediaTypes.DATA+XML, xmlData);
+        verify(restconfService, times(2)).createConfigurationData(eq(uriPath), any(CompositeNode.class));
+        post(uri, null, MediaType.APPLICATION_JSON, jsonData);
+        verify(restconfService, times(3)).createConfigurationData(eq(uriPath), any(CompositeNode.class));
+        post(uri, null, MediaType.APPLICATION_XML, xmlData);
+        verify(restconfService, times(4)).createConfigurationData(eq(uriPath), any(CompositeNode.class));
+        post(uri, null, MediaType.TEXT_XML, xmlData);
+        verify(restconfService, times(5)).createConfigurationData(eq(uriPath), any(CompositeNode.class));
+        post(uri, "fooMediaType", MediaType.TEXT_XML, xmlData);
+        verify(restconfService, times(6)).createConfigurationData(eq(uriPath), any(CompositeNode.class));
+    }
+    
+    @Test
+    public void testPostConfigMediaTypes() throws UnsupportedEncodingException {
+        String uriPrefix = "/config/";
+        String uri = createUri(uriPrefix, "");
+        when(restconfService.createConfigurationData(any(CompositeNode.class))).thenReturn(null);
+        post(uri, null, Draft02.MediaTypes.DATA+JSON, jsonData);
+        verify(restconfService, times(1)).createConfigurationData(any(CompositeNode.class));
+        post(uri, null, Draft02.MediaTypes.DATA+XML, xmlData);
+        verify(restconfService, times(2)).createConfigurationData(any(CompositeNode.class));
+        post(uri, null, MediaType.APPLICATION_JSON, jsonData);
+        verify(restconfService, times(3)).createConfigurationData(any(CompositeNode.class));
+        post(uri, null, MediaType.APPLICATION_XML, xmlData);
+        verify(restconfService, times(4)).createConfigurationData(any(CompositeNode.class));
+        post(uri, null, MediaType.TEXT_XML, xmlData);
+        verify(restconfService, times(5)).createConfigurationData(any(CompositeNode.class));
+        post(uri, "fooMediaType", MediaType.TEXT_XML, xmlData);
+        verify(restconfService, times(6)).createConfigurationData(any(CompositeNode.class));
+    }
+    
+    @Test
+    public void testDeleteConfigMediaTypes() throws UnsupportedEncodingException {
+        String uriPrefix = "/config/";
+        String uriPath = "ietf-interfaces:interfaces";
+        String uri = createUri(uriPrefix, uriPath);
+        when(restconfService.deleteConfigurationData(eq(uriPath))).thenReturn(null);
+        target(uri).request("fooMediaType").delete();
+        verify(restconfService, times(1)).deleteConfigurationData(uriPath);
+    }
+    
+    private int get(String uri, String acceptMediaType) {
+        return target(uri).request(acceptMediaType).get().getStatus();
+    }
+    
+    private int put(String uri, String acceptMediaType, String contentTypeMediaType, String data) {
+        if (acceptMediaType == null) {
+            return target(uri).request().put(Entity.entity(data, contentTypeMediaType)).getStatus();
+        }
+        return target(uri).request(acceptMediaType).put(Entity.entity(data, contentTypeMediaType)).getStatus();
+    }
+    
+    private int post(String uri, String acceptMediaType, String contentTypeMediaType, String data) {
+        if (acceptMediaType == null) {
+            if (contentTypeMediaType == null || data == null) {
+                return target(uri).request().post(null).getStatus();
+            }
+            return target(uri).request().post(Entity.entity(data, contentTypeMediaType)).getStatus();
+        }
+        if (contentTypeMediaType == null || data == null) {
+            return target(uri).request(acceptMediaType).post(null).getStatus();
+        }
+        return target(uri).request(acceptMediaType).post(Entity.entity(data, contentTypeMediaType)).getStatus();
+    }
+
+}
index dccf0d3bae3dd17076dc3a1763b6ca8f4ad4252f..c6d0a93a6f382ddcda217ae5dbae136a123c5b22 100644 (file)
@@ -73,7 +73,8 @@ public class RestConfigDataTest extends JerseyTest {
         restconfImpl.setControllerContext(controllerContext);
     }
 
-    @Test
+//    @Test
+    // TODO 
     public void createConfigurationDataTest() throws UnsupportedEncodingException, ParseException {
         initMocking();
         String URI_1 = createUri("/config", "");
@@ -141,7 +142,8 @@ public class RestConfigDataTest extends JerseyTest {
         assertEquals("Bad format URI", identifier, instanceIdCaptor.getValue().getPath().toString());
     }
     
-    @Test
+//    @Test
+    // TODO
     public void testExistingData() throws UnsupportedEncodingException {
         initMocking();
         String URI_1 = createUri("/config", "");
index 814c8a3c64f77bb086abf203196245debe877a94..4b36d6353905ee341f1c5fa07d4b9a8a5114faec 100644 (file)
@@ -11,7 +11,6 @@ import java.io.FileNotFoundException;
 import java.io.UnsupportedEncodingException;
 import java.util.Set;
 import java.util.concurrent.Future;
-import java.util.logging.Level;
 
 import javax.ws.rs.core.Application;
 import javax.ws.rs.core.MediaType;
@@ -19,7 +18,6 @@ import javax.ws.rs.core.Response;
 
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
-import org.glassfish.jersey.test.TestProperties;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
@@ -38,7 +36,6 @@ public class RestDeleteOperationTest extends JerseyTest {
     private static ControllerContext controllerContext;
     private static BrokerFacade brokerFacade;
     private static RestconfImpl restconfImpl;
-    private static final MediaType MEDIA_TYPE_DRAFT02 = new MediaType("application", "yang.data+xml");
 
     @BeforeClass
     public static void init() throws FileNotFoundException {
@@ -56,13 +53,10 @@ public class RestDeleteOperationTest extends JerseyTest {
     @Override
     protected Application configure() {
         /* enable/disable Jersey logs to console */
-        /*
-         * enable(TestProperties.LOG_TRAFFIC);
-         */
-        enable(TestProperties.DUMP_ENTITY);
-        enable(TestProperties.RECORD_LOG_LEVEL);
-        set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue());
-
+//        enable(TestProperties.LOG_TRAFFIC);
+//        enable(TestProperties.DUMP_ENTITY);
+//        enable(TestProperties.RECORD_LOG_LEVEL);
+//        set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue());
         ResourceConfig resourceConfig = new ResourceConfig();
         resourceConfig = resourceConfig.registerInstances(restconfImpl, StructuredDataToXmlProvider.INSTANCE,
                 XmlToCompositeNodeProvider.INSTANCE);
@@ -70,24 +64,22 @@ public class RestDeleteOperationTest extends JerseyTest {
     }
 
     @Test
-    public void testDeleteConfigurationData() throws UnsupportedEncodingException, FileNotFoundException {
-        String uri2 = createUri("/config/", "test-interface:interfaces");
-
-        RpcResult<TransactionStatus> rpcResult = new DummyRpcResult.Builder<TransactionStatus>().result(
-                TransactionStatus.COMMITED).build();
-        Future<RpcResult<TransactionStatus>> dummyFuture = DummyFuture.builder().rpcResult(rpcResult).build();
+    public void deleteConfigStatusCodes() throws UnsupportedEncodingException {
+        String uri = createUri("/config/", "test-interface:interfaces");
+        Future<RpcResult<TransactionStatus>> dummyFuture = createFuture(TransactionStatus.COMMITED);
         when(brokerFacade.commitConfigurationDataDelete(any(InstanceIdentifier.class))).thenReturn(dummyFuture);
-
-        Response response = target(uri2).request(MEDIA_TYPE_DRAFT02).delete();
+        Response response = target(uri).request(MediaType.APPLICATION_XML).delete();
         assertEquals(200, response.getStatus());
-
-        rpcResult = new DummyRpcResult.Builder<TransactionStatus>().result(TransactionStatus.FAILED).build();
-        dummyFuture = DummyFuture.builder().rpcResult(rpcResult).build();
-
+        
+        dummyFuture = createFuture(TransactionStatus.FAILED);
         when(brokerFacade.commitConfigurationDataDelete(any(InstanceIdentifier.class))).thenReturn(dummyFuture);
-
-        response = target(uri2).request(MEDIA_TYPE_DRAFT02).delete();
+        response = target(uri).request(MediaType.APPLICATION_XML).delete();
         assertEquals(500, response.getStatus());
     }
+    
+    private Future<RpcResult<TransactionStatus>> createFuture(TransactionStatus statusName) {
+        RpcResult<TransactionStatus> rpcResult = new DummyRpcResult.Builder<TransactionStatus>().result(statusName).build();
+        return DummyFuture.builder().rpcResult(rpcResult).build();
+    }
 
 }
index d997a8afb19d60854f58bb2802ee4f5ad850da61..ebc8a09f151adccaf9916c5d8a0062c9a2eef7bb 100644 (file)
@@ -4,7 +4,6 @@ import static org.junit.Assert.assertEquals;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.JSON;
 import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.XML;
 import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.createUri;
 
@@ -14,7 +13,6 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.logging.Level;
 
 import javax.ws.rs.core.Application;
 import javax.ws.rs.core.MediaType;
@@ -22,14 +20,11 @@ import javax.ws.rs.core.Response;
 
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
-import org.glassfish.jersey.test.TestProperties;
-import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.opendaylight.controller.sal.core.api.mount.MountInstance;
 import org.opendaylight.controller.sal.core.api.mount.MountService;
-import org.opendaylight.controller.sal.rest.api.Draft01;
 import org.opendaylight.controller.sal.rest.api.Draft02;
-import org.opendaylight.controller.sal.rest.api.RestconfService;
 import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider;
 import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider;
 import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider;
@@ -50,6 +45,7 @@ public class RestGetOperationTest extends JerseyTest {
     private static RestconfImpl restconfImpl;
     private static SchemaContext schemaContextYangsIetf;
     private static SchemaContext schemaContextTestModule;
+    private static CompositeNode answerFromGet;
 
     @BeforeClass
     public static void init() throws FileNotFoundException {
@@ -61,27 +57,16 @@ public class RestGetOperationTest extends JerseyTest {
         restconfImpl = RestconfImpl.getInstance();
         restconfImpl.setBroker(brokerFacade);
         restconfImpl.setControllerContext(controllerContext);
-    }
-
-    @Before
-    public void logs() {
-        /* enable/disable Jersey logs to console */
-        /*
-         * List<LogRecord> loggedRecords = getLoggedRecords(); for (LogRecord l
-         * : loggedRecords) { System.out.println(l.getMessage()); }
-         */
+        answerFromGet = prepareCompositeNodeWithIetfInterfacesInterfacesData();
     }
 
     @Override
     protected Application configure() {
         /* enable/disable Jersey logs to console */
-        /*
-         * enable(TestProperties.LOG_TRAFFIC);
-         */
-        enable(TestProperties.DUMP_ENTITY);
-        enable(TestProperties.RECORD_LOG_LEVEL);
-        set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue());
-
+//        enable(TestProperties.LOG_TRAFFIC);
+//        enable(TestProperties.DUMP_ENTITY);
+//        enable(TestProperties.RECORD_LOG_LEVEL);
+//        set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue());
         ResourceConfig resourceConfig = new ResourceConfig();
         resourceConfig = resourceConfig.registerInstances(restconfImpl, StructuredDataToXmlProvider.INSTANCE,
                 StructuredDataToJsonProvider.INSTANCE, XmlToCompositeNodeProvider.INSTANCE,
@@ -90,184 +75,76 @@ public class RestGetOperationTest extends JerseyTest {
     }
 
     /**
-     * Tests {@link RestconfImpl#readData() readAllData()} method of
-     * RestconfImpl with url {@code "/datastore/ identifier}"}. Status codes 200
-     * is tested.
+     * Tests of status codes for "/datastore/{identifier}".
      */
     @Test
-    public void getDatastoreDataViaUrlTest200() throws FileNotFoundException, UnsupportedEncodingException {
+    public void getDatastoreStatusCodes() throws FileNotFoundException, UnsupportedEncodingException {
         mockReadOperationalDataMethod();
-        getDataWithUrl("/datastore/", Draft01.MediaTypes.DATA + JSON, 200);
-        getDataWithUrl("/datastore/", Draft01.MediaTypes.DATA + XML, 200);
-        getDataWithUrl("/datastore/", MediaType.APPLICATION_JSON, 200);
-        getDataWithUrl("/datastore/", MediaType.APPLICATION_XML, 200);
-        getDataWithUrl("/datastore/", MediaType.TEXT_XML, 200);
-    }
-
-    /**
-     * Tests {@link RestconfImpl#readData() readAllData()} method of
-     * RestconfImpl with url {@code "/datastore/ identifier}"}. Status codes 400
-     * is tested.
-     */
-    @Test
-    public void getDatastoreDataViaUrlTest400() throws FileNotFoundException, UnsupportedEncodingException {
-        mockReadOperationalDataMethod();
-        getDataWithUrl("/datastore/", Draft01.MediaTypes.DATA + JSON, 400);
-        getDataWithUrl("/datastore/", Draft01.MediaTypes.DATA + XML, 400);
-        getDataWithUrl("/datastore/", MediaType.APPLICATION_JSON, 400);
-        getDataWithUrl("/datastore/", MediaType.APPLICATION_XML, 400);
-        getDataWithUrl("/datastore/", MediaType.TEXT_XML, 400);
-    }
-
-    /**
-     * Tests {@link RestconfImpl#readOperationalData(String)
-     * readOperationalData(String)} method of RestconfImpl with url
-     * {@code "/operational/...identifier..."}. Status codes 200 is tested.
-     */
-    @Test
-    public void getOperationalDataViaUrl200() throws UnsupportedEncodingException {
-        mockReadOperationalDataMethod();
-        getDataWithUrl("/operational/", Draft02.MediaTypes.DATA + JSON, 200);
-        getDataWithUrl("/operational/", Draft02.MediaTypes.DATA + XML, 200);
-        getDataWithUrl("/operational/", MediaType.APPLICATION_JSON, 200);
-        getDataWithUrl("/operational/", MediaType.APPLICATION_XML, 200);
-        getDataWithUrl("/operational/", MediaType.TEXT_XML, 200);
+        String uri = createUri("/datastore/", "ietf-interfaces:interfaces/interface/eth0");
+        assertEquals(200, get(uri, MediaType.APPLICATION_XML));
+        
+        uri = createUri("/datastore/", "wrong-module:interfaces/interface/eth0");
+        assertEquals(400, get(uri, MediaType.APPLICATION_XML));
+        
+        // Test of request for not existing data. Returning status code 404
+        uri = createUri("/datastore/", "ietf-interfaces:interfaces/interface/eth0");
+        when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(null);
+        assertEquals(404, get(uri, MediaType.APPLICATION_XML));
     }
 
     /**
-     * Tests {@link RestconfImpl#readOperationalData(String)
-     * readOperationalData(String)} method of RestconfImpl with url
-     * {@code "/operational/...identifier..."}. Status codes 400 is tested.
+     * Tests of status codes for "/operational/{identifier}".
      */
     @Test
-    public void getOperationalDataViaUrl400() throws UnsupportedEncodingException {
+    public void getOperationalStatusCodes() throws UnsupportedEncodingException {
         mockReadOperationalDataMethod();
-        getDataWithUrl("/operational/", Draft02.MediaTypes.DATA + JSON, 400);
-        getDataWithUrl("/operational/", Draft02.MediaTypes.DATA + XML, 400);
-        getDataWithUrl("/operational/", MediaType.APPLICATION_JSON, 400);
-        getDataWithUrl("/operational/", MediaType.APPLICATION_XML, 400);
-        getDataWithUrl("/operational/", MediaType.TEXT_XML, 400);
-    }
-
-    /**
-     * Tests {@link RestconfImpl#readOperationalData
-     * #readConfigurationData(String) readConfigurationData(String)} method of
-     * RestconfImpl with url {@code "/config/...identifier..."}. Status codes
-     * 200 is tested.
-     */
-    @Test
-    public void getConfigDataViaUrl200() throws UnsupportedEncodingException {
-        mockReadConfigurationDataMethod();
-        getDataWithUrl("/config/", Draft02.MediaTypes.DATA + JSON, 200);
-        getDataWithUrl("/config/", Draft02.MediaTypes.DATA + XML, 200);
-        getDataWithUrl("/config/", MediaType.APPLICATION_JSON, 200);
-        getDataWithUrl("/config/", MediaType.APPLICATION_XML, 200);
-        getDataWithUrl("/config/", MediaType.TEXT_XML, 200);
+        String uri = createUri("/operational/", "ietf-interfaces:interfaces/interface/eth0");
+        assertEquals(200, get(uri, MediaType.APPLICATION_XML));
+        
+        uri = createUri("/operational/", "wrong-module:interfaces/interface/eth0");
+        assertEquals(400, get(uri, MediaType.APPLICATION_XML));
     }
 
     /**
-     * Tests {@link RestconfImpl#readOperationalData
-     * #readConfigurationData(String) readConfigurationData(String)} method of
-     * RestconfImpl with url {@code "/config/...identifier..."}. Status codes
-     * 400 is tested.
+     * Tests of status codes for "/config/{identifier}".
      */
     @Test
-    public void getConfigDataViaUrl400() throws UnsupportedEncodingException {
+    public void getConfigStatusCodes() throws UnsupportedEncodingException {
         mockReadConfigurationDataMethod();
-        getDataWithUrl("/config/", Draft02.MediaTypes.DATA + JSON, 400);
-        getDataWithUrl("/config/", Draft02.MediaTypes.DATA + XML, 400);
-        getDataWithUrl("/config/", MediaType.APPLICATION_JSON, 400);
-        getDataWithUrl("/config/", MediaType.APPLICATION_XML, 400);
-        getDataWithUrl("/config/", MediaType.TEXT_XML, 400);
-    }
-
-    /**
-     * Tests {@link RestconfImpl#readAllData() readAllData()} method of
-     * RestconfImpl with url {@code "/datastore"}. Currently the method isn't
-     * supported so it returns 500
-     */
-    @Test
-    public void getDatastoreDataAllTest500() throws UnsupportedEncodingException {
-        getDatastoreAllDataTest(Draft01.MediaTypes.DATASTORE + XML);
-        getDatastoreAllDataTest(Draft01.MediaTypes.DATASTORE + JSON);
-    }
-
-    /**
-     * 
-     * Tests {@link RestconfImpl#getModules getModules} method of RestconfImpl
-     * with uri {@code "/modules"}. Currently the method isn't supported so it
-     * returns 500
-     */
-    @Test
-    public void getModulesDataTest500() throws UnsupportedEncodingException {
-        getModulesDataTest(Draft01.MediaTypes.API + JSON);
-        getModulesDataTest(Draft01.MediaTypes.API + XML);
-        getModulesDataTest(Draft02.MediaTypes.API + JSON);
-        getModulesDataTest(Draft02.MediaTypes.API + XML);
-    }
-
-    /**
-     * Test of request for not existing data. Returning status code 404
-     */
-    @Test
-    public void getDataWithUrlNoExistingDataTest404() throws UnsupportedEncodingException, URISyntaxException {
-        String uri = createUri("/datastore/", "ietf-interfaces:interfaces/interface/eth0");
-
-        when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(null);
-
-        Response response = target(uri).request(Draft01.MediaTypes.DATA + RestconfService.XML).get();
-        assertEquals(404, response.getStatus());
+        String uri = createUri("/config/", "ietf-interfaces:interfaces/interface/eth0");
+        assertEquals(200, get(uri, MediaType.APPLICATION_XML));
+        
+        uri = createUri("/config/", "wrong-module:interfaces/interface/eth0");
+        assertEquals(400, get(uri, MediaType.APPLICATION_XML));
     }
 
     /**
      * MountPoint test. URI represents mount point.
      */
     @Test
-    public void getDataWithUrlMountPoint() throws UnsupportedEncodingException, FileNotFoundException,
-            URISyntaxException {
-        when(brokerFacade.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(
-                prepareCnDataForMountPointTest());
-
+    public void getDataWithUrlMountPoint() throws UnsupportedEncodingException, URISyntaxException {
+        when(brokerFacade.readConfigurationDataBehindMountPoint(any(MountInstance.class),
+                        any(InstanceIdentifier.class))).thenReturn(prepareCnDataForMountPointTest());
+        MountInstance mountInstance = mock(MountInstance.class);
+        when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
         MountService mockMountService = mock(MountService.class);
-
-        when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(
-                new DummyMountInstanceImpl.Builder().setSchemaContext(schemaContextTestModule).build());
+        when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
 
         ControllerContext.getInstance().setMountService(mockMountService);
 
-        String uri = createUri("/config/", "ietf-interfaces:interfaces/interface/0/test-module:cont/cont1");
+        String uri = createUri("/config/",
+                "ietf-interfaces:interfaces/interface/0/yang-ext:mount/test-module:cont/cont1");
         Response response = target(uri).request(Draft02.MediaTypes.DATA + XML).get();
         assertEquals(200, response.getStatus());
+        
+        uri = createUri("/config/",
+                "ietf-interfaces:interfaces/yang-ext:mount/test-module:cont/cont1");
+        response = target(uri).request(Draft02.MediaTypes.DATA + XML).get();
+        assertEquals(200, response.getStatus());
     }
-
-    private void getDataWithUrl(String mediaTypePrefix, String mediaType, int statusCode)
-            throws UnsupportedEncodingException {
-        String uri = null;
-        switch (statusCode) {
-        case 400:
-            uri = createUri(mediaTypePrefix, "wrong-module:interfaces/interface/eth0");
-            break;
-        case 200:
-            uri = createUri(mediaTypePrefix, "ietf-interfaces:interfaces/interface/eth0");
-            break;
-        }
-        Response response = target(uri).request(mediaType).get();
-        assertEquals("Status is incorrect for media type " + mediaType + ".", statusCode, response.getStatus());
-
-    }
-
-    private void getModulesDataTest(String mediaType) throws UnsupportedEncodingException {
-        String uri = createUri("/modules", "");
-        Response response = target(uri).request(mediaType).get();
-
-        assertEquals("Status is incorrect for media type " + mediaType + ".", 500, response.getStatus());
-    }
-
-    private void getDatastoreAllDataTest(String mediaType) throws UnsupportedEncodingException {
-        String uri = createUri("/datastore", "");
-        Response response = target(uri).request(mediaType).get();
-
-        assertEquals(500, response.getStatus());
+    
+    private int get(String uri, String mediaType) {
+        return target(uri).request(mediaType).get().getStatus();
     }
 
     private CompositeNode prepareCnDataForMountPointTest() throws URISyntaxException {
@@ -277,7 +154,15 @@ public class RestGetOperationTest extends JerseyTest {
         return cont1.unwrap();
     }
 
-    private CompositeNode prepareCompositeNodeWithIetfInterfacesInterfacesData() {
+    private void mockReadOperationalDataMethod() {
+        when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(answerFromGet);
+    }
+
+    private void mockReadConfigurationDataMethod() {
+        when(brokerFacade.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(answerFromGet);
+    }
+
+    private static CompositeNode prepareCompositeNodeWithIetfInterfacesInterfacesData() {
         CompositeNode intface;
         try {
             intface = new CompositeNodeWrapper(new URI("interface"), "interface");
@@ -295,13 +180,4 @@ public class RestGetOperationTest extends JerseyTest {
         return null;
     }
 
-    private void mockReadOperationalDataMethod() {
-        CompositeNode loadedCompositeNode = prepareCompositeNodeWithIetfInterfacesInterfacesData();
-        when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(loadedCompositeNode);
-    }
-
-    private void mockReadConfigurationDataMethod() {
-        CompositeNode loadedCompositeNode = prepareCompositeNodeWithIetfInterfacesInterfacesData();
-        when(brokerFacade.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(loadedCompositeNode);
-    }
 }
index 1f0daace70b484690497cbbdee69485053c092e7..186dafb168621cfac851ff3fcfcbd5e0e838570c 100644 (file)
@@ -4,9 +4,6 @@ import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URLEncoder;
 
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.MediaType;
-
 import com.google.common.base.Charsets;
 
 public class RestOperationUtils {
@@ -17,14 +14,6 @@ public class RestOperationUtils {
     private RestOperationUtils() {
     }
 
-    static Entity<String> entity(String data, MediaType mediaType) {
-        return Entity.entity(data, mediaType);
-    }
-
-    static Entity<String> entity(String data, String mediaType) {
-        return Entity.entity(data, mediaType);
-    }
-
     static String createUri(String prefix, String encodedPart) throws UnsupportedEncodingException {
         return URI.create(prefix + URLEncoder.encode(encodedPart, Charsets.US_ASCII.name()).toString()).toASCIIString();
     }
index 9bf6a0f03cd961ed4c03c0cf263bdd3528dacfa3..833d030b920b46f8cdeb039b2ff16b6da70d8da3 100644 (file)
@@ -4,34 +4,27 @@ import static org.junit.Assert.assertEquals;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.JSON;
 import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.XML;
 import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.createUri;
-import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.entity;
 
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.concurrent.Future;
-import java.util.logging.Level;
 
 import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.Application;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
 
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
-import org.glassfish.jersey.test.TestProperties;
-import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.sal.core.api.mount.MountInstance;
 import org.opendaylight.controller.sal.core.api.mount.MountService;
-import org.opendaylight.controller.sal.rest.api.Draft01;
 import org.opendaylight.controller.sal.rest.api.Draft02;
 import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider;
 import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider;
@@ -49,13 +42,9 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 public class RestPostOperationTest extends JerseyTest {
 
-    private static String xmlData;
     private static String xmlDataAbsolutePath;
-    private static String jsonData;
-    private static String jsonDataAbsolutePath;
     private static String xmlDataRpcInput;
     private static CompositeNodeWrapper cnSnDataOutput;
-    private static String jsonDataRpcInput;
     private static String xmlData2;
 
     private static ControllerContext controllerContext;
@@ -76,26 +65,13 @@ public class RestPostOperationTest extends JerseyTest {
         loadData();
     }
 
-    @Before
-    public void logs() throws IOException, URISyntaxException {
-        /* enable/disable Jersey logs to console */
-        /*
-         * List<LogRecord> loggedRecords = getLoggedRecords(); for (LogRecord l
-         * : loggedRecords) { System.out.println(l.getMessage()); }
-         */
-    }
-
     @Override
     protected Application configure() {
         /* enable/disable Jersey logs to console */
-
-        /*
-         * enable(TestProperties.LOG_TRAFFIC);
-         */
-        enable(TestProperties.DUMP_ENTITY);
-        enable(TestProperties.RECORD_LOG_LEVEL);
-        set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue());
-
+//        enable(TestProperties.LOG_TRAFFIC);
+//        enable(TestProperties.DUMP_ENTITY);
+//        enable(TestProperties.RECORD_LOG_LEVEL);
+//        set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue());
         ResourceConfig resourceConfig = new ResourceConfig();
         resourceConfig = resourceConfig.registerInstances(restconfImpl, StructuredDataToXmlProvider.INSTANCE,
                 StructuredDataToJsonProvider.INSTANCE, XmlToCompositeNodeProvider.INSTANCE,
@@ -104,200 +80,88 @@ public class RestPostOperationTest extends JerseyTest {
     }
 
     @Test
-    public void postOperationsDataViaUrl200() throws URISyntaxException, IOException {
-        controllerContext.setSchemas(schemaContextTestModule);
-        postOperationsDataViaUrl(Draft02.MediaTypes.DATA + JSON, cnSnDataOutput, jsonDataRpcInput, 200);
-        postOperationsDataViaUrl(Draft01.MediaTypes.DATA + JSON, cnSnDataOutput, jsonDataRpcInput, 200);
-        postOperationsDataViaUrl(MediaType.APPLICATION_JSON, cnSnDataOutput, jsonDataRpcInput, 200);
-
-        postOperationsDataViaUrl(Draft01.MediaTypes.DATA + XML, cnSnDataOutput, xmlDataRpcInput, 200);
-        postOperationsDataViaUrl(Draft02.MediaTypes.DATA + XML, cnSnDataOutput, xmlDataRpcInput, 200);
-        postOperationsDataViaUrl(MediaType.APPLICATION_XML, cnSnDataOutput, xmlDataRpcInput, 200);
-        postOperationsDataViaUrl(MediaType.TEXT_XML, cnSnDataOutput, xmlDataRpcInput, 200);
-    }
-
-    @Test
-    public void postOperationsDataViaUrl204() throws URISyntaxException, IOException {
-        controllerContext.setSchemas(schemaContextTestModule);
-        postOperationsDataViaUrl(Draft02.MediaTypes.DATA + JSON, cnSnDataOutput, jsonDataRpcInput, 204);
-        postOperationsDataViaUrl(Draft01.MediaTypes.DATA + JSON, cnSnDataOutput, jsonDataRpcInput, 204);
-        postOperationsDataViaUrl(MediaType.APPLICATION_JSON, cnSnDataOutput, jsonDataRpcInput, 204);
-
-        postOperationsDataViaUrl(Draft01.MediaTypes.DATA + XML, cnSnDataOutput, xmlDataRpcInput, 204);
-        postOperationsDataViaUrl(Draft02.MediaTypes.DATA + XML, cnSnDataOutput, xmlDataRpcInput, 204);
-        postOperationsDataViaUrl(MediaType.APPLICATION_XML, cnSnDataOutput, xmlDataRpcInput, 204);
-        postOperationsDataViaUrl(MediaType.TEXT_XML, cnSnDataOutput, xmlDataRpcInput, 204);
-    }
-
-    @Test
-    public void postOperationsDataViaUrl500() throws URISyntaxException, IOException {
-        controllerContext.setSchemas(schemaContextTestModule);
-        postOperationsDataViaUrl(Draft02.MediaTypes.DATA + JSON, cnSnDataOutput, jsonDataRpcInput, 500);
-        postOperationsDataViaUrl(Draft01.MediaTypes.DATA + JSON, cnSnDataOutput, jsonDataRpcInput, 500);
-        postOperationsDataViaUrl(MediaType.APPLICATION_JSON, cnSnDataOutput, jsonDataRpcInput, 500);
-
-        postOperationsDataViaUrl(Draft01.MediaTypes.DATA + XML, cnSnDataOutput, xmlDataRpcInput, 500);
-        postOperationsDataViaUrl(Draft02.MediaTypes.DATA + XML, cnSnDataOutput, xmlDataRpcInput, 500);
-        postOperationsDataViaUrl(MediaType.APPLICATION_XML, cnSnDataOutput, xmlDataRpcInput, 500);
-        postOperationsDataViaUrl(MediaType.TEXT_XML, cnSnDataOutput, xmlDataRpcInput, 500);
-    }
-
-    @Test
-    public void postOperationsDataViaUrl400() throws URISyntaxException, IOException {
-        controllerContext.setSchemas(schemaContextTestModule);
-        postOperationsDataViaUrl(Draft02.MediaTypes.DATA + JSON, cnSnDataOutput, jsonDataRpcInput, 400);
-        postOperationsDataViaUrl(Draft01.MediaTypes.DATA + JSON, cnSnDataOutput, jsonDataRpcInput, 400);
-        postOperationsDataViaUrl(MediaType.APPLICATION_JSON, cnSnDataOutput, jsonDataRpcInput, 400);
-
-        postOperationsDataViaUrl(Draft01.MediaTypes.DATA + XML, cnSnDataOutput, xmlDataRpcInput, 400);
-        postOperationsDataViaUrl(Draft02.MediaTypes.DATA + XML, cnSnDataOutput, xmlDataRpcInput, 400);
-        postOperationsDataViaUrl(MediaType.APPLICATION_XML, cnSnDataOutput, xmlDataRpcInput, 400);
-        postOperationsDataViaUrl(MediaType.TEXT_XML, cnSnDataOutput, xmlDataRpcInput, 400);
-    }
-
-    @Test
-    public void postOperationsDataViaUrl404() throws URISyntaxException, IOException {
+    public void postOperationsStatusCodes() throws UnsupportedEncodingException {
         controllerContext.setSchemas(schemaContextTestModule);
-        postOperationsDataViaUrl(Draft02.MediaTypes.DATA + JSON, cnSnDataOutput, jsonDataRpcInput, 404);
-        postOperationsDataViaUrl(Draft01.MediaTypes.DATA + JSON, cnSnDataOutput, jsonDataRpcInput, 404);
-        postOperationsDataViaUrl(MediaType.APPLICATION_JSON, cnSnDataOutput, jsonDataRpcInput, 404);
-
-        postOperationsDataViaUrl(Draft01.MediaTypes.DATA + XML, cnSnDataOutput, xmlDataRpcInput, 404);
-        postOperationsDataViaUrl(Draft02.MediaTypes.DATA + XML, cnSnDataOutput, xmlDataRpcInput, 404);
-        postOperationsDataViaUrl(MediaType.APPLICATION_XML, cnSnDataOutput, xmlDataRpcInput, 404);
-        postOperationsDataViaUrl(MediaType.TEXT_XML, cnSnDataOutput, xmlDataRpcInput, 404);
+        mockInvokeRpc(cnSnDataOutput, true);
+        String uri = createUri("/operations/", "test-module:rpc-test");
+        assertEquals(200, post(uri, MediaType.APPLICATION_XML, xmlDataRpcInput));
+        
+        mockInvokeRpc(null, true);
+        assertEquals(204, post(uri, MediaType.APPLICATION_XML, xmlDataRpcInput));
+        
+        mockInvokeRpc(null, false);
+        assertEquals(500, post(uri, MediaType.APPLICATION_XML, xmlDataRpcInput));
+        
+        uri = createUri("/operations/", "test-module:rpc-wrongtest");
+        assertEquals(404, post(uri, MediaType.APPLICATION_XML, xmlDataRpcInput));
     }
 
     @Test
-    public void postConfigDataViaUrlConfigOnlyTest204() throws UnsupportedEncodingException, FileNotFoundException {
+    public void postConfigOnlyStatusCodes() throws UnsupportedEncodingException {
         controllerContext.setSchemas(schemaContextYangsIetf);
         mockCommitConfigurationDataPostMethod(TransactionStatus.COMMITED);
-        postDataViaUrlTest("/config", "", Draft02.MediaTypes.DATA + JSON, jsonDataAbsolutePath, 204);
-        postDataViaUrlTest("/config", "", Draft02.MediaTypes.DATA + XML, xmlDataAbsolutePath, 204);
-        postDataViaUrlTest("/config", "", MediaType.APPLICATION_JSON, jsonDataAbsolutePath, 204);
-        postDataViaUrlTest("/config", "", MediaType.APPLICATION_XML, xmlDataAbsolutePath, 204);
-        postDataViaUrlTest("/config", "", MediaType.TEXT_XML, xmlDataAbsolutePath, 204);
-    }
-
-    @Test
-    public void postConfigDataViaUrlConfigOnlyTest202() throws UnsupportedEncodingException, FileNotFoundException {
-        controllerContext.setSchemas(schemaContextYangsIetf);
+        String uri = createUri("/config", "");
+        assertEquals(204, post(uri, MediaType.APPLICATION_XML, xmlDataAbsolutePath));
+        
         mockCommitConfigurationDataPostMethod(null);
-        postDataViaUrlTest("/config", "", Draft02.MediaTypes.DATA + JSON, jsonDataAbsolutePath, 202);
-        postDataViaUrlTest("/config", "", Draft02.MediaTypes.DATA + XML, xmlDataAbsolutePath, 202);
-        postDataViaUrlTest("/config", "", MediaType.APPLICATION_JSON, jsonDataAbsolutePath, 202);
-        postDataViaUrlTest("/config", "", MediaType.APPLICATION_XML, xmlDataAbsolutePath, 202);
-        postDataViaUrlTest("/config", "", MediaType.TEXT_XML, xmlDataAbsolutePath, 202);
-    }
-
-    @Test
-    public void postConfigDataViaUrlConfigOnlyTest500() throws UnsupportedEncodingException, FileNotFoundException {
-        controllerContext.setSchemas(schemaContextYangsIetf);
+        assertEquals(202, post(uri, MediaType.APPLICATION_XML, xmlDataAbsolutePath));
+        
         mockCommitConfigurationDataPostMethod(TransactionStatus.FAILED);
-        postDataViaUrlTest("/config", "", Draft02.MediaTypes.DATA + JSON, jsonDataAbsolutePath, 500);
-        postDataViaUrlTest("/config", "", Draft02.MediaTypes.DATA + XML, xmlDataAbsolutePath, 500);
-        postDataViaUrlTest("/config", "", MediaType.APPLICATION_JSON, jsonDataAbsolutePath, 500);
-        postDataViaUrlTest("/config", "", MediaType.APPLICATION_XML, xmlDataAbsolutePath, 500);
-        postDataViaUrlTest("/config", "", MediaType.TEXT_XML, xmlDataAbsolutePath, 500);
+        assertEquals(500, post(uri, MediaType.APPLICATION_XML, xmlDataAbsolutePath));
     }
 
     @Test
-    public void postConfigDataViaUrlTest204() throws UnsupportedEncodingException {
+    public void postConfigStatusCodes() throws UnsupportedEncodingException {
         controllerContext.setSchemas(schemaContextYangsIetf);
         mockCommitConfigurationDataPostMethod(TransactionStatus.COMMITED);
-        String urlPath = "ietf-interfaces:interfaces";
-        postDataViaUrlTest("/config/", urlPath, Draft02.MediaTypes.DATA + JSON, jsonData, 204);
-        postDataViaUrlTest("/config/", urlPath, Draft02.MediaTypes.DATA + XML, xmlData, 204);
-        postDataViaUrlTest("/config/", urlPath, MediaType.APPLICATION_JSON, jsonData, 204);
-        postDataViaUrlTest("/config/", urlPath, MediaType.APPLICATION_XML, xmlData, 204);
-        postDataViaUrlTest("/config/", urlPath, MediaType.TEXT_XML, xmlData, 204);
-    }
-
-    @Test
-    public void postConfigDataViaUrlTest202() throws UnsupportedEncodingException {
-        controllerContext.setSchemas(schemaContextYangsIetf);
+        String uri = createUri("/config/", "ietf-interfaces:interfaces");
+        assertEquals(204, post(uri, MediaType.APPLICATION_XML, xmlDataAbsolutePath));
+        
         mockCommitConfigurationDataPostMethod(null);
-        String urlPath = "ietf-interfaces:interfaces";
-        postDataViaUrlTest("/config/", urlPath, Draft02.MediaTypes.DATA + JSON, jsonData, 202);
-        postDataViaUrlTest("/config/", urlPath, Draft02.MediaTypes.DATA + XML, xmlData, 202);
-        postDataViaUrlTest("/config/", urlPath, MediaType.APPLICATION_JSON, jsonData, 202);
-        postDataViaUrlTest("/config/", urlPath, MediaType.APPLICATION_XML, xmlData, 202);
-        postDataViaUrlTest("/config/", urlPath, MediaType.TEXT_XML, xmlData, 202);
-    }
-
-    @Test
-    public void postConfigDataViaUrlTest500() throws UnsupportedEncodingException {
-        controllerContext.setSchemas(schemaContextYangsIetf);
+        assertEquals(202, post(uri, MediaType.APPLICATION_XML, xmlDataAbsolutePath));
+        
         mockCommitConfigurationDataPostMethod(TransactionStatus.FAILED);
-        String urlPath = "ietf-interfaces:interfaces";
-        postDataViaUrlTest("/config/", urlPath, Draft02.MediaTypes.DATA + JSON, jsonData, 500);
-        postDataViaUrlTest("/config/", urlPath, Draft02.MediaTypes.DATA + XML, xmlData, 500);
-        postDataViaUrlTest("/config/", urlPath, MediaType.APPLICATION_JSON, jsonData, 500);
-        postDataViaUrlTest("/config/", urlPath, MediaType.APPLICATION_XML, xmlData, 500);
-        postDataViaUrlTest("/config/", urlPath, MediaType.TEXT_XML, xmlData, 500);
+        assertEquals(500, post(uri, MediaType.APPLICATION_XML, xmlDataAbsolutePath));
     }
 
     @Test
-    public void postDatastoreDataViaUrlTest204() throws UnsupportedEncodingException {
+    public void postDatastoreStatusCodes() throws UnsupportedEncodingException {
         controllerContext.setSchemas(schemaContextYangsIetf);
         mockCommitConfigurationDataPostMethod(TransactionStatus.COMMITED);
-        String urlPath = "ietf-interfaces:interfaces";
-        postDataViaUrlTest("/datastore/", urlPath, Draft01.MediaTypes.DATA + JSON, jsonData, 204);
-        postDataViaUrlTest("/datastore/", urlPath, Draft01.MediaTypes.DATA + XML, xmlData, 204);
-        postDataViaUrlTest("/datastore/", urlPath, MediaType.APPLICATION_JSON, jsonData, 204);
-        postDataViaUrlTest("/datastore/", urlPath, MediaType.APPLICATION_XML, xmlData, 204);
-        postDataViaUrlTest("/datastore/", urlPath, MediaType.TEXT_XML, xmlData, 204);
-    }
-
-    @Test
-    public void postDatastoreDataViaUrlTest202() throws UnsupportedEncodingException {
-        controllerContext.setSchemas(schemaContextYangsIetf);
+        String uri = createUri("/datastore/", "ietf-interfaces:interfaces");
+        assertEquals(204, post(uri, MediaType.APPLICATION_XML, xmlDataAbsolutePath));
+        
         mockCommitConfigurationDataPostMethod(null);
-        String urlPath = "ietf-interfaces:interfaces";
-        postDataViaUrlTest("/datastore/", urlPath, Draft01.MediaTypes.DATA + JSON, jsonData, 202);
-        postDataViaUrlTest("/datastore/", urlPath, Draft01.MediaTypes.DATA + XML, xmlData, 202);
-        postDataViaUrlTest("/datastore/", urlPath, MediaType.APPLICATION_JSON, jsonData, 202);
-        postDataViaUrlTest("/datastore/", urlPath, MediaType.APPLICATION_XML, xmlData, 202);
-        postDataViaUrlTest("/datastore/", urlPath, MediaType.TEXT_XML, xmlData, 202);
-    }
-
-    @Test
-    public void postDatastoreDataViaUrlTest500() throws UnsupportedEncodingException {
-        controllerContext.setSchemas(schemaContextYangsIetf);
+        assertEquals(202, post(uri, MediaType.APPLICATION_XML, xmlDataAbsolutePath));
+        
         mockCommitConfigurationDataPostMethod(TransactionStatus.FAILED);
-        String urlPath = "ietf-interfaces:interfaces";
-        postDataViaUrlTest("/datastore/", urlPath, Draft01.MediaTypes.DATA + JSON, jsonData, 500);
-        postDataViaUrlTest("/datastore/", urlPath, Draft01.MediaTypes.DATA + XML, xmlData, 500);
-        postDataViaUrlTest("/datastore/", urlPath, MediaType.APPLICATION_JSON, jsonData, 500);
-        postDataViaUrlTest("/datastore/", urlPath, MediaType.APPLICATION_XML, xmlData, 500);
-        postDataViaUrlTest("/datastore/", urlPath, MediaType.TEXT_XML, xmlData, 500);
+        assertEquals(500, post(uri, MediaType.APPLICATION_XML, xmlDataAbsolutePath));
     }
 
     @Test
     public void postDataViaUrlMountPoint() throws UnsupportedEncodingException {
         controllerContext.setSchemas(schemaContextYangsIetf);
-        mockCommitConfigurationDataPostMethod(TransactionStatus.COMMITED);
+        RpcResult<TransactionStatus> rpcResult = new DummyRpcResult.Builder<TransactionStatus>().result(TransactionStatus.COMMITED)
+                .build();
+        Future<RpcResult<TransactionStatus>> dummyFuture = DummyFuture.builder().rpcResult(rpcResult).build();
+        when(brokerFacade.commitConfigurationDataPostBehindMountPoint(any(MountInstance.class),
+                        any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
 
+        MountInstance mountInstance = mock(MountInstance.class);
+        when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
         MountService mockMountService = mock(MountService.class);
-        SchemaContext otherSchemaContext = schemaContextTestModule;
-        when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(
-                new DummyMountInstanceImpl.Builder().setSchemaContext(otherSchemaContext).build());
+        when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
 
         ControllerContext.getInstance().setMountService(mockMountService);
 
-        String uri = createUri("/config/", "ietf-interfaces:interfaces/interface/0/test-module:cont/cont1");
-        Response response = target(uri).request(Draft02.MediaTypes.DATA + XML).post(
-                entity(xmlData2, Draft02.MediaTypes.DATA + XML));
-        // 204 code is returned when COMMITED transaction status is put as input
-        // to mock method
-        assertEquals(204, response.getStatus());
+        String uri = createUri("/config/", "ietf-interfaces:interfaces/interface/0/yang-ext:mount/test-module:cont/cont1");
+        assertEquals(204, post(uri, Draft02.MediaTypes.DATA + XML, xmlData2));
     }
-
-    private void postDataViaUrlTest(String urlPrefix, String urlPath, String mediaType, String data, int responseStatus)
-            throws UnsupportedEncodingException {
-        String url = createUri(urlPrefix, urlPath);
-        Response response = target(url).request(mediaType).post(entity(data, mediaType));
-        assertEquals(responseStatus, response.getStatus());
+    
+    private void mockInvokeRpc(CompositeNode result, boolean sucessful) {
+        RpcResult<CompositeNode> rpcResult = new DummyRpcResult.Builder<CompositeNode>().result(result)
+                .isSuccessful(sucessful).build();
+        when(brokerFacade.invokeRpc(any(QName.class), any(CompositeNode.class))).thenReturn(rpcResult);
     }
 
     private void mockCommitConfigurationDataPostMethod(TransactionStatus statusName) {
@@ -313,72 +177,27 @@ public class RestPostOperationTest extends JerseyTest {
         when(brokerFacade.commitConfigurationDataPost(any(InstanceIdentifier.class), any(CompositeNode.class)))
                 .thenReturn(dummyFuture);
     }
-
-    private static CompositeNodeWrapper prepareCnSnRpcOutput() throws URISyntaxException {
-        CompositeNodeWrapper cnSnDataOutput = new CompositeNodeWrapper(new URI("test:module"), "output");
-        CompositeNodeWrapper cont = new CompositeNodeWrapper(new URI("test:module"), "cont-output");
-        cnSnDataOutput.addValue(cont);
-        cnSnDataOutput.unwrap();
-        return cnSnDataOutput;
-    }
-
-    private void mockInvokeRpc(CompositeNode compositeNode, boolean sucessful) {
-        RpcResult<CompositeNode> rpcResult = new DummyRpcResult.Builder<CompositeNode>().result(compositeNode)
-                .isSuccessful(sucessful).build();
-        when(brokerFacade.invokeRpc(any(QName.class), any(CompositeNode.class))).thenReturn(rpcResult);
-    }
-
-    private void postOperationsDataViaUrl(String mediaType, CompositeNode cnSnDataOut, String dataIn, int statusCode)
-            throws FileNotFoundException, UnsupportedEncodingException {
-        String url = createUri("/operations/", "test-module:rpc-test");
-        Response response = null;
-        switch (statusCode) {
-        case 200:
-            mockInvokeRpc(cnSnDataOut, true);
-            break;
-        case 204:
-            mockInvokeRpc(null, true);
-            break;
-        case 500:
-            mockInvokeRpc(null, false);
-            break;
-        case 400:
-            response = target(url).request(mediaType).post(Entity.entity("{}", mediaType));
-            break;
-        case 404:
-            url = createUri("/operations/", "test-module:rpc-wrongtest");
-            break;
-        }
-        response = response == null ? target(url).request(mediaType).post(Entity.entity(dataIn, mediaType)) : response;
-        assertEquals(statusCode, response.getStatus());
+    
+    private int post(String uri, String mediaType, String data) {
+        return target(uri).request(mediaType).post(Entity.entity(data, mediaType)).getStatus();
     }
 
     private static void loadData() throws IOException, URISyntaxException {
-
-        InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/parts/ietf-interfaces_interfaces.xml");
-        xmlData = TestUtils.getDocumentInPrintableForm(TestUtils.loadDocumentFrom(xmlStream));
-
-        xmlStream = RestconfImplTest.class.getResourceAsStream("/parts/ietf-interfaces_interfaces_absolute_path.xml");
+        InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/parts/ietf-interfaces_interfaces_absolute_path.xml");
         xmlDataAbsolutePath = TestUtils.getDocumentInPrintableForm(TestUtils.loadDocumentFrom(xmlStream));
-
-        String jsonPath = RestconfImplTest.class.getResource("/parts/ietf-interfaces_interfaces.json").getPath();
-        jsonData = TestUtils.loadTextFile(jsonPath);
-
-        String jsonFullPath = RestconfImplTest.class
-                .getResource("/parts/ietf-interfaces_interfaces_absolute_path.json").getPath();
-        jsonDataAbsolutePath = TestUtils.loadTextFile(jsonFullPath);
-
         String xmlPathRpcInput = RestconfImplTest.class.getResource("/full-versions/test-data2/data-rpc-input.xml")
                 .getPath();
         xmlDataRpcInput = TestUtils.loadTextFile(xmlPathRpcInput);
         cnSnDataOutput = prepareCnSnRpcOutput();
-
-        String jsonPathToRpcInput = RestconfImplTest.class.getResource("/full-versions/test-data2/data-rpc-input.json")
-                .getPath();
-        jsonDataRpcInput = TestUtils.loadTextFile(jsonPathToRpcInput);
-
         String data2Input = RestconfImplTest.class.getResource("/full-versions/test-data2/data2.xml").getPath();
         xmlData2 = TestUtils.loadTextFile(data2Input);
+    }
 
+    private static CompositeNodeWrapper prepareCnSnRpcOutput() throws URISyntaxException {
+        CompositeNodeWrapper cnSnDataOutput = new CompositeNodeWrapper(new URI("test:module"), "output");
+        CompositeNodeWrapper cont = new CompositeNodeWrapper(new URI("test:module"), "cont-output");
+        cnSnDataOutput.addValue(cont);
+        cnSnDataOutput.unwrap();
+        return cnSnDataOutput;
     }
 }
index 2bef9ba4ef221a93004b60479134cbf6cb1f5658..2df68af62f71e1aa89e0654fe1184c67ede23795 100644 (file)
@@ -4,10 +4,8 @@ import static org.junit.Assert.assertEquals;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.JSON;
 import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.XML;
 import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.createUri;
-import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.entity;
 
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -15,7 +13,6 @@ import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URISyntaxException;
 import java.util.concurrent.Future;
-import java.util.logging.Level;
 
 import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.Application;
@@ -24,13 +21,11 @@ import javax.ws.rs.core.Response;
 
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
-import org.glassfish.jersey.test.TestProperties;
-import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.sal.core.api.mount.MountInstance;
 import org.opendaylight.controller.sal.core.api.mount.MountService;
-import org.opendaylight.controller.sal.rest.api.Draft01;
 import org.opendaylight.controller.sal.rest.api.Draft02;
 import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider;
 import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider;
@@ -47,7 +42,6 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 public class RestPutOperationTest extends JerseyTest {
 
     private static String xmlData;
-    private static String jsonData;
 
     private static BrokerFacade brokerFacade;
     private static RestconfImpl restconfImpl;
@@ -67,25 +61,18 @@ public class RestPutOperationTest extends JerseyTest {
         loadData();
     }
 
-    @Before
-    public void logs() throws IOException {
-        /* enable/disable Jersey logs to console */
-        /*
-         * List<LogRecord> loggedRecords = getLoggedRecords(); for (LogRecord l
-         * : loggedRecords) { System.out.println(l.getMessage()); }
-         */
+    private static void loadData() throws IOException {
+        InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/parts/ietf-interfaces_interfaces.xml");
+        xmlData = TestUtils.getDocumentInPrintableForm(TestUtils.loadDocumentFrom(xmlStream));
     }
 
     @Override
     protected Application configure() {
         /* enable/disable Jersey logs to console */
-        /*
-         * enable(TestProperties.LOG_TRAFFIC);
-         */
-        enable(TestProperties.DUMP_ENTITY);
-        enable(TestProperties.RECORD_LOG_LEVEL);
-        set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue());
-
+//        enable(TestProperties.LOG_TRAFFIC);
+//        enable(TestProperties.DUMP_ENTITY);
+//        enable(TestProperties.RECORD_LOG_LEVEL);
+//        set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue());
         ResourceConfig resourceConfig = new ResourceConfig();
         resourceConfig = resourceConfig.registerInstances(restconfImpl, StructuredDataToXmlProvider.INSTANCE,
                 StructuredDataToJsonProvider.INSTANCE, XmlToCompositeNodeProvider.INSTANCE,
@@ -94,109 +81,65 @@ public class RestPutOperationTest extends JerseyTest {
     }
 
     /**
-     * Test method
-     * {@link RestconfImpl#updateConfigurationData(String, CompositeNode)} of
-     * RestconfImpl for "/config/...identifier..." URL. Return status code is
-     * 200.
-     * 
+     * Tests of status codes for "/config/{identifier}".
      */
     @Test
-    public void putConfigDataViaUrlTest200() throws UnsupportedEncodingException {
+    public void putConfigStatusCodes() throws UnsupportedEncodingException {
+        String uri = createUri("/config/", "ietf-interfaces:interfaces/interface/eth0");
         mockCommitConfigurationDataPutMethod(TransactionStatus.COMMITED);
-        putDataViaUrlTest("/config/", Draft02.MediaTypes.DATA + JSON, jsonData, 200);
-        putDataViaUrlTest("/config/", Draft02.MediaTypes.DATA + XML, xmlData, 200);
-        putDataViaUrlTest("/config/", MediaType.APPLICATION_JSON, jsonData, 200);
-        putDataViaUrlTest("/config/", MediaType.APPLICATION_XML, xmlData, 200);
-        putDataViaUrlTest("/config/", MediaType.TEXT_XML, xmlData, 200);
-
-    }
-
-    /**
-     * Test method
-     * {@link RestconfImpl#updateConfigurationData(String, CompositeNode)} of
-     * RestconfImpl for "/config/...identifier..." URL. Return status code is
-     * 500.
-     * 
-     */
-    @Test
-    public void putConfigDataViaUrlTest500() throws UnsupportedEncodingException {
+        assertEquals(200, put(uri, MediaType.APPLICATION_XML, xmlData));
+        
         mockCommitConfigurationDataPutMethod(TransactionStatus.FAILED);
-        putDataViaUrlTest("/config/", Draft02.MediaTypes.DATA + JSON, jsonData, 500);
-        putDataViaUrlTest("/config/", Draft02.MediaTypes.DATA + XML, xmlData, 500);
-        putDataViaUrlTest("/config/", MediaType.APPLICATION_JSON, jsonData, 500);
-        putDataViaUrlTest("/config/", MediaType.APPLICATION_XML, xmlData, 500);
-        putDataViaUrlTest("/config/", MediaType.TEXT_XML, xmlData, 500);
-
+        assertEquals(500, put(uri, MediaType.APPLICATION_XML, xmlData));
     }
 
-    /**
-     * Test method
-     * {@link RestconfImpl#updateConfigurationData(String, CompositeNode)} of
-     * RestconfImpl for "/datastore/...identifier..." URL. Return status code is
-     * 200.
-     * 
-     */
-    @Test
-    public void putDatastoreDataViaUrlTest200() throws UnsupportedEncodingException {
-        mockCommitConfigurationDataPutMethod(TransactionStatus.COMMITED);
-        putDataViaUrlTest("/datastore/", Draft01.MediaTypes.DATA + JSON, jsonData, 200);
-        putDataViaUrlTest("/datastore/", Draft01.MediaTypes.DATA + XML, xmlData, 200);
-        putDataViaUrlTest("/datastore/", MediaType.APPLICATION_JSON, jsonData, 200);
-        putDataViaUrlTest("/datastore/", MediaType.APPLICATION_XML, xmlData, 200);
-        putDataViaUrlTest("/datastore/", MediaType.TEXT_XML, xmlData, 200);
-    }
 
     /**
-     * Test method
-     * {@link RestconfImpl#updateConfigurationData(String, CompositeNode)} of
-     * RestconfImpl for "/datastore/...identifier..." URL. Return status code is
-     * 500.
-     * 
+     * Tests of status codes for "/datastore/{identifier}".
      */
     @Test
-    public void putDatastoreDataViaUrlTest500() throws UnsupportedEncodingException {
+    public void putDatastoreStatusCodes() throws UnsupportedEncodingException {
+        String uri = createUri("/datastore/", "ietf-interfaces:interfaces/interface/eth0");
+        mockCommitConfigurationDataPutMethod(TransactionStatus.COMMITED);
+        assertEquals(200, put(uri, MediaType.APPLICATION_XML, xmlData));
+        
         mockCommitConfigurationDataPutMethod(TransactionStatus.FAILED);
-        putDataViaUrlTest("/datastore/", Draft01.MediaTypes.DATA + JSON, jsonData, 500);
-        putDataViaUrlTest("/datastore/", Draft01.MediaTypes.DATA + XML, xmlData, 500);
-        putDataViaUrlTest("/datastore/", MediaType.APPLICATION_JSON, jsonData, 500);
-        putDataViaUrlTest("/datastore/", MediaType.APPLICATION_XML, xmlData, 500);
-        putDataViaUrlTest("/datastore/", MediaType.TEXT_XML, xmlData, 500);
+        assertEquals(500, put(uri, MediaType.APPLICATION_XML, xmlData));
     }
 
     @Test
     public void testRpcResultCommitedToStatusCodesWithMountPoint() throws UnsupportedEncodingException,
             FileNotFoundException, URISyntaxException {
 
-        mockCommitConfigurationDataPutMethod(TransactionStatus.COMMITED);
+        RpcResult<TransactionStatus> rpcResult = new DummyRpcResult.Builder<TransactionStatus>().result(TransactionStatus.COMMITED)
+                .build();
+        Future<RpcResult<TransactionStatus>> dummyFuture = DummyFuture.builder().rpcResult(rpcResult).build();
+        when(brokerFacade.commitConfigurationDataPutBehindMountPoint(any(MountInstance.class),
+                        any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
+        
 
         InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/full-versions/test-data2/data2.xml");
         String xml = TestUtils.getDocumentInPrintableForm(TestUtils.loadDocumentFrom(xmlStream));
         Entity<String> entity = Entity.entity(xml, Draft02.MediaTypes.DATA + XML);
 
+        MountInstance mountInstance = mock(MountInstance.class);
+        when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
         MountService mockMountService = mock(MountService.class);
-        when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(
-                new DummyMountInstanceImpl.Builder().setSchemaContext(schemaContextTestModule).build());
+        when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
 
         ControllerContext.getInstance().setMountService(mockMountService);
 
-        String uri = createUri("/config/", "ietf-interfaces:interfaces/interface/0/test-module:cont");
+        String uri = createUri("/config/", "ietf-interfaces:interfaces/interface/0/yang-ext:mount/test-module:cont");
         Response response = target(uri).request(Draft02.MediaTypes.DATA + XML).put(entity);
         assertEquals(200, response.getStatus());
+        
+        uri = createUri("/config/", "ietf-interfaces:interfaces/yang-ext:mount/test-module:cont");
+        response = target(uri).request(Draft02.MediaTypes.DATA + XML).put(entity);
+        assertEquals(200, response.getStatus());
     }
 
-    private void putDataViaUrlTest(String uriPrefix, String mediaType, String data, int responseStatus)
-            throws UnsupportedEncodingException {
-        String uri = createUri(uriPrefix, "ietf-interfaces:interfaces/interface/eth0");
-        Response response = target(uri).request(mediaType).put(entity(data, mediaType));
-        assertEquals(responseStatus, response.getStatus());
-    }
-
-    private static void loadData() throws IOException {
-        InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/parts/ietf-interfaces_interfaces.xml");
-        xmlData = TestUtils.getDocumentInPrintableForm(TestUtils.loadDocumentFrom(xmlStream));
-
-        String jsonPath = RestconfImplTest.class.getResource("/parts/ietf-interfaces_interfaces.json").getPath();
-        jsonData = TestUtils.loadTextFile(jsonPath);
+    private int put(String uri, String mediaType, String data) throws UnsupportedEncodingException {
+        return target(uri).request(mediaType).put(Entity.entity(data, mediaType)).getStatus();
     }
 
     private void mockCommitConfigurationDataPutMethod(TransactionStatus statusName) {
index 674b8b09beb2bb0e1e33559dc00a2f48d400c138..0dec051ac7380a5aa92235e4ca9deb9ca0168c9b 100644 (file)
@@ -54,6 +54,11 @@ module simple-nodes {
                leaf beer {
                    type string;
                }
+               container nonalcoholic {
+                   leaf beer {
+                       type string;
+                   }
+               }
            }
            case late-night {
                leaf chocolate {
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/data-of-several-modules/yang/module1.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/data-of-several-modules/yang/module1.yang
new file mode 100644 (file)
index 0000000..f6a81ae
--- /dev/null
@@ -0,0 +1,16 @@
+module module1 {
+  namespace "module:one";  
+
+  prefix "m1";
+  revision 2014-01-17 {    
+  }
+
+    container cont_m1 {
+        leaf lf1_m1 {
+            type string;
+        }
+    }
+    container contB_m1 {
+    }
+  
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/data-of-several-modules/yang/module2.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/data-of-several-modules/yang/module2.yang
new file mode 100644 (file)
index 0000000..bdd8ece
--- /dev/null
@@ -0,0 +1,17 @@
+module module2 {
+  namespace "module:two";  
+
+  prefix "m2";
+  revision 2014-01-17 {    
+  }
+
+    container cont_m2 {
+        leaf lf1_m2 {
+            type string;
+        }
+    }
+    container contB_m2 {
+    }
+
+  
+}
\ No newline at end of file
index 45bc9055026812bf00b1f1bf9e3da9c0b97ffb90..bb5dea3bd5ad753ca7069169e32a9207b1599715 100644 (file)
@@ -177,34 +177,32 @@ public class StatisticsProvider implements AutoCloseable {
 
         for (Node targetNode : targetNodes){
             
-            InstanceIdentifier<Node> targetInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class,targetNode.getKey()).toInstance();
-            NodeRef targetNodeRef = new NodeRef(targetInstanceId);
+            if(targetNode.getAugmentation(FlowCapableNode.class) != null){
+
+                spLogger.info("Send request for stats collection to node : {})",targetNode.getId());
+                
+                InstanceIdentifier<Node> targetInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class,targetNode.getKey()).toInstance();
+                
+                NodeRef targetNodeRef = new NodeRef(targetInstanceId);
             
-            try {
+                try{
+                    sendAggregateFlowsStatsFromAllTablesRequest(targetNode.getKey());
                 
-                sendAggregateFlowsStatsFromAllTablesRequest(targetNode.getKey());
+                    sendAllFlowsStatsFromAllTablesRequest(targetNodeRef);
 
-                sendAllFlowsStatsFromAllTablesRequest(targetNodeRef);
-
-                sendAllNodeConnectorsStatisticsRequest(targetNodeRef);
+                    sendAllNodeConnectorsStatisticsRequest(targetNodeRef);
                 
-                sendAllFlowTablesStatisticsRequest(targetNodeRef);
+                    sendAllFlowTablesStatisticsRequest(targetNodeRef);
                 
-                sendAllQueueStatsFromAllNodeConnector (targetNodeRef);
-
-            }catch(Exception e){
-                spLogger.error("Exception occured while sending statistics requests : {}",e);
-            }
-
-            if(targetNode.getAugmentation(FlowCapableNode.class) != null){
-
-                spLogger.info("Send request for stats collection to node : {})",targetNode.getId());
-
-                try{
-                  sendAllGroupStatisticsRequest(targetNodeRef);
-                  sendAllMeterStatisticsRequest(targetNodeRef);
-                  sendGroupDescriptionRequest(targetNodeRef);
-                  sendMeterConfigStatisticsRequest(targetNodeRef);
+                    sendAllQueueStatsFromAllNodeConnector (targetNodeRef);
+
+                    sendAllGroupStatisticsRequest(targetNodeRef);
+                    
+                    sendAllMeterStatisticsRequest(targetNodeRef);
+                    
+                    sendGroupDescriptionRequest(targetNodeRef);
+                    
+                    sendMeterConfigStatisticsRequest(targetNodeRef);
                 }catch(Exception e){
                     spLogger.error("Exception occured while sending statistics requests : {}", e);
                 }
index 9511673ea40781446c4134f02d3b1defbe47353a..f236a8d36ecda2d706c59eb425470cbda0799028 100644 (file)
@@ -260,10 +260,8 @@ public class NetconfMappingTest extends AbstractConfigTest {
         commit();
         response = getConfigCandidate();
         final String responseFromCandidate = XmlUtil.toString(response).replaceAll("\\s+", "");
-        // System.out.println(responseFromCandidate);
         response = getConfigRunning();
         final String responseFromRunning = XmlUtil.toString(response).replaceAll("\\s+", "");
-        // System.out.println(responseFromRunning);
         assertEquals(responseFromCandidate, responseFromRunning);
 
         final String expectedResult = XmlFileLoader.fileToString("netconfMessages/editConfig_expectedResult.xml")
index b70a31a84b0e009052559e7564013f3ae2266de2..621c8eaa8654c3de256d04cd5fdd54842b721b31 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.netconf.impl.util;
 
 import com.google.common.base.Preconditions;
index 6b0316b6fcbba8b92b5823c44d51aa45661f7ae0..73eb608f0b7bac686c9dd02b5dbf656b723ed3c8 100644 (file)
@@ -1,3 +1,10 @@
+/*\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.netconf.impl;\r
 \r
 import static junit.framework.Assert.assertNotNull;\r
index fdea831b47e0dd05d73e1ed70dd1bf4be2b90c84..b0821799b0b57ad94682fe6ec58cba61ac0dee97 100644 (file)
@@ -175,7 +175,6 @@ public class NetconfMonitoringITTest extends AbstractConfigTest {
 
                 responseBuilder.append(line);
                 responseBuilder.append(System.lineSeparator());
-                System.out.println(responseBuilder.toString());
 
                 if(line.contains("</rpc-reply>"))
                     break;
index f6f05f6bde6344f089ad14151fa3f60645ca886d..816650c4bb457c14ffff7a0ebe759d016ad1b0fd 100644 (file)
@@ -1,3 +1,10 @@
+/*\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.netconf.mapping.api;\r
 \r
 import org.opendaylight.controller.netconf.api.NetconfSession;\r
index 8771421a111514f0ba064f7ae108fa366809252a..85da5975d1f22caaf4485ebea88484e9ad1f242c 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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
+ */
 @XmlSchema(
         elementFormDefault = XmlNsForm.QUALIFIED,
 //        xmlns = {
index 1e3f343624726e9ff0af80f98c3da32e9233f7c5..d4462f85d99e2f3cf267b3e7cffca82670b9d0a3 100644 (file)
@@ -7,15 +7,10 @@
 */
 package org.opendaylight.controller.netconf.monitoring.xml;
 
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-
-import java.util.Date;
-
+import com.google.common.collect.Lists;
 import org.junit.Test;
 import org.opendaylight.controller.netconf.api.monitoring.NetconfMonitoringService;
 import org.opendaylight.controller.netconf.monitoring.xml.model.NetconfState;
-import org.opendaylight.controller.netconf.util.xml.XmlUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.DomainName;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Host;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.extension.rev131210.Session1;
@@ -30,7 +25,10 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.ZeroBasedCounter32;
 import org.w3c.dom.Element;
 
-import com.google.common.collect.Lists;
+import java.util.Date;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
 
 public class JaxBSerializerTest {
 
@@ -51,7 +49,6 @@ public class JaxBSerializerTest {
         };
         NetconfState model = new NetconfState(service);
         Element xml = new JaxBSerializer().toXml(model);
-        System.out.println(XmlUtil.toString(xml));
     }
 
     private Session getMockSession() {
index 6df19155110e098ea093b370f2473e8ed9135704..d159f59f1a2cedcefeca01bf24b93854c4fa269b 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.netconf.ssh.threads;
 
 
index 12d1129daff5c6b3c4a7aa4324e4de14385a9347..8636e5ecb5fe55f22ce01cf9a19fb537397c9b0e 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.netconf.util.handler.ssh.client;
 
 import java.io.IOException;
index 63dfcde0c6f49e5685dbfcfb6adff4b8350c5668..7109971b5d56625f57d35b607d831b21433986e3 100644 (file)
@@ -1,3 +1,10 @@
+/*\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.netconf.util.xml;\r
 \r
 import com.siemens.ct.exi.CodingMode;\r
index 8baa68e494272ebda3658527525ff09c95df9398..82bbb66c02a74c0f13a022511d6f08b9b6643819 100644 (file)
@@ -1,3 +1,10 @@
+/*\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.netconf.util.xml;\r
 \r
 import io.netty.buffer.ByteBuf;\r
index 8e14d9b366227726190f9dc3589e4b3f33a70c74..150f6028022e01e38f5a3558237e9c2281ccc20f 100644 (file)
@@ -77,7 +77,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
@@ -92,7 +92,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
 </project>
index 588a61653ab6bfac66c0886d01aa69746ecd7e64..b6cdd2512bf7d0d314ba39344f2db9931fe06a70 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>commons-net</groupId>
index 8c3279e6c7b6857630bb5e7855b93cfd1064f906..5baaeb0dccc64d358ce960d224cd578dc17f52f1 100644 (file)
@@ -43,6 +43,7 @@
             <Import-Package>
               org.opendaylight.controller.sal.core,
               org.opendaylight.controller.sal.utils,
+              org.opendaylight.controller.configuration,
               org.opendaylight.controller.containermanager,
               org.opendaylight.controller.switchmanager,
               org.opendaylight.controller.usermanager,
index c5153962125445ead7ce27411f4bc87ea0b989f8..003f8b3b95df37b465ad04caf487181614511ddc 100644 (file)
@@ -29,6 +29,7 @@ import javax.ws.rs.core.UriInfo;
 import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.codehaus.enunciate.jaxrs.TypeHint;
+import org.opendaylight.controller.configuration.IConfigurationService;
 import org.opendaylight.controller.containermanager.IContainerManager;
 import org.opendaylight.controller.northbound.commons.RestMessages;
 import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
@@ -254,6 +255,44 @@ public class ControllerManagerNorthbound {
         return NorthboundUtils.getResponse(status);
     }
 
+    /**
+     * Save controller configuration
+     *
+     * Request URL:
+     *  http://localhost:8080/controller/nb/v2/controllermanager/configuration
+     *
+     * Request body is empty
+     */
+    @Path("/configuration")
+    @PUT
+    @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @StatusCodes({
+            @ResponseCode(code = 204, condition = "Operation successful"),
+            @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
+            @ResponseCode(code = 503, condition = "Configuration service is unavailable.")
+    })
+    public Response saveConfiguration() {
+
+        if (!NorthboundUtils.isAuthorized(getUserName(), "default", Privilege.WRITE, this)) {
+            throw new UnauthorizedException("User is not authorized to perform this operation");
+        }
+
+        IConfigurationService configService = (IConfigurationService)
+                ServiceHelper.getGlobalInstance(IConfigurationService.class, this);
+
+        if (configService == null) {
+            throw new ServiceUnavailableException("Configuration Service " +
+                    RestMessages.SERVICEUNAVAILABLE.toString());
+        }
+        Status status = configService.saveConfigurations();
+        if (status.isSuccess()) {
+            NorthboundUtils.auditlog("Controller Configuration", username,
+                    "save", "configuration");
+            return Response.noContent().build();
+        }
+        return NorthboundUtils.getResponse(status);
+    }
+
     private boolean isValidContainer(String containerName) {
         if (containerName.equals(GlobalConstants.DEFAULT.toString())) {
             return true;
index 8a86d2f256fee58addddffaa9b998071b99c58ac..27a7ae6ffb125ebb42d8af542ca27348fa926bb0 100644 (file)
@@ -748,7 +748,7 @@ public class OFStatisticsManager implements IOFStatisticsManager, IInventoryShim
             for (OFStatistics stats : targetList) {
                 V6StatsReply v6Stats = (V6StatsReply) stats;
                 V6Match v6Match = v6Stats.getMatch();
-                if (v6Stats.getPriority() == priority && v6Match.equals(targetMatch)) {
+                if (v6Stats.getPriority() == priority && targetMatch.equals(v6Match)) {
                     List<OFStatistics> list = new ArrayList<OFStatistics>();
                     list.add(stats);
                     return list;
@@ -757,7 +757,7 @@ public class OFStatisticsManager implements IOFStatisticsManager, IInventoryShim
         } else {
             for (OFStatistics stats : statsList) {
                 OFFlowStatisticsReply flowStats = (OFFlowStatisticsReply) stats;
-                if (flowStats.getPriority() == priority && flowStats.getMatch().equals(ofMatch)) {
+                if (flowStats.getPriority() == priority && ofMatch.equals(flowStats.getMatch())) {
                     List<OFStatistics> list = new ArrayList<OFStatistics>();
                     list.add(stats);
                     return list;
index 2457ddeb67d779fbb171553371a341e1e5617c8d..b7d7b05b608cf821a75076d93b53c3df2341ebf6 100644 (file)
@@ -57,7 +57,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index ec050fa305d17123fcada432873e747dd2273944..9f2454bbffa9d6ace80c29fafaf6e8ea770f460c 100644 (file)
@@ -65,6 +65,12 @@ public class InventoryService implements IPluginInInventoryService {
         }
     }
 
+    @Override
+    public Set<Node> getConfiguredNotConnectedNodes() {
+        // TODO
+        return null;
+    }
+
     /**
      * Function called by the dependency manager when all the required
      * dependencies are satisfied
index eeea5d91d7e773cea232420f40c0462428358c7e..aa3f6259396d78434a2c87e83d9284f090dda053 100644 (file)
@@ -59,7 +59,7 @@
    <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index d60e7abe70874e75f582aa9b672c0fa23758415c..006334edfeb7567742bb679f8fa04c50e5a9d364 100644 (file)
@@ -50,7 +50,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index e171a8de59ad275cc7ea2253bba098b6aadcd30a..4a7e70b836aa06146b89a67b19aaa38f2fbc87c3 100644 (file)
@@ -58,7 +58,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 79707cbc572d0b8856f31aafd7e27fc4f060ff31..3c08b439aeea04b9d37d8ebc1c4d6dccb1b24f26 100644 (file)
@@ -47,7 +47,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
 </project>
index 9d7b84ac79bedcedf8f277dba6f88c9563abc37a..c25ce0fa4f11cfd691b04cb56aaea523b5917ad0 100644 (file)
@@ -50,7 +50,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index cf7a18ea659e6d126f43b868d8cf996cee6253dc..6f951ca2f6c6c9e4edb55ce0e714dfce4813c9ff 100644 (file)
@@ -85,7 +85,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>forwardingrulesmanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
@@ -95,7 +95,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index 1bbc5bf23efad487b6242cf48e444d76d78b5ec0..3b054b6339514595ffce28642792bff675763ff6 100644 (file)
@@ -28,7 +28,7 @@
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>0.7.0-SNAPSHOT</version>
           </dependency>
         </dependencies>
       </plugin>
@@ -90,7 +90,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index edd146e61572fd49ff025c1d732b510fca3353e0..a4bb76d5ab5d780774c23225d4a2f4687038389c 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>forwardingrulesmanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>hosttracker</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
@@ -86,7 +86,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
 </project>
index 2e7466daf000255e915fca10252e9295bbb5349c..ef45e768337a621f4ffa7ffd259bfdcbd271ee90 100644 (file)
@@ -58,7 +58,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
         <groupId>orbit</groupId>
index 0dca7396e71ead84841bee31b4c9f2db8708aaab..3a1367901be031e85de8d9014022c11aa447ca56 100644 (file)
@@ -47,7 +47,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>forwardingrulesmanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
 </project>
index 54ba4865b2231d9e2b15b299e1b76094285a8c85..c69e752549dfe4b2f12f0fbfbdcc3feab411600d 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>forwardingrulesmanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index d04371461f371e1e11ba0254a57fb92763f793c3..026811f75b6f92476bbc146132df141ed5f26db6 100644 (file)
@@ -45,7 +45,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>forwardingrulesmanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index b9cac8f2f86ac286f07bebeea3982e3aa75c5ec4..a4e96dd6a03d0339b46c97a0b2759d17b2b71e07 100644 (file)
@@ -92,7 +92,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index 76bfd56c2913cf9f89625e3db71fcf2cc9cc9e48..93c076dcba084ddd81616c691c8282ff9521378e 100644 (file)
@@ -97,7 +97,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>statisticsmanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index a91e7275ba6ac5403ac4dee11baa363cbe80c694..10b1a7243bdbe2f76cb81915a5014b3d1c025743 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 5dfa1632f74c4d323cb87e8cbe8bb8885ada9e35..93e8dcc89f3bec602c04762ded8ea0619819cba5 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
      <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal.implementation</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.4.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>containermanager</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
+      <version>0.5.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>containermanager.it.implementation</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
+      <version>0.5.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>forwardingrulesmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.stub</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.4.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>statisticsmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>statisticsmanager.implementation</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.4.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager.implementation</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.4.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>configuration</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.4.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>configuration.implementation</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.4.1-SNAPSHOT</version>
     </dependency>
       <dependency>
       <groupId>org.opendaylight.controller</groupId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>topologymanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.4.1-SNAPSHOT</version>
     </dependency>
   </dependencies>
   <properties>
index 5d9e6c70ce622415a190ed1f4438407103e5a924..f7064a3c6dee8ee5bd9b01b599ed4858bbcc9372 100644 (file)
@@ -76,7 +76,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
@@ -86,7 +86,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index dcdc2f6d50447e942fe868c22bc69bc732bfe248..dbf71fec6866b9cfb2ab1c368378495294b02948 100644 (file)
@@ -79,7 +79,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
@@ -89,7 +89,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.springframework.security</groupId>
index 8f6e1cc593e9c3aea0eec97a9c62dde96d42531f..82abfbadb091e13cb30595c6fafd9df5dd1bea78 100644 (file)
@@ -93,7 +93,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>forwardingrulesmanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index cc142bf9672f136686a952e88c5c99395f6c2d8e..855dc90aa9023208b41168c384806db16d86dae5 100644 (file)
@@ -37,11 +37,11 @@ one.f.dashlet = {
 one.f.menu = {
   left : {
     top : [
-      one.f.dashlet.nodesLearnt,
-      one.f.dashlet.connection
+      one.f.dashlet.nodesLearnt
       ],
     bottom : [
-      one.f.dashlet.staticRouteConfig
+      one.f.dashlet.staticRouteConfig,
+      one.f.dashlet.connection
       ]
   },
   right : {
@@ -1361,7 +1361,7 @@ one.f.switchmanager.spanPortConfig = {
 
       $fieldset.append($label).append($select);
       // input port
-      var $label = one.lib.form.label("Input Port");
+      var $label = one.lib.form.label("Port");
       var $select = one.lib.form.select.create();
       one.lib.form.select.prepend($select, {'':'None'});
       $select.attr('id', one.f.switchmanager.spanPortConfig.id.modal.form.port);
index 2b4dcd3de5388881564cb11e206dd6cca7f22ef3..5812c0e861700d3b04ff44a2f663465fd9694508 100644 (file)
@@ -91,7 +91,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>forwardingrulesmanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 6b4cfa00253ef4f36026a51f639fba6af02ed4b6..094562fac07252b182e601774e79209d0a473e20 100644 (file)
@@ -390,8 +390,8 @@ one.f.flows = {
                     $tr = $(tr);
                     $span = $("td span", $tr);
                     var flowstatus = $span.data("flowstatus");
-                    if($span.data("installInHw") != null) {
-                        var installInHw = $span.data("installInHw").toString();
+                    if($span.data("installinhw") != null) {
+                        var installInHw = $span.data("installinhw").toString();
                         if(installInHw == "true" && flowstatus == "Success") {
                             $tr.addClass("success");
                         } else {
index 8ebab10ca544f6383ac1dd8c6fe9c31847147e45..1a801a2fe41517b907cbae2662973e993b2589f9 100644 (file)
@@ -97,7 +97,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>clustering.services</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 97c5e3ccdc6ec50ef506f2ff9322c04667b74e96..358ea21ad9948d0b371bece2ae27abd1f9935a13 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 4550be87f9853e5d2d78f10d930301a70f7c3f8d..033cc6d9e976e214400d0c56db229bcb3b822495 100644 (file)
@@ -93,7 +93,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>forwardingrulesmanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>statisticsmanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>