Merge "creating a default subnet"
authorGiovanni Meo <gmeo@cisco.com>
Mon, 11 Nov 2013 09:50:24 +0000 (09:50 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 11 Nov 2013 09:50:24 +0000 (09:50 +0000)
340 files changed:
README.OPENDAYLIGHT
opendaylight/commons/checkstyle/src/main/resources/controller/checkstyle.xml
opendaylight/commons/opendaylight/pom.xml
opendaylight/config/config-api/pom.xml
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/DependencyResolver.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/stat/ConfigProvider.java [deleted file]
opendaylight/config/config-manager/pom.xml
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/ConfigTransactionControllerImpl.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/dependencyresolver/DependencyResolverImpl.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/dependencyresolver/DependencyResolverManager.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/dependencyresolver/ModulesHolder.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/dependencyresolver/TransactionHolder.java
opendaylight/config/config-persister-api/pom.xml
opendaylight/config/config-persister-api/src/main/java/org/opendaylight/controller/config/persist/api/storage/StorageAdapter.java
opendaylight/config/config-persister-file-adapter/pom.xml
opendaylight/config/config-persister-file-adapter/src/main/java/org/opendaylight/controller/config/persist/storage/file/FileStorageAdapter.java
opendaylight/config/config-util/pom.xml
opendaylight/config/logback-config/pom.xml
opendaylight/config/netty-threadgroup-config/pom.xml [new file with mode: 0644]
opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/NettyThreadgroupModule.java [new file with mode: 0644]
opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/NettyThreadgroupModuleFactory.java [new file with mode: 0644]
opendaylight/config/netty-threadgroup-config/src/main/yang/nsos-netty-threadgroup.yang [new file with mode: 0644]
opendaylight/config/netty-threadgroup-config/src/test/java/org/opendaylight/controller/config/yang/netty/threadgroup/NettyThreadgroupModuleTest.java [new file with mode: 0644]
opendaylight/config/pom.xml
opendaylight/config/threadpool-config-api/pom.xml [new file with mode: 0644]
opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ScheduledThreadPool.java [new file with mode: 0644]
opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ThreadPool.java [new file with mode: 0644]
opendaylight/config/threadpool-config-api/src/main/yang/threadpool.yang [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/pom.xml [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/CloseableAsyncEventBus.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/CloseableEventBus.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FixedThreadPoolWrapper.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FlexibleThreadPoolWrapper.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/NamingThreadPoolFactory.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/ScheduledThreadPoolWrapper.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/AsyncEventBusModule.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/AsyncEventBusModuleFactory.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/EventBusModule.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/EventBusModuleFactory.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FixedThreadPoolModule.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FixedThreadPoolModuleFactory.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FlexibleThreadPoolModule.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FlexibleThreadPoolModuleFactory.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/NamingThreadFactoryModule.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/NamingThreadFactoryModuleFactory.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/ScheduledThreadPoolModule.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/ScheduledThreadPoolModuleFactory.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl.yang [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/async/AsyncEventBusConfigBeanTest.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/eventbus/SyncEventBusConfigBeanTest.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/eventbus/TestingEventBusModule.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/FixedThreadPoolConfigBeanTest.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/TestingFixedThreadPoolModule.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/flexible/FlexibleThreadPoolConfigBeanTest.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/NamingThreadPoolFactoryConfigBeanTest.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/TestingNamingThreadPoolFactoryModule.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/ScheduledThreadPoolConfigBeanTest.java [new file with mode: 0644]
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/TestingScheduledThreadPoolModule.java [new file with mode: 0644]
opendaylight/config/yang-jmx-generator-it/pom.xml
opendaylight/config/yang-jmx-generator-plugin/pom.xml
opendaylight/config/yang-jmx-generator/pom.xml
opendaylight/config/yang-store-api/pom.xml
opendaylight/config/yang-store-impl/pom.xml
opendaylight/config/yang-test/pom.xml
opendaylight/distribution/opendaylight/pom.xml
opendaylight/forwardingrulesmanager_mdsal/openflow/pom.xml
opendaylight/forwardingrulesmanager_mdsal/openflow/src/main/java/org/opendaylight/controller/forwardingrulesmanager_mdsal/consumer/impl/FRMConsumerImpl.java
opendaylight/forwardingrulesmanager_mdsal/openflow/src/main/java/org/opendaylight/controller/forwardingrulesmanager_mdsal/consumer/impl/FRMUtil.java [new file with mode: 0644]
opendaylight/forwardingrulesmanager_mdsal/openflow/src/main/java/org/opendaylight/controller/forwardingrulesmanager_mdsal/consumer/impl/FlowConsumerImpl.java
opendaylight/forwardingrulesmanager_mdsal/openflow/src/main/java/org/opendaylight/controller/forwardingrulesmanager_mdsal/consumer/impl/GroupConsumerImpl.java
opendaylight/md-sal/clustered-data-store/implementation/pom.xml
opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/datastore/ClusteredDataStore.java [new file with mode: 0644]
opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/datastore/internal/Activator.java
opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/datastore/internal/ClusteredDataStore.java [deleted file]
opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/datastore/internal/ClusteredDataStoreImpl.java [new file with mode: 0644]
opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/datastore/internal/ClusteredDataStoreManager.java [new file with mode: 0644]
opendaylight/md-sal/clustered-data-store/implementation/src/test/java/org/opendaylight/controller/datastore/internal/ActivatorTest.java
opendaylight/md-sal/clustered-data-store/implementation/src/test/java/org/opendaylight/controller/datastore/internal/ClusteredDataStoreImplTest.java [new file with mode: 0644]
opendaylight/md-sal/clustered-data-store/implementation/src/test/java/org/opendaylight/controller/datastore/internal/ClusteredDataStoreManagerTest.java [new file with mode: 0644]
opendaylight/md-sal/clustered-data-store/implementation/src/test/java/org/opendaylight/controller/datastore/internal/ClusteredDataStoreTest.java [deleted file]
opendaylight/md-sal/compatibility/flow-management-compatibility/pom.xml [moved from opendaylight/md-sal/flow-management-compatibility/pom.xml with 94% similarity]
opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FRMRuntimeDataProvider.xtend [moved from opendaylight/md-sal/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FRMRuntimeDataProvider.xtend with 98% similarity]
opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowConfigMapping.xtend [moved from opendaylight/md-sal/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowConfigMapping.xtend with 89% similarity]
opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowManagementReader.java [moved from opendaylight/md-sal/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowManagementReader.java with 100% similarity]
opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/SampleConsumer.java [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.xtend [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.xtend [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.xtend [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.xtend [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.xtend [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.xtend [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.xtend [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/ConfigurableLinkManager.xtend [new file with mode: 0644]
opendaylight/md-sal/compatibility/pom.xml [new file with mode: 0644]
opendaylight/md-sal/compatibility/sal-compatibility/pom.xml [moved from opendaylight/md-sal/sal-compability/pom.xml with 65% similarity]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ComponentActivator.xtend [moved from opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ComponentActivator.xtend with 97% similarity]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/DataPacketAdapter.xtend [moved from opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/DataPacketAdapter.xtend with 93% similarity]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FlowProgrammerAdapter.xtend [moved from opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/FlowProgrammerAdapter.xtend with 93% similarity]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java [moved from opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/FromSalConversionsUtils.java with 98% similarity]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend [moved from opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/InventoryAndReadAdapter.xtend with 98% similarity]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryMapping.xtend [new file with mode: 0644]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDFlowMapping.xtend [moved from opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/MDFlowMapping.xtend with 98% similarity]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/NodeMapping.xtend [moved from opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/NodeMapping.xtend with 98% similarity]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ProtocolConstants.java [moved from opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ProtocolConstants.java with 88% similarity]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ToSalConversionsUtils.java [moved from opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ToSalConversionsUtils.java with 98% similarity]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/DataPacketServiceAdapter.java [moved from opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/adsal/DataPacketServiceAdapter.java with 92% similarity]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowServiceAdapter.java [new file with mode: 0644]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowStatisticsAdapter.java [moved from opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/adsal/FlowStatisticsAdapter.java with 98% similarity]
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestFromSalConversionsUtils.java [moved from opendaylight/md-sal/sal-compability/src/test/java/org/opendaylight/controller/sal/compability/TestFromSalConversionsUtils.java with 85% similarity]
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestToSalConversionsUtils.java [moved from opendaylight/md-sal/sal-compability/src/test/java/org/opendaylight/controller/sal/compability/TestToSalConversionsUtils.java with 82% similarity]
opendaylight/md-sal/model/model-flow-base/src/main/yang/group-types.yang
opendaylight/md-sal/model/model-flow-base/src/main/yang/meter-types.yang
opendaylight/md-sal/model/model-flow-base/src/main/yang/port-types.yang
opendaylight/md-sal/model/model-flow-management/src/main/yang/meter-config.yang
opendaylight/md-sal/model/model-flow-service/src/main/yang/flow-capable-transaction.yang [new file with mode: 0644]
opendaylight/md-sal/model/model-flow-service/src/main/yang/group-service.yang
opendaylight/md-sal/model/model-flow-service/src/main/yang/meter-service.yang
opendaylight/md-sal/model/model-flow-service/src/main/yang/port-service.yang [new file with mode: 0644]
opendaylight/md-sal/model/model-flow-service/src/main/yang/table-service.yang
opendaylight/md-sal/model/model-topology/pom.xml [new file with mode: 0644]
opendaylight/md-sal/model/model-topology/src/main/yang/opendaylight-topology-inventory.yang [new file with mode: 0644]
opendaylight/md-sal/model/model-topology/src/main/yang/opendaylight-topology.yang [new file with mode: 0644]
opendaylight/md-sal/model/model-topology/src/main/yang/topology-view.yang [new file with mode: 0644]
opendaylight/md-sal/model/pom.xml
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-binding-api/pom.xml
opendaylight/md-sal/sal-binding-broker/pom.xml
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataBrokerImpl.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataProviderContext.xtend [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataTransactionImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/util/BindingAwareDataReaderRouter.xtend [new file with mode: 0644]
opendaylight/md-sal/sal-binding-config/pom.xml
opendaylight/md-sal/sal-binding-it/pom.xml
opendaylight/md-sal/sal-binding-util/pom.xml [new file with mode: 0644]
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/TypeSafeDataReader.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataChange.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataChangeEvent.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataCommitHandler.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModification.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataStore.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/Route.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RouteChangeListener.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RouteChangePublisher.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/Router.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-impl/pom.xml
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataModification.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/AbstractDataReadRouter.java [new file with mode: 0644]
opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ToSalPropertyClassUtils.java [new file with mode: 0644]
opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/adsal/FlowServiceAdapter.java [deleted file]
opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/RpcRouter.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcConsumptionRegistry.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcProvisionRegistry.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataProviderService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/model/SchemaService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/model/SchemaServiceListener.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionInstance.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionService.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountService.java
opendaylight/md-sal/sal-dom-broker/pom.xml
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BrokerActivator.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BrokerImpl.xtend
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/ConsumerContextImpl.xtend
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataBrokerImpl.xtend [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataConsumerServiceImpl.xtend [deleted file]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/MountPointImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/MountPointManagerImpl.xtend [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/ProviderContextImpl.xtend
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/SchemaServiceImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/DataReaderRouter.xtend [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/NotificationRouterImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/RpcRouterImpl.xtend [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/AbstractBrokerServiceProxy.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DataBrokerServiceProxy.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DataProviderServiceProxy.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/MountProviderServiceProxy.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/NotificationPublishServiceProxy.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/NotificationServiceProxy.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/ProxyFactory.xtend [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/SchemaServiceProxy.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/NotificationRouter.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/RoutedRpcProcessor.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/RpcRouter.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/pom.xml
opendaylight/md-sal/sal-rest-connector/pom.xml
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfService.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonToCompositeNodeProvider.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfProvider.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToJsonProvider.java
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/JsonMapper.xtend [deleted file]
opendaylight/md-sal/sal-rest-connector/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/XmlProvidersTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/YangAndXmlToJsonConversionJsonReaderTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/YangAndXmlToJsonConversionRegExTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/yang-to-json-conversion/simple-yang-types/simple-yang-types.yang [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/yang-to-json-conversion/simple-yang-types/xml/awaited_output.json [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/yang-to-json-conversion/simple-yang-types/xml/data.xml [new file with mode: 0644]
opendaylight/md-sal/sal-zeromq-connector/pom.xml [new file with mode: 0644]
opendaylight/md-sal/sal-zeromq-connector/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/api/RouteChange.java [new file with mode: 0644]
opendaylight/md-sal/sal-zeromq-connector/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/api/RouteChangeListener.java [new file with mode: 0644]
opendaylight/md-sal/sal-zeromq-connector/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/api/RoutingTable.java [new file with mode: 0644]
opendaylight/md-sal/sal-zeromq-connector/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/router/zeromq/Activator.java [new file with mode: 0644]
opendaylight/md-sal/sal-zeromq-connector/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/router/zeromq/Message.java [new file with mode: 0644]
opendaylight/md-sal/sal-zeromq-connector/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/router/zeromq/RouteIdentifierImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-zeromq-connector/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/router/zeromq/RpcRequestImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-zeromq-connector/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/router/zeromq/ZeroMqRpcRouter.java [new file with mode: 0644]
opendaylight/md-sal/samples/pom.xml
opendaylight/md-sal/samples/toaster-it/pom.xml
opendaylight/md-sal/test/pom.xml [new file with mode: 0644]
opendaylight/md-sal/test/sal-rest-connector-it/pom.xml [new file with mode: 0644]
opendaylight/md-sal/test/sal-rest-connector-it/src/test/java/org/opendaylight/controller/test/restconf/it/ServiceProviderController.java [new file with mode: 0644]
opendaylight/md-sal/test/sal-rest-connector-it/src/test/resources/exam.properties [new file with mode: 0644]
opendaylight/md-sal/test/sal-rest-connector-it/src/test/resources/logback.xml [new file with mode: 0644]
opendaylight/md-sal/test/sal-rest-connector-it/src/test/resources/tomcat-server.xml [new file with mode: 0644]
opendaylight/md-sal/test/zeromq-test-consumer/pom.xml [new file with mode: 0644]
opendaylight/md-sal/test/zeromq-test-consumer/src/main/java/org/opendaylight/controller/sample/zeromq/consumer/ExampleConsumer.java [new file with mode: 0644]
opendaylight/md-sal/test/zeromq-test-it/pom.xml [new file with mode: 0644]
opendaylight/md-sal/test/zeromq-test-it/src/test/java/org/opendaylight/controller/sample/zeromq/test/it/ServiceConsumerController.java [new file with mode: 0644]
opendaylight/md-sal/test/zeromq-test-it/src/test/java/org/opendaylight/controller/sample/zeromq/test/it/ServiceProviderController.java [new file with mode: 0644]
opendaylight/md-sal/test/zeromq-test-provider/pom.xml [new file with mode: 0644]
opendaylight/md-sal/test/zeromq-test-provider/src/main/java/org/opendaylight/controller/sample/zeromq/provider/ExampleProvider.java [new file with mode: 0644]
opendaylight/netconf/config-netconf-connector/pom.xml
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceImpl.java
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/NetconfMappingTest.java
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditConfigTest.java
opendaylight/netconf/config-persister-impl/pom.xml
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/NoOpStorageAdapter.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/PersisterImpl.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterActivator.java
opendaylight/netconf/config-persister-impl/src/main/resources/netconfOp/editConfig.xml
opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/PersisterImplTest.java
opendaylight/netconf/netconf-api/pom.xml
opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfOperationRouter.java
opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfSession.java
opendaylight/netconf/netconf-client/pom.xml
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClient.java
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSession.java
opendaylight/netconf/netconf-client/src/main/resources/client_hello.xml
opendaylight/netconf/netconf-impl/pom.xml
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSession.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionListener.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionListenerFactory.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/ExiDecoderHandler.java [new file with mode: 0644]
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/ExiEncoderHandler.java [new file with mode: 0644]
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultCloseSession.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultCommit.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultGetSchema.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStartExi.java [new file with mode: 0644]
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStopExi.java [new file with mode: 0644]
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfImplActivator.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfOperationRouterImpl.java
opendaylight/netconf/netconf-impl/src/main/resources/server_hello.xml
opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java [new file with mode: 0644]
opendaylight/netconf/netconf-it/pom.xml
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java
opendaylight/netconf/netconf-mapping-api/pom.xml
opendaylight/netconf/netconf-mapping-api/src/main/java/org/opendaylight/controller/netconf/mapping/api/DefaultNetconfOperation.java [new file with mode: 0644]
opendaylight/netconf/netconf-mapping-api/src/main/java/org/opendaylight/controller/netconf/mapping/api/NetconfOperationFilter.java
opendaylight/netconf/netconf-util/pom.xml
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageAggregator.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/SshHandler.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/authentication/AuthenticationHandler.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/authentication/LoginPassword.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/client/Invoker.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/client/SshClient.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/client/SshClientAdapter.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/client/SshSession.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/ChannelInputStream.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/ChannelOutputStream.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/VirtualSocket.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/VirtualSocketException.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/mapping/AbstractNetconfOperation.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/osgi/NetconfConfigUtil.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/ExiParameters.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/ExiUtil.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlElement.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlNetconfConstants.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlUtil.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/test/XmlFileLoader.java
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/startExi.xml [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/stopExi.xml [new file with mode: 0644]
opendaylight/netconf/pom.xml
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/Activator.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFloatingIPInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronNetworkInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronPortInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronRouterInterface.java
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSubnetInterface.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPAware.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPCRUD.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkAware.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkCRUD.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortAware.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortCRUD.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterAware.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterCRUD.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetAware.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetCRUD.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronCRUDInterfaces.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFloatingIP.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronNetwork.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronPort.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_Interface.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_NetworkReference.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_HostRoute.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_IPAllocationPool.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/Neutron_IPs.java
opendaylight/northbound/hosttracker/enunciate.xml
opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java
opendaylight/northbound/networkconfiguration/bridgedomain/src/main/java/org/opendaylight/controller/networkconfig/bridgedomain/northbound/BridgeDomainNorthbound.java
opendaylight/northbound/networkconfiguration/bridgedomain/src/main/resources/WEB-INF/web.xml
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPRequest.java
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPsNorthbound.java
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworkRequest.java
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworksNorthbound.java
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNorthboundRSApplication.java
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortRequest.java
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortsNorthbound.java
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRouterRequest.java
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRoutersNorthbound.java
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetRequest.java
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetsNorthbound.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Bandwidth.java
opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SubnetConfig.java
opendaylight/web/devices/pom.xml
opendaylight/web/devices/src/main/java/org/opendaylight/controller/devices/web/Devices.java
opendaylight/web/devices/src/main/java/org/opendaylight/controller/devices/web/NodeJsonBean.java
opendaylight/web/devices/src/main/resources/js/page.js
pom.xml
third-party/com.siemens.ct.exi/pom.xml [new file with mode: 0644]
third-party/commons/thirdparty/pom.xml
third-party/ganymed/pom.xml [new file with mode: 0644]
third-party/ganymed/src/main/java/ch/ethz/ssh2/Connection.java [new file with mode: 0644]
third-party/ganymed/src/main/java/ch/ethz/ssh2/transport/TransportManager.java [new file with mode: 0644]

index e85aa31..78d54a7 100644 (file)
@@ -21,12 +21,20 @@ HOW TO BUILD
 ============
 In order to build it's required to have JDK 1.7+ and Maven 3+, to get
 a build going it's needed to:
-1) Choose the distribution, from within opendaylight/distribution
-2) Go in the directory and run
+1) From the root directory run
    "mvn clean install"
-3) On succesfull completion go in the target directory to pick the zip
-file of the distribution or controller can be executed right from
-there going into the distribution directory.
+2) On succesfull completion go in the directory:
+"opendaylight/distribution/opendaylight/target"
+
+to pick the zip file of the distribution or controller can be executed
+right from there going into the distribution directory.
+
+Please note that this way no integration tests but only UT will be
+executed, if you are planning on committing code be aware that the
+code will be tested also for Integrations tests hence make sure before
+submitting a patch to build using the command:
+   "mvn clean install -Pintegrationtests"
+to get IT executed.
 
 HOW TO RELEASE ARTIFACTS
 ========================
index c810d65..2b7462a 100644 (file)
@@ -18,6 +18,8 @@
        <module name="UnusedImports"/>\r
        <module name="AvoidStarImport"/>\r
        <module name="UpperEll"/>\r
+       <module name="EmptyStatement"/>\r
+       <module name="EqualsHashCode"/>\r
     </module>\r
 \r
 </module>\r
index f7b2a01..f86a0b7 100644 (file)
@@ -76,8 +76,8 @@
     <yangtools.binding.version>0.6.0-SNAPSHOT</yangtools.binding.version>
     <!--versions for bits of the controller -->
     <controller.version>0.4.1-SNAPSHOT</controller.version>
-    <config.version>0.2.2-SNAPSHOT</config.version>
-    <netconf.version>0.2.2-SNAPSHOT</netconf.version>
+    <config.version>0.2.3-SNAPSHOT</config.version>
+    <netconf.version>0.2.3-SNAPSHOT</netconf.version>
     <mdsal.version>1.0-SNAPSHOT</mdsal.version>
     <containermanager.version>0.5.1-SNAPSHOT</containermanager.version>
     <switchmanager.api.version>0.6.1-SNAPSHOT</switchmanager.api.version>
     <java.version.target>1.7</java.version.target>
     <!-- enforcer version -->
     <enforcer.version>1.3.1</enforcer.version>
+    <exi.version>0.9.2-SNAPSHOT</exi.version>
   </properties>
 
   <dependencyManagement>
         <artifactId>org.openflow.openflowj</artifactId>
         <version>1.0.2</version>
       </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller.thirdparty</groupId>
+        <artifactId>exificient</artifactId>
+        <version>${exi.version}</version>
+      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller.thirdparty</groupId>
         <artifactId>com.sun.jersey.jersey-servlet</artifactId>
         <artifactId>org.apache.catalina.filters.CorsFilter</artifactId>
         <version>7.0.42</version>
       </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller.thirdparty</groupId>
+        <artifactId>ganymed</artifactId>
+        <version>1.0-SNAPSHOT</version>
+      </dependency>
       <!-- yang model dependencies -->
       <dependency>
        <groupId>org.opendaylight.yangtools.model</groupId>
index 394831d..d733834 100644 (file)
@@ -6,7 +6,7 @@
     <parent>
         <artifactId>config-subsystem</artifactId>
         <groupId>org.opendaylight.controller</groupId>
-        <version>0.2.2-SNAPSHOT</version>
+        <version>0.2.3-SNAPSHOT</version>
     </parent>
 
     <artifactId>config-api</artifactId>
@@ -49,7 +49,6 @@
                             org.opendaylight.controller.config.api.jmx,
                             org.opendaylight.controller.config.api.jmx.constants,
                             org.opendaylight.controller.config.api.runtime,
-                            org.opendaylight.controller.config.stat,
                         </Export-Package>
                     </instructions>
                 </configuration>
index 7cac106..3984545 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.controller.config.api;
 import javax.management.ObjectName;
 
 import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface;
+import org.opendaylight.yangtools.concepts.Identifiable;
 
 /**
  * Each new {@link org.opendaylight.controller.config.spi.Module} can receive
@@ -18,7 +19,7 @@ import org.opendaylight.controller.config.api.annotations.AbstractServiceInterfa
  *
  * @see org.opendaylight.controller.config.spi.Module
  */
-public interface DependencyResolver {
+public interface DependencyResolver extends Identifiable<ModuleIdentifier> {
 
     /**
      * To be used during validation phase to validate serice interface of
diff --git a/opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/stat/ConfigProvider.java b/opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/stat/ConfigProvider.java
deleted file mode 100644 (file)
index 3a81061..0000000
+++ /dev/null
@@ -1,55 +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.config.stat;
-
-import org.osgi.framework.BundleContext;
-
-/**
- * Subset of {@link org.osgi.framework.BundleContext}
- */
-public interface ConfigProvider {
-    /**
-     * Returns the value of the specified property. If the key is not found in
-     * the Framework properties, the system properties are then searched. The
-     * method returns {@code null} if the property is not found.
-     *
-     * <p>
-     * All bundles must have permission to read properties whose names start
-     * with &quot;org.osgi.&quot;.
-     *
-     * @param key
-     *            The name of the requested property.
-     * @return The value of the requested property, or {@code null} if the
-     *         property is undefined.
-     * @throws SecurityException
-     *             If the caller does not have the appropriate
-     *             {@code PropertyPermission} to read the property, and the Java
-     *             Runtime Environment supports permissions.
-     */
-    String getProperty(String key);
-
-    public static class ConfigProviderImpl implements ConfigProvider {
-        private final BundleContext context;
-
-        public ConfigProviderImpl(BundleContext context) {
-            this.context = context;
-        }
-
-        @Override
-        public String getProperty(String key) {
-            return context.getProperty(key);
-        }
-
-        @Override
-        public String toString() {
-            return "ConfigProviderImpl{" + "context=" + context + '}';
-        }
-    }
-
-}
index 138f500..b55b5da 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <artifactId>config-subsystem</artifactId>
         <groupId>org.opendaylight.controller</groupId>
-        <version>0.2.2-SNAPSHOT</version>
+        <version>0.2.3-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
     <artifactId>config-manager</artifactId>
index 343d45a..3f569ae 100644 (file)
@@ -138,8 +138,10 @@ class ConfigTransactionControllerImpl implements
         for (ModuleFactory moduleFactory : toBeAdded) {
             Set<? extends Module> defaultModules = moduleFactory.getDefaultModules(dependencyResolverManager, bundleContext);
             for (Module module : defaultModules) {
+                // ensure default module to be registered to jmx even if its module factory does not use dependencyResolverFactory
+                DependencyResolver dependencyResolver = dependencyResolverManager.getOrCreate(module.getIdentifier());
                 try {
-                    putConfigBeanToJMXAndInternalMaps(module.getIdentifier(), module, moduleFactory, null);
+                    putConfigBeanToJMXAndInternalMaps(module.getIdentifier(), module, moduleFactory, null, dependencyResolver);
                 } catch (InstanceAlreadyExistsException e) {
                     throw new IllegalStateException(e);
                 }
@@ -179,7 +181,7 @@ class ConfigTransactionControllerImpl implements
                     "Error while copying old configuration from %s to %s",
                     oldConfigBeanInfo, moduleFactory), e);
         }
-        putConfigBeanToJMXAndInternalMaps(moduleIdentifier, module, moduleFactory, oldConfigBeanInfo);
+        putConfigBeanToJMXAndInternalMaps(moduleIdentifier, module, moduleFactory, oldConfigBeanInfo, dependencyResolver);
     }
 
     @Override
@@ -196,19 +198,24 @@ class ConfigTransactionControllerImpl implements
         DependencyResolver dependencyResolver = dependencyResolverManager.getOrCreate(moduleIdentifier);
         Module module = moduleFactory.createModule(instanceName, dependencyResolver, bundleContext);
         return putConfigBeanToJMXAndInternalMaps(moduleIdentifier, module,
-                moduleFactory, null);
+                moduleFactory, null, dependencyResolver);
     }
 
     private synchronized ObjectName putConfigBeanToJMXAndInternalMaps(
             ModuleIdentifier moduleIdentifier, Module module,
             ModuleFactory moduleFactory,
-            @Nullable ModuleInternalInfo maybeOldConfigBeanInfo)
+            @Nullable ModuleInternalInfo maybeOldConfigBeanInfo, DependencyResolver dependencyResolver)
             throws InstanceAlreadyExistsException {
+
         logger.debug("Adding module {} to transaction {}", moduleIdentifier, this);
         if (moduleIdentifier.equals(module.getIdentifier())==false) {
             throw new IllegalStateException("Incorrect name reported by module. Expected "
              + moduleIdentifier + ", got " + module.getIdentifier());
         }
+        if (dependencyResolver.getIdentifier().equals(moduleIdentifier) == false ) {
+            throw new IllegalStateException("Incorrect name reported by dependency resolver. Expected "
+                    + moduleIdentifier + ", got " + dependencyResolver.getIdentifier());
+        }
         DynamicMBean writableDynamicWrapper = new DynamicWritableWrapper(
                 module, moduleIdentifier, transactionIdentifier,
                 readOnlyAtomicBoolean, transactionsMBeanServer,
@@ -224,8 +231,6 @@ class ConfigTransactionControllerImpl implements
                 maybeOldConfigBeanInfo, transactionModuleJMXRegistration);
 
         dependencyResolverManager.put(moduleInternalTransactionalInfo);
-        // ensure default module to be registered to jmx even if its module factory does not use dependencyResolverFactory
-        dependencyResolverManager.getOrCreate(moduleIdentifier);
         return writableON;
     }
 
index f817b41..065a0f8 100644 (file)
@@ -7,15 +7,6 @@
  */
 package org.opendaylight.controller.config.manager.impl.dependencyresolver;
 
-import static java.lang.String.format;
-
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import javax.annotation.concurrent.GuardedBy;
-import javax.management.ObjectName;
-
 import org.opendaylight.controller.config.api.DependencyResolver;
 import org.opendaylight.controller.config.api.JmxAttribute;
 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
@@ -25,7 +16,14 @@ import org.opendaylight.controller.config.api.jmx.ObjectNameUtil;
 import org.opendaylight.controller.config.manager.impl.TransactionStatus;
 import org.opendaylight.controller.config.spi.Module;
 import org.opendaylight.controller.config.spi.ModuleFactory;
-import org.opendaylight.yangtools.concepts.Identifiable;
+
+import javax.annotation.concurrent.GuardedBy;
+import javax.management.ObjectName;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import static java.lang.String.format;
 
 /**
  * Protect {@link org.opendaylight.controller.config.spi.Module#getInstance()}
@@ -33,7 +31,7 @@ import org.opendaylight.yangtools.concepts.Identifiable;
  * during validation. Tracks dependencies for ordering purposes.
  */
 final class DependencyResolverImpl implements DependencyResolver,
-       Identifiable<ModuleIdentifier>, Comparable<DependencyResolverImpl> {
+       Comparable<DependencyResolverImpl> {
     private final ModulesHolder modulesHolder;
     private final ModuleIdentifier name;
     private final TransactionStatus transactionStatus;
@@ -47,11 +45,6 @@ final class DependencyResolverImpl implements DependencyResolver,
         this.modulesHolder = modulesHolder;
     }
 
-    @Deprecated
-    public ModuleIdentifier getName() {
-        return name;
-    }
-
     /**
      * {@inheritDoc}
      */
@@ -177,7 +170,7 @@ final class DependencyResolverImpl implements DependencyResolver,
         int maxDepth = 0;
         LinkedHashSet<ModuleIdentifier> chainForDetectingCycles2 = new LinkedHashSet<>(
                 chainForDetectingCycles);
-        chainForDetectingCycles2.add(impl.getName());
+        chainForDetectingCycles2.add(impl.getIdentifier());
         for (ModuleIdentifier dependencyName : impl.dependencies) {
             DependencyResolverImpl dependentDRI = manager
                     .getOrCreate(dependencyName);
index 28f2e37..dea78c8 100644 (file)
@@ -7,15 +7,6 @@
  */
 package org.opendaylight.controller.config.manager.impl.dependencyresolver;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.concurrent.GuardedBy;
-import javax.management.InstanceAlreadyExistsException;
-
 import org.opendaylight.controller.config.api.DependencyResolver;
 import org.opendaylight.controller.config.api.DependencyResolverFactory;
 import org.opendaylight.controller.config.api.JmxAttribute;
@@ -26,6 +17,14 @@ import org.opendaylight.controller.config.manager.impl.TransactionStatus;
 import org.opendaylight.controller.config.spi.Module;
 import org.opendaylight.controller.config.spi.ModuleFactory;
 
+import javax.annotation.concurrent.GuardedBy;
+import javax.management.InstanceAlreadyExistsException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * Holds information about modules being created and destroyed within this
  * transaction. Observes usage of DependencyResolver within modules to figure
@@ -80,7 +79,7 @@ public class DependencyResolverManager implements TransactionHolder, DependencyR
         List<ModuleIdentifier> result = new ArrayList<>(
                 moduleIdentifiersToDependencyResolverMap.size());
         for (DependencyResolverImpl dri : getAllSorted()) {
-            ModuleIdentifier driName = dri.getName();
+            ModuleIdentifier driName = dri.getIdentifier();
             result.add(driName);
         }
         return result;
index f70c4bf..6bbd787 100644 (file)
@@ -7,18 +7,6 @@
  */
 package org.opendaylight.controller.config.manager.impl.dependencyresolver;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.concurrent.GuardedBy;
-import javax.management.InstanceAlreadyExistsException;
-
 import org.opendaylight.controller.config.api.JmxAttribute;
 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
 import org.opendaylight.controller.config.api.ModuleIdentifier;
@@ -28,6 +16,17 @@ import org.opendaylight.controller.config.manager.impl.ModuleInternalTransaction
 import org.opendaylight.controller.config.spi.Module;
 import org.opendaylight.controller.config.spi.ModuleFactory;
 
+import javax.annotation.concurrent.GuardedBy;
+import javax.management.InstanceAlreadyExistsException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * Represents modules to be committed.
  */
@@ -117,8 +116,7 @@ class ModulesHolder implements TransactionHolder {
             throws InstanceAlreadyExistsException {
         if (commitMap.containsKey(moduleIdentifier)) {
             throw new InstanceAlreadyExistsException(
-                    "There is an instance registered with name "
-                            + moduleIdentifier);
+                    "There is an instance registered with name " + moduleIdentifier);
         }
     }
 
index f81e747..8f05ed7 100644 (file)
@@ -7,10 +7,6 @@
  */
 package org.opendaylight.controller.config.manager.impl.dependencyresolver;
 
-import java.util.Map;
-
-import javax.management.InstanceAlreadyExistsException;
-
 import org.opendaylight.controller.config.api.JmxAttribute;
 import org.opendaylight.controller.config.api.ModuleIdentifier;
 import org.opendaylight.controller.config.manager.impl.CommitInfo;
@@ -18,6 +14,9 @@ import org.opendaylight.controller.config.manager.impl.ModuleInternalTransaction
 import org.opendaylight.controller.config.spi.Module;
 import org.opendaylight.controller.config.spi.ModuleFactory;
 
+import javax.management.InstanceAlreadyExistsException;
+import java.util.Map;
+
 interface TransactionHolder {
     CommitInfo toCommitInfo();
 
index 504c295..51f8c0b 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <artifactId>config-subsystem</artifactId>
         <groupId>org.opendaylight.controller</groupId>
-        <version>0.2.2-SNAPSHOT</version>
+        <version>0.2.3-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
     <artifactId>config-persister-api</artifactId>
@@ -33,7 +33,6 @@
                             com.google.common.base,
                             org.w3c.dom,
                             org.osgi.framework,
-                            org.opendaylight.controller.config.stat
                         </Import-Package>
                         <Export-Package>
                             org.opendaylight.controller.config.persist.api,
index 4475040..9daf4a1 100644 (file)
@@ -9,7 +9,7 @@
 package org.opendaylight.controller.config.persist.api.storage;
 
 import org.opendaylight.controller.config.persist.api.Persister;
-import org.opendaylight.controller.config.stat.ConfigProvider;
+import org.osgi.framework.BundleContext;
 
 /**
  * Plugins for {@link org.opendaylight.controller.config.persist.api.Persister}
@@ -17,6 +17,6 @@ import org.opendaylight.controller.config.stat.ConfigProvider;
  */
 public interface StorageAdapter extends Persister {
 
-    void setProperties(ConfigProvider configProvider);
+    void setProperties(BundleContext bundleContext);
 
 }
index a5c026d..b243ead 100644 (file)
@@ -6,7 +6,7 @@
     <parent>
         <artifactId>config-subsystem</artifactId>
         <groupId>org.opendaylight.controller</groupId>
-        <version>0.2.2-SNAPSHOT</version>
+        <version>0.2.3-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
     <artifactId>config-persister-file-adapter</artifactId>
@@ -80,7 +80,6 @@
                             javax.xml.transform.stream,
                             org.apache.commons.lang3,
                             org.opendaylight.controller.config.persist.api,
-                            org.opendaylight.controller.config.stat,
                             org.opendaylight.controller.config.persist.api.storage,
                             org.slf4j,
                             org.w3c.dom,
index a866743..775fb1f 100644 (file)
@@ -16,7 +16,7 @@ import com.google.common.collect.Sets;
 import com.google.common.io.Files;
 import org.apache.commons.lang3.StringUtils;
 import org.opendaylight.controller.config.persist.api.storage.StorageAdapter;
-import org.opendaylight.controller.config.stat.ConfigProvider;
+import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.SAXException;
@@ -55,8 +55,8 @@ public class FileStorageAdapter implements StorageAdapter {
     private File storage;
 
     @Override
-    public void setProperties(ConfigProvider configProvider) {
-        File storage = extractStorageFileFromProperties(configProvider);
+    public void setProperties(BundleContext bundleContext) {
+        File storage = extractStorageFileFromProperties(bundleContext);
         logger.debug("Using file {}", storage.getAbsolutePath());
         // Create file if it does not exist
         File parentFile = storage.getAbsoluteFile().getParentFile();
@@ -92,12 +92,12 @@ public class FileStorageAdapter implements StorageAdapter {
         numberOfStoredBackups = numberOfBackups;
     }
 
-    private static File extractStorageFileFromProperties(ConfigProvider configProvider) {
-        String fileStorageProperty = configProvider.getProperty(FILE_STORAGE_PROP);
+    private static File extractStorageFileFromProperties(BundleContext bundleContext) {
+        String fileStorageProperty = bundleContext.getProperty(FILE_STORAGE_PROP);
         Preconditions.checkNotNull(fileStorageProperty, "Unable to find " + FILE_STORAGE_PROP
-                + " in received properties :" + configProvider);
+                + " in received context :" + bundleContext);
         File result = new File(fileStorageProperty);
-        String numberOfBAckupsAsString = configProvider.getProperty(NUMBER_OF_BACKUPS);
+        String numberOfBAckupsAsString = bundleContext.getProperty(NUMBER_OF_BACKUPS);
         if (numberOfBAckupsAsString != null) {
             numberOfStoredBackups = Integer.valueOf(numberOfBAckupsAsString);
         } else {
index bf681b1..206184c 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <artifactId>config-subsystem</artifactId>
         <groupId>org.opendaylight.controller</groupId>
-        <version>0.2.2-SNAPSHOT</version>
+        <version>0.2.3-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
     <artifactId>config-util</artifactId>
index 9abc8cc..b63f329 100644 (file)
@@ -6,7 +6,7 @@
     <parent>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>config-subsystem</artifactId>
-        <version>0.2.2-SNAPSHOT</version>
+        <version>0.2.3-SNAPSHOT</version>
     </parent>
     <artifactId>logback-config</artifactId>
     <name>${project.artifactId}</name>
diff --git a/opendaylight/config/netty-threadgroup-config/pom.xml b/opendaylight/config/netty-threadgroup-config/pom.xml
new file mode 100644 (file)
index 0000000..ef63fce
--- /dev/null
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <parent>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>config-subsystem</artifactId>
+        <version>0.2.3-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>netty-threadgroup-config</artifactId>
+    <description>Configuration Wrapper around netty's event group</description>
+    <packaging>bundle</packaging>
+    <name>${project.artifactId}</name>
+    <prerequisites>
+        <maven>3.0.4</maven>
+    </prerequisites>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>config-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>threadpool-config-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+
+
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
+
+        <!--test dependencies -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>config-manager</artifactId>
+            <scope>test</scope>
+            <type>test-jar</type>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>config-manager</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>config-util</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.bgpcep</groupId>
+            <artifactId>mockito-configuration</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+
+            <plugin>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-maven-plugin</artifactId>
+            </plugin>
+
+
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.3.7</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                        <Export-Package>
+                        </Export-Package>
+                        <Import-Package>
+                            com.google.common.base,
+                            io.netty.channel.nio,
+                            org.opendaylight.controller.config.yang.threadpool,
+                            io.netty.util.concurrent,
+                            org.opendaylight.controller.config.api,
+                            org.opendaylight.controller.config.api.annotations,
+                            org.opendaylight.controller.config.api.runtime,
+                            org.opendaylight.controller.config.spi,
+                            org.slf4j,
+                            org.osgi.framework
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <distributionManagement>
+        <site>
+            <id>${project.artifactId}</id>
+            <name>NETTY-THREADGROUP-CONFIG Module site</name>
+            <url>${basedir}/target/site/${project.artifactId}</url>
+        </site>
+    </distributionManagement>
+
+</project>
diff --git a/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/NettyThreadgroupModule.java b/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/NettyThreadgroupModule.java
new file mode 100644 (file)
index 0000000..fd6b216
--- /dev/null
@@ -0,0 +1,57 @@
+/**
+* Generated file
+
+* Generated from: yang module name: nsos-threadpool  yang module local name: netty-threadgroup-fixed
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri Nov 08 08:31:45 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.netty.threadgroup;
+
+import com.google.common.base.Preconditions;
+import io.netty.channel.nio.NioEventLoopGroup;
+
+/**
+*
+*/
+public final class NettyThreadgroupModule extends org.opendaylight.controller.config.yang.netty.threadgroup.AbstractNettyThreadgroupModule
+{
+    public NettyThreadgroupModule(org.opendaylight.controller.config.api.ModuleIdentifier name, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(name, dependencyResolver);
+    }
+
+    public NettyThreadgroupModule(org.opendaylight.controller.config.api.ModuleIdentifier name, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, NettyThreadgroupModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(name, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void validate(){
+        if(getThreadCount()!=null) {
+            Preconditions.checkArgument(getThreadCount() > 0, "Thread count cannot be < 0");
+        }
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        return getThreadCount()==null ? new NioEventLoopGroupCloseable() : new NioEventLoopGroupCloseable(getThreadCount());
+    }
+
+
+    private class NioEventLoopGroupCloseable extends NioEventLoopGroup implements AutoCloseable {
+
+
+        public NioEventLoopGroupCloseable(int threadCount) {
+            super(threadCount);
+        }
+
+        public NioEventLoopGroupCloseable() {
+            super();
+        }
+
+        @Override
+        public void close() throws Exception {
+            shutdownGracefully();
+        }
+    }
+}
diff --git a/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/NettyThreadgroupModuleFactory.java b/opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/NettyThreadgroupModuleFactory.java
new file mode 100644 (file)
index 0000000..1dca381
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: nsos-threadpool  yang module local name: netty-threadgroup-fixed
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri Nov 08 08:31:45 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.netty.threadgroup;
+
+/**
+*
+*/
+public class NettyThreadgroupModuleFactory extends org.opendaylight.controller.config.yang.netty.threadgroup.AbstractNettyThreadgroupModuleFactory
+{
+
+
+}
diff --git a/opendaylight/config/netty-threadgroup-config/src/main/yang/nsos-netty-threadgroup.yang b/opendaylight/config/netty-threadgroup-config/src/main/yang/nsos-netty-threadgroup.yang
new file mode 100644 (file)
index 0000000..f13cf39
--- /dev/null
@@ -0,0 +1,53 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module nsos-threadpool {
+    yang-version 1;
+       namespace "urn:opendaylight:params:xml:ns:yang:controller:netty:threadgroup";
+    prefix "netty-t";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import threadpool { prefix th; revision-date 2013-04-09; }
+
+    organization "Cisco Systems, Inc.";
+
+    contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for NS-OS
+         thread-related services.
+
+        Copyright (c)2013 Cisco Systems, Inc. All rights reserved.";
+
+    revision "2013-11-07" {
+        description
+            "Initial revision";
+    }
+
+    identity netty-threadgroup-fixed {
+        base config:module-type;
+        config:provided-service th:netty-threadgroup;
+        config:java-name-prefix NettyThreadgroup;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case netty-threadgroup-fixed {
+            when "/config:modules/config:module/config:type = 'netty-threadgroup-fixed'";
+
+            leaf thread-count {
+                type uint16;
+
+                description "Number of threads to be used by NioEventLoopGroup. This attribute is optional and default value will be 2* Number of CPUs";
+            }
+
+            // TODO add optional thread factory dependency
+
+        }
+    }
+
+    augment "/config:modules/config:module/config:state" {
+        case netty-threadgroup-fixed {
+            when "/config:modules/config:module/config:type = 'netty-threadgroup-fixed'";
+        }
+    }
+
+
+}
diff --git a/opendaylight/config/netty-threadgroup-config/src/test/java/org/opendaylight/controller/config/yang/netty/threadgroup/NettyThreadgroupModuleTest.java b/opendaylight/config/netty-threadgroup-config/src/test/java/org/opendaylight/controller/config/yang/netty/threadgroup/NettyThreadgroupModuleTest.java
new file mode 100644 (file)
index 0000000..590bd91
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * 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.threadgroup;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.config.api.ConflictingVersionException;
+import org.opendaylight.controller.config.api.ValidationException;
+import org.opendaylight.controller.config.api.jmx.CommitStatus;
+import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
+import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
+import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.ObjectName;
+
+public class NettyThreadgroupModuleTest extends AbstractConfigTest {
+
+    private NettyThreadgroupModuleFactory factory;
+    private final String instanceName = "netty1";
+
+    @Before
+    public void setUp() {
+        factory = new NettyThreadgroupModuleFactory();
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(factory));
+    }
+
+    @Test
+    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException, ConflictingVersionException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+
+        createInstance(transaction, instanceName, 2);
+        createInstance(transaction, instanceName + 2, null);
+        transaction.validateConfig();
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(2, factory.getImplementationName());
+        assertStatus(status, 2, 0, 0);
+    }
+
+    @Test
+    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException, ValidationException {
+
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createInstance(transaction, instanceName, null);
+
+        transaction.commit();
+
+        transaction = configRegistryClient.createTransaction();
+        assertBeanCount(1, factory.getImplementationName());
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(1, factory.getImplementationName());
+        assertStatus(status, 0, 0, 1);
+    }
+
+    @Test
+    public void testReconfigure() throws InstanceAlreadyExistsException, ConflictingVersionException,
+            ValidationException, InstanceNotFoundException {
+
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createInstance(transaction, instanceName, null);
+
+        transaction.commit();
+
+        transaction = configRegistryClient.createTransaction();
+        assertBeanCount(1, factory.getImplementationName());
+        NettyThreadgroupModuleMXBean mxBean = transaction.newMBeanProxy(
+                transaction.lookupConfigBean(AbstractNettyThreadgroupModuleFactory.NAME, instanceName),
+                NettyThreadgroupModuleMXBean.class);
+        mxBean.setThreadCount(1);
+        CommitStatus status = transaction.commit();
+
+        assertBeanCount(1, factory.getImplementationName());
+        assertStatus(status, 0, 1, 0);
+    }
+
+    private ObjectName createInstance(ConfigTransactionJMXClient transaction, String instanceName, Integer threads)
+            throws InstanceAlreadyExistsException {
+        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);
+        NettyThreadgroupModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated, NettyThreadgroupModuleMXBean.class);
+        mxBean.setThreadCount(threads);
+        return nameCreated;
+    }
+}
index 949c283..2842b5c 100755 (executable)
@@ -10,7 +10,7 @@
     </parent>
 
 
-    <version>0.2.2-SNAPSHOT</version>
+    <version>0.2.3-SNAPSHOT</version>
     <artifactId>config-subsystem</artifactId>
     <packaging>pom</packaging>
     <name>${project.artifactId}</name>
         <module>config-persister-file-adapter</module>
         <module>yang-jmx-generator</module>
         <module>yang-jmx-generator-plugin</module>
-        <module>yang-jmx-generator-it</module>
         <module>yang-store-api</module>
         <module>yang-store-impl</module>
         <module>yang-test</module>
         <module>logback-config</module>
+        <module>threadpool-config-api</module>
+        <module>threadpool-config-impl</module>
+        <module>netty-threadgroup-config</module>
     </modules>
+
+    <profiles>
+      <profile>
+        <id>integrationtests</id>
+        <activation>
+          <activeByDefault>false</activeByDefault>
+        </activation>
+        <modules>
+          <module>yang-jmx-generator-it</module>
+        </modules>
+      </profile>
+    </profiles>
+
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <java.version.source>1.7</java.version.source>
diff --git a/opendaylight/config/threadpool-config-api/pom.xml b/opendaylight/config/threadpool-config-api/pom.xml
new file mode 100644 (file)
index 0000000..d8ddc4f
--- /dev/null
@@ -0,0 +1,56 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <parent>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>config-subsystem</artifactId>
+      <version>0.2.3-SNAPSHOT</version>
+   </parent>
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>threadpool-config-api</artifactId>
+   <name>${project.artifactId}</name>
+   <packaging>bundle</packaging>
+   <prerequisites>
+      <maven>3.0.4</maven>
+   </prerequisites>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>config-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-transport</artifactId>
+        </dependency>
+    </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-bundle-plugin</artifactId>
+            <configuration>
+               <instructions>
+                  <Import-Package>
+                     org.opendaylight.controller.config.api.*,
+                     com.google.common.eventbus,
+                     io.netty.channel,
+                  </Import-Package>
+                  <Export-Package>
+                     org.opendaylight.controller.config.threadpool,
+                     org.opendaylight.controller.config.yang.threadpool
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+         <plugin>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-maven-plugin</artifactId>
+         </plugin>
+      </plugins>
+   </build>
+</project>
\ No newline at end of file
diff --git a/opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ScheduledThreadPool.java b/opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ScheduledThreadPool.java
new file mode 100644 (file)
index 0000000..bf6c016
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * 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;
+
+import java.util.concurrent.ScheduledExecutorService;
+
+/**
+ * Interface representing scheduled {@link ThreadPool}.
+ */
+public interface ScheduledThreadPool extends ThreadPool {
+
+    @Override
+    public ScheduledExecutorService getExecutor();
+}
\ No newline at end of file
diff --git a/opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ThreadPool.java b/opendaylight/config/threadpool-config-api/src/main/java/org/opendaylight/controller/config/threadpool/ThreadPool.java
new file mode 100644 (file)
index 0000000..701b0bc
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * 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;
+
+import java.util.concurrent.ExecutorService;
+
+/**
+ * Interface representing thread pool.
+ */
+public interface ThreadPool {
+
+    public ExecutorService getExecutor();
+
+    public int getMaxThreadCount();
+}
\ No newline at end of file
diff --git a/opendaylight/config/threadpool-config-api/src/main/yang/threadpool.yang b/opendaylight/config/threadpool-config-api/src/main/yang/threadpool.yang
new file mode 100644 (file)
index 0000000..5cc17e5
--- /dev/null
@@ -0,0 +1,87 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module threadpool {
+       yang-version 1;
+       namespace "urn:opendaylight:params:xml:ns:yang:controller:threadpool";
+       prefix "th";
+
+       import config { prefix config; revision-date 2013-04-05; }
+
+       organization "Cisco Systems, Inc.";
+
+       contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for
+         thread-related services.
+
+        Copyright (c)2013 Cisco Systems, Inc. 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";
+
+    revision "2013-04-09" {
+        description
+            "Added eventbus service.";
+    }
+
+    revision "2013-04-05" {
+        description
+            "Updated with YANG extension for Java class specification.";
+    }
+
+    revision "2013-04-03" {
+        description
+            "Initial revision by Anton Tkacik, Tomas Olvecky and
+             Robert Varga.";
+    }
+
+    identity eventbus {
+        description
+            "Service representing an event bus. The service acts as message
+             router between event producers and event consumers";
+
+        base "config:service-type";
+        config:java-class "com.google.common.eventbus.EventBus";
+    }
+
+    identity threadfactory {
+        description
+            "Service representing a ThreadFactory instance. It is directly
+             useful in Java world, where various library pieces need to create
+             threads and you may want to inject a customized thread
+             implementation.";
+
+        base "config:service-type";
+        config:java-class "java.util.concurrent.ThreadFactory";
+    }
+
+       identity threadpool {
+        description
+            "A simple pool of threads able to execute work.";
+
+               base "config:service-type";
+        config:java-class "org.opendaylight.controller.config.threadpool.ThreadPool";
+       }
+
+       identity scheduled-threadpool {
+        description
+            "An extension of the simple pool of threads able to schedule
+             work to be executed at some point in time.";
+
+               base "threadpool";
+        config:java-class "org.opendaylight.controller.config.threadpool.ScheduledThreadPool";
+       }
+
+
+    identity netty-threadgroup {
+        description
+            "Configuration wrapper around netty's threadgroup";
+
+        base "config:service-type";
+        config:java-class "io.netty.channel.EventLoopGroup";
+    }
+
+
+}
diff --git a/opendaylight/config/threadpool-config-impl/pom.xml b/opendaylight/config/threadpool-config-impl/pom.xml
new file mode 100644 (file)
index 0000000..cde6436
--- /dev/null
@@ -0,0 +1,99 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <parent>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>config-subsystem</artifactId>
+      <version>0.2.3-SNAPSHOT</version>
+   </parent>
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>threadpool-config-impl</artifactId>
+   <name>${project.artifactId}</name>
+   <packaging>bundle</packaging>
+   <prerequisites>
+      <maven>3.0.4</maven>
+   </prerequisites>
+
+   <dependencies>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>config-api</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>threadpool-config-api</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>com.google.guava</groupId>
+         <artifactId>guava</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>org.slf4j</groupId>
+         <artifactId>slf4j-api</artifactId>
+      </dependency>
+
+      <!--test dependencies -->
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>config-manager</artifactId>
+         <scope>test</scope>
+         <type>test-jar</type>
+      </dependency>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>config-manager</artifactId>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>config-util</artifactId>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.opendaylight.bgpcep</groupId>
+         <artifactId>mockito-configuration</artifactId>
+         <scope>test</scope>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-bundle-plugin</artifactId>
+            <configuration>
+               <instructions>
+                  <Private-Package>
+                     org.opendaylight.controller.config.threadpool.util,
+                     javax.annotation.*,
+                     org.opendaylight.controller.config.yang.threadpool.impl,
+                  </Private-Package>
+                  <Import-Package>
+                     org.opendaylight.controller.config.api.*,
+                     org.opendaylight.controller.config.spi.*,
+                     org.opendaylight.controller.config.threadpool,
+                     org.opendaylight.controller.config.yang.threadpool,
+                     javax.management,
+                     org.osgi.framework,
+                     org.slf4j,
+                     com.google.common.*
+                  </Import-Package>
+                  <Export-Package>
+                     org.opendaylight.controller.config.threadpool.util
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-jar-plugin</artifactId>
+         </plugin>
+
+         <plugin>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-maven-plugin</artifactId>
+         </plugin>
+      </plugins>
+   </build>
+
+</project>
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/CloseableAsyncEventBus.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/CloseableAsyncEventBus.java
new file mode 100644 (file)
index 0000000..93a08da
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * 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.util;
+
+import com.google.common.eventbus.AsyncEventBus;
+import com.google.common.eventbus.DeadEvent;
+import com.google.common.eventbus.Subscribe;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+import org.opendaylight.controller.config.threadpool.ThreadPool;
+import org.opendaylight.controller.config.yang.threadpool.impl.AsyncEventBusRuntimeMXBean;
+import org.opendaylight.controller.config.yang.threadpool.impl.AsyncEventBusRuntimeRegistration;
+import org.opendaylight.controller.config.yang.threadpool.impl.AsyncEventBusRuntimeRegistrator;
+
+/**
+ * Closeable version of {@link AsyncEventBus}.
+ */
+public class CloseableAsyncEventBus extends AsyncEventBus implements Closeable {
+    private final ThreadPool threadPool;
+    private final AsyncEventBusRuntimeRegistration rootRegistration;
+
+    public CloseableAsyncEventBus(String identifier, ThreadPool threadPool,
+            AsyncEventBusRuntimeRegistrator rootRegistrator) {
+        super(identifier, threadPool.getExecutor());
+        this.threadPool = threadPool;
+        rootRegistration = rootRegistrator.register(new AsyncEventBusRuntimeMXBean() {
+            private long deadEventsCounter = 0;
+
+            @Subscribe
+            public void increaseDeadEvents(DeadEvent deadEvent) {
+                deadEventsCounter++;
+            }
+
+            @Override
+            public Long countDeadEvents() {
+                return deadEventsCounter;
+            }
+
+        });
+    }
+
+    public ThreadPool getThreadPool() {
+        return threadPool;
+    }
+
+    @Override
+    public void close() throws IOException {
+        rootRegistration.close();
+    }
+
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/CloseableEventBus.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/CloseableEventBus.java
new file mode 100644 (file)
index 0000000..b6dd77d
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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.util;
+
+import java.io.Closeable;
+
+import org.opendaylight.controller.config.yang.threadpool.impl.EventBusRuntimeMXBean;
+import org.opendaylight.controller.config.yang.threadpool.impl.EventBusRuntimeRegistration;
+import org.opendaylight.controller.config.yang.threadpool.impl.EventBusRuntimeRegistrator;
+
+import com.google.common.eventbus.DeadEvent;
+import com.google.common.eventbus.EventBus;
+import com.google.common.eventbus.Subscribe;
+
+/**
+ * Closeable {@link EventBus}.
+ */
+public class CloseableEventBus extends EventBus implements Closeable {
+
+    private final EventBusRuntimeRegistration rootRegistration;
+
+    public CloseableEventBus(String identifier, EventBusRuntimeRegistrator rootRegistrator) {
+        super(identifier);
+        rootRegistration = rootRegistrator.register(new EventBusRuntimeMXBean() {
+            private long deadEventsCounter = 0;
+
+            @Subscribe
+            public void increaseDeadEvents(DeadEvent deadEvent) {
+                deadEventsCounter++;
+            }
+
+            @Override
+            public Long countDeadEvents() {
+                return deadEventsCounter;
+            }
+        });
+
+    }
+
+    @Override
+    public void close() {
+        rootRegistration.close();
+
+    }
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FixedThreadPoolWrapper.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FixedThreadPoolWrapper.java
new file mode 100644 (file)
index 0000000..ca03443
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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.util;
+
+import java.io.Closeable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+
+import org.opendaylight.controller.config.threadpool.ThreadPool;
+
+/**
+ * Implementation of {@link ThreadPool} using fixed number of threads wraps
+ * {@link ExecutorService}.
+ */
+public class FixedThreadPoolWrapper implements ThreadPool, Closeable {
+
+    private final ThreadPoolExecutor executor;
+
+    public FixedThreadPoolWrapper(int threadCount, ThreadFactory factory) {
+        this.executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(threadCount, factory);
+        executor.prestartAllCoreThreads();
+    }
+
+    @Override
+    public ExecutorService getExecutor() {
+        return Executors.unconfigurableExecutorService(executor);
+    }
+
+    @Override
+    public void close() {
+        executor.shutdown();
+    }
+
+    @Override
+    public int getMaxThreadCount() {
+        return executor.getMaximumPoolSize();
+    }
+
+    public void setMaxThreadCount(int maxThreadCount) {
+        executor.setCorePoolSize(maxThreadCount);
+        executor.setMaximumPoolSize(maxThreadCount);
+    }
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FlexibleThreadPoolWrapper.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FlexibleThreadPoolWrapper.java
new file mode 100644 (file)
index 0000000..3dfa6e2
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * 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.util;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import org.opendaylight.controller.config.threadpool.ThreadPool;
+
+/**
+ * Implementation of {@link ThreadPool} using flexible number of threads wraps
+ * {@link ExecutorService}.
+ */
+public class FlexibleThreadPoolWrapper implements ThreadPool, Closeable {
+    private final ThreadPoolExecutor executor;
+
+    public FlexibleThreadPoolWrapper(int minThreadCount, int maxThreadCount, long keepAlive, TimeUnit timeUnit,
+            ThreadFactory threadFactory) {
+
+        executor = new ThreadPoolExecutor(minThreadCount, maxThreadCount, keepAlive, timeUnit,
+                new SynchronousQueue<Runnable>(), threadFactory);
+        executor.prestartAllCoreThreads();
+    }
+
+    @Override
+    public ExecutorService getExecutor() {
+        return Executors.unconfigurableExecutorService(executor);
+    }
+
+    public int getMinThreadCount() {
+        return executor.getCorePoolSize();
+    }
+
+    public void setMinThreadCount(int minThreadCount) {
+        executor.setCorePoolSize(minThreadCount);
+    }
+
+    @Override
+    public int getMaxThreadCount() {
+        return executor.getMaximumPoolSize();
+    }
+
+    public void setMaxThreadCount(int maxThreadCount) {
+        executor.setMaximumPoolSize(maxThreadCount);
+    }
+
+    public long getKeepAliveMillis() {
+        return executor.getKeepAliveTime(TimeUnit.MILLISECONDS);
+    }
+
+    public void setKeepAliveMillis(long keepAliveMillis) {
+        executor.setKeepAliveTime(keepAliveMillis, TimeUnit.MILLISECONDS);
+    }
+
+    public void setThreadFactory(ThreadFactory threadFactory) {
+        executor.setThreadFactory(threadFactory);
+    }
+
+    public void prestartAllCoreThreads() {
+        executor.prestartAllCoreThreads();
+    }
+
+    @Override
+    public void close() throws IOException {
+        executor.shutdown();
+    }
+
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/NamingThreadPoolFactory.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/NamingThreadPoolFactory.java
new file mode 100644 (file)
index 0000000..2e27d6c
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.util;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicLong;
+
+import javax.annotation.concurrent.ThreadSafe;
+
+import com.google.common.base.Preconditions;
+
+/**
+ * Implementation of {@link ThreadFactory}.
+ */
+@ThreadSafe
+public class NamingThreadPoolFactory implements ThreadFactory, Closeable {
+
+    private final ThreadGroup group;
+    private final String namePrefix;
+    private final AtomicLong threadName = new AtomicLong();
+
+    public NamingThreadPoolFactory(String namePrefix) {
+        Preconditions.checkNotNull(namePrefix);
+        this.group = new ThreadGroup(namePrefix);
+        this.namePrefix = namePrefix;
+    }
+
+    @Override
+    public Thread newThread(Runnable r) {
+        return new Thread(group, r, String.format("%s-%d", group.getName(), threadName.incrementAndGet()));
+    }
+
+    @Override
+    public void close() throws IOException {
+    }
+
+    public String getNamePrefix() {
+        return namePrefix;
+    }
+
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/ScheduledThreadPoolWrapper.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/ScheduledThreadPoolWrapper.java
new file mode 100644 (file)
index 0000000..ee3399e
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.util;
+
+import java.io.Closeable;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadFactory;
+
+import org.opendaylight.controller.config.threadpool.ScheduledThreadPool;
+
+/**
+ * Implementation of {@link ScheduledThreadPool} wraps
+ * {@link ScheduledExecutorService}.
+ */
+public class ScheduledThreadPoolWrapper implements ScheduledThreadPool, Closeable {
+
+    private final ScheduledThreadPoolExecutor executor;
+    private final int threadCount;
+
+    public ScheduledThreadPoolWrapper(int threadCount, ThreadFactory factory) {
+        this.threadCount = threadCount;
+        this.executor = new ScheduledThreadPoolExecutor(threadCount, factory);
+        executor.prestartAllCoreThreads();
+    }
+
+    @Override
+    public ScheduledExecutorService getExecutor() {
+        return Executors.unconfigurableScheduledExecutorService(executor);
+    }
+
+    @Override
+    public void close() {
+        executor.shutdown();
+    }
+
+    @Override
+    public int getMaxThreadCount() {
+        return threadCount;
+    }
+
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/AsyncEventBusModule.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/AsyncEventBusModule.java
new file mode 100644 (file)
index 0000000..f108303
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: threadpool-impl  yang module local name: async-eventbus
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Tue Nov 05 15:40:46 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.threadpool.impl;
+
+import org.opendaylight.controller.config.threadpool.util.CloseableAsyncEventBus;
+
+/**
+*
+*/
+public final class AsyncEventBusModule extends
+        org.opendaylight.controller.config.yang.threadpool.impl.AbstractAsyncEventBusModule {
+
+    public AsyncEventBusModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public AsyncEventBusModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            AsyncEventBusModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void validate() {
+        super.validate();
+        // Add custom validation for module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        return new CloseableAsyncEventBus(getIdentifier().toString(), getThreadpoolDependency(),
+                getRootRuntimeBeanRegistratorWrapper());
+    }
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/AsyncEventBusModuleFactory.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/AsyncEventBusModuleFactory.java
new file mode 100644 (file)
index 0000000..14fcf41
--- /dev/null
@@ -0,0 +1,18 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: threadpool-impl  yang module local name: async-eventbus
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Tue Nov 05 15:40:46 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.threadpool.impl;
+
+/**
+*
+*/
+public class AsyncEventBusModuleFactory extends
+        org.opendaylight.controller.config.yang.threadpool.impl.AbstractAsyncEventBusModuleFactory {
+
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/EventBusModule.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/EventBusModule.java
new file mode 100644 (file)
index 0000000..92eaee5
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: threadpool-impl  yang module local name: eventbus
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Tue Nov 05 15:40:46 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.threadpool.impl;
+
+import org.opendaylight.controller.config.threadpool.util.CloseableEventBus;
+
+/**
+*
+*/
+public final class EventBusModule extends
+        org.opendaylight.controller.config.yang.threadpool.impl.AbstractEventBusModule {
+
+    public EventBusModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public EventBusModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, EventBusModule oldModule,
+            java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void validate() {
+        super.validate();
+        // Add custom validation for module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        return new CloseableEventBus(getIdentifier().toString(), getRootRuntimeBeanRegistratorWrapper());
+    }
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/EventBusModuleFactory.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/EventBusModuleFactory.java
new file mode 100644 (file)
index 0000000..e909998
--- /dev/null
@@ -0,0 +1,18 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: threadpool-impl  yang module local name: eventbus
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Tue Nov 05 15:40:46 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.threadpool.impl;
+
+/**
+*
+*/
+public class EventBusModuleFactory extends
+        org.opendaylight.controller.config.yang.threadpool.impl.AbstractEventBusModuleFactory {
+
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FixedThreadPoolModule.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FixedThreadPoolModule.java
new file mode 100644 (file)
index 0000000..a0a9add
--- /dev/null
@@ -0,0 +1,45 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: threadpool-impl  yang module local name: threadpool-fixed
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 16:19:33 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.threadpool.impl;
+
+import org.opendaylight.controller.config.api.JmxAttributeValidationException;
+import org.opendaylight.controller.config.threadpool.util.FixedThreadPoolWrapper;
+
+/**
+*
+*/
+public final class FixedThreadPoolModule extends
+        org.opendaylight.controller.config.yang.threadpool.impl.AbstractFixedThreadPoolModule {
+
+    public FixedThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public FixedThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            FixedThreadPoolModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void validate() {
+        super.validate();
+
+        JmxAttributeValidationException.checkNotNull(getMaxThreadCount(), maxThreadCountJmxAttribute);
+        JmxAttributeValidationException.checkCondition(getMaxThreadCount() > 0, "must be greater than zero",
+                maxThreadCountJmxAttribute);
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        return new FixedThreadPoolWrapper(getMaxThreadCount(), getThreadFactoryDependency());
+    }
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FixedThreadPoolModuleFactory.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FixedThreadPoolModuleFactory.java
new file mode 100644 (file)
index 0000000..2803448
--- /dev/null
@@ -0,0 +1,18 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: threadpool-impl  yang module local name: threadpool-fixed
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 16:19:33 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.threadpool.impl;
+
+/**
+*
+*/
+public class FixedThreadPoolModuleFactory extends
+        org.opendaylight.controller.config.yang.threadpool.impl.AbstractFixedThreadPoolModuleFactory {
+
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FlexibleThreadPoolModule.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FlexibleThreadPoolModule.java
new file mode 100644 (file)
index 0000000..47b4eec
--- /dev/null
@@ -0,0 +1,55 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: threadpool-impl  yang module local name: threadpool-flexible
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 16:19:33 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.threadpool.impl;
+
+import java.util.concurrent.TimeUnit;
+
+import org.opendaylight.controller.config.api.JmxAttributeValidationException;
+import org.opendaylight.controller.config.threadpool.util.FlexibleThreadPoolWrapper;
+
+/**
+*
+*/
+public final class FlexibleThreadPoolModule extends
+        org.opendaylight.controller.config.yang.threadpool.impl.AbstractFlexibleThreadPoolModule {
+
+    public FlexibleThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public FlexibleThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            FlexibleThreadPoolModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void validate() {
+        super.validate();
+        JmxAttributeValidationException.checkNotNull(getKeepAliveMillis(), keepAliveMillisJmxAttribute);
+        JmxAttributeValidationException.checkCondition(getKeepAliveMillis() > 0, "must be greater than zero",
+                keepAliveMillisJmxAttribute);
+
+        JmxAttributeValidationException.checkNotNull(getMinThreadCount(), minThreadCountJmxAttribute);
+        JmxAttributeValidationException.checkCondition(getMinThreadCount() > 0, "must be greater than zero",
+                minThreadCountJmxAttribute);
+
+        JmxAttributeValidationException.checkNotNull(getMaxThreadCount(), maxThreadCountJmxAttribute);
+        JmxAttributeValidationException.checkCondition(getMaxThreadCount() > 0, "must be greater than zero",
+                maxThreadCountJmxAttribute);
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        return new FlexibleThreadPoolWrapper(getMinThreadCount(), getMaxThreadCount(), getKeepAliveMillis(),
+                TimeUnit.MILLISECONDS, getThreadFactoryDependency());
+    }
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FlexibleThreadPoolModuleFactory.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/FlexibleThreadPoolModuleFactory.java
new file mode 100644 (file)
index 0000000..ef6ebd2
--- /dev/null
@@ -0,0 +1,18 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: threadpool-impl  yang module local name: threadpool-flexible
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 16:19:33 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.threadpool.impl;
+
+/**
+*
+*/
+public class FlexibleThreadPoolModuleFactory extends
+        org.opendaylight.controller.config.yang.threadpool.impl.AbstractFlexibleThreadPoolModuleFactory {
+
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/NamingThreadFactoryModule.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/NamingThreadFactoryModule.java
new file mode 100644 (file)
index 0000000..a761727
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: threadpool-impl  yang module local name: threadfactory-naming
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 16:19:33 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.threadpool.impl;
+
+import org.opendaylight.controller.config.api.JmxAttributeValidationException;
+import org.opendaylight.controller.config.threadpool.util.NamingThreadPoolFactory;
+
+/**
+*
+*/
+public final class NamingThreadFactoryModule extends
+        org.opendaylight.controller.config.yang.threadpool.impl.AbstractNamingThreadFactoryModule {
+
+    public NamingThreadFactoryModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public NamingThreadFactoryModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            NamingThreadFactoryModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void validate() {
+        super.validate();
+        JmxAttributeValidationException.checkNotNull(getNamePrefix(), namePrefixJmxAttribute);
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        return new NamingThreadPoolFactory(getNamePrefix());
+    }
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/NamingThreadFactoryModuleFactory.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/NamingThreadFactoryModuleFactory.java
new file mode 100644 (file)
index 0000000..5e70afb
--- /dev/null
@@ -0,0 +1,18 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: threadpool-impl  yang module local name: threadfactory-naming
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 16:19:33 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.threadpool.impl;
+
+/**
+*
+*/
+public class NamingThreadFactoryModuleFactory extends
+        org.opendaylight.controller.config.yang.threadpool.impl.AbstractNamingThreadFactoryModuleFactory {
+
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/ScheduledThreadPoolModule.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/ScheduledThreadPoolModule.java
new file mode 100644 (file)
index 0000000..42739b4
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: threadpool-impl  yang module local name: threadpool-scheduled
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 16:19:33 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.threadpool.impl;
+
+import org.opendaylight.controller.config.api.JmxAttributeValidationException;
+import org.opendaylight.controller.config.threadpool.util.ScheduledThreadPoolWrapper;
+
+/**
+*
+*/
+public final class ScheduledThreadPoolModule extends
+        org.opendaylight.controller.config.yang.threadpool.impl.AbstractScheduledThreadPoolModule {
+
+    public ScheduledThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public ScheduledThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            ScheduledThreadPoolModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void validate() {
+        super.validate();
+        JmxAttributeValidationException.checkNotNull(getMaxThreadCount(), maxThreadCountJmxAttribute);
+        JmxAttributeValidationException.checkCondition(getMaxThreadCount() > 0, "must be greater than zero",
+                maxThreadCountJmxAttribute);
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        return new ScheduledThreadPoolWrapper(getMaxThreadCount(), getThreadFactoryDependency());
+    }
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/ScheduledThreadPoolModuleFactory.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/yang/threadpool/impl/ScheduledThreadPoolModuleFactory.java
new file mode 100644 (file)
index 0000000..489af82
--- /dev/null
@@ -0,0 +1,18 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: threadpool-impl  yang module local name: threadpool-scheduled
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 16:19:33 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.threadpool.impl;
+
+/**
+*
+*/
+public class ScheduledThreadPoolModuleFactory extends
+        org.opendaylight.controller.config.yang.threadpool.impl.AbstractScheduledThreadPoolModuleFactory {
+
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl.yang b/opendaylight/config/threadpool-config-impl/src/main/yang/threadpool-impl.yang
new file mode 100644 (file)
index 0000000..a2366f2
--- /dev/null
@@ -0,0 +1,195 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module threadpool-impl {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl";
+    prefix "th-java";
+
+    import threadpool { prefix th; revision-date 2013-04-09; }
+    import config { prefix config; revision-date 2013-04-05; }
+    import rpc-context { prefix rpcx; revision-date 2013-06-17; }
+
+    organization "Cisco Systems, Inc.";
+
+    contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for
+         thread services pure Java implementation.
+
+        Copyright (c)2013 Cisco Systems, Inc. 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";
+
+    revision "2013-04-05" {
+        description
+            "Updated to work with new anchors.";
+    }
+
+    revision "2013-04-03" {
+        description
+            "Initial revision by Anton Tkacik, Tomas Olvecky and
+             Robert Varga.";
+    }
+
+    identity eventbus {
+        base config:module-type;
+        config:provided-service th:eventbus;
+        config:java-name-prefix EventBus;
+    }
+
+       augment "/config:modules/config:module/config:configuration" {
+               case eventbus {
+                       when "/config:modules/config:module/config:type = 'eventbus'";
+                       // No real configuration
+        }
+    }
+
+       augment "/config:modules/config:module/config:state" {
+               case eventbus {
+                       when "/config:modules/config:module/config:type = 'eventbus'";
+                       rpcx:rpc-context-instance "event-bus-rpc";
+        }
+    }
+
+       identity event-bus-rpc;
+
+    identity async-eventbus {
+        base config:module-type;
+        config:provided-service th:eventbus;
+        config:java-name-prefix AsyncEventBus;
+    }
+
+       augment "/config:modules/config:module/config:configuration" {
+               case async-eventbus {
+                       when "/config:modules/config:module/config:type = 'async-eventbus'";
+                       container threadpool {
+                               uses config:service-ref {
+                                       refine type {
+                                               //mandatory true;
+                                               config:required-identity th:threadpool;
+                                       }
+                               }
+                       }
+               }
+       }
+
+       augment "/config:modules/config:module/config:state" {
+               case async-eventbus {
+                       when "/config:modules/config:module/config:type = 'async-eventbus'";
+                       rpcx:rpc-context-instance "event-bus-rpc";
+        }
+    }
+
+       rpc get-dead-events-count {
+               config:java-name-prefix countDeadEvents;
+               input {
+                       uses rpcx:rpc-context-ref {
+                               refine context-instance {
+                                       rpcx:rpc-context-instance event-bus-rpc;
+                               }
+                       }
+               }
+               output {
+                       leaf result {
+                               type uint32;
+                       }
+               }
+       }
+       
+       identity threadfactory-naming {
+        base config:module-type;
+               config:provided-service th:threadfactory;
+        config:java-name-prefix NamingThreadFactory;
+    }
+
+       augment "/config:modules/config:module/config:configuration" {
+               case threadfactory-naming {
+                       when "/config:modules/config:module/config:type = 'threadfactory-naming'";
+                       leaf name-prefix {
+                               type string;
+                       }
+        }
+    }
+
+    identity threadpool-fixed {
+       base config:module-type;
+       config:provided-service th:threadpool;
+       config:java-name-prefix FixedThreadPool;
+    }
+
+       augment "/config:modules/config:module/config:configuration" {
+               case threadpool-fixed {
+                       when "/config:modules/config:module/config:type = 'threadpool-fixed'";
+                       leaf max-thread-count {
+                               type uint16;
+                       }
+
+                       container threadFactory {
+                               uses config:service-ref {
+                                       refine type {
+                                               //mandatory true;
+                                               config:required-identity th:threadfactory;
+                                       }
+                               }
+                       }
+        }
+       }
+
+       identity threadpool-flexible {
+               base config:module-type;
+               config:provided-service th:threadpool;
+               config:java-name-prefix FlexibleThreadPool;
+       }
+
+       augment "/config:modules/config:module/config:configuration" {
+               case threadpool-flexible {
+                       when "/config:modules/config:module/config:type = 'threadpool-flexible'";
+                       leaf max-thread-count {
+                               type uint16;
+                       }
+                       leaf minThreadCount {
+                               type uint16;
+                       }
+                       leaf keepAliveMillis {
+                               type uint32;
+                       }
+
+                       container threadFactory {
+                               uses config:service-ref {
+                                       refine type {
+                                          // mandatory true;
+                                               config:required-identity th:threadfactory;
+                                       }
+                               }
+                       }
+        }
+       }
+
+    identity threadpool-scheduled {
+               base config:module-type;
+               config:provided-service th:scheduled-threadpool;
+               config:java-name-prefix ScheduledThreadPool;
+       }
+
+       augment "/config:modules/config:module/config:configuration" {
+               case threadpool-scheduled {
+                       when "/config:modules/config:module/config:type = 'threadpool-scheduled'";
+                       leaf max-thread-count {
+                               type uint16;
+                       }
+
+                       container threadFactory {
+                               uses config:service-ref {
+                                       refine type {
+                                        //   mandatory true;
+                                               config:required-identity th:threadfactory;
+                                       }
+                               }
+                       }
+               }
+       }
+}
+
diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/async/AsyncEventBusConfigBeanTest.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/async/AsyncEventBusConfigBeanTest.java
new file mode 100644 (file)
index 0000000..b2fc75d
--- /dev/null
@@ -0,0 +1,100 @@
+package org.opendaylight.controller.config.threadpool.async;\r
+\r
+import static org.junit.Assert.assertThat;\r
+import static org.junit.Assert.fail;\r
+import static org.junit.matchers.JUnitMatchers.containsString;\r
+\r
+import javax.management.InstanceAlreadyExistsException;\r
+import javax.management.ObjectName;\r
+\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+import org.opendaylight.controller.config.api.ConflictingVersionException;\r
+import org.opendaylight.controller.config.api.ValidationException;\r
+import org.opendaylight.controller.config.api.jmx.CommitStatus;\r
+import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;\r
+import org.opendaylight.controller.config.manager.impl.ClassBasedModuleFactory;\r
+import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;\r
+import org.opendaylight.controller.config.threadpool.scheduled.TestingScheduledThreadPoolModule;\r
+import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.AsyncEventBusModuleFactory;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.AsyncEventBusModuleMXBean;\r
+\r
+public class AsyncEventBusConfigBeanTest extends AbstractConfigTest {\r
+\r
+    private AsyncEventBusModuleFactory factory;\r
+    private final String instanceName = "async1";\r
+    private final String poolImplName = "fixed1";\r
+\r
+    @Before\r
+    public void setUp() {\r
+\r
+        ClassBasedModuleFactory scheduledThreadPoolConfigFactory = createClassBasedCBF(\r
+                TestingScheduledThreadPoolModule.class, poolImplName);\r
+\r
+        factory = new AsyncEventBusModuleFactory();\r
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(factory,\r
+                scheduledThreadPoolConfigFactory));\r
+    }\r
+\r
+    @Test\r
+    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,\r
+            ConflictingVersionException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+\r
+        createAsynced(transaction, instanceName, transaction.createModule(poolImplName, "pool-test"));\r
+        transaction.validateConfig();\r
+        CommitStatus status = transaction.commit();\r
+\r
+        assertBeanCount(1, factory.getImplementationName());\r
+        assertStatus(status, 2, 0, 0);\r
+    }\r
+\r
+    @Test\r
+    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,\r
+            ValidationException {\r
+\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+        createAsynced(transaction, instanceName, transaction.createModule(poolImplName, "pool-test"));\r
+\r
+        transaction.commit();\r
+\r
+        assertBeanCount(1, factory.getImplementationName());\r
+\r
+        transaction = configRegistryClient.createTransaction();\r
+        CommitStatus status = transaction.commit();\r
+\r
+        assertBeanCount(1, factory.getImplementationName());\r
+        assertStatus(status, 0, 0, 2);\r
+\r
+    }\r
+\r
+    @Test\r
+    public void testInstanceAlreadyExistsException() throws ConflictingVersionException, ValidationException,\r
+            InstanceAlreadyExistsException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+\r
+        ObjectName poolCB = transaction.createModule(poolImplName, "pool-test");\r
+        createAsynced(transaction, instanceName, poolCB);\r
+        transaction.commit();\r
+\r
+        transaction = configRegistryClient.createTransaction();\r
+        try {\r
+            createAsynced(transaction, instanceName, poolCB);\r
+            fail();\r
+        } catch (InstanceAlreadyExistsException e) {\r
+            assertThat(\r
+                    e.getMessage(),\r
+                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='async-eventbus', instanceName='async1'}"));\r
+        }\r
+    }\r
+\r
+    private ObjectName createAsynced(ConfigTransactionJMXClient transaction, String instanceName, ObjectName threadPool)\r
+            throws InstanceAlreadyExistsException {\r
+        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);\r
+        AsyncEventBusModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated, AsyncEventBusModuleMXBean.class);\r
+        mxBean.setThreadpool(threadPool);\r
+        return nameCreated;\r
+    }\r
+\r
+}\r
diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/eventbus/SyncEventBusConfigBeanTest.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/eventbus/SyncEventBusConfigBeanTest.java
new file mode 100644 (file)
index 0000000..4cd279f
--- /dev/null
@@ -0,0 +1,97 @@
+package org.opendaylight.controller.config.threadpool.eventbus;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.junit.matchers.JUnitMatchers.containsString;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.ObjectName;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.config.api.ConflictingVersionException;
+import org.opendaylight.controller.config.api.ValidationException;
+import org.opendaylight.controller.config.api.jmx.CommitStatus;
+import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
+import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
+import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
+import org.opendaylight.controller.config.yang.threadpool.impl.EventBusModuleFactory;
+
+public class SyncEventBusConfigBeanTest extends AbstractConfigTest {
+
+    private EventBusModuleFactory factory;
+    private final String instanceName = "sync1";
+
+    @Before
+    public void setUp() {
+
+        factory = new EventBusModuleFactory();
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(factory));
+    }
+
+    @Test
+    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,
+            ConflictingVersionException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+
+        createSynced(transaction, instanceName);
+        transaction.validateConfig();
+        CommitStatus status = transaction.commit();
+
+        assertEquals(1, configRegistry.lookupConfigBeans(factory.getImplementationName()).size());
+        assertEquals(1, status.getNewInstances().size());
+        assertEquals(0, status.getRecreatedInstances().size());
+        assertEquals(0, status.getReusedInstances().size());
+        // TODO test dead event collector
+    }
+
+    @Test
+    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,
+            ValidationException {
+
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        createSynced(transaction, instanceName);
+
+        transaction.commit();
+
+        assertEquals(1, configRegistry.lookupConfigBeans(factory.getImplementationName()).size());
+
+        transaction = configRegistryClient.createTransaction();
+        CommitStatus status = transaction.commit();
+
+        assertEquals(1, configRegistry.lookupConfigBeans(factory.getImplementationName()).size());
+        assertEquals(0, status.getNewInstances().size());
+        assertEquals(0, status.getRecreatedInstances().size());
+        assertEquals(1, status.getReusedInstances().size());
+
+    }
+
+    @Test
+    public void testInstanceAlreadyExistsException() throws ConflictingVersionException, ValidationException {
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+
+        try {
+            createSynced(transaction, instanceName);
+            transaction.commit();
+        } catch (InstanceAlreadyExistsException e1) {
+            fail();
+        }
+
+        transaction = configRegistryClient.createTransaction();
+        try {
+            createSynced(transaction, instanceName);
+            fail();
+        } catch (InstanceAlreadyExistsException e) {
+            assertThat(
+                    e.getMessage(),
+                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='eventbus', instanceName='sync1'}"));
+        }
+    }
+
+    private ObjectName createSynced(ConfigTransactionJMXClient transaction, String instanceName)
+            throws InstanceAlreadyExistsException {
+        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);
+        return nameCreated;
+    }
+}
diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/eventbus/TestingEventBusModule.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/eventbus/TestingEventBusModule.java
new file mode 100644 (file)
index 0000000..ee6bbc5
--- /dev/null
@@ -0,0 +1,28 @@
+package org.opendaylight.controller.config.threadpool.eventbus;\r
+\r
+import static org.mockito.Mockito.doNothing;\r
+import static org.mockito.Mockito.mock;\r
+\r
+import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;\r
+import org.opendaylight.controller.config.api.ModuleIdentifier;\r
+import org.opendaylight.controller.config.manager.impl.AbstractMockedModule;\r
+import org.opendaylight.controller.config.spi.Module;\r
+import org.opendaylight.controller.config.threadpool.util.CloseableEventBus;\r
+import org.opendaylight.controller.config.yang.threadpool.EventBusServiceInterface;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.EventBusModuleMXBean;\r
+\r
+public class TestingEventBusModule extends AbstractMockedModule implements Module, EventBusServiceInterface,\r
+        EventBusModuleMXBean {\r
+\r
+    public TestingEventBusModule(DynamicMBeanWithInstance old, ModuleIdentifier id) {\r
+        super(old, id);\r
+    }\r
+\r
+    @Override\r
+    protected AutoCloseable prepareMockedInstance() throws Exception {\r
+        CloseableEventBus bus = mock(CloseableEventBus.class);\r
+        doNothing().when(bus).close();\r
+        return bus;\r
+    }\r
+\r
+}\r
diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/FixedThreadPoolConfigBeanTest.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/FixedThreadPoolConfigBeanTest.java
new file mode 100644 (file)
index 0000000..4fda06b
--- /dev/null
@@ -0,0 +1,129 @@
+package org.opendaylight.controller.config.threadpool.fixed;\r
+\r
+import static org.junit.Assert.assertThat;\r
+import static org.junit.Assert.fail;\r
+import static org.junit.matchers.JUnitMatchers.containsString;\r
+\r
+import javax.management.InstanceAlreadyExistsException;\r
+import javax.management.InstanceNotFoundException;\r
+import javax.management.ObjectName;\r
+\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+import org.opendaylight.controller.config.api.ConflictingVersionException;\r
+import org.opendaylight.controller.config.api.ValidationException;\r
+import org.opendaylight.controller.config.api.jmx.CommitStatus;\r
+import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;\r
+import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;\r
+import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.FixedThreadPoolModuleFactory;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.FixedThreadPoolModuleMXBean;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleFactory;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;\r
+\r
+public class FixedThreadPoolConfigBeanTest extends AbstractConfigTest {\r
+\r
+    private FixedThreadPoolModuleFactory factory;\r
+    private final String nameInstance = "fixedInstance";\r
+\r
+    @Before\r
+    public void setUp() {\r
+        factory = new FixedThreadPoolModuleFactory();\r
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(factory,\r
+                new NamingThreadFactoryModuleFactory()));\r
+    }\r
+\r
+    @Test\r
+    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,\r
+            ConflictingVersionException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+        createFixed(transaction, nameInstance, 2);\r
+\r
+        transaction.validateConfig();\r
+        CommitStatus status = transaction.commit();\r
+\r
+        assertBeanCount(1, factory.getImplementationName());\r
+        assertStatus(status, 2, 0, 0);\r
+    }\r
+\r
+    @Test\r
+    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,\r
+            ValidationException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+        createFixed(transaction, nameInstance, 4);\r
+\r
+        transaction.validateConfig();\r
+        transaction.commit();\r
+\r
+        assertBeanCount(1, factory.getImplementationName());\r
+\r
+        transaction = configRegistryClient.createTransaction();\r
+        CommitStatus status = transaction.commit();\r
+\r
+        assertBeanCount(1, factory.getImplementationName());\r
+        assertStatus(status, 0, 0, 2);\r
+    }\r
+\r
+    @Test\r
+    public void testNegative() throws ConflictingVersionException, ValidationException, InstanceAlreadyExistsException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+\r
+        createFixed(transaction, nameInstance, 5);\r
+        transaction.commit();\r
+\r
+        transaction = configRegistryClient.createTransaction();\r
+        try {\r
+            createFixed(transaction, nameInstance, 0);\r
+            fail();\r
+        } catch (InstanceAlreadyExistsException e) {\r
+            assertThat(\r
+                    e.getMessage(),\r
+                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='threadpool-fixed', instanceName='fixedInstance'}"));\r
+        }\r
+    }\r
+\r
+    @Test\r
+    public void testDestroy() throws InstanceAlreadyExistsException, ValidationException, ConflictingVersionException,\r
+            InstanceNotFoundException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+        createFixed(transaction, nameInstance, 1);\r
+\r
+        transaction.commit();\r
+\r
+        transaction = configRegistryClient.createTransaction();\r
+        transaction.destroyConfigBean(factory.getImplementationName(), nameInstance);\r
+        CommitStatus status = transaction.commit();\r
+\r
+        assertBeanCount(0, factory.getImplementationName());\r
+        assertStatus(status, 0, 0, 1);\r
+    }\r
+\r
+    @Test\r
+    public void testValidationException() throws InstanceAlreadyExistsException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+        createFixed(transaction, nameInstance, -1);\r
+        try {\r
+            transaction.validateConfig();\r
+            fail();\r
+        } catch (ValidationException e) {\r
+            assertThat(e.getMessage(), containsString("MaxThreadCount must be greater than zero"));\r
+        }\r
+    }\r
+\r
+    private ObjectName createFixed(ConfigTransactionJMXClient transaction, String name, int numberOfThreads)\r
+            throws InstanceAlreadyExistsException {\r
+        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), name);\r
+        FixedThreadPoolModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated, FixedThreadPoolModuleMXBean.class);\r
+        mxBean.setMaxThreadCount(numberOfThreads);\r
+\r
+        ObjectName threadFactoryON = transaction.createModule(NamingThreadFactoryModuleFactory.NAME, "naming");\r
+        NamingThreadFactoryModuleMXBean namingThreadFactoryModuleMXBean = transaction.newMXBeanProxy(threadFactoryON,\r
+                NamingThreadFactoryModuleMXBean.class);\r
+        namingThreadFactoryModuleMXBean.setNamePrefix("prefix");\r
+\r
+        mxBean.setThreadFactory(threadFactoryON);\r
+\r
+        return nameCreated;\r
+    }\r
+\r
+}\r
diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/TestingFixedThreadPoolModule.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/TestingFixedThreadPoolModule.java
new file mode 100644 (file)
index 0000000..00be5d8
--- /dev/null
@@ -0,0 +1,30 @@
+package org.opendaylight.controller.config.threadpool.fixed;\r
+\r
+import static org.mockito.Mockito.doNothing;\r
+import static org.mockito.Mockito.doReturn;\r
+import static org.mockito.Mockito.mock;\r
+\r
+import java.util.concurrent.ExecutorService;\r
+\r
+import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;\r
+import org.opendaylight.controller.config.api.ModuleIdentifier;\r
+import org.opendaylight.controller.config.manager.impl.AbstractMockedModule;\r
+import org.opendaylight.controller.config.spi.Module;\r
+import org.opendaylight.controller.config.threadpool.util.FixedThreadPoolWrapper;\r
+import org.opendaylight.controller.config.yang.threadpool.ThreadPoolServiceInterface;\r
+\r
+public class TestingFixedThreadPoolModule extends AbstractMockedModule implements ThreadPoolServiceInterface, Module {\r
+\r
+    public TestingFixedThreadPoolModule(DynamicMBeanWithInstance old, ModuleIdentifier id) {\r
+        super(old, id);\r
+    }\r
+\r
+    @Override\r
+    protected AutoCloseable prepareMockedInstance() throws Exception {\r
+        FixedThreadPoolWrapper pool = mock(FixedThreadPoolWrapper.class);\r
+        doNothing().when(pool).close();\r
+        doReturn(mock(ExecutorService.class)).when(pool).getExecutor();\r
+        return pool;\r
+    }\r
+\r
+}\r
diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/flexible/FlexibleThreadPoolConfigBeanTest.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/flexible/FlexibleThreadPoolConfigBeanTest.java
new file mode 100644 (file)
index 0000000..ee1de8f
--- /dev/null
@@ -0,0 +1,173 @@
+package org.opendaylight.controller.config.threadpool.flexible;\r
+\r
+import static org.junit.Assert.assertThat;\r
+import static org.junit.Assert.fail;\r
+import static org.junit.matchers.JUnitMatchers.containsString;\r
+\r
+import javax.management.InstanceAlreadyExistsException;\r
+import javax.management.InstanceNotFoundException;\r
+import javax.management.ObjectName;\r
+\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+import org.opendaylight.controller.config.api.ConflictingVersionException;\r
+import org.opendaylight.controller.config.api.ValidationException;\r
+import org.opendaylight.controller.config.api.jmx.CommitStatus;\r
+import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;\r
+import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;\r
+import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.FlexibleThreadPoolModuleFactory;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.FlexibleThreadPoolModuleMXBean;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleFactory;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;\r
+\r
+public class FlexibleThreadPoolConfigBeanTest extends AbstractConfigTest {\r
+\r
+    private FlexibleThreadPoolModuleFactory flexibleFactory;\r
+    private final String instanceName = "flexible1";\r
+    private final String threadFactoryName = "threadFactoryName";\r
+\r
+    @Before\r
+    public void setUp() {\r
+\r
+        flexibleFactory = new FlexibleThreadPoolModuleFactory();\r
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(flexibleFactory,\r
+                new NamingThreadFactoryModuleFactory()));\r
+    }\r
+\r
+    @Test\r
+    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,\r
+            ConflictingVersionException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+\r
+        createFlexible(transaction, instanceName, threadFactoryName, 1, 20, 20);\r
+        transaction.validateConfig();\r
+        CommitStatus status = transaction.commit();\r
+\r
+        assertBeanCount(1, flexibleFactory.getImplementationName());\r
+        assertStatus(status, 2, 0, 0);\r
+    }\r
+\r
+    @Test\r
+    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,\r
+            ValidationException {\r
+\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+        createFlexible(transaction, instanceName, threadFactoryName, 1, 20, 10);\r
+\r
+        transaction.commit();\r
+\r
+        assertBeanCount(1, flexibleFactory.getImplementationName());\r
+\r
+        transaction = configRegistryClient.createTransaction();\r
+        CommitStatus status = transaction.commit();\r
+\r
+        assertBeanCount(1, flexibleFactory.getImplementationName());\r
+        assertStatus(status, 0, 0, 2);\r
+\r
+    }\r
+\r
+    @Test\r
+    public void testInstanceAlreadyExistsException() throws ConflictingVersionException, ValidationException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+\r
+        try {\r
+            createFlexible(transaction, instanceName, threadFactoryName, 1, 1, 2);\r
+            transaction.commit();\r
+        } catch (InstanceAlreadyExistsException e1) {\r
+            fail();\r
+        }\r
+\r
+        transaction = configRegistryClient.createTransaction();\r
+        try {\r
+            createFlexible(transaction, instanceName, "threadFactoryName1", 2, 2, 2);\r
+            fail();\r
+        } catch (InstanceAlreadyExistsException e) {\r
+            assertThat(\r
+                    e.getMessage(),\r
+                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='threadpool-flexible', instanceName='flexible1'}"));\r
+        }\r
+    }\r
+\r
+    @Test\r
+    public void testValidationException() throws InstanceAlreadyExistsException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+\r
+        createFlexible(transaction, instanceName, threadFactoryName, 0, 10, 10);\r
+\r
+        try {\r
+            transaction.validateConfig();\r
+            fail();\r
+        } catch (ValidationException e) {\r
+            assertThat(e.getMessage(), containsString("MinThreadCount must be greater than zero"));\r
+        }\r
+    }\r
+\r
+    @Test\r
+    public void testValidationException2() throws InstanceAlreadyExistsException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+\r
+        createFlexible(transaction, instanceName, threadFactoryName, 0, 0, 10);\r
+\r
+        try {\r
+            transaction.validateConfig();\r
+            fail();\r
+        } catch (ValidationException e) {\r
+            assertThat(e.getMessage(), containsString("KeepAliveMillis must be greater than zero"));\r
+        }\r
+    }\r
+\r
+    @Test\r
+    public void testValidationException3() throws InstanceAlreadyExistsException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+\r
+        createFlexible(transaction, instanceName, threadFactoryName, 10, 50, 0);\r
+\r
+        try {\r
+            transaction.validateConfig();\r
+            fail();\r
+        } catch (ValidationException e) {\r
+            assertThat(e.getMessage(), containsString("MaxThreadCount must be greater than zero"));\r
+        }\r
+    }\r
+\r
+    private ObjectName createFlexible(ConfigTransactionJMXClient transaction, String instanceName,\r
+            String threadFactoryName, int minThreadCount, long keepAliveMillis, int maxThreadCount)\r
+            throws InstanceAlreadyExistsException {\r
+\r
+        ObjectName threadFactoryON = transaction.createModule(NamingThreadFactoryModuleFactory.NAME, threadFactoryName);\r
+        NamingThreadFactoryModuleMXBean namingThreadFactoryModuleMXBean = transaction.newMXBeanProxy(threadFactoryON,\r
+                NamingThreadFactoryModuleMXBean.class);\r
+        namingThreadFactoryModuleMXBean.setNamePrefix("prefix");\r
+\r
+        ObjectName flexibleON = transaction.createModule(flexibleFactory.getImplementationName(), instanceName);\r
+        FlexibleThreadPoolModuleMXBean mxBean = transaction.newMBeanProxy(flexibleON,\r
+                FlexibleThreadPoolModuleMXBean.class);\r
+        mxBean.setKeepAliveMillis(keepAliveMillis);\r
+        mxBean.setMaxThreadCount(maxThreadCount);\r
+        mxBean.setMinThreadCount(minThreadCount);\r
+        mxBean.setThreadFactory(threadFactoryON);\r
+        return flexibleON;\r
+    }\r
+\r
+    @Test\r
+    public void testReconfigurationInstance() throws InstanceAlreadyExistsException, ValidationException,\r
+            ConflictingVersionException, InstanceNotFoundException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+        createFlexible(transaction, instanceName, threadFactoryName, 2, 2, 2);\r
+\r
+        transaction.commit();\r
+\r
+        transaction = configRegistryClient.createTransaction();\r
+        ObjectName databaseNew = transaction.lookupConfigBean(flexibleFactory.getImplementationName(), instanceName);\r
+        FlexibleThreadPoolModuleMXBean proxy = transaction.newMXBeanProxy(databaseNew,\r
+                FlexibleThreadPoolModuleMXBean.class);\r
+        proxy.setMaxThreadCount(99);\r
+\r
+        CommitStatus status = transaction.commit();\r
+\r
+        assertBeanCount(1, flexibleFactory.getImplementationName());\r
+        assertStatus(status, 0, 1, 1);\r
+    }\r
+\r
+}\r
diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/NamingThreadPoolFactoryConfigBeanTest.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/NamingThreadPoolFactoryConfigBeanTest.java
new file mode 100644 (file)
index 0000000..9e9565a
--- /dev/null
@@ -0,0 +1,136 @@
+package org.opendaylight.controller.config.threadpool.naming;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertThat;\r
+import static org.junit.Assert.assertTrue;\r
+import static org.junit.Assert.fail;\r
+import static org.junit.matchers.JUnitMatchers.containsString;\r
+\r
+import javax.management.InstanceAlreadyExistsException;\r
+import javax.management.InstanceNotFoundException;\r
+import javax.management.ObjectName;\r
+\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+import org.opendaylight.controller.config.api.ConflictingVersionException;\r
+import org.opendaylight.controller.config.api.ValidationException;\r
+import org.opendaylight.controller.config.api.jmx.CommitStatus;\r
+import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;\r
+import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;\r
+import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;\r
+import org.opendaylight.controller.config.yang.threadpool.ThreadFactoryServiceInterface;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleFactory;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;\r
+\r
+public class NamingThreadPoolFactoryConfigBeanTest extends AbstractConfigTest {\r
+\r
+    private NamingThreadFactoryModuleFactory factory;\r
+    private final String instanceName = "named";\r
+\r
+    @Before\r
+    public void setUp() {\r
+\r
+        factory = new NamingThreadFactoryModuleFactory();\r
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(factory));\r
+    }\r
+\r
+    @Test\r
+    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,\r
+            ConflictingVersionException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+\r
+        createNamed(transaction, instanceName, "prefixes");\r
+        transaction.validateConfig();\r
+        CommitStatus status = transaction.commit();\r
+\r
+        assertEquals(1, configRegistry.lookupConfigBeans(factory.getImplementationName()).size());\r
+        assertEquals(1, status.getNewInstances().size());\r
+        assertEquals(0, status.getRecreatedInstances().size());\r
+        assertEquals(0, status.getReusedInstances().size());\r
+    }\r
+\r
+    @Test\r
+    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,\r
+            ValidationException {\r
+\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+        createNamed(transaction, instanceName, "prefixes");\r
+\r
+        transaction.commit();\r
+\r
+        assertEquals(1, configRegistry.lookupConfigBeans(factory.getImplementationName()).size());\r
+\r
+        transaction = configRegistryClient.createTransaction();\r
+        CommitStatus status = transaction.commit();\r
+\r
+        assertEquals(1, configRegistry.lookupConfigBeans(factory.getImplementationName()).size());\r
+        assertEquals(0, status.getNewInstances().size());\r
+        assertEquals(0, status.getRecreatedInstances().size());\r
+        assertEquals(1, status.getReusedInstances().size());\r
+\r
+    }\r
+\r
+    @Test\r
+    public void testInstanceAlreadyExistsException() throws ConflictingVersionException, ValidationException,\r
+            InstanceAlreadyExistsException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+\r
+        createNamed(transaction, instanceName, "prefixes");\r
+        transaction.commit();\r
+\r
+        transaction = configRegistryClient.createTransaction();\r
+        try {\r
+            createNamed(transaction, instanceName, "prefixes1");\r
+            fail();\r
+        } catch (InstanceAlreadyExistsException e) {\r
+            assertThat(\r
+                    e.getMessage(),\r
+                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='threadfactory-naming', instanceName='named'}"));\r
+        }\r
+    }\r
+\r
+    @Test\r
+    public void testValidationException() throws InstanceAlreadyExistsException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+\r
+        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);\r
+        transaction.newMXBeanProxy(nameCreated, ThreadFactoryServiceInterface.class);\r
+        try {\r
+            transaction.validateConfig();\r
+            fail();\r
+        } catch (ValidationException e) {\r
+            assertTrue(e.getFailedValidations().containsKey(factory.getImplementationName()));\r
+            assertEquals(1, e.getFailedValidations().get(factory.getImplementationName()).keySet().size());\r
+        }\r
+    }\r
+\r
+    @Test\r
+    public void testReconfigurationInstance() throws InstanceAlreadyExistsException, ValidationException,\r
+            ConflictingVersionException, InstanceNotFoundException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+        createNamed(transaction, instanceName, "pref");\r
+\r
+        transaction.commit();\r
+\r
+        transaction = configRegistryClient.createTransaction();\r
+        ObjectName databaseNew = transaction.lookupConfigBean(factory.getImplementationName(), instanceName);\r
+        NamingThreadFactoryModuleMXBean proxy = transaction.newMXBeanProxy(databaseNew,\r
+                NamingThreadFactoryModuleMXBean.class);\r
+        proxy.setNamePrefix("pref1");\r
+\r
+        CommitStatus status = transaction.commit();\r
+\r
+        assertBeanCount(1, factory.getImplementationName());\r
+        assertStatus(status, 0, 1, 0);\r
+    }\r
+\r
+    private ObjectName createNamed(ConfigTransactionJMXClient transaction, String instanceName, String prefixes)\r
+            throws InstanceAlreadyExistsException {\r
+        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);\r
+        NamingThreadFactoryModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated,\r
+                NamingThreadFactoryModuleMXBean.class);\r
+        mxBean.setNamePrefix(prefixes);\r
+        return nameCreated;\r
+    }\r
+\r
+}\r
diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/TestingNamingThreadPoolFactoryModule.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/naming/TestingNamingThreadPoolFactoryModule.java
new file mode 100644 (file)
index 0000000..5c717cc
--- /dev/null
@@ -0,0 +1,59 @@
+package org.opendaylight.controller.config.threadpool.naming;\r
+\r
+import static org.mockito.Matchers.any;\r
+import static org.mockito.Mockito.doNothing;\r
+import static org.mockito.Mockito.doReturn;\r
+import static org.mockito.Mockito.mock;\r
+\r
+import java.io.Closeable;\r
+import java.io.IOException;\r
+\r
+import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;\r
+import org.opendaylight.controller.config.api.ModuleIdentifier;\r
+import org.opendaylight.controller.config.spi.Module;\r
+import org.opendaylight.controller.config.threadpool.util.NamingThreadPoolFactory;\r
+import org.opendaylight.controller.config.yang.threadpool.ThreadFactoryServiceInterface;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;\r
+\r
+public class TestingNamingThreadPoolFactoryModule implements Module, ThreadFactoryServiceInterface,\r
+        NamingThreadFactoryModuleMXBean {\r
+\r
+    private final NamingThreadPoolFactory fact;\r
+\r
+    public TestingNamingThreadPoolFactoryModule() throws IOException {\r
+        fact = mock(NamingThreadPoolFactory.class);\r
+        Thread thread = mock(Thread.class);\r
+        doNothing().when(thread).start();\r
+        doReturn(thread).when(fact).newThread(any(Runnable.class));\r
+        doNothing().when(fact).close();\r
+    }\r
+\r
+    public TestingNamingThreadPoolFactoryModule(DynamicMBeanWithInstance old) {\r
+        fact = (NamingThreadPoolFactory) old.getInstance();\r
+    }\r
+\r
+    @Override\r
+    public ModuleIdentifier getIdentifier() {\r
+        return new ModuleIdentifier(TestingNamingThreadPoolFactoryModule.class.getCanonicalName(), "mock");\r
+    }\r
+\r
+    @Override\r
+    public String getNamePrefix() {\r
+        return null;\r
+    }\r
+\r
+    @Override\r
+    public void setNamePrefix(String arg) {\r
+        throw new UnsupportedOperationException();\r
+    }\r
+\r
+    @Override\r
+    public void validate() {\r
+    }\r
+\r
+    @Override\r
+    public Closeable getInstance() {\r
+        return fact;\r
+    }\r
+\r
+}\r
diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/ScheduledThreadPoolConfigBeanTest.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/ScheduledThreadPoolConfigBeanTest.java
new file mode 100644 (file)
index 0000000..b4b1b60
--- /dev/null
@@ -0,0 +1,154 @@
+package org.opendaylight.controller.config.threadpool.scheduled;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertThat;\r
+import static org.junit.Assert.assertTrue;\r
+import static org.junit.Assert.fail;\r
+import static org.junit.matchers.JUnitMatchers.containsString;\r
+\r
+import javax.management.InstanceAlreadyExistsException;\r
+import javax.management.InstanceNotFoundException;\r
+import javax.management.ObjectName;\r
+\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+import org.opendaylight.controller.config.api.ConflictingVersionException;\r
+import org.opendaylight.controller.config.api.ValidationException;\r
+import org.opendaylight.controller.config.api.jmx.CommitStatus;\r
+import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;\r
+import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;\r
+import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleFactory;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.ScheduledThreadPoolModuleFactory;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.ScheduledThreadPoolModuleMXBean;\r
+\r
+public class ScheduledThreadPoolConfigBeanTest extends AbstractConfigTest {\r
+\r
+    private ScheduledThreadPoolModuleFactory factory;\r
+    private final String instanceName = "scheduled1";\r
+\r
+    @Before\r
+    public void setUp() {\r
+\r
+        factory = new ScheduledThreadPoolModuleFactory();\r
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(factory,\r
+                new NamingThreadFactoryModuleFactory()));\r
+    }\r
+\r
+    @Test\r
+    public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,\r
+            ConflictingVersionException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+\r
+        createScheduled(transaction, instanceName, 1);\r
+        transaction.validateConfig();\r
+        CommitStatus status = transaction.commit();\r
+\r
+        assertBeanCount(1, factory.getImplementationName());\r
+        assertStatus(status, 2, 0, 0);\r
+    }\r
+\r
+    @Test\r
+    public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,\r
+            ValidationException {\r
+\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+        createScheduled(transaction, instanceName, 1);\r
+\r
+        transaction.commit();\r
+\r
+        assertBeanCount(1, factory.getImplementationName());\r
+\r
+        transaction = configRegistryClient.createTransaction();\r
+        CommitStatus status = transaction.commit();\r
+\r
+        assertBeanCount(1, factory.getImplementationName());\r
+        assertStatus(status, 0, 0, 2);\r
+    }\r
+\r
+    @Test\r
+    public void testReconfigurationInstance() throws InstanceAlreadyExistsException, ValidationException,\r
+            ConflictingVersionException, InstanceNotFoundException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+        createScheduled(transaction, instanceName, 1);\r
+\r
+        transaction.commit();\r
+\r
+        transaction = configRegistryClient.createTransaction();\r
+        ObjectName databaseNew = transaction.lookupConfigBean(factory.getImplementationName(), instanceName);\r
+        ScheduledThreadPoolModuleMXBean proxy = transaction.newMXBeanProxy(databaseNew,\r
+                ScheduledThreadPoolModuleMXBean.class);\r
+        proxy.setMaxThreadCount(99);\r
+\r
+        CommitStatus status = transaction.commit();\r
+\r
+        assertBeanCount(1, factory.getImplementationName());\r
+        assertStatus(status, 0, 1, 1);\r
+    }\r
+\r
+    @Test\r
+    public void testDestroy() throws InstanceAlreadyExistsException, ValidationException, ConflictingVersionException,\r
+            InstanceNotFoundException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+        createScheduled(transaction, instanceName, 1);\r
+\r
+        transaction.commit();\r
+\r
+        transaction = configRegistryClient.createTransaction();\r
+        transaction.destroyConfigBean(factory.getImplementationName(), instanceName);\r
+        CommitStatus status = transaction.commit();\r
+\r
+        assertBeanCount(0, factory.getImplementationName());\r
+        assertStatus(status, 0, 0, 1);\r
+    }\r
+\r
+    @Test\r
+    public void testInstanceAlreadyExistsException() throws ConflictingVersionException, ValidationException,\r
+            InstanceAlreadyExistsException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+        createScheduled(transaction, instanceName, 1);\r
+        transaction.commit();\r
+        transaction = configRegistryClient.createTransaction();\r
+        try {\r
+            createScheduled(transaction, instanceName, 2);\r
+            fail();\r
+        } catch (InstanceAlreadyExistsException e) {\r
+            assertThat(\r
+                    e.getMessage(),\r
+                    containsString("There is an instance registered with name ModuleIdentifier{factoryName='threadpool-scheduled', instanceName='scheduled1'}"));\r
+        }\r
+    }\r
+\r
+    @Test\r
+    public void testValidationException() throws InstanceAlreadyExistsException {\r
+        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();\r
+        createScheduled(transaction, instanceName, 0);\r
+\r
+        try {\r
+            transaction.validateConfig();\r
+            fail();\r
+        } catch (ValidationException e) {\r
+            assertTrue(e.getFailedValidations().containsKey(factory.getImplementationName()));\r
+            assertEquals(1, e.getFailedValidations().get(factory.getImplementationName()).keySet().size());\r
+        }\r
+    }\r
+\r
+    private ObjectName createScheduled(ConfigTransactionJMXClient transaction, String instanceName, int maxThreadCount)\r
+            throws InstanceAlreadyExistsException {\r
+        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);\r
+        ScheduledThreadPoolModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated,\r
+                ScheduledThreadPoolModuleMXBean.class);\r
+        mxBean.setMaxThreadCount(maxThreadCount);\r
+\r
+        ObjectName threadFactoryON = transaction.createModule(NamingThreadFactoryModuleFactory.NAME, "naming");\r
+        NamingThreadFactoryModuleMXBean namingThreadFactoryModuleMXBean = transaction.newMXBeanProxy(threadFactoryON,\r
+                NamingThreadFactoryModuleMXBean.class);\r
+        namingThreadFactoryModuleMXBean.setNamePrefix("prefix");\r
+\r
+        mxBean.setThreadFactory(threadFactoryON);\r
+\r
+        return nameCreated;\r
+    }\r
+\r
+}\r
diff --git a/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/TestingScheduledThreadPoolModule.java b/opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/TestingScheduledThreadPoolModule.java
new file mode 100644 (file)
index 0000000..27e60ee
--- /dev/null
@@ -0,0 +1,77 @@
+package org.opendaylight.controller.config.threadpool.scheduled;\r
+\r
+import static org.mockito.Matchers.any;\r
+import static org.mockito.Matchers.anyBoolean;\r
+import static org.mockito.Matchers.anyLong;\r
+import static org.mockito.Mockito.doNothing;\r
+import static org.mockito.Mockito.doReturn;\r
+import static org.mockito.Mockito.mock;\r
+\r
+import java.util.concurrent.ScheduledExecutorService;\r
+import java.util.concurrent.ScheduledFuture;\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import javax.management.ObjectName;\r
+\r
+import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;\r
+import org.opendaylight.controller.config.api.ModuleIdentifier;\r
+import org.opendaylight.controller.config.manager.impl.AbstractMockedModule;\r
+import org.opendaylight.controller.config.spi.Module;\r
+import org.opendaylight.controller.config.threadpool.util.ScheduledThreadPoolWrapper;\r
+import org.opendaylight.controller.config.yang.threadpool.ScheduledThreadPoolServiceInterface;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.ScheduledThreadPoolModuleMXBean;\r
+\r
+import com.google.common.util.concurrent.ListenableFutureTask;\r
+\r
+public class TestingScheduledThreadPoolModule extends AbstractMockedModule implements\r
+        ScheduledThreadPoolServiceInterface, Module, ScheduledThreadPoolModuleMXBean {\r
+\r
+    public TestingScheduledThreadPoolModule(DynamicMBeanWithInstance old, ModuleIdentifier id) {\r
+        super(old, id);\r
+    }\r
+\r
+    @Override\r
+    protected AutoCloseable prepareMockedInstance() throws Exception {\r
+        ScheduledThreadPoolWrapper instance = mock(ScheduledThreadPoolWrapper.class);\r
+        ScheduledExecutorService ses = mock(ScheduledExecutorService.class);\r
+        {// mockFuture\r
+            ScheduledFuture<?> future = mock(ScheduledFuture.class);\r
+            doReturn(false).when(future).cancel(anyBoolean());\r
+            try {\r
+                doReturn(mock(Object.class)).when(future).get();\r
+            } catch (Exception e) {\r
+                throw new RuntimeException(e);\r
+            }\r
+            doReturn(future).when(ses).schedule(any(Runnable.class), any(Long.class), any(TimeUnit.class));\r
+            doReturn(future).when(ses).scheduleWithFixedDelay(any(Runnable.class), anyLong(), anyLong(),\r
+                    any(TimeUnit.class));\r
+\r
+        }\r
+        doNothing().when(ses).execute(any(Runnable.class));\r
+        doNothing().when(ses).execute(any(ListenableFutureTask.class));\r
+        doReturn(ses).when(instance).getExecutor();\r
+        doNothing().when(instance).close();\r
+\r
+        doReturn(1).when(instance).getMaxThreadCount();\r
+        return instance;\r
+    }\r
+\r
+    @Override\r
+    public ObjectName getThreadFactory() {\r
+        return any(ObjectName.class);\r
+    }\r
+\r
+    @Override\r
+    public void setThreadFactory(ObjectName threadFactory) {\r
+    }\r
+\r
+    @Override\r
+    public Integer getMaxThreadCount() {\r
+        return 1;\r
+    }\r
+\r
+    @Override\r
+    public void setMaxThreadCount(Integer maxThreadCount) {\r
+    }\r
+\r
+}\r
index 336d0c3..bcec65f 100644 (file)
@@ -6,7 +6,7 @@
     <parent>
         <artifactId>config-subsystem</artifactId>
         <groupId>org.opendaylight.controller</groupId>
