Merge "Removed `which` dependency, now using proper shell builtin."
authorEd Warnicke <eaw@cisco.com>
Tue, 10 Jun 2014 13:46:52 +0000 (13:46 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 10 Jun 2014 13:46:52 +0000 (13:46 +0000)
323 files changed:
features/base/src/main/resources/features.xml
opendaylight/commons/opendaylight/pom.xml
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractDispatcher.java
opendaylight/config/logback-config-loader/pom.xml [new file with mode: 0644]
opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/Activator.java [new file with mode: 0644]
opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/impl/LogbackConfigUtil.java [new file with mode: 0644]
opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/impl/LogbackConfigurationLoader.java [new file with mode: 0644]
opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/LogbackConfigurationLoaderTest.java [new file with mode: 0644]
opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/TestAppender.java [new file with mode: 0644]
opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Debugger.java [new file with mode: 0644]
opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Errorer.java [new file with mode: 0644]
opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Informer.java [new file with mode: 0644]
opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Tracer.java [new file with mode: 0644]
opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Warner.java [new file with mode: 0644]
opendaylight/config/logback-config-loader/src/test/resources/logback-test.xml [new file with mode: 0755]
opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt.xml [new file with mode: 0755]
opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt2.xml [new file with mode: 0755]
opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt3.xml [new file with mode: 0755]
opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/LogbackModuleTest.java
opendaylight/config/pom.xml
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/fixed/FixedThreadPoolConfigBeanTest.java
opendaylight/config/threadpool-config-impl/src/test/java/org/opendaylight/controller/config/threadpool/scheduled/ScheduledThreadPoolConfigBeanTest.java
opendaylight/config/yang-jmx-generator-plugin/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/gofactory/AbsFactoryGeneratedObjectFactory.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/ModuleMXBeanEntryBuilder.java
opendaylight/distribution/opendaylight-karaf/src/main/resources/etc/jre.properties [new file with mode: 0644]
opendaylight/distribution/opendaylight-karaf/src/main/resources/etc/startup.properties [new file with mode: 0644]
opendaylight/distribution/opendaylight/pom.xml
opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini
opendaylight/distribution/opendaylight/src/main/resources/configuration/initial/99-netconf-connector.xml
opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.java [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.xtend [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.java [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.xtend [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.java [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.xtend [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.java [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.xtend [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.java [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.xtend [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.java [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.xtend [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.java [new file with mode: 0644]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.xtend [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/ConfigurableLinkManager.java [moved from opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/ConfigurableLinkManager.xtend with 57% similarity]
opendaylight/md-sal/compatibility/pom.xml
opendaylight/md-sal/compatibility/sal-compatibility/pom.xml
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.java [new file with mode: 0644]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend [deleted file]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryMapping.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/NodeMapping.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ToSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/NodeMappingTest.java
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestFromSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestToSalConversionsUtils.java
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/AbstractChangeListener.java
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/FRMActivator.java
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowChangeListener.java
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowProvider.java
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowTransactionValidator.java
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupChangeListener.java
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupProvider.java
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterChangeListener.java
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterProvider.java
opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/NodeChangeCommiter.java
opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-match-types.yang
opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-table-types.yang
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBrokerAwareActivator.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareConsumer.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareProvider.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareService.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationListener.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcConsumerRegistry.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataBrokerService.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderInstance.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcContextIdentifier.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcRoutingTable.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModuleFactory.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/RuntimeCodeGenerator.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/YangtoolsMappingHelper.java [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/AbstractRuntimeCodeGenerator.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/BrokerImplClassLoader.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcMetadata.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRouterCodegenInstance.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcServiceMetadata.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeCodeGenerator.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeGeneratedInvoker.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeGeneratedInvokerPrototype.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/SingletonHolder.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/AbstractNotificationListenerRegistration.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/AggregatedNotificationListenerRegistration.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/ListenerMapGeneration.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/MountPointManagerImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationListenerRegistration.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotifyTask.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingDomConnectorDeployer.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardingUtils.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/DelegateProxy.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/remote/RemoteRpcRouter.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/UnionSerializationTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/mock/BarListener.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/mock/FooListener.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/mock/FooService.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/RpcRegistrationNullPointer.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/BrokerIntegrationTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/RegistrationListener.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataProvisionService.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/notify/NotificationPublishService.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/MutableRoutingTable.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/Route.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RoutingTable.java
opendaylight/md-sal/sal-common-impl/pom.xml
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/AbstractDataReadRouter.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeEventImpl.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/InitialDataChangeEventImpl.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationException.java
opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/CommitHandlerTransactions.java
opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/RpcErrors.java
opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ToSalPropertyClassUtils.java
opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/BindingAwareRpcRouter.java
opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/BindingAwareZeroMqRpcRouter.java
opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/Connector.java
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/AbstractConsumer.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/BrokerService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/Consumer.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/Provider.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcConsumptionRegistry.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcProvisionRegistry.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcRegistrationListener.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcRoutingContext.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataBrokerService.java
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/data/DataStore.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataValidator.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/notify/NotificationListener.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/notify/NotificationPublishService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/notify/NotificationService.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/statistics/DomBrokerRuntimeMXBeanImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/AbstractDOMStoreTransaction.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStore.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/SnapshotBackedReadTransaction.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/SnapshotBackedReadWriteTransaction.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/SnapshotBackedWriteTransaction.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/DataTreeFactory.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/InMemoryDataTreeModification.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BrokerConfigActivator.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataBrokerImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataTransactionImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/DataReaderRouter.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DataBrokerServiceProxy.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DataProviderServiceProxy.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/NotificationRouter.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangDataUtils.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangSchemaUtils.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDataStoreTest.java
opendaylight/md-sal/sal-netconf-connector/pom.xml
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModule.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/api/MessageTransformer.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/api/RemoteDevice.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/api/RemoteDeviceCommunicator.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/api/RemoteDeviceHandler.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/api/SchemaContextProviderFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/api/SchemaSourceProviderFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/api/package-info.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/InventoryUtils.java [deleted file]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceListener.java [deleted file]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceTwoPhaseCommitTransaction.java [deleted file]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfInventoryUtils.java [deleted file]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfRemoteSchemaSourceProvider.java [deleted file]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfDeviceCommunicator.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfSessionCapabilities.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/listener/UncancellableFuture.java [moved from opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/UncancellableFuture.java with 67% similarity]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/package-info.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceCommitHandler.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceDataReader.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceDatastoreAdapter.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceRpc.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceSalFacade.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceSalProvider.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceTwoPhaseCommitTransaction.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/schema/NetconfDeviceSchemaProviderFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/schema/NetconfRemoteSchemaSourceProvider.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/schema/mapping/NetconfMessageTransformer.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/NetconfMessageTransformUtil.java [moved from opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.java with 50% similarity]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/NodeContainerProxy.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/util/FailedRpcResult.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/util/MessageCounter.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/util/RemoteDeviceId.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/util/package-info.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/yang/odl-sal-netconf-connector-cfg.yang
opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/test/resources/schemas/test-module.yang [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModuleFactory.java
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/dto/MessageWrapper.java
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/provider-service/src/main/java/org/opendaylight/controller/sample/zeromq/provider/ExampleProvider.java
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/src/test/java/org/opendaylight/controller/sample/zeromq/test/it/RouterTest.java
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/JsonReader.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestUtil.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlReader.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/EmptyNodeWrapper.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/IdentityValuesDTO.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/NodeWrapper.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestCodec.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/SimpleNodeWrapper.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/ListenerAdapter.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/Notificator.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/websockets/WebSocketServer.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/websockets/WebSocketServerHandler.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/websockets/WebSocketServerInitializer.java
opendaylight/md-sal/sal-rest-connector/src/main/resources/WEB-INF/web.xml
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonChoiceCaseTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonBasicDataTypesTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonLeafrefType.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnInstanceIdentifierToXmlTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlWithDataFromSeveralModulesTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonToCnSnTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/CodecsExceptionsCatchingTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyFuture.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestDeleteOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/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/structures/CompareLf.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlAugmentedElementToCnSnTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlToCnSnTest.java
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/augmentation/xml/data.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/choice/xml/data_case_defined_without_case.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/choice/xml/data_container.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/choice/xml/data_leaflist.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/choice/xml/data_list.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/choice/xml/data_more_choices_same_level.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/choice/xml/data_more_choices_same_level_various_paths_err.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/choice/xml/data_no_first_case.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/choice/xml/data_random_level.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/choice/xml/data_three_choices_same_level.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/choice/xml/data_various_path_err.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/leafref/xml/data_absolut_ref_to_existing_leaf.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/leafref/xml/data_from_leafref_to_leafref.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/leafref/xml/data_ref_to_non_existing_leaf.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/leafref/xml/data_ref_to_not_leaf.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/leafref/xml/data_relativ_ref_from_leaflist_to_existing_leaf.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/leafref/xml/data_relativ_ref_to_existing_leaf.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/simple-data-types/xml/bad-data.xml [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/simple-data-types/xml/data.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/simple-yang-types/xml/data.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/cnsn-to-json/simple-yang-types/xml/empty_data.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/full-versions/test-data2/data-rpc-input.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/instanceidentifier/xml/xmldata.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/parts/ietf-interfaces_interfaces_absolute_path.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/data-container.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/data-list.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/empty-data.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/identityref/xml/data-default-nmspc-in-element.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/identityref/xml/data-default-nmspc-in-parrent-element.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/identityref/xml/data-nmspc-in-parrent-element.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/identityref/xml/data-no-nmspc-value-with-prefix.xml
opendaylight/md-sal/sal-rest-connector/src/test/resources/xml-to-cnsn/identityref/xml/data-no-nmspc-value-without-prefix.xml
opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGenerator.java
opendaylight/md-sal/sal-rest-docgen/src/main/resources/WEB-INF/web.xml
opendaylight/md-sal/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/DocGeneratorTest.java
opendaylight/md-sal/samples/toaster-it/src/test/resources/controller.xml
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatisticsHandler.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsProvider.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsRequestScheduler.java
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryListener.java
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPLinkAger.java
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/utils/LLDPDiscoveryUtils.java
opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyExporter.java
opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyProvider.java
opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/OperationProcessor.java [new file with mode: 0644]
opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/TopologyOperation.java [new file with mode: 0644]
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/ReplaceEditConfigStrategyTest.java
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/SshClientChannelInitializer.java
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/TcpClientChannelInitializer.java
opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/test/TestingNetconfClient.java
opendaylight/netconf/netconf-impl/pom.xml
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerDispatcher.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfImplActivator.java
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITSecureTest.java
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java
opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/AbstractChannelInitializer.java
opendaylight/netconf/netconf-ssh/pom.xml
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/NetconfSSHServer.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/authentication/AuthProvider.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/authentication/AuthProviderInterface.java [deleted file]
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/authentication/PEMGenerator.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/NetconfSSHActivator.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/Handshaker.java [new file with mode: 0644]
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/IOThread.java [deleted file]
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/SocketThread.java [deleted file]
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/KeyGeneratorTest.java [deleted file]
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/SSHServerTest.java [deleted file]
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/EchoClient.java [new file with mode: 0644]
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/EchoClientHandler.java [new file with mode: 0644]
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/EchoServer.java [new file with mode: 0644]
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/EchoServerHandler.java [new file with mode: 0644]
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/ProxyServer.java [new file with mode: 0644]
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/ProxyServerHandler.java [new file with mode: 0644]
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/SSHTest.java [new file with mode: 0644]
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/ssh/authentication/SSHServerTest.java [new file with mode: 0644]
opendaylight/netconf/netconf-ssh/src/test/resources/logback-test.xml [new file with mode: 0644]
opendaylight/netconf/netconf-tcp/pom.xml [new file with mode: 0644]
opendaylight/netconf/netconf-tcp/src/main/java/org/opendaylight/controller/netconf/tcp/netty/ProxyServer.java [new file with mode: 0644]
opendaylight/netconf/netconf-tcp/src/main/java/org/opendaylight/controller/netconf/tcp/netty/ProxyServerHandler.java [new file with mode: 0644]
opendaylight/netconf/netconf-tcp/src/main/java/org/opendaylight/controller/netconf/tcp/osgi/NetconfTCPActivator.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/pom.xml
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/osgi/NetconfConfigUtil.java
opendaylight/netconf/pom.xml
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ContainerFlow.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/TCP.java
opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/TCPTest.java

index cc11205..23051f5 100644 (file)
@@ -1,10 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<features name="base-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
-   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-   xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+<features name="base-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
 
-   <feature name="base-all" description="OpenDaylight Controller"
-      version="${project.version}">
+   <feature name="base-all" description="OpenDaylight Controller" version="${project.version}">
       <feature>http</feature>
       <feature>transaction</feature>
       <feature>base-felix-dm</feature>
    <feature name="base-dummy-console" description="Temporary Dummy Console" version="1.1.0-SNAPSHOT">
       <bundle>mvn:org.opendaylight.controller/dummy-console/1.1.0-SNAPSHOT</bundle>
    </feature>
-   <feature name="base-felix-dm" description="Felix Dependency Manager"
-      version="${felix.dependencymanager.version}">
+   <feature name="base-felix-dm" description="Felix Dependency Manager" version="${felix.dependencymanager.version}">
       <bundle start-level="35">mvn:org.osgi/org.osgi.compendium/${osgi.compendium.version}</bundle>
       <bundle start-level="35">mvn:org.apache.felix/org.apache.felix.dependencymanager/${felix.dependencymanager.version}</bundle>
       <bundle start-level="35">mvn:org.apache.felix/org.apache.felix.dependencymanager.shell/${felix.dependencymanager.shell.version}</bundle>
    </feature>
-   <feature name="base-aries-spi-fly" description="Aries SPI Fly"
-      version="${spifly.version}">
+   <feature name="base-aries-spi-fly" description="Aries SPI Fly" version="${spifly.version}">
       <bundle start-level="35">mvn:org.apache.aries/org.apache.aries.util/1.1.0</bundle>
       <bundle start-level="35">mvn:org.apache.aries.spifly/org.apache.aries.spifly.dynamic.bundle/${spifly.version}</bundle>
       <bundle start-level="35">mvn:org.ow2.asm/asm-all/4.0</bundle>
    </feature>
-     <feature name='base-netty' version='${netty.version}'>
-        <bundle>wrap:mvn:io.netty/netty-buffer/${netty.version}</bundle>
-        <bundle>wrap:mvn:io.netty/netty-codec/${netty.version}</bundle>
-        <bundle>wrap:mvn:io.netty/netty-transport/${netty.version}</bundle>
-        <bundle>wrap:mvn:io.netty/netty-common/${netty.version}</bundle>
-        <bundle>wrap:mvn:io.netty/netty-handler/${netty.version}</bundle>
-        <bundle>wrap:mvn:io.netty/netty-codec-http/${netty.version}</bundle>
-        <bundle>mvn:org.opendaylight.controller.thirdparty/ganymed/1.1-SNAPSHOT</bundle>
-    </feature>
-    <feature name="base-jersey" description="Jersey" version="${jersey.version}">
-        <feature>base-gemini-web</feature>
-        <bundle>mvn:org.opendaylight.controller.thirdparty/com.sun.jersey.jersey-servlet/${jersey.version}</bundle>
-        <bundle>mvn:com.sun.jersey/jersey-server/${jersey.version}</bundle>
-        <bundle>mvn:com.sun.jersey/jersey-core/${jersey.version}</bundle>
-        <bundle>mvn:com.sun.jersey/jersey-client/${jersey.version}</bundle>
-        <bundle>mvn:com.sun.jersey/jersey-servlet/${jersey.version}</bundle>
+   <feature name='base-netty' version='${netty.version}'>
+      <bundle>wrap:mvn:io.netty/netty-buffer/${netty.version}</bundle>
+      <bundle>wrap:mvn:io.netty/netty-codec/${netty.version}</bundle>
+      <bundle>wrap:mvn:io.netty/netty-transport/${netty.version}</bundle>
+      <bundle>wrap:mvn:io.netty/netty-common/${netty.version}</bundle>
+      <bundle>wrap:mvn:io.netty/netty-handler/${netty.version}</bundle>
+      <bundle>wrap:mvn:io.netty/netty-codec-http/${netty.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller.thirdparty/ganymed/1.1-SNAPSHOT</bundle>
+   </feature>
+   <feature name="base-jersey" description="Jersey" version="${jersey.version}">
+      <feature>base-gemini-web</feature>
+      <bundle>mvn:org.opendaylight.controller.thirdparty/com.sun.jersey.jersey-servlet/${jersey.version}</bundle>
+      <bundle>mvn:com.sun.jersey/jersey-server/${jersey.version}</bundle>
+      <bundle>mvn:com.sun.jersey/jersey-core/${jersey.version}</bundle>
+      <bundle>mvn:com.sun.jersey/jersey-client/${jersey.version}</bundle>
+      <bundle>mvn:com.sun.jersey/jersey-servlet/${jersey.version}</bundle>
+      <bundle start="true" start-level="35">mvn:javax.ws.rs/javax.ws.rs-api/2.0</bundle>
    </feature>
+   <feature name="base-jersey2-osgi" description="OSGi friendly Jersey" version="${jersey2.publisher.version}">
+      <feature>http</feature>
+      <bundle>mvn:com.eclipsesource.jaxrs/jersey-all/${jersey2.version}</bundle>
+      <bundle>mvn:com.eclipsesource.jaxrs/publisher/${jersey2.publisher.version}</bundle>
+      <bundle start="true" start-level="35">mvn:javax.ws.rs/javax.ws.rs-api/${jsr311.v2.api.version}</bundle>
+      <bundle>mvn:javax.annotation/javax.annotation-api/${javax.annotation.version}</bundle>
+    </feature>
    <feature name="base-jackson" description="Jackson JAX-RS" version="${jackson.version}">
       <bundle start="true" start-level="35">mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle>
       <bundle start="true" start-level="35">mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle>
       <bundle start="true" start-level="35">mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle>
       <bundle start="true" start-level="35">mvn:org.codehaus.jettison/jettison/${jettison.version}</bundle>
-      <bundle start="true" start-level="35">mvn:javax.ws.rs/jsr311-api/${jsr311.api.version}</bundle>
       <bundle start="true" start-level="35">mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/${jackson.version}</bundle>
       <bundle start="true" start-level="35">mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/${jackson.version}</bundle>
       <bundle start="true" start-level="35">mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/${jackson.version}</bundle>
@@ -66,8 +68,7 @@
       <bundle start-level="35">mvn:org.slf4j/slf4j-simple/1.7.2</bundle>
       <bundle start="true" start-level="35">mvn:org.slf4j/slf4j-api/1.7.2</bundle>
    </feature>
-   <feature name="base-apache-commons" description="Apache Commons Libraries"
-      version="${project.version}">
+   <feature name="base-apache-commons" description="Apache Commons Libraries" version="${project.version}">
       <bundle start="true" start-level="35">mvn:com.google.guava/guava/${guava.version}</bundle>
       <bundle start="true" start-level="35">mvn:org.javassist/javassist/${javassist.version}</bundle>
       <bundle start="true" start-level="35">mvn:commons-io/commons-io/${commons.io.version}</bundle>
index c166f66..077b452 100644 (file)
     <java.version.source>1.7</java.version.source>
     <java.version.target>1.7</java.version.target>
     <javassist.version>3.17.1-GA</javassist.version>
+    <javax.annotation.version>1.2</javax.annotation.version>
     <!-- Third party version -->
     <jersey-servlet.version>1.17</jersey-servlet.version>
     <jersey.version>1.17</jersey.version>
+    <jersey2.publisher.version>4.0</jersey2.publisher.version>
+    <jersey2.version>2.8</jersey2.version>
     <jettison.version>1.3.3</jettison.version>
     <jmxGeneratorPath>src/main/yang-gen-config</jmxGeneratorPath>
     <jolokia.version>1.1.4</jolokia.version>
     <jsr305.api.version>2.0.1</jsr305.api.version>
     <jsr311.api.version>1.1.1</jsr311.api.version>
+    <jsr311.v2.api.version>2.0</jsr311.v2.api.version>
     <junit.version>4.8.1</junit.version>
     <karaf.version>3.0.1</karaf.version>
     <logback.version>1.0.9</logback.version>
     <mdsal.version>1.1-SNAPSHOT</mdsal.version>
     <mockito.version>1.9.5</mockito.version>
     <netconf.version>0.2.5-SNAPSHOT</netconf.version>
-    <netty.version>4.0.17.Final</netty.version>
+    <netty.version>4.0.19.Final</netty.version>
     <networkconfig.bridgedomain.northbound.version>0.0.3-SNAPSHOT</networkconfig.bridgedomain.northbound.version>
     <networkconfig.neutron.implementation.version>0.4.2-SNAPSHOT</networkconfig.neutron.implementation.version>
     <networkconfig.neutron.northbound.version>0.4.2-SNAPSHOT</networkconfig.neutron.northbound.version>
         <version>${netconf.version}</version>
         <type>test-jar</type>
       </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>netconf-tcp</artifactId>
+        <version>${netconf.version}</version>
+      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>netconf-util</artifactId>
index 916ef9a..fef2c71 100644 (file)
@@ -7,12 +7,16 @@
  */
 package org.opendaylight.protocol.framework;
 
+import com.google.common.base.Preconditions;
 import io.netty.bootstrap.Bootstrap;
 import io.netty.bootstrap.ServerBootstrap;
+import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.ChannelInitializer;
 import io.netty.channel.ChannelOption;
 import io.netty.channel.EventLoopGroup;
+import io.netty.channel.ServerChannel;
+import io.netty.channel.local.LocalServerChannel;
 import io.netty.channel.socket.SocketChannel;
 import io.netty.channel.socket.nio.NioServerSocketChannel;
 import io.netty.channel.socket.nio.NioSocketChannel;
@@ -21,22 +25,20 @@ import io.netty.util.concurrent.EventExecutor;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.GlobalEventExecutor;
 import io.netty.util.concurrent.Promise;
-
 import java.io.Closeable;
 import java.net.InetSocketAddress;
-
+import java.net.SocketAddress;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Preconditions;
-
 /**
  * Dispatcher class for creating servers and clients. The idea is to first create servers and clients and the run the
  * start method that will handle sockets in different thread.
  */
 public abstract class AbstractDispatcher<S extends ProtocolSession<?>, L extends SessionListener<?, ?, ?>> implements Closeable {
 
-    protected interface PipelineInitializer<S extends ProtocolSession<?>> {
+
+    protected interface ChannelPipelineInitializer<CH extends Channel, S extends ProtocolSession<?>> {
         /**
          * Initializes channel by specifying the handlers in its pipeline. Handlers are protocol specific, therefore this
          * method needs to be implemented in protocol specific Dispatchers.
@@ -44,7 +46,11 @@ public abstract class AbstractDispatcher<S extends ProtocolSession<?>, L extends
          * @param channel whose pipeline should be defined, also to be passed to {@link SessionNegotiatorFactory}
          * @param promise to be passed to {@link SessionNegotiatorFactory}
          */
-        void initializeChannel(SocketChannel channel, Promise<S> promise);
+        void initializeChannel(CH channel, Promise<S> promise);
+    }
+
+    protected interface PipelineInitializer<S extends ProtocolSession<?>> extends ChannelPipelineInitializer<SocketChannel, S> {
+
     }
 
 
@@ -76,25 +82,43 @@ public abstract class AbstractDispatcher<S extends ProtocolSession<?>, L extends
      * @return ChannelFuture representing the binding process
      */
     protected ChannelFuture createServer(final InetSocketAddress address, final PipelineInitializer<S> initializer) {
+        return createServer(address, NioServerSocketChannel.class, initializer);
+    }
+
+    /**
+     * Creates server. Each server needs factories to pass their instances to client sessions.
+     *
+     * @param address address to which the server should be bound
+     * @param channelClass The {@link Class} which is used to create {@link Channel} instances from.
+     * @param initializer instance of PipelineInitializer used to initialize the channel pipeline
+     *
+     * @return ChannelFuture representing the binding process
+     */
+    protected <CH extends Channel> ChannelFuture createServer(SocketAddress address, Class<? extends ServerChannel> channelClass,
+                                                              final ChannelPipelineInitializer<CH, S> initializer) {
         final ServerBootstrap b = new ServerBootstrap();
-        b.childHandler(new ChannelInitializer<SocketChannel>() {
+        b.childHandler(new ChannelInitializer<CH>() {
 
             @Override
-            protected void initChannel(final SocketChannel ch) {
+            protected void initChannel(final CH ch) {
                 initializer.initializeChannel(ch, new DefaultPromise<S>(executor));
             }
         });
 
         b.option(ChannelOption.SO_BACKLOG, 128);
-        b.childOption(ChannelOption.SO_KEEPALIVE, true);
+        if (LocalServerChannel.class.equals(channelClass) == false) {
+            // makes no sense for LocalServer and produces warning
+            b.childOption(ChannelOption.SO_KEEPALIVE, true);
+        }
         customizeBootstrap(b);
 
         if (b.group() == null) {
             b.group(bossGroup, workerGroup);
         }
         try {
-            b.channel(NioServerSocketChannel.class);
+            b.channel(channelClass);
         } catch (IllegalStateException e) {
+            // FIXME: if this is ok, document why
             LOG.trace("Not overriding channelFactory on bootstrap {}", b, e);
         }
 
diff --git a/opendaylight/config/logback-config-loader/pom.xml b/opendaylight/config/logback-config-loader/pom.xml
new file mode 100644 (file)
index 0000000..03ff65f
--- /dev/null
@@ -0,0 +1,53 @@
+<?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">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>config-plugin-parent</artifactId>
+    <version>0.2.5-SNAPSHOT</version>
+    <relativePath>../config-plugin-parent</relativePath>
+  </parent>
+  <artifactId>logback-config-loader</artifactId>
+  <packaging>bundle</packaging>
+  <name>${project.artifactId}</name>
+  <prerequisites>
+    <maven>3.0.4</maven>
+  </prerequisites>
+
+  <dependencies>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+
+    <!-- test dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <configuration>
+          <instructions>
+            <Bundle-Activator>org.opendaylight.controller.logback.config.loader.Activator</Bundle-Activator>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/Activator.java b/opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/Activator.java
new file mode 100644 (file)
index 0000000..99866d5
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.logback.config.loader;
+
+import java.io.File;
+import java.util.List;
+
+import org.opendaylight.controller.logback.config.loader.impl.LogbackConfigUtil;
+import org.opendaylight.controller.logback.config.loader.impl.LogbackConfigurationLoader;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * default activator for loading multiple logback configuration files
+ */
+public class Activator implements BundleActivator {
+
+    /**
+     * expected environment variable name, containing the root folder containing
+     * logback configurations
+     */
+    private static final String LOGBACK_CONFIG_D = "logback.config.d";
+    private static Logger LOG = LoggerFactory.getLogger(Activator.class);
+
+    @Override
+    public void start(BundleContext context) {
+        LOG.info("Starting logback configuration loader");
+        String logbackConfigRoot = System.getProperty(LOGBACK_CONFIG_D);
+        LOG.debug("configRoot: {}", logbackConfigRoot);
+        if (logbackConfigRoot != null) {
+            File logbackConfigRootFile = new File(logbackConfigRoot);
+            List<File> sortedConfigFiles = LogbackConfigUtil.harvestSortedConfigFiles(logbackConfigRootFile);
+            LogbackConfigurationLoader.load(true, sortedConfigFiles.toArray());
+        }
+    }
+
+    @Override
+    public void stop(BundleContext context) {
+        LOG.info("Stopping logback configuration loader");
+        // TODO: need reset/reload default config?
+    }
+
+}
diff --git a/opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/impl/LogbackConfigUtil.java b/opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/impl/LogbackConfigUtil.java
new file mode 100644 (file)
index 0000000..ddf14d7
--- /dev/null
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.logback.config.loader.impl;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * logback config utils
+ */
+public final class LogbackConfigUtil {
+
+    /** logback config file pattern (*.xml) */
+    protected static final String LOGBACK_CONFIG_FILE_REGEX_SEED = ".+\\.xml";
+    private static final Logger LOG = LoggerFactory
+            .getLogger(LogbackConfigUtil.class);
+
+    /**
+     *  forbidden ctor
+     */
+    private LogbackConfigUtil() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @param logConfigRoot folder containing configuration files
+     * @return sorted list of found files
+     */
+    public static List<File> harvestSortedConfigFiles(File logConfigRoot) {
+        final Pattern xmlFilePattern = Pattern.compile(LOGBACK_CONFIG_FILE_REGEX_SEED);
+        File[] configs = logConfigRoot.listFiles(new FileFilter() {
+            @Override
+            public boolean accept(File pathname) {
+                return pathname.isFile()
+                        && xmlFilePattern.matcher(pathname.getName()).find();
+            }
+        });
+
+        List<File> sortedConfigFiles = new ArrayList<File>(configs.length);
+        for (File cfgItem : configs) {
+            LOG.trace("config: {}", cfgItem.toURI());
+            sortedConfigFiles.add(cfgItem);
+        }
+        Collections.sort(sortedConfigFiles);
+
+        return sortedConfigFiles;
+    }
+
+}
diff --git a/opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/impl/LogbackConfigurationLoader.java b/opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/impl/LogbackConfigurationLoader.java
new file mode 100644 (file)
index 0000000..2aa6b1a
--- /dev/null
@@ -0,0 +1,109 @@
+/**
+ * Copyright (c) 201 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.logback.config.loader.impl;
+
+import java.io.File;
+import java.net.URL;
+
+import org.slf4j.ILoggerFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.joran.JoranConfigurator;
+import ch.qos.logback.core.joran.spi.JoranException;
+import ch.qos.logback.core.util.StatusPrinter;
+
+/**
+ * Logback configuration loader.
+ * Strategy:
+ * <ol>
+ * <li>reset actual configuration (probably default configuration)</li>
+ * <li>load all given logback config xml files in given order</li>
+ * </ol>
+ */
+public final class LogbackConfigurationLoader {
+
+    private static final Logger LOG = LoggerFactory
+            .getLogger(LogbackConfigurationLoader.class);
+
+    /**
+     *  forbidden ctor
+     */
+    private LogbackConfigurationLoader() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * load given logback configurations in given order, reset existing configuration before applying first one
+     * @param purgeBefore require reset before loading first config
+     * @param args
+     */
+    public static void load(boolean purgeBefore, Object...args) {
+        try {
+            if (purgeBefore) {
+                resetExistingConfiguration();
+            }
+            for (Object logbackConfig : args) {
+                load(logbackConfig);
+            }
+        } catch (IllegalStateException e) {
+            LOG.warn("loading of multiple logback configurations failed", e);
+        }
+    }
+
+    /**
+     * purge existing logback configuration
+     */
+    public static void resetExistingConfiguration() {
+        LOG.trace("resetting existing logback configuration");
+        LoggerContext context = getLoggerContext();
+        JoranConfigurator configurator = new JoranConfigurator();
+        configurator.setContext(context);
+        context.reset();
+    }
+
+    /**
+     * @return logback context
+     */
+    private static LoggerContext getLoggerContext() {
+        ILoggerFactory context = LoggerFactory.getILoggerFactory();
+        if (context != null && context instanceof LoggerContext) {
+            // now SLF4J is bound to logback in the current environment
+            return (LoggerContext) context;
+        }
+        throw new IllegalStateException("current logger factory is not supported: " + context);
+    }
+
+    /**
+     * @param logbackConfig
+     * @param reset true if previous configuration needs to get purged
+     */
+    public static void load(Object logbackConfig) {
+        LOG.trace("BEFORE logback reconfig");
+        try {
+            LoggerContext context = getLoggerContext();
+            JoranConfigurator configurator = new JoranConfigurator();
+            configurator.setContext(context);
+            if (logbackConfig instanceof String) {
+                configurator.doConfigure((String) logbackConfig);
+            } else if (logbackConfig instanceof URL) {
+                configurator.doConfigure((URL) logbackConfig);
+            } else if (logbackConfig instanceof File) {
+                configurator.doConfigure((File) logbackConfig);
+            }
+
+            LOG.trace("applied {}", logbackConfig);
+            StatusPrinter.printInCaseOfErrorsOrWarnings(context);
+        } catch (IllegalStateException | JoranException je) {
+            LOG.warn("Logback configuration loading failed: {}", logbackConfig);
+        }
+        LOG.trace("AFTER logback reconfig");
+    }
+
+}
diff --git a/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/LogbackConfigurationLoaderTest.java b/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/LogbackConfigurationLoaderTest.java
new file mode 100644 (file)
index 0000000..2e9bf1d
--- /dev/null
@@ -0,0 +1,87 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.logback.config.loader.test;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+import org.opendaylight.controller.logback.config.loader.impl.LogbackConfigUtil;
+import org.opendaylight.controller.logback.config.loader.impl.LogbackConfigurationLoader;
+import org.opendaylight.controller.logback.config.loader.test.logwork.Debugger;
+import org.opendaylight.controller.logback.config.loader.test.logwork.Errorer;
+import org.opendaylight.controller.logback.config.loader.test.logwork.Informer;
+import org.opendaylight.controller.logback.config.loader.test.logwork.Tracer;
+import org.opendaylight.controller.logback.config.loader.test.logwork.Warner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * test of logging config loader - {@link LogbackConfigurationLoader}
+ */
+@RunWith(JUnit4.class)
+public class LogbackConfigurationLoaderTest {
+
+    /** logback config root */
+    private static final String LOGBACK_D = "/logback.d";
+    private static Logger LOG = LoggerFactory
+            .getLogger(LogbackConfigurationLoaderTest.class);
+
+    /**
+     * Test of method {@link LogbackConfigurationLoader#load(boolean, Object[])}
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testLoad() throws Exception {
+        File logConfigRoot = new File(LogbackConfigurationLoaderTest.class
+                .getResource(LOGBACK_D).getFile());
+        List<File> sortedConfigFiles = LogbackConfigUtil.harvestSortedConfigFiles(logConfigRoot);
+        LogbackConfigurationLoader.load(true, sortedConfigFiles.toArray());
+
+        LOG.info("LOGBACK ready -> about to use it");
+
+        Tracer.doSomeAction();
+        Debugger.doSomeAction();
+        Informer.doSomeAction();
+        Warner.doSomeAction();
+        Errorer.doSomeAction();
+
+        // check logs
+        String[] expectedLogs = new String[] {
+                "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.LogbackConfigurationLoaderTest: LOGBACK ready -> about to use it",
+                "LoggingEvent -> [TRACE] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: tracing",
+                "LoggingEvent -> [DEBUG] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: debugging",
+                "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: infoing",
+                "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: warning",
+                "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: erroring",
+                "LoggingEvent -> [DEBUG] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: debugging",
+                "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: infoing",
+                "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: warning",
+                "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: erroring",
+                "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.logwork.Informer: infoing",
+                "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Informer: warning",
+                "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Informer: erroring",
+                "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Warner: warning",
+                "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Warner: erroring",
+                "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Errorer: erroring"
+
+        };
+
+        List<String> logSnapshot = new ArrayList<>(TestAppender.getLogRecord());
+        for (String logLine : logSnapshot) {
+            LOG.info("\"{}\",", logLine);
+        }
+
+        Assert.assertArrayEquals(expectedLogs, logSnapshot.toArray());
+    }
+}
diff --git a/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/TestAppender.java b/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/TestAppender.java
new file mode 100644 (file)
index 0000000..b273d27
--- /dev/null
@@ -0,0 +1,145 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.logback.config.loader.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import ch.qos.logback.classic.spi.LoggingEvent;
+import ch.qos.logback.core.Appender;
+import ch.qos.logback.core.Context;
+import ch.qos.logback.core.LogbackException;
+import ch.qos.logback.core.filter.Filter;
+import ch.qos.logback.core.spi.FilterReply;
+import ch.qos.logback.core.status.Status;
+
+/**
+ * dummy appender for collecting log messages
+ *
+ * @param <E>
+ */
+public class TestAppender<E> implements Appender<E> {
+
+    private boolean started;
+    private Context context;
+    private String name;
+
+    private static List<String> logRecord = new ArrayList<>();
+
+    @Override
+    public void start() {
+        started = true;
+    }
+
+    @Override
+    public void stop() {
+        started = false;
+    }
+
+    @Override
+    public boolean isStarted() {
+        return started;
+    }
+
+    @Override
+    public void setContext(Context context) {
+        this.context = context;
+    }
+
+    @Override
+    public Context getContext() {
+        return context;
+    }
+
+    @Override
+    public void addStatus(Status status) {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    public void addInfo(String msg) {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    public void addInfo(String msg, Throwable ex) {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    public void addWarn(String msg) {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    public void addWarn(String msg, Throwable ex) {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    public void addError(String msg) {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    public void addError(String msg, Throwable ex) {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    public void addFilter(Filter<E> newFilter) {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    public void clearAllFilters() {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    public List<Filter<E>> getCopyOfAttachedFiltersList() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public FilterReply getFilterChainDecision(E event) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public void doAppend(E event) throws LogbackException {
+        if (event instanceof LoggingEvent) {
+            LoggingEvent lEvent = (LoggingEvent) event;
+            logRecord.add(String.format("%s -> [%s] %s: %s", event.getClass()
+                    .getSimpleName(), lEvent.getLevel(),
+                    lEvent.getLoggerName(), lEvent.getMessage()));
+        } else {
+            logRecord.add(event.getClass() + " -> " + event.toString());
+        }
+    }
+
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return the logRecord
+     */
+    public static List<String> getLogRecord() {
+        return logRecord;
+    }
+
+}
diff --git a/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Debugger.java b/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Debugger.java
new file mode 100644 (file)
index 0000000..a8052f7
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.logback.config.loader.test.logwork;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * dummy logging guy
+ */
+public class Debugger {
+
+    private static Logger LOG = LoggerFactory.getLogger(Debugger.class);
+
+    /**
+     * all logging
+     */
+    public static void doSomeAction() {
+        LOG.trace("tracing");
+        LOG.debug("debugging");
+        LOG.info("infoing");
+        LOG.warn("warning");
+        LOG.error("erroring");
+    }
+
+}
diff --git a/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Errorer.java b/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Errorer.java
new file mode 100644 (file)
index 0000000..0bcd830
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.logback.config.loader.test.logwork;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * dummy logging guy
+ */
+public class Errorer {
+
+    private static Logger LOG = LoggerFactory.getLogger(Errorer.class);
+
+    /**
+     * all logging
+     */
+    public static void doSomeAction() {
+        LOG.trace("tracing");
+        LOG.debug("debugging");
+        LOG.info("infoing");
+        LOG.warn("warning");
+        LOG.error("erroring");
+    }
+
+}
diff --git a/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Informer.java b/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Informer.java
new file mode 100644 (file)
index 0000000..44f0931
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.logback.config.loader.test.logwork;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * dummy logging guy
+ */
+public class Informer {
+
+    private static Logger LOG = LoggerFactory.getLogger(Informer.class);
+
+    /**
+     * all logging
+     */
+    public static void doSomeAction() {
+        LOG.trace("tracing");
+        LOG.debug("debugging");
+        LOG.info("infoing");
+        LOG.warn("warning");
+        LOG.error("erroring");
+    }
+
+}
diff --git a/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Tracer.java b/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Tracer.java
new file mode 100644 (file)
index 0000000..70df607
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.logback.config.loader.test.logwork;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * dummy logging guy
+ */
+public class Tracer {
+
+    private static Logger LOG = LoggerFactory.getLogger(Tracer.class);
+
+    /**
+     * all logging
+     */
+    public static void doSomeAction() {
+        LOG.trace("tracing");
+        LOG.debug("debugging");
+        LOG.info("infoing");
+        LOG.warn("warning");
+        LOG.error("erroring");
+    }
+
+}
diff --git a/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Warner.java b/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Warner.java
new file mode 100644 (file)
index 0000000..8093180
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.logback.config.loader.test.logwork;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * dummy logging guy
+ */
+public class Warner {
+
+    private static Logger LOG = LoggerFactory.getLogger(Warner.class);
+
+    /**
+     * all logging
+     */
+    public static void doSomeAction() {
+        LOG.trace("tracing");
+        LOG.debug("debugging");
+        LOG.info("infoing");
+        LOG.warn("warning");
+        LOG.error("erroring");
+    }
+
+}
diff --git a/opendaylight/config/logback-config-loader/src/test/resources/logback-test.xml b/opendaylight/config/logback-config-loader/src/test/resources/logback-test.xml
new file mode 100755 (executable)
index 0000000..7fb760a
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<configuration debug="true">\r
+\r
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">\r
+    <encoder>\r
+      <pattern>%date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n</pattern>\r
+    </encoder>\r
+  </appender>\r
+\r
+  <root level="INFO">\r
+    <appender-ref ref="STDOUT" />\r
+  </root>\r
+\r
+  <!--  Base log level  -->\r
+  <logger name="org.opendaylight.controller.logback.config.loader" level="DEBUG"/>\r
+\r
+</configuration>\r
diff --git a/opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt.xml b/opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt.xml
new file mode 100755 (executable)
index 0000000..ca489d5
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<configuration debug="false">\r
+\r
+  <appender name="TEST" class="org.opendaylight.controller.logback.config.loader.test.TestAppender"/>\r
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">\r
+    <encoder>\r
+      <pattern>%date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n</pattern>\r
+    </encoder>\r
+  </appender>\r
+\r
+  <root level="INFO">\r
+    <appender-ref ref="TEST" />\r
+    <appender-ref ref="STDOUT" />\r
+  </root>\r
+\r
+  <!--  Base log level  -->\r
+  <logger name="org.opendaylight.controller.logback.config.loader" level="INFO"/>\r
+\r
+</configuration>\r
diff --git a/opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt2.xml b/opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt2.xml
new file mode 100755 (executable)
index 0000000..89f82c5
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<configuration debug="false">\r
+\r
+  <!--  Base log level  -->\r
+  <logger name="org.opendaylight.controller.logback.config.loader" level="DEBUG"/>\r
+  <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Tracer" level="TRACE"/>\r
+<!--   <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Debugger" level="DEBUG"/> -->\r
+  <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Informer" level="DEBUG"/>\r
+  <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Warner" level="ERROR"/>\r
+  <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Errorer" level="ERROR"/>\r
+\r
+</configuration>\r
diff --git a/opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt3.xml b/opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt3.xml
new file mode 100755 (executable)
index 0000000..a37b6f7
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<configuration debug="false">\r
+  <root level="INFO">\r
+    <appender-ref ref="TEST" />\r
+  </root>\r
+\r
+  <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Informer" level="INFO"/>\r
+  <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Warner" level="WARN"/>\r
+\r
+  <logger name="org.opendaylight.controller.logback.config.loader.test.LogbackConfigurationLoaderTest" level="TRACE"/>\r
+</configuration>\r
index d9c9dad..75323d2 100644 (file)
@@ -7,6 +7,14 @@
  */
 package org.opendaylight.controller.config.yang.logback.config;
 
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.junit.matchers.JUnitMatchers.containsString;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.management.ObjectName;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -16,15 +24,6 @@ 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.ObjectName;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-import static org.junit.matchers.JUnitMatchers.containsString;
-
 public class LogbackModuleTest extends AbstractConfigTest {
 
     private static final String INSTANCE_NAME = "singleton";
@@ -89,7 +88,7 @@ public class LogbackModuleTest extends AbstractConfigTest {
         assertBeanCount(1, factory.getImplementationName());
 
         ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        transaction.destroyConfigBean(factory.getImplementationName(), INSTANCE_NAME);
+        transaction.destroyModule(factory.getImplementationName(), INSTANCE_NAME);
         CommitStatus status = transaction.commit();
 
         assertBeanCount(0, factory.getImplementationName());
index 6139401..5f34a9a 100644 (file)
       </plugins>
     </pluginManagement>
     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>2.12</version>
+        <configuration>
+          <failsOnError>false</failsOnError>
+          <failOnViolation>false</failOnViolation>
+          <configLocation>checkstyle-logging.xml</configLocation>
+          <consoleOutput>true</consoleOutput>
+          <includeTestSourceDirectory>true</includeTestSourceDirectory>
+          <sourceDirectory>${project.basedir}</sourceDirectory>
+          <includes>**\/*.java,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat,**\/*.yang</includes>
+          <excludes>**\/target\/,**\/bin\/,**\/target-ide\/,**\/${jmxGeneratorPath}\/,**\/${salGeneratorPath}\/</excludes>
+        </configuration>
+        <dependencies>
+          <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>checkstyle-logging</artifactId>
+            <version>${yangtools.version}</version>
+          </dependency>
+        </dependencies>
+        <executions>
+          <execution>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
index c95661d..62b295b 100644 (file)
@@ -7,6 +7,19 @@
  */
 package org.opendaylight.controller.config.threadpool.fixed;
 
+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 java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+import java.util.ArrayList;
+import java.util.List;
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.ObjectName;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.config.api.ConflictingVersionException;
@@ -19,16 +32,11 @@ import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFacto
 import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;
 import org.opendaylight.controller.config.yang.threadpool.impl.fixed.FixedThreadPoolModuleFactory;
 import org.opendaylight.controller.config.yang.threadpool.impl.fixed.FixedThreadPoolModuleMXBean;
-
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InstanceNotFoundException;
-import javax.management.ObjectName;
-
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-import static org.junit.matchers.JUnitMatchers.containsString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class FixedThreadPoolConfigBeanTest extends AbstractConfigTest {
+    private static final Logger logger = LoggerFactory.getLogger(FixedThreadPoolConfigBeanTest.class);
 
     private FixedThreadPoolModuleFactory factory;
     private final String nameInstance = "fixedInstance";
@@ -36,7 +44,7 @@ public class FixedThreadPoolConfigBeanTest extends AbstractConfigTest {
     @Before
     public void setUp() {
         factory = new FixedThreadPoolModuleFactory();
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext,factory,
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, factory,
                 new NamingThreadFactoryModuleFactory()));
     }
 
@@ -44,7 +52,7 @@ public class FixedThreadPoolConfigBeanTest extends AbstractConfigTest {
     public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException,
             ConflictingVersionException {
         ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        createFixed(transaction, nameInstance, 2);
+        createFixed(transaction, nameInstance, 2, nameInstance);
 
         transaction.validateConfig();
         CommitStatus status = transaction.commit();
@@ -57,7 +65,7 @@ public class FixedThreadPoolConfigBeanTest extends AbstractConfigTest {
     public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,
             ValidationException {
         ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        createFixed(transaction, nameInstance, 4);
+        createFixed(transaction, nameInstance, 4, nameInstance);
 
         transaction.validateConfig();
         transaction.commit();
@@ -75,12 +83,12 @@ public class FixedThreadPoolConfigBeanTest extends AbstractConfigTest {
     public void testNegative() throws ConflictingVersionException, ValidationException, InstanceAlreadyExistsException {
         ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
 
-        createFixed(transaction, nameInstance, 5);
+        createFixed(transaction, nameInstance, 5, nameInstance);
         transaction.commit();
 
         transaction = configRegistryClient.createTransaction();
         try {
-            createFixed(transaction, nameInstance, 0);
+            createFixed(transaction, nameInstance, 0, nameInstance);
             fail();
         } catch (InstanceAlreadyExistsException e) {
             assertThat(
@@ -89,26 +97,56 @@ public class FixedThreadPoolConfigBeanTest extends AbstractConfigTest {
         }
     }
 
+    private int countThreadsByPrefix(String prefix) {
+        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
+        int result = 0;
+        List<String> names = new ArrayList<>();
+        for (ThreadInfo threadInfo : threadMXBean.dumpAllThreads(false, false)) {
+            names.add(threadInfo.getThreadName());
+            if (threadInfo.getThreadName().startsWith(prefix)) {
+                result++;
+            }
+        }
+        logger.info("Current threads {}", names);
+        return result;
+    }
+
     @Test
     public void testDestroy() throws InstanceAlreadyExistsException, ValidationException, ConflictingVersionException,
-            InstanceNotFoundException {
+            InstanceNotFoundException, InterruptedException {
+
+        String prefix = org.apache.commons.lang3.RandomStringUtils.randomAlphabetic(10);
+
+        int numberOfThreads = 100;
+        int threadCount1 = countThreadsByPrefix(prefix);
+        assertEquals(0, threadCount1);
         ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        createFixed(transaction, nameInstance, 1);
 
+        createFixed(transaction, nameInstance, numberOfThreads, prefix);
         transaction.commit();
+        int threadCount2 = countThreadsByPrefix(prefix);
+        assertEquals(numberOfThreads, threadCount2);
 
         transaction = configRegistryClient.createTransaction();
-        transaction.destroyConfigBean(factory.getImplementationName(), nameInstance);
+        transaction.destroyModule(factory.getImplementationName(), nameInstance);
         CommitStatus status = transaction.commit();
 
         assertBeanCount(0, factory.getImplementationName());
         assertStatus(status, 0, 0, 1);
+
+        for (int i = 0; i < 60; i++) {
+            if (countThreadsByPrefix(prefix) == 0) {
+                return;
+            }
+            Thread.sleep(1000);
+        }
+        assertEquals(0, countThreadsByPrefix(prefix));
     }
 
     @Test
     public void testValidationException() throws InstanceAlreadyExistsException {
         ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        createFixed(transaction, nameInstance, -1);
+        createFixed(transaction, nameInstance, -1, nameInstance);
         try {
             transaction.validateConfig();
             fail();
@@ -117,7 +155,7 @@ public class FixedThreadPoolConfigBeanTest extends AbstractConfigTest {
         }
     }
 
-    private ObjectName createFixed(ConfigTransactionJMXClient transaction, String name, int numberOfThreads)
+    private ObjectName createFixed(ConfigTransactionJMXClient transaction, String name, int numberOfThreads, String prefix)
             throws InstanceAlreadyExistsException {
         ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), name);
         FixedThreadPoolModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated, FixedThreadPoolModuleMXBean.class);
@@ -126,7 +164,7 @@ public class FixedThreadPoolConfigBeanTest extends AbstractConfigTest {
         ObjectName threadFactoryON = transaction.createModule(NamingThreadFactoryModuleFactory.NAME, "naming");
         NamingThreadFactoryModuleMXBean namingThreadFactoryModuleMXBean = transaction.newMXBeanProxy(threadFactoryON,
                 NamingThreadFactoryModuleMXBean.class);
-        namingThreadFactoryModuleMXBean.setNamePrefix("prefix");
+        namingThreadFactoryModuleMXBean.setNamePrefix(prefix);
 
         mxBean.setThreadFactory(threadFactoryON);
 
index ef06e43..0fc2fd6 100644 (file)
@@ -7,6 +7,15 @@
  */
 package org.opendaylight.controller.config.threadpool.scheduled;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.matchers.JUnitMatchers.containsString;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.ObjectName;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.config.api.ConflictingVersionException;
@@ -20,16 +29,6 @@ import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFacto
 import org.opendaylight.controller.config.yang.threadpool.impl.scheduled.ScheduledThreadPoolModuleFactory;
 import org.opendaylight.controller.config.yang.threadpool.impl.scheduled.ScheduledThreadPoolModuleMXBean;
 
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InstanceNotFoundException;
-import javax.management.ObjectName;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.matchers.JUnitMatchers.containsString;
-
 public class ScheduledThreadPoolConfigBeanTest extends AbstractConfigTest {
 
     private ScheduledThreadPoolModuleFactory factory;
@@ -103,7 +102,7 @@ public class ScheduledThreadPoolConfigBeanTest extends AbstractConfigTest {
         transaction.commit();
 
         transaction = configRegistryClient.createTransaction();
-        transaction.destroyConfigBean(factory.getImplementationName(), instanceName);
+        transaction.destroyModule(factory.getImplementationName(), instanceName);
         CommitStatus status = transaction.commit();
 
         assertBeanCount(0, factory.getImplementationName());
index 48a6c15..8c65eaa 100644 (file)
@@ -31,9 +31,9 @@ import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.Generated
 import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.JavaFileInputBuilder;
 import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.TypeName;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.osgi.framework.BundleContext;
 
 public class AbsFactoryGeneratedObjectFactory {
+    private static final String BUNDLE_CONTEXT = "org.osgi.framework.BundleContext";
 
     public GeneratedObject toGeneratedObject(ModuleMXBeanEntry mbe, Optional<String> copyright) {
         FullyQualifiedName absFactoryFQN = new FullyQualifiedName(mbe.getPackageName(), mbe.getAbstractFactoryName());
@@ -91,7 +91,7 @@ public class AbsFactoryGeneratedObjectFactory {
             "public %s createModule(String instanceName, %s dependencyResolver, %s bundleContext) {\n"+
                 "return instantiateModule(instanceName, dependencyResolver, bundleContext);\n"+
             "}\n",
-                Module.class.getCanonicalName(), DependencyResolver.class.getCanonicalName(), BundleContext.class.getCanonicalName()));
+                Module.class.getCanonicalName(), DependencyResolver.class.getCanonicalName(), BUNDLE_CONTEXT));
 
         b.addToBody(getCreateModule(moduleFQN, moduleFields));
 
@@ -100,12 +100,12 @@ public class AbsFactoryGeneratedObjectFactory {
                 "return new %s(new %s(NAME, instanceName), dependencyResolver, oldModule, oldInstance);\n"+
             "}\n",
                 moduleFQN, DependencyResolver.class.getCanonicalName(), moduleFQN, AutoCloseable.class.getCanonicalName(),
-                BundleContext.class.getCanonicalName(), moduleFQN, ModuleIdentifier.class.getCanonicalName()));
+                BUNDLE_CONTEXT, moduleFQN, ModuleIdentifier.class.getCanonicalName()));
 
         b.addToBody(format("\n"+
             "public %s instantiateModule(String instanceName, %s dependencyResolver, %s bundleContext) {\n"+
                 "return new %s(new %s(NAME, instanceName), dependencyResolver);\n"+
-            "}\n", moduleFQN, DependencyResolver.class.getCanonicalName(), BundleContext.class.getCanonicalName(),
+            "}\n", moduleFQN, DependencyResolver.class.getCanonicalName(), BUNDLE_CONTEXT,
                 moduleFQN, ModuleIdentifier.class.getCanonicalName()
         ));
 
@@ -118,7 +118,7 @@ public class AbsFactoryGeneratedObjectFactory {
             "@Override\n"+
             "public java.util.Set<%s> getDefaultModules(org.opendaylight.controller.config.api.DependencyResolverFactory dependencyResolverFactory, %s bundleContext) {\n"+
                 "return new java.util.HashSet<%s>();\n"+
-            "}\n", moduleFQN, BundleContext.class.getCanonicalName(), moduleFQN));
+            "}\n", moduleFQN, BUNDLE_CONTEXT, moduleFQN));
 
         return new GeneratedObjectBuilder(b.build()).toGeneratedObject();
     }
@@ -127,8 +127,8 @@ public class AbsFactoryGeneratedObjectFactory {
         String result = "\n"+
             "@Override\n"+
             format("public %s createModule(String instanceName, %s dependencyResolver, %s old, %s bundleContext) throws Exception {\n",
-                                Module.class.getCanonicalName(),DependencyResolver.class.getCanonicalName(),
-                                DynamicMBeanWithInstance.class.getCanonicalName(),BundleContext.class.getCanonicalName())+
+                                Module.class.getCanonicalName(), DependencyResolver.class.getCanonicalName(),
+                                DynamicMBeanWithInstance.class.getCanonicalName(), BUNDLE_CONTEXT)+
                 format("%s oldModule = null;\n",moduleFQN)+
                 "try {\n"+
                     format("oldModule = (%s) old.getModule();\n",moduleFQN)+
index 6da8dfc..89f3a4a 100644 (file)
@@ -18,7 +18,6 @@ import com.google.common.base.Optional;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -96,14 +95,10 @@ final class ModuleMXBeanEntryBuilder {
     // TODO: the XPath should be parsed by code generator IMO
     private static final String MAGIC_STRING = "MAGIC_STRING";
     private static final String MODULE_CONDITION_XPATH_TEMPLATE = "^/MAGIC_STRING:modules/MAGIC_STRING:module/MAGIC_STRING:type\\s*=\\s*['\"](.+)['\"]$";
-    private static final SchemaPath expectedConfigurationAugmentationSchemaPath = new SchemaPath(
-            Arrays.asList(createConfigQName("modules"),
-                    createConfigQName("module"),
-                    createConfigQName("configuration")), true);
-    private static final SchemaPath expectedStateAugmentationSchemaPath = new SchemaPath(
-            Arrays.asList(createConfigQName("modules"),
-                    createConfigQName("module"), createConfigQName("state")),
-            true);
+    private static final SchemaPath expectedConfigurationAugmentationSchemaPath = SchemaPath.create(true,
+            createConfigQName("modules"), createConfigQName("module"), createConfigQName("configuration"));
+    private static final SchemaPath expectedStateAugmentationSchemaPath = SchemaPath.create(true,
+            createConfigQName("modules"), createConfigQName("module"), createConfigQName("state"));
     private static final Pattern PREFIX_COLON_LOCAL_NAME = Pattern
             .compile("^(.+):(.+)$");
 
diff --git a/opendaylight/distribution/opendaylight-karaf/src/main/resources/etc/jre.properties b/opendaylight/distribution/opendaylight-karaf/src/main/resources/etc/jre.properties
new file mode 100644 (file)
index 0000000..e91da89
--- /dev/null
@@ -0,0 +1,503 @@
+################################################################################
+#
+#    Licensed to the Apache Software Foundation (ASF) under one or more
+#    contributor license agreements.  See the NOTICE file distributed with
+#    this work for additional information regarding copyright ownership.
+#    The ASF licenses this file to You under the Apache License, Version 2.0
+#    (the "License"); you may not use this file except in compliance with
+#    the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#
+################################################################################
+
+#
+# Java platform package export properties.
+#
+
+# Standard package set.  Note that:
+#   - javax.transaction* is exported with a mandatory attribute
+jre-1.6= \
+ javax.accessibility, \
+ javax.activation;version="1.1", \
+ javax.activity, \
+ javax.crypto, \
+ javax.crypto.interfaces, \
+ javax.crypto.spec, \
+ javax.imageio, \
+ javax.imageio.event, \
+ javax.imageio.metadata, \
+ javax.imageio.plugins.bmp, \
+ javax.imageio.plugins.jpeg, \
+ javax.imageio.spi, \
+ javax.imageio.stream, \
+ javax.jws, \
+ javax.jws.soap, \
+ javax.lang.model, \
+ javax.lang.model.element, \
+ javax.lang.model.type, \
+ javax.lang.model.util, \
+ javax.management, \
+ javax.management.loading, \
+ javax.management.modelmbean, \
+ javax.management.monitor, \
+ javax.management.openmbean, \
+ javax.management.relation, \
+ javax.management.remote, \
+ javax.management.remote.rmi, \
+ javax.management.timer, \
+ javax.naming, \
+ javax.naming.directory, \
+ javax.naming.event, \
+ javax.naming.ldap, \
+ javax.naming.spi, \
+ javax.net, \
+ javax.net.ssl, \
+ javax.print, \
+ javax.print.attribute, \
+ javax.print.attribute.standard, \
+ javax.print.event, \
+ javax.rmi, \
+ javax.rmi.CORBA, \
+ javax.rmi.ssl, \
+ javax.script, \
+ javax.security.auth, \
+ javax.security.auth.callback, \
+ javax.security.auth.kerberos, \
+ javax.security.auth.login, \
+ javax.security.auth.spi, \
+ javax.security.auth.x500, \
+ javax.security.cert, \
+ javax.security.sasl, \
+ javax.sound.midi, \
+ javax.sound.midi.spi, \
+ javax.sound.sampled, \
+ javax.sound.sampled.spi, \
+ javax.sql, \
+ javax.sql.rowset, \
+ javax.sql.rowset.serial, \
+ javax.sql.rowset.spi, \
+ javax.swing, \
+ javax.swing.border, \
+ javax.swing.colorchooser, \
+ javax.swing.event, \
+ javax.swing.filechooser, \
+ javax.swing.plaf, \
+ javax.swing.plaf.basic, \
+ javax.swing.plaf.metal, \
+ javax.swing.plaf.multi, \
+ javax.swing.plaf.synth, \
+ javax.swing.table, \
+ javax.swing.text, \
+ javax.swing.text.html, \
+ javax.swing.text.html.parser, \
+ javax.swing.text.rtf, \
+ javax.swing.tree, \
+ javax.swing.undo, \
+ javax.tools, \
+ javax.transaction; javax.transaction.xa; partial=true; mandatory:=partial, \
+ javax.xml, \
+ javax.xml.bind;version="2.2.1", \
+ javax.xml.bind.annotation;version="2.2.1", \
+ javax.xml.bind.annotation.adapters;version="2.2.1", \
+ javax.xml.bind.attachment;version="2.2.1", \
+ javax.xml.bind.helpers;version="2.2.1", \
+ javax.xml.bind.util;version="2.2.1", \
+ javax.xml.crypto, \
+ javax.xml.crypto.dom, \
+ javax.xml.crypto.dsig, \
+ javax.xml.crypto.dsig.dom, \
+ javax.xml.crypto.dsig.keyinfo, \
+ javax.xml.crypto.dsig.spec, \
+ javax.xml.datatype, \
+ javax.xml.namespace, \
+ javax.xml.parsers, \
+ javax.xml.soap;version="1.3", \
+ javax.xml.stream;version="1.2", \
+ javax.xml.stream.events;version="1.2", \
+ javax.xml.stream.util;version="1.2", \
+ javax.xml.transform, \
+ javax.xml.transform.dom, \
+ javax.xml.transform.sax, \
+ javax.xml.transform.stax, \
+ javax.xml.transform.stream, \
+ javax.xml.validation, \
+ javax.xml.ws;version="2.2", \
+ javax.xml.ws.handler;version="2.2", \
+ javax.xml.ws.handler.soap;version="2.2", \
+ javax.xml.ws.http;version="2.2", \
+ javax.xml.ws.soap;version="2.2", \
+ javax.xml.ws.spi;version="2.2", \
+ javax.xml.ws.wsaddressing;version="2.2", \
+ javax.xml.ws.spi.http;version="2.2", \
+ javax.xml.xpath, \
+ org.ietf.jgss, \
+ org.omg.CORBA, \
+ org.omg.CORBA_2_3, \
+ org.omg.CORBA_2_3.portable, \
+ org.omg.CORBA.DynAnyPackage, \
+ org.omg.CORBA.ORBPackage, \
+ org.omg.CORBA.portable, \
+ org.omg.CORBA.TypeCodePackage, \
+ org.omg.CosNaming, \
+ org.omg.CosNaming.NamingContextExtPackage, \
+ org.omg.CosNaming.NamingContextPackage, \
+ org.omg.Dynamic, \
+ org.omg.DynamicAny, \
+ org.omg.DynamicAny.DynAnyFactoryPackage, \
+ org.omg.DynamicAny.DynAnyPackage, \
+ org.omg.IOP, \
+ org.omg.IOP.CodecFactoryPackage, \
+ org.omg.IOP.CodecPackage, \
+ org.omg.Messaging, \
+ org.omg.PortableInterceptor, \
+ org.omg.PortableInterceptor.ORBInitInfoPackage, \
+ org.omg.PortableServer, \
+ org.omg.PortableServer.CurrentPackage, \
+ org.omg.PortableServer.POAManagerPackage, \
+ org.omg.PortableServer.POAPackage, \
+ org.omg.PortableServer.portable, \
+ org.omg.PortableServer.ServantLocatorPackage, \
+ org.omg.SendingContext, \
+ org.omg.stub.java.rmi, \
+ org.omg.stub.javax.management.remote.rmi, \
+ org.w3c.dom, \
+ org.w3c.dom.bootstrap, \
+ org.w3c.dom.css, \
+ org.w3c.dom.events, \
+ org.w3c.dom.html, \
+ org.w3c.dom.ls, \
+ org.w3c.dom.ranges, \
+ org.w3c.dom.stylesheets, \
+ org.w3c.dom.traversal, \
+ org.w3c.dom.views, \
+ org.w3c.dom.xpath, \
+ org.xml.sax, \
+ org.xml.sax.ext, \
+ org.xml.sax.helpers
+
+# Standard package set.  Note that:
+#   - javax.transaction* is exported with a mandatory attribute
+jre-1.7= \
+ javax.accessibility, \
+ javax.activation;version="1.1", \
+ javax.activity, \
+ javax.crypto, \
+ javax.crypto.interfaces, \
+ javax.crypto.spec, \
+ javax.imageio, \
+ javax.imageio.event, \
+ javax.imageio.metadata, \
+ javax.imageio.plugins.bmp, \
+ javax.imageio.plugins.jpeg, \
+ javax.imageio.spi, \
+ javax.imageio.stream, \
+ javax.jws, \
+ javax.jws.soap, \
+ javax.lang.model, \
+ javax.lang.model.element, \
+ javax.lang.model.type, \
+ javax.lang.model.util, \
+ javax.management, \
+ javax.management.loading, \
+ javax.management.modelmbean, \
+ javax.management.monitor, \
+ javax.management.openmbean, \
+ javax.management.relation, \
+ javax.management.remote, \
+ javax.management.remote.rmi, \
+ javax.management.timer, \
+ javax.naming, \
+ javax.naming.directory, \
+ javax.naming.event, \
+ javax.naming.ldap, \
+ javax.naming.spi, \
+ javax.net, \
+ javax.net.ssl, \
+ javax.print, \
+ javax.print.attribute, \
+ javax.print.attribute.standard, \
+ javax.print.event, \
+ javax.rmi, \
+ javax.rmi.CORBA, \
+ javax.rmi.ssl, \
+ javax.script, \
+ javax.security.auth, \
+ javax.security.auth.callback, \
+ javax.security.auth.kerberos, \
+ javax.security.auth.login, \
+ javax.security.auth.spi, \
+ javax.security.auth.x500, \
+ javax.security.cert, \
+ javax.security.sasl, \
+ javax.sound.midi, \
+ javax.sound.midi.spi, \
+ javax.sound.sampled, \
+ javax.sound.sampled.spi, \
+ javax.sql, \
+ javax.sql.rowset, \
+ javax.sql.rowset.serial, \
+ javax.sql.rowset.spi, \
+ javax.swing, \
+ javax.swing.border, \
+ javax.swing.colorchooser, \
+ javax.swing.event, \
+ javax.swing.filechooser, \
+ javax.swing.plaf, \
+ javax.swing.plaf.basic, \
+ javax.swing.plaf.metal, \
+ javax.swing.plaf.multi, \
+ javax.swing.plaf.synth, \
+ javax.swing.table, \
+ javax.swing.text, \
+ javax.swing.text.html, \
+ javax.swing.text.html.parser, \
+ javax.swing.text.rtf, \
+ javax.swing.tree, \
+ javax.swing.undo, \
+ javax.tools, \
+ javax.transaction; javax.transaction.xa; partial=true; mandatory:=partial, \
+ javax.xml, \
+ javax.xml.bind;version="2.2.1", \
+ javax.xml.bind.annotation;version="2.2.1", \
+ javax.xml.bind.annotation.adapters;version="2.2.1", \
+ javax.xml.bind.attachment;version="2.2.1", \
+ javax.xml.bind.helpers;version="2.2.1", \
+ javax.xml.bind.util;version="2.2.1", \
+ javax.xml.crypto, \
+ javax.xml.crypto.dom, \
+ javax.xml.crypto.dsig, \
+ javax.xml.crypto.dsig.dom, \
+ javax.xml.crypto.dsig.keyinfo, \
+ javax.xml.crypto.dsig.spec, \
+ javax.xml.datatype, \
+ javax.xml.namespace, \
+ javax.xml.parsers, \
+ javax.xml.soap;version="1.3", \
+ javax.xml.stream;version="1.2", \
+ javax.xml.stream.events;version="1.2", \
+ javax.xml.stream.util;version="1.2", \
+ javax.xml.transform, \
+ javax.xml.transform.dom, \
+ javax.xml.transform.sax, \
+ javax.xml.transform.stax, \
+ javax.xml.transform.stream, \
+ javax.xml.validation, \
+ javax.xml.ws;version="2.2", \
+ javax.xml.ws.handler;version="2.2", \
+ javax.xml.ws.handler.soap;version="2.2", \
+ javax.xml.ws.http;version="2.2", \
+ javax.xml.ws.soap;version="2.2", \
+ javax.xml.ws.spi;version="2.2", \
+ javax.xml.ws.wsaddressing;version="2.2", \
+ javax.xml.ws.spi.http;version="2.2", \
+ javax.xml.xpath, \
+ org.ietf.jgss, \
+ org.omg.CORBA, \
+ org.omg.CORBA_2_3, \
+ org.omg.CORBA_2_3.portable, \
+ org.omg.CORBA.DynAnyPackage, \
+ org.omg.CORBA.ORBPackage, \
+ org.omg.CORBA.portable, \
+ org.omg.CORBA.TypeCodePackage, \
+ org.omg.CosNaming, \
+ org.omg.CosNaming.NamingContextExtPackage, \
+ org.omg.CosNaming.NamingContextPackage, \
+ org.omg.Dynamic, \
+ org.omg.DynamicAny, \
+ org.omg.DynamicAny.DynAnyFactoryPackage, \
+ org.omg.DynamicAny.DynAnyPackage, \
+ org.omg.IOP, \
+ org.omg.IOP.CodecFactoryPackage, \
+ org.omg.IOP.CodecPackage, \
+ org.omg.Messaging, \
+ org.omg.PortableInterceptor, \
+ org.omg.PortableInterceptor.ORBInitInfoPackage, \
+ org.omg.PortableServer, \
+ org.omg.PortableServer.CurrentPackage, \
+ org.omg.PortableServer.POAManagerPackage, \
+ org.omg.PortableServer.POAPackage, \
+ org.omg.PortableServer.portable, \
+ org.omg.PortableServer.ServantLocatorPackage, \
+ org.omg.SendingContext, \
+ org.omg.stub.java.rmi, \
+ org.omg.stub.javax.management.remote.rmi, \
+ org.w3c.dom, \
+ org.w3c.dom.bootstrap, \
+ org.w3c.dom.css, \
+ org.w3c.dom.events, \
+ org.w3c.dom.html, \
+ org.w3c.dom.ls, \
+ org.w3c.dom.ranges, \
+ org.w3c.dom.stylesheets, \
+ org.w3c.dom.traversal, \
+ org.w3c.dom.views, \
+ org.w3c.dom.xpath, \
+ org.xml.sax, \
+ org.xml.sax.ext, \
+ org.xml.sax.helpers
+
+jre-1.8= \
+ javax.accessibility, \
+ javax.activation;version="1.1", \
+ javax.activity, \
+ javax.crypto, \
+ javax.crypto.interfaces, \
+ javax.crypto.spec, \
+ javax.imageio, \
+ javax.imageio.event, \
+ javax.imageio.metadata, \
+ javax.imageio.plugins.bmp, \
+ javax.imageio.plugins.jpeg, \
+ javax.imageio.spi, \
+ javax.imageio.stream, \
+ javax.jws, \
+ javax.jws.soap, \
+ javax.lang.model, \
+ javax.lang.model.element, \
+ javax.lang.model.type, \
+ javax.lang.model.util, \
+ javax.management, \
+ javax.management.loading, \
+ javax.management.modelmbean, \
+ javax.management.monitor, \
+ javax.management.openmbean, \
+ javax.management.relation, \
+ javax.management.remote, \
+ javax.management.remote.rmi, \
+ javax.management.timer, \
+ javax.naming, \
+ javax.naming.directory, \
+ javax.naming.event, \
+ javax.naming.ldap, \
+ javax.naming.spi, \
+ javax.net, \
+ javax.net.ssl, \
+ javax.print, \
+ javax.print.attribute, \
+ javax.print.attribute.standard, \
+ javax.print.event, \
+ javax.rmi, \
+ javax.rmi.CORBA, \
+ javax.rmi.ssl, \
+ javax.script, \
+ javax.security.auth, \
+ javax.security.auth.callback, \
+ javax.security.auth.kerberos, \
+ javax.security.auth.login, \
+ javax.security.auth.spi, \
+ javax.security.auth.x500, \
+ javax.security.cert, \
+ javax.security.sasl, \
+ javax.sound.midi, \
+ javax.sound.midi.spi, \
+ javax.sound.sampled, \
+ javax.sound.sampled.spi, \
+ javax.sql, \
+ javax.sql.rowset, \
+ javax.sql.rowset.serial, \
+ javax.sql.rowset.spi, \
+ javax.swing, \
+ javax.swing.border, \
+ javax.swing.colorchooser, \
+ javax.swing.event, \
+ javax.swing.filechooser, \
+ javax.swing.plaf, \
+ javax.swing.plaf.basic, \
+ javax.swing.plaf.metal, \
+ javax.swing.plaf.multi, \
+ javax.swing.plaf.synth, \
+ javax.swing.table, \
+ javax.swing.text, \
+ javax.swing.text.html, \
+ javax.swing.text.html.parser, \
+ javax.swing.text.rtf, \
+ javax.swing.tree, \
+ javax.swing.undo, \
+ javax.tools, \
+ javax.transaction; javax.transaction.xa; partial=true; mandatory:=partial, \
+ javax.xml, \
+ javax.xml.bind;version="2.2.1", \
+ javax.xml.bind.annotation;version="2.2.1", \
+ javax.xml.bind.annotation.adapters;version="2.2.1", \
+ javax.xml.bind.attachment;version="2.2.1", \
+ javax.xml.bind.helpers;version="2.2.1", \
+ javax.xml.bind.util;version="2.2.1", \
+ javax.xml.crypto, \
+ javax.xml.crypto.dom, \
+ javax.xml.crypto.dsig, \
+ javax.xml.crypto.dsig.dom, \
+ javax.xml.crypto.dsig.keyinfo, \
+ javax.xml.crypto.dsig.spec, \
+ javax.xml.datatype, \
+ javax.xml.namespace, \
+ javax.xml.parsers, \
+ javax.xml.soap;version="1.3", \
+ javax.xml.stream;version="1.2", \
+ javax.xml.stream.events;version="1.2", \
+ javax.xml.stream.util;version="1.2", \
+ javax.xml.transform, \
+ javax.xml.transform.dom, \
+ javax.xml.transform.sax, \
+ javax.xml.transform.stax, \
+ javax.xml.transform.stream, \
+ javax.xml.validation, \
+ javax.xml.ws;version="2.2", \
+ javax.xml.ws.handler;version="2.2", \
+ javax.xml.ws.handler.soap;version="2.2", \
+ javax.xml.ws.http;version="2.2", \
+ javax.xml.ws.soap;version="2.2", \
+ javax.xml.ws.spi;version="2.2", \
+ javax.xml.ws.wsaddressing;version="2.2", \
+ javax.xml.ws.spi.http;version="2.2", \
+ javax.xml.xpath, \
+ org.ietf.jgss, \
+ org.omg.CORBA, \
+ org.omg.CORBA_2_3, \
+ org.omg.CORBA_2_3.portable, \
+ org.omg.CORBA.DynAnyPackage, \
+ org.omg.CORBA.ORBPackage, \
+ org.omg.CORBA.portable, \
+ org.omg.CORBA.TypeCodePackage, \
+ org.omg.CosNaming, \
+ org.omg.CosNaming.NamingContextExtPackage, \
+ org.omg.CosNaming.NamingContextPackage, \
+ org.omg.Dynamic, \
+ org.omg.DynamicAny, \
+ org.omg.DynamicAny.DynAnyFactoryPackage, \
+ org.omg.DynamicAny.DynAnyPackage, \
+ org.omg.IOP, \
+ org.omg.IOP.CodecFactoryPackage, \
+ org.omg.IOP.CodecPackage, \
+ org.omg.Messaging, \
+ org.omg.PortableInterceptor, \
+ org.omg.PortableInterceptor.ORBInitInfoPackage, \
+ org.omg.PortableServer, \
+ org.omg.PortableServer.CurrentPackage, \
+ org.omg.PortableServer.POAManagerPackage, \
+ org.omg.PortableServer.POAPackage, \
+ org.omg.PortableServer.portable, \
+ org.omg.PortableServer.ServantLocatorPackage, \
+ org.omg.SendingContext, \
+ org.omg.stub.java.rmi, \
+ org.omg.stub.javax.management.remote.rmi, \
+ org.w3c.dom, \
+ org.w3c.dom.bootstrap, \
+ org.w3c.dom.css, \
+ org.w3c.dom.events, \
+ org.w3c.dom.html, \
+ org.w3c.dom.ls, \
+ org.w3c.dom.ranges, \
+ org.w3c.dom.stylesheets, \
+ org.w3c.dom.traversal, \
+ org.w3c.dom.views, \
+ org.w3c.dom.xpath, \
+ org.xml.sax, \
+ org.xml.sax.ext, \
+ org.xml.sax.helpers
diff --git a/opendaylight/distribution/opendaylight-karaf/src/main/resources/etc/startup.properties b/opendaylight/distribution/opendaylight-karaf/src/main/resources/etc/startup.properties
new file mode 100644 (file)
index 0000000..ca8c83c
--- /dev/null
@@ -0,0 +1,53 @@
+#Bundles to be started on startup, with startlevel
+
+# feature: framework version: 3.0.1
+mvn\:org.ops4j.base/ops4j-base-lang/1.4.0 = 5
+mvn\:biz.aQute.bnd/bndlib/2.2.0 = 5
+mvn\:org.ops4j.pax.swissbox/pax-swissbox-bnd/1.7.0 = 5
+mvn\:org.ops4j.pax.url/pax-url-maven-commons/1.6.0 = 5
+mvn\:org.ops4j.pax.url/pax-url-aether/1.6.0 = 5
+mvn\:org.ops4j.pax.url/pax-url-wrap/1.6.0 = 5
+mvn\:javax.annotation/javax.annotation-api/1.2 = 5
+mvn\:org.ops4j.pax.logging/pax-logging-api/1.7.2 = 8
+mvn\:org.ops4j.pax.logging/pax-logging-service/1.7.2 = 8
+mvn\:org.apache.karaf.service/org.apache.karaf.service.guard/3.0.1 = 10
+mvn\:org.apache.felix/org.apache.felix.configadmin/1.6.0 = 10
+mvn\:org.apache.felix/org.apache.felix.fileinstall/3.2.8 = 11
+mvn\:org.ow2.asm/asm-all/4.1 = 12
+mvn\:org.apache.aries/org.apache.aries.util/1.1.0 = 20
+mvn\:org.apache.aries.proxy/org.apache.aries.proxy.api/1.0.0 = 20
+mvn\:org.apache.aries.proxy/org.apache.aries.proxy.impl/1.0.2 = 20
+mvn\:org.apache.aries.blueprint/org.apache.aries.blueprint.api/1.0.0 = 20
+mvn\:org.apache.aries.blueprint/org.apache.aries.blueprint.cm/1.0.3 = 20
+mvn\:org.apache.aries.blueprint/org.apache.aries.blueprint.core.compatibility/1.0.0 = 20
+mvn\:org.apache.aries.blueprint/org.apache.aries.blueprint.core/1.4.0 = 20
+mvn\:org.apache.karaf.deployer/org.apache.karaf.deployer.spring/3.0.1 = 24
+mvn\:org.apache.karaf.deployer/org.apache.karaf.deployer.blueprint/3.0.1 = 24
+mvn\:org.apache.karaf.deployer/org.apache.karaf.deployer.wrap/3.0.1 = 24
+mvn\:org.apache.karaf.region/org.apache.karaf.region.core/3.0.1 = 25
+mvn\:org.apache.karaf.features/org.apache.karaf.features.core/3.0.1 = 25
+mvn\:org.apache.karaf.deployer/org.apache.karaf.deployer.features/3.0.1 = 26
+mvn\:jline/jline/2.11 = 30
+mvn\:org.jledit/core/0.2.1 = 30
+mvn\:org.fusesource.jansi/jansi/1.11 = 30
+mvn\:org.ops4j.base/ops4j-base-util-property/1.4.0 = 30
+mvn\:org.ops4j.base/ops4j-base-util-xml/1.4.0 = 30
+mvn\:org.ops4j.base/ops4j-base-util-collections/1.4.0 = 30
+mvn\:org.ops4j.pax.url/pax-url-commons/1.6.0 = 30
+mvn\:org.ops4j.pax.swissbox/pax-swissbox-property/1.7.0 = 30
+mvn\:org.ops4j.base/ops4j-base-net/1.4.0 = 30
+mvn\:org.ops4j.base/ops4j-base-monitors/1.4.0 = 30
+mvn\:org.apache.karaf.features/org.apache.karaf.features.command/3.0.1 = 30
+mvn\:org.apache.karaf.shell/org.apache.karaf.shell.console/3.0.1 = 30
+mvn\:org.apache.karaf.jaas/org.apache.karaf.jaas.modules/3.0.1 = 30
+mvn\:org.apache.karaf.jaas/org.apache.karaf.jaas.config/3.0.1 = 30
+mvn\:org.apache.karaf.jaas/org.apache.karaf.jaas.boot/3.0.1 = 30
+mvn\:org.apache.sshd/sshd-core/0.9.0 = 30
+mvn\:org.apache.karaf.bundle/org.apache.karaf.bundle.command/3.0.1 = 30
+mvn\:org.apache.karaf.shell/org.apache.karaf.shell.table/3.0.1 = 30
+mvn\:org.apache.karaf.bundle/org.apache.karaf.bundle.core/3.0.1 = 30
+mvn\:org.apache.karaf.shell/org.apache.karaf.shell.help/3.0.1 = 30
+mvn\:org.apache.karaf.system/org.apache.karaf.system.core/3.0.1 = 30
+mvn\:org.apache.karaf.system/org.apache.karaf.system.command/3.0.1 = 30
+mvn\:org.apache.karaf.shell/org.apache.karaf.shell.commands/3.0.1 = 30
+mvn\:org.apache.aries.quiesce/org.apache.aries.quiesce.api/1.0.0 = 30
index 5b44bb7..3802370 100644 (file)
           <groupId>org.opendaylight.controller</groupId>
           <artifactId>netconf-ssh</artifactId>
         </dependency>
+        <dependency>
+          <groupId>org.opendaylight.controller</groupId>
+          <artifactId>netconf-tcp</artifactId>
+        </dependency>
         <dependency>
           <groupId>org.opendaylight.controller</groupId>
           <artifactId>netconf-util</artifactId>
index f15f8f7..f05afbb 100644 (file)
@@ -14,13 +14,11 @@ osgi.bundles=\
 
 # Netconf startup configuration
 
-# Netconf tcp address:port is optional with default value 127.0.0.1:8383
+# Netconf tcp address:port is optional
 #netconf.tcp.address=127.0.0.1
-#netconf.tcp.port=8384
-
-#netconf.tcp.client.address=127.0.0.1
-#netconf.tcp.client.port=8384
+#netconf.tcp.port=8383
 
+# Netconf tcp address:port is optional
 netconf.ssh.address=0.0.0.0
 netconf.ssh.port=1830
 netconf.ssh.pk.path = ./configuration/RSA.pk
index fcbec19..b4b433d 100644 (file)
             <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-timer</type>
             <name>global-timer</name>
           </timer>
+        </module>
+
+        <!-- Netconf dispatcher to be used by all netconf-connectors --> 
+        <module>
+          <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl">prefix:threadfactory-naming</type>
+          <name>global-netconf-processing-executor-threadfactory</name>
+          <name-prefix xmlns="urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl">remote-connector-processing-executor</name-prefix>
+        </module>  
+        <module>
+          <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:flexible">prefix:threadpool-flexible</type>
+          <name>global-netconf-processing-executor</name>
+          <minThreadCount xmlns="urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:flexible">1</minThreadCount>
+          <max-thread-count xmlns="urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:flexible">4</max-thread-count>
+          <keepAliveMillis xmlns="urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:flexible">600000</keepAliveMillis>
+          <threadFactory xmlns="urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:flexible">
+            <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadfactory</type>
+            <name>global-netconf-processing-executor-threadfactory</name>
+          </threadFactory>
         </module>  
 
         <!-- Loopback connection to netconf server in controller using netconf-connector -->
             <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-event-executor</type>
             <name>global-event-executor</name>
           </event-executor>
+          <binding-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
+            <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>
+            <name>binding-osgi-broker</name>
+          </binding-registry>
           <dom-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
             <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">prefix:dom-broker-osgi-registry</type>
             <name>dom-broker</name>
             <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf">prefix:netconf-client-dispatcher</type>
             <name>global-netconf-dispatcher</name>
           </client-dispatcher>
+          <processing-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
+            <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadpool</type>
+            <name>global-netconf-processing-executor</name>
+          </processing-executor>
         </module>
       </modules>
 
             <provider>/modules/module[type='netconf-client-dispatcher'][name='global-netconf-dispatcher']</provider>
           </instance>
         </service>
+        <service>
+          <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadfactory</type>
+          <instance>
+            <name>global-netconf-processing-executor-threadfactory</name>
+            <provider>/modules/module[type='threadfactory-naming'][name='global-netconf-processing-executor-threadfactory']</provider>
+          </instance>
+        </service>
+        <service>
+          <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadpool</type>
+          <instance>
+            <name>global-netconf-processing-executor</name>
+            <provider>/modules/module[type='threadpool-flexible'][name='global-netconf-processing-executor']</provider>
+          </instance>
+        </service>
       </services>
 
     </data>
   <required-capabilities>
       <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf?module=odl-sal-netconf-connector-cfg&amp;revision=2013-10-28</capability>
       <capability>urn:opendaylight:params:xml:ns:yang:controller:config:netconf:client:dispatcher?module=odl-netconfig-client-cfg&amp;revision=2014-04-08</capability>
+      <capability>urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl?module=threadpool-impl&amp;revision=2013-04-05</capability>
+      <capability>urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:flexible?module=threadpool-impl-flexible&amp;revision=2013-12-01</capability>
   </required-capabilities>
 </snapshot>
index 18fb785..fc58ed9 100644 (file)
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.eclipse.xtend</groupId>
-      <artifactId>org.eclipse.xtend.lib</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>forwardingrulesmanager</artifactId>
           </instructions>
         </configuration>
       </plugin>
-      <plugin>
-        <groupId>org.eclipse.xtend</groupId>
-        <artifactId>xtend-maven-plugin</artifactId>
-      </plugin>
     </plugins>
   </build>
   <scm>
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.java
new file mode 100644 (file)
index 0000000..b37b501
--- /dev/null
@@ -0,0 +1,97 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.md.compatibility.inventory;
+
+import java.util.ArrayList;
+import java.util.Set;
+
+import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider;
+import org.opendaylight.controller.sal.compatibility.InventoryMapping;
+import org.opendaylight.controller.switchmanager.ISwitchManager;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class InventoryReader implements RuntimeDataProvider {
+    private static final Logger LOG = LoggerFactory.getLogger(InventoryReader.class);
+    private ISwitchManager switchManager;
+
+    public ISwitchManager getSwitchManager() {
+        return switchManager;
+    }
+
+    public void setSwitchManager(final ISwitchManager switchManager) {
+        this.switchManager = switchManager;
+    }
+
+    @Override
+    public DataObject readConfigurationData(final InstanceIdentifier<? extends DataObject> path) {
+        // Topology and Inventory are operational only
+        return null;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public DataObject readOperationalData(final InstanceIdentifier<? extends DataObject> path) {
+        final Class<? extends DataObject> type = path.getTargetType();
+        if (Nodes.class.equals(type)) {
+            return readNodes(((InstanceIdentifier<Nodes>) path));
+        }
+        if (Node.class.equals(type)) {
+            return readNode(((InstanceIdentifier<Node>) path));
+        }
+        if (NodeConnector.class.equals(type)) {
+            return readNodeConnector(((InstanceIdentifier<NodeConnector>) path));
+        }
+
+        LOG.debug("Unsupported type {}", type);
+        return null;
+    }
+
+    private NodeConnector readNodeConnector(final InstanceIdentifier<NodeConnector> identifier) {
+        return constructNodeConnector(InventoryMapping.toAdNodeConnector(identifier));
+    }
+
+    private Node readNode(final InstanceIdentifier<Node> identifier) {
+        return constructNode(InventoryMapping.toAdNode(identifier));
+    }
+
+    private Node constructNode(final org.opendaylight.controller.sal.core.Node node) {
+        final Set<org.opendaylight.controller.sal.core.NodeConnector> connectors = getSwitchManager().getNodeConnectors(node);
+        final ArrayList<NodeConnector> tpList = new ArrayList<NodeConnector>(connectors.size());
+        for (final org.opendaylight.controller.sal.core.NodeConnector connector : connectors) {
+            tpList.add(constructNodeConnector(connector));
+        }
+
+        return new NodeBuilder()
+        .setKey(InventoryMapping.toNodeKey(node))
+        .setNodeConnector(tpList)
+        .build();
+    }
+
+    private Nodes readNodes(final InstanceIdentifier<Nodes> identifier) {
+        final Set<org.opendaylight.controller.sal.core.Node> nodes = getSwitchManager().getNodes();
+        final ArrayList<Node> nodeList = new ArrayList<Node>(nodes.size());
+        for (final org.opendaylight.controller.sal.core.Node node : nodes) {
+            nodeList.add(constructNode(node));
+        }
+
+        return new NodesBuilder().setNode(nodeList).build();
+    }
+
+    private static NodeConnector constructNodeConnector(final org.opendaylight.controller.sal.core.NodeConnector connector) {
+        return new NodeConnectorBuilder().setKey(InventoryMapping.toNodeConnectorKey(connector)).build();
+    }
+}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.xtend b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.xtend
deleted file mode 100644 (file)
index 9b71369..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.compatibility.inventory
-
-import org.opendaylight.controller.switchmanager.ISwitchManager
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
-import org.opendaylight.yangtools.yang.binding.DataObject
-import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider
-import java.util.ArrayList
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector
-import static extension org.opendaylight.controller.sal.compatibility.InventoryMapping.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder
-
-class InventoryReader implements RuntimeDataProvider {
-
-    @Property
-    var ISwitchManager switchManager;
-
-    override readConfigurationData(InstanceIdentifier<? extends DataObject> path) {
-
-        // Topology and Inventory are operational only
-        return null;
-    }
-
-    override readOperationalData(InstanceIdentifier<? extends DataObject> path) {
-        val type = path.targetType;
-        var DataObject data = null;
-        switch (type) {
-            case Nodes:
-                data = readNodes(path as InstanceIdentifier<Nodes>)
-            case Node:
-                data = readNode(path as InstanceIdentifier<Node>)
-            case NodeConnector:
-                data = readNodeConnector(path as InstanceIdentifier<NodeConnector>)
-        }
-        return data;
-    }
-
-    def DataObject readNodeConnector(InstanceIdentifier<NodeConnector> identifier) {
-        val nodeConnector = identifier.toAdNodeConnector();
-        return constructNodeConnector(nodeConnector)
-    }
-
-    def DataObject readNode(InstanceIdentifier<Node> identifier) {
-        val node = identifier.toAdNode();
-        return constructNode(node);
-    }
-
-
-    def Node constructNode(org.opendaylight.controller.sal.core.Node node) {
-        val connectors = switchManager.getNodeConnectors(node)
-
-        val tpList = new ArrayList<NodeConnector>(connectors.size)
-        for (connector : connectors) {
-            tpList.add(constructNodeConnector(connector));
-        }
-
-        val it = new NodeBuilder()
-        key = node.toNodeKey();
-        nodeConnector = tpList
-        return build();
-    }
-
-    def NodeConnector constructNodeConnector(org.opendaylight.controller.sal.core.NodeConnector connector) {
-        val it = new NodeConnectorBuilder()
-        key = connector.toNodeConnectorKey()
-        return build();
-    }
-
-    def readNodes(InstanceIdentifier<Nodes> identifier) {
-        val nodes = switchManager.nodes
-        val nodeList = new ArrayList<Node>(nodes.size)
-        for (node : nodes) {
-            nodeList.add(constructNode(node))
-        }
-        val it = new NodesBuilder();
-        node = nodeList
-        return build()
-
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.java
new file mode 100644 (file)
index 0000000..82c5b7b
--- /dev/null
@@ -0,0 +1,347 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.md.compatibility.switchmanager;
+
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
+import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.compatibility.NodeMapping;
+import org.opendaylight.controller.sal.core.Bandwidth;
+import org.opendaylight.controller.sal.core.ConstructionException;
+import org.opendaylight.controller.sal.core.Description;
+import org.opendaylight.controller.sal.core.ForwardingMode;
+import org.opendaylight.controller.sal.core.MacAddress;
+import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.core.Property;
+import org.opendaylight.controller.sal.core.Tier;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.switchmanager.ISwitchManager;
+import org.opendaylight.controller.switchmanager.Subnet;
+import org.opendaylight.controller.switchmanager.Switch;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CompatibleSwitchManager extends ConfigurableSwitchManager implements ISwitchManager {
+    private static final  Logger LOG = LoggerFactory.getLogger(CompatibleSwitchManager.class);
+
+    private DataBrokerService _dataService;
+
+    public DataBrokerService getDataService() {
+        return this._dataService;
+    }
+
+    public void setDataService(final DataBrokerService dataService) {
+        this._dataService = dataService;
+    }
+
+    @Override
+    public Status addNodeConnectorProp(final NodeConnector nodeConnector, final Property prop) {
+        final DataModificationTransaction it = getDataService().beginTransaction();
+        final NodeConnectorRef path = NodeMapping.toNodeConnectorRef(nodeConnector);
+        return null;
+    }
+
+    @Override
+    public Property createProperty(final String propName, final String propValue) {
+        try {
+            if (propName.equalsIgnoreCase(Description.propertyName)) {
+                return new Description(propValue);
+            } else if (propName.equalsIgnoreCase(Tier.TierPropName)) {
+                return new Tier(Integer.parseInt(propValue));
+            } else if (propName.equalsIgnoreCase(Bandwidth.BandwidthPropName)) {
+                return new Bandwidth(Long.parseLong(propValue));
+            } else if (propName.equalsIgnoreCase(ForwardingMode.name)) {
+                return new ForwardingMode(Integer.parseInt(propValue));
+            } else if (propName.equalsIgnoreCase(MacAddress.name)) {
+                return new MacAddress(propValue);
+            } else {
+                LOG.debug("Not able to create {} property", propName);
+            }
+        } catch (Exception e) {
+            LOG.debug("createProperty caught exception {}", e.getMessage());
+        }
+
+        return null;
+    }
+
+    @Override
+    public boolean doesNodeConnectorExist(final NodeConnector nc) {
+        return (getDataService().readOperationalData(NodeMapping.toNodeConnectorRef(nc).getValue()) != null);
+    }
+
+    @Override
+    public byte[] getControllerMAC() {
+        final Enumeration<NetworkInterface> nis;
+        try {
+            nis = NetworkInterface.getNetworkInterfaces();
+        } catch (SocketException e) {
+            LOG.error("Failed to acquire list of interfaces, cannot determine controller MAC", e);
+            return null;
+        }
+
+        while (nis.hasMoreElements()) {
+            final NetworkInterface ni = nis.nextElement();
+            try {
+                return ni.getHardwareAddress();
+            } catch (SocketException e) {
+                LOG.error("Failed to acquire controller MAC from interface {}", ni, e);
+            }
+        }
+
+        // This happens when running controller on windows VM, for example
+        // Try parsing the OS command output
+        LOG.warn("Failed to acquire controller MAC: No physical interface found");
+        return null;
+    }
+
+    @Override
+    public Map<String,Property> getControllerProperties() {
+        return Collections.<String, Property>emptyMap();
+    }
+
+    @Override
+    public Property getControllerProperty(final String propertyName) {
+        return null;
+    }
+
+    @Override
+    public List<Switch> getNetworkDevices() {
+        final InstanceIdentifier<Nodes> path = InstanceIdentifier.builder(Nodes.class).toInstance();
+        final Nodes data = ((Nodes) getDataService().readOperationalData(path));
+        final ArrayList<Switch> ret = new ArrayList<>();
+        for (final Node node : data.getNode()) {
+            try {
+                ret.add(toSwitch(node));
+            } catch (ConstructionException e) {
+                throw new IllegalStateException(String.format("Failed to create switch {}", node), e);
+            }
+        }
+        return ret;
+    }
+
+    @Override
+    public NodeConnector getNodeConnector(final org.opendaylight.controller.sal.core.Node node, final String nodeConnectorName) {
+        final NodeConnectorKey key = new NodeConnectorKey(new NodeConnectorId(nodeConnectorName));
+        try {
+            return new NodeConnector(NodeMapping.MD_SAL_TYPE, key, node);
+        } catch (ConstructionException e) {
+            throw new IllegalStateException(String.format("Failed to create node connector for {} {}", node, nodeConnectorName), e);
+        }
+    }
+
+    @Override
+    public Property getNodeConnectorProp(final NodeConnector nodeConnector, final String propName) {
+        return getNodeConnectorProps(nodeConnector).get(propName);
+    }
+
+    @Override
+    public Map<String,Property> getNodeConnectorProps(final NodeConnector nodeConnector) {
+        final NodeConnectorRef ref = NodeMapping.toNodeConnectorRef(nodeConnector);
+        return toAdProperties(readNodeConnector(ref.getValue()));
+    }
+
+    @Override
+    public Set<NodeConnector> getNodeConnectors(final org.opendaylight.controller.sal.core.Node node) {
+        final Node data = this.readNode(NodeMapping.toNodeRef(node).getValue());
+        final HashSet<NodeConnector> ret = new HashSet<>();
+        for (final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector nc : data.getNodeConnector()) {
+            try {
+                ret.add(new NodeConnector(NodeMapping.MD_SAL_TYPE, nc.getKey(), node));
+            } catch (ConstructionException e) {
+                throw new IllegalStateException(String.format("Failed to create node {} connector", node, nc.getKey()), e);
+            }
+        }
+        return ret;
+    }
+
+    @Override
+    public String getNodeDescription(final org.opendaylight.controller.sal.core.Node node) {
+        return ((Description) getNodeProps(node).get(Description.propertyName)).getValue();
+    }
+
+    @Override
+    public byte[] getNodeMAC(final org.opendaylight.controller.sal.core.Node node) {
+        return ((MacAddress) getNodeProps(node).get(MacAddress.name)).getMacAddress();
+    }
+
+    @Override
+    public Property getNodeProp(final org.opendaylight.controller.sal.core.Node node, final String propName) {
+        return getNodeProps(node).get(propName);
+    }
+
+    @Override
+    public Map<String,Property> getNodeProps(final org.opendaylight.controller.sal.core.Node node) {
+        final NodeRef ref = NodeMapping.toNodeRef(node);
+        return toAdProperties(((Node) getDataService().readOperationalData(ref.getValue())));
+    }
+
+    @Override
+    public Set<org.opendaylight.controller.sal.core.Node> getNodes() {
+        final InstanceIdentifier<Nodes> path = InstanceIdentifier.builder(Nodes.class).toInstance();
+        final Nodes data = ((Nodes) getDataService().readOperationalData(path));
+        final HashSet<org.opendaylight.controller.sal.core.Node> ret = new HashSet<>();
+        for (final Node node : data.getNode()) {
+            try {
+                ret.add(new org.opendaylight.controller.sal.core.Node(NodeMapping.MD_SAL_TYPE, node.getKey()));
+            } catch (ConstructionException e) {
+                throw new IllegalStateException(String.format("Failed to create node for {}", node), e);
+            }
+        }
+        return ret;
+    }
+
+    private static Switch toSwitch(final Node node) throws ConstructionException {
+        return new Switch(new org.opendaylight.controller.sal.core.Node(NodeMapping.MD_SAL_TYPE, node.getKey()));
+    }
+
+    @Override
+    public Set<NodeConnector> getPhysicalNodeConnectors(final org.opendaylight.controller.sal.core.Node node) {
+        final NodeRef ref = NodeMapping.toNodeRef(node);
+        final Node data = readNode(ref.getValue());
+        final HashSet<NodeConnector> ret = new HashSet<>();
+        for (final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector nc : data.getNodeConnector()) {
+            final FlowCapableNodeConnector flowConnector = nc.getAugmentation(FlowCapableNodeConnector.class);
+            try {
+                ret.add(new NodeConnector(NodeMapping.MD_SAL_TYPE, nc.getKey(), node));
+            } catch (ConstructionException e) {
+                throw new IllegalStateException(String.format("Failed to create connector for {} on node {}", nc.getKey(), node), e);
+            }
+        }
+        return ret;
+    }
+
+    private static Map<String,Property> toAdProperties(final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector connector) {
+        return Collections.emptyMap();
+    }
+
+    private static Map<String,Property> toAdProperties(final Node connector) {
+        return Collections.emptyMap();
+    }
+
+    private Node readNode(final InstanceIdentifier<? extends Object> ref) {
+        return (Node) getDataService().readOperationalData((ref));
+    }
+
+    private org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector readNodeConnector(final InstanceIdentifier<? extends Object> ref) {
+        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) getDataService().readOperationalData(ref));
+    }
+
+    @Override
+    public List<NodeConnector> getSpanPorts(final org.opendaylight.controller.sal.core.Node node) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public Subnet getSubnetByNetworkAddress(final InetAddress networkAddress) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public Set<NodeConnector> getUpNodeConnectors(final org.opendaylight.controller.sal.core.Node node) {
+        final Node data = readNode(NodeMapping.toNodeRef(node).getValue());
+        final HashSet<NodeConnector> ret = new HashSet<>();
+        for (final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector nc : data.getNodeConnector()) {
+            final FlowCapableNodeConnector flowConn = nc.<FlowCapableNodeConnector>getAugmentation(FlowCapableNodeConnector.class);
+            if (flowConn != null && flowConn.getState() != null && !flowConn.getState().isLinkDown()) {
+                try {
+                    ret.add(new NodeConnector(NodeMapping.MD_SAL_TYPE, nc.getKey(), node));
+                } catch (ConstructionException e) {
+                    throw new IllegalStateException(String.format("Failed to create node connector for node {} connector {}", node, nc), e);
+                }
+            }
+        }
+        return ret;
+    }
+
+    @Override
+    public Boolean isNodeConnectorEnabled(final NodeConnector nodeConnector) {
+        final NodeConnectorRef ref = NodeMapping.toNodeConnectorRef(nodeConnector);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector data = readNodeConnector(ref.getValue());
+        return true;
+    }
+
+    @Override
+    public boolean isSpecial(final NodeConnector p) {
+        final NodeConnectorRef ref = NodeMapping.toNodeConnectorRef(p);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector data = readNodeConnector(ref.getValue());
+        return true;
+    }
+
+    @Override
+    public Status removeControllerProperty(final String propertyName) {
+        return null;
+    }
+
+    @Override
+    public Status removeNodeAllProps(final org.opendaylight.controller.sal.core.Node node) {
+        return null;
+    }
+
+    @Override
+    public Status removeNodeConnectorAllProps(final NodeConnector nodeConnector) {
+        return null;
+    }
+
+    @Override
+    public Status removeNodeConnectorProp(final NodeConnector nc, final String propName) {
+        return null;
+    }
+
+    @Override
+    public Status removeNodeProp(final org.opendaylight.controller.sal.core.Node node, final String propName) {
+        return null;
+    }
+
+    @Override
+    public Status removePortsFromSubnet(final String name, final List<String> nodeConnectors) {
+        return null;
+    }
+
+    @Override
+    public Status removeSubnet(final String name) {
+        return null;
+    }
+
+    @Override
+    public Status setControllerProperty(final Property property) {
+        return null;
+    }
+
+    @Override
+    public void setNodeProp(final org.opendaylight.controller.sal.core.Node node, final Property prop) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public Status addPortsToSubnet(final String name, final List<String> nodeConnectors) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public Set<Switch> getConfiguredNotConnectedSwitches() {
+        return null;
+    }
+}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.xtend b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.xtend
deleted file mode 100644 (file)
index 20d375f..0000000
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.compatibility.switchmanager
-
-import java.net.InetAddress
-import java.net.NetworkInterface
-import java.net.SocketException
-import java.util.ArrayList
-import java.util.Collections
-import java.util.HashSet
-import java.util.List
-import java.util.Map
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService
-import org.opendaylight.controller.sal.core.Bandwidth
-import org.opendaylight.controller.sal.core.Description
-import org.opendaylight.controller.sal.core.ForwardingMode
-import org.opendaylight.controller.sal.core.MacAddress
-import org.opendaylight.controller.sal.core.Node
-import org.opendaylight.controller.sal.core.NodeConnector
-import org.opendaylight.controller.sal.core.Property
-import org.opendaylight.controller.sal.core.Tier
-import org.opendaylight.controller.switchmanager.ISwitchManager
-import org.opendaylight.controller.switchmanager.Switch
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey
-import org.opendaylight.yangtools.yang.binding.DataObject
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
-import org.slf4j.LoggerFactory
-
-import static extension org.opendaylight.controller.sal.compatibility.NodeMapping.*
-
-class CompatibleSwitchManager extends ConfigurableSwitchManager implements ISwitchManager {
-
-    private static val log = LoggerFactory.getLogger(CompatibleSwitchManager)
-
-    @org.eclipse.xtend.lib.Property
-    var DataBrokerService dataService;
-
-    override addNodeConnectorProp(NodeConnector nodeConnector, Property prop) {
-        val it = dataService.beginTransaction
-        val path = nodeConnector.toNodeConnectorRef
-
-        // TODO: Update FlowCapableNode
-        return null;
-    }
-
-    override createProperty(String propName, String propValue) {
-        try {
-            if (propName.equalsIgnoreCase(Description.propertyName)) {
-                return new Description(propValue);
-            } else if (propName.equalsIgnoreCase(Tier.TierPropName)) {
-                val tier = Integer.parseInt(propValue);
-                return new Tier(tier);
-            } else if (propName.equalsIgnoreCase(Bandwidth.BandwidthPropName)) {
-                val bw = Long.parseLong(propValue);
-                return new Bandwidth(bw);
-            } else if (propName.equalsIgnoreCase(ForwardingMode.name)) {
-                val mode = Integer.parseInt(propValue);
-                return new ForwardingMode(mode);
-            } else if (propName.equalsIgnoreCase(MacAddress.name)) {
-                return new MacAddress(propValue);
-            } else {
-                log.debug("Not able to create {} property", propName);
-            }
-        } catch (Exception e) {
-            log.debug("createProperty caught exception {}", e.getMessage());
-        }
-        return null;
-    }
-
-    override doesNodeConnectorExist(NodeConnector nc) {
-        val ref = nc.toNodeConnectorRef
-        return dataService.readOperationalData(ref.value as InstanceIdentifier<? extends DataObject>) !== null
-    }
-
-    override getControllerMAC() {
-        var byte[] macAddress = null;
-
-        try {
-            val nis = NetworkInterface.getNetworkInterfaces();
-            while (nis.hasMoreElements()) {
-                val ni = nis.nextElement();
-                try {
-                    macAddress = ni.getHardwareAddress();
-                    return macAddress;
-                } catch (SocketException e) {
-                    log.error("Failed to acquire controller MAC: ", e);
-                }
-            }
-        } catch (SocketException e) {
-            log.error("Failed to acquire controller MAC: ", e);
-            return macAddress;
-        }
-
-        if (macAddress == null) {
-            log.warn("Failed to acquire controller MAC: No physical interface found");
-
-            // This happens when running controller on windows VM, for example
-            // Try parsing the OS command output
-            }
-            return macAddress;
-        }
-
-    override getControllerProperties() {
-        return Collections.emptyMap()
-    }
-
-    override getControllerProperty(String propertyName) {
-        return null;
-    }
-
-    override getNetworkDevices() {
-        val path = InstanceIdentifier.builder(Nodes).toInstance;
-        val data = dataService.readOperationalData(path) as Nodes;
-        val ret = new ArrayList<Switch>();
-        for (node : data.node) {
-            ret.add(node.toSwitch());
-        }
-        return ret;
-    }
-
-    override getNodeConnector(Node node, String nodeConnectorName) {
-        val key = new NodeConnectorKey(new NodeConnectorId(nodeConnectorName));
-        return new NodeConnector(MD_SAL_TYPE, key, node);
-    }
-
-    override getNodeConnectorProp(NodeConnector nodeConnector, String propName) {
-        getNodeConnectorProps(nodeConnector).get(propName);
-    }
-
-    override getNodeConnectorProps(NodeConnector nodeConnector) {
-        val ref = nodeConnector.toNodeConnectorRef
-        val data = readNodeConnector(ref.value);
-        return data.toAdProperties();
-    }
-
-    override getNodeConnectors(Node node) {
-        val ref = node.toNodeRef;
-        val data = readNode(ref.value);
-        val ret = new HashSet();
-        for (nc : data.nodeConnector) {
-
-            val adConnector = new NodeConnector(MD_SAL_TYPE, nc.key, node);
-            ret.add(adConnector);
-        }
-        return ret;
-    }
-
-    override getNodeDescription(Node node) {
-        (getNodeProps(node).get(Description.propertyName) as Description).value;
-    }
-
-    override getNodeMAC(Node node) {
-        (getNodeProps(node).get(MacAddress.name) as MacAddress).macAddress;
-    }
-
-    override getNodeProp(Node node, String propName) {
-        getNodeProps(node).get(propName)
-    }
-
-    override getNodeProps(Node node) {
-        val ref = node.toNodeRef;
-        val data = dataService.readOperationalData(ref.value as InstanceIdentifier<? extends DataObject>) as org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-        return data.toAdProperties();
-    }
-
-    override getNodes() {
-        val path = InstanceIdentifier.builder(Nodes).toInstance;
-        val data = dataService.readOperationalData(path) as Nodes;
-        val ret = new HashSet<Node>();
-        for (node : data.node) {
-            ret.add(new Node(MD_SAL_TYPE, node.key));
-        }
-        return ret;
-    }
-
-    def Switch toSwitch(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node node) {
-        val adNode = new Node(MD_SAL_TYPE, node.key);
-        val sw = new Switch(adNode)
-        return sw;
-    }
-
-    override getPhysicalNodeConnectors(Node node) {
-        val ref = node.toNodeRef;
-        val data = readNode(ref.value);
-        val ret = new HashSet();
-        for (nc : data.nodeConnector) {
-            val flowConnector = nc.getAugmentation(FlowCapableNodeConnector)
-            val adConnector = new NodeConnector(MD_SAL_TYPE, nc.key, node);
-            ret.add(adConnector);
-        }
-        return ret;
-    }
-
-    def Map<String, Property> toAdProperties(
-        org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector connector) {
-        return Collections.emptyMap
-    }
-
-    def Map<String, Property> toAdProperties(
-        org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node connector) {
-        return Collections.emptyMap
-    }
-
-    def readNode(InstanceIdentifier<?> ref) {
-        dataService.readOperationalData(ref as InstanceIdentifier<? extends DataObject>) as org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node
-    }
-
-    def readNodeConnector(InstanceIdentifier<?> ref) {
-        dataService.readOperationalData(ref as InstanceIdentifier<? extends DataObject>) as org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector
-    }
-
-    override getSpanPorts(Node node) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    override getSubnetByNetworkAddress(InetAddress networkAddress) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    override getUpNodeConnectors(Node node) {
-        val ref = node.toNodeRef
-        val data = readNode(ref.value);
-        val ret = new HashSet<NodeConnector>();
-        for (nc : data.nodeConnector) {
-            val flowConn = nc.getAugmentation(FlowCapableNodeConnector);
-            if (flowConn != null && flowConn.state != null && !flowConn.state.linkDown) {
-                ret.add(new NodeConnector(MD_SAL_TYPE, nc.key, node));
-            }
-        }
-        return ret;
-    }
-
-    override isNodeConnectorEnabled(NodeConnector nodeConnector) {
-        val ref = nodeConnector.toNodeConnectorRef
-        val data = readNodeConnector(ref.value);
-
-        return true;
-    }
-
-    override isSpecial(NodeConnector p) {
-        val ref = p.toNodeConnectorRef
-        val data = readNodeConnector(ref.value);
-
-        return true;
-    }
-
-    override removeControllerProperty(String propertyName) {
-        // NOOP
-    }
-
-    override removeNodeAllProps(Node node) {
-        // NOOP: not supported node has more properties than AD-SAL is capable to see
-    }
-
-    override removeNodeConnectorAllProps(NodeConnector nodeConnector) {
-        // NOOP: not supported node has more properties than AD-SAL is capable to see
-    }
-
-    override removeNodeConnectorProp(NodeConnector nc, String propName) {
-        // NOOP: not supported node has more properties than AD-SAL is capable to see
-    }
-
-    override removeNodeProp(Node node, String propName) {
-        // NOOP: not supported node has more properties than AD-SAL is capable to see
-    }
-
-    override removePortsFromSubnet(String name, List<String> nodeConnectors) {
-        // NOOP
-    }
-
-    override removeSubnet(String name) {
-        // NOOP
-    }
-
-    override setControllerProperty(Property property) {
-        // NOOP
-    }
-
-    override setNodeProp(Node node, Property prop) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    override addPortsToSubnet(String name, List<String> nodeConnectors) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    override getConfiguredNotConnectedSwitches() {
-        return null;
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.java
new file mode 100644 (file)
index 0000000..63f682a
--- /dev/null
@@ -0,0 +1,86 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.md.compatibility.switchmanager;
+
+import java.util.List;
+
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.switchmanager.ISwitchManager;
+import org.opendaylight.controller.switchmanager.SpanConfig;
+import org.opendaylight.controller.switchmanager.SubnetConfig;
+import org.opendaylight.controller.switchmanager.SwitchConfig;
+
+/**
+ * These methods should be backed by config subsystem.
+ */
+public abstract class ConfigurableSwitchManager implements ISwitchManager {
+    @Override
+    public Status saveSwitchConfig() {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public Status removeSpanConfig(final SpanConfig cfgObject) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public Status addSubnet(final SubnetConfig configObject) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public final Status addSpanConfig(final SpanConfig configObject) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public final List<SpanConfig> getSpanConfigList() {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public final void updateSwitchConfig(final SwitchConfig cfgObject) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public final Status updateNodeConfig(final SwitchConfig switchConfig) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public final SubnetConfig getSubnetConfig(final String subnet) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public final Status removeNodeConfig(final String nodeId) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public final Status removeSubnet(final SubnetConfig configObject) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public final List<SubnetConfig> getSubnetsConfigList() {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public final SwitchConfig getSwitchConfig(final String nodeId) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public Status modifySubnet(final SubnetConfig configObject) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.xtend b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.xtend
deleted file mode 100644 (file)
index faa4b8d..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.compatibility.switchmanager
-
-import org.opendaylight.controller.switchmanager.ISwitchManager
-import org.opendaylight.controller.switchmanager.SpanConfig
-import org.opendaylight.controller.switchmanager.SwitchConfig
-import org.opendaylight.controller.switchmanager.SubnetConfig
-
-/**
- * 
- * THis methods should be backed by config subsystem.
- * 
- */
-abstract class ConfigurableSwitchManager implements ISwitchManager {
-
-    override saveSwitchConfig() {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    override removeSpanConfig(SpanConfig cfgObject) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    override addSubnet(SubnetConfig configObject) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-
-    }
-
-    final override addSpanConfig(SpanConfig configObject) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-
-    }
-
-    final override getSpanConfigList() {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-
-    }
-
-    final override updateSwitchConfig(SwitchConfig cfgObject) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-
-    }
-
-    final override updateNodeConfig(SwitchConfig switchConfig) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-
-    }
-
-    final override getSubnetConfig(String subnet) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    final override removeNodeConfig(String nodeId) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    final override removeSubnet(SubnetConfig configObject) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    final override getSubnetsConfigList() {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    final override getSwitchConfig(String nodeId) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    override modifySubnet(SubnetConfig configObject) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.java
new file mode 100644 (file)
index 0000000..8e50bd8
--- /dev/null
@@ -0,0 +1,82 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.md.compatibility.topology;
+
+import java.util.Iterator;
+
+import org.opendaylight.controller.sal.compatibility.InventoryMapping;
+import org.opendaylight.controller.sal.core.ConstructionException;
+import org.opendaylight.controller.sal.core.Edge;
+import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.LinkId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.LinkKey;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+
+import com.google.common.base.Splitter;
+
+public class TopologyMapping {
+    private static final String HEAD_TAIL_STRING = "::::";
+    private static final Splitter HEAD_TAIL_SPLITTER = Splitter.on(HEAD_TAIL_STRING);
+
+    public TopologyMapping(final TopologyKey path, final InstanceIdentifier<Topology> key) {
+        // No-op for now. Multi-instance will require fixing InventoryMapping first.
+    }
+
+    public Edge toAdTopologyEdge(final InstanceIdentifier<Link> identifier) throws ConstructionException {
+        @SuppressWarnings("unchecked")
+        final LinkKey linkKey = ((KeyedInstanceIdentifier<Link, LinkKey>)identifier).getKey();
+
+        final Iterator<String> it = HEAD_TAIL_SPLITTER.split(linkKey.getLinkId().getValue()).iterator();
+        final NodeConnector tail = InventoryMapping.nodeConnectorFromId(it.next());
+        final NodeConnector head = InventoryMapping.nodeConnectorFromId(it.next());
+        return new Edge(tail, head);
+    }
+
+    public NodeConnector toAdTopologyNodeConnector(final InstanceIdentifier<TerminationPoint> identifier) {
+        @SuppressWarnings("unchecked")
+        final TerminationPointKey tpKey = ((KeyedInstanceIdentifier<TerminationPoint, TerminationPointKey>)identifier).getKey();
+
+        return InventoryMapping.nodeConnectorFromId(tpKey.getTpId().getValue());
+    }
+
+    public org.opendaylight.controller.sal.core.Node toAdTopologyNode(final InstanceIdentifier<Node> identifier) {
+        @SuppressWarnings("unchecked")
+        final NodeKey nodeKey = ((KeyedInstanceIdentifier<Node, NodeKey>)identifier).getKey();
+
+        return InventoryMapping.nodeFromNodeId(nodeKey.getNodeId().getValue());
+    }
+
+    public NodeKey toTopologyNodeKey(final org.opendaylight.controller.sal.core.Node node) {
+        return new NodeKey(new NodeId(InventoryMapping.toNodeId(node)));
+    }
+
+    public TerminationPointKey toTopologyTerminationPointKey(final NodeConnector nc) {
+        return new TerminationPointKey(new TpId(InventoryMapping.toNodeConnectorId(nc)));
+    }
+
+    public LinkKey toTopologyLinkKey(final Edge edge) {
+        final TerminationPointKey sourceTp = toTopologyTerminationPointKey(edge.getTailNodeConnector());
+        final TerminationPointKey destTp = toTopologyTerminationPointKey(edge.getHeadNodeConnector());
+
+        final StringBuilder sb = new StringBuilder();
+        sb.append(sourceTp.getTpId().toString());
+        sb.append(HEAD_TAIL_STRING);
+        sb.append(destTp.getTpId().toString());
+        return new LinkKey(new LinkId(sb.toString()));
+    }
+}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.xtend b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.xtend
deleted file mode 100644 (file)
index 0889de1..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.compatibility.topology
-
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
-import org.opendaylight.yangtools.yang.binding.DataObject
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology
-import org.opendaylight.controller.sal.core.Edge
-import java.util.Set
-import org.opendaylight.controller.sal.core.Property
-import org.opendaylight.controller.sal.core.NodeConnector
-
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.LinkKey
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.LinkId
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.IdentifiableItem
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node
-import org.opendaylight.controller.sal.compatibility.InventoryMapping
-class TopologyMapping {
-
-    new(TopologyKey path, InstanceIdentifier<Topology> key) {
-        // NOOP
-    }
-
-    def Edge toAdTopologyEdge(InstanceIdentifier<Link> identifier) {
-        val linkKey = (identifier.path.last as IdentifiableItem<Link,LinkKey>).key;
-        val components = linkKey.linkId.value.split("::::");
-        val tail = InventoryMapping.nodeConnectorFromId(components.get(0));
-        val head = InventoryMapping.nodeConnectorFromId(components.get(1));
-        return new Edge(tail, head);
-    }
-
-    def NodeConnector toAdTopologyNodeConnector(InstanceIdentifier<TerminationPoint> identifier) {
-        val tpKey = (identifier.path.last as IdentifiableItem<TerminationPoint,TerminationPointKey>).key;
-        return InventoryMapping.nodeConnectorFromId(tpKey.tpId.value);
-    }
-
-    def org.opendaylight.controller.sal.core.Node toAdTopologyNode(
-        InstanceIdentifier<Node> identifier) {
-        val tpKey = (identifier.path.last as IdentifiableItem<Node,NodeKey>).key;
-        return InventoryMapping.nodeFromNodeId(tpKey.nodeId.value);
-    }
-    
-
-
-    def NodeKey toTopologyNodeKey(org.opendaylight.controller.sal.core.Node node) {
-        val nodeId = new NodeId(InventoryMapping.toNodeId(node));
-        return new NodeKey(nodeId);
-    }
-
-    def TerminationPointKey toTopologyTerminationPointKey(NodeConnector nc) {
-        val node = nc.node;
-        val nodeId = new TpId(InventoryMapping.toNodeConnectorId(nc))
-        return new TerminationPointKey(nodeId);
-    }
-
-    def LinkKey toTopologyLinkKey(Edge edge) {
-        val sourceTp = edge.tailNodeConnector.toTopologyTerminationPointKey;
-        val destTp = edge.headNodeConnector.toTopologyTerminationPointKey;
-        val linkId = new LinkId('''«sourceTp.tpId»::::«destTp.tpId»''')
-        return new LinkKey(linkId);
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.java
new file mode 100644 (file)
index 0000000..a4ac6f9
--- /dev/null
@@ -0,0 +1,199 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.md.compatibility.topology;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider;
+import org.opendaylight.controller.sal.core.ConstructionException;
+import org.opendaylight.controller.sal.core.Edge;
+import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.core.Property;
+import org.opendaylight.controller.switchmanager.ISwitchManager;
+import org.opendaylight.controller.topologymanager.ITopologyManager;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.DestinationBuilder;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.SourceBuilder;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.LinkBuilder;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TopologyReader implements RuntimeDataProvider {
+    private static final Logger LOG = LoggerFactory.getLogger(TopologyReader.class);
+    private final InstanceIdentifier<Topology> topologyPath;
+    private final TopologyKey topologyKey;
+    private final TopologyMapping mapping;
+    private ITopologyManager topologyManager;
+    private ISwitchManager switchManager;
+
+    public ISwitchManager getSwitchManager() {
+        return this.switchManager;
+    }
+
+    public void setSwitchManager(final ISwitchManager switchManager) {
+        this.switchManager = switchManager;
+    }
+
+    public ITopologyManager getTopologyManager() {
+        return this.topologyManager;
+    }
+
+    public void setTopologyManager(final ITopologyManager topologyManager) {
+        this.topologyManager = topologyManager;
+    }
+
+    public TopologyKey getTopologyKey() {
+        return this.topologyKey;
+    }
+
+    public TopologyMapping getMapping() {
+        return this.mapping;
+    }
+
+    public TopologyReader() {
+        this.topologyKey = new TopologyKey(new TopologyId("compatibility:ad-sal"));
+        this.topologyPath = InstanceIdentifier.builder(NetworkTopology.class)
+                .child(Topology.class, topologyKey)
+                .toInstance();
+        this.mapping = new TopologyMapping(topologyKey, topologyPath);
+    }
+
+    @Override
+    public DataObject readConfigurationData(final InstanceIdentifier<? extends DataObject> path) {
+        // Topology and Inventory are operational only
+        return null;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public DataObject readOperationalData(final InstanceIdentifier<? extends DataObject> path) {
+        if (!topologyPath.contains(path)) {
+            return null;
+        }
+
+        final Class<? extends DataObject> type = path.getTargetType();
+        if (Link.class.equals(type)) {
+            return readLink((InstanceIdentifier<Link>) path);
+        }
+        if (Node.class.equals(type)) {
+            return readNode((InstanceIdentifier<Node>) path);
+        }
+        if (TerminationPoint.class.equals(type)) {
+            return readTerminationPoint((InstanceIdentifier<TerminationPoint>) path);
+
+        }
+        if (Topology.class.equals(type)) {
+            return readTopology((InstanceIdentifier<Topology>) path);
+        }
+
+        LOG.debug("Unsupported type {}", type);
+        return null;
+    }
+
+    private Link readLink(final InstanceIdentifier<Link> identifier) {
+        final Edge edge;
+        try {
+            edge = this.mapping.toAdTopologyEdge(identifier);
+        } catch (ConstructionException e) {
+            throw new IllegalStateException(String.format("Failed to construct edge for link %s", identifier), e);
+        }
+
+        final Map<Edge,Set<Property>> edges;
+        if (topologyManager != null) {
+            edges = topologyManager.getEdges();
+        } else {
+            edges = null;
+        }
+
+        final Set<Property> properties;
+        if (edges != null) {
+            properties = edges.get(edge);
+        } else {
+            properties = null;
+        }
+
+        return constructLink(edge);
+    }
+
+    private TerminationPoint readTerminationPoint(final InstanceIdentifier<TerminationPoint> identifier) {
+        return constructTerminationPoint(mapping.toAdTopologyNodeConnector(identifier));
+    }
+
+    private Node readNode(final InstanceIdentifier<Node> identifier) {
+        return constructNode(mapping.toAdTopologyNode(identifier));
+    }
+
+    private Topology readTopology(final InstanceIdentifier<Topology> identifier) {
+        final Set<org.opendaylight.controller.sal.core.Node> nodes = getSwitchManager().getNodes();
+        final ArrayList<Node> nodeList = new ArrayList<Node>(nodes.size());
+        for (final org.opendaylight.controller.sal.core.Node node : nodes) {
+            nodeList.add(constructNode(node));
+        }
+
+        final Map<Edge,Set<Property>> edges = getTopologyManager().getEdges();
+        final ArrayList<Link> linkList = new ArrayList<Link>(edges.size());
+        for (final Edge edge : edges.keySet()) {
+            linkList.add(constructLink(edge));
+        }
+
+        return new TopologyBuilder()
+        .setKey(topologyKey)
+        .setNode(nodeList)
+        .setLink(linkList)
+        .build();
+    }
+
+    private Link constructLink(final Edge edge) {
+        final NodeConnector sourceNc = edge.getTailNodeConnector();
+        final NodeConnector destNc = edge.getHeadNodeConnector();
+
+        final LinkBuilder it = new LinkBuilder().setKey(mapping.toTopologyLinkKey(edge));
+
+        it.setSource(new SourceBuilder()
+        .setSourceNode(mapping.toTopologyNodeKey(sourceNc.getNode()).getNodeId())
+        .setSourceTp(mapping.toTopologyTerminationPointKey(sourceNc).getTpId())
+        .build());
+
+        it.setDestination(new DestinationBuilder()
+        .setDestNode(mapping.toTopologyNodeKey(destNc.getNode()).getNodeId())
+        .setDestTp(mapping.toTopologyTerminationPointKey(destNc).getTpId())
+        .build());
+
+        return it.build();
+    }
+
+    private Node constructNode(final org.opendaylight.controller.sal.core.Node node) {
+        final Set<NodeConnector> connectors = getSwitchManager().getNodeConnectors(node);
+        final ArrayList<TerminationPoint> tpList = new ArrayList<TerminationPoint>(connectors.size());
+        for (final NodeConnector connector : connectors) {
+            tpList.add(constructTerminationPoint(connector));
+        }
+
+        return new NodeBuilder()
+        .setKey(mapping.toTopologyNodeKey(node))
+        .setTerminationPoint(tpList)
+        .build();
+    }
+
+    private TerminationPoint constructTerminationPoint(final NodeConnector connector) {
+        return new TerminationPointBuilder().setKey(mapping.toTopologyTerminationPointKey(connector)).build();
+    }
+}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.xtend b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.xtend
deleted file mode 100644 (file)
index 6ebe20b..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.compatibility.topology
-
-import java.util.ArrayList
-import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider
-import org.opendaylight.controller.sal.core.Edge
-import org.opendaylight.controller.sal.core.NodeConnector
-import org.opendaylight.controller.switchmanager.ISwitchManager
-import org.opendaylight.controller.topologymanager.ITopologyManager
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.DestinationBuilder
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.SourceBuilder
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.LinkBuilder
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder
-import org.opendaylight.yangtools.yang.binding.DataObject
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
-
-class TopologyReader implements RuntimeDataProvider {
-
-    @Property
-    var ISwitchManager switchManager;
-
-    @Property
-    var ITopologyManager topologyManager;
-
-    @Property
-    val TopologyKey topologyKey;
-
-    @Property
-    val InstanceIdentifier<Topology> topologyPath;
-
-    @Property
-    val extension TopologyMapping mapping;
-
-    new() {
-        _topologyKey = new TopologyKey(new TopologyId("compatibility:ad-sal"));
-        _topologyPath = InstanceIdentifier.builder(NetworkTopology).child(Topology, topologyKey).toInstance;
-        _mapping = new TopologyMapping(topologyKey, topologyPath);
-    }
-
-    override readConfigurationData(InstanceIdentifier<? extends DataObject> path) {
-
-        // Topology and Inventory are operational only
-        return null;
-    }
-
-    override readOperationalData(InstanceIdentifier<? extends DataObject> path) {
-        val type = path.targetType;
-        var DataObject data = null;
-        if (false == topologyPath.contains(path)) {
-            return null;
-        }
-        switch (type) {
-            case Topology:
-                data = readTopology(path as InstanceIdentifier<Topology>)
-            case Node:
-                data = readNode(path as InstanceIdentifier<Node>)
-            case TerminationPoint:
-                data = readTerminationPoint(path as InstanceIdentifier<TerminationPoint>)
-            case Link:
-                data = readLink(path as InstanceIdentifier<Link>)
-        }
-        return data;
-    }
-
-    def DataObject readLink(InstanceIdentifier<Link> identifier) {
-        val edge = identifier.toAdTopologyEdge();
-        val properties = topologyManager?.edges?.get(edge);
-
-        return constructLink(edge);
-    }
-
-    def DataObject readTerminationPoint(InstanceIdentifier<TerminationPoint> identifier) {
-        val nodeConnector = identifier.toAdTopologyNodeConnector();
-        return constructTerminationPoint(nodeConnector)
-    }
-
-    def DataObject readNode(InstanceIdentifier<Node> identifier) {
-        val node = identifier.toAdTopologyNode();
-        return constructNode(node);
-    }
-
-    def DataObject readTopology(InstanceIdentifier<Topology> identifier) {
-
-        //val nodeConnectors = switchManager.
-        val nodes = switchManager.nodes
-        val edges = topologyManager.edges
-
-        val nodeList = new ArrayList<Node>(nodes.size)
-        for (node : nodes) {
-            nodeList.add(constructNode(node))
-        }
-
-        val linkList = new ArrayList<Link>(edges.size)
-        for (edge : edges.keySet) {
-            linkList.add(constructLink(edge))
-        }
-
-        val it = new TopologyBuilder();
-        key = topologyKey
-        node = nodeList
-        link = linkList
-        return build()
-    }
-
-    def constructLink(Edge edge) {
-        val sourceNc = edge.tailNodeConnector
-        val destNc = edge.headNodeConnector
-
-        val it = new LinkBuilder()
-        key = edge.toTopologyLinkKey();
-        source = new SourceBuilder().setSourceNode(sourceNc.node.toTopologyNodeKey.nodeId).setSourceTp(
-            sourceNc.toTopologyTerminationPointKey.tpId).build()
-        destination = new DestinationBuilder().setDestNode(destNc.node.toTopologyNodeKey.nodeId).setDestTp(
-            destNc.toTopologyTerminationPointKey.tpId).build
-        return build()
-    }
-
-    def Node constructNode(org.opendaylight.controller.sal.core.Node node) {
-        val connectors = switchManager.getNodeConnectors(node)
-
-        val tpList = new ArrayList<TerminationPoint>(connectors.size)
-        for (connector : connectors) {
-            tpList.add(constructTerminationPoint(connector));
-        }
-
-        val it = new NodeBuilder()
-        key = node.toTopologyNodeKey();
-        terminationPoint = tpList
-        return build();
-    }
-
-    def TerminationPoint constructTerminationPoint(NodeConnector connector) {
-        val it = new TerminationPointBuilder()
-        key = connector.toTopologyTerminationPointKey
-        return build();
-    }
-
-}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.java
new file mode 100644 (file)
index 0000000..a7a7a9a
--- /dev/null
@@ -0,0 +1,109 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.md.compatibility.topologymanager;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.controller.sal.compatibility.NodeMapping;
+import org.opendaylight.controller.sal.core.ConstructionException;
+import org.opendaylight.controller.sal.core.Edge;
+import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.core.Property;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.Destination;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.Source;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class AdSalTopologyMapping {
+    private final InstanceIdentifier<Topology> topologyPath;
+
+    public AdSalTopologyMapping(final TopologyKey topology) {
+        this.topologyPath = InstanceIdentifier.builder(NetworkTopology.class)
+                .child(Topology.class, topology).toInstance();
+    }
+
+    public InstanceIdentifier<Topology> getTopologyPath() {
+        return topologyPath;
+    }
+
+    public InstanceIdentifier<TerminationPoint> toTerminationPoint(final NodeConnector connector) {
+        return getTopologyPath().builder()
+                .child(Node.class)
+                .child(TerminationPoint.class, toTerminationPointKey(connector))
+                .toInstance();
+    }
+
+    public Map<Edge,Set<Property>> toEdgePropertiesMap(final Iterable<Link> links) {
+        final HashMap<Edge,Set<Property>> ret = new HashMap<>();
+        for (final Link link : links) {
+            try {
+                ret.put(toEdge(link), toProperties(link));
+            } catch (ConstructionException e) {
+                throw new IllegalStateException(String.format("Failed to create edge properties for {}", link), e);
+            }
+        }
+        return ret;
+    }
+
+    public static Set<Edge> toEdges(final Iterable<Link> links) throws ConstructionException {
+        final HashSet<Edge> ret = new HashSet<Edge>();
+        for (final Link link : links) {
+            ret.add(toEdge(link));
+        }
+        return ret;
+    }
+
+    public static Edge toEdge(final Link link) throws ConstructionException {
+        final NodeConnector tail = toNodeConnector(link.getSource());
+        final NodeConnector head = toNodeConnector(link.getDestination());
+        return new Edge(tail, head);
+    }
+
+    public static org.opendaylight.controller.sal.core.Node toAdNode(final Node node) throws ConstructionException {
+        return toAdNode(node.getNodeId());
+    }
+
+    public static org.opendaylight.controller.sal.core.Node toAdNode(final NodeId node) throws ConstructionException {
+        final NodeKey key = new NodeKey(
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId(node));
+        return new org.opendaylight.controller.sal.core.Node(NodeMapping.MD_SAL_TYPE, key);
+    }
+
+    public static NodeConnector toNodeConnector(final Source ref) throws ConstructionException {
+        final org.opendaylight.controller.sal.core.Node adNode = toAdNode(ref.getSourceNode());
+        final NodeConnectorKey key = new NodeConnectorKey(new NodeConnectorId(ref.getSourceTp()));
+        return new NodeConnector(NodeMapping.MD_SAL_TYPE, key, adNode);
+    }
+
+    public static NodeConnector toNodeConnector(final Destination ref) throws ConstructionException {
+        final org.opendaylight.controller.sal.core.Node adNode = toAdNode(ref.getDestNode());
+        final NodeConnectorKey key = new NodeConnectorKey(new NodeConnectorId(ref.getDestTp()));
+        return new NodeConnector(NodeMapping.MD_SAL_TYPE, key, adNode);
+    }
+
+    public TerminationPointKey toTerminationPointKey(final NodeConnector connector) {
+        return null;
+    }
+
+    public Set<Property> toProperties(final Link link) {
+        return null;
+    }
+}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.xtend b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.xtend
deleted file mode 100644 (file)
index aa238a8..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.compatibility.topologymanager
-
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint
-import org.opendaylight.controller.sal.core.NodeConnector
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology
-import java.util.Map
-import org.opendaylight.controller.sal.core.Edge
-import java.util.Set
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node
-import java.util.HashSet
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId
-import org.opendaylight.controller.sal.compatibility.NodeMapping
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.Source
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.Destination
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey
-import java.util.HashMap
-
-class AdSalTopologyMapping {
-
-    val TopologyKey topologyMapping;
-    @Property
-    val InstanceIdentifier<Topology> topologyPath;
-
-    new(TopologyKey topology) {
-        topologyMapping = topology;
-        _topologyPath = InstanceIdentifier.builder(NetworkTopology).child(Topology, topology).toInstance;
-    }
-
-    def InstanceIdentifier<TerminationPoint> toTerminationPoint(NodeConnector connector) {
-        InstanceIdentifier.builder(topologyPath).child(Node).child(TerminationPoint, connector.toTerminationPointKey()).toInstance;
-    }
-
-    def Map<Edge, Set<org.opendaylight.controller.sal.core.Property>> toEdgePropertiesMap(Iterable<Link> links) {
-        val ret = new HashMap<Edge, Set<org.opendaylight.controller.sal.core.Property>>
-        for (link : links) {
-            ret.put(link.toEdge(), link.toProperties())
-        }
-        return ret;
-    }
-
-    def Set<Edge> toEdges(Iterable<Link> links) {
-        val ret = new HashSet<Edge>
-        for (link : links) {
-            ret.add(link.toEdge)
-        }
-        return ret;
-    }
-
-    def Edge toEdge(Link link) {
-        val tail = link.source.toNodeConnector();
-        val head = link.destination.toNodeConnector();
-        return new Edge(tail, head);
-    }
-
-    def org.opendaylight.controller.sal.core.Node toAdNode(Node node) {
-        return node.nodeId.toAdNode;
-    }
-
-    def org.opendaylight.controller.sal.core.Node toAdNode(
-        org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId node) {
-        val key = new NodeKey(new NodeId(node))
-        return new org.opendaylight.controller.sal.core.Node(NodeMapping.MD_SAL_TYPE, key);
-    }
-
-    def NodeConnector toNodeConnector(Source ref) {
-        val adNode = ref.sourceNode.toAdNode();
-        val key = new NodeConnectorKey(new NodeConnectorId(ref.sourceTp))
-        return new NodeConnector(NodeMapping.MD_SAL_TYPE, key, adNode);
-    }
-
-    def NodeConnector toNodeConnector(Destination ref) {
-        val adNode = ref.destNode.toAdNode();
-        val key = new NodeConnectorKey(new NodeConnectorId(ref.destTp))
-        return new NodeConnector(NodeMapping.MD_SAL_TYPE, key, adNode);
-    }
-
-    def TerminationPointKey toTerminationPointKey(NodeConnector connector) {
-    }
-
-    def Set<org.opendaylight.controller.sal.core.Property> toProperties(Link link) {
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.java
new file mode 100644 (file)
index 0000000..11320a1
--- /dev/null
@@ -0,0 +1,149 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.md.compatibility.topologymanager;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader;
+import org.opendaylight.controller.sal.core.ConstructionException;
+import org.opendaylight.controller.sal.core.Edge;
+import org.opendaylight.controller.sal.core.Host;
+import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.core.Property;
+import org.opendaylight.controller.sal.core.UpdateType;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.topologymanager.ITopologyManager;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.FluentIterable;
+
+@SuppressWarnings("all")
+public class CompatibleTopologyManager extends ConfigurableLinkManager implements ITopologyManager {
+    private AdSalTopologyMapping topologyMapping;
+    private TypeSafeDataReader dataReader;
+
+    public TypeSafeDataReader getDataReader() {
+        return dataReader;
+    }
+
+    public void setDataReader(final TypeSafeDataReader dataReader) {
+        this.dataReader = dataReader;
+    }
+
+    public AdSalTopologyMapping getTopologyMapping() {
+        return topologyMapping;
+    }
+
+    public void setTopologyMapping(final AdSalTopologyMapping topologyMapping) {
+        this.topologyMapping = topologyMapping;
+    }
+
+    @Override
+    public Map<Edge,Set<Property>> getEdges() {
+        final Topology topology = getDataReader().readOperationalData(topologyMapping.getTopologyPath());
+        return this.topologyMapping.toEdgePropertiesMap(topology.getLink());
+    }
+
+    @Override
+    public Map<org.opendaylight.controller.sal.core.Node, Set<Edge>> getNodeEdges() {
+        final Topology topology = getDataReader().readOperationalData(topologyMapping.getTopologyPath());
+        final HashMap<org.opendaylight.controller.sal.core.Node, Set<Edge>> ret = new HashMap<>();
+        for (final Node node : topology.getNode()) {
+            try {
+                ret.put(topologyMapping.toAdNode(node), topologyMapping.toEdges(
+                        FluentIterable.from(topology.getLink()).filter(new Predicate<Link>() {
+                            @Override
+                            public boolean apply(final Link input) {
+                                final NodeId nodeId = node.getNodeId();
+                                if (nodeId.equals(input.getSource().getSourceNode())) {
+                                    return true;
+                                }
+                                if (nodeId.equals(input.getDestination().getDestNode())) {
+                                    return true;
+                                }
+
+                                return false;
+                            }
+                        })));
+            } catch (ConstructionException e) {
+                throw new IllegalStateException(String.format("Failed to construct node for {}", node), e);
+            }
+        }
+        return ret;
+    }
+
+    /**
+     * Returns true if point is connected to link
+     */
+    private boolean isInternal(final TerminationPoint point) {
+        final Topology topology = getDataReader().readConfigurationData(topologyMapping.getTopologyPath());
+        final TpId tpId = point.getKey().getTpId();
+        return FluentIterable.from(topology.getLink()).anyMatch(new Predicate<Link>() {
+            @Override
+            public boolean apply(final Link input) {
+                if (tpId.equals(input.getSource().getSourceTp())) {
+                    return true;
+                }
+                if (tpId.equals(input.getDestination().getDestTp())) {
+                    return true;
+                }
+                return false;
+            }
+        });
+    }
+
+    @Override
+    public Set<NodeConnector> getNodeConnectorWithHost() {
+        return null;
+    }
+
+    @Override
+    public Host getHostAttachedToNodeConnector(final NodeConnector p) {
+        final InstanceIdentifier<TerminationPoint> tpPath = topologyMapping.toTerminationPoint(p);
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public List<Host> getHostsAttachedToNodeConnector(final NodeConnector p) {
+        final Topology topology = getDataReader().readOperationalData(topologyMapping.getTopologyPath());
+        throw new UnsupportedOperationException("Hosts not mapped yet");
+    }
+
+    @Override
+    public Map<org.opendaylight.controller.sal.core.Node, Set<NodeConnector>> getNodesWithNodeConnectorHost() {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
+    }
+
+    @Override
+    public boolean isInternal(final NodeConnector p) {
+        final TerminationPoint connector = getDataReader()
+                .readConfigurationData(topologyMapping.toTerminationPoint(p));
+        return this.isInternal(connector);
+    }
+
+    @Override
+    public void updateHostLink(final NodeConnector p, final Host h, final UpdateType t, final Set<Property> props) {
+        // Update app defined topology
+    }
+
+    @Override
+    public Status saveConfig() {
+        // FIXME: commit configuration
+        return null;
+    }
+}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.xtend b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.xtend
deleted file mode 100644 (file)
index 4fdea4b..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.compatibility.topologymanager
-
-import org.opendaylight.controller.topologymanager.ITopologyManager
-import org.opendaylight.controller.sal.core.NodeConnector
-import org.opendaylight.controller.sal.core.Host
-import org.opendaylight.controller.sal.core.UpdateType
-import java.util.Set
-import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader
-import java.util.HashMap
-import org.opendaylight.controller.sal.core.Edge
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint
-import com.google.common.collect.FluentIterable
-
-class CompatibleTopologyManager extends ConfigurableLinkManager implements ITopologyManager {
-
-    @Property
-    var TypeSafeDataReader dataReader;
-
-    @Property
-    var extension AdSalTopologyMapping topologyMapping;
-
-    override getEdges() {
-        val topology = dataReader.readOperationalData(topologyPath);
-        return topology.link.toEdgePropertiesMap();
-    }
-
-    override getNodeEdges() {
-        val topology = dataReader.readOperationalData(topologyPath);
-        val ret = new HashMap<org.opendaylight.controller.sal.core.Node, Set<Edge>>;
-        for (node : topology.node) {
-            val adNode = node.toAdNode();
-            val adEdges = FluentIterable.from(topology.link).filter[
-                source.sourceNode == node.nodeId || destination.destNode == node.nodeId].toEdges();
-            ret.put(adNode, adEdges)
-        }
-        return ret;
-    }
-
-    /**
-     *   Returns true if point is connected to link
-    */
-    def isInternal(TerminationPoint point) {
-        val topology = dataReader.readConfigurationData(topologyPath);
-        val tpId = point.key.tpId;
-        return FluentIterable.from(topology.link).anyMatch(
-            [
-                source.sourceTp == tpId || destination.destTp == tpId
-            ])
-    }
-
-    override getNodeConnectorWithHost() {
-    }
-
-    override getHostAttachedToNodeConnector(NodeConnector p) {
-        val tpPath = p.toTerminationPoint();
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    override getHostsAttachedToNodeConnector(NodeConnector p) {
-        val topology = dataReader.readOperationalData(topologyPath);
-
-        throw new UnsupportedOperationException("Hosts not mapped yet")
-    }
-
-    override getNodesWithNodeConnectorHost() {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-
-    }
-
-    override isInternal(NodeConnector p) {
-        val tpPath = p.toTerminationPoint();
-        val connector = dataReader.readConfigurationData(tpPath);
-        return connector.isInternal();
-    }
-
-    override updateHostLink(NodeConnector p, Host h, UpdateType t,
-        Set<org.opendaylight.controller.sal.core.Property> props) {
-        // Update app defined topology
-    }
-
-    override saveConfig() {
-        // FIXME: commit configuration
-    }
-
-}
@@ -1,31 +1,31 @@
-/*
+/**
  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.md.compatibility.topologymanager
+package org.opendaylight.controller.md.compatibility.topologymanager;
 
-import org.opendaylight.controller.topologymanager.ITopologyManager
-import org.opendaylight.controller.topologymanager.TopologyUserLinkConfig
+import java.util.concurrent.ConcurrentMap;
 
-abstract class ConfigurableLinkManager implements ITopologyManager {
-    
-    final override addUserLink(TopologyUserLinkConfig link) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-        
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.topologymanager.ITopologyManager;
+import org.opendaylight.controller.topologymanager.TopologyUserLinkConfig;
+
+public abstract class ConfigurableLinkManager implements ITopologyManager {
+    @Override
+    public final Status addUserLink(final TopologyUserLinkConfig link) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
     }
-    
-    
-    final override deleteUserLink(String linkName) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-        
+
+    @Override
+    public final Status deleteUserLink(final String linkName) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
     }
-    
-    
-    final override getUserLinks() {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-        
+
+    @Override
+    public final ConcurrentMap<String,TopologyUserLinkConfig> getUserLinks() {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub");
     }
 }
index 3ed1edf..688e6ac 100644 (file)
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.eclipse.xtend</groupId>
-      <artifactId>org.eclipse.xtend.lib</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
           </instructions>
         </configuration>
       </plugin>
-      <plugin>
-        <groupId>org.eclipse.xtend</groupId>
-        <artifactId>xtend-maven-plugin</artifactId>
-      </plugin>
       <plugin>
         <groupId>org.jacoco</groupId>
         <artifactId>jacoco-maven-plugin</artifactId>
index a145a3b..6c79e05 100644 (file)
           </instructions>
         </configuration>
       </plugin>
-      <plugin>
-        <groupId>org.eclipse.xtend</groupId>
-        <artifactId>xtend-maven-plugin</artifactId>
-      </plugin>
       <plugin>
         <groupId>org.jacoco</groupId>
         <artifactId>jacoco-maven-plugin</artifactId>
index 53257f8..a879a36 100644 (file)
@@ -261,11 +261,11 @@ public class FromSalConversionsUtils {
                     .setType(etherType);
             targetEthMatchBuild.setEthernetType(ethType.build());
         }
-        if((sourceMatch.getField(DL_SRC) != null && sourceMatch.getField(DL_SRC).getValue() != null) || 
-                (sourceMatch.getField(DL_DST) != null && sourceMatch.getField(DL_DST).getValue() != null)|| 
+        if((sourceMatch.getField(DL_SRC) != null && sourceMatch.getField(DL_SRC).getValue() != null) ||
+                (sourceMatch.getField(DL_DST) != null && sourceMatch.getField(DL_DST).getValue() != null)||
                 dataLinkType != null ) {
-            return targetEthMatchBuild.build();            
-        } 
+            return targetEthMatchBuild.build();
+        }
         return null;
     }
 
@@ -372,7 +372,7 @@ public class FromSalConversionsUtils {
                     .toAddrString(inetDestAddress);
             layer4MatchBuild
             .setIpv4Destination(new Ipv4Prefix(inetDstAddressString));
-        }       
+        }
         return layer4MatchBuild.build();
 
     }
@@ -388,13 +388,13 @@ public class FromSalConversionsUtils {
         }
         if(inetDestAddress != null) {
             String inetDstAddressString = InetAddresses
-                    .toAddrString(inetDestAddress);    
+                    .toAddrString(inetDestAddress);
             layer6MatchBuild
                     .setIpv6Destination(new Ipv6Prefix(inetDstAddressString));
         }
         return layer6MatchBuild.build();
     }
-    
+
     public static boolean flowEquals(Flow statsFlow, Flow storedFlow) {
         if (statsFlow.getClass() != storedFlow.getClass()) {
             return false;
diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.java
new file mode 100644 (file)
index 0000000..2830165
--- /dev/null
@@ -0,0 +1,770 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.sal.compatibility;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader;
+import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
+import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.controller.sal.core.ConstructionException;
+import org.opendaylight.controller.sal.core.Edge;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.core.NodeTable;
+import org.opendaylight.controller.sal.core.Property;
+import org.opendaylight.controller.sal.core.UpdateType;
+import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
+import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService;
+import org.opendaylight.controller.sal.reader.FlowOnNode;
+import org.opendaylight.controller.sal.reader.IPluginInReadService;
+import org.opendaylight.controller.sal.reader.IPluginOutReadService;
+import org.opendaylight.controller.sal.reader.NodeConnectorStatistics;
+import org.opendaylight.controller.sal.reader.NodeDescription;
+import org.opendaylight.controller.sal.reader.NodeTableStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsUpdate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowStatisticsData;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsData;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.statistics.FlowTableStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.Link;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated;
+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.NodeRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.OpendaylightInventoryListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.GenericStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.Bytes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.Packets;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsData;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class InventoryAndReadAdapter implements IPluginInReadService, IPluginInInventoryService, OpendaylightInventoryListener, OpendaylightFlowStatisticsListener, OpendaylightFlowTableStatisticsListener, OpendaylightPortStatisticsListener {
+    private static final Logger LOG = LoggerFactory.getLogger(InventoryAndReadAdapter.class);
+    private static final short OPENFLOWV10_TABLE_ID = 0;
+
+    private final InventoryNotificationProvider inventoryNotificationProvider = new InventoryNotificationProvider();
+    private final Map<PathArgument,List<PathArgument>> nodeToNodeConnectorsMap = new ConcurrentHashMap<>();
+    private List<IPluginOutInventoryService> inventoryPublisher = new CopyOnWriteArrayList<>();
+    private List<IPluginOutReadService> statisticsPublisher = new CopyOnWriteArrayList<>();
+
+    private OpendaylightFlowTableStatisticsService flowTableStatisticsService;
+    private OpendaylightPortStatisticsService nodeConnectorStatisticsService;
+    private OpendaylightFlowStatisticsService flowStatisticsService;
+    private FlowTopologyDiscoveryService topologyDiscovery;
+    private DataProviderService dataProviderService;
+    private DataBrokerService dataService;
+
+    public DataBrokerService getDataService() {
+        return dataService;
+    }
+
+    public void setDataService(final DataBrokerService dataService) {
+        this.dataService = dataService;
+    }
+
+    public DataProviderService getDataProviderService() {
+        return dataProviderService;
+    }
+
+    public void setDataProviderService(final DataProviderService dataProviderService) {
+        this.dataProviderService = dataProviderService;
+    }
+
+    public OpendaylightFlowStatisticsService getFlowStatisticsService() {
+        return flowStatisticsService;
+    }
+
+    public void setFlowStatisticsService(final OpendaylightFlowStatisticsService flowStatisticsService) {
+        this.flowStatisticsService = flowStatisticsService;
+    }
+
+    public OpendaylightPortStatisticsService getNodeConnectorStatisticsService() {
+        return nodeConnectorStatisticsService;
+    }
+
+    public void setNodeConnectorStatisticsService(final OpendaylightPortStatisticsService nodeConnectorStatisticsService) {
+        this.nodeConnectorStatisticsService = nodeConnectorStatisticsService;
+    }
+
+    public OpendaylightFlowTableStatisticsService getFlowTableStatisticsService() {
+        return flowTableStatisticsService;
+    }
+
+    public void setFlowTableStatisticsService(final OpendaylightFlowTableStatisticsService flowTableStatisticsService) {
+        this.flowTableStatisticsService = flowTableStatisticsService;
+    }
+
+    public FlowTopologyDiscoveryService getTopologyDiscovery() {
+        return topologyDiscovery;
+    }
+
+    public void setTopologyDiscovery(final FlowTopologyDiscoveryService topologyDiscovery) {
+        this.topologyDiscovery = topologyDiscovery;
+    }
+
+    public List<IPluginOutReadService> getStatisticsPublisher() {
+        return statisticsPublisher;
+    }
+
+    public void setStatisticsPublisher(final List<IPluginOutReadService> statisticsPublisher) {
+        this.statisticsPublisher = statisticsPublisher;
+    }
+
+    public List<IPluginOutInventoryService> getInventoryPublisher() {
+        return inventoryPublisher;
+    }
+
+    public void setInventoryPublisher(final List<IPluginOutInventoryService> inventoryPublisher) {
+        this.inventoryPublisher = inventoryPublisher;
+    }
+
+    public void startAdapter() {
+        inventoryNotificationProvider.setDataProviderService(getDataProviderService());
+        inventoryNotificationProvider.setInventoryPublisher(getInventoryPublisher());
+        // inventoryNotificationProvider.start();
+    }
+
+    public boolean setInventoryPublisher(final IPluginOutInventoryService listener) {
+        return getInventoryPublisher().add(listener);
+    }
+
+    public boolean unsetInventoryPublisher(final IPluginOutInventoryService listener) {
+        return getInventoryPublisher().remove(listener);
+    }
+
+    public boolean setReadPublisher(final IPluginOutReadService listener) {
+        return getStatisticsPublisher().add(listener);
+    }
+
+    public Boolean unsetReadPublisher(final IPluginOutReadService listener) {
+        if (listener != null) {
+            return getStatisticsPublisher().remove(listener);
+        }
+        return false;
+    }
+
+    protected DataModificationTransaction startChange() {
+        return getDataProviderService().beginTransaction();
+    }
+
+    @Override
+    public long getTransmitRate(final NodeConnector connector) {
+        final FlowCapableNodeConnector nodeConnector = this.readOperFlowCapableNodeConnector(NodeMapping.toNodeConnectorRef(connector));
+        return nodeConnector.getCurrentSpeed().longValue();
+    }
+
+    private FlowCapableNode readOperFlowCapableNode(final NodeRef ref) {
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node node =
+                (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)getDataService().readOperationalData(ref.getValue());
+        if (node == null) {
+            return null;
+        }
+
+        return node.getAugmentation(FlowCapableNode.class);
+    }
+
+    private org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node readConfigNode(final Node node) {
+        final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node> nodeRef =
+                InstanceIdentifier.builder(Nodes.class)
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, InventoryMapping.toNodeKey(node))
+                .build();
+
+        return (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) startChange().readConfigurationData(nodeRef);
+    }
+
+    private org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector readConfigNodeConnector(final NodeConnector connector) {
+        final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector> nodeConnectorRef =
+                InstanceIdentifier.builder(Nodes.class)
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, InventoryMapping.toNodeKey(connector.getNode()))
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector.class, InventoryMapping.toNodeConnectorKey(connector))
+                .toInstance();
+
+        return((org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) startChange().readConfigurationData(nodeConnectorRef));
+    }
+
+    /**
+     * Read a table of a node from configuration data store.
+     *
+     * @param node Node id
+     * @param id Table id
+     * @return Table contents, or null if not present
+     */
+    private Table readConfigTable(final Node node, final short id) {
+        final InstanceIdentifier<Table> tableRef = InstanceIdentifier.builder(Nodes.class)
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, InventoryMapping.toNodeKey(node))
+                .augmentation(FlowCapableNode.class)
+                .child(Table.class, new TableKey(id))
+                .build();
+
+        return (Table) startChange().readConfigurationData(tableRef);
+    }
+
+    @Override
+    public List<FlowOnNode> readAllFlow(final Node node, final boolean cached) {
+        final ArrayList<FlowOnNode> output = new ArrayList<>();
+        final Table table = readConfigTable(node, OPENFLOWV10_TABLE_ID);
+        if (table != null) {
+            final List<Flow> flows = table.getFlow();
+            LOG.trace("Number of flows installed in table 0 of node {} : {}", node, flows.size());
+
+            for (final Flow flow : flows) {
+                final FlowStatisticsData statsFromDataStore = flow.getAugmentation(FlowStatisticsData.class);
+                if (statsFromDataStore != null) {
+                    final FlowOnNode it = new FlowOnNode(ToSalConversionsUtils.toFlow(flow, node));
+                    output.add(addFlowStats(it, statsFromDataStore.getFlowStatistics()));
+                }
+            }
+        }
+
+        // TODO (main): Shall we send request to the switch? It will make async request to the switch.
+        // Once the plugin receives a response, it will let the adaptor know through onFlowStatisticsUpdate()
+        // If we assume that md-sal statistics manager will always be running, then it is not required
+        // But if not, then sending request will collect the latest data for adaptor at least.
+        getFlowStatisticsService().getAllFlowsStatisticsFromAllFlowTables(
+                new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder().setNode(NodeMapping.toNodeRef(node)).build());
+        return output;
+    }
+
+    @Override
+    public List<NodeConnectorStatistics> readAllNodeConnector(final Node node, final boolean cached) {
+        final ArrayList<NodeConnectorStatistics> ret = new ArrayList<>();
+
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node dsNode = readConfigNode(node);
+        if (dsNode != null) {
+            for (final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector dsNodeConnector : dsNode.getNodeConnector()) {
+                final FlowCapableNodeConnectorStatistics stats = (dsNodeConnector.getAugmentation(FlowCapableNodeConnectorStatisticsData.class));
+                if (stats != null) {
+                    try {
+                        ret.add(toNodeConnectorStatistics(stats.getFlowCapableNodeConnectorStatistics(), dsNode.getId(), dsNodeConnector.getId()));
+                    } catch (ConstructionException e) {
+                        LOG.warn("Failed to instantiate node connector statistics for node {} connector {}, ignoring it",
+                                dsNode.getId(), dsNodeConnector.getId(), e);
+                    }
+                }
+            }
+        }
+
+        //TODO: Refer TODO (main)
+        getNodeConnectorStatisticsService().getAllNodeConnectorsStatistics(
+                new GetAllNodeConnectorsStatisticsInputBuilder().setNode(NodeMapping.toNodeRef(node)).build());
+        return ret;
+    }
+
+    @Override
+    public List<NodeTableStatistics> readAllNodeTable(final Node node, final boolean cached) {
+        final NodeRef nodeRef = NodeMapping.toNodeRef(node);
+
+        final ArrayList<NodeTableStatistics> ret = new ArrayList<>();
+        final FlowCapableNode dsFlowCapableNode = this.readOperFlowCapableNode(nodeRef);
+        if (dsFlowCapableNode != null) {
+            for (final Table table : dsFlowCapableNode.getTable()) {
+                final FlowTableStatisticsData tableStats = table.getAugmentation(FlowTableStatisticsData.class);
+                if (tableStats != null) {
+                    try {
+                        ret.add(toNodeTableStatistics(tableStats.getFlowTableStatistics(), table.getId(), node));
+                    } catch (ConstructionException e) {
+                        LOG.warn("Failed to instantiate table statistics for node {} table {}, ignoring it", node, table.getId(), e);
+                    }
+                }
+            }
+        }
+
+        //TODO: Refer TODO (main)
+        getFlowTableStatisticsService().getFlowTablesStatistics(new GetFlowTablesStatisticsInputBuilder().setNode(nodeRef).build());
+        return ret;
+    }
+
+    @Override
+    public NodeDescription readDescription(final Node node, final boolean cached) {
+        return this.toNodeDescription(NodeMapping.toNodeRef(node));
+    }
+
+    @Override
+    public FlowOnNode readFlow(final Node node, final org.opendaylight.controller.sal.flowprogrammer.Flow targetFlow, final boolean cached) {
+        FlowOnNode ret = null;
+        final Table table = readConfigTable(node, OPENFLOWV10_TABLE_ID);
+        if (table != null) {
+            final List<Flow> flows = table.getFlow();
+            InventoryAndReadAdapter.LOG.trace("Number of flows installed in table 0 of node {} : {}", node, flows.size());
+
+            for (final Flow mdsalFlow : flows) {
+                if(FromSalConversionsUtils.flowEquals(mdsalFlow, MDFlowMapping.toMDSalflow(targetFlow))) {
+                    final FlowStatisticsData statsFromDataStore = mdsalFlow.getAugmentation(FlowStatisticsData.class);
+                    if (statsFromDataStore != null) {
+                        InventoryAndReadAdapter.LOG.debug("Found matching flow in the data store flow table ");
+                        ret = addFlowStats(new FlowOnNode(targetFlow), statsFromDataStore.getFlowStatistics());
+
+                        // FIXME: break; ?
+                    }
+                }
+            }
+        }
+
+        //TODO: Refer TODO (main)
+        final GetFlowStatisticsFromFlowTableInputBuilder input = new GetFlowStatisticsFromFlowTableInputBuilder().setNode(NodeMapping.toNodeRef(node));
+        input.fieldsFrom(MDFlowMapping.toMDSalflow(targetFlow));
+        getFlowStatisticsService().getFlowStatisticsFromFlowTable(input.build());
+        return ret;
+    }
+
+    @Override
+    public NodeConnectorStatistics readNodeConnector(final NodeConnector connector, final boolean cached) {
+        final NodeConnectorId ncId = InventoryMapping.toNodeConnectorKey(connector).getId();
+
+        NodeConnectorStatistics ret = null;
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector nodeConnectorFromDS = readConfigNodeConnector(connector);
+        if (nodeConnectorFromDS != null) {
+            final FlowCapableNodeConnectorStatistics stats = nodeConnectorFromDS.getAugmentation(FlowCapableNodeConnectorStatisticsData.class);
+            if (stats != null) {
+                try {
+                    ret = toNodeConnectorStatistics(stats.getFlowCapableNodeConnectorStatistics(),
+                            InventoryMapping.toNodeKey(connector.getNode()).getId(), ncId);
+                } catch (ConstructionException e) {
+                    LOG.warn("Failed to instantiate node connector statistics for connector {}, ignoring it",
+                            connector, e);
+                }
+            }
+        }
+
+        getNodeConnectorStatisticsService().getNodeConnectorStatistics(
+                new GetNodeConnectorStatisticsInputBuilder().setNode(NodeMapping.toNodeRef(connector.getNode())).setNodeConnectorId(ncId).build());
+        return ret;
+    }
+
+    @Override
+    public NodeTableStatistics readNodeTable(final NodeTable nodeTable, final boolean cached) {
+        NodeTableStatistics nodeStats = null;
+        final Table table = readConfigTable(nodeTable.getNode(), (short) nodeTable.getID());
+        if (table != null) {
+            final FlowTableStatisticsData tableStats = table.getAugmentation(FlowTableStatisticsData.class);
+            if (tableStats != null) {
+                try {
+                    nodeStats = toNodeTableStatistics(tableStats.getFlowTableStatistics(), table.getId(), nodeTable.getNode());
+                } catch (ConstructionException e) {
+                    LOG.warn("Failed to instantiate table statistics for node {} table {}, ignoring it",
+                            nodeTable.getNode(), table.getId(), e);
+                }
+            }
+        }
+
+        //TODO: Refer TODO (main)
+        getFlowTableStatisticsService().getFlowTablesStatistics(
+                new GetFlowTablesStatisticsInputBuilder().setNode(NodeMapping.toNodeRef(nodeTable.getNode())).build());
+        return nodeStats;
+    }
+
+    @Override
+    public void onNodeConnectorRemoved(final NodeConnectorRemoved update) {
+        // Never received
+    }
+
+    @Override
+    public void onNodeRemoved(final NodeRemoved notification) {
+        this.removeNodeConnectors(notification.getNodeRef().getValue());
+        try {
+            final Node aDNode = NodeMapping.toADNode(notification.getNodeRef());
+            this.publishNodeUpdate(aDNode, UpdateType.REMOVED, Collections.<Property>emptySet());
+        } catch (ConstructionException e) {
+            LOG.warn("Failed to construct node for {}, not propagating update", notification.getNodeRef(), e);
+        }
+    }
+
+    @Override
+    public void onNodeConnectorUpdated(final NodeConnectorUpdated update) {
+        final NodeConnectorRef ref = update.getNodeConnectorRef();
+        final UpdateType updateType;
+        if (!this.isKnownNodeConnector(ref.getValue())) {
+            this.recordNodeConnector(ref.getValue());
+            updateType = UpdateType.ADDED;
+        } else {
+            updateType = UpdateType.CHANGED;
+        }
+
+        try {
+            final NodeConnector nodeConnector;
+            nodeConnector = NodeMapping.toADNodeConnector(ref);
+            this.publishNodeConnectorUpdate(nodeConnector, updateType, NodeMapping.toADNodeConnectorProperties(update));
+        } catch (ConstructionException e) {
+            LOG.warn("Failed to construct node connector for {}, not reporting the update", ref, e);
+        }
+    }
+
+    @Override
+    public void onNodeUpdated(final NodeUpdated notification) {
+        final NodeRef ref = notification.getNodeRef();
+
+        final UpdateType updateType;
+        if (dataService.readOperationalData(ref.getValue()) == null) {
+            updateType = UpdateType.ADDED;
+        } else {
+            updateType = UpdateType.CHANGED;
+        }
+
+        final Node aDNode;
+        try {
+            aDNode = NodeMapping.toADNode(ref);
+        } catch (ConstructionException e) {
+            LOG.warn("Failed to construct node for {}, not reporting the update", ref, e);
+            return;
+        }
+
+        this.publishNodeUpdate(aDNode, updateType, NodeMapping.toADNodeProperties(notification));
+        for (final IPluginOutReadService statsPublisher : getStatisticsPublisher()) {
+            final NodeDescription description = this.toNodeDescription(ref);
+            if (description != null) {
+                final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node> nodeRef =
+                        InstanceIdentifier.builder(Nodes.class)
+                        .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, new NodeKey(notification.getId()))
+                        .toInstance();
+                try {
+                    statsPublisher.descriptionStatisticsUpdated(NodeMapping.toADNode(nodeRef), description);
+                } catch (ConstructionException e) {
+                    LOG.warn("Failed to construct node for {}, not reporting the update to publisher {}", nodeRef, statsPublisher, e);
+                }
+            }
+        }
+    }
+
+    @Override
+    public ConcurrentMap<Node,Map<String,Property>> getNodeProps() {
+        final ConcurrentHashMap<Node,Map<String,Property>> props = new ConcurrentHashMap<>();
+        final Nodes nodes = this.readOperAllMDNodes();
+        for (final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node node : nodes.getNode()) {
+            final FlowCapableNode fcn = node.getAugmentation(FlowCapableNode.class);
+            if (fcn != null) {
+                final ConcurrentHashMap<String,Property> perNodePropMap = new ConcurrentHashMap<String, Property>();
+                final HashSet<Property> perNodeProps = NodeMapping.toADNodeProperties(fcn, node.getId());
+                if (perNodeProps != null) {
+                    for (final Property perNodeProp : perNodeProps) {
+                        perNodePropMap.put(perNodeProp.getName(), perNodeProp);
+                    }
+                }
+
+                try {
+                    final Node adNode = new Node(NodeMapping.MD_SAL_TYPE, NodeMapping.toADNodeId(node.getId()));
+                    props.put(adNode, perNodePropMap);
+                } catch (ConstructionException e) {
+                    LOG.warn("Failed to construct node for {}, skipping it", node, e);
+                }
+            }
+        }
+        return props;
+    }
+
+    private Nodes readOperAllMDNodes() {
+        final TypeSafeDataReader reader = TypeSafeDataReader.forReader(getDataService());
+        return reader.readOperationalData(InstanceIdentifier.builder(Nodes.class).build());
+    }
+
+    @Override
+    public ConcurrentMap<NodeConnector,Map<String,Property>> getNodeConnectorProps(final Boolean refresh) {
+        final ConcurrentHashMap<NodeConnector,Map<String,Property>> props = new ConcurrentHashMap<>();
+        for (final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node node : this.readOperAllMDNodes().getNode()) {
+            for (final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector nc : node.getNodeConnector()) {
+                final FlowCapableNodeConnector fcnc = nc.getAugmentation(FlowCapableNodeConnector.class);
+                if (fcnc != null) {
+                    final ConcurrentHashMap<String,Property> ncpsm = new ConcurrentHashMap<>();
+                    final HashSet<Property> ncps = NodeMapping.toADNodeConnectorProperties(fcnc);
+                    if (ncps != null) {
+                        for (final Property p : ncps) {
+                            ncpsm.put(p.getName(), p);
+                        }
+                    }
+
+                    try {
+                        props.put(NodeMapping.toADNodeConnector(nc.getId(), node.getId()), ncpsm);
+                    } catch (ConstructionException e) {
+                        LOG.warn("Failed to instantiate node {} connector {}, not reporting it", node.getId(), nc.getId(), e);
+                    }
+                }
+            }
+        }
+        return props;
+    }
+
+    private FlowCapableNodeConnector readOperFlowCapableNodeConnector(final NodeConnectorRef ref) {
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector nc =
+                (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector)
+                getDataService().readOperationalData(ref.getValue());
+        return nc.getAugmentation(FlowCapableNodeConnector.class);
+    }
+
+    private static NodeConnectorStatistics toNodeConnectorStatistics(final org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.NodeConnectorStatistics nodeConnectorStatistics, final NodeId nodeId, final NodeConnectorId nodeConnectorId) throws ConstructionException {
+        final NodeConnectorStatistics it = new NodeConnectorStatistics();
+
+        final Packets packets = nodeConnectorStatistics.getPackets();
+        it.setReceivePacketCount(packets.getReceived().longValue());
+        it.setTransmitPacketCount(packets.getTransmitted().longValue());
+
+        final Bytes bytes = nodeConnectorStatistics.getBytes();
+        it.setReceiveByteCount(bytes.getReceived().longValue());
+        it.setTransmitByteCount(bytes.getTransmitted().longValue());
+
+        it.setReceiveDropCount(nodeConnectorStatistics.getReceiveDrops().longValue());
+        it.setTransmitDropCount(nodeConnectorStatistics.getTransmitDrops().longValue());
+        it.setReceiveErrorCount(nodeConnectorStatistics.getReceiveErrors().longValue());
+        it.setTransmitErrorCount(nodeConnectorStatistics.getTransmitErrors().longValue());
+        it.setReceiveFrameErrorCount(nodeConnectorStatistics.getReceiveFrameError().longValue());
+        it.setReceiveOverRunErrorCount(nodeConnectorStatistics.getReceiveOverRunError().longValue());
+        it.setReceiveCRCErrorCount(nodeConnectorStatistics.getReceiveCrcError().longValue());
+        it.setCollisionCount(nodeConnectorStatistics.getCollisionCount().longValue());
+
+        final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector> nodeConnectorRef =
+                InstanceIdentifier.builder(Nodes.class)
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, new NodeKey(nodeId))
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector.class, new NodeConnectorKey(nodeConnectorId))
+                .build();
+        it.setNodeConnector(NodeMapping.toADNodeConnector(new NodeConnectorRef(nodeConnectorRef)));
+        return it;
+    }
+
+    private static NodeTableStatistics toNodeTableStatistics(final FlowTableStatistics tableStats, final Short tableId, final Node node) throws ConstructionException {
+        final NodeTableStatistics it = new NodeTableStatistics();
+        it.setActiveCount(tableStats.getActiveFlows().getValue().intValue());
+        it.setLookupCount(tableStats.getPacketsLookedUp().getValue().longValue());
+        it.setMatchedCount(tableStats.getPacketsMatched().getValue().longValue());
+        it.setName(tableId.toString());
+        it.setNodeTable(new NodeTable(NodeMapping.MD_SAL_TYPE, tableId, node));
+        return it;
+    }
+
+    private NodeDescription toNodeDescription(final NodeRef nodeRef) {
+        final FlowCapableNode capableNode = this.readOperFlowCapableNode(nodeRef);
+        if (capableNode == null) {
+            return null;
+        }
+
+        final NodeDescription it = new NodeDescription();
+        it.setManufacturer(capableNode.getManufacturer());
+        it.setSerialNumber(capableNode.getSerialNumber());
+        it.setSoftware(capableNode.getSoftware());
+        it.setDescription(capableNode.getDescription());
+        return it;
+    }
+
+    public Edge toADEdge(final Link link) throws ConstructionException {
+        NodeConnectorRef _source = link.getSource();
+        NodeConnector _aDNodeConnector = NodeMapping.toADNodeConnector(_source);
+        NodeConnectorRef _destination = link.getDestination();
+        NodeConnector _aDNodeConnector_1 = NodeMapping.toADNodeConnector(_destination);
+        Edge _edge = new Edge(_aDNodeConnector, _aDNodeConnector_1);
+        return _edge;
+    }
+
+    /**
+     * OpendaylightFlowStatisticsListener interface implementation
+     */
+    @Override
+    public void onAggregateFlowStatisticsUpdate(final AggregateFlowStatisticsUpdate notification) {
+        // Ignoring this notification as there does not seem to be a way to bubble this up to AD-SAL
+    }
+
+    @Override
+    public void onFlowsStatisticsUpdate(final FlowsStatisticsUpdate notification) {
+        final ArrayList<FlowOnNode> adsalFlowsStatistics = new ArrayList<>();
+        final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node> nodeRef =
+                InstanceIdentifier.builder(Nodes.class)
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, new NodeKey(notification.getId()))
+                .build();
+
+        final Node aDNode;
+        try {
+            aDNode = NodeMapping.toADNode(nodeRef);
+        } catch (ConstructionException e) {
+            LOG.warn("Failed to construct node for {}, ignoring it", notification.getId(), e);
+            return;
+        }
+
+        for (final FlowAndStatisticsMapList flowStats : notification.getFlowAndStatisticsMapList()) {
+            if (flowStats.getTableId() == 0) {
+                adsalFlowsStatistics.add(InventoryAndReadAdapter.toFlowOnNode(flowStats, aDNode));
+            }
+        }
+        for (final IPluginOutReadService statsPublisher : getStatisticsPublisher()) {
+            statsPublisher.nodeFlowStatisticsUpdated(aDNode, adsalFlowsStatistics);
+        }
+    }
+
+    /**
+     * OpendaylightFlowTableStatisticsListener interface implementation
+     */
+    @Override
+    public void onFlowTableStatisticsUpdate(final FlowTableStatisticsUpdate notification) {
+        ArrayList<NodeTableStatistics> adsalFlowTableStatistics = new ArrayList<>();
+        for (final FlowTableAndStatisticsMap stats : notification.getFlowTableAndStatisticsMap()) {
+            if (stats.getTableId().getValue() == 0) {
+                final NodeTableStatistics it = new NodeTableStatistics();
+                it.setActiveCount(stats.getActiveFlows().getValue().intValue());
+                it.setLookupCount(stats.getPacketsLookedUp().getValue().longValue());
+                it.setMatchedCount(stats.getPacketsMatched().getValue().longValue());
+                adsalFlowTableStatistics.add(it);
+            }
+        }
+
+        final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node> nodeRef =
+                InstanceIdentifier.builder(Nodes.class)
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, new NodeKey(notification.getId()))
+                .build();
+
+        final Node aDNode;
+        try {
+            aDNode = NodeMapping.toADNode(nodeRef);
+        } catch (ConstructionException e) {
+            LOG.warn("Failed to construct node for {}, ignoring it", notification.getId(), e);
+            return;
+        }
+
+        for (final IPluginOutReadService statsPublisher : getStatisticsPublisher()) {
+            statsPublisher.nodeTableStatisticsUpdated(aDNode, adsalFlowTableStatistics);
+        }
+    }
+
+    /**
+     * OpendaylightPortStatisticsUpdate interface implementation
+     */
+    @Override
+    public void onNodeConnectorStatisticsUpdate(final NodeConnectorStatisticsUpdate notification) {
+        final ArrayList<NodeConnectorStatistics> adsalPortStatistics = new ArrayList<NodeConnectorStatistics>();
+        for (final NodeConnectorStatisticsAndPortNumberMap nodeConnectorStatistics : notification.getNodeConnectorStatisticsAndPortNumberMap()) {
+            try {
+                adsalPortStatistics.add(toNodeConnectorStatistics(
+                        nodeConnectorStatistics, notification.getId(), nodeConnectorStatistics.getNodeConnectorId()));
+            } catch (ConstructionException e) {
+                LOG.warn("Failed to create statistics for node {} connector {}, not updating them",
+                        notification.getId(), nodeConnectorStatistics.getNodeConnectorId(), e);
+            }
+        }
+
+        final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node> nodeRef =
+                InstanceIdentifier.builder(Nodes.class)
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, new NodeKey(notification.getId()))
+                .build();
+
+        final Node aDNode;
+        try {
+            aDNode = NodeMapping.toADNode(nodeRef);
+        } catch (ConstructionException e) {
+            LOG.warn("Failed to construct node for {}, ignoring it", notification.getId(), e);
+            return;
+        }
+
+        for (final IPluginOutReadService statsPublisher : getStatisticsPublisher()) {
+            statsPublisher.nodeConnectorStatisticsUpdated(aDNode, adsalPortStatistics);
+        }
+    }
+
+    private static FlowOnNode toFlowOnNode(final FlowAndStatisticsMapList flowAndStatsMap, final Node node) {
+        final FlowOnNode it = new FlowOnNode(ToSalConversionsUtils.toFlow(flowAndStatsMap, node));
+        return addFlowStats(it, flowAndStatsMap);
+    }
+
+    private static FlowOnNode addFlowStats(final FlowOnNode node, final GenericStatistics stats) {
+        node.setByteCount(stats.getByteCount().getValue().longValue());
+        node.setPacketCount(stats.getPacketCount().getValue().longValue());
+        node.setDurationSeconds(stats.getDuration().getSecond().getValue().intValue());
+        node.setDurationNanoseconds(stats.getDuration().getNanosecond().getValue().intValue());
+        return node;
+    }
+
+    @Override
+    public Set<Node> getConfiguredNotConnectedNodes() {
+        return Collections.emptySet();
+    }
+
+    private void publishNodeUpdate(final Node node, final UpdateType updateType, final Set<Property> properties) {
+        for (final IPluginOutInventoryService publisher : getInventoryPublisher()) {
+            publisher.updateNode(node, updateType, properties);
+        }
+    }
+
+    private void publishNodeConnectorUpdate(final NodeConnector nodeConnector, final UpdateType updateType, final Set<Property> properties) {
+        for (final IPluginOutInventoryService publisher : getInventoryPublisher()) {
+            publisher.updateNodeConnector(nodeConnector, updateType, properties);
+        }
+    }
+
+    private boolean isKnownNodeConnector(final InstanceIdentifier<? extends Object> nodeConnectorIdentifier) {
+        final List<PathArgument> path = nodeConnectorIdentifier.getPath();
+        if (path.size() >= 3) {
+            final PathArgument nodePath = path.get(1);
+            final PathArgument nodeConnectorPath = path.get(2);
+            final List<PathArgument> nodeConnectors = nodeToNodeConnectorsMap.get(nodePath);
+            if (nodeConnectors != null) {
+                return nodeConnectors.contains(nodeConnectorPath);
+            }
+        }
+        return false;
+    }
+
+    private boolean recordNodeConnector(final InstanceIdentifier<? extends Object> nodeConnectorIdentifier) {
+        final List<PathArgument> path = nodeConnectorIdentifier.getPath();
+        if (path.size() < 3) {
+            return false;
+        }
+
+        final PathArgument nodePath = path.get(1);
+        final PathArgument nodeConnectorPath = path.get(2);
+
+        synchronized (this) {
+            List<PathArgument> nodeConnectors = this.nodeToNodeConnectorsMap.get(nodePath);
+            if (nodeConnectors == null) {
+                nodeConnectors = new ArrayList<>();
+                this.nodeToNodeConnectorsMap.put(nodePath, nodeConnectors);
+            }
+
+            return nodeConnectors.add(nodeConnectorPath);
+        }
+    }
+
+    private List<PathArgument> removeNodeConnectors(final InstanceIdentifier<? extends Object> nodeIdentifier) {
+        return this.nodeToNodeConnectorsMap.remove(nodeIdentifier.getPath().get(1));
+    }
+}
diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend
deleted file mode 100644 (file)
index 8908504..0000000
+++ /dev/null
@@ -1,683 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.compatibility
-
-import java.util.ArrayList
-import java.util.Collections
-import java.util.List
-import java.util.Map
-import java.util.Set
-import java.util.concurrent.ConcurrentHashMap
-import java.util.concurrent.CopyOnWriteArrayList
-import java.util.concurrent.locks.Lock
-import java.util.concurrent.locks.ReentrantLock
-import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService
-import org.opendaylight.controller.sal.core.Edge
-import org.opendaylight.controller.sal.core.Node
-import org.opendaylight.controller.sal.core.NodeTable
-import org.opendaylight.controller.sal.core.UpdateType
-import org.opendaylight.controller.sal.flowprogrammer.Flow
-import org.opendaylight.controller.sal.inventory.IPluginInInventoryService
-import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService
-import org.opendaylight.controller.sal.reader.FlowOnNode
-import org.opendaylight.controller.sal.reader.IPluginInReadService
-import org.opendaylight.controller.sal.reader.IPluginOutReadService
-import org.opendaylight.controller.sal.reader.NodeConnectorStatistics
-import org.opendaylight.controller.sal.reader.NodeDescription
-import org.opendaylight.controller.sal.reader.NodeTableStatistics
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsUpdate
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowStatisticsData
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInputBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInputBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsListener
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsData
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdate
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInputBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsListener
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.statistics.FlowTableStatistics
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryService
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.Link
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemoved
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated
-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.NodeRemoved
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.OpendaylightInventoryListener
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatistics
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsData
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInputBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsInputBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdate
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsListener
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService
-import org.opendaylight.yangtools.yang.binding.DataObject
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
-import org.slf4j.LoggerFactory
-
-import static extension org.opendaylight.controller.sal.common.util.Arguments.*
-import static extension org.opendaylight.controller.sal.compatibility.NodeMapping.*
-
-class InventoryAndReadAdapter implements IPluginInReadService,
-                                             IPluginInInventoryService,
-                                             OpendaylightInventoryListener,
-                                             OpendaylightFlowStatisticsListener,
-                                             OpendaylightFlowTableStatisticsListener,
-                                             OpendaylightPortStatisticsListener {
-
-    private static val LOG = LoggerFactory.getLogger(InventoryAndReadAdapter);
-
-    private static val OPENFLOWV10_TABLE_ID = new Integer(0).shortValue;
-    @Property
-    DataBrokerService dataService;
-
-    @Property
-    DataProviderService dataProviderService;
-
-    @Property
-    OpendaylightFlowStatisticsService flowStatisticsService;
-
-    @Property
-    OpendaylightPortStatisticsService nodeConnectorStatisticsService;
-    
-    @Property
-    OpendaylightFlowTableStatisticsService flowTableStatisticsService;
-
-    @Property
-    FlowTopologyDiscoveryService topologyDiscovery;
-    
-    @Property
-    List<IPluginOutReadService> statisticsPublisher = new CopyOnWriteArrayList<IPluginOutReadService>();
-
-    @Property
-    List<IPluginOutInventoryService> inventoryPublisher = new CopyOnWriteArrayList<IPluginOutInventoryService>();
-
-    private final InventoryNotificationProvider inventoryNotificationProvider = new InventoryNotificationProvider();
-
-    private final Map<InstanceIdentifier.PathArgument, List<InstanceIdentifier.PathArgument>> nodeToNodeConnectorsMap = new ConcurrentHashMap<InstanceIdentifier.PathArgument, List<InstanceIdentifier.PathArgument>>();
-
-    private final Lock nodeToNodeConnectorsLock = new ReentrantLock();
-
-
-    def startAdapter(){
-        inventoryNotificationProvider.dataProviderService = dataProviderService;
-        inventoryNotificationProvider.inventoryPublisher = inventoryPublisher;
-        // inventoryNotificationProvider.start();
-    }
-
-    def start(){
-    }
-
-    def setInventoryPublisher(IPluginOutInventoryService listener){
-        inventoryPublisher.add(listener);
-    }
-
-    def unsetInventoryPublisher(IPluginOutInventoryService listener){
-        inventoryPublisher.remove(listener);
-    }
-
-    def setReadPublisher(IPluginOutReadService listener) {
-        statisticsPublisher.add(listener);
-    }
-    
-    def unsetReadPublisher (IPluginOutReadService listener) {
-        if( listener != null)
-            statisticsPublisher.remove(listener);
-    }
-
-    protected def startChange() {
-        return dataProviderService.beginTransaction;
-    }
-
-    override getTransmitRate(org.opendaylight.controller.sal.core.NodeConnector connector) {
-        val nodeConnector = readFlowCapableNodeConnector(connector.toNodeConnectorRef);
-        return nodeConnector.currentSpeed
-    }
-
-    override readAllFlow(Node node, boolean cached) {
-
-        val output = new ArrayList<FlowOnNode>();
-        val tableRef = InstanceIdentifier.builder(Nodes)
-                                        .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(node))
-                                        .augmentation(FlowCapableNode).child(Table, new TableKey(OPENFLOWV10_TABLE_ID)).toInstance();
-        
-        val it = this.startChange();
-        
-        val table= it.readConfigurationData(tableRef) as Table;
-        
-        if(table != null){
-            LOG.trace("Number of flows installed in table 0 of node {} : {}",node,table.flow.size);
-            
-            for(flow : table.flow){
-                
-                val adsalFlow = ToSalConversionsUtils.toFlow(flow,node);
-                val statsFromDataStore = flow.getAugmentation(FlowStatisticsData);
-                
-                if(statsFromDataStore != null){
-                    val it = new FlowOnNode(adsalFlow);
-                    byteCount =  statsFromDataStore.flowStatistics.byteCount.value.longValue;
-                    packetCount = statsFromDataStore.flowStatistics.packetCount.value.longValue;
-                    durationSeconds = statsFromDataStore.flowStatistics.duration.second.value.intValue;
-                    durationNanoseconds = statsFromDataStore.flowStatistics.duration.nanosecond.value.intValue;
-                    
-                    output.add(it);
-                }
-            }
-        }
-        
-        //TODO (main): Shell we send request to the switch? It will make async request to the switch.
-        // Once plugin receive response, it will let adaptor know through onFlowStatisticsUpdate()
-        // If we assume that md-sal statistics manager will always be running, then its not required
-        // But if not, then sending request will collect the latest data for adaptor atleast.
-        val input = new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder;
-        input.setNode(node.toNodeRef);
-        flowStatisticsService.getAllFlowsStatisticsFromAllFlowTables(input.build)
-        
-        return output;
-    }
-
-    override readAllNodeConnector(Node node, boolean cached) {
-        
-        val ret = new ArrayList<NodeConnectorStatistics>();
-        val nodeRef = InstanceIdentifier.builder(Nodes)
-                                    .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(node))
-                                    .toInstance();
-        
-        val provider = this.startChange();
-        
-        val dsNode= provider.readConfigurationData(nodeRef) as org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-        
-         if(dsNode != null){
-             
-             for (dsNodeConnector : dsNode.nodeConnector){
-                val nodeConnectorRef = InstanceIdentifier.builder(Nodes)
-                                    .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(node))
-                                    .child(NodeConnector, dsNodeConnector.key)
-                                    .toInstance();
-                 
-                 val nodeConnectorFromDS = provider.readConfigurationData(nodeConnectorRef) as NodeConnector;
-                 
-                 if(nodeConnectorFromDS != null){
-                     val nodeConnectorStatsFromDs = nodeConnectorFromDS.getAugmentation(FlowCapableNodeConnectorStatisticsData) as FlowCapableNodeConnectorStatistics;
-                     
-                    ret.add(toNodeConnectorStatistics(nodeConnectorStatsFromDs.flowCapableNodeConnectorStatistics,dsNode.id,dsNodeConnector.id));
-                 }
-             }
-         }
-
-        //TODO: Refer TODO (main)
-        val input = new GetAllNodeConnectorsStatisticsInputBuilder();
-        input.setNode(node.toNodeRef);
-        nodeConnectorStatisticsService.getAllNodeConnectorsStatistics(input.build());
-        return ret;
-    }
-
-    override readAllNodeTable(Node node, boolean cached) {
-        val ret = new ArrayList<NodeTableStatistics>();
-        
-        val dsFlowCapableNode= readFlowCapableNode(node.toNodeRef)
-        
-         if(dsFlowCapableNode != null){
-             
-             for (table : dsFlowCapableNode.table){
-                 
-                 val tableStats = table.getAugmentation(FlowTableStatisticsData);
-                 
-                 if(tableStats != null){
-                     ret.add(toNodeTableStatistics(tableStats.flowTableStatistics,table.id,node));
-                 }
-             }
-         }
-
-        //TODO: Refer TODO (main)
-        val input = new GetFlowTablesStatisticsInputBuilder();
-        input.setNode(node.toNodeRef);
-        flowTableStatisticsService.getFlowTablesStatistics(input.build);
-        return ret;
-    }
-
-    override readDescription(Node node, boolean cached) {
-        return toNodeDescription(node.toNodeRef);
-    }
-
-    override readFlow(Node node, Flow targetFlow, boolean cached) {
-        var FlowOnNode ret= null;
-        
-        val tableRef = InstanceIdentifier.builder(Nodes)
-                                        .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(node))
-                                        .augmentation(FlowCapableNode).child(Table, new TableKey(OPENFLOWV10_TABLE_ID)).toInstance();
-        
-        val it = this.startChange();
-        
-        val table= it.readConfigurationData(tableRef) as Table;
-        
-        if(table != null){
-            LOG.trace("Number of flows installed in table 0 of node {} : {}",node,table.flow.size);
-            
-            for(mdsalFlow : table.flow){
-                if(FromSalConversionsUtils.flowEquals(mdsalFlow, MDFlowMapping.toMDSalflow(targetFlow))){
-                    val statsFromDataStore = mdsalFlow.getAugmentation(FlowStatisticsData);
-                    
-                    if(statsFromDataStore != null){
-                        LOG.debug("Found matching flow in the data store flow table ");
-                        val it = new FlowOnNode(targetFlow);
-                        byteCount =  statsFromDataStore.flowStatistics.byteCount.value.longValue;
-                        packetCount = statsFromDataStore.flowStatistics.packetCount.value.longValue;
-                        durationSeconds = statsFromDataStore.flowStatistics.duration.second.value.intValue;
-                        durationNanoseconds = statsFromDataStore.flowStatistics.duration.nanosecond.value.intValue;
-                        
-                        ret = it;
-                    }
-                }            
-