-        <version>0.2.2-SNAPSHOT</version>
+        <version>0.2.3-SNAPSHOT</version>
     </parent>
 
     <artifactId>yang-jmx-generator-it</artifactId>
index 1d53f58..f06c7bd 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <artifactId>config-subsystem</artifactId>
         <groupId>org.opendaylight.controller</groupId>
-        <version>0.2.2-SNAPSHOT</version>
+        <version>0.2.3-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
     <artifactId>yang-jmx-generator-plugin</artifactId>
index 3784638..cd98571 100644 (file)
@@ -6,7 +6,7 @@
     <parent>
         <artifactId>config-subsystem</artifactId>
         <groupId>org.opendaylight.controller</groupId>
-        <version>0.2.2-SNAPSHOT</version>
+        <version>0.2.3-SNAPSHOT</version>
     </parent>
 
     <artifactId>yang-jmx-generator</artifactId>
index 6e850b2..9b103df 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <artifactId>config-subsystem</artifactId>
         <groupId>org.opendaylight.controller</groupId>
-        <version>0.2.2-SNAPSHOT</version>
+        <version>0.2.3-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
     <artifactId>yang-store-api</artifactId>
index 07ac4d4..ae59dde 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <artifactId>config-subsystem</artifactId>
         <groupId>org.opendaylight.controller</groupId>
-        <version>0.2.2-SNAPSHOT</version>
+        <version>0.2.3-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
     <artifactId>yang-store-impl</artifactId>
index 3de0688..b7540c8 100644 (file)
@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>config-subsystem</artifactId>
-        <version>0.2.2-SNAPSHOT</version>
+        <version>0.2.3-SNAPSHOT</version>
     </parent>
 
     <artifactId>yang-test</artifactId>
index 4482df0..1ebab9b 100644 (file)
@@ -81,7 +81,7 @@
         </dependency>
         <dependency>
           <groupId>org.opendaylight.controller</groupId>
-          <artifactId>sal-compability</artifactId>
+          <artifactId>sal-compatibility</artifactId>
           <version>${mdsal.version}</version>
         </dependency>
         <dependency>
           <artifactId>config-persister-impl</artifactId>
           <version>${netconf.version}</version>
         </dependency>
-
+        <dependency>
+          <groupId>org.opendaylight.controller.thirdparty</groupId>
+          <artifactId>exificient</artifactId>
+          <version>${exi.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.servicemix.bundles</groupId>
+            <artifactId>org.apache.servicemix.bundles.xerces</artifactId>
+            <version>2.11.0_1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.birt.runtime.3_7_1</groupId>
+            <artifactId>org.apache.xml.resolver</artifactId>
+            <version>1.2.0</version>
+        </dependency>
 
           <!-- toaster example I'm pretty sure we should trim -->
-
          <dependency>
           <groupId>org.opendaylight.controller.samples</groupId>
           <artifactId>sample-toaster</artifactId>
            <version>2.4</version>
          </dependency>
 
-           <dependency>
+         <dependency>
           <groupId>org.opendaylight.yangtools.thirdparty</groupId>
           <artifactId>antlr4-runtime-osgi-nohead</artifactId>
           <version>4.0</version>
           <artifactId>yang-model-api</artifactId>
          </dependency>
 
-          <dependency>
-           <groupId>org.opendaylight.yangtools.model</groupId>
-           <artifactId>yang-ext</artifactId>
-          </dependency>
+         <dependency>
+          <groupId>org.opendaylight.yangtools.model</groupId>
+          <artifactId>yang-ext</artifactId>
+         </dependency>
 
+        <dependency>
+         <groupId>org.opendaylight.controller.thirdparty</groupId>
+         <artifactId>ganymed</artifactId>
+        </dependency>
       </dependencies>
     </profile>
   </profiles>
index 9b96f86..29de772 100644 (file)
             <Import-Package>
               org.opendaylight.controller.sal.binding.api,
               org.opendaylight.controller.sal.binding.api.data,
-              org.opendaylight.controller.md.sal.common.api.data,              
-              org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow,
+              org.opendaylight.controller.md.sal.common.api.data, 
+              org.opendaylight.controller.sal.utils, 
+              org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow, 
+              org.opendaylight.yang.gen.v1.urn.opendaylight.group.config.rev131024.groups, 
+              org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918, 
+              org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018, 
+              org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group, 
+              org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets, 
+              org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.bucket,
               org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819,
+              org.opendaylight.controller.clustering.services, org.opendaylight.controller.sal.core, 
+              org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction,
+              org.opendaylight.controller.switchmanager, 
+              org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list, 
+              org.opendaylight.yang.gen.v1.urn.opendaylight.group.config.rev131024,
               org.opendaylight.yangtools.concepts,              
               org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819,
               org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819,
index ae488b6..e48e038 100644 (file)
 package org.opendaylight.controller.forwardingrulesmanager_mdsal.consumer.impl;
 
 
+import org.eclipse.osgi.framework.console.CommandProvider;
+import org.opendaylight.controller.clustering.services.IClusterContainerServices;
 import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.opendaylight.controller.sal.binding.api.NotificationService;
 import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.controller.sal.core.IContainer;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+import org.opendaylight.controller.switchmanager.ISwitchManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
-public class FRMConsumerImpl extends AbstractBindingAwareProvider {
+public class FRMConsumerImpl extends AbstractBindingAwareProvider implements CommandProvider{
        protected static final Logger logger = LoggerFactory.getLogger(FRMConsumerImpl.class);
        private static ProviderContext p_session;
     private static DataBrokerService dataBrokerService;         
@@ -28,11 +35,21 @@ public class FRMConsumerImpl extends AbstractBindingAwareProvider {
        private GroupConsumerImpl groupImplRef;
        private static DataProviderService dataProviderService;  
 
+       private static IClusterContainerServices clusterContainerService = null;
+       private static ISwitchManager switchManager;
+       private static IContainer container;
+       
        @Override
     public void onSessionInitiated(ProviderContext session) {
        
         FRMConsumerImpl.p_session = session;
         
+        if (!getDependentModule()) {
+            logger.error("Unable to fetch handlers for dependent modules");
+            System.out.println("Unable to fetch handlers for dependent modules");
+            return;
+        }
+        
         if (null != session) {
                notificationService = session.getSALService(NotificationService.class);
                
@@ -44,7 +61,8 @@ public class FRMConsumerImpl extends AbstractBindingAwareProvider {
                                
                                if (null != dataProviderService) {
                                        flowImplRef = new FlowConsumerImpl();
-                                       groupImplRef = new GroupConsumerImpl();
+                       //              groupImplRef = new GroupConsumerImpl();
+                                       registerWithOSGIConsole();
                                }
                                else {
                                        logger.error("Data Provider Service is down or NULL. " +
@@ -68,18 +86,85 @@ public class FRMConsumerImpl extends AbstractBindingAwareProvider {
                System.out.println("Consumer session is NULL. Please check if provider is registered");
         }
   
+    }
+       
+       public static IClusterContainerServices getClusterContainerService() {
+        return clusterContainerService;
+    }
+
+    public static void setClusterContainerService(
+            IClusterContainerServices clusterContainerService) {
+        FRMConsumerImpl.clusterContainerService = clusterContainerService;
+    }
+
+    public static ISwitchManager getSwitchManager() {
+        return switchManager;
+    }
+
+    public static void setSwitchManager(ISwitchManager switchManager) {
+        FRMConsumerImpl.switchManager = switchManager;
+    }
+
+    public static IContainer getContainer() {
+        return container;
     }
 
-       public static DataProviderService getDataProviderService() {
+    public static void setContainer(IContainer container) {
+        FRMConsumerImpl.container = container;
+    }
+
+    private void registerWithOSGIConsole() {
+        BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
+        bundleContext.registerService(CommandProvider.class.getName(), this, null);
+    }
+       
+       private boolean getDependentModule() {
+           do {
+        clusterContainerService = (IClusterContainerServices) ServiceHelper.getGlobalInstance(IClusterContainerServices.class, this);
+        try {
+            Thread.sleep(4);
+        } catch (InterruptedException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+           } while(clusterContainerService == null);
+           
+           do {
+               
+           
+        container = (IContainer) ServiceHelper.getGlobalInstance(IContainer.class, this);
+        try {
+            Thread.sleep(5);
+        } catch (InterruptedException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+           } while (container == null);
+           
+           do {
+               switchManager = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class, container.getName(), this);
+               try {
+                   Thread.sleep(5);
+               } catch (InterruptedException e) {
+                   // TODO Auto-generated catch block
+                   e.printStackTrace();
+               }
+           } while(null == switchManager);
+        return true;
+       }
+
+       
+
+    public static DataProviderService getDataProviderService() {
                return dataProviderService;
        }
 
        public FlowConsumerImpl getFlowImplRef() {
-               return flowImplRef;
+           return flowImplRef;
        }
 
        public GroupConsumerImpl getGroupImplRef() {
-                       return groupImplRef;
+           return groupImplRef;
        }
         
        public static ProviderContext getProviderSession() {
@@ -93,6 +178,15 @@ public class FRMConsumerImpl extends AbstractBindingAwareProvider {
        public static DataBrokerService getDataBrokerService() {
                return dataBrokerService;
        }
+       
+       /*
+     * OSGI COMMANDS
+     */
+    @Override
+    public String getHelp() {
+        StringBuffer help = new StringBuffer();
+        return help.toString();
+    }
 
 }
        
diff --git a/opendaylight/forwardingrulesmanager_mdsal/openflow/src/main/java/org/opendaylight/controller/forwardingrulesmanager_mdsal/consumer/impl/FRMUtil.java b/opendaylight/forwardingrulesmanager_mdsal/openflow/src/main/java/org/opendaylight/controller/forwardingrulesmanager_mdsal/consumer/impl/FRMUtil.java
new file mode 100644 (file)
index 0000000..df34d19
--- /dev/null
@@ -0,0 +1,33 @@
+package org.opendaylight.controller.forwardingrulesmanager_mdsal.consumer.impl;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.bucket.Actions;
+
+public class FRMUtil {
+    private static final String NAMEREGEX = "^[a-zA-Z0-9]+$";
+    public enum operation {ADD, DELETE, UPDATE, GET};
+    
+    
+    public static boolean isNameValid(String name) {
+    
+        //  Name validation 
+        if (name == null || name.trim().isEmpty() || !name.matches(NAMEREGEX)) {
+            return false;
+        }
+        return true;
+        
+    }
+    
+    public static boolean areActionsValid(Actions actions) {
+     //   List<Action> actionList;
+       // Action actionRef;
+      //  if (null != actions && null != actions.getAction()) {
+       //     actionList = actions.getAction();
+            
+
+               
+       // }
+        
+        return true;
+    }
+}
index a6a3c71..59c7e04 100644 (file)
@@ -20,6 +20,7 @@ import org.opendaylight.controller.sal.common.util.Rpcs;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
+
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved;
@@ -27,6 +28,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.Flow
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeFlow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 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;
@@ -61,6 +63,7 @@ public class FlowConsumerImpl {
                }
                
                listener = new FlowDataListener();
+               
                if (null == FRMConsumerImpl.getDataBrokerService().registerDataChangeListener(path, listener)) {
                        logger.error("Failed to listen on flow data modifcation events");
                System.out.println("Consumer SAL Service is down or NULL.");
@@ -75,7 +78,7 @@ public class FlowConsumerImpl {
                System.out.println("Consumer SAL Service is down or NULL.");
                return;
                }
-               addFlowTest();
+               //addFlowTest();
                System.out.println("-------------------------------------------------------------------");
                allocateCaches();
                commitHandler = new FlowDataCommitHandler();
@@ -120,11 +123,19 @@ public class FlowConsumerImpl {
     private void addFlow(InstanceIdentifier<?> path, Flow dataObject) {
 
         AddFlowInputBuilder input = new AddFlowInputBuilder();
+        List<Instruction> inst = (dataObject).getInstructions().getInstruction();
         input.setNode((dataObject).getNode());
         input.setPriority((dataObject).getPriority());
         input.setMatch((dataObject).getMatch());
         input.setCookie((dataObject).getCookie());
-        input.setAction((dataObject).getAction());
+        input.setInstructions((dataObject).getInstructions());
+        dataObject.getMatch().getLayer3Match()
+        for (int i=0;i<inst.size();i++) {
+            System.out.println("i = "+ i + inst.get(i).getInstruction().toString());
+            System.out.println("i = "+ i + inst.get(i).toString());
+        }
+        
+        System.out.println("Instruction list" + (dataObject).getInstructions().getInstruction().toString());
 
         // We send flow to the sounthbound plugin
         flowService.addFlow(input.build());
@@ -132,9 +143,11 @@ public class FlowConsumerImpl {
     
     private void commitToPlugin(internalTransaction transaction) {
         for(Entry<InstanceIdentifier<?>, Flow> entry :transaction.additions.entrySet()) {
+            System.out.println("Coming add cc in FlowDatacommitHandler");
             addFlow(entry.getKey(),entry.getValue());
         }
-        for(@SuppressWarnings("unused") Entry<InstanceIdentifier<?>, Flow> entry :transaction.additions.entrySet()) {
+        for(@SuppressWarnings("unused") Entry<InstanceIdentifier<?>, Flow> entry :transaction.updates.entrySet()) {
+            System.out.println("Coming update cc in FlowDatacommitHandler");
            // updateFlow(entry.getKey(),entry.getValue());
         }
         
@@ -196,9 +209,11 @@ public class FlowConsumerImpl {
             Flow original = originalSwView.get(key);
             if (original != null) {
                 // It is update for us
+                System.out.println("Coming update  in FlowDatacommitHandler");
                 updates.put(key, flow);
             } else {
                 // It is addition for us
+                System.out.println("Coming add in FlowDatacommitHandler");
                 additions.put(key, flow);
             }
         }
@@ -273,7 +288,7 @@ public class FlowConsumerImpl {
                        for (DataObject dataObject : additions) {
                            if (dataObject instanceof NodeFlow) {
                                NodeRef nodeOne = createNodeRef("foo:node:1");
-                                       // validating the dataObject here
+                                       // validating the dataObject here                               
                                    AddFlowInputBuilder input = new AddFlowInputBuilder();
                                    input.setNode(((NodeFlow) dataObject).getNode());
                                    input.setNode(nodeOne);
@@ -300,18 +315,6 @@ public class FlowConsumerImpl {
         return new NodeRef(path);
     }
            
-         /*  private void loadFlowData() {
        
-                   DataModification modification = (DataModification) dataservice.beginTransaction();
-                   String id = "abc";
-                   FlowKey key = new FlowKey(id, new NodeRef());
-                   InstanceIdentifier<?> path1;
-                   FlowBuilder flow = new FlowBuilder();
-                   flow.setKey(key);
-                   path1 = InstanceIdentifier.builder().node(Flows.class).node(Flow.class, key).toInstance();
-                   DataObject cls = (DataObject) modification.readConfigurationData(path);
-                   modification.putConfigurationData(path, flow.build());
-                   modification.commit();
-               }*/
 
 }
index cc42e21..acc0dc6 100644 (file)
@@ -1,7 +1,478 @@
 package org.opendaylight.controller.forwardingrulesmanager_mdsal.consumer.impl;
 
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.opendaylight.controller.clustering.services.CacheConfigException;
+import org.opendaylight.controller.clustering.services.CacheExistException;
+import org.opendaylight.controller.clustering.services.IClusterContainerServices;
+import org.opendaylight.controller.clustering.services.IClusterServices;
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
+import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction;
+import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.controller.sal.core.IContainer;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.GlobalConstants;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
+import org.opendaylight.controller.switchmanager.ISwitchManager;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.config.rev131024.Groups;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.config.rev131024.groups.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.config.rev131024.groups.GroupKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupAdded;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupUpdated;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes.GroupType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.Buckets;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket;
+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.NotificationListener;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("unused")
 public class GroupConsumerImpl {
-       public GroupConsumerImpl() {
-               
+    
+    protected static final Logger logger = LoggerFactory.getLogger(GroupConsumerImpl.class);
+    private GroupEventListener groupEventListener = new GroupEventListener();
+    private Registration<NotificationListener> groupListener;
+    private SalGroupService groupService;    
+    private GroupDataCommitHandler commitHandler;
+    
+    private ConcurrentMap<GroupKey, Group> originalSwGroupView;
+    private ConcurrentMap<GroupKey, Group> installedSwGroupView;
+    
+    private ConcurrentMap<Node, List<Group>> nodeGroups;
+    private ConcurrentMap<GroupKey, Group> inactiveGroups;
+    
+    private IClusterContainerServices clusterGroupContainerService = null;
+    private ISwitchManager switchGroupManager;
+    private IContainer container;
+    
+    public GroupConsumerImpl() {
+           InstanceIdentifier<? extends DataObject> path = InstanceIdentifier.builder().node(Groups.class).toInstance();
+        groupService = FRMConsumerImpl.getProviderSession().getRpcService(SalGroupService.class);
+        
+        clusterGroupContainerService = FRMConsumerImpl.getClusterContainerService();
+        switchGroupManager = FRMConsumerImpl.getSwitchManager();
+        container = FRMConsumerImpl.getContainer();
+        
+        if (!(cacheStartup())) {
+            logger.error("Unanle to allocate/retrieve group cache");
+            System.out.println("Unable to allocate/retrieve group cache");
+        }
+        
+        if (null == groupService) {
+            logger.error("Consumer SAL Group Service is down or NULL. FRM may not function as intended");
+            System.out.println("Consumer SAL Group Service is down or NULL.");
+            return;
+        }     
+        
+        // For switch events
+        groupListener = FRMConsumerImpl.getNotificationService().registerNotificationListener(groupEventListener);
+        
+        if (null == groupListener) {
+            logger.error("Listener to listen on group data modifcation events");
+            System.out.println("Listener to listen on group data modifcation events.");
+            return;
+        }       
+        
+        commitHandler = new GroupDataCommitHandler();
+        FRMConsumerImpl.getDataProviderService().registerCommitHandler(path, commitHandler);
        }
+       
+    private boolean allocateGroupCaches() {
+        if (this.clusterGroupContainerService == null) {
+            logger.warn("Group: Un-initialized clusterGroupContainerService, can't create cache");
+            return false;
+        }       
+
+        try {
+            clusterGroupContainerService.createCache("frm.originalSwGroupView",
+                    EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
+
+            clusterGroupContainerService.createCache("frm.installedSwGroupView",
+                    EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
+
+            clusterGroupContainerService.createCache("frm.inactiveGroups",
+                    EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
+
+            clusterGroupContainerService.createCache("frm.nodeGroups",
+                    EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
+            
+//TODO for cluster mode
+           /* clusterGroupContainerService.createCache(WORK_STATUS_CACHE,
+                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL, IClusterServices.cacheMode.ASYNC));
+
+            clusterGroupContainerService.createCache(WORK_ORDER_CACHE,
+                    EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL, IClusterServices.cacheMode.ASYNC));*/
+            
+        } catch (CacheConfigException cce) {            
+            logger.error("Group CacheConfigException");
+            return false;
+            
+        } catch (CacheExistException cce) {
+            logger.error(" Group CacheExistException");           
+        }
+        
+        return true;
+    }
+    
+    private void nonClusterGroupObjectCreate() {
+        originalSwGroupView = new ConcurrentHashMap<GroupKey, Group>();
+        installedSwGroupView = new ConcurrentHashMap<GroupKey, Group>();
+        nodeGroups = new ConcurrentHashMap<Node, List<Group>>();        
+        inactiveGroups = new ConcurrentHashMap<GroupKey, Group>();
+    }
+    
+    @SuppressWarnings({ "unchecked" })
+    private boolean retrieveGroupCaches() {
+        ConcurrentMap<?, ?> map;
+
+        if (this.clusterGroupContainerService == null) {
+            logger.warn("Group: un-initialized clusterGroupContainerService, can't retrieve cache");
+            nonClusterGroupObjectCreate();
+            return false;
+        }       
+
+        map = clusterGroupContainerService.getCache("frm.originalSwGroupView");
+        if (map != null) {
+            originalSwGroupView = (ConcurrentMap<GroupKey, Group>) map;
+        } else {
+            logger.error("Retrieval of cache(originalSwGroupView) failed");
+            return false;
+        }
+
+        map = clusterGroupContainerService.getCache("frm.installedSwGroupView");
+        if (map != null) {
+            installedSwGroupView = (ConcurrentMap<GroupKey, Group>) map;
+        } else {
+            logger.error("Retrieval of cache(installedSwGroupView) failed");
+            return false;
+        }
+
+        map = clusterGroupContainerService.getCache("frm.inactiveGroups");
+        if (map != null) {
+            inactiveGroups = (ConcurrentMap<GroupKey, Group>) map;
+        } else {
+            logger.error("Retrieval of cache(inactiveGroups) failed");
+            return false;
+        }
+
+        map = clusterGroupContainerService.getCache("frm.nodeGroups");
+        if (map != null) {
+            nodeGroups = (ConcurrentMap<Node, List<Group>>) map;
+        } else {
+            logger.error("Retrieval of cache(nodeGroup) failed");
+            return false;
+        }
+        
+        return true;
+    }
+       
+    private boolean cacheStartup() {
+        if (allocateGroupCaches()) {
+            if (retrieveGroupCaches()) {
+                return true;
+            }
+        }
+        
+        return false;
+    }
+    
+    public Status validateGroup(Group group, FRMUtil.operation operation) {
+        String containerName;
+        String groupName;
+        Iterator<Bucket> bucketIterator;
+        boolean returnResult;
+        Buckets groupBuckets;
+        
+        if (null != group) {
+            containerName = group.getContainerName();
+            
+            if (null == containerName) {
+                containerName = GlobalConstants.DEFAULT.toString();
+            }
+            else if (!FRMUtil.isNameValid(containerName)) {
+                logger.error("Container Name is invalid %s" + containerName);
+                return new Status(StatusCode.BADREQUEST, "Container Name is invalid");
+            }
+            
+            groupName = group.getGroupName();
+            if (!FRMUtil.isNameValid(groupName)) {
+                logger.error("Group Name is invalid %s" + groupName);
+                return new Status(StatusCode.BADREQUEST, "Group Name is invalid");
+            }
+            
+            returnResult = doesGroupEntryExists(group.getKey(), groupName, containerName);
+            
+            if (FRMUtil.operation.ADD == operation && returnResult) {
+                logger.error("Record with same Group Name exists");
+                return new Status(StatusCode.BADREQUEST, "Group record exists");
+            }
+            else if (!returnResult) {
+                logger.error("Group record does not exist");
+                return new Status(StatusCode.BADREQUEST, "Group record does not exist");
+            }
+            
+            if (!(group.getGroupType().getIntValue() >= GroupType.GroupAll.getIntValue() && 
+                    group.getGroupType().getIntValue() <= GroupType.GroupFf.getIntValue())) {
+                logger.error("Invalid Group type %d" + group.getGroupType().getIntValue());
+                return new Status(StatusCode.BADREQUEST, "Invalid Group type");                
+            }
+            
+            groupBuckets = group.getBuckets();
+                    
+            if (null != groupBuckets && null != groupBuckets.getBucket()) {
+                bucketIterator = groupBuckets.getBucket().iterator();
+                
+                while (bucketIterator.hasNext()) {
+                    if(!(FRMUtil.areActionsValid(bucketIterator.next().getActions()))) {
+                        logger.error("Error in action bucket");
+                        return new Status(StatusCode.BADREQUEST, "Invalid Group bucket contents");
+                    }                                
+                }
+            }                
+        }
+        
+        return new Status(StatusCode.SUCCESS);
+        
+    }
+    
+    private boolean doesGroupEntryExists(GroupKey key, String groupName, String containerName) {
+        if (! originalSwGroupView.containsKey(key)) {
+            return false;
+        }
+        
+        for (ConcurrentMap.Entry<GroupKey, Group> entry : originalSwGroupView.entrySet()) {
+            if (entry.getValue().getGroupName().equals(groupName)) {
+                if (entry.getValue().getContainerName().equals(containerName)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    
+    /**
+     * Update Group entries to the southbound plugin/inventory and our internal database
+     *
+     * @param path
+     * @param dataObject
+     */
+    private Status updateGroup(InstanceIdentifier<?> path, Group groupUpdateDataObject) {
+        GroupKey groupKey = groupUpdateDataObject.getKey();
+        Status groupOperationStatus = validateGroup(groupUpdateDataObject, FRMUtil.operation.UPDATE);
+        
+        if (!groupOperationStatus.isSuccess()) {
+            logger.error("Group data object validation failed %s" + groupUpdateDataObject.getGroupName());
+            return groupOperationStatus;
+        }
+            
+        originalSwGroupView.remove(groupKey);
+        originalSwGroupView.put(groupKey, groupUpdateDataObject);
+        
+        if (groupUpdateDataObject.isInstall()) {
+            UpdateGroupInputBuilder groupData = new UpdateGroupInputBuilder();
+            //TODO how to get original group and modified group. 
+            
+            if (installedSwGroupView.containsKey(groupKey)) {
+                installedSwGroupView.remove(groupKey);
+            }
+            
+            installedSwGroupView.put(groupKey, groupUpdateDataObject);
+            groupService.updateGroup(groupData.build());
+        }
+        
+        return groupOperationStatus;
+    }
+    
+    /**
+     * Adds Group to the southbound plugin and our internal database
+     *
+     * @param path
+     * @param dataObject
+     */
+    private Status addGroup(InstanceIdentifier<?> path, Group groupAddDataObject) {
+        GroupKey groupKey = groupAddDataObject.getKey();
+        Status groupOperationStatus = validateGroup(groupAddDataObject, FRMUtil.operation.ADD);
+        
+        if (!groupOperationStatus.isSuccess()) {
+            logger.error("Group data object validation failed %s" + groupAddDataObject.getGroupName());
+            return groupOperationStatus;
+        }
+        validateGroup(groupAddDataObject, FRMUtil.operation.ADD);
+        originalSwGroupView.put(groupKey, groupAddDataObject);
+        
+        if (groupAddDataObject.isInstall()) {
+            AddGroupInputBuilder groupData = new AddGroupInputBuilder();
+            groupData.setBuckets(groupAddDataObject.getBuckets());
+            groupData.setContainerName(groupAddDataObject.getContainerName());
+            groupData.setGroupId(groupAddDataObject.getGroupId());
+            groupData.setGroupType(groupAddDataObject.getGroupType());
+            groupData.setNode(groupAddDataObject.getNode());  
+            installedSwGroupView.put(groupKey, groupAddDataObject);
+            groupService.addGroup(groupData.build());
+        }
+        
+        return groupOperationStatus;
+    }
+    
+       private RpcResult<Void> commitToPlugin(internalTransaction transaction) {
+        for(Entry<InstanceIdentifier<?>, Group> entry :transaction.additions.entrySet()) {
+            
+            if (!addGroup(entry.getKey(),entry.getValue()).isSuccess()) {
+                return Rpcs.getRpcResult(false, null, null);
+            }
+        }
+        for(@SuppressWarnings("unused") Entry<InstanceIdentifier<?>, Group> entry :transaction.additions.entrySet()) {
+           
+            if (!updateGroup(entry.getKey(),entry.getValue()).isSuccess()) {
+                return Rpcs.getRpcResult(false, null, null);
+            }
+        }
+        
+        for(InstanceIdentifier<?> removal : transaction.removals) {
+           // removeFlow(removal);
+        }
+        
+        return Rpcs.getRpcResult(true, null, null);
+    }
+    
+    private final class GroupDataCommitHandler implements DataCommitHandler<InstanceIdentifier<?>, DataObject> {
+
+         @SuppressWarnings("unchecked")
+        @Override
+         public DataCommitTransaction requestCommit(DataModification<InstanceIdentifier<?>, DataObject> modification) {
+             // We should verify transaction
+             System.out.println("Coming in FlowDatacommitHandler");
+             internalTransaction transaction = new internalTransaction(modification);
+             transaction.prepareUpdate();
+             return transaction;
+         }
+    }
+
+    private final class internalTransaction implements DataCommitTransaction<InstanceIdentifier<?>, DataObject> {
+
+        private final DataModification<InstanceIdentifier<?>, DataObject> modification;
+
+        @Override
+        public DataModification<InstanceIdentifier<?>, DataObject> getModification() {
+            return modification;
+        }
+
+        public internalTransaction(DataModification<InstanceIdentifier<?>, DataObject> modification) {
+            this.modification = modification;
+        }
+
+        Map<InstanceIdentifier<?>, Group> additions = new HashMap<>();
+        Map<InstanceIdentifier<?>, Group> updates = new HashMap<>();
+        Set<InstanceIdentifier<?>> removals = new HashSet<>();
+
+        /**
+         * We create a plan which flows will be added, which will be updated and
+         * which will be removed based on our internal state.
+         * 
+         */
+        void prepareUpdate() {
+
+            Set<Entry<InstanceIdentifier<?>, DataObject>> puts = modification.getUpdatedConfigurationData().entrySet();
+            for (Entry<InstanceIdentifier<?>, DataObject> entry : puts) {
+                if (entry.getValue() instanceof Group) {                    
+                    Group group = (Group) entry.getValue();                    
+                    preparePutEntry(entry.getKey(), group);
+                }
+
+            }
+
+            removals = modification.getRemovedConfigurationData();
+        }
+
+        private void preparePutEntry(InstanceIdentifier<?> key, Group group) {
+            
+            Group original = originalSwGroupView.get(key);
+            if (original != null) {
+                // It is update for us
+                
+                updates.put(key, group);               
+            } else {
+                // It is addition for us
+                
+                additions.put(key, group);
+            }
+        }
+
+        /**
+         * We are OK to go with execution of plan
+         * 
+         */
+        @Override
+        public RpcResult<Void> finish() throws IllegalStateException {
+            
+            RpcResult<Void> rpcStatus = commitToPlugin(this);
+            // We return true if internal transaction is successful.
+          //  return Rpcs.getRpcResult(true, null, Collections.emptySet());
+            return rpcStatus;
+        }
+
+        /**
+         * 
+         * We should rollback our preparation
+         * 
+         */
+        @Override
+        public RpcResult<Void> rollback() throws IllegalStateException {
+            // NOOP - we did not modified any internal state during
+            // requestCommit phase
+           // return Rpcs.getRpcResult(true, null, Collections.emptySet());
+            return Rpcs.getRpcResult(true, null, null);
+            
+        }
+        
+    }
+    
+       
+       final class GroupEventListener implements SalGroupListener {
+           
+        List<GroupAdded> addedGroups = new ArrayList<>();
+        List<GroupRemoved> removedGroups = new ArrayList<>();
+        List<GroupUpdated> updatedGroups = new ArrayList<>();
+       
+
+        @Override
+        public void onGroupAdded(GroupAdded notification) {
+            System.out.println("added Group..........................");
+            addedGroups.add(notification);            
+        }
+
+        @Override
+        public void onGroupRemoved(GroupRemoved notification) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        @Override
+        public void onGroupUpdated(GroupUpdated notification) {
+            // TODO Auto-generated method stub
+            
+        }    
+    }
 }
index f822ac5..bb43809 100644 (file)
     </plugins>
   </build>
   <dependencies>
+
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+    </dependency>
     <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>sal-common-api</artifactId>
         <version>1.0-SNAPSHOT</version>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-common-util</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+       <groupId>org.mockito</groupId>
+       <artifactId>mockito-all</artifactId>
+       <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>equinoxSDK381</groupId>
       <artifactId>org.eclipse.osgi</artifactId>
diff --git a/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/datastore/ClusteredDataStore.java b/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/datastore/ClusteredDataStore.java
new file mode 100644 (file)
index 0000000..0a577ad
--- /dev/null
@@ -0,0 +1,18 @@
+
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+
+package org.opendaylight.controller.datastore;
+
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
+import org.opendaylight.controller.md.sal.common.api.data.DataReader;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public interface ClusteredDataStore extends DataReader<InstanceIdentifier<? extends Object>, Object>, DataCommitHandler<InstanceIdentifier<? extends Object>,Object> {
+}
index 101da7f..c94355d 100644 (file)
@@ -9,14 +9,46 @@
 
 package org.opendaylight.controller.datastore.internal;
 
+import org.apache.felix.dm.Component;
+import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
+import org.opendaylight.controller.datastore.ClusteredDataStore;
 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Set;
+
 public class Activator extends ComponentActivatorAbstractBase {
     protected static final Logger logger = LoggerFactory
             .getLogger(Activator.class);
 
 
+    @Override
+    protected Object[] getGlobalImplementations(){
+       logger.debug("Calling getGlobalImplementations to return:", ClusteredDataStoreManager.class);
+        return new Object[] {
+            ClusteredDataStoreManager.class
+        };
+    }
+
+
+    @Override
+    protected void configureGlobalInstance(Component c, Object imp){
+        if (imp.equals(ClusteredDataStoreManager.class)) {
+            Dictionary<String, Set<String>> props = new Hashtable<String, Set<String>>();
+
+            c.setInterface(new String[] { ClusteredDataStore.class.getName() }, props);
+            logger.debug("configureGlobalInstance adding dependency:", IClusterGlobalServices.class);
+            
+            c.add(createServiceDependency().setService(
+                    IClusterGlobalServices.class).setCallbacks(
+                    "setClusterGlobalServices",
+                    "unsetClusterGlobalServices").setRequired(true));
+
+        }
+    }
+
 
 }
diff --git a/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/datastore/internal/ClusteredDataStore.java b/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/datastore/internal/ClusteredDataStore.java
deleted file mode 100644 (file)
index 7c25b14..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.opendaylight.controller.datastore.internal;
-
-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.yangtools.yang.binding.InstanceIdentifier;
-
-public class ClusteredDataStore implements DataReader<InstanceIdentifier<? extends Object>, Object>, DataCommitHandler<InstanceIdentifier<? extends Object>,Object> {
-    @Override
-    public DataCommitTransaction<InstanceIdentifier<? extends Object>, Object> requestCommit(DataModification<InstanceIdentifier<? extends Object>, Object> modification) {
-        return null;
-    }
-
-    @Override
-    public Object readOperationalData(InstanceIdentifier<? extends Object> path) {
-        return null;
-    }
-
-    @Override
-    public Object readConfigurationData(InstanceIdentifier<? extends Object> path) {
-        return null;
-    }
-}
diff --git a/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/datastore/internal/ClusteredDataStoreImpl.java b/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/datastore/internal/ClusteredDataStoreImpl.java
new file mode 100644 (file)
index 0000000..f2e7773
--- /dev/null
@@ -0,0 +1,122 @@
+
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.datastore.internal;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.clustering.services.CacheConfigException;
+import org.opendaylight.controller.clustering.services.CacheExistException;
+import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
+import org.opendaylight.controller.clustering.services.IClusterServices;
+import org.opendaylight.controller.datastore.ClusteredDataStore;
+import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * The ClusteredDataStoreImpl stores global data to be shared across a controller cluster. It uses Clustering Services.
+ */
+public class ClusteredDataStoreImpl implements ClusteredDataStore {
+
+
+    public static final String OPERATIONAL_DATA_CACHE = "clustered_data_store.operational_data_cache";
+    public static final String CONFIGURATION_DATA_CACHE = "clustered_data_store.configuration_data_cache";
+
+    private ConcurrentMap operationalDataCache;
+    private ConcurrentMap configurationDataCache;
+
+    public ClusteredDataStoreImpl(IClusterGlobalServices clusterGlobalServices) throws CacheExistException, CacheConfigException {
+        Preconditions.checkNotNull(clusterGlobalServices, "clusterGlobalServices cannot be null");
+
+        operationalDataCache = clusterGlobalServices.createCache(OPERATIONAL_DATA_CACHE, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
+
+        if(operationalDataCache == null){
+            Preconditions.checkNotNull(operationalDataCache, "operationalDataCache cannot be null");
+        }
+
+        configurationDataCache = clusterGlobalServices.createCache(CONFIGURATION_DATA_CACHE, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
+
+        if(configurationDataCache == null){
+            Preconditions.checkNotNull(configurationDataCache, "configurationDataCache cannot be null");
+        }
+
+    }
+
+    @Override
+    public DataCommitTransaction<InstanceIdentifier<? extends Object>, Object> requestCommit(DataModification<InstanceIdentifier<? extends Object>, Object> modification) {
+        return new ClusteredDataStoreTransaction(modification);
+    }
+
+    @Override
+    public Object readOperationalData(InstanceIdentifier<? extends Object> path) {
+        Preconditions.checkNotNull(path, "path cannot be null");
+        return operationalDataCache.get(path);
+    }
+
+    @Override
+    public Object readConfigurationData(InstanceIdentifier<? extends Object> path) {
+        Preconditions.checkNotNull(path, "path cannot be null");
+        return configurationDataCache.get(path);
+    }
+
+    private RpcResult<Void> finish(final ClusteredDataStoreTransaction transaction) {
+      final DataModification<InstanceIdentifier<? extends Object>,Object> modification = transaction.getModification();
+
+      this.configurationDataCache.putAll(modification.getUpdatedConfigurationData());
+      this.operationalDataCache.putAll(modification.getUpdatedOperationalData());
+
+      for (final InstanceIdentifier<? extends Object> removal : modification.getRemovedConfigurationData()) {
+        this.configurationDataCache.remove(removal);
+      }
+
+      for (final InstanceIdentifier<? extends Object> removal : modification.getRemovedOperationalData()) {
+        this.operationalDataCache.remove(removal  );
+      }
+
+      Set<RpcError> _emptySet = Collections.<RpcError>emptySet();
+      return Rpcs.<Void>getRpcResult(true, null, _emptySet);
+    }
+
+    private RpcResult<Void> rollback(final ClusteredDataStoreTransaction transaction) {
+      Set<RpcError> _emptySet = Collections.<RpcError>emptySet();
+      return Rpcs.<Void>getRpcResult(true, null, _emptySet);
+    }
+
+    private class ClusteredDataStoreTransaction implements DataCommitTransaction<InstanceIdentifier<? extends Object>, Object> {
+        private final DataModification<InstanceIdentifier<? extends Object>,Object> modification;
+
+        public ClusteredDataStoreTransaction(DataModification<InstanceIdentifier<? extends Object>,Object> modification){
+            Preconditions.checkNotNull(modification, "modification cannot be null");
+
+            this.modification = modification;
+        }
+
+        @Override
+        public DataModification<InstanceIdentifier<? extends Object>, Object> getModification() {
+            return this.modification;
+        }
+
+        @Override
+        public RpcResult<Void> finish() throws IllegalStateException {
+            return ClusteredDataStoreImpl.this.finish(this);
+        }
+
+        @Override
+        public RpcResult<Void> rollback() throws IllegalStateException {
+            return ClusteredDataStoreImpl.this.rollback(this);
+        }
+    }
+}
diff --git a/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/datastore/internal/ClusteredDataStoreManager.java b/opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/datastore/internal/ClusteredDataStoreManager.java
new file mode 100644 (file)
index 0000000..e6acdb0
--- /dev/null
@@ -0,0 +1,75 @@
+
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+
+
+package org.opendaylight.controller.datastore.internal;
+
+import com.google.common.base.Preconditions;
+import org.apache.felix.dm.Component;
+import org.opendaylight.controller.clustering.services.CacheConfigException;
+import org.opendaylight.controller.clustering.services.CacheExistException;
+import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
+import org.opendaylight.controller.datastore.ClusteredDataStore;
+import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class ClusteredDataStoreManager implements ClusteredDataStore {
+
+    private ClusteredDataStoreImpl clusteredDataStore = null;
+    private IClusterGlobalServices clusterGlobalServices = null;
+
+    @Override
+    public DataCommitTransaction<InstanceIdentifier<? extends Object>, Object> requestCommit(DataModification<InstanceIdentifier<? extends Object>, Object> modification) {
+        Preconditions.checkState(clusteredDataStore != null, "clusteredDataStore cannot be null");
+        return clusteredDataStore.requestCommit(modification);
+    }
+
+    @Override
+    public Object readOperationalData(InstanceIdentifier<? extends Object> path) {
+        Preconditions.checkState(clusteredDataStore != null, "clusteredDataStore cannot be null");
+        return clusteredDataStore.readOperationalData(path);
+    }
+
+    @Override
+    public Object readConfigurationData(InstanceIdentifier<? extends Object> path) {
+        Preconditions.checkState(clusteredDataStore != null, "clusteredDataStore cannot be null");
+        return clusteredDataStore.readConfigurationData(path);
+    }
+
+
+    public void setClusterGlobalServices(IClusterGlobalServices clusterGlobalServices){
+        this.clusterGlobalServices = clusterGlobalServices;
+    }
+
+    public void unsetClusterGlobalServices(IClusterGlobalServices clusterGlobalServices){
+        this.clusterGlobalServices = null;
+        this.clusteredDataStore = null;
+    }
+
+
+    /**
+     * Function called by the dependency manager when all the required
+     * dependencies are satisfied
+     *
+     */
+    void init(Component c) {
+        try {
+               //Adding creation of the clustered data store in its own method to make the method unit testable
+            clusteredDataStore = createClusteredDataStore(c);
+        } catch (CacheExistException e) {
+            throw new IllegalStateException("could not construct clusteredDataStore");
+        } catch (CacheConfigException e) {
+            throw new IllegalStateException("could not construct clusteredDataStore");
+        }
+    }
+    protected ClusteredDataStoreImpl createClusteredDataStore(Component c) throws CacheExistException,CacheConfigException{
+       return  new ClusteredDataStoreImpl(clusterGlobalServices);
+    }
+